- Duke: Remove player_struct::posX() and player_struct::posY().

This commit is contained in:
Mitchell Richters 2022-11-21 13:29:33 +11:00 committed by Christoph Oelckers
parent b1bd59db41
commit 6f102e1171
8 changed files with 20 additions and 41 deletions

View file

@ -139,6 +139,11 @@ public:
backupang();
}
void restorevec2()
{
spr.pos.XY() = opos.XY();
}
void restorepos()
{
spr.pos = opos;

View file

@ -374,8 +374,7 @@ void movedummyplayers(void)
}
}
act->spr.pos.X += (ps[p].posX() - ps[p].posoldX());
act->spr.pos.Y += (ps[p].posY() - ps[p].posoldY());
act->spr.pos.XY() += ps[p].GetActor()->spr.pos.XY() - ps[p].GetActor()->opos.XY();
SetActor(act, act->spr.pos);
}
}
@ -1868,15 +1867,7 @@ void handle_se00(DDukeActor* actor)
ps[p].bobpos += (result - ps[p].posXY());
ps[p].posX() = result.X;
ps[p].posY() = result.Y;
auto psp = ps[p].GetActor();
if (psp->spr.extra <= 0)
{
psp->spr.pos.X = result.X;
psp->spr.pos.Y = result.Y;
}
ps[p].GetActor()->spr.pos.XY() = result;
}
}
DukeSectIterator itp(actor->sector());

View file

@ -1367,8 +1367,7 @@ void movetransports_d(void)
if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP))) ||
(ps[p].jetpack_on && PlayerInput(p, SB_CROUCH)))
{
ps[p].posX() += Owner->spr.pos.X - act->spr.pos.X;
ps[p].posY() += Owner->spr.pos.Y - act->spr.pos.Y;
ps[p].GetActor()->spr.pos.XY() += Owner->spr.pos.XY() - act->spr.pos.XY();
ps[p].GetActor()->backupvec2();
if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11))
@ -1425,8 +1424,7 @@ void movetransports_d(void)
if (k == 1)
{
ps[p].posX() += Owner->spr.pos.X - act->spr.pos.X;
ps[p].posY() += Owner->spr.pos.Y - act->spr.pos.Y;
ps[p].GetActor()->spr.pos.XY() += Owner->spr.pos.XY() - act->spr.pos.XY();
ps[p].GetActor()->backupvec2();
if (!Owner || Owner->GetOwner() != Owner)

View file

@ -1252,8 +1252,7 @@ void movetransports_r(void)
if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && PlayerInput(p, SB_JUMP)) ||
(ps[p].jetpack_on && PlayerInput(p, SB_CROUCH)))
{
ps[p].posX() += Owner->spr.pos.X - act->spr.pos.X;
ps[p].posY() += Owner->spr.pos.Y - act->spr.pos.Y;
ps[p].GetActor()->spr.pos.XY() += Owner->spr.pos.XY() - act->spr.pos.XY();
ps[p].GetActor()->backupvec2();
if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11))
@ -1319,8 +1318,7 @@ void movetransports_r(void)
if (k == 1)
{
ps[p].posX() += Owner->spr.pos.X - act->spr.pos.X;
ps[p].posY() += Owner->spr.pos.Y - act->spr.pos.Y;
ps[p].GetActor()->spr.pos.XY() += Owner->spr.pos.XY() - act->spr.pos.XY();
ps[p].GetActor()->backupvec2();
if (Owner->GetOwner() != Owner)
@ -1334,8 +1332,7 @@ void movetransports_r(void)
}
else if (isRRRA() && k == 2)
{
ps[p].posoldX() = ps[p].posX() += Owner->spr.pos.X - act->spr.pos.X;
ps[p].posoldY() = ps[p].posY() += Owner->spr.pos.Y - act->spr.pos.Y;
ps[p].GetActor()->spr.pos.XY() += Owner->spr.pos.XY() - act->spr.pos.XY();
ps[p].GetActor()->backupvec2();
if (Owner->GetOwner() != Owner)

View file

@ -326,11 +326,11 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
break;
case PLAYER_POSX: // oh, my... :( Writing to these has been disabled until I know how to do it without the engine shitting all over itself.
if (!bSet) SetGameVarID(lVar2, int(ps[iPlayer].posX() * (1/maptoworld)), sActor, sPlayer);
if (!bSet) SetGameVarID(lVar2, int(ps[iPlayer].GetActor()->spr.pos.X * (1/maptoworld)), sActor, sPlayer);
break;
case PLAYER_POSY:
if (!bSet) SetGameVarID(lVar2, int(ps[iPlayer].posY() * (1 / maptoworld)), sActor, sPlayer);
if (!bSet) SetGameVarID(lVar2, int(ps[iPlayer].GetActor()->spr.pos.Y * (1 / maptoworld)), sActor, sPlayer);
break;
case PLAYER_POSZ:

View file

@ -507,8 +507,8 @@ void footprints(int snum)
while (auto act = it.Next())
{
if (act->spr.picnum == TILE_FOOTPRINTS || act->spr.picnum == TILE_FOOTPRINTS2 || act->spr.picnum == TILE_FOOTPRINTS3 || act->spr.picnum == TILE_FOOTPRINTS4)
if (abs(act->spr.pos.X - p->posX()) < 24)
if (abs(act->spr.pos.Y - p->posY()) < 24)
if (abs(act->spr.pos.X - p->GetActor()->spr.pos.X) < 24)
if (abs(act->spr.pos.Y - p->GetActor()->spr.pos.Y) < 24)
{
j = 1;
break;
@ -765,13 +765,11 @@ void player_struct::backuppos(bool noclipping)
{
if (!noclipping)
{
posoldX() = posX();
posoldY() = posY();
GetActor()->backupvec2();
}
else
{
posX() = posoldX();
posY() = posoldY();
GetActor()->restorevec2();
}
posoldZset(posZget());

View file

@ -3991,8 +3991,7 @@ void OnMotorcycle(player_struct *p, DDukeActor* motosprite)
{
if (motosprite)
{
p->posX() = motosprite->spr.pos.X;
p->posY() = motosprite->spr.pos.Y;
p->GetActor()->spr.pos.XY() = motosprite->spr.pos.XY();
p->angle.ang = motosprite->spr.angle;
p->ammo_amount[MOTORCYCLE_WEAPON] = motosprite->saved_ammo;
motosprite->Destroy();
@ -4066,8 +4065,7 @@ void OnBoat(player_struct *p, DDukeActor* boat)
{
if (boat)
{
p->posX() = boat->spr.pos.X;
p->posY() = boat->spr.pos.Y;
p->GetActor()->spr.pos.XY() = boat->spr.pos.XY();
p->angle.ang = boat->spr.angle;
p->ammo_amount[BOAT_WEAPON] = boat->saved_ammo;
boat->Destroy();

View file

@ -336,14 +336,6 @@ struct player_struct
}
double& posX()
{
return GetActor()->spr.pos.X;
}
double& posY()
{
return GetActor()->spr.pos.Y;
}
DVector2& posXY()
{
return GetActor()->spr.pos.XY();