- Duke: Wrap calls that add to player_struct::PlayerNowPosition.Z.

This commit is contained in:
Mitchell Richters 2022-11-15 17:56:20 +11:00 committed by Christoph Oelckers
parent 93189037c3
commit 44166ae9e6
6 changed files with 29 additions and 25 deletions

View file

@ -1862,7 +1862,7 @@ void handle_se00(DDukeActor* actor)
{
ps[p].angle.addadjustment(ang_amount * direction);
ps[p].PlayerNowPosition.Z += zchange;
ps[p].posZadd(zchange);
auto result = rotatepoint(Owner->spr.pos, ps[p].posXY(), ang_amount * direction);
@ -2997,7 +2997,7 @@ void handle_se17(DDukeActor* actor)
if (act1->spr.statnum == STAT_PLAYER && act1->GetOwner())
{
int p = act1->spr.yint;
ps[p].PlayerNowPosition.Z += q;
ps[p].posZadd(q);
ps[p].truefz += q;
ps[p].truecz += q;
}
@ -3048,7 +3048,7 @@ void handle_se17(DDukeActor* actor)
ps[p].PlayerOldPosition -= ps[p].PlayerNowPosition;
ps[p].posXY() += act2->spr.pos.XY() - actor->spr.pos.XY();
ps[p].PlayerNowPosition.Z += act2->sector()->floorz - sc->floorz;
ps[p].posZadd(act2->sector()->floorz - sc->floorz);
ps[p].PlayerOldPosition += ps[p].PlayerNowPosition;
if (q > 0) ps[p].backupz();
@ -3121,7 +3121,7 @@ void handle_se18(DDukeActor *actor, bool morecheck)
{
if (a2->isPlayer() && a2->GetOwner())
{
if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].PlayerNowPosition.Z += extra;
if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].posZadd(extra);
}
if (a2->vel.Z == 0 && a2->spr.statnum != STAT_EFFECTOR && a2->spr.statnum != STAT_PROJECTILE)
{
@ -3459,7 +3459,7 @@ void handle_se26(DDukeActor* actor)
{
ps[p].fric.X += vect.X;
ps[p].fric.Y += vect.Y;
ps[p].PlayerNowPosition.Z += zvel;
ps[p].posZadd(zvel);
}
movesector(actor, actor->temp_data[1], nullAngle);
@ -3869,7 +3869,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
{
if (a2->isPlayer() && a2->GetOwner())
if (ps[a2->PlayerIndex()].on_ground == 1)
ps[a2->PlayerIndex()].PlayerNowPosition.Z +=l;
ps[a2->PlayerIndex()].posZadd(l);
if (a2->vel.Z == 0 && a2->spr.statnum != STAT_EFFECTOR && (!choosedir || a2->spr.statnum != STAT_PROJECTILE))
{
a2->spr.pos.Z += l;
@ -3898,7 +3898,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
{
if (a2->isPlayer() && a2->GetOwner())
if (ps[a2->PlayerIndex()].on_ground == 1)
ps[a2->PlayerIndex()].PlayerNowPosition.Z += l;
ps[a2->PlayerIndex()].posZadd(l);
if (a2->vel.Z == 0 && a2->spr.statnum != STAT_EFFECTOR && (!choosedir || a2->spr.statnum != STAT_PROJECTILE))
{
a2->spr.pos.Z += l;
@ -3929,7 +3929,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
{
if (a2->isPlayer() && a2->GetOwner())
if (ps[a2->PlayerIndex()].on_ground == 1)
ps[a2->PlayerIndex()].PlayerNowPosition.Z += l;
ps[a2->PlayerIndex()].posZadd(l);
if (a2->vel.Z == 0 && a2->spr.statnum != STAT_EFFECTOR && (!choosedir || a2->spr.statnum != STAT_PROJECTILE))
{
a2->spr.pos.Z += l;

View file

@ -609,7 +609,7 @@ void playerisdead(int snum, int psectlotag, double floorz, double ceilingz)
if (p->on_warping_sector == 0)
{
if (abs(p->PlayerNowPosition.Z - floorz) > (gs.playerheight * 0.5))
p->PlayerNowPosition.Z += 348/ 256.;
p->posZadd(348/ 256.);
}
else
{
@ -706,7 +706,7 @@ void playerCrouch(int snum)
OnEvent(EVENT_CROUCH, snum, p->GetActor(), -1);
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
{
p->PlayerNowPosition.Z += 8 + 3;
p->posZadd(8 + 3);
p->crack_time = CRACK_TIME;
}
}

View file

@ -1717,7 +1717,7 @@ static void operateJetpack(int snum, ESyncBits actions, int psectlotag, double f
OnEvent(EVENT_SOARDOWN, snum, p->GetActor(), -1);
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
{
p->PlayerNowPosition.Z += dist;
p->posZadd(dist);
p->crack_time = CRACK_TIME;
}
}
@ -1730,7 +1730,7 @@ static void operateJetpack(int snum, ESyncBits actions, int psectlotag, double f
p->scuba_on = 0;
if (p->PlayerNowPosition.Z > floorz - k)
p->PlayerNowPosition.Z += ((floorz - k) - p->PlayerNowPosition.Z) * 0.5;
p->posZadd(((floorz - k) - p->PlayerNowPosition.Z) * 0.5);
if (p->PlayerNowPosition.Z < pact->ceilingz + 18)
p->posZset(pact->ceilingz + 18);
@ -1850,13 +1850,13 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
double k = (floorz - i - p->PlayerNowPosition.Z) * 0.5;
if (abs(k) < 1) k = 0;
p->PlayerNowPosition.Z += k;
p->posZadd(k);
p->vel.Z -= 3;
if (p->vel.Z < 0) p->vel.Z = 0;
}
else if (p->jumping_counter == 0)
{
p->PlayerNowPosition.Z += ((floorz - i * 0.5) - p->PlayerNowPosition.Z) * 0.5; //Smooth on the water
p->posZadd(((floorz - i * 0.5) - p->PlayerNowPosition.Z) * 0.5); //Smooth on the water
if (p->on_warping_sector == 0 && p->PlayerNowPosition.Z > floorz - 16)
{
p->posZset(floorz - 16);
@ -1910,7 +1910,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
}
}
p->PlayerNowPosition.Z += p->vel.Z ;
p->posZadd(p->vel.Z );
if (p->PlayerNowPosition.Z < ceilingz + 4)
{
@ -1977,10 +1977,10 @@ static void underwater(int snum, ESyncBits actions, double floorz, double ceilin
if (p->vel.Z > 8)
p->vel.Z *= 0.5;
p->PlayerNowPosition.Z += p->vel.Z ;
p->posZadd(p->vel.Z );
if (p->PlayerNowPosition.Z > floorz - 15)
p->PlayerNowPosition.Z += (((floorz - 15) - p->PlayerNowPosition.Z) * 0.5);
p->posZadd((((floorz - 15) - p->PlayerNowPosition.Z) * 0.5));
if (p->PlayerNowPosition.Z < ceilingz + 4)
{
@ -3041,7 +3041,7 @@ HORIZONLY:
clipmove(p->PlayerNowPosition, &p->cursector, p->vel, 10.25, 4., iif, CLIPMASK0, clip);
if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk)
p->PlayerNowPosition.Z += 32;
p->posZadd(32);
if (clip.type != kHitNone)
checkplayerhurt_d(p, clip);

View file

@ -2177,13 +2177,13 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
double k = (floorz - i - p->PlayerNowPosition.Z) * 0.5;
if (abs(k) < 1) k = 0;
p->PlayerNowPosition.Z += k;
p->posZadd(k);
p->vel.Z -= 3;
if (p->vel.Z < 0) p->vel.Z = 0;
}
else if (p->jumping_counter == 0)
{
p->PlayerNowPosition.Z += ((floorz - i * 0.5) - p->PlayerNowPosition.Z) * 0.5; //Smooth on the water
p->posZadd(((floorz - i * 0.5) - p->PlayerNowPosition.Z) * 0.5); //Smooth on the water
if (p->on_warping_sector == 0 && p->PlayerNowPosition.Z > floorz - 16)
{
p->posZset(floorz - 16);
@ -2233,7 +2233,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
}
}
p->PlayerNowPosition.Z += p->vel.Z ;
p->posZadd(p->vel.Z );
if (p->PlayerNowPosition.Z < ceilingz + 4)
{
@ -2296,10 +2296,10 @@ static void underwater(int snum, ESyncBits actions, double floorz, double ceilin
if (p->vel.Z > 8)
p->vel.Z *= 0.5;
p->PlayerNowPosition.Z += p->vel.Z ;
p->posZadd(p->vel.Z );
if (p->PlayerNowPosition.Z > floorz - 15)
p->PlayerNowPosition.Z += (((floorz - 15) - p->PlayerNowPosition.Z) * 0.5);
p->posZadd((((floorz - 15) - p->PlayerNowPosition.Z) * 0.5));
if (p->PlayerNowPosition.Z < ceilingz + 4)
{
@ -3745,7 +3745,7 @@ HORIZONLY:
clipmove(p->PlayerNowPosition, &p->cursector, p->vel, 10.25, 4., iif, CLIPMASK0, clip);
if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk)
p->PlayerNowPosition.Z += 32;
p->posZadd(32);
if (clip.type != kHitNone)
checkplayerhurt_r(p, clip);

View file

@ -383,7 +383,7 @@ void doanimations(void)
if ((dasectp->floorz - ps[p].PlayerNowPosition.Z) < 64)
if (ps[p].GetActor()->GetOwner() != nullptr)
{
ps[p].PlayerNowPosition.Z += v;
ps[p].posZadd(v);
ps[p].vel.Z = 0;
}

View file

@ -375,6 +375,10 @@ struct player_struct
{
PlayerNowPosition.Z = val;
}
void posZadd(const double val)
{
PlayerNowPosition.Z += val;
}
};
struct Cycler