- SW: Remove all the player oldpos stuff.

* This only had one valid use, for a bad setup in `DoPlayerRun()` where `DoPlayerBob()` was called before `DoPlayerMove()`.
This commit is contained in:
Mitchell Richters 2022-11-23 21:42:21 +11:00 committed by Christoph Oelckers
parent 703db0e3c3
commit c43bde9b4d
4 changed files with 4 additions and 28 deletions

View file

@ -1708,8 +1708,6 @@ BEGIN_SW_NS
struct PLAYER struct PLAYER
{ {
DVector3 PlayerOldPosition;
DSWActor* actor; // this may not be a TObjPtr! DSWActor* actor; // this may not be a TObjPtr!
TObjPtr<DSWActor*> lowActor, highActor; TObjPtr<DSWActor*> lowActor, highActor;
TObjPtr<DSWActor*> remoteActor; TObjPtr<DSWActor*> remoteActor;
@ -1890,21 +1888,6 @@ struct PLAYER
return actor->viewzoffset + height; return actor->viewzoffset + height;
} }
DVector2& posoldXY()
{
return PlayerOldPosition.XY();
}
void posoldSet(const DVector3& val)
{
PlayerOldPosition = val;
}
DVector3 posoldGet()
{
return PlayerOldPosition;
}
void setHeightAndZ(const double newz, const double newheight) void setHeightAndZ(const double newz, const double newheight)
{ {
actor->spr.pos.Z = newz; actor->spr.pos.Z = newz;

View file

@ -1314,7 +1314,6 @@ void DoPlayerTeleportToSprite(PLAYER* pp, DVector3& pos, DAngle ang)
pp->angle.ang = pp->angle.oang = ang; pp->angle.ang = pp->angle.oang = ang;
pp->actor->spr.pos = pos; pp->actor->spr.pos = pos;
pp->actor->backuppos(); pp->actor->backuppos();
pp->posoldXY() = pp->actor->spr.pos.XY();
updatesector(pp->actor->getPosWithOffsetZ(), &pp->cursector); updatesector(pp->actor->getPosWithOffsetZ(), &pp->cursector);
pp->Flags2 |= (PF2_TELEPORTED); pp->Flags2 |= (PF2_TELEPORTED);
@ -1328,7 +1327,6 @@ void DoPlayerTeleportToSprite(PLAYER* pp, DVector3& pos, DAngle ang)
void DoPlayerTeleportToOffset(PLAYER* pp) void DoPlayerTeleportToOffset(PLAYER* pp)
{ {
pp->posoldXY() = pp->actor->spr.pos.XY();
pp->actor->backupvec2(); pp->actor->backupvec2();
updatesector(pp->actor->getPosWithOffsetZ(), &pp->cursector); updatesector(pp->actor->getPosWithOffsetZ(), &pp->cursector);
@ -1693,7 +1691,7 @@ void DoPlayerBob(PLAYER* pp)
{ {
double amt; double amt;
double dist = (pp->actor->spr.pos.XY() - pp->posoldXY()).Length(); double dist = (pp->actor->spr.pos.XY() - pp->actor->opos.XY()).Length();
if (dist > 32) if (dist > 32)
dist = 0; dist = 0;
@ -2026,7 +2024,7 @@ void PlayerCheckValidMove(PLAYER* pp)
{ {
if (!pp->insector()) if (!pp->insector())
{ {
pp->actor->spr.pos = pp->posoldGet().plusZ(-pp->actor->viewzoffset); pp->actor->restorepos();
pp->cursector = pp->lastcursector; pp->cursector = pp->lastcursector;
} }
} }
@ -2090,7 +2088,6 @@ void DoPlayerMove(PLAYER* pp)
DoPlayerTurn(pp, pp->input.avel, 1); DoPlayerTurn(pp, pp->input.avel, 1);
} }
pp->posoldSet(pp->actor->getPosWithOffsetZ());
pp->lastcursector = pp->cursector; pp->lastcursector = pp->cursector;
if (PLAYER_MOVING(pp) == 0) if (PLAYER_MOVING(pp) == 0)
@ -6568,8 +6565,6 @@ void DoPlayerRun(PLAYER* pp)
} }
} }
DoPlayerBob(pp);
if (pp->WadeDepth) if (pp->WadeDepth)
{ {
DoPlayerBeginWade(pp); DoPlayerBeginWade(pp);
@ -6616,6 +6611,8 @@ void DoPlayerRun(PLAYER* pp)
pp->setHeightAndZ(pp->loz, PLAYER_HEIGHTF); pp->setHeightAndZ(pp->loz, PLAYER_HEIGHTF);
} }
DoPlayerBob(pp);
// Adjust height moving up and down sectors // Adjust height moving up and down sectors
DoPlayerHeight(pp); DoPlayerHeight(pp);
} }

View file

@ -480,9 +480,6 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PLAYER& w, PLAYER*
("recoil_ndx", w.recoil_ndx) ("recoil_ndx", w.recoil_ndx)
("recoil_horizoff", w.recoil_horizoff) ("recoil_horizoff", w.recoil_horizoff)
("recoil_ohorizoff", w.recoil_ohorizoff) ("recoil_ohorizoff", w.recoil_ohorizoff)
("oldposx", w.PlayerOldPosition.X)
("oldposy", w.PlayerOldPosition.Y)
("oldposz", w.PlayerOldPosition.Z)
("revolvex", w.Revolve.X) ("revolvex", w.Revolve.X)
("revolvey", w.Revolve.Y) ("revolvey", w.Revolve.Y)
("RevolveDeltaAng", w.RevolveDeltaAng) ("RevolveDeltaAng", w.RevolveDeltaAng)

View file

@ -1544,7 +1544,6 @@ void PreMapCombineFloors(void)
if (itsect == dasect) if (itsect == dasect)
{ {
pp->actor->spr.pos.XY() += dv; pp->actor->spr.pos.XY() += dv;
pp->posoldXY() = pp->actor->spr.pos.XY();
pp->actor->backupvec2(); pp->actor->backupvec2();
break; break;
} }