- SW: Add inertia correction to PlayerWarpUpdatePos().

* Warping between sectors such as the clouds in $volcano now maintains perfect velocity, etc.
This commit is contained in:
Mitchell Richters 2023-01-02 11:53:10 +11:00
parent 2de707e7f8
commit db8a53e7d4

View file

@ -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);
}