- SW: Remove most PLAYER::posSet() calls.

This commit is contained in:
Mitchell Richters 2022-11-24 13:24:50 +11:00 committed by Christoph Oelckers
parent 0917434888
commit bf0f0345b3
3 changed files with 13 additions and 8 deletions

View file

@ -964,8 +964,9 @@ void post_analyzesprites(tspriteArray& tsprites)
std::pair<DVector3, DAngle> GameInterface::GetCoordinates()
{
PLAYER* pp = Player + myconnectindex;
return std::make_pair(pp->posGet(), pp->angle.ang);
auto ppActor = Player[myconnectindex].actor;
if (!ppActor) return std::make_pair(DVector3(DBL_MAX, 0, 0), nullAngle);
return std::make_pair(ppActor->spr.pos, ppActor->spr.angle);
}
//---------------------------------------------------------------------------

View file

@ -56,9 +56,13 @@ BEGIN_SW_NS
void GameInterface::WarpToCoords(double x, double y, double z, DAngle ang)
{
Player->posSet(DVector3(x,y,z));
auto pp = &Player[myconnectindex];
auto ppActor = pp->actor;
Player->posprevSet(Player->posGet());
if (!ppActor) return;
ppActor->spr.pos = DVector3(x,y,z);
ppActor->backuppos();
if (ang != DAngle::fromDeg(INT_MIN))
{

View file

@ -1312,8 +1312,8 @@ void DoPlayerTeleportPause(PLAYER* pp)
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->actor->spr.pos = pos;
pp->actor->backuppos();
pp->posoldXY() = pp->actor->spr.pos.XY();
updatesector(pp->posGet(), &pp->cursector);
@ -2030,7 +2030,7 @@ void PlayerCheckValidMove(PLAYER* pp)
{
if (!pp->insector())
{
pp->posSet(pp->posoldGet());
pp->actor->spr.pos = pp->posoldGet().plusZ(-pp->actor->viewzoffset);
pp->cursector = pp->lastcursector;
}
}
@ -5304,7 +5304,7 @@ void RemoteToPlayer(PLAYER* pp)
pp->setcursector(pp->remote.cursectp);
pp->lastcursector = pp->remote.lastcursectp;
pp->posSet(pp->remote.pos);
pp->actor->spr.pos = pp->remote.pos.plusZ(-pp->actor->viewzoffset);
pp->vect = pp->remote.vect;
pp->ovect = pp->remote.ovect;