- adapted FAFhitscan to the new backend API.

Lots of search & replace to change the names of the HitInfo struct, no manual edits outside of FAFhitscan.
This commit is contained in:
Christoph Oelckers 2021-11-26 01:27:44 +01:00
parent 3f43f48b57
commit a5ccd2ccd2
12 changed files with 295 additions and 320 deletions

View file

@ -242,7 +242,7 @@ int CanHitPlayer(DSWActor* actor)
{ {
USERp u = actor->u(); USERp u = actor->u();
SPRITEp sp = &actor->s(); SPRITEp sp = &actor->s();
HITINFO hitinfo; HitInfo hit;
int xvect,yvect,zvect; int xvect,yvect,zvect;
int ang; int ang;
// if actor can still see the player // if actor can still see the player
@ -279,12 +279,12 @@ int CanHitPlayer(DSWActor* actor)
xvect, xvect,
yvect, yvect,
zvect, zvect,
&hitinfo, CLIPMASK_MISSILE); hit, CLIPMASK_MISSILE);
if (hitinfo.sector() == nullptr) if (hit.hitSector == nullptr)
return false; return false;
if (hitinfo.hitactor == u->targetActor) if (hit.actor() == u->targetActor)
return true; return true;
return false; return false;

View file

@ -934,7 +934,6 @@ CircleCamera(int *nx, int *ny, int *nz, sectortype** vsect, binangle *nang, fixe
hitscan({ *nx, *ny, *nz }, *vsect, { vx, vy, vz }, hit, CLIPMASK_MISSILE); hitscan({ *nx, *ny, *nz }, *vsect, { vx, vy, vz }, hit, CLIPMASK_MISSILE);
sp->cstat = bakcstat; // Restore cstat sp->cstat = bakcstat; // Restore cstat
//ASSERT(hitinfo.sect >= 0);
hx = hit.hitpos.x - (*nx); hx = hit.hitpos.x - (*nx);
hy = hit.hitpos.y - (*ny); hy = hit.hitpos.y - (*ny);

View file

@ -1917,11 +1917,11 @@ 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);
struct HITINFO; struct HitInfo;
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* hitinfo, int32_t clipmask); HitInfo& hit, int32_t clipmask);
bool FAFcansee(int32_t xs, int32_t ys, int32_t zs, sectortype* sects, int32_t xe, int32_t ye, int32_t ze, sectortype* secte); bool FAFcansee(int32_t xs, int32_t ys, int32_t zs, sectortype* sects, int32_t xe, int32_t ye, int32_t ze, sectortype* secte);

View file

@ -21,7 +21,21 @@ int32_t CONFIG_ReadSetup(void);
DSWActor* WarpPlane(int32_t* x, int32_t* y, int32_t* z, int* sectnum); DSWActor* WarpPlane(int32_t* x, int32_t* y, int32_t* z, int* sectnum);
bool WarpSectorInfo(sectortype* sect, DSWActor** sp_warp); bool WarpSectorInfo(sectortype* sect, DSWActor** sp_warp);
DSWActor* Warp(int32_t* x, int32_t* y, int32_t* z, int* sectnum); DSWActor* Warp(int32_t* x, int32_t* y, int32_t* z, int* sectnum);
inline DSWActor* Warp(int32_t* x, int32_t* y, int32_t* z, sectortype** sect)
{
int sn = sectnum(*sect);
auto res = Warp(x, y, z, &sn);
*sect = sn == -1? nullptr : &sector[sn];
return res;
}
inline DSWActor* WarpPlane(int32_t* x, int32_t* y, int32_t* z, sectortype** sect)
{
int sn = sectnum(*sect);
auto res = WarpPlane(x, y, z, &sn);
*sect = sn == -1 ? nullptr : &sector[sn];
return res;
}
void ProcessVisOn(void); void ProcessVisOn(void);

View file

@ -3417,7 +3417,7 @@ void DoPlayerClimb(PLAYERp pp)
int DoPlayerWadeSuperJump(PLAYERp pp) int DoPlayerWadeSuperJump(PLAYERp pp)
{ {
HITINFO hitinfo; HitInfo hit;
unsigned i; unsigned i;
//short angs[3]; //short angs[3];
static short angs[3] = {0, 0, 0}; static short angs[3] = {0, 0, 0};
@ -3430,15 +3430,15 @@ int DoPlayerWadeSuperJump(PLAYERp pp)
FAFhitscan(pp->posx, pp->posy, zh, pp->cursector(), // Start position FAFhitscan(pp->posx, pp->posy, zh, pp->cursector(), // Start position
bcos(pp->angle.ang.asbuild() + angs[i]), // X vector of 3D ang bcos(pp->angle.ang.asbuild() + angs[i]), // X vector of 3D ang
bsin(pp->angle.ang.asbuild() + angs[i]), // Y vector of 3D ang bsin(pp->angle.ang.asbuild() + angs[i]), // Y vector of 3D ang
0, &hitinfo, CLIPMASK_MISSILE); // Z vector of 3D ang 0, hit, CLIPMASK_MISSILE); // Z vector of 3D ang
if (hitinfo.wall() != nullptr && hitinfo.sector() != nullptr) if (hit.hitWall != nullptr && hit.hitSector != nullptr)
{ {
hitinfo.hitSector = hitinfo.wall()->nextSector(); hit.hitSector = hit.hitWall->nextSector();
if (hitinfo.sector() != nullptr && labs(hitinfo.sector()->floorz - pp->posz) < Z(50)) if (hit.hitSector != nullptr && labs(hit.hitSector->floorz - pp->posz) < Z(50))
{ {
if (Distance(pp->posx, pp->posy, hitinfo.pos.x, hitinfo.pos.y) < ((((int)pp->Actor()->s().clipdist)<<2) + 256)) if (Distance(pp->posx, pp->posy, hit.hitpos.x, hit.hitpos.y) < ((((int)pp->Actor()->s().clipdist)<<2) + 256))
return true; return true;
} }
} }
@ -3721,7 +3721,7 @@ bool PlayerOnLadder(PLAYERp pp)
int dist, nx, ny; int dist, nx, ny;
unsigned i; unsigned i;
SPRITEp lsp; SPRITEp lsp;
HITINFO hitinfo; HitInfo hit;
int dir; int dir;
int neartaghitdist; int neartaghitdist;
@ -3760,13 +3760,13 @@ bool PlayerOnLadder(PLAYERp pp)
bcos(pp->angle.ang.asbuild() + angles[i]), bcos(pp->angle.ang.asbuild() + angles[i]),
bsin(pp->angle.ang.asbuild() + angles[i]), bsin(pp->angle.ang.asbuild() + angles[i]),
0, 0,
&hitinfo, CLIPMASK_MISSILE); hit, CLIPMASK_MISSILE);
dist = DIST(pp->posx, pp->posy, hitinfo.pos.x, hitinfo.pos.y); dist = DIST(pp->posx, pp->posy, hit.hitpos.x, hit.hitpos.y);
if (hitinfo.hitactor != nullptr) if (hit.actor() != nullptr)
{ {
int cstat = hitinfo.hitactor->s().cstat; int cstat = hit.actor()->s().cstat;
// if the sprite blocking you hit is not a wall sprite there is something between // if the sprite blocking you hit is not a wall sprite there is something between
// you and the ladder // you and the ladder
if (TEST(cstat, CSTAT_SPRITE_BLOCK) && if (TEST(cstat, CSTAT_SPRITE_BLOCK) &&
@ -3778,7 +3778,7 @@ bool PlayerOnLadder(PLAYERp pp)
else else
{ {
// if you hit a wall and it is not a climb wall - forget it // if you hit a wall and it is not a climb wall - forget it
if (hitinfo.wall() != nullptr && hitinfo.wall()->lotag != TAG_WALL_CLIMB) if (hit.hitWall != nullptr && hit.hitWall->lotag != TAG_WALL_CLIMB)
return false; return false;
} }
} }

View file

@ -935,7 +935,7 @@ int InitRipperHang(DSWActor* actor)
SPRITEp sp = &actor->s(); SPRITEp sp = &actor->s();
int dist; int dist;
HITINFO hitinfo; HitInfo hit;
bool Found = false; bool Found = false;
short dang, tang; short dang, tang;
@ -948,15 +948,14 @@ int InitRipperHang(DSWActor* actor)
bcos(tang), // X vector of 3D ang bcos(tang), // X vector of 3D ang
bsin(tang), // Y vector of 3D ang bsin(tang), // Y vector of 3D ang
0, // Z vector of 3D ang 0, // Z vector of 3D ang
&hitinfo, CLIPMASK_MISSILE); hit, CLIPMASK_MISSILE);
//ASSERT(hitinfo.sect >= 0); if (hit.hitSector == nullptr)
if (hitinfo.sector() == nullptr)
continue; continue;
dist = Distance(sp->x, sp->y, hitinfo.pos.x, hitinfo.pos.y); dist = Distance(sp->x, sp->y, hit.hitpos.x, hit.hitpos.y);
if (hitinfo.wall() == nullptr || dist < 2000 || dist > 7000) if (hit.hitWall == nullptr || dist < 2000 || dist > 7000)
{ {
continue; continue;
} }

View file

