diff --git a/source/games/sw/src/ai.cpp b/source/games/sw/src/ai.cpp index 67457b495..6dbd2e032 100644 --- a/source/games/sw/src/ai.cpp +++ b/source/games/sw/src/ai.cpp @@ -279,7 +279,7 @@ int CanHitPlayer(DSWActor* actor) // if (labs(zvect / FindDistance2D(hp->x - sp->x, hp->y - sp->y)) > 200) // return(false); - FAFhitscan(sp->x, sp->y, zhs, sp->sectnum, + FAFhitscan(sp->x, sp->y, zhs, sp->sector(), xvect, yvect, zvect, diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 6de63e454..05ece23bc 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -1924,7 +1924,7 @@ void FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum, int32_t xvect, int32_t yvect, int32_t zvect, hitdata_t* hitinfo, int32_t clipmask); -void FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum, +void FAFhitscan(int32_t x, int32_t y, int32_t z, sectortype* sectnum, int32_t xvect, int32_t yvect, int32_t zvect, HITINFO* hitinfo, int32_t clipmask); diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 4036c31a8..33e94e60e 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -3431,7 +3431,7 @@ int DoPlayerWadeSuperJump(PLAYERp pp) for (i = 0; i < SIZ(angs); i++) { - FAFhitscan(pp->posx, pp->posy, zh, pp->cursectnum, // Start position + FAFhitscan(pp->posx, pp->posy, zh, pp->cursector(), // Start position bcos(pp->angle.ang.asbuild() + angs[i]), // X 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 @@ -3760,7 +3760,7 @@ bool PlayerOnLadder(PLAYERp pp) if (wal < 0 || dist < 100 || wall[wal].lotag != TAG_WALL_CLIMB) return false; - FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, + FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursector(), bcos(pp->angle.ang.asbuild() + angles[i]), bsin(pp->angle.ang.asbuild() + angles[i]), 0, diff --git a/source/games/sw/src/ripper.cpp b/source/games/sw/src/ripper.cpp index 019418586..9534ca603 100644 --- a/source/games/sw/src/ripper.cpp +++ b/source/games/sw/src/ripper.cpp @@ -944,7 +944,7 @@ int InitRipperHang(DSWActor* actor) { tang = NORM_ANGLE(sp->ang + dang); - FAFhitscan(sp->x, sp->y, sp->z - SPRITEp_SIZE_Z(sp), sp->sectnum, // Start position + FAFhitscan(sp->x, sp->y, sp->z - SPRITEp_SIZE_Z(sp), sp->sector(), // Start position bcos(tang), // X vector of 3D ang bsin(tang), // Y vector of 3D ang 0, // Z vector of 3D ang diff --git a/source/games/sw/src/ripper2.cpp b/source/games/sw/src/ripper2.cpp index 2bb68d45e..4eb371aec 100644 --- a/source/games/sw/src/ripper2.cpp +++ b/source/games/sw/src/ripper2.cpp @@ -947,7 +947,7 @@ int InitRipper2Hang(DSWActor* actor) { tang = NORM_ANGLE(sp->ang + dang); - FAFhitscan(sp->x, sp->y, sp->z - SPRITEp_SIZE_Z(sp), sp->sectnum, // Start position + FAFhitscan(sp->x, sp->y, sp->z - SPRITEp_SIZE_Z(sp), sp->sector(), // Start position bcos(tang), // X vector of 3D ang bsin(tang), // Y vector of 3D ang 0, // Z vector of 3D ang diff --git a/source/games/sw/src/rooms.cpp b/source/games/sw/src/rooms.cpp index 3c2ba9ffb..9fd8a113e 100644 --- a/source/games/sw/src/rooms.cpp +++ b/source/games/sw/src/rooms.cpp @@ -157,12 +157,12 @@ void ResetWallWarpHitscan(sectortype* sect) } void -FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum, +FAFhitscan(int32_t x, int32_t y, int32_t z, sectortype* sect, int32_t xvect, int32_t yvect, int32_t zvect, HITINFO* hitinfo, int32_t clipmask) { hitdata_t hitdata; - FAFhitscan(x, y, z, sectnum, xvect, yvect, zvect, &hitdata, clipmask); + FAFhitscan(x, y, z, sectnum(sect), xvect, yvect, zvect, &hitdata, clipmask); hitinfo->set(&hitdata); } diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index 8afd8f156..8fe8b0151 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -2083,7 +2083,7 @@ bool NearThings(PLAYERp pp) HITINFO hitinfo; short dang = pp->angle.ang.asbuild(); - FAFhitscan(pp->posx, pp->posy, pp->posz - Z(30), pp->cursectnum, // Start position + FAFhitscan(pp->posx, pp->posy, pp->posz - Z(30), pp->cursector(), // Start position bcos(dang), // X vector of 3D ang bsin(dang), // Y vector of 3D ang 0, // Z vector of 3D ang diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index 515728daf..dd21b9e11 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -3134,7 +3134,7 @@ bool ActorTrackDecide(TRACK_POINTp tpoint, DSWActor* actor) { RESET(sp->cstat, CSTAT_SPRITE_BLOCK); - FAFhitscan(sp->x, sp->y, sp->z - Z(24), sp->sectnum, // Start position + FAFhitscan(sp->x, sp->y, sp->z - Z(24), sp->sector(), // Start position bcos(sp->ang), // X vector of 3D ang bsin(sp->ang), // Y vector of 3D ang 0, // Z vector of 3D ang diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 77359e44a..fe0080e18 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -12542,7 +12542,7 @@ int InitSwordAttack(PLAYERp pp) daang = pp->angle.ang.asbuild(); daz = -MulScale(pp->horizon.horiz.asq16(), 2000, 16) + (RandomRange(24000) - 12000); - FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position + FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursector(), // Start position bcos(daang), // X vector of 3D ang bsin(daang), // Y vector of 3D ang daz, // Z vector of 3D ang @@ -12732,7 +12732,7 @@ int InitFistAttack(PLAYERp pp) daang = pp->angle.ang.asbuild(); daz = -MulScale(pp->horizon.horiz.asq16(), 2000, 16) + (RandomRange(24000) - 12000); - FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position + FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursector(), // Start position bcos(daang), // X vector of 3D ang bsin(daang), // Y vector of 3D ang daz, // Z vector of 3D ang @@ -13504,7 +13504,7 @@ int ContinueHitscan(PLAYERp pp, sectortype* sect, int x, int y, int z, short ang HITINFO hitinfo; USERp u = pp->Actor()->u(); - FAFhitscan(x, y, z, sectnum(sect), + FAFhitscan(x, y, z, sect, xvect, yvect, zvect, &hitinfo, CLIPMASK_MISSILE); @@ -13585,7 +13585,6 @@ int InitShotgun(PLAYERp pp) auto sp = &pp->Actor()->s(); short daang,ndaang, i; HITINFO hitinfo; - short nsect; int daz, ndaz; int nx,ny,nz; int xvect,yvect,zvect; @@ -13610,7 +13609,6 @@ int InitShotgun(PLAYERp pp) nx = pp->posx; ny = pp->posy; daz = nz = pp->posz + pp->bob_z; - nsect = pp->cursectnum; daang = 64; if (WeaponAutoAimHitscan(pp->Actor(), &daz, &daang, false) != nullptr) @@ -13638,7 +13636,7 @@ int InitShotgun(PLAYERp pp) xvect = bcos(ndaang); yvect = bsin(ndaang); zvect = ndaz; - FAFhitscan(nx, ny, nz, nsect, // Start position + FAFhitscan(nx, ny, nz, pp->cursector(), // Start position xvect, yvect, zvect, &hitinfo, CLIPMASK_MISSILE); @@ -16197,7 +16195,7 @@ int InitUzi(PLAYERp pp) xvect = bcos(daang); yvect = bsin(daang); zvect = daz; - FAFhitscan(pp->posx, pp->posy, nz, pp->cursectnum, // Start position + FAFhitscan(pp->posx, pp->posy, nz, pp->cursector(), // Start position xvect,yvect,zvect, &hitinfo, CLIPMASK_MISSILE); @@ -16710,7 +16708,6 @@ int InitSobjMachineGun(DSWActor* actor, PLAYERp pp) SPRITEp sp = &actor->s(); short daang; HITINFO hitinfo; - short nsect; int daz; int nx,ny,nz; short cstat = 0; @@ -16721,7 +16718,6 @@ int InitSobjMachineGun(DSWActor* actor, PLAYERp pp) nx = sp->x; ny = sp->y; daz = nz = sp->z; - nsect = sp->sectnum; if (RANDOM_P2(1024) < 200) InitTracerTurret(actor, pp->Actor(), pp->horizon.horiz.asq16()); @@ -16743,7 +16739,7 @@ int InitSobjMachineGun(DSWActor* actor, PLAYERp pp) daang = sp->ang; } - FAFhitscan(nx, ny, nz, nsect, // Start position + FAFhitscan(nx, ny, nz, sp->sector(), // Start position bcos(daang), // X vector of 3D ang bsin(daang), // Y vector of 3D ang daz, // Z vector of 3D ang @@ -17080,7 +17076,6 @@ int InitTurretMgun(SECTOR_OBJECTp sop) SPRITEp hsp; short daang, i; HITINFO hitinfo; - short nsect; int daz; int nx,ny,nz; short cstat = 0; @@ -17099,7 +17094,6 @@ int InitTurretMgun(SECTOR_OBJECTp sop) nx = sp->x; ny = sp->y; daz = nz = sp->z; - nsect = sp->sectnum; // if its not operated by a player if (sop->Animator) @@ -17148,7 +17142,7 @@ int InitTurretMgun(SECTOR_OBJECTp sop) yvect = bsin(daang); zvect = daz; - FAFhitscan(nx, ny, nz, nsect, // Start position + FAFhitscan(nx, ny, nz, sp->sector(), // Start position xvect, yvect, zvect, &hitinfo, CLIPMASK_MISSILE); @@ -17291,7 +17285,7 @@ int InitEnemyUzi(DSWActor* actor) daang = NORM_ANGLE(sp->ang + (RANDOM_P2(128)) - 64); } - FAFhitscan(sp->x, sp->y, sp->z - zh, sp->sectnum, // Start position + FAFhitscan(sp->x, sp->y, sp->z - zh, sp->sector(), // Start position bcos(daang), // X vector of 3D ang bsin(daang), // Y vector of 3D ang daz, // Z vector of 3D ang @@ -18901,7 +18895,7 @@ DSWActor* QueueWallBlood(DSWActor* actor, short ang) daz -= DIV2(Z(128)<<3); dang = (ang+(RANDOM_P2(128<<5) >> 5)) - DIV2(128); - FAFhitscan(hsp->x, hsp->y, hsp->z - Z(30), hsp->sectnum, // Start position + FAFhitscan(hsp->x, hsp->y, hsp->z - Z(30), hsp->sector(), // Start position bcos(dang), // X vector of 3D ang bsin(dang), // Y vector of 3D ang daz, // Z vector of 3D ang