- SW: Wrap calls that add to PLAYER::PlayerNowPosition.

This commit is contained in:
Mitchell Richters 2022-11-16 13:35:26 +11:00 committed by Christoph Oelckers
parent 11f9d82239
commit 964557ab6b
5 changed files with 8 additions and 4 deletions

View file

@ -737,6 +737,10 @@ struct PLAYER
{ {
PlayerNowPosition = val; PlayerNowPosition = val;
} }
void posAdd(const DVector2& val)
{
PlayerNowPosition += val;
}
}; };
extern PLAYER Player[MAX_SW_PLAYERS_REG+1]; extern PLAYER Player[MAX_SW_PLAYERS_REG+1];

View file

@ -207,7 +207,7 @@ int RectClipMove(PLAYER* pp, DVector2* qpos)
//Given the 4 points: x[4], y[4] //Given the 4 points: x[4], y[4]
if (testquadinsect(&point_num, xy, pp->cursector)) if (testquadinsect(&point_num, xy, pp->cursector))
{ {
pp->PlayerNowPosition += pvect; pp->posAdd(pvect);
return true; return true;
} }

View file

@ -2165,7 +2165,7 @@ void DoPlayerMove(PLAYER* pp)
{ {
pp->PlayerPrevPosition.XY() = pp->posXY(); pp->PlayerPrevPosition.XY() = pp->posXY();
} }
pp->PlayerNowPosition += pp->vect; pp->posAdd(pp->vect);
updatesector(pp->PlayerNowPosition, &sect); updatesector(pp->PlayerNowPosition, &sect);
if (sect != nullptr) if (sect != nullptr)
pp->cursector = sect; pp->cursector = sect;

View file

@ -1543,7 +1543,7 @@ void PreMapCombineFloors(void)
{ {
if (itsect == dasect) if (itsect == dasect)
{ {
pp->PlayerNowPosition += dv; pp->posAdd(dv);
pp->PlayerPrevPosition.XY() = pp->PlayerOldPosition.XY() = pp->posXY(); pp->PlayerPrevPosition.XY() = pp->PlayerOldPosition.XY() = pp->posXY();
break; break;
} }

View file

@ -1487,7 +1487,7 @@ void MovePlayer(PLAYER* pp, SECTOR_OBJECT* sop, const DVector2& move)
pp->RevolveDeltaAng = nullAngle; pp->RevolveDeltaAng = nullAngle;
} }
pp->PlayerNowPosition += move; pp->posAdd(move);
if ((sop->flags & SOBJ_DONT_ROTATE)) if ((sop->flags & SOBJ_DONT_ROTATE))
{ {