@ -938,7 +938,7 @@ int InitRipper2Hang(DSWActor* actor)
SPRITEp sp = &actor->s(); SPRITEp sp = &actor->s();
int dist; int dist;
HITINFO hitinfo; HitInfo hit;
bool Found = false; bool Found = false;
short dang, tang; short dang, tang;
@ -951,14 +951,14 @@ int InitRipper2Hang(DSWActor* actor)
bcos(tang), // X vector of 3D ang bcos(tang), // X vector of 3D ang
bsin(tang), // Y vector of 3D ang bsin(tang), // Y vector of 3D ang
0, // Z vector of 3D ang 0, // Z vector of 3D ang
&hitinfo, CLIPMASK_MISSILE); hit, CLIPMASK_MISSILE);
if (hitinfo.sector() == nullptr) if (hit.hitSector == nullptr)
continue; continue;
dist = Distance(sp->x, sp->y, hitinfo.pos.x, hitinfo.pos.y); dist = Distance(sp->x, sp->y, hit.hitpos.x, hit.hitpos.y);
if (hitinfo.wall() == nullptr || dist < 2000 || dist > 7000) if (hit.hitWall == nullptr || dist < 2000 || dist > 7000)
{ {
continue; continue;
} }

View file

@ -140,9 +140,8 @@ void ResetWallWarpHitscan(sectortype* sect)
void void
FAFhitscan(int32_t x, int32_t y, int32_t z, sectortype* sect, FAFhitscan(int32_t x, int32_t y, int32_t z, sectortype* sect,
int32_t xvect, int32_t yvect, int32_t zvect, int32_t xvect, int32_t yvect, int32_t zvect,
HITINFO* hitinfo, int32_t clipmask) HitInfo& hit, int32_t clipmask)
{ {
vec3_t firstpos = { x, y, z };
int loz, hiz; int loz, hiz;
auto newsector = sect; auto newsector = sect;
int startclipmask = 0; int startclipmask = 0;
@ -151,95 +150,85 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, sectortype* sect,
if (clipmask == CLIPMASK_MISSILE) if (clipmask == CLIPMASK_MISSILE)
startclipmask = CLIPMASK_WARP_HITSCAN; startclipmask = CLIPMASK_WARP_HITSCAN;
hitdata_t e_hitinfo; hitscan({ x, y, z }, sect, { xvect, yvect, zvect }, hit, startclipmask);
hitscan(&firstpos, sectnum(sect), xvect, yvect, zvect, &e_hitinfo, startclipmask);
hitinfo->set(&e_hitinfo);
if (hitinfo->sector() == nullptr) if (hit.hitSector == nullptr)
return; return;
if (hitinfo->wall() != nullptr) if (hit.hitWall != nullptr)
{ {
// hitscan warping // hitscan warping
if (TEST(hitinfo->wall()->cstat, CSTAT_WALL_WARP_HITSCAN)) if (TEST(hit.hitWall->cstat, CSTAT_WALL_WARP_HITSCAN))
{ {
MONO_PRINT(ds);
// back it up a bit to get a correct warp location // back it up a bit to get a correct warp location
hitinfo->pos.x -= xvect>>9; hit.hitpos.x -= xvect>>9;
hitinfo->pos.y -= yvect>>9; hit.hitpos.y -= yvect>>9;
// warp to new x,y,z, sectnum // warp to new x,y,z, sectnum
int newsect; sectortype* newsect;
if (Warp(&hitinfo->pos.x, &hitinfo->pos.y, &hitinfo->pos.z, &newsect)) if (Warp(&hit.hitpos.x, &hit.hitpos.y, &hit.hitpos.z, &newsect))
{ {
auto dest_sect = &sector[newsect];
// hitscan needs to pass through dest sect // hitscan needs to pass through dest sect
ResetWallWarpHitscan(dest_sect); ResetWallWarpHitscan(newsect);
// NOTE: This could be recursive I think if need be // NOTE: This could be recursive I think if need be
hitscan(&hitinfo->pos, newsect, xvect, yvect, zvect, &e_hitinfo, startclipmask); auto pos = hit.hitpos;
hitinfo->set(&e_hitinfo); hitscan(pos, newsect, { xvect, yvect, zvect }, hit, startclipmask);
// reset hitscan block for dest sect // reset hitscan block for dest sect
SetWallWarpHitscan(dest_sect); SetWallWarpHitscan(newsect);
return; return;
} }
else else
{ {
//DSPRINTF(ds,"hitinfo->pos.x %d, hitinfo->pos.y %d, hitinfo->pos.z %d",hitinfo->pos.x, hitinfo->pos.y, hitinfo->pos.z);
MONO_PRINT(ds);
ASSERT(true == false); ASSERT(true == false);
} }
} }
} }
// make sure it hit JUST a sector before doing a check // make sure it hit JUST a sector before doing a check
if (hitinfo->wall() == nullptr && hitinfo->hitactor == nullptr) if (hit.hitWall == nullptr && hit.actor() == nullptr)
{ {
if (TEST(hitinfo->sector()->extra, SECTFX_WARP_SECTOR)) if (TEST(hit.hitSector->extra, SECTFX_WARP_SECTOR))
{ {
if (TEST(hitinfo->sector()->firstWall()->cstat, CSTAT_WALL_WARP_HITSCAN)) if (TEST(hit.hitSector->firstWall()->cstat, CSTAT_WALL_WARP_HITSCAN))
{ {
// hit the floor of a sector that is a warping sector // hit the floor of a sector that is a warping sector
int newsect; sectortype* newsect;
if (Warp(&hitinfo->pos.x, &hitinfo->pos.y, &hitinfo->pos.z, &newsect)) if (Warp(&hit.hitpos.x, &hit.hitpos.y, &hit.hitpos.z, &newsect))
{ {
vec3_t pos = e_hitinfo.pos; auto pos = hit.hitpos;
hitscan(&hitinfo->pos, newsect, xvect, yvect, zvect, &e_hitinfo, clipmask); hitscan(pos, newsect, { xvect, yvect, zvect }, hit, clipmask);
hitinfo->set(&e_hitinfo);
return; return;
} }
} }
else else
{ {
int newsect; sectortype* newsect;
if (WarpPlane(&hitinfo->pos.x, &hitinfo->pos.y, &hitinfo->pos.z, &newsect)) if (WarpPlane(&hit.hitpos.x, &hit.hitpos.y, &hit.hitpos.z, &newsect))
{ {
vec3_t pos = e_hitinfo.pos; auto pos = hit.hitpos;
hitscan(&hitinfo->pos, newsect, xvect, yvect, zvect, &e_hitinfo, clipmask); hitscan(pos, newsect, { xvect, yvect, zvect }, hit, clipmask);
hitinfo->set(&e_hitinfo);
return; return;
} }
} }
} }
getzsofslopeptr(hitinfo->sector(), hitinfo->pos.x, hitinfo->pos.y, &hiz, &loz); getzsofslopeptr(hit.hitSector, hit.hitpos.x, hit.hitpos.y, &hiz, &loz);
if (abs(hitinfo->pos.z - loz) < Z(4)) if (abs(hit.hitpos.z - loz) < Z(4))
{ {
if (FAF_ConnectFloor(hitinfo->sector()) && !TEST(hitinfo->sector()->floorstat, FLOOR_STAT_FAF_BLOCK_HITSCAN)) if (FAF_ConnectFloor(hit.hitSector) && !TEST(hit.hitSector->floorstat, FLOOR_STAT_FAF_BLOCK_HITSCAN))
{ {
updatesectorz(e_hitinfo.pos.x, e_hitinfo.pos.y, e_hitinfo.pos.z + Z(12), &newsector); updatesectorz(hit.hitpos.x, hit.hitpos.y, hit.hitpos.z + Z(12), &newsector);
plax_found = true; plax_found = true;
} }
} }
else if (labs(e_hitinfo.pos.z - hiz) < Z(4)) else if (labs(hit.hitpos.z - hiz) < Z(4))
{ {
if (FAF_ConnectCeiling(hitinfo->sector()) && !TEST(hitinfo->sector()->floorstat, CEILING_STAT_FAF_BLOCK_HITSCAN)) if (FAF_ConnectCeiling(hit.hitSector) && !TEST(hit.hitSector->floorstat, CEILING_STAT_FAF_BLOCK_HITSCAN))
{ {
updatesectorz(hitinfo->pos.x, hitinfo->pos.y, hitinfo->pos.z - Z(12), &newsector); updatesectorz(hit.hitpos.x, hit.hitpos.y, hit.hitpos.z - Z(12), &newsector);
plax_found = true; plax_found = true;
} }
} }
@ -247,9 +236,8 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, sectortype* sect,
if (plax_found) if (plax_found)
{ {
vec3_t pos = e_hitinfo.pos; auto pos = hit.hitpos;
hitscan(&pos, sectnum(newsector), xvect, yvect, zvect, &e_hitinfo, clipmask); hitscan(pos, newsector, { xvect, yvect, zvect }, hit, clipmask);
hitinfo->set(&e_hitinfo);
} }
} }

View file

@ -2058,33 +2058,33 @@ bool NearThings(PLAYERp pp)
} }
// This only gets called if nothing else worked, check for nearness to a wall // This only gets called if nothing else worked, check for nearness to a wall
{ {
HITINFO hitinfo; HitInfo hit;
short dang = pp->angle.ang.asbuild(); short dang = pp->angle.ang.asbuild();
FAFhitscan(pp->posx, pp->posy, pp->posz - Z(30), pp->cursector(), // Start position FAFhitscan(pp->posx, pp->posy, pp->posz - Z(30), pp->cursector(), // Start position
bcos(dang), // X vector of 3D ang bcos(dang), // X vector of 3D ang
bsin(dang), // Y vector of 3D ang bsin(dang), // Y vector of 3D ang
0, // Z vector of 3D ang 0, // Z vector of 3D ang
&hitinfo, CLIPMASK_MISSILE); hit, CLIPMASK_MISSILE);
if (hitinfo.sector() == nullptr) if (hit.hitSector == nullptr)
return false; return false;
if (Distance(hitinfo.pos.x, hitinfo.pos.y, pp->posx, pp->posy) > 1500) if (Distance(hit.hitpos.x, hit.hitpos.y, pp->posx, pp->posy) > 1500)
return false; return false;
// hit a sprite? // hit a sprite?
if (hitinfo.hitactor != nullptr) if (hit.actor() != nullptr)
return false; return false;
if (neartagsect >= 0) if (neartagsect >= 0)
return true; return true;
if (hitinfo.wall() != nullptr) if (hit.hitWall != nullptr)
{ {
WALLp wp; WALLp wp;
wp = hitinfo.wall(); wp = hit.hitWall;
// Near a plain old vanilla wall. Can't do anything but grunt. // Near a plain old vanilla wall. Can't do anything but grunt.
if (!TEST(wp->extra, WALLFX_DONT_STICK) && pp == Player+myconnectindex) if (!TEST(wp->extra, WALLFX_DONT_STICK) && pp == Player+myconnectindex)

View file

@ -192,31 +192,6 @@ inline int Collision::setFromEngine(int value)
return type; return type;
} }
struct HITINFO {
DSWActor* hitactor;
sectortype* hitSector;
walltype* hitWall;
vec3_t pos;
void clearObj()
{
pos = {};
hitactor = nullptr;
hitSector = nullptr;
hitWall = nullptr;
}
void set(hitdata_t* hit)
{
hitSector = hit->sect == -1? nullptr : &::sector[hit->sect];
hitWall = hit->wall == -1 ? nullptr : &::wall[hit->wall];
hitactor = hit->sprite >= 0 ? &swActors[hit->sprite] : nullptr;
pos = hit->pos;
}
walltype* wall() const { return hitWall; }
sectortype* sector() const { return hitSector; }
};
inline FSerializer& Serialize(FSerializer& arc, const char* keyname, DSWActor*& w, DSWActor** def) inline FSerializer& Serialize(FSerializer& arc, const char* keyname, DSWActor*& w, DSWActor** def)
{ {

View file

@ -3108,7 +3108,7 @@ bool ActorTrackDecide(TRACK_POINTp tpoint, DSWActor* actor)
if (u->ActorActionSet->Jump) if (u->ActorActionSet->Jump)
{ {
int zdiff; int zdiff;
HITINFO hitinfo; HitInfo hit;
sp->ang = tpoint->ang; sp->ang = tpoint->ang;
@ -3127,19 +3127,19 @@ bool ActorTrackDecide(TRACK_POINTp tpoint, DSWActor* actor)
bcos(sp->ang), // X vector of 3D ang bcos(sp->ang), // X vector of 3D ang
bsin(sp->ang), // Y vector of 3D ang bsin(sp->ang), // Y vector of 3D ang
0, // Z vector of 3D ang 0, // Z vector of 3D ang
&hitinfo, CLIPMASK_MISSILE); hit, CLIPMASK_MISSILE);
SET(sp->cstat, CSTAT_SPRITE_BLOCK); SET(sp->cstat, CSTAT_SPRITE_BLOCK);
ASSERT(hitinfo.sector() != nullptr); ASSERT(hit.hitSector != nullptr);
if (hitinfo.hitactor != nullptr) if (hit.actor() != nullptr)
return false; return false;
if (hitinfo.wall() == nullptr) if (hit.hitWall == nullptr)
return false; return false;
zdiff = labs(sp->z - hitinfo.wall()->nextSector()->floorz) >> 8; zdiff = labs(sp->z - hit.hitWall->nextSector()->floorz) >> 8;
u->jump_speed = PickJumpSpeed(actor, zdiff); u->jump_speed = PickJumpSpeed(actor, zdiff);
} }

View file

@ -12527,7 +12527,7 @@ int InitSwordAttack(PLAYERp pp)
// all this is to break glass // all this is to break glass
{ {
HITINFO hitinfo; HitInfo hit;
short daang; short daang;
int daz; int daz;
@ -12538,18 +12538,18 @@ int InitSwordAttack(PLAYERp pp)
bcos(daang), // X vector of 3D ang bcos(daang), // X vector of 3D ang
bsin(daang), // Y vector of 3D ang bsin(daang), // Y vector of 3D ang
daz, // Z vector of 3D ang daz, // Z vector of 3D ang
&hitinfo, CLIPMASK_MISSILE); hit, CLIPMASK_MISSILE);
if (hitinfo.sector() == nullptr) if (hit.hitSector == nullptr)
return 0; return 0;
if (FindDistance3D(pp->posx - hitinfo.pos.x, pp->posy - hitinfo.pos.y, pp->posz - hitinfo.pos.z) < 700) if (FindDistance3D(pp->posx - hit.hitpos.x, pp->posy - hit.hitpos.y, pp->posz - hit.hitpos.z) < 700)
{ {
if (hitinfo.hitactor != nullptr) if (hit.actor() != nullptr)
{ {
extern STATE s_TrashCanPain[]; extern STATE s_TrashCanPain[];
auto hitActor = hitinfo.hitactor; auto hitActor = hit.actor();
SPRITEp hsp = &hitActor->s(); SPRITEp hsp = &hitActor->s();
if (hitActor->hasU()) // JBF: added null check if (hitActor->hasU()) // JBF: added null check
@ -12558,8 +12558,8 @@ int InitSwordAttack(PLAYERp pp)
switch (tu->ID) switch (tu->ID)
{ {
case ZILLA_RUN_R0: case ZILLA_RUN_R0:
SpawnSwordSparks(pp, hitinfo.sector(), nullptr, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang); SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang);
PlaySound(DIGI_SWORDCLANK, &hitinfo.pos, v3df_none); PlaySound(DIGI_SWORDCLANK, &hit.hitpos, v3df_none);
break; break;
case TRASHCAN: case TRASHCAN:
if (tu->WaitTics <= 0) if (tu->WaitTics <= 0)
@ -12567,8 +12567,8 @@ int InitSwordAttack(PLAYERp pp)
tu->WaitTics = SEC(2); tu->WaitTics = SEC(2);
ChangeState(hitActor, s_TrashCanPain); ChangeState(hitActor, s_TrashCanPain);
} }
SpawnSwordSparks(pp, hitinfo.sector(), nullptr, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang); SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang);
PlaySound(DIGI_SWORDCLANK, &hitinfo.pos, v3df_none); PlaySound(DIGI_SWORDCLANK, &hit.hitpos, v3df_none);
PlaySound(DIGI_TRASHLID, hitActor, v3df_none); PlaySound(DIGI_TRASHLID, hitActor, v3df_none);
break; break;
case PACHINKO1: case PACHINKO1:
@ -12576,8 +12576,8 @@ int InitSwordAttack(PLAYERp pp)
case PACHINKO3: case PACHINKO3:
case PACHINKO4: case PACHINKO4:
case 623: case 623:
SpawnSwordSparks(pp, hitinfo.sector(), nullptr, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang); SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang);
PlaySound(DIGI_SWORDCLANK, &hitinfo.pos, v3df_none); PlaySound(DIGI_SWORDCLANK, &hit.hitpos, v3df_none);
break; break;
} }
} }
@ -12601,28 +12601,28 @@ int InitSwordAttack(PLAYERp pp)
} }
if (hitinfo.wall() != nullptr) if (hit.hitWall != nullptr)
{ {
if (hitinfo.wall()->twoSided()) if (hit.hitWall->twoSided())
{ {
if (TEST(hitinfo.wall()->nextSector()->ceilingstat, CEILING_STAT_PLAX)) if (TEST(hit.hitWall->nextSector()->ceilingstat, CEILING_STAT_PLAX))
{ {
if (hitinfo.pos.z < hitinfo.wall()->nextSector()->ceilingz) if (hit.hitpos.z < hit.hitWall->nextSector()->ceilingz)
{ {
return 0; return 0;
} }
} }
} }
if (hitinfo.wall()->lotag == TAG_WALL_BREAK) if (hit.hitWall->lotag == TAG_WALL_BREAK)
{ {
HitBreakWall(hitinfo.wall(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, u->ID); HitBreakWall(hit.hitWall, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang, u->ID);
} }
// hit non breakable wall - do sound and puff // hit non breakable wall - do sound and puff
else else
{ {
SpawnSwordSparks(pp, hitinfo.sector(), hitinfo.wall(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang); SpawnSwordSparks(pp, hit.hitSector, hit.hitWall, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang);
PlaySound(DIGI_SWORDCLANK, &hitinfo.pos, v3df_none); PlaySound(DIGI_SWORDCLANK, &hit.hitpos, v3df_none);
} }
} }
} }
@ -12717,7 +12717,7 @@ int InitFistAttack(PLAYERp pp)
// all this is to break glass // all this is to break glass
{ {
HITINFO hitinfo; HitInfo hit;
short daang; short daang;
int daz; int daz;
@ -12728,18 +12728,18 @@ int InitFistAttack(PLAYERp pp)
bcos(daang), // X vector of 3D ang bcos(daang), // X vector of 3D ang
bsin(daang), // Y vector of 3D ang bsin(daang), // Y vector of 3D ang
daz, // Z vector of 3D ang daz, // Z vector of 3D ang
&hitinfo, CLIPMASK_MISSILE); hit, CLIPMASK_MISSILE);
if (hitinfo.sector() == nullptr) if (hit.hitSector == nullptr)
return 0; return 0;
if (FindDistance3D(pp->posx - hitinfo.pos.x, pp->posy - hitinfo.pos.y, pp->posz - hitinfo.pos.z) < 700) if (FindDistance3D(pp->posx - hit.hitpos.x, pp->posy - hit.hitpos.y, pp->posz - hit.hitpos.z) < 700)
{ {
if (hitinfo.hitactor != nullptr) if (hit.actor() != nullptr)
{ {
extern STATE s_TrashCanPain[]; extern STATE s_TrashCanPain[];
auto hitActor = hitinfo.hitactor; auto hitActor = hit.actor();
SPRITEp hsp = &hitActor->s(); SPRITEp hsp = &hitActor->s();
if (hitActor->hasU()) // JBF: added null check if (hitActor->hasU()) // JBF: added null check
@ -12748,8 +12748,8 @@ int InitFistAttack(PLAYERp pp)
switch (tu->ID) switch (tu->ID)
{ {
case ZILLA_RUN_R0: case ZILLA_RUN_R0:
SpawnSwordSparks(pp, hitinfo.sector(), nullptr, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang); SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang);
PlaySound(DIGI_ARMORHIT, &hitinfo.pos, v3df_none); PlaySound(DIGI_ARMORHIT, &hit.hitpos, v3df_none);
break; break;
case TRASHCAN: case TRASHCAN:
if (tu->WaitTics <= 0) if (tu->WaitTics <= 0)
@ -12757,8 +12757,8 @@ int InitFistAttack(PLAYERp pp)
tu->WaitTics = SEC(2); tu->WaitTics = SEC(2);
ChangeState(hitActor, s_TrashCanPain); ChangeState(hitActor, s_TrashCanPain);
} }
SpawnSwordSparks(pp, hitinfo.sector(), nullptr, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang); SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang);
PlaySound(DIGI_ARMORHIT, &hitinfo.pos, v3df_none); PlaySound(DIGI_ARMORHIT, &hit.hitpos, v3df_none);
PlaySound(DIGI_TRASHLID, hitActor, v3df_none); PlaySound(DIGI_TRASHLID, hitActor, v3df_none);
break; break;
case PACHINKO1: case PACHINKO1:
@ -12766,8 +12766,8 @@ int InitFistAttack(PLAYERp pp)
case PACHINKO3: case PACHINKO3:
case PACHINKO4: case PACHINKO4:
case 623: case 623:
SpawnSwordSparks(pp, hitinfo.sector(), nullptr, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang); SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang);
PlaySound(DIGI_ARMORHIT, &hitinfo.pos, v3df_none); PlaySound(DIGI_ARMORHIT, &hit.hitpos, v3df_none);
break; break;
} }
} }
@ -12794,8 +12794,8 @@ int InitFistAttack(PLAYERp pp)
case 5062: case 5062:
case 5063: case 5063:
case 4947: case 4947:
SpawnSwordSparks(pp, hitinfo.sector(), nullptr, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang); SpawnSwordSparks(pp, hit.hitSector, nullptr, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang);
PlaySound(DIGI_ARMORHIT, &hitinfo.pos, v3df_none); PlaySound(DIGI_ARMORHIT, &hit.hitpos, v3df_none);
if (RandomRange(1000) > 700) if (RandomRange(1000) > 700)
PlayerUpdateHealth(pp,1); // Give some health PlayerUpdateHealth(pp,1); // Give some health
SET(hsp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); SET(hsp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
@ -12804,28 +12804,28 @@ int InitFistAttack(PLAYERp pp)
} }
if (hitinfo.wall() != nullptr) if (hit.hitWall != nullptr)
{ {
if (hitinfo.wall()->twoSided()) if (hit.hitWall->twoSided())
{ {
if (TEST(hitinfo.wall()->nextSector()->ceilingstat, CEILING_STAT_PLAX)) if (TEST(hit.hitWall->nextSector()->ceilingstat, CEILING_STAT_PLAX))
{ {
if (hitinfo.pos.z < hitinfo.wall()->nextSector()->ceilingz) if (hit.hitpos.z < hit.hitWall->nextSector()->ceilingz)
{ {
return 0; return 0;
} }
} }
} }
if (hitinfo.wall()->lotag == TAG_WALL_BREAK) if (hit.hitWall->lotag == TAG_WALL_BREAK)
{ {
HitBreakWall(hitinfo.wall(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, u->ID); HitBreakWall(hit.hitWall, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang, u->ID);
} }
// hit non breakable wall - do sound and puff // hit non breakable wall - do sound and puff
else else
{ {
SpawnSwordSparks(pp, hitinfo.sector(), hitinfo.wall(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang); SpawnSwordSparks(pp, hit.hitSector, hit.hitWall, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang);
PlaySound(DIGI_ARMORHIT, &hitinfo.pos, v3df_none); PlaySound(DIGI_ARMORHIT, &hit.hitpos, v3df_none);
if (PlayerTakeDamage(pp, nullptr)) if (PlayerTakeDamage(pp, nullptr))
{ {
PlayerUpdateHealth(pp, -(RandomRange(2<<8)>>8)); PlayerUpdateHealth(pp, -(RandomRange(2<<8)>>8));
@ -13493,80 +13493,80 @@ void InitHeartAttack(PLAYERp pp)
int ContinueHitscan(PLAYERp pp, sectortype* sect, int x, int y, int z, short ang, int xvect, int yvect, int zvect) int ContinueHitscan(PLAYERp pp, sectortype* sect, int x, int y, int z, short ang, int xvect, int yvect, int zvect)
{ {
HITINFO hitinfo; HitInfo hit;
USERp u = pp->Actor()->u(); USERp u = pp->Actor()->u();
FAFhitscan(x, y, z, sect, FAFhitscan(x, y, z, sect,
xvect, yvect, zvect, xvect, yvect, zvect,
&hitinfo, CLIPMASK_MISSILE); hit, CLIPMASK_MISSILE);
if (hitinfo.sector() == nullptr) if (hit.hitSector == nullptr)
return 0; return 0;
if (hitinfo.hitactor == nullptr && hitinfo.wall() == nullptr) if (hit.actor() == nullptr && hit.hitWall == nullptr)
{ {
if (labs(hitinfo.pos.z - hitinfo.sector()->ceilingz) <= Z(1)) if (labs(hit.hitpos.z - hit.hitSector->ceilingz) <= Z(1))
{ {
hitinfo.pos.z += Z(16); hit.hitpos.z += Z(16);
if (TEST(hitinfo.sector()->ceilingstat, CEILING_STAT_PLAX)) if (TEST(hit.hitSector->ceilingstat, CEILING_STAT_PLAX))
return 0; return 0;
} }
else if (labs(hitinfo.pos.z - hitinfo.sector()->floorz) <= Z(1)) else if (labs(hit.hitpos.z - hit.hitSector->floorz) <= Z(1))
{ {
} }
} }
if (hitinfo.wall() != nullptr) if (hit.hitWall != nullptr)
{ {
if (hitinfo.wall()->twoSided()) if (hit.hitWall->twoSided())
{ {
if (TEST(hitinfo.wall()->nextSector()->ceilingstat, CEILING_STAT_PLAX)) if (TEST(hit.hitWall->nextSector()->ceilingstat, CEILING_STAT_PLAX))
{ {
if (hitinfo.pos.z < hitinfo.wall()->nextSector()->ceilingz) if (hit.hitpos.z < hit.hitWall->nextSector()->ceilingz)
{ {
return 0; return 0;
} }
} }
} }
if (hitinfo.wall()->lotag == TAG_WALL_BREAK) if (hit.hitWall->lotag == TAG_WALL_BREAK)
{ {
HitBreakWall(hitinfo.wall(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, ang, u->ID); HitBreakWall(hit.hitWall, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, ang, u->ID);
return 0; return 0;
} }
QueueHole(hitinfo.sector(), hitinfo.wall(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z); QueueHole(hit.hitSector, hit.hitWall, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z);
} }
// hit a sprite? // hit a sprite?
if (hitinfo.hitactor != nullptr) if (hit.actor() != nullptr)
{ {
SPRITEp hsp = &hitinfo.hitactor->s(); SPRITEp hsp = &hit.actor()->s();
if (hsp->lotag == TAG_SPRITE_HIT_MATCH) if (hsp->lotag == TAG_SPRITE_HIT_MATCH)
{ {
if (MissileHitMatch(nullptr, WPN_SHOTGUN, hitinfo.hitactor)) if (MissileHitMatch(nullptr, WPN_SHOTGUN, hit.actor()))
return 0; return 0;
} }
if (TEST(hsp->extra, SPRX_BREAKABLE)) if (TEST(hsp->extra, SPRX_BREAKABLE))
{ {
HitBreakSprite(hitinfo.hitactor,0); HitBreakSprite(hit.actor(),0);
return 0; return 0;
} }
if (BulletHitSprite(pp->Actor(), hitinfo.hitactor, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, 0)) if (BulletHitSprite(pp->Actor(), hit.actor(), hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, 0))
return 0; return 0;
// hit a switch? // hit a switch?
if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL) && (hsp->lotag || hsp->hitag)) if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL) && (hsp->lotag || hsp->hitag))
{ {
ShootableSwitch(hitinfo.hitactor); ShootableSwitch(hit.actor());
} }
} }
auto j = SpawnShotgunSparks(pp, hitinfo.sector(), hitinfo.wall(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, ang); auto j = SpawnShotgunSparks(pp, hit.hitSector, hit.hitWall, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, ang);
DoHitscanDamage(j, hitinfo.hitactor); DoHitscanDamage(j, hit.actor());
return 0; return 0;
} }
@ -13576,7 +13576,7 @@ int InitShotgun(PLAYERp pp)
USERp u = pp->Actor()->u(); USERp u = pp->Actor()->u();
auto sp = &pp->Actor()->s(); auto sp = &pp->Actor()->s();
short daang,ndaang, i; short daang,ndaang, i;
HITINFO hitinfo; HitInfo hit;
int daz, ndaz; int daz, ndaz;
int nx,ny,nz; int nx,ny,nz;
int xvect,yvect,zvect; int xvect,yvect,zvect;
@ -13630,40 +13630,40 @@ int InitShotgun(PLAYERp pp)
zvect = ndaz; zvect = ndaz;
FAFhitscan(nx, ny, nz, pp->cursector(), // Start position FAFhitscan(nx, ny, nz, pp->cursector(), // Start position
xvect, yvect, zvect, xvect, yvect, zvect,
&hitinfo, CLIPMASK_MISSILE); hit, CLIPMASK_MISSILE);
if (hitinfo.sector() == nullptr) if (hit.hitSector == nullptr)
{ {
continue; continue;
} }
if (hitinfo.hitactor == nullptr && hitinfo.wall() == nullptr) if (hit.actor() == nullptr && hit.hitWall == nullptr)
{ {
if (labs(hitinfo.pos.z - hitinfo.sector()->ceilingz) <= Z(1)) if (labs(hit.hitpos.z - hit.hitSector->ceilingz) <= Z(1))
{ {
hitinfo.pos.z += Z(16); hit.hitpos.z += Z(16);
SET(cstat, CSTAT_SPRITE_YFLIP); SET(cstat, CSTAT_SPRITE_YFLIP);
if (TEST(hitinfo.sector()->ceilingstat, CEILING_STAT_PLAX)) if (TEST(hit.hitSector->ceilingstat, CEILING_STAT_PLAX))
continue; continue;
if (SectorIsUnderwaterArea(hitinfo.sector())) if (SectorIsUnderwaterArea(hit.hitSector))
{ {
WarpToSurface(&hitinfo.hitSector, &hitinfo.pos.x, &hitinfo.pos.y, &hitinfo.pos.z); WarpToSurface(&hit.hitSector, &hit.hitpos.x, &hit.hitpos.y, &hit.hitpos.z);
ContinueHitscan(pp, hitinfo.sector(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, ndaang, xvect, yvect, zvect); ContinueHitscan(pp, hit.hitSector, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, ndaang, xvect, yvect, zvect);
continue; continue;
} }
} }
else if (labs(hitinfo.pos.z - hitinfo.sector()->floorz) <= Z(1)) else if (labs(hit.hitpos.z - hit.hitSector->floorz) <= Z(1))
{ {
if (TEST(hitinfo.sector()->extra, SECTFX_LIQUID_MASK) != SECTFX_LIQUID_NONE) if (TEST(hit.hitSector->extra, SECTFX_LIQUID_MASK) != SECTFX_LIQUID_NONE)
{ {
SpawnSplashXY(hitinfo.pos.x,hitinfo.pos.y,hitinfo.pos.z,hitinfo.sector()); SpawnSplashXY(hit.hitpos.x,hit.hitpos.y,hit.hitpos.z,hit.hitSector);
if (SectorIsDiveArea(hitinfo.sector())) if (SectorIsDiveArea(hit.hitSector))
{ {
WarpToUnderwater(&hitinfo.hitSector, &hitinfo.pos.x, &hitinfo.pos.y, &hitinfo.pos.z); WarpToUnderwater(&hit.hitSector, &hit.hitpos.x, &hit.hitpos.y, &hit.hitpos.z);
ContinueHitscan(pp, hitinfo.sector(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, ndaang, xvect, yvect, zvect); ContinueHitscan(pp, hit.hitSector, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, ndaang, xvect, yvect, zvect);
} }
continue; continue;
@ -13671,32 +13671,32 @@ int InitShotgun(PLAYERp pp)
} }
} }
if (hitinfo.wall() != nullptr) if (hit.hitWall != nullptr)
{ {
if (hitinfo.wall()->twoSided()) if (hit.hitWall->twoSided())
{ {
if (TEST(hitinfo.wall()->nextSector()->ceilingstat, CEILING_STAT_PLAX)) if (TEST(hit.hitWall->nextSector()->ceilingstat, CEILING_STAT_PLAX))
{ {
if (hitinfo.pos.z < hitinfo.wall()->nextSector()->ceilingz) if (hit.hitpos.z < hit.hitWall->nextSector()->ceilingz)
{ {
continue; continue;
} }
} }
} }
if (hitinfo.wall()->lotag == TAG_WALL_BREAK) if (hit.hitWall->lotag == TAG_WALL_BREAK)
{ {
HitBreakWall(hitinfo.wall(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, ndaang, u->ID); HitBreakWall(hit.hitWall, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, ndaang, u->ID);
continue; continue;
} }
QueueHole(hitinfo.sector(), hitinfo.wall(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z); QueueHole(hit.hitSector, hit.hitWall, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z);
} }
// hit a sprite? // hit a sprite?
if (hitinfo.hitactor != nullptr) if (hit.actor() != nullptr)
{ {
auto hitActor = hitinfo.hitactor; auto hitActor = hit.actor();
SPRITEp hsp = &hitActor->s(); SPRITEp hsp = &hitActor->s();
auto hu = hitActor->u(); auto hu = hitActor->u();
@ -13724,7 +13724,7 @@ int InitShotgun(PLAYERp pp)
continue; continue;
} }
if (BulletHitSprite(pp->Actor(), hitActor, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, SHOTGUN_SMOKE)) if (BulletHitSprite(pp->Actor(), hitActor, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, SHOTGUN_SMOKE))
continue; continue;
// hit a switch? // hit a switch?
@ -13734,8 +13734,8 @@ int InitShotgun(PLAYERp pp)
} }
} }
auto j = SpawnShotgunSparks(pp, hitinfo.sector(), hitinfo.wall(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, ndaang); auto j = SpawnShotgunSparks(pp, hit.hitSector, hit.hitWall, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, ndaang);
DoHitscanDamage(j, hitinfo.hitactor); DoHitscanDamage(j, hit.actor());
} }
DoPlayerBeginRecoil(pp, SHOTGUN_RECOIL_AMT); DoPlayerBeginRecoil(pp, SHOTGUN_RECOIL_AMT);
@ -16129,7 +16129,7 @@ int InitUzi(PLAYERp pp)
SPRITEp wp, hsp; SPRITEp wp, hsp;
USERp wu; USERp wu;
short daang; short daang;
HITINFO hitinfo; HitInfo hit;
int daz, nz; int daz, nz;
int xvect,yvect,zvect; int xvect,yvect,zvect;
short cstat = 0; short cstat = 0;
@ -16189,9 +16189,9 @@ int InitUzi(PLAYERp pp)
zvect = daz; zvect = daz;
FAFhitscan(pp->posx, pp->posy, nz, pp->cursector(), // Start position FAFhitscan(pp->posx, pp->posy, nz, pp->cursector(), // Start position
xvect,yvect,zvect, xvect,yvect,zvect,
&hitinfo, CLIPMASK_MISSILE); hit, CLIPMASK_MISSILE);
if (hitinfo.sector() == nullptr) if (hit.hitSector == nullptr)
{ {
return 0; return 0;
} }
@ -16199,33 +16199,33 @@ int InitUzi(PLAYERp pp)
SetVisHigh(); SetVisHigh();
// check to see what you hit // check to see what you hit
if (hitinfo.hitactor == nullptr && hitinfo.wall() == nullptr) if (hit.actor() == nullptr && hit.hitWall == nullptr)
{ {
if (labs(hitinfo.pos.z - hitinfo.sector()->ceilingz) <= Z(1)) if (labs(hit.hitpos.z - hit.hitSector->ceilingz) <= Z(1))
{ {
hitinfo.pos.z += Z(16); hit.hitpos.z += Z(16);
SET(cstat, CSTAT_SPRITE_YFLIP); SET(cstat, CSTAT_SPRITE_YFLIP);
if (TEST(hitinfo.sector()->ceilingstat, CEILING_STAT_PLAX)) if (TEST(hit.hitSector->ceilingstat, CEILING_STAT_PLAX))
return 0; return 0;
if (SectorIsUnderwaterArea(hitinfo.sector())) if (SectorIsUnderwaterArea(hit.hitSector))
{ {
WarpToSurface(&hitinfo.hitSector, &hitinfo.pos.x, &hitinfo.pos.y, &hitinfo.pos.z); WarpToSurface(&hit.hitSector, &hit.hitpos.x, &hit.hitpos.y, &hit.hitpos.z);
ContinueHitscan(pp, hitinfo.sector(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, xvect, yvect, zvect); ContinueHitscan(pp, hit.hitSector, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang, xvect, yvect, zvect);
return 0; return 0;
} }
} }
else if (labs(hitinfo.pos.z - hitinfo.sector()->floorz) <= Z(1)) else if (labs(hit.hitpos.z - hit.hitSector->floorz) <= Z(1))
{ {
if (TEST(hitinfo.sector()->extra, SECTFX_LIQUID_MASK) != SECTFX_LIQUID_NONE) if (TEST(hit.hitSector->extra, SECTFX_LIQUID_MASK) != SECTFX_LIQUID_NONE)
{ {
SpawnSplashXY(hitinfo.pos.x,hitinfo.pos.y,hitinfo.pos.z,hitinfo.sector()); SpawnSplashXY(hit.hitpos.x,hit.hitpos.y,hit.hitpos.z,hit.hitSector);
if (SectorIsDiveArea(hitinfo.sector())) if (SectorIsDiveArea(hit.hitSector))
{ {
WarpToUnderwater(&hitinfo.hitSector, &hitinfo.pos.x, &hitinfo.pos.y, &hitinfo.pos.z); WarpToUnderwater(&hit.hitSector, &hit.hitpos.x, &hit.hitpos.y, &hit.hitpos.z);
ContinueHitscan(pp, hitinfo.sector(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, xvect, yvect, zvect); ContinueHitscan(pp, hit.hitSector, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang, xvect, yvect, zvect);
return 0; return 0;
} }
@ -16234,13 +16234,13 @@ int InitUzi(PLAYERp pp)
} }
} }
if (hitinfo.wall() != nullptr) if (hit.hitWall != nullptr)
{ {
if (hitinfo.wall()->twoSided()) if (hit.hitWall->twoSided())
{ {
if (TEST(hitinfo.wall()->nextSector()->ceilingstat, CEILING_STAT_PLAX)) if (TEST(hit.hitWall->nextSector()->ceilingstat, CEILING_STAT_PLAX))
{ {
if (hitinfo.pos.z < hitinfo.wall()->nextSector()->ceilingz) if (hit.hitpos.z < hit.hitWall->nextSector()->ceilingz)
{ {
return 0; return 0;
} }
@ -16248,19 +16248,19 @@ int InitUzi(PLAYERp pp)
} }
if (hitinfo.wall()->lotag == TAG_WALL_BREAK) if (hit.hitWall->lotag == TAG_WALL_BREAK)
{ {
HitBreakWall(hitinfo.wall(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, u->ID); HitBreakWall(hit.hitWall, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang, u->ID);
return 0; return 0;
} }
QueueHole(hitinfo.sector(), hitinfo.wall(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z); QueueHole(hit.hitSector, hit.hitWall, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z);
} }
// hit a sprite? // hit a sprite?
if (hitinfo.hitactor != nullptr) if (hit.actor() != nullptr)
{ {
auto hitActor = hitinfo.hitactor; auto hitActor = hit.actor();
SPRITEp hsp = &hitActor->s(); SPRITEp hsp = &hitActor->s();
auto hu = hitActor->u(); auto hu = hitActor->u();
@ -16288,7 +16288,7 @@ int InitUzi(PLAYERp pp)
return 0; return 0;
} }
if (BulletHitSprite(pp->Actor(), hitActor, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, 0)) if (BulletHitSprite(pp->Actor(), hitActor, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, 0))
return 0; return 0;
// hit a switch? // hit a switch?
@ -16299,7 +16299,7 @@ int InitUzi(PLAYERp pp)
} }
auto actorNew = SpawnActor(STAT_MISSILE, UZI_SMOKE, s_UziSmoke, hitinfo.sector(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, 0); auto actorNew = SpawnActor(STAT_MISSILE, UZI_SMOKE, s_UziSmoke, hit.hitSector, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang, 0);
wp = &actorNew->s(); wp = &actorNew->s();
wp->shade = -40; wp->shade = -40;
wp->xrepeat = UZI_SMOKE_REPEAT; wp->xrepeat = UZI_SMOKE_REPEAT;
@ -16308,10 +16308,10 @@ int InitUzi(PLAYERp pp)
SET(wp->cstat, cstat | CSTAT_SPRITE_YCENTER); SET(wp->cstat, cstat | CSTAT_SPRITE_YCENTER);
wp->clipdist = 8 >> 2; wp->clipdist = 8 >> 2;
HitscanSpriteAdjust(actorNew, hitinfo.wall()); HitscanSpriteAdjust(actorNew, hit.hitWall);
DoHitscanDamage(actorNew, hitinfo.hitactor); DoHitscanDamage(actorNew, hit.actor());
actorNew = SpawnActor(STAT_MISSILE, UZI_SPARK, s_UziSpark, hitinfo.sector(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, 0); actorNew = SpawnActor(STAT_MISSILE, UZI_SPARK, s_UziSpark, hit.hitSector, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang, 0);
wp = &actorNew->s(); wp = &actorNew->s();
wu = actorNew->u(); wu = actorNew->u();
wp->shade = -40; wp->shade = -40;
@ -16322,7 +16322,7 @@ int InitUzi(PLAYERp pp)
SET(wp->cstat, cstat | CSTAT_SPRITE_YCENTER); SET(wp->cstat, cstat | CSTAT_SPRITE_YCENTER);
wp->clipdist = 8 >> 2; wp->clipdist = 8 >> 2;
HitscanSpriteAdjust(actorNew, hitinfo.wall()); HitscanSpriteAdjust(actorNew, hit.hitWall);
if (RANDOM_P2(1024) < 100) if (RANDOM_P2(1024) < 100)
{ {
@ -16699,7 +16699,7 @@ int InitSobjMachineGun(DSWActor* actor, PLAYERp pp)
USERp u = actor->u(); USERp u = actor->u();
SPRITEp sp = &actor->s(); SPRITEp sp = &actor->s();
short daang; short daang;
HITINFO hitinfo; HitInfo hit;
int daz; int daz;
int nx,ny,nz; int nx,ny,nz;
short cstat = 0; short cstat = 0;
@ -16735,28 +16735,28 @@ int InitSobjMachineGun(DSWActor* actor, PLAYERp pp)
bcos(daang), // X vector of 3D ang bcos(daang), // X vector of 3D ang
bsin(daang), // Y vector of 3D ang bsin(daang), // Y vector of 3D ang
daz, // Z vector of 3D ang daz, // Z vector of 3D ang
&hitinfo, CLIPMASK_MISSILE); hit, CLIPMASK_MISSILE);
if (hitinfo.sector() == nullptr) if (hit.hitSector == nullptr)
{ {
return 0; return 0;
} }
if (hitinfo.hitactor == nullptr && hitinfo.wall() == nullptr) if (hit.actor() == nullptr && hit.hitWall == nullptr)
{ {
if (labs(hitinfo.pos.z - hitinfo.sector()->ceilingz) <= Z(1)) if (labs(hit.hitpos.z - hit.hitSector->ceilingz) <= Z(1))
{ {
hitinfo.pos.z += Z(16); hit.hitpos.z += Z(16);
SET(cstat, CSTAT_SPRITE_YFLIP); SET(cstat, CSTAT_SPRITE_YFLIP);
if (TEST(hitinfo.sector()->ceilingstat, CEILING_STAT_PLAX)) if (TEST(hit.hitSector->ceilingstat, CEILING_STAT_PLAX))
return 0; return 0;
} }
else if (labs(hitinfo.pos.z - hitinfo.sector()->floorz) <= Z(1)) else if (labs(hit.hitpos.z - hit.hitSector->floorz) <= Z(1))
{ {
if (TEST(hitinfo.sector()->extra, SECTFX_LIQUID_MASK) != SECTFX_LIQUID_NONE) if (TEST(hit.hitSector->extra, SECTFX_LIQUID_MASK) != SECTFX_LIQUID_NONE)
{ {
SpawnSplashXY(hitinfo.pos.x,hitinfo.pos.y,hitinfo.pos.z,hitinfo.sector()); SpawnSplashXY(hit.hitpos.x,hit.hitpos.y,hit.hitpos.z,hit.hitSector);
return 0; return 0;
} }
} }
@ -16764,38 +16764,38 @@ int InitSobjMachineGun(DSWActor* actor, PLAYERp pp)
} }
// hit a sprite? // hit a sprite?
if (hitinfo.hitactor != nullptr) if (hit.actor() != nullptr)
{ {
SPRITEp hsp = &hitinfo.hitactor->s(); SPRITEp hsp = &hit.actor()->s();
if (hsp->lotag == TAG_SPRITE_HIT_MATCH) if (hsp->lotag == TAG_SPRITE_HIT_MATCH)
{ {
// spawn sparks here and pass the sprite as SO_MISSILE // spawn sparks here and pass the sprite as SO_MISSILE
spark = SpawnBoatSparks(pp, hitinfo.sector(), hitinfo.wall(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang); spark = SpawnBoatSparks(pp, hit.hitSector, hit.hitWall, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang);
SET(spark->u()->Flags2, SPR2_SO_MISSILE); SET(spark->u()->Flags2, SPR2_SO_MISSILE);
if (MissileHitMatch(spark, -1, hitinfo.hitactor)) if (MissileHitMatch(spark, -1, hit.actor()))
return 0; return 0;
return 0; return 0;
} }
if (TEST(hsp->extra, SPRX_BREAKABLE)) if (TEST(hsp->extra, SPRX_BREAKABLE))
{ {
HitBreakSprite(hitinfo.hitactor, 0); HitBreakSprite(hit.actor(), 0);
return 0; return 0;
} }
if (BulletHitSprite(pp->Actor(), hitinfo.hitactor, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, 0)) if (BulletHitSprite(pp->Actor(), hit.actor(), hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, 0))
return 0; return 0;
// hit a switch? // hit a switch?
if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL) && (hsp->lotag || hsp->hitag)) if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL) && (hsp->lotag || hsp->hitag))
{ {
ShootableSwitch(hitinfo.hitactor); ShootableSwitch(hit.actor());
} }
} }
spark = SpawnBoatSparks(pp, hitinfo.sector(), hitinfo.wall(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang); spark = SpawnBoatSparks(pp, hit.hitSector, hit.hitWall, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang);
DoHitscanDamage(spark, hitinfo.hitactor); DoHitscanDamage(spark, hit.actor());
return 0; return 0;
} }
@ -17067,7 +17067,7 @@ int InitTurretMgun(SECTOR_OBJECTp sop)
{ {
SPRITEp hsp; SPRITEp hsp;
short daang, i; short daang, i;
HITINFO hitinfo; HitInfo hit;
int daz; int daz;
int nx,ny,nz; int nx,ny,nz;
short cstat = 0; short cstat = 0;
@ -17092,9 +17092,9 @@ int InitTurretMgun(SECTOR_OBJECTp sop)
{ {
// only auto aim for Z // only auto aim for Z
daang = 512; daang = 512;
auto hit = WeaponAutoAimHitscan(actor, &daz, &daang, false); auto hitt = WeaponAutoAimHitscan(actor, &daz, &daang, false);
hitinfo.hitactor = hit; hit.hitActor = hitt;
if (hit != nullptr) if (hitt != nullptr)
{ {
delta = short(abs(getincangle(sp->ang, daang))); delta = short(abs(getincangle(sp->ang, daang)));
if (delta > 128) if (delta > 128)
@ -17106,7 +17106,7 @@ int InitTurretMgun(SECTOR_OBJECTp sop)
{ {
// always shoot the ground when tracking // always shoot the ground when tracking
// and not close // and not close
WeaponHitscanShootFeet(actor, hit, &daz); WeaponHitscanShootFeet(actor, hitt, &daz);
daang = sp->ang; daang = sp->ang;
daang = NORM_ANGLE(daang + RANDOM_P2(32) - 16); daang = NORM_ANGLE(daang + RANDOM_P2(32) - 16);
@ -17136,7 +17136,7 @@ int InitTurretMgun(SECTOR_OBJECTp sop)
FAFhitscan(nx, ny, nz, sp->sector(), // Start position FAFhitscan(nx, ny, nz, sp->sector(), // Start position
xvect, yvect, zvect, xvect, yvect, zvect,
&hitinfo, CLIPMASK_MISSILE); hit, CLIPMASK_MISSILE);
if (RANDOM_P2(1024) < 400) if (RANDOM_P2(1024) < 400)
{ {
@ -17144,82 +17144,82 @@ int InitTurretMgun(SECTOR_OBJECTp sop)
xvect>>4, yvect>>4, zvect>>4); xvect>>4, yvect>>4, zvect>>4);
} }
if (hitinfo.sector() == nullptr) if (hit.hitSector == nullptr)
continue; continue;
if (hitinfo.hitactor == nullptr && hitinfo.wall() == nullptr) if (hit.actor() == nullptr && hit.hitWall == nullptr)
{ {
if (labs(hitinfo.pos.z - hitinfo.sector()->ceilingz) <= Z(1)) if (labs(hit.hitpos.z - hit.hitSector->ceilingz) <= Z(1))
{ {
hitinfo.pos.z += Z(16); hit.hitpos.z += Z(16);
SET(cstat, CSTAT_SPRITE_YFLIP); SET(cstat, CSTAT_SPRITE_YFLIP);
if (TEST(hitinfo.sector()->ceilingstat, CEILING_STAT_PLAX)) if (TEST(hit.hitSector->ceilingstat, CEILING_STAT_PLAX))
continue; continue;
} }
else if (labs(hitinfo.pos.z - hitinfo.sector()->floorz) <= Z(1)) else if (labs(hit.hitpos.z - hit.hitSector->floorz) <= Z(1))
{ {
if (TEST(hitinfo.sector()->extra, SECTFX_LIQUID_MASK) != SECTFX_LIQUID_NONE) if (TEST(hit.hitSector->extra, SECTFX_LIQUID_MASK) != SECTFX_LIQUID_NONE)
{ {
SpawnSplashXY(hitinfo.pos.x,hitinfo.pos.y,hitinfo.pos.z,hitinfo.sector()); SpawnSplashXY(hit.hitpos.x,hit.hitpos.y,hit.hitpos.z,hit.hitSector);
continue; continue;
} }
} }
} }
if (hitinfo.wall() != nullptr) if (hit.hitWall != nullptr)
{ {
if (hitinfo.wall()->twoSided()) if (hit.hitWall->twoSided())
{ {
if (TEST(hitinfo.wall()->nextSector()->ceilingstat, CEILING_STAT_PLAX)) if (TEST(hit.hitWall->nextSector()->ceilingstat, CEILING_STAT_PLAX))
{ {
if (hitinfo.pos.z < hitinfo.wall()->nextSector()->ceilingz) if (hit.hitpos.z < hit.hitWall->nextSector()->ceilingz)
{ {
return 0; return 0;
} }
} }
} }
if (hitinfo.wall()->lotag == TAG_WALL_BREAK) if (hit.hitWall->lotag == TAG_WALL_BREAK)
{ {
HitBreakWall(hitinfo.wall(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, 0); HitBreakWall(hit.hitWall, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang, 0);
continue; continue;
} }
QueueHole(hitinfo.sector(), hitinfo.wall(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z); QueueHole(hit.hitSector, hit.hitWall, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z);
} }
// hit a sprite? // hit a sprite?
if (hitinfo.hitactor != nullptr) if (hit.actor() != nullptr)
{ {
hsp = &hitinfo.hitactor->s(); hsp = &hit.actor()->s();
if (hsp->lotag == TAG_SPRITE_HIT_MATCH) if (hsp->lotag == TAG_SPRITE_HIT_MATCH)
{ {
if (MissileHitMatch(nullptr, WPN_UZI, hitinfo.hitactor)) if (MissileHitMatch(nullptr, WPN_UZI, hit.actor()))
continue; continue;
} }
if (TEST(hsp->extra, SPRX_BREAKABLE)) if (TEST(hsp->extra, SPRX_BREAKABLE))
{ {
HitBreakSprite(hitinfo.hitactor, 0); HitBreakSprite(hit.actor(), 0);
continue; continue;
} }
if (BulletHitSprite(actor, hitinfo.hitactor, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, 0)) if (BulletHitSprite(actor, hit.actor(), hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, 0))
continue; continue;
// hit a switch? // hit a switch?
if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL) && (hsp->lotag || hsp->hitag)) if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL) && (hsp->lotag || hsp->hitag))
{ {
ShootableSwitch(hitinfo.hitactor); ShootableSwitch(hit.actor());
} }
} }
auto j = SpawnTurretSparks(hitinfo.sector(), hitinfo.wall(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang); auto j = SpawnTurretSparks(hit.hitSector, hit.hitWall, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang);
DoHitscanDamage(j, hitinfo.hitactor); DoHitscanDamage(j, hit.actor());
} }
} }
@ -17233,7 +17233,7 @@ int InitEnemyUzi(DSWActor* actor)
SPRITEp sp = &actor->s(), wp; SPRITEp sp = &actor->s(), wp;
USERp wu; USERp wu;
short daang; short daang;
HITINFO hitinfo; HitInfo hit;
int daz; int daz;
int zh; int zh;
void InitUziShell(PLAYERp); void InitUziShell(PLAYERp);
@ -17281,9 +17281,9 @@ int InitEnemyUzi(DSWActor* actor)
bcos(daang), // X vector of 3D ang bcos(daang), // X vector of 3D ang
bsin(daang), // Y vector of 3D ang bsin(daang), // Y vector of 3D ang
daz, // Z vector of 3D ang daz, // Z vector of 3D ang
&hitinfo, CLIPMASK_MISSILE); hit, CLIPMASK_MISSILE);
if (hitinfo.sector() == nullptr) if (hit.hitSector == nullptr)
return 0; return 0;
if (RANDOM_P2(1024<<4)>>4 > 700) if (RANDOM_P2(1024<<4)>>4 > 700)
@ -17304,35 +17304,35 @@ int InitEnemyUzi(DSWActor* actor)
PlaySound(DIGI_NINJAUZIATTACK, actor, v3df_none); PlaySound(DIGI_NINJAUZIATTACK, actor, v3df_none);
} }
if (hitinfo.wall() != nullptr) if (hit.hitWall != nullptr)
{ {
if (hitinfo.wall()->twoSided()) if (hit.hitWall->twoSided())
{ {
if (TEST(hitinfo.wall()->nextSector()->ceilingstat, CEILING_STAT_PLAX)) if (TEST(hit.hitWall->nextSector()->ceilingstat, CEILING_STAT_PLAX))
{ {
if (hitinfo.pos.z < hitinfo.wall()->nextSector()->ceilingz) if (hit.hitpos.z < hit.hitWall->nextSector()->ceilingz)
{ {
return 0; return 0;
} }
} }
} }
if (hitinfo.wall()->lotag == TAG_WALL_BREAK) if (hit.hitWall->lotag == TAG_WALL_BREAK)
{ {
HitBreakWall(hitinfo.wall(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, u->ID); HitBreakWall(hit.hitWall, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang, u->ID);
return 0; return 0;
} }
QueueHole(hitinfo.sector(), hitinfo.wall(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z); QueueHole(hit.hitSector, hit.hitWall, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z);
} }
if (hitinfo.hitactor != nullptr) if (hit.actor() != nullptr)
{ {
if (BulletHitSprite(actor, hitinfo.hitactor, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, 0)) if (BulletHitSprite(actor, hit.actor(), hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, 0))
return 0; return 0;
} }
auto actorNew = SpawnActor(STAT_MISSILE, UZI_SMOKE+2, s_UziSmoke, hitinfo.sector(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, 0); auto actorNew = SpawnActor(STAT_MISSILE, UZI_SMOKE+2, s_UziSmoke, hit.hitSector, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang, 0);
wu = actorNew->u(); wu = actorNew->u();
wp = &actorNew->s(); wp = &actorNew->s();
wp->shade = -40; wp->shade = -40;
@ -17349,7 +17349,7 @@ int InitEnemyUzi(DSWActor* actor)
wp->clipdist = 32L >> 2; wp->clipdist = 32L >> 2;
actorNew = SpawnActor(STAT_MISSILE, UZI_SMOKE, s_UziSmoke, hitinfo.sector(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, 0); actorNew = SpawnActor(STAT_MISSILE, UZI_SMOKE, s_UziSmoke, hit.hitSector, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang, 0);
wp = &actorNew->s(); wp = &actorNew->s();
wp->shade = -40; wp->shade = -40;
wp->xrepeat = UZI_SMOKE_REPEAT; wp->xrepeat = UZI_SMOKE_REPEAT;
@ -17358,10 +17358,10 @@ int InitEnemyUzi(DSWActor* actor)
SET(wp->cstat, CSTAT_SPRITE_YCENTER); SET(wp->cstat, CSTAT_SPRITE_YCENTER);
wp->clipdist = 8 >> 2; wp->clipdist = 8 >> 2;
HitscanSpriteAdjust(actorNew, hitinfo.wall()); HitscanSpriteAdjust(actorNew, hit.hitWall);
DoHitscanDamage(actorNew, hitinfo.hitactor); DoHitscanDamage(actorNew, hit.actor());
actorNew = SpawnActor(STAT_MISSILE, UZI_SPARK, s_UziSpark, hitinfo.sector(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, 0); actorNew = SpawnActor(STAT_MISSILE, UZI_SPARK, s_UziSpark, hit.hitSector, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, daang, 0);
wu = actorNew->u(); wu = actorNew->u();
wp = &actorNew->s(); wp = &actorNew->s();
wp->shade = -40; wp->shade = -40;
@ -17372,7 +17372,7 @@ int InitEnemyUzi(DSWActor* actor)
SET(wp->cstat, CSTAT_SPRITE_YCENTER); SET(wp->cstat, CSTAT_SPRITE_YCENTER);
wp->clipdist = 8 >> 2; wp->clipdist = 8 >> 2;
HitscanSpriteAdjust(actorNew, hitinfo.wall()); HitscanSpriteAdjust(actorNew, hit.hitWall);
if (RANDOM_P2(1024) < 100) if (RANDOM_P2(1024) < 100)
{ {
@ -18876,7 +18876,7 @@ DSWActor* QueueWallBlood(DSWActor* actor, short ang)
int sectnum; int sectnum;
short rndnum; short rndnum;
int daz; int daz;
HITINFO hitinfo; HitInfo hit;
USERp u = actor->u(); USERp u = actor->u();
@ -18891,22 +18891,22 @@ DSWActor* QueueWallBlood(DSWActor* actor, short ang)
bcos(dang), // X vector of 3D ang bcos(dang), // X vector of 3D ang
bsin(dang), // Y vector of 3D ang bsin(dang), // Y vector of 3D ang
daz, // Z vector of 3D ang daz, // Z vector of 3D ang
&hitinfo, CLIPMASK_MISSILE); hit, CLIPMASK_MISSILE);
if (hitinfo.sector() == nullptr) if (hit.hitSector == nullptr)
return nullptr; return nullptr;
const int WALLBLOOD_DIST_MAX = 2500; const int WALLBLOOD_DIST_MAX = 2500;
if (Distance(hitinfo.pos.x, hitinfo.pos.y, hsp->x, hsp->y) > WALLBLOOD_DIST_MAX) if (Distance(hit.hitpos.x, hit.hitpos.y, hsp->x, hsp->y) > WALLBLOOD_DIST_MAX)
return nullptr; return nullptr;
// hit a sprite? // hit a sprite?
if (hitinfo.hitactor != nullptr) if (hit.actor() != nullptr)
return nullptr; // Don't try to put blood on a sprite return nullptr; // Don't try to put blood on a sprite
if (hitinfo.wall() != nullptr) // Don't check if blood didn't hit a wall, otherwise the ASSERT fails! if (hit.hitWall != nullptr) // Don't check if blood didn't hit a wall, otherwise the ASSERT fails!
{ {
if (TestDontStick(nullptr, hitinfo.wall())) if (TestDontStick(nullptr, hit.hitWall))
return nullptr; return nullptr;
} }
else else
@ -18921,22 +18921,22 @@ DSWActor* QueueWallBlood(DSWActor* actor, short ang)
if (rndnum > 768) if (rndnum > 768)
{ {
WallBloodQueue[WallBloodQueueHead] = spawnedActor = WallBloodQueue[WallBloodQueueHead] = spawnedActor =
SpawnActor(STAT_WALLBLOOD_QUEUE, WALLBLOOD1, s_WallBlood1, hitinfo.sector(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, ang, 0); SpawnActor(STAT_WALLBLOOD_QUEUE, WALLBLOOD1, s_WallBlood1, hit.hitSector, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, ang, 0);
} }
else if (rndnum > 512) else if (rndnum > 512)
{ {
WallBloodQueue[WallBloodQueueHead] = spawnedActor = WallBloodQueue[WallBloodQueueHead] = spawnedActor =
SpawnActor(STAT_WALLBLOOD_QUEUE, WALLBLOOD2, s_WallBlood2, hitinfo.sector(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, ang, 0); SpawnActor(STAT_WALLBLOOD_QUEUE, WALLBLOOD2, s_WallBlood2, hit.hitSector, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, ang, 0);
} }
else if (rndnum > 128) else if (rndnum > 128)
{ {
WallBloodQueue[WallBloodQueueHead] = spawnedActor = WallBloodQueue[WallBloodQueueHead] = spawnedActor =
SpawnActor(STAT_WALLBLOOD_QUEUE, WALLBLOOD3, s_WallBlood3, hitinfo.sector(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, ang, 0); SpawnActor(STAT_WALLBLOOD_QUEUE, WALLBLOOD3, s_WallBlood3, hit.hitSector, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, ang, 0);
} }
else else
{ {
WallBloodQueue[WallBloodQueueHead] = spawnedActor = WallBloodQueue[WallBloodQueueHead] = spawnedActor =
SpawnActor(STAT_WALLBLOOD_QUEUE, WALLBLOOD4, s_WallBlood4, hitinfo.sector(), hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, ang, 0); SpawnActor(STAT_WALLBLOOD_QUEUE, WALLBLOOD4, s_WallBlood4, hit.hitSector, hit.hitpos.x, hit.hitpos.y, hit.hitpos.z, ang, 0);
} }
WallBloodQueueHead = (WallBloodQueueHead+1) & (MAX_WALLBLOOD_QUEUE-1); WallBloodQueueHead = (WallBloodQueueHead+1) & (MAX_WALLBLOOD_QUEUE-1);
@ -18950,18 +18950,18 @@ DSWActor* QueueWallBlood(DSWActor* actor, short ang)
sp->extra = 0; sp->extra = 0;
sp->clipdist = 0; sp->clipdist = 0;
sp->xoffset = sp->yoffset = 0; sp->xoffset = sp->yoffset = 0;
sp->x = hitinfo.pos.x; sp->x = hit.hitpos.x;
sp->y = hitinfo.pos.y; sp->y = hit.hitpos.y;
sp->z = hitinfo.pos.z; sp->z = hit.hitpos.z;
sp->shade -= 5; // Brighten it up just a bit sp->shade -= 5; // Brighten it up just a bit
spawnedActor->tempwall = hitinfo.wall(); // pass hitinfo.wall spawnedActor->tempwall = hit.hitWall; // pass hitinfo.wall
SET(sp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL); SET(sp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL);
SET(sp->cstat, CSTAT_SPRITE_ONE_SIDED); SET(sp->cstat, CSTAT_SPRITE_ONE_SIDED);
SET(sp->cstat, CSTAT_SPRITE_YCENTER); SET(sp->cstat, CSTAT_SPRITE_YCENTER);
RESET(sp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); RESET(sp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
wall_ang = NORM_ANGLE(getangle(hitinfo.wall()->delta()) + 512); wall_ang = NORM_ANGLE(getangle(hit.hitWall->delta()) + 512);
sp->ang = wall_ang; sp->ang = wall_ang;
// move it back some // move it back some