- Duke: Wrap calls to player_struct::PlayerOldPosition.XY().

This commit is contained in:
Mitchell Richters 2022-11-15 18:29:51 +11:00 committed by Christoph Oelckers
parent a3b1ab10fe
commit fa16d5d344
6 changed files with 14 additions and 9 deletions

View file

@ -3034,7 +3034,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
if (a & face_player)
{
if (ps[playernum].newOwner != nullptr)
goalang = (ps[playernum].PlayerOldPosition.XY() - actor->spr.pos.XY()).Angle();
goalang = (ps[playernum].posoldXY() - actor->spr.pos.XY()).Angle();
else goalang = (ps[playernum].posXY() - actor->spr.pos.XY()).Angle();
angdif = deltaangle(actor->spr.angle, goalang) * 0.25;
if (angdif > -DAngle22_5 / 16 && angdif < nullAngle) angdif = nullAngle;
@ -3047,7 +3047,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
if (a & face_player_slow)
{
if (ps[playernum].newOwner != nullptr)
goalang = (ps[playernum].PlayerOldPosition.XY() - actor->spr.pos.XY()).Angle();
goalang = (ps[playernum].posoldXY() - actor->spr.pos.XY()).Angle();
else goalang = (ps[playernum].posXY() - actor->spr.pos.XY()).Angle();
angdif = DAngle22_5 * 0.25 * Sgn(deltaangle(actor->spr.angle, goalang).Degrees()); // this looks very wrong...
actor->spr.angle += angdif;

View file

@ -3212,7 +3212,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
if (a & face_player)
{
if (ps[pnum].newOwner != nullptr)
goalang = (ps[pnum].PlayerOldPosition.XY() - actor->spr.pos.XY()).Angle();
goalang = (ps[pnum].posoldXY() - actor->spr.pos.XY()).Angle();
else goalang = (ps[pnum].posXY() - actor->spr.pos.XY()).Angle();
angdif = deltaangle(actor->spr.angle, goalang) * 0.25;
if (angdif > -DAngle22_5 / 16 && angdif < nullAngle) angdif = nullAngle;
@ -3225,7 +3225,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
if (a & face_player_slow)
{
if (ps[pnum].newOwner != nullptr)
goalang = (ps[pnum].PlayerOldPosition.XY() - actor->spr.pos.XY()).Angle();
goalang = (ps[pnum].posoldXY() - actor->spr.pos.XY()).Angle();
else goalang = (ps[pnum].posXY() - actor->spr.pos.XY()).Angle();
angdif = DAngle22_5 * 0.25 * Sgn(deltaangle(actor->spr.angle, goalang).Degrees()); // this looks very wrong...
actor->spr.angle += angdif;
@ -3236,7 +3236,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
if (a & antifaceplayerslow)
{
if (ps[pnum].newOwner != nullptr)
goalang = ((ps[pnum].PlayerOldPosition.XY() - actor->spr.pos.XY()).Angle() + DAngle180);
goalang = ((ps[pnum].posoldXY() - actor->spr.pos.XY()).Angle() + DAngle180);
else goalang = ((ps[pnum].posXY() - actor->spr.pos.XY()).Angle() + DAngle180);
angdif = DAngle22_5 * 0.25 * Sgn(deltaangle(actor->spr.angle, goalang).Degrees()); // this looks very wrong...
actor->spr.angle += angdif;

View file

@ -277,7 +277,7 @@ void drawoverlays(double interpfrac)
}
else
{
cposxy = pp->PlayerOldPosition.XY();
cposxy = pp->posoldXY();
cang = pp->angle.oang;
}
DrawOverheadMap(cposxy, cang, interpfrac);

View file

@ -153,7 +153,7 @@ static void shootflamethrowerflame(DDukeActor* actor, int p, DVector3 spos, DAng
{
double x;
int j = findplayer(actor, &x);
sang = (ps[j].PlayerOldPosition.XY() - spos.XY()).Angle();
sang = (ps[j].posoldXY() - spos.XY()).Angle();
if (actor->spr.picnum == BOSS5)
{
@ -693,7 +693,7 @@ static void shootrpg(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int atw
{
double x;
int j = findplayer(actor, &x);
ang = (ps[j].PlayerOldPosition.XY() - pos.XY()).Angle();
ang = (ps[j].posoldXY() - pos.XY()).Angle();
if (actor->spr.picnum == BOSS3)
{
double zoffs = 32;

View file

@ -613,7 +613,7 @@ static void shootrpg(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int atw
{
double x;
int j = findplayer(actor, &x);
ang = (ps[j].PlayerOldPosition.XY() - pos.XY()).Angle();
ang = (ps[j].posoldXY() - pos.XY()).Angle();
if (actor->spr.picnum == BOSS3)
pos.Z -= 32;
else if (actor->spr.picnum == BOSS2)

View file

@ -400,6 +400,11 @@ struct player_struct
{
return PlayerNowPosition;
}
DVector2& posoldXY()
{
return PlayerOldPosition.XY();
}
};
struct Cycler