- use backend's collision struct in SW.

This commit is contained in:
Christoph Oelckers 2021-11-26 15:14:10 +01:00
parent b3bbf8932e
commit 30f36e4871
12 changed files with 81 additions and 159 deletions

View file

@ -78,7 +78,7 @@ bool ActorMoveHitReact(DSWActor* actor)
auto coll = u->coll; auto coll = u->coll;
if (coll.type == kHitSprite) if (coll.type == kHitSprite)
{ {
auto hitActor = coll.actor; auto hitActor = coll.actor();
if (hitActor->hasU() && hitActor->u()->PlayerP) if (hitActor->hasU() && hitActor->u()->PlayerP)
{ {
// if you ran into a player - call close range functions // if you ran into a player - call close range functions

View file

@ -228,7 +228,7 @@ int DoShadowFindGroundPoint(tspriteptr_t sp)
{ {
case kHitSprite: case kHitSprite:
{ {
hsp = &florhit.actor->s(); hsp = &florhit.actor()->s();
if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_FLOOR)) if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_FLOOR))
{ {

View file

@ -58,29 +58,10 @@ EXTERN_CVAR(Bool, sw_bunnyrockets)
BEGIN_SW_NS BEGIN_SW_NS
// Wrapper around the insane collision info mess from Build.
class DSWActor; class DSWActor;
struct Collision using HitInfo = THitInfo<DSWActor>;
{ using Collision = TCollision<DSWActor>;
int type;
int index;
int legacyVal; // should be removed later, but needed for converting back for unadjusted code.
DSWActor* actor;
Collision() = default;
explicit Collision(int legacyval) { setFromEngine(legacyval); }
void invalidate() { type = -1; } // something invalid that's not a valid hit type.
int setNone();
int setSector(int num);
int setWall(int num);
int setSprite(DSWActor* num);
int setSky();
int setFromEngine(int value);
walltype* wall() const { assert(type == kHitWall); return &::wall[index]; }
sectortype* sector() const { assert(type == kHitSector); return &::sector[index]; }
};
typedef struct typedef struct
{ {
@ -1059,7 +1040,6 @@ struct ROTATOR
}; };
using ROTATORp = ROTATOR*; using ROTATORp = ROTATOR*;
struct Collision;
// //
// User Extension record // User Extension record
@ -1917,9 +1897,6 @@ inline bool FAF_ConnectArea(sectortype* sect)
bool PlayerCeilingHit(PLAYERp pp, int zlimit); bool PlayerCeilingHit(PLAYERp pp, int zlimit);
bool PlayerFloorHit(PLAYERp pp, int zlimit); bool PlayerFloorHit(PLAYERp pp, int zlimit);
class DSWActor;
using HitInfo = THitInfo<DSWActor>;
void FAFhitscan(int32_t x, int32_t y, int32_t z, sectortype* sectnum, void FAFhitscan(int32_t x, int32_t y, int32_t z, sectortype* sectnum,
int32_t xvect, int32_t yvect, int32_t zvect, int32_t xvect, int32_t yvect, int32_t zvect,
HitInfo& hit, int32_t clipmask); HitInfo& hit, int32_t clipmask);
@ -1936,12 +1913,6 @@ void FAFgetzrangepoint(int32_t x, int32_t y, int32_t z, sectortype* sect,
int32_t* loz, Collision* florhit); int32_t* loz, Collision* florhit);
void short_setinterpolation(short *posptr);
void short_stopinterpolation(short *posptr);
void short_updateinterpolations(void);
void short_dointerpolations(int smoothratio);
void short_restoreinterpolations(void);
enum SoundType enum SoundType
{ {
SOUND_OBJECT_TYPE, SOUND_OBJECT_TYPE,

View file

@ -410,7 +410,7 @@ int DoBloodSpray(DSWActor* actor)
case kHitSprite: case kHitSprite:
{ {
short wall_ang; short wall_ang;
auto hitActor = u->coll.actor; auto hitActor = u->coll.actor();
SPRITEp hsp = &hitActor->s(); SPRITEp hsp = &hitActor->s();
if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL))
@ -440,7 +440,7 @@ int DoBloodSpray(DSWActor* actor)
WALLp wph; WALLp wph;
short wb; short wb;
wph = u->coll.wall(); wph = u->coll.hitWall;
if (wph->lotag == TAG_WALL_BREAK) if (wph->lotag == TAG_WALL_BREAK)
{ {
@ -613,7 +613,7 @@ int DoPhosphorus(DSWActor* actor)
USERp hu; USERp hu;
auto hitActor = u->coll.actor; auto hitActor = u->coll.actor();
hsp = &hitActor->s(); hsp = &hitActor->s();
hu = hitActor->u(); hu = hitActor->u();
@ -648,7 +648,7 @@ int DoPhosphorus(DSWActor* actor)
short hit_wall, nw, wall_ang; short hit_wall, nw, wall_ang;
WALLp wph; WALLp wph;
wph = u->coll.wall(); wph = u->coll.hitWall;
if (wph->lotag == TAG_WALL_BREAK) if (wph->lotag == TAG_WALL_BREAK)
{ {
@ -858,7 +858,7 @@ int DoChemBomb(DSWActor* actor)
case kHitWall: case kHitWall:
{ {
auto wph = u->coll.wall(); auto wph = u->coll.hitWall;
if (wph->lotag == TAG_WALL_BREAK) if (wph->lotag == TAG_WALL_BREAK)
{ {
@ -1062,7 +1062,7 @@ int DoCaltrops(DSWActor* actor)
PlaySound(DIGI_CALTROPS, actor, v3df_dontpan); PlaySound(DIGI_CALTROPS, actor, v3df_dontpan);
auto hitActor = u->coll.actor; auto hitActor = u->coll.actor();
auto hsp = &hitActor->s(); auto hsp = &hitActor->s();
if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL))
@ -1083,7 +1083,7 @@ int DoCaltrops(DSWActor* actor)
case kHitWall: case kHitWall:
{ {
auto wph = u->coll.wall(); auto wph = u->coll.hitWall;
if (wph->lotag == TAG_WALL_BREAK) if (wph->lotag == TAG_WALL_BREAK)
{ {

View file

@ -1886,20 +1886,20 @@ void DoPlayerZrange(PLAYERp pp)
if (ceilColl.type == kHitSprite) if (ceilColl.type == kHitSprite)
{ {
pp->highActor = ceilColl.actor; pp->highActor = ceilColl.actor();
} }
else else
{ {
pp->hi_sectp = ceilColl.sector(); pp->hi_sectp = ceilColl.hitSector;
} }
if (floorColl.type == kHitSprite) if (floorColl.type == kHitSprite)
{ {
pp->lowActor = floorColl.actor; pp->lowActor = floorColl.actor();
// prevent player from standing on Zombies // prevent player from standing on Zombies
auto fsp = &floorColl.actor->s(); auto fsp = &floorColl.actor()->s();
if (fsp->statnum == STAT_ENEMY && floorColl.actor->u()->ID == ZOMBIE_RUN_R0) if (fsp->statnum == STAT_ENEMY && floorColl.actor()->u()->ID == ZOMBIE_RUN_R0)
{ {
pp->lo_sectp = fsp->sector(); pp->lo_sectp = fsp->sector();
pp->loz = fsp->z; pp->loz = fsp->z;
@ -1908,7 +1908,7 @@ void DoPlayerZrange(PLAYERp pp)
} }
else else
{ {
pp->lo_sectp = floorColl.sector(); pp->lo_sectp = floorColl.hitSector;
} }
} }
@ -5992,7 +5992,7 @@ void DoPlayerDeathMoveHead(PLAYERp pp)
//PlaySound(DIGI_DHCLUNK, pp, v3df_dontpan); //PlaySound(DIGI_DHCLUNK, pp, v3df_dontpan);
auto hit_sprite = u->coll.actor; auto hit_sprite = u->coll.actor();
hsp = &hit_sprite->s(); hsp = &hit_sprite->s();
if (!TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) if (!TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL))
@ -6008,7 +6008,7 @@ void DoPlayerDeathMoveHead(PLAYERp pp)
} }
case kHitWall: case kHitWall:
{ {
int wall_ang = NORM_ANGLE(getangle(u->coll.wall()->delta())-512); int wall_ang = NORM_ANGLE(getangle(u->coll.hitWall->delta())-512);
int dang = getincangle(wall_ang, u->slide_ang); int dang = getincangle(wall_ang, u->slide_ang);
u->slide_ang = NORM_ANGLE(wall_ang + 1024 - dang); u->slide_ang = NORM_ANGLE(wall_ang + 1024 - dang);

View file

@ -1021,7 +1021,7 @@ int DoRipperMoveHang(DSWActor* actor)
u->WaitTics = 2 + ((RANDOM_P2(4 << 8) >> 8) * 120); u->WaitTics = 2 + ((RANDOM_P2(4 << 8) >> 8) * 120);
// hang flush with the wall // hang flush with the wall
sp->ang = NORM_ANGLE(getangle(u->coll.wall()->delta()) - 512); sp->ang = NORM_ANGLE(getangle(u->coll.hitWall->delta()) - 512);
return 0; return 0;
} }

View file

@ -1035,7 +1035,7 @@ int DoRipper2MoveHang(DSWActor* actor)
u->WaitTics = 0; // Double jump u->WaitTics = 0; // Double jump
// hang flush with the wall // hang flush with the wall
sp->ang = NORM_ANGLE(getangle(u->coll.wall()->delta()) - 512); sp->ang = NORM_ANGLE(getangle(u->coll.hitWall->delta()) - 512);
return 0; return 0;
} }

View file

@ -355,7 +355,7 @@ bool SectorZadjust(const Collision& ceilhit, int32_t* hiz, const Collision& flor
{ {
case kHitSector: case kHitSector:
{ {
auto hit_sector = florhit.sector(); auto hit_sector = florhit.hitSector;
// don't jack with connect sectors // don't jack with connect sectors
if (FAF_ConnectFloor(hit_sector)) if (FAF_ConnectFloor(hit_sector))
@ -409,7 +409,7 @@ bool SectorZadjust(const Collision& ceilhit, int32_t* hiz, const Collision& flor
{ {
case kHitSector: case kHitSector:
{ {
auto hit_sector = ceilhit.sector(); auto hit_sector = ceilhit.hitSector;
// don't jack with connect sectors // don't jack with connect sectors
if (FAF_ConnectCeiling(hit_sector)) if (FAF_ConnectCeiling(hit_sector))
@ -460,7 +460,7 @@ void WaterAdjust(const Collision& florhit, int32_t* loz)
{ {
if (florhit.type == kHitSector) if (florhit.type == kHitSector)
{ {
auto sect = florhit.sector(); auto sect = florhit.hitSector;
if (!sect->hasU()) return; if (!sect->hasU()) return;
if (sect->hasU() && FixedToInt(sect->depth_fixed)) if (sect->hasU() && FixedToInt(sect->depth_fixed))

View file

@ -843,7 +843,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, USER& w, USER* def
("sz", w.sz, def->sz) ("sz", w.sz, def->sz)
("sang", w.sang, def->sang) ("sang", w.sang, def->sang)
("spal", w.spal, def->spal) ("spal", w.spal, def->spal)
("ret", w.coll.legacyVal, def->coll.legacyVal) // is this needed? //("ret", w.coll, def->coll) // is this needed?
("Flag1", w.Flag1, def->Flag1) ("Flag1", w.Flag1, def->Flag1)
("LastWeaponNum", w.LastWeaponNum, def->LastWeaponNum) ("LastWeaponNum", w.LastWeaponNum, def->LastWeaponNum)
("WeaponNum", w.WeaponNum, def->WeaponNum) ("WeaponNum", w.WeaponNum, def->WeaponNum)
@ -864,7 +864,6 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, USER& w, USER* def
if (arc.isReading()) if (arc.isReading())
{ {
w.oangdiff = 0; w.oangdiff = 0;
SetCollision(&w, w.coll.legacyVal);
} }
} }
return arc; return arc;

View file

@ -4613,10 +4613,10 @@ void DoActorZrange(DSWActor* actor)
switch (ceilhit.type) switch (ceilhit.type)
{ {
case kHitSprite: case kHitSprite:
u->highActor = ceilhit.actor; u->highActor = ceilhit.actor();
break; break;
case kHitSector: case kHitSector:
u->hi_sectp = ceilhit.sector(); u->hi_sectp = ceilhit.hitSector;
break; break;
default: default:
ASSERT(true==false); ASSERT(true==false);
@ -4626,10 +4626,10 @@ void DoActorZrange(DSWActor* actor)
switch (florhit.type) switch (florhit.type)
{ {
case kHitSprite: case kHitSprite:
u->lowActor = florhit.actor; u->lowActor = florhit.actor();
break; break;
case kHitSector: case kHitSector:
u->lo_sectp = florhit.sector(); u->lo_sectp = florhit.hitSector;
break; break;
default: default:
ASSERT(true==false); ASSERT(true==false);
@ -4654,20 +4654,20 @@ int DoActorGlobZ(DSWActor* actor)
switch (globhihit.type) switch (globhihit.type)
{ {
case kHitSprite: case kHitSprite:
u->highActor = globhihit.actor; u->highActor = globhihit.actor();
break; break;
default: default:
u->hi_sectp = globhihit.sector(); u->hi_sectp = globhihit.hitSector;
break; break;
} }
switch (globlohit.type) switch (globlohit.type)
{ {
case kHitSprite: case kHitSprite:
u->lowActor = globlohit.actor; u->lowActor = globlohit.actor();
break; break;
default: default:
u->lo_sectp = globlohit.sector(); u->lo_sectp = globlohit.hitSector;
break; break;
} }
@ -4697,7 +4697,7 @@ bool ActorDrop(DSWActor* actor, int x, int y, int z, sectortype* new_sector, sho
{ {
case kHitSprite: case kHitSprite:
{ {
SPRITEp hsp = &florhit.actor->s(); SPRITEp hsp = &florhit.actor()->s();
// if its a floor sprite and not too far down // if its a floor sprite and not too far down
if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_FLOOR) && if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_FLOOR) &&
@ -6449,7 +6449,7 @@ void SpriteControl(void)
Collision move_sprite(DSWActor* actor, int xchange, int ychange, int zchange, int ceildist, int flordist, uint32_t cliptype, int numtics) Collision move_sprite(DSWActor* actor, int xchange, int ychange, int zchange, int ceildist, int flordist, uint32_t cliptype, int numtics)
{ {
Collision retval(0); Collision retval{};
int zh; int zh;
int dasectnum; int dasectnum;
short tempshort; short tempshort;
@ -6660,7 +6660,7 @@ Collision move_missile(DSWActor* actor, int xchange, int ychange, int zchange, i
{ {
USERp u = actor->u(); USERp u = actor->u();
SPRITEp sp = &actor->s(); SPRITEp sp = &actor->s();
Collision retval(0); Collision retval{};
int zh; int zh;
int dasectnum, tempshort; int dasectnum, tempshort;
short lastsectnum; short lastsectnum;
@ -6692,7 +6692,7 @@ Collision move_missile(DSWActor* actor, int xchange, int ychange, int zchange, i
if (dasectnum < 0) if (dasectnum < 0)
{ {
// we've gone beyond a white wall - kill it // we've gone beyond a white wall - kill it
retval.setSky(); retval.setVoid();
return retval; return retval;
} }
retval.setFromEngine(cmret); retval.setFromEngine(cmret);
@ -6767,7 +6767,7 @@ Collision move_missile(DSWActor* actor, int xchange, int ychange, int zchange, i
{ {
if (sp->z < sp->sector()->ceilingz) if (sp->z < sp->sector()->ceilingz)
{ {
retval.setSky(); retval.setVoid();
} }
} }
@ -6775,7 +6775,7 @@ Collision move_missile(DSWActor* actor, int xchange, int ychange, int zchange, i
{ {
if (sp->z > sp->sector()->floorz) if (sp->z > sp->sector()->floorz)
{ {
retval.setSky(); retval.setVoid();
} }
} }
@ -6788,7 +6788,7 @@ Collision move_ground_missile(DSWActor* actor, int xchange, int ychange, int cei
USERp u = actor->u(); USERp u = actor->u();
SPRITEp sp = &actor->s(); SPRITEp sp = &actor->s();
int daz; int daz;
Collision retval(0); Collision retval{};
int dasectnum; int dasectnum;
short lastsectnum; short lastsectnum;
int ox,oy; int ox,oy;
@ -6843,7 +6843,7 @@ Collision move_ground_missile(DSWActor* actor, int xchange, int ychange, int cei
if (dasectnum < 0) if (dasectnum < 0)
{ {
// we've gone beyond a white wall - kill it // we've gone beyond a white wall - kill it
retval.setSky(); retval.setVoid();
return retval; return retval;
} }
@ -6873,7 +6873,7 @@ Collision move_ground_missile(DSWActor* actor, int xchange, int ychange, int cei
if (labs(u->hiz - u->loz) < Z(12)) if (labs(u->hiz - u->loz) < Z(12))
{ {
// we've gone into a very small place - kill it // we've gone into a very small place - kill it
retval.setSky(); retval.setVoid();
return retval; return retval;
} }

View file

@ -138,54 +138,6 @@ public:
}; };
inline int Collision::setNone()
{
type = kHitNone;
index = -1;
legacyVal = 0;
actor = nullptr;
return kHitNone;
}
inline int Collision::setSector(int num)
{
type = kHitSector;
index = num;
legacyVal = type | index;
actor = nullptr;
return kHitSector;
}
inline int Collision::setWall(int num)
{
type = kHitWall;
index = num;
legacyVal = type | index;
actor = nullptr;
return kHitWall;
}
inline int Collision::setSprite(DSWActor* num)
{
type = kHitSprite;
index = -1;
legacyVal = type | int(num - swActors);
actor = num;
return kHitSprite;
}
int Collision::setSky() { setNone(); type = kHitVoid; return kHitVoid; }
inline int Collision::setFromEngine(int value)
{
legacyVal = value;
type = value & kHitTypeMaskSW;
if (type == 0) { index = -1; actor = nullptr; }
else if (type != kHitSprite) { index = value & kHitIndexMask; actor = nullptr; }
else { index = -1; actor = &swActors[value & kHitIndexMask]; }
return type;
}
inline FSerializer& Serialize(FSerializer& arc, const char* keyname, DSWActor*& w, DSWActor** def) inline FSerializer& Serialize(FSerializer& arc, const char* keyname, DSWActor*& w, DSWActor** def)
{ {
int index = w? int(w - swActors) : -1; int index = w? int(w - swActors) : -1;

View file

@ -3834,9 +3834,9 @@ int DoVomit(DSWActor* actor)
if (u->coll.type == kHitSprite) if (u->coll.type == kHitSprite)
{ {
if (TEST(u->coll.actor->s().extra, SPRX_PLAYER_OR_ENEMY)) if (TEST(u->coll.actor()->s().extra, SPRX_PLAYER_OR_ENEMY))
{ {
DoDamage(u->coll.actor, actor); DoDamage(u->coll.actor(), actor);
} }
} }
return 0; return 0;
@ -4223,7 +4223,7 @@ bool VehicleMoveHit(DSWActor* actor)
{ {
case kHitSector: case kHitSector:
{ {
SECTORp sectp = u->coll.sector(); SECTORp sectp = u->coll.hitSector;
if (TEST(sectp->extra, SECTFX_SECTOR_OBJECT)) if (TEST(sectp->extra, SECTFX_SECTOR_OBJECT))
{ {
@ -4235,7 +4235,7 @@ bool VehicleMoveHit(DSWActor* actor)
case kHitSprite: case kHitSprite:
{ {
auto hitActor = u->coll.actor; auto hitActor = u->coll.actor();
SPRITEp hsp = &hitActor->s(); SPRITEp hsp = &hitActor->s();
if (TEST(hsp->extra, SPRX_BREAKABLE)) if (TEST(hsp->extra, SPRX_BREAKABLE))
@ -4266,7 +4266,7 @@ bool VehicleMoveHit(DSWActor* actor)
case kHitWall: case kHitWall:
{ {
auto wph = u->coll.wall(); auto wph = u->coll.hitWall;
if (TEST(wph->extra, WALLFX_SECTOR_OBJECT)) if (TEST(wph->extra, WALLFX_SECTOR_OBJECT))
{ {
@ -4309,7 +4309,7 @@ bool WeaponMoveHit(DSWActor* actor)
SECTORp sectp; SECTORp sectp;
SECTOR_OBJECTp sop; SECTOR_OBJECTp sop;
sectp = u->coll.sector(); sectp = u->coll.hitSector;
ASSERT(sectp->extra != -1); ASSERT(sectp->extra != -1);
@ -4377,7 +4377,7 @@ bool WeaponMoveHit(DSWActor* actor)
SPRITEp hsp; SPRITEp hsp;
USERp hu; USERp hu;
auto hitActor = u->coll.actor; auto hitActor = u->coll.actor();
hsp = &hitActor->s(); hsp = &hitActor->s();
hu = hitActor->u(); hu = hitActor->u();
@ -4453,7 +4453,7 @@ bool WeaponMoveHit(DSWActor* actor)
case kHitWall: case kHitWall:
{ {
auto wph = u->coll.wall(); auto wph = u->coll.hitWall;
SECTOR_OBJECTp sop; SECTOR_OBJECTp sop;
ASSERT(wph->extra != -1); ASSERT(wph->extra != -1);
@ -7602,7 +7602,7 @@ int DoStar(DSWActor* actor)
short nw,wall_ang; short nw,wall_ang;
WALLp wph; WALLp wph;
wph = u->coll.wall(); wph = u->coll.hitWall;
if (wph->lotag == TAG_WALL_BREAK) if (wph->lotag == TAG_WALL_BREAK)
{ {
@ -7649,7 +7649,7 @@ int DoStar(DSWActor* actor)
case kHitSector: case kHitSector:
{ {
bool did_hit_wall; bool did_hit_wall;
auto hit_sect = u->coll.sector(); auto hit_sect = u->coll.hitSector;
if (sp->z > ((u->hiz + u->loz) >> 1)) if (sp->z > ((u->hiz + u->loz) >> 1))
{ {
@ -7735,9 +7735,9 @@ int DoStar(DSWActor* actor)
if (u->coll.type != kHitNone) if (u->coll.type != kHitNone)
{ {
if (u->coll.type == kHitSprite && u->coll.actor->hasU()) if (u->coll.type == kHitSprite && u->coll.actor()->hasU())
{ {
su = u->coll.actor->u(); su = u->coll.actor()->u();
if (su->ID == TRASHCAN || su->ID == ZILLA_RUN_R0) if (su->ID == TRASHCAN || su->ID == ZILLA_RUN_R0)
PlaySound(DIGI_STARCLINK, actor, v3df_none); PlaySound(DIGI_STARCLINK, actor, v3df_none);
} }
@ -8239,7 +8239,7 @@ int DoPlasma(DSWActor* actor)
// if hit a player/enemy back up and do it again with blocking reset // if hit a player/enemy back up and do it again with blocking reset
if (u->coll.type == kHitSprite) if (u->coll.type == kHitSprite)
{ {
auto hitActor = u->coll.actor; auto hitActor = u->coll.actor();
SPRITEp hsp = &hitActor->s(); SPRITEp hsp = &hitActor->s();
USERp hu = hitActor->u(); USERp hu = hitActor->u();
@ -8379,7 +8379,7 @@ bool SlopeBounce(DSWActor* actor, bool *hit_wall)
int dax,day,daz; int dax,day,daz;
short daang; short daang;
auto hit_sector = u->coll.sector(); auto hit_sector = u->coll.hitSector;
getzsofslopeptr(hit_sector, sp->x, sp->y, &hiz, &loz); getzsofslopeptr(hit_sector, sp->x, sp->y, &hiz, &loz);
@ -8480,7 +8480,7 @@ int DoGrenade(DSWActor* actor)
PlaySound(DIGI_40MMBNCE, actor, v3df_dontpan); PlaySound(DIGI_40MMBNCE, actor, v3df_dontpan);
auto hitActor = u->coll.actor; auto hitActor = u->coll.actor();
hsp = &hitActor->s(); hsp = &hitActor->s();
// special case so grenade can ring gong // special case so grenade can ring gong
@ -8520,7 +8520,7 @@ int DoGrenade(DSWActor* actor)
short nw,wall_ang; short nw,wall_ang;
WALLp wph; WALLp wph;
wph = u->coll.wall(); wph = u->coll.hitWall;
if (wph->lotag == TAG_WALL_BREAK) if (wph->lotag == TAG_WALL_BREAK)
{ {
@ -8709,7 +8709,7 @@ int DoVulcanBoulder(DSWActor* actor)
short wall_ang; short wall_ang;
SPRITEp hsp; SPRITEp hsp;
auto hitActor = u->coll.actor; auto hitActor = u->coll.actor();
hsp = &hitActor->s(); hsp = &hitActor->s();
if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL))
@ -8733,7 +8733,7 @@ int DoVulcanBoulder(DSWActor* actor)
short nw,wall_ang; short nw,wall_ang;
WALLp wph; WALLp wph;
wph = u->coll.wall(); wph = u->coll.hitWall;
if (wph->lotag == TAG_WALL_BREAK) if (wph->lotag == TAG_WALL_BREAK)
{ {
@ -9091,7 +9091,7 @@ int DoMine(DSWActor* actor)
return 0; return 0;
case kHitSprite: case kHitSprite:
{ {
auto hitActor = u->coll.actor; auto hitActor = u->coll.actor();
SPRITEp hsp = &hitActor->s(); SPRITEp hsp = &hitActor->s();
USERp hu = hitActor->u(); USERp hu = hitActor->u();
@ -9159,7 +9159,7 @@ int DoMine(DSWActor* actor)
case kHitWall: case kHitWall:
{ {
auto hit_wall = u->coll.wall(); auto hit_wall = u->coll.hitWall;
if (hit_wall->lotag == TAG_WALL_BREAK) if (hit_wall->lotag == TAG_WALL_BREAK)
{ {
@ -9188,7 +9188,7 @@ int DoMine(DSWActor* actor)
case kHitSector: case kHitSector:
{ {
auto hit_sect = u->coll.sector(); auto hit_sect = u->coll.hitSector;
SetMineStuck(actor); SetMineStuck(actor);
@ -9525,7 +9525,7 @@ int DoRail(DSWActor* actor)
{ {
if (u->coll.type == kHitSprite) if (u->coll.type == kHitSprite)
{ {
auto hitActor = u->coll.actor; auto hitActor = u->coll.actor();
auto hs = &hitActor->s(); auto hs = &hitActor->s();
if (hs->extra & SPRX_PLAYER_OR_ENEMY) if (hs->extra & SPRX_PLAYER_OR_ENEMY)
@ -9967,7 +9967,7 @@ int DoElectro(DSWActor* actor)
{ {
case kHitSprite: case kHitSprite:
{ {
auto hitActor = u->coll.actor; auto hitActor = u->coll.actor();
SPRITEp hsp = &hitActor->s(); SPRITEp hsp = &hitActor->s();
USERp hu = hitActor->u(); USERp hu = hitActor->u();
@ -11147,8 +11147,8 @@ int DoFireball(DSWActor* actor)
if (TEST(hsp->extra, SPRX_BURNABLE)) if (TEST(hsp->extra, SPRX_BURNABLE))
{ {
if (!hu) if (!hu)
hu = SpawnUser(u->coll.actor, hsp->picnum, nullptr); hu = SpawnUser(u->coll.actor(), hsp->picnum, nullptr);
SpawnFireballFlames(actor, u->coll.actor); SpawnFireballFlames(actor, u->coll.actor());
hit_burn = true; hit_burn = true;
} }
@ -11191,7 +11191,7 @@ int DoFindGround(DSWActor* actor)
{ {
case kHitSprite: case kHitSprite:
{ {
auto florActor = florhit.actor; auto florActor = florhit.actor();
hsp = &florActor->s(); hsp = &florActor->s();
if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_FLOOR)) if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_FLOOR))
@ -11215,7 +11215,7 @@ int DoFindGround(DSWActor* actor)
} }
case kHitSector: case kHitSector:
{ {
u->lo_sectp = florhit.sector(); u->lo_sectp = florhit.hitSector;
u->lowActor = nullptr; u->lowActor = nullptr;
return true; return true;
} }
@ -11248,7 +11248,7 @@ int DoFindGroundPoint(DSWActor* actor)
{ {
case kHitSprite: case kHitSprite:
{ {
auto florActor = florhit.actor; auto florActor = florhit.actor();
hsp = &florActor->s(); hsp = &florActor->s();
if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_FLOOR)) if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_FLOOR))
@ -11272,7 +11272,7 @@ int DoFindGroundPoint(DSWActor* actor)
} }
case kHitSector: case kHitSector:
{ {
u->lo_sectp = florhit.sector(); u->lo_sectp = florhit.hitSector;
u->lowActor = nullptr; u->lowActor = nullptr;
return true; return true;
} }
@ -11321,7 +11321,7 @@ int DoNapalm(DSWActor* actor)
// if hit a player/enemy back up and do it again with blocking reset // if hit a player/enemy back up and do it again with blocking reset
if (u->coll.type == kHitSprite) if (u->coll.type == kHitSprite)
{ {
SPRITEp hsp = &u->coll.actor->s(); SPRITEp hsp = &u->coll.actor()->s();
if (TEST(hsp->cstat, CSTAT_SPRITE_BLOCK) && !TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) if (TEST(hsp->cstat, CSTAT_SPRITE_BLOCK) && !TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL))
{ {
@ -11503,8 +11503,8 @@ int DoSerpMeteor(DSWActor* actor)
// if hit a player/enemy back up and do it again with blocking reset // if hit a player/enemy back up and do it again with blocking reset
if (u->coll.type == kHitSprite) if (u->coll.type == kHitSprite)
{ {
SPRITEp hsp = &u->coll.actor->s(); SPRITEp hsp = &u->coll.actor()->s();
USERp hu = u->coll.actor->u(); USERp hu = u->coll.actor()->u();
if (hu && hu->ID >= SKULL_R0 && hu->ID <= SKULL_SERP) if (hu && hu->ID >= SKULL_R0 && hu->ID <= SKULL_SERP)
{ {
@ -14891,7 +14891,7 @@ int InitGoroChop(DSWActor* actor)
int InitHornetSting(DSWActor* actor) int InitHornetSting(DSWActor* actor)
{ {
DoDamage(actor->u()->coll.actor, actor); DoDamage(actor->u()->coll.actor(), actor);
InitActorReposition(actor); InitActorReposition(actor);
return 0; return 0;
} }
@ -18238,7 +18238,7 @@ bool MissileHitDiveArea(DSWActor* actor)
if (u->coll.type == kHitSector) if (u->coll.type == kHitSector)
{ {
auto hit_sect = u->coll.sector(); auto hit_sect = u->coll.hitSector;
if (SpriteInDiveArea(sp)) if (SpriteInDiveArea(sp))
{ {
@ -18534,7 +18534,7 @@ bool TestDontStick(DSWActor* actor, walltype* hit_wall)
ASSERT(actor != nullptr); ASSERT(actor != nullptr);
USERp u = actor->u(); USERp u = actor->u();
if (u->coll.type != kHitWall) return true; // ain't got a wall here. if (u->coll.type != kHitWall) return true; // ain't got a wall here.
hit_wall = u->coll.wall(); hit_wall = u->coll.hitWall;
} }
wp = hit_wall; wp = hit_wall;
@ -19201,7 +19201,7 @@ int DoShrapVelocity(DSWActor* actor)
short wall_ang; short wall_ang;
SPRITEp hsp; SPRITEp hsp;
auto hit_sprite = u->coll.actor; auto hit_sprite = u->coll.actor();
hsp = &hit_sprite->s(); hsp = &hit_sprite->s();
wall_ang = NORM_ANGLE(hsp->ang); wall_ang = NORM_ANGLE(hsp->ang);
@ -19213,7 +19213,7 @@ int DoShrapVelocity(DSWActor* actor)
case kHitWall: case kHitWall:
{ {
int wall_ang = NORM_ANGLE(getangle(u->coll.wall()->delta())+512); int wall_ang = NORM_ANGLE(getangle(u->coll.hitWall->delta())+512);
WallBounce(actor, wall_ang); WallBounce(actor, wall_ang);
ScaleSpriteVector(actor, 32000); ScaleSpriteVector(actor, 32000);
@ -19519,7 +19519,7 @@ int DoItemFly(DSWActor* actor)
case kHitSprite: case kHitSprite:
{ {
short wall_ang; short wall_ang;
auto hit_sprite = u->coll.actor; auto hit_sprite = u->coll.actor();
SPRITEp hsp; SPRITEp hsp;
hsp = &hit_sprite->s(); hsp = &hit_sprite->s();
@ -19541,7 +19541,7 @@ int DoItemFly(DSWActor* actor)
case kHitWall: case kHitWall:
{ {
int wall_ang = NORM_ANGLE(getangle(u->coll.wall()->delta())+512); int wall_ang = NORM_ANGLE(getangle(u->coll.hitWall->delta())+512);
WallBounce(actor, wall_ang); WallBounce(actor, wall_ang);
ScaleSpriteVector(actor, 32000); ScaleSpriteVector(actor, 32000);
break; break;