- Duke: Remove player_struct::posZadd().

This commit is contained in:
Mitchell Richters 2022-11-20 19:14:51 +11:00 committed by Christoph Oelckers
parent 78b04649f1
commit bd8a6dd956
6 changed files with 29 additions and 34 deletions

View file

@ -1861,7 +1861,7 @@ void handle_se00(DDukeActor* actor)
{
ps[p].angle.addadjustment(ang_amount * direction);
ps[p].posZadd(zchange);
ps[p].GetActor()->spr.pos.Z += zchange;
auto result = rotatepoint(Owner->spr.pos, ps[p].GetActor()->spr.pos.XY(), ang_amount * direction);
@ -2988,7 +2988,7 @@ void handle_se17(DDukeActor* actor)
if (act1->spr.statnum == STAT_PLAYER && act1->GetOwner())
{
int p = act1->spr.yint;
ps[p].posZadd(q);
ps[p].GetActor()->spr.pos.Z += q;
ps[p].truefz += q;
ps[p].truecz += q;
}
@ -3039,7 +3039,7 @@ void handle_se17(DDukeActor* actor)
ps[p].posoldAdd(-ps[p].posGet());
ps[p].GetActor()->spr.pos.XY() += act2->spr.pos.XY() - actor->spr.pos.XY();
ps[p].posZadd(act2->sector()->floorz - sc->floorz);
ps[p].GetActor()->spr.pos.Z += act2->sector()->floorz - sc->floorz;
ps[p].posoldAdd(ps[p].posGet());
if (q > 0) ps[p].GetActor()->backupz();
@ -3112,7 +3112,7 @@ void handle_se18(DDukeActor *actor, bool morecheck)
{
if (a2->isPlayer() && a2->GetOwner())
{
if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].posZadd(extra);
if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].GetActor()->spr.pos.Z += extra;
}
if (a2->vel.Z == 0 && a2->spr.statnum != STAT_EFFECTOR && a2->spr.statnum != STAT_PROJECTILE)
{
@ -3151,7 +3151,7 @@ void handle_se18(DDukeActor *actor, bool morecheck)
{
if (a2->isPlayer() && a2->GetOwner())
{
if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].posZadd(-extra);
if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].GetActor()->spr.pos.Z -= extra;
}
if (a2->vel.Z == 0 && a2->spr.statnum != STAT_EFFECTOR && a2->spr.statnum != STAT_PROJECTILE)
{
@ -3450,7 +3450,7 @@ void handle_se26(DDukeActor* actor)
{
ps[p].fric.X += vect.X;
ps[p].fric.Y += vect.Y;
ps[p].posZadd(zvel);
ps[p].GetActor()->spr.pos.Z += zvel;
}
movesector(actor, actor->temp_data[1], nullAngle);
@ -3860,7 +3860,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
{
if (a2->isPlayer() && a2->GetOwner())
if (ps[a2->PlayerIndex()].on_ground == 1)
ps[a2->PlayerIndex()].posZadd(l);
ps[a2->PlayerIndex()].GetActor()->spr.pos.Z += l;
if (a2->vel.Z == 0 && a2->spr.statnum != STAT_EFFECTOR && (!choosedir || a2->spr.statnum != STAT_PROJECTILE))
{
if (!a2->isPlayer()) a2->spr.pos.Z += l;
@ -3889,7 +3889,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
{
if (a2->isPlayer() && a2->GetOwner())
if (ps[a2->PlayerIndex()].on_ground == 1)
ps[a2->PlayerIndex()].posZadd(l);
ps[a2->PlayerIndex()].GetActor()->spr.pos.Z += l;
if (a2->vel.Z == 0 && a2->spr.statnum != STAT_EFFECTOR && (!choosedir || a2->spr.statnum != STAT_PROJECTILE))
{
if (!a2->isPlayer()) a2->spr.pos.Z += l;
@ -3920,7 +3920,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
{
if (a2->isPlayer() && a2->GetOwner())
if (ps[a2->PlayerIndex()].on_ground == 1)
ps[a2->PlayerIndex()].posZadd(l);
ps[a2->PlayerIndex()].GetActor()->spr.pos.Z += l;
if (a2->vel.Z == 0 && a2->spr.statnum != STAT_EFFECTOR && (!choosedir || a2->spr.statnum != STAT_PROJECTILE))
{
if (!a2->isPlayer()) a2->spr.pos.Z += l;
@ -3948,7 +3948,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
{
if (a2->isPlayer() && a2->GetOwner())
if (ps[a2->PlayerIndex()].on_ground == 1)
ps[a2->PlayerIndex()].posZadd(-l);
ps[a2->PlayerIndex()].GetActor()->spr.pos.Z -= l;
if (a2->vel.Z == 0 && a2->spr.statnum != STAT_EFFECTOR && (!choosedir || a2->spr.statnum != STAT_PROJECTILE))
{
if (!a2->isPlayer()) a2->spr.pos.Z -= l;

View file

@ -560,7 +560,6 @@ void playerisdead(int snum, int psectlotag, double floorz, double ceilingz)
if (actor->spr.pal != 1)
{
SetPlayerPal(p, PalEntry(63, 63, 0, 0));
p->posZadd(-16);
actor->spr.pos.Z -= 16;
}
#if 0
@ -609,7 +608,7 @@ void playerisdead(int snum, int psectlotag, double floorz, double ceilingz)
if (p->on_warping_sector == 0)
{
if (abs(p->posZget() - floorz) > (gs.playerheight * 0.5))
p->posZadd(348/ 256.);
p->GetActor()->spr.pos.Z += 348/ 256.;
}
else
{
@ -706,7 +705,7 @@ void playerCrouch(int snum)
OnEvent(EVENT_CROUCH, snum, p->GetActor(), -1);
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
{
p->posZadd(8 + 3);
p->GetActor()->spr.pos.Z += 8 + 3;
p->crack_time = CRACK_TIME;
}
}

View file

@ -1689,7 +1689,7 @@ static void operateJetpack(int snum, ESyncBits actions, int psectlotag, double f
if (p->jetpack_on < 11)
{
p->jetpack_on++;
p->posZadd(-(p->jetpack_on * 0.5)); //Goin up
p->GetActor()->spr.pos.Z -= p->jetpack_on * 0.5; //Goin up
}
else if (p->jetpack_on == 11 && !S_CheckActorSoundPlaying(pact, DUKE_JETPACK_IDLE))
S_PlayActorSound(DUKE_JETPACK_IDLE, pact);
@ -1705,7 +1705,7 @@ static void operateJetpack(int snum, ESyncBits actions, int psectlotag, double f
OnEvent(EVENT_SOARUP, snum, p->GetActor(), -1);
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
{
p->posZadd(-dist);
p->GetActor()->spr.pos.Z -= dist;
p->crack_time = CRACK_TIME;
}
}
@ -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->posZadd(dist);
p->GetActor()->spr.pos.Z += 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->posZget() > floorz - k)
p->posZadd(((floorz - k) - p->posZget()) * 0.5);
p->GetActor()->spr.pos.Z += ((floorz - k) - p->posZget()) * 0.5;
if (p->posZget() < pact->ceilingz + 18)
p->GetActor()->spr.pos.Z = pact->ceilingz + 18 + gs.playerheight;
@ -1850,13 +1850,13 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
double k = (floorz - i - p->posZget()) * 0.5;
if (abs(k) < 1) k = 0;
p->posZadd(k);
p->GetActor()->spr.pos.Z += k;
p->vel.Z -= 3;
if (p->vel.Z < 0) p->vel.Z = 0;
}
else if (p->jumping_counter == 0)
{
p->posZadd(((floorz - i * 0.5) - p->posZget()) * 0.5); //Smooth on the water
p->GetActor()->spr.pos.Z += ((floorz - i * 0.5) - p->posZget()) * 0.5; //Smooth on the water
if (p->on_warping_sector == 0 && p->posZget() > floorz - 16)
{
p->GetActor()->spr.pos.Z = floorz - 16 + gs.playerheight;
@ -1910,7 +1910,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
}
}
p->posZadd(p->vel.Z );
p->GetActor()->spr.pos.Z += p->vel.Z;
if (p->posZget() < 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->posZadd(p->vel.Z );
p->GetActor()->spr.pos.Z += p->vel.Z;
if (p->posZget() > floorz - 15)
p->posZadd((((floorz - 15) - p->posZget()) * 0.5));
p->GetActor()->spr.pos.Z += ((floorz - 15) - p->posZget()) * 0.5;
if (p->posZget() < ceilingz + 4)
{
@ -3041,7 +3041,7 @@ HORIZONLY:
clipmove(p->GetActor()->spr.pos.XY(), p->posZget(), &p->cursector, p->vel, 10.25, 4., iif, CLIPMASK0, clip);
if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk)
p->posZadd(32);
p->GetActor()->spr.pos.Z += 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->posZget()) * 0.5;
if (abs(k) < 1) k = 0;
p->posZadd(k);
p->GetActor()->spr.pos.Z += k;
p->vel.Z -= 3;
if (p->vel.Z < 0) p->vel.Z = 0;
}
else if (p->jumping_counter == 0)
{
p->posZadd(((floorz - i * 0.5) - p->posZget()) * 0.5); //Smooth on the water
p->GetActor()->spr.pos.Z += ((floorz - i * 0.5) - p->posZget()) * 0.5; //Smooth on the water
if (p->on_warping_sector == 0 && p->posZget() > floorz - 16)
{
p->GetActor()->spr.pos.Z = floorz - 16 + gs.playerheight;
@ -2233,7 +2233,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
}
}
p->posZadd(p->vel.Z );
p->GetActor()->spr.pos.Z += p->vel.Z;
if (p->posZget() < 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->posZadd(p->vel.Z );
p->GetActor()->spr.pos.Z += p->vel.Z;
if (p->posZget() > floorz - 15)
p->posZadd((((floorz - 15) - p->posZget()) * 0.5));
p->GetActor()->spr.pos.Z += ((floorz - 15) - p->posZget()) * 0.5;
if (p->posZget() < ceilingz + 4)
{
@ -3745,7 +3745,7 @@ HORIZONLY:
clipmove(p->GetActor()->spr.pos.XY(), p->posZget(), &p->cursector, p->vel, 10.25, 4., iif, CLIPMASK0, clip);
if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk)
p->posZadd(32);
p->GetActor()->spr.pos.Z += 32;
if (clip.type != kHitNone)
checkplayerhurt_r(p, clip);

View file

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

View file

@ -336,10 +336,6 @@ struct player_struct
}
void posZadd(const double val)
{
GetActor()->spr.pos.Z += val;
}
double posZget()
{
return GetActor()->spr.pos.Z + GetActor()->viewzoffset;