diff --git a/source/core/maptypes.h b/source/core/maptypes.h index bb15166d0..645b80747 100644 --- a/source/core/maptypes.h +++ b/source/core/maptypes.h @@ -333,6 +333,7 @@ struct sectortype void addceilingypan(float add) { ceilingypan_ = fmodf(ceilingypan_ + add + 512, 256); } // +512 is for handling negative offsets void setceilingslope(int heinum) { ceilingheinum = heinum; if (heinum) ceilingstat |= CSTAT_SECTOR_SLOPE; else ceilingstat &= ~CSTAT_SECTOR_SLOPE; } void setfloorslope(int heinum) { floorheinum = heinum; if (heinum) floorstat |= CSTAT_SECTOR_SLOPE; else floorstat &= ~CSTAT_SECTOR_SLOPE; } + int getfloorslope() const { return floorstat & CSTAT_SECTOR_SLOPE ? floorheinum : 0; } walltype* firstWall() const; walltype* lastWall() const; diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 0fe58938b..87f55c5c4 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -3163,8 +3163,8 @@ void handle_se02(DDukeActor* actor) } if (abs(sc->floorheinum - actor->temp_data[5]) < 8) - sc->floorheinum = actor->temp_data[5]; - else sc->floorheinum += (Sgn(actor->temp_data[5] - sc->floorheinum) << 4); + sc->setfloorslope(actor->temp_data[5]); + else sc->setfloorslope(sc->getfloorslope() + (Sgn(actor->temp_data[5] - sc->getfloorslope()) << 4)); } int m = MulScale(actor->spr.xvel, bcos(actor->spr.ang), 14); diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index 2eb9aed9e..36d98c87e 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -1014,7 +1014,7 @@ void spawneffector(DDukeActor* actor, TArray* actors) } else if (actor->spr.lotag == SE_2_EARTHQUAKE) { - actor->temp_data[5] = actor->sector()->floorheinum; + actor->temp_data[5] = actor->sector()->getfloorslope(); actor->sector()->setfloorslope(0); } }