diff --git a/source/games/sw/src/misc.h b/source/games/sw/src/misc.h index e0593eb89..db9ab17d7 100644 --- a/source/games/sw/src/misc.h +++ b/source/games/sw/src/misc.h @@ -19,7 +19,7 @@ void MapColors(short num,COLOR_MAP cm,short create); int32_t CONFIG_ReadSetup(void); DSWActor* WarpPlane(int32_t* x, int32_t* y, int32_t* z, int* sectnum); -bool WarpSectorInfo(short sectnum, DSWActor** sp_warp); +bool WarpSectorInfo(sectortype* sect, DSWActor** sp_warp); DSWActor* Warp(int32_t* x, int32_t* y, int32_t* z, int* sectnum); [[deprecated]] diff --git a/source/games/sw/src/rooms.cpp b/source/games/sw/src/rooms.cpp index c4a97b919..3c2ba9ffb 100644 --- a/source/games/sw/src/rooms.cpp +++ b/source/games/sw/src/rooms.cpp @@ -119,17 +119,17 @@ bool FAF_Sector(sectortype* sectnum) return false; } -void SetWallWarpHitscan(short sectnum) +void SetWallWarpHitscan(sectortype* sect) { DSWActor* sp_warp; - if (!WarpSectorInfo(sectnum, &sp_warp)) + if (!WarpSectorInfo(sect, &sp_warp)) return; if (!sp_warp) return; - auto start_wall = sector[sectnum].firstWall(); + auto start_wall = sect->firstWall(); auto wall_num = start_wall; // Travel all the way around loop setting wall bits @@ -142,9 +142,9 @@ void SetWallWarpHitscan(short sectnum) while (wall_num != start_wall); } -void ResetWallWarpHitscan(short sectnum) +void ResetWallWarpHitscan(sectortype* sect) { - auto start_wall = sector[sectnum].firstWall(); + auto start_wall = sect->firstWall(); auto wall_num = start_wall; // Travel all the way around loop setting wall bits @@ -192,8 +192,6 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum, // hitscan warping if (TEST(wall[hitinfo->wall].cstat, CSTAT_WALL_WARP_HITSCAN)) { - short dest_sect; - MONO_PRINT(ds); // back it up a bit to get a correct warp location @@ -205,7 +203,7 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum, { vec3_t pos = hitinfo->pos; - dest_sect = hitinfo->sect; + auto dest_sect = §or[hitinfo->sect]; // hitscan needs to pass through dest sect ResetWallWarpHitscan(dest_sect); diff --git a/source/games/sw/src/warp.cpp b/source/games/sw/src/warp.cpp index e58e12dfa..5e4eb5885 100644 --- a/source/games/sw/src/warp.cpp +++ b/source/games/sw/src/warp.cpp @@ -206,11 +206,11 @@ DSWActor* WarpToArea(DSWActor* sp_from, int32_t* x, int32_t* y, int32_t* z, int* // //////////////////////////////////////////////////////////////////////////////// -bool WarpSectorInfo(short sectnum, DSWActor** sp_warp) +bool WarpSectorInfo(sectortype* sect, DSWActor** sp_warp) { *sp_warp = nullptr; - if (!TEST(sector[sectnum].extra, SECTFX_WARP_SECTOR)) + if (!TEST(sect->extra, SECTFX_WARP_SECTOR)) return false; SWStatIterator it(STAT_WARP); @@ -218,7 +218,7 @@ bool WarpSectorInfo(short sectnum, DSWActor** sp_warp) { auto sp = &actor->s(); - if (sp->sectnum == sectnum) + if (sp->sector() == sect) { // skip - don't teleport if (SP_TAG10(sp) == 1) @@ -241,7 +241,7 @@ DSWActor* Warp(int32_t* x, int32_t* y, int32_t* z, int* sectnum) if (Prediction) return nullptr; - if (!WarpSectorInfo(*sectnum, &sp_warp)) + if (!WarpSectorInfo(§or[*sectnum], &sp_warp)) return nullptr; if (sp_warp)