diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index b303a97dc..83f057cf7 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -764,6 +764,11 @@ struct PLAYER { return PlayerPrevPosition; } + + DVector2& posoldXY() + { + return PlayerOldPosition.XY(); + } }; extern PLAYER Player[MAX_SW_PLAYERS_REG+1]; diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index da1722b75..f2b69b816 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -1314,7 +1314,7 @@ void DoPlayerTeleportToSprite(PLAYER* pp, DVector3& pos, DAngle ang) pp->angle.ang = pp->angle.oang = ang; pp->posSet(pos.plusZ(-PLAYER_HEIGHTF)); pp->posprevSet(pos.plusZ(-PLAYER_HEIGHTF)); - pp->PlayerOldPosition.XY() = pp->posXY(); + pp->posoldXY() = pp->posXY(); updatesector(pp->posGet(), &pp->cursector); pp->Flags2 |= (PF2_TELEPORTED); @@ -1328,7 +1328,7 @@ void DoPlayerTeleportToSprite(PLAYER* pp, DVector3& pos, DAngle ang) void DoPlayerTeleportToOffset(PLAYER* pp) { - pp->PlayerOldPosition.XY() = pp->posprevXY() = pp->posXY(); + pp->posoldXY() = pp->posprevXY() = pp->posXY(); updatesector(pp->posGet(), &pp->cursector); pp->Flags2 |= (PF2_TELEPORTED); @@ -1703,7 +1703,7 @@ void DoPlayerBob(PLAYER* pp) { double amt; - double dist = (pp->posXY() - pp->PlayerOldPosition.XY()).Length(); + double dist = (pp->posXY() - pp->posoldXY()).Length(); if (dist > 32) dist = 0; diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 81831aaef..cc63c34f2 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -1544,7 +1544,7 @@ void PreMapCombineFloors(void) if (itsect == dasect) { pp->posAdd(dv); - pp->posprevXY() = pp->PlayerOldPosition.XY() = pp->posXY(); + pp->posprevXY() = pp->posoldXY() = pp->posXY(); break; } }