diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 24b05f42b..8bc6b1d65 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -166,7 +166,7 @@ void DoPlayerDeathExplode(PLAYER* pp); void DoPlayerDeathFall(PLAYER* pp); void PlayerCheckValidMove(PLAYER* pp); -void PlayerWarpUpdatePos(PLAYER* pp); +void PlayerWarpUpdatePos(PLAYER* pp, const DVector3& oldpos); void DoPlayerBeginDiveNoWarp(PLAYER* pp); int PlayerCanDiveNoWarp(PLAYER* pp); void DoPlayerCurrent(PLAYER* pp); @@ -2222,12 +2222,15 @@ void DoPlayerMove(PLAYER* pp) } // check for warp - probably can remove from CeilingHit + const auto oldpos = pp->pos; if (WarpPlane(pp->pos, &pp->cursector)) { - PlayerWarpUpdatePos(pp); + PlayerWarpUpdatePos(pp, oldpos); + } + else + { + DoPlayerZrange(pp); } - - DoPlayerZrange(pp); //PlayerSectorBound(pp, 1); @@ -3500,9 +3503,10 @@ void DoPlayerClimb(PLAYER* pp) LadderUpdate = true; } + const auto oldpos = pp->pos; if (WarpPlane(pp->pos, &pp->cursector)) { - PlayerWarpUpdatePos(pp); + PlayerWarpUpdatePos(pp, oldpos); LadderUpdate = true; } @@ -3750,12 +3754,12 @@ void DoPlayerBeginFly(PLAYER* pp) // //--------------------------------------------------------------------------- -void PlayerWarpUpdatePos(PLAYER* pp) +void PlayerWarpUpdatePos(PLAYER* pp, const DVector3& oldpos) { if (Prediction) return; - pp->opos = pp->pos; + pp->opos += pp->pos - oldpos; DoPlayerZrange(pp); UpdatePlayerSprite(pp); }