diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 64f62d10a..1e5ca10f3 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -1860,7 +1860,7 @@ short AnimSetVelAdj(short anim_ndx, short vel_adj); void EnemyDefaults(DSWActor* actor, ACTOR_ACTION_SETp action, PERSONALITYp person); -void getzrangepoint(int x, int y, int z, short sectnum, int32_t* ceilz, Collision* ceilhit, int32_t* florz, Collision* florhit); +void getzrangepoint(int x, int y, int z, sectortype* sect, int32_t* ceilz, Collision* ceilhit, int32_t* florz, Collision* florhit); Collision move_sprite(DSWActor* , int xchange, int ychange, int zchange, int ceildist, int flordist, uint32_t cliptype, int numtics); Collision move_missile(DSWActor*, int xchange, int ychange, int zchange, int ceildist, int flordist, uint32_t cliptype, int numtics); DSWActor* DoPickTarget(DSWActor*, uint32_t max_delta_ang, int skip_targets); diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index e9deeebc3..11649050c 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -3002,12 +3002,12 @@ void StackedWaterSplash(PLAYERp pp) { if (FAF_ConnectArea(pp->cursector)) { - auto sectnum = pp->cursector; + auto sect = pp->cursector; auto psp = &pp->Actor()->s(); - updatesectorz(pp->posx, pp->posy, SPRITEp_BOS(psp), §num); + updatesectorz(pp->posx, pp->posy, SPRITEp_BOS(psp), §); - if (SectorIsUnderwaterArea(sectnum)) + if (SectorIsUnderwaterArea(sect)) { PlaySound(DIGI_SPLASH1, pp, v3df_dontpan); } diff --git a/source/games/sw/src/rooms.cpp b/source/games/sw/src/rooms.cpp index cdd80ef02..880bd3ed5 100644 --- a/source/games/sw/src/rooms.cpp +++ b/source/games/sw/src/rooms.cpp @@ -532,7 +532,6 @@ void FAFgetzrangepoint(int32_t x, int32_t y, int32_t z, sectortype* const sect, int32_t* hiz, Collision* ceilhit, int32_t* loz, Collision* florhit) { - int sectnum = ::sectnum(sect); int foo1; Collision foo2; bool SkipFAFcheck; @@ -545,13 +544,13 @@ void FAFgetzrangepoint(int32_t x, int32_t y, int32_t z, sectortype* const sect, // early out to regular routine if (!FAF_ConnectArea(sect)) { - getzrangepoint(x, y, z, sectnum, hiz, ceilhit, loz, florhit); + getzrangepoint(x, y, z, sect, hiz, ceilhit, loz, florhit); SectorZadjust(*ceilhit, hiz, *florhit, loz); WaterAdjust(*florhit, loz); return; } - getzrangepoint(x, y, z, sectnum, hiz, ceilhit, loz, florhit); + getzrangepoint(x, y, z, sect, hiz, ceilhit, loz, florhit); SkipFAFcheck = SectorZadjust(*ceilhit, hiz, *florhit, loz); WaterAdjust(*florhit, loz); @@ -560,25 +559,25 @@ void FAFgetzrangepoint(int32_t x, int32_t y, int32_t z, sectortype* const sect, if (FAF_ConnectCeiling(sect)) { - int uppersect = sectnum; + auto uppersect = sect; int newz = *hiz - Z(2); if (ceilhit->type == kHitSprite) return; updatesectorz(x, y, newz, &uppersect); - if (uppersect < 0) + if (uppersect == nullptr) return; getzrangepoint(x, y, newz, uppersect, hiz, ceilhit, &foo1, &foo2); SectorZadjust(*ceilhit, hiz, trash, nullptr); } else if (FAF_ConnectFloor(sect) && !TEST(sect->floorstat, FLOOR_STAT_FAF_BLOCK_HITSCAN)) { - int lowersect = sectnum; + auto lowersect = sect; int newz = *loz + Z(2); if (florhit->type == kHitSprite) return; updatesectorz(x, y, newz, &lowersect); - if (lowersect < 0) + if (lowersect == nullptr) return; getzrangepoint(x, y, newz, lowersect, &foo1, &foo2, loz, florhit); SectorZadjust(trash, nullptr, *florhit, loz); diff --git a/source/games/sw/src/rotator.cpp b/source/games/sw/src/rotator.cpp index c79fe2871..e27be7ec1 100644 --- a/source/games/sw/src/rotator.cpp +++ b/source/games/sw/src/rotator.cpp @@ -146,7 +146,6 @@ void DoRotatorMatch(PLAYERp pp, short match, bool manual) { USERp fu; SPRITEp fsp; - short sectnum; DSWActor* firstVator = nullptr; //RotatorSwitch(match, ON); diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index fdb3dab51..d5f499323 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -608,7 +608,7 @@ void SectorMidPoint(sectortype* sectp, int *xmid, int *ymid, int *zmid) } -void DoSpringBoard(PLAYERp pp/*, short sectnum*/) +void DoSpringBoard(PLAYERp pp) { pp->jump_speed = -pp->cursector->hitag; diff --git a/source/games/sw/src/slidor.cpp b/source/games/sw/src/slidor.cpp index 8770725bb..673d4e117 100644 --- a/source/games/sw/src/slidor.cpp +++ b/source/games/sw/src/slidor.cpp @@ -145,7 +145,6 @@ void DoSlidorMatch(PLAYERp pp, short match, bool manual) { USERp fu; SPRITEp fsp; - short sectnum; SWStatIterator it(STAT_SLIDOR); while (auto actor = it.Next()) diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index d5b746344..1002cba27 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -619,7 +619,6 @@ void KillActor(DSWActor* actor) USERp u = actor->u(); int i; unsigned stat; - short statnum,sectnum; //extern short Zombies; ASSERT(!Prediction); @@ -2332,7 +2331,7 @@ void SpriteSetup(void) break; } - getzrangepoint(sp->x, sp->y, sp->z, sp->sectnum, &ceilingz, &trash, &floorz, &trash); + getzrangepoint(sp->x, sp->y, sp->z, sp->sector(), &ceilingz, &trash, &floorz, &trash); if (floor_vator) { @@ -4467,7 +4466,7 @@ bool SpriteOverlapZ(DSWActor* actor_a, DSWActor* actor_b, int z_overlap) } -void getzrangepoint(int x, int y, int z, short sectnum, +void getzrangepoint(int x, int y, int z, sectortype* sect, int32_t* ceilz, Collision* ceilhit, int32_t* florz, Collision* florhit) { spritetype *spr; @@ -4476,7 +4475,7 @@ void getzrangepoint(int x, int y, int z, short sectnum, short cstat; char clipyou; - if (sectnum < 0) + if (sect == nullptr) { *ceilz = 0x80000000; @@ -4486,12 +4485,12 @@ void getzrangepoint(int x, int y, int z, short sectnum, } // Initialize z's and hits to the current sector's top&bottom - getzsofslope(sectnum, x, y, ceilz, florz); - ceilhit->setSector(sectnum); - florhit->setSector(sectnum); + getzsofslopeptr(sect, x, y, ceilz, florz); + ceilhit->setSector(sect); + florhit->setSector(sect); // Go through sprites of only the current sector - SWSectIterator it(sectnum); + SWSectIterator it(sect); while (auto itActor = it.Next()) { spr = &itActor->s();