From 8325e7369fee7617101fb23188edd91ed3dc7966 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 3 Feb 2022 00:50:36 +0100 Subject: [PATCH] - removed floorzptr and ceilingzptr. These were obstacles for further changes. --- source/core/maptypes.h | 12 ------------ source/games/duke/src/actors.cpp | 20 +++++++++++++------- source/games/sw/src/vator.cpp | 30 +++++++++++++++++------------- 3 files changed, 30 insertions(+), 32 deletions(-) diff --git a/source/core/maptypes.h b/source/core/maptypes.h index 3a88ac061..30904af66 100644 --- a/source/core/maptypes.h +++ b/source/core/maptypes.h @@ -253,8 +253,6 @@ struct sectortype void set_int_floorz(int cc, bool temp = false); void add_int_ceilingz(int cc, bool temp = false); void add_int_floorz(int cc, bool temp = false); - int32_t* ceilingzptr(bool temp = false); - int32_t* floorzptr(bool temp = false); #endif @@ -695,16 +693,6 @@ inline void sectortype::add_int_floorz(int cc, bool temp) __int_floorz += cc; if (!temp) MarkVerticesForSector(sector.IndexOf(this)); } -inline int32_t* sectortype::ceilingzptr(bool temp) -{ - if (!temp) MarkVerticesForSector(sector.IndexOf(this)); - return &__int_ceilingz; -} -inline int32_t* sectortype::floorzptr(bool temp) -{ - if (!temp) MarkVerticesForSector(sector.IndexOf(this)); - return &__int_floorz; -} #endif diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 268de52e9..b874dfe7c 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -4211,30 +4211,36 @@ void handle_se20(DDukeActor* actor) void handle_se21(DDukeActor* actor) { auto sc = actor->sector(); - int* lp; + int lp; if (actor->temp_data[0] == 0) return; if (actor->spr.ang == 1536) - lp = sc->ceilingzptr(); + lp = sc->int_ceilingz(); else - lp = sc->floorzptr(); + lp = sc->int_floorz(); if (actor->temp_data[0] == 1) //Decide if the sector should go up or down { - actor->spr.zvel = Sgn(actor->int_pos().Z - *lp) * (actor->spr.yvel << 4); + actor->spr.zvel = Sgn(actor->int_pos().Z - lp) * (actor->spr.yvel << 4); actor->temp_data[0]++; } if (sc->extra == 0) { - *lp += actor->spr.zvel; + lp += actor->spr.zvel; - if (abs(*lp - actor->int_pos().Z) < 1024) + if (abs(lp - actor->int_pos().Z) < 1024) { - *lp = actor->int_pos().Z; + lp = actor->int_pos().Z; deletesprite(actor); } + + if (actor->spr.ang == 1536) + sc->set_int_ceilingz(lp); + else + sc->set_int_floorz(lp); + } else sc->extra--; } diff --git a/source/games/sw/src/vator.cpp b/source/games/sw/src/vator.cpp index 53752b673..6ae1d548c 100644 --- a/source/games/sw/src/vator.cpp +++ b/source/games/sw/src/vator.cpp @@ -364,7 +364,7 @@ int DoVatorMove(DSWActor* actor, int *lptr) int DoVator(DSWActor* actor) { sectortype* sectp = actor->sector(); - int *lptr; + int zval; int amt; // actor->user.sz - where the sector z started @@ -375,19 +375,21 @@ int DoVator(DSWActor* actor) if (actor->spr.cstat & (CSTAT_SPRITE_YFLIP)) { - lptr = sectp->ceilingzptr(); - amt = DoVatorMove(actor, lptr); + zval = sectp->int_ceilingz(); + amt = DoVatorMove(actor, &zval); + sectp->set_int_ceilingz(zval); MoveSpritesWithSector(actor->sector(), amt, true); // ceiling } else { - lptr = sectp->floorzptr(); - amt = DoVatorMove(actor, lptr); + zval = sectp->int_floorz(); + amt = DoVatorMove(actor, &zval); + sectp->set_int_floorz(zval); MoveSpritesWithSector(actor->sector(), amt, false); // floor } // EQUAL this entry has finished - if (*lptr == actor->user.z_tgt) + if (zval == actor->user.z_tgt) { // in the ON position if (actor->user.z_tgt == actor->int_pos().Z) @@ -436,7 +438,7 @@ int DoVator(DSWActor* actor) } // setup to go back to the original z - if (*lptr != actor->user.oz) + if (zval != actor->user.oz) { if (actor->user.WaitTics) actor->user.Tics = actor->user.WaitTics; @@ -521,24 +523,26 @@ int DoVator(DSWActor* actor) int DoVatorAuto(DSWActor* actor) { sectortype* sectp = actor->sector(); - int *lptr; + int zval; int amt; if (actor->spr.cstat & (CSTAT_SPRITE_YFLIP)) { - lptr = sectp->ceilingzptr(); - amt = DoVatorMove(actor, lptr); + zval = sectp->int_ceilingz(); + amt = DoVatorMove(actor, &zval); + sectp->set_int_ceilingz(zval); MoveSpritesWithSector(actor->sector(), amt, true); // ceiling } else { - lptr = sectp->floorzptr(); - amt = DoVatorMove(actor, lptr); + zval = sectp->int_floorz(); + amt = DoVatorMove(actor, &zval); + sectp->set_int_floorz(zval); MoveSpritesWithSector(actor->sector(), amt, false); // floor } // EQUAL this entry has finished - if (*lptr == actor->user.z_tgt) + if (zval == actor->user.z_tgt) { // in the UP position if (actor->user.z_tgt == actor->int_pos().Z)