From 732aa2023b79bf10158b30b95d917fc3ff187b68 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 24 Nov 2021 19:49:03 +0100 Subject: [PATCH] - over_sp/under_sp sectnums --- source/games/sw/src/_polymost.cpp | 2 -- source/games/sw/src/player.cpp | 15 +++++++-------- source/games/sw/src/weapon.cpp | 25 ++++++++++++------------- source/games/sw/src/zombie.cpp | 3 --- 4 files changed, 19 insertions(+), 26 deletions(-) diff --git a/source/games/sw/src/_polymost.cpp b/source/games/sw/src/_polymost.cpp index e01bd8760..ac1d6cd51 100644 --- a/source/games/sw/src/_polymost.cpp +++ b/source/games/sw/src/_polymost.cpp @@ -103,7 +103,6 @@ void FAF_DrawRooms(int x, int y, int z, fixed_t q16ang, fixed_t q16horiz, int se SP_TAG5(sp) = sp->sector()->ceilingpicnum; sp->sector()->ceilingpicnum = SP_TAG2(sp); SP_TAG4(sp) = sp->sector()->ceilingstat; - //SET(sp->sectnum].ceilingstat, ((int)SP_TAG7(sp))<<7); SET(sp->sector()->ceilingstat, SP_TAG6(sp)); RESET(sp->sector()->ceilingstat, CEILING_STAT_PLAX); } @@ -112,7 +111,6 @@ void FAF_DrawRooms(int x, int y, int z, fixed_t q16ang, fixed_t q16horiz, int se SP_TAG5(sp) = sp->sector()->floorpicnum; sp->sector()->floorpicnum = SP_TAG2(sp); SP_TAG4(sp) = sp->sector()->floorstat; - //SET(sp->sector()->floorstat, ((int)SP_TAG7(sp))<<7); SET(sp->sector()->floorstat, SP_TAG6(sp)); RESET(sp->sector()->floorstat, FLOOR_STAT_PLAX); } diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 52272314d..0271feb71 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -1719,8 +1719,7 @@ void UpdatePlayerUnderSprite(PLAYERp pp) ASSERT(over_u); // dont bother spawning if you ain't really in the water - //water_level_z = sector[over_sp->sectnum].floorz - Z(pp->WadeDepth); - water_level_z = sector[over_sp->sectnum].floorz; // - Z(pp->WadeDepth); + water_level_z = over_sp->sector()->floorz; // - Z(pp->WadeDepth); // if not below water above_water = (SPRITEp_BOS(over_sp) <= water_level_z); @@ -4100,7 +4099,7 @@ void DoPlayerWarpToUnderwater(PLAYERp pp) { over_sp = &actor->s(); - if (TEST(sector[over_sp->sectnum].extra, SECTFX_DIVE_AREA) && + if (TEST(over_sp->sector()->extra, SECTFX_DIVE_AREA) && over_sp->sector()->hasU() && over_sp->sector()->number == sectu->number) { @@ -4118,7 +4117,7 @@ void DoPlayerWarpToUnderwater(PLAYERp pp) { under_sp = &actor->s(); - if (TEST(sector[under_sp->sectnum].extra, SECTFX_UNDERWATER) && + if (TEST(under_sp->sector()->extra, SECTFX_UNDERWATER) && under_sp->sector()->hasU() && under_sp->sector()->number == sectu->number) { @@ -4147,7 +4146,7 @@ void DoPlayerWarpToUnderwater(PLAYERp pp) else pp->cursectnum = over; - pp->posz = sector[under_sp->sectnum].ceilingz + Z(6); + pp->posz = under_sp->sector()->ceilingz + Z(6); pp->oposx = pp->posx; pp->oposy = pp->posy; @@ -4175,7 +4174,7 @@ void DoPlayerWarpToSurface(PLAYERp pp) { under_sp = &actor->s(); - if (TEST(sector[under_sp->sectnum].extra, SECTFX_UNDERWATER) && + if (TEST(under_sp->sector()->extra, SECTFX_UNDERWATER) && under_sp->sector()->hasU() && under_sp->sector()->number == sectu->number) { @@ -4193,7 +4192,7 @@ void DoPlayerWarpToSurface(PLAYERp pp) { over_sp = &actor->s(); - if (TEST(sector[over_sp->sectnum].extra, SECTFX_DIVE_AREA) && + if (TEST(over_sp->sector()->extra, SECTFX_DIVE_AREA) && over_sp->sector()->hasU() && over_sp->sector()->number == sectu->number) { @@ -4220,7 +4219,7 @@ void DoPlayerWarpToSurface(PLAYERp pp) pp->cursectnum = over; } - pp->posz = sector[over_sp->sectnum].floorz - Z(2); + pp->posz = over_sp->sector()->floorz - Z(2); // set z range and wade depth so we know how high to set view DoPlayerZrange(pp); diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 5ab357570..9b39f8a0c 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -17900,7 +17900,7 @@ bool WarpToUnderwater(int *sectnum, int *x, int *y, int *z) { over_sp = &itActor->s(); - if (TEST(sector[over_sp->sectnum].extra, SECTFX_DIVE_AREA) && + if (TEST(over_sp->sector()->extra, SECTFX_DIVE_AREA) && over_sp->sector()->hasU() && sectu->hasU() && over_sp->sector()->number == sectu->number) { @@ -17918,7 +17918,7 @@ bool WarpToUnderwater(int *sectnum, int *x, int *y, int *z) { under_sp = &itActor->s(); - if (TEST(sector[under_sp->sectnum].extra, SECTFX_UNDERWATER) && + if (TEST(under_sp->sector()->extra, SECTFX_UNDERWATER) && under_sp->sector()->hasU() && under_sp->sector()->number == sectu->number) { @@ -17949,7 +17949,7 @@ bool WarpToUnderwater(int *sectnum, int *x, int *y, int *z) *sectnum = under; } - *z = sector[under_sp->sectnum].ceilingz + Z(1); + *z = under_sp->sector()->ceilingz + Z(1); return true; } @@ -17974,7 +17974,7 @@ bool WarpToSurface(int *sectnum, int *x, int *y, int *z) { under_sp = &itActor->s(); - if (TEST(sector[under_sp->sectnum].extra, SECTFX_UNDERWATER) && + if (TEST(under_sp->sector()->extra, SECTFX_UNDERWATER) && under_sp->sector()->hasU() && sectu->hasU() && under_sp->sector()->number == sectu->number) { @@ -17992,7 +17992,7 @@ bool WarpToSurface(int *sectnum, int *x, int *y, int *z) { over_sp = &itActor->s(); - if (TEST(sector[over_sp->sectnum].extra, SECTFX_DIVE_AREA) && + if (TEST(over_sp->sector()->extra, SECTFX_DIVE_AREA) && over_sp->sector()->hasU() && over_sp->sector()->number == sectu->number) { @@ -18019,7 +18019,7 @@ bool WarpToSurface(int *sectnum, int *x, int *y, int *z) *sectnum = over; } - *z = sector[over_sp->sectnum].floorz - Z(2); + *z = over_sp->sector()->floorz - Z(2); return true; } @@ -18046,7 +18046,7 @@ bool SpriteWarpToUnderwater(DSWActor* actor) { over_sp = &itActor->s(); - if (TEST(sector[over_sp->sectnum].extra, SECTFX_DIVE_AREA) && + if (TEST(over_sp->sector()->extra, SECTFX_DIVE_AREA) && over_sp->sector()->hasU() && over_sp->sector()->number == sectu->number) { @@ -18064,7 +18064,7 @@ bool SpriteWarpToUnderwater(DSWActor* actor) { under_sp = &itActor->s(); - if (TEST(sector[under_sp->sectnum].extra, SECTFX_UNDERWATER) && + if (TEST(under_sp->sector()->extra, SECTFX_UNDERWATER) && under_sp->sector()->hasU() && under_sp->sector()->number == sectu->number) { @@ -18095,8 +18095,7 @@ bool SpriteWarpToUnderwater(DSWActor* actor) ChangeActorSect(actor, over); } - //sp->z = sector[under_sp->sectnum].ceilingz + Z(6); - sp->z = sector[under_sp->sectnum].ceilingz + u->ceiling_dist+Z(1); + sp->z = under_sp->sector()->ceilingz + u->ceiling_dist+Z(1); sp->backuppos(); @@ -18124,7 +18123,7 @@ bool SpriteWarpToSurface(DSWActor* actor) { under_sp = &itActor->s(); - if (TEST(sector[under_sp->sectnum].extra, SECTFX_UNDERWATER) && + if (TEST(under_sp->sector()->extra, SECTFX_UNDERWATER) && under_sp->sector()->hasU() && under_sp->sector()->number == sectu->number) { @@ -18146,7 +18145,7 @@ bool SpriteWarpToSurface(DSWActor* actor) { over_sp = &itActor->s(); - if (TEST(sector[over_sp->sectnum].extra, SECTFX_DIVE_AREA) && + if (TEST(over_sp->sector()->extra, SECTFX_DIVE_AREA) && over_sp->sector()->hasU() && over_sp->sector()->number == sectu->number) { @@ -18173,7 +18172,7 @@ bool SpriteWarpToSurface(DSWActor* actor) ChangeActorSect(actor, over); } - sp->z = sector[over_sp->sectnum].floorz - Z(2); + sp->z = over_sp->sector()->floorz - Z(2); // set z range and wade depth so we know how high to set view DoActorZrange(actor); diff --git a/source/games/sw/src/zombie.cpp b/source/games/sw/src/zombie.cpp index 6ce1d8bad..7aa367606 100644 --- a/source/games/sw/src/zombie.cpp +++ b/source/games/sw/src/zombie.cpp @@ -824,9 +824,6 @@ void SpawnZombie2(DSWActor* actor) if (SectorIsUnderwaterArea(sp->sectnum)) return; - //if (FAF_ConnectArea(sp->sectnum)) - // return(-1); - if (FAF_ConnectArea(sp->sectnum)) { int sectnum = sp->sectnum;