- wrapped player::pos z-assignments.

This commit is contained in:
Christoph Oelckers 2022-02-05 12:56:49 +01:00
parent 9cd57f4510
commit 44dc2a692f
10 changed files with 60 additions and 60 deletions

View file

@ -791,7 +791,7 @@ void movecrane(DDukeActor *actor, int crane)
ps[p].backupxyz();
ps[p].__int_pos.X = actor->int_pos().X - bcos(ang, -6);
ps[p].__int_pos.Y = actor->int_pos().Y - bsin(ang, -6);
ps[p].__int_pos.Z = actor->int_pos().Z + (2 << 8);
ps[p].player_set_int_z(actor->int_pos().Z + (2 << 8));
SetActor(ps[p].GetActor(), ps[p].player_int_pos());
ps[p].setCursector(ps[p].GetActor()->sector());
}
@ -1095,7 +1095,7 @@ void movetouchplate(DDukeActor* actor, int plate)
{
sectp->add_int_floorz(sectp->extra);
p = checkcursectnums(actor->sector());
if (p >= 0) ps[p].__int_pos.Z += sectp->extra;
if (p >= 0) ps[p].player_add_int_z(sectp->extra);
}
}
else
@ -1110,7 +1110,7 @@ void movetouchplate(DDukeActor* actor, int plate)
sectp->add_int_floorz(-sectp->extra);
p = checkcursectnums(actor->sector());
if (p >= 0)
ps[p].__int_pos.Z -= sectp->extra;
ps[p].player_add_int_z(-sectp->extra);
}
}
return;
@ -2680,7 +2680,7 @@ void handle_se00(DDukeActor* actor)
{
ps[p].angle.addadjustment(buildang(l * q));
ps[p].__int_pos.Z += zchange;
ps[p].player_add_int_z(zchange);
vec2_t res;
rotatepoint(Owner->int_pos().vec2, ps[p].player_int_pos().vec2, (q * l), &res);
@ -3827,7 +3827,7 @@ void handle_se17(DDukeActor* actor)
{
int p = act1->spr.yvel;
if (numplayers < 2) ps[p].backupz();
ps[p].__int_pos.Z += q * zworldtoint;
ps[p].player_add_int_z(q * zworldtoint);
ps[p].truefz += q;
ps[p].truecz += q;
if (numplayers > 1) ps[p].backupz();
@ -3880,7 +3880,7 @@ void handle_se17(DDukeActor* actor)
ps[p].__int_pos.X += act2->int_pos().X - actor->int_pos().X;
ps[p].__int_pos.Y +=act2->int_pos().Y - actor->int_pos().Y;
ps[p].__int_pos.Z = act2->sector()->int_floorz() - (sc->int_floorz() - ps[p].player_int_pos().Z);
ps[p].player_set_int_z(act2->sector()->int_floorz() - (sc->int_floorz() - ps[p].player_int_pos().Z));
act3->floorz = act2->sector()->floorz;
act3->ceilingz = act2->sector()->ceilingz;
@ -3946,7 +3946,7 @@ void handle_se18(DDukeActor *actor, bool morecheck)
while (auto a2 = it.Next())
{
if (a2->isPlayer() && a2->GetOwner())
if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].__int_pos.Z += sc->extra;
if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].player_add_int_z(sc->extra);
if (a2->spr.zvel == 0 && a2->spr.statnum != STAT_EFFECTOR && a2->spr.statnum != STAT_PROJECTILE)
{
a2->add_int_z(sc->extra);
@ -3983,7 +3983,7 @@ void handle_se18(DDukeActor *actor, bool morecheck)
while (auto a2 = it.Next())
{
if (a2->isPlayer() && a2->GetOwner())
if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].__int_pos.Z -= sc->extra;
if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].player_add_int_z(-sc->extra);
if (a2->spr.zvel == 0 && a2->spr.statnum != STAT_EFFECTOR && a2->spr.statnum != STAT_PROJECTILE)
{
a2->add_int_z(-sc->extra);
@ -4287,7 +4287,7 @@ void handle_se26(DDukeActor* actor)
{
ps[p].fric.X += l << 5;
ps[p].fric.Y += x << 5;
ps[p].__int_pos.Z += actor->spr.zvel;
ps[p].player_add_int_z(actor->spr.zvel);
}
ms(actor);
@ -4678,7 +4678,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
{
if (a2->isPlayer() && a2->GetOwner())
if (ps[a2->PlayerIndex()].on_ground == 1)
ps[a2->PlayerIndex()].__int_pos.Z += l;
ps[a2->PlayerIndex()].player_add_int_z(l);
if (a2->spr.zvel == 0 && a2->spr.statnum != STAT_EFFECTOR && (!choosedir || a2->spr.statnum != STAT_PROJECTILE))
{
a2->add_int_z(l);
@ -4707,7 +4707,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
{
if (a2->isPlayer() && a2->GetOwner())
if (ps[a2->PlayerIndex()].on_ground == 1)
ps[a2->PlayerIndex()].__int_pos.Z += l;
ps[a2->PlayerIndex()].player_add_int_z(l);
if (a2->spr.zvel == 0 && a2->spr.statnum != STAT_EFFECTOR && (!choosedir || a2->spr.statnum != STAT_PROJECTILE))
{
a2->add_int_z(l);
@ -4738,7 +4738,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
{
if (a2->isPlayer() && a2->GetOwner())
if (ps[a2->PlayerIndex()].on_ground == 1)
ps[a2->PlayerIndex()].__int_pos.Z += l;
ps[a2->PlayerIndex()].player_add_int_z(l);
if (a2->spr.zvel == 0 && a2->spr.statnum != STAT_EFFECTOR && (!choosedir || a2->spr.statnum != STAT_PROJECTILE))
{
a2->add_int_z(l);
@ -4766,7 +4766,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
{
if (a2->isPlayer() && a2->GetOwner())
if (ps[a2->PlayerIndex()].on_ground == 1)
ps[a2->PlayerIndex()].__int_pos.Z -= l;
ps[a2->PlayerIndex()].player_add_int_z(-l);
if (a2->spr.zvel == 0 && a2->spr.statnum != STAT_EFFECTOR && (!choosedir || a2->spr.statnum != STAT_PROJECTILE))
{
a2->add_int_z(-l);

View file

@ -1833,8 +1833,8 @@ void movetransports_d(void)
ps[p].backupxy();
if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11))
ps[p].__int_pos.Z = Owner->int_pos().Z - 6144;
else ps[p].__int_pos.Z = Owner->int_pos().Z + 6144;
ps[p].player_set_int_z(Owner->int_pos().Z - 6144);
else ps[p].player_set_int_z(Owner->int_pos().Z + 6144);
ps[p].backupz();
auto pa = ps[p].GetActor();
@ -1858,7 +1858,7 @@ void movetransports_d(void)
}
if (ps[p].GetActor()->spr.extra > 0)
S_PlayActorSound(DUKE_UNDERWATER, act2);
ps[p].__int_pos.Z = Owner->sector()->int_ceilingz() + (7 << 8);
ps[p].player_set_int_z(Owner->sector()->int_ceilingz() + (7 << 8));
ps[p].backupz();
ps[p].vel.X = 4096 - (krand() & 8192);
@ -1876,7 +1876,7 @@ void movetransports_d(void)
}
S_PlayActorSound(DUKE_GASP, act2);
ps[p].__int_pos.Z = Owner->sector()->int_floorz() - (7 << 8);
ps[p].player_set_int_z(Owner->sector()->int_floorz() - (7 << 8));
ps[p].backupz();
ps[p].jumping_toggle = 1;

View file

@ -1480,8 +1480,8 @@ void movetransports_r(void)
ps[p].backupxy();
if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11))
ps[p].__int_pos.Z = Owner->int_pos().Z - 6144;
else ps[p].__int_pos.Z = Owner->int_pos().Z + 6144;
ps[p].player_set_int_z(Owner->int_pos().Z - 6144);
else ps[p].player_set_int_z(Owner->int_pos().Z + 6144);
ps[p].backupz();
ChangeActorSect(act2, Owner->sector());
@ -1497,7 +1497,7 @@ void movetransports_r(void)
if (onfloorz && sectlotag == 160 && ps[p].player_int_pos().Z > (sectp->int_floorz() - (48 << 8)))
{
k = 2;
ps[p].__int_pos.Z = Owner->sector()->int_ceilingz() + (7 << 8);
ps[p].player_set_int_z(Owner->sector()->int_ceilingz() + (7 << 8));
ps[p].backupz();
}
@ -1505,7 +1505,7 @@ void movetransports_r(void)
{
k = 2;
if (ps[p].GetActor()->spr.extra <= 0) break;
ps[p].__int_pos.Z = Owner->sector()->int_floorz() - (49 << 8);
ps[p].player_set_int_z(Owner->sector()->int_floorz() - (49 << 8));
ps[p].backupz();
}
}
@ -1520,7 +1520,7 @@ void movetransports_r(void)
FX_StopAllSounds();
}
S_PlayActorSound(DUKE_UNDERWATER, ps[p].GetActor());
ps[p].__int_pos.Z = Owner->sector()->int_ceilingz() + (7 << 8);
ps[p].player_set_int_z(Owner->sector()->int_ceilingz() + (7 << 8));
ps[p].backupz();
if (ps[p].OnMotorcycle)
ps[p].moto_underwater = 1;
@ -1536,7 +1536,7 @@ void movetransports_r(void)
}
S_PlayActorSound(DUKE_GASP, ps[p].GetActor());
ps[p].__int_pos.Z = Owner->sector()->int_floorz() - (7 << 8);
ps[p].player_set_int_z(Owner->sector()->int_floorz() - (7 << 8));
ps[p].backupz();
}

View file

@ -1981,7 +1981,7 @@ int ParseState::parse(void)
break;
case concmd_larrybird:
insptr++;
ps[g_p].__int_pos.Z = ps[g_p].GetActor()->sector()->int_ceilingz();
ps[g_p].player_set_int_z(ps[g_p].GetActor()->sector()->int_ceilingz());
ps[g_p].GetActor()->set_int_z(ps[g_p].player_int_pos().Z);
break;
case concmd_destroyit:

View file

@ -564,7 +564,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz)
if (actor->spr.pal != 1)
{
SetPlayerPal(p, PalEntry(63, 63, 0, 0));
p->__int_pos.Z -= (16 << 8);
p->player_add_int_z(-(16 << 8));
actor->add_int_z(-(16 << 8));
}
#if 0
@ -613,7 +613,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz)
if (p->on_warping_sector == 0)
{
if (abs(p->player_int_pos().Z - fz) > (gs.int_playerheight >> 1))
p->__int_pos.Z += 348;
p->player_add_int_z(348);
}
else
{
@ -710,7 +710,7 @@ void playerCrouch(int snum)
OnEvent(EVENT_CROUCH, snum, p->GetActor(), -1);
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
{
p->__int_pos.Z += (2048 + 768);
p->player_add_int_z((2048 + 768));
p->crack_time = CRACK_TIME;
}
}

View file

@ -1687,7 +1687,7 @@ static void operateJetpack(int snum, ESyncBits actions, int psectlotag, int fz,
if (p->jetpack_on < 11)
{
p->jetpack_on++;
p->__int_pos.Z -= (p->jetpack_on << 7); //Goin up
p->player_add_int_z(-(p->jetpack_on << 7)); //Goin up
}
else if (p->jetpack_on == 11 && !S_CheckActorSoundPlaying(pact, DUKE_JETPACK_IDLE))
S_PlayActorSound(DUKE_JETPACK_IDLE, pact);
@ -1702,7 +1702,7 @@ static void operateJetpack(int snum, ESyncBits actions, int psectlotag, int fz,
OnEvent(EVENT_SOARUP, snum, p->GetActor(), -1);
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
{
p->__int_pos.Z -= j;
p->player_add_int_z(-j);
p->crack_time = CRACK_TIME;
}
}
@ -1714,7 +1714,7 @@ static void operateJetpack(int snum, ESyncBits actions, int psectlotag, int fz,
OnEvent(EVENT_SOARDOWN, snum, p->GetActor(), -1);
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
{
p->__int_pos.Z += j;
p->player_add_int_z(j);
p->crack_time = CRACK_TIME;
}
}
@ -1727,9 +1727,9 @@ static void operateJetpack(int snum, ESyncBits actions, int psectlotag, int fz,
p->scuba_on = 0;
if (p->player_int_pos().Z > (fz - (k << 8)))
p->__int_pos.Z += ((fz - (k << 8)) - p->player_int_pos().Z) >> 1;
p->player_add_int_z(((fz - (k << 8)) - p->player_int_pos().Z) >> 1);
if (p->player_int_pos().Z < (pact->actor_int_ceilingz() + (18 << 8)))
p->__int_pos.Z = pact->actor_int_ceilingz() + (18 << 8);
p->player_set_int_z(pact->actor_int_ceilingz() + (18 << 8));
}
@ -1788,7 +1788,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz, int
// not jumping or crouching
if ((actions & (SB_JUMP|SB_CROUCH)) == 0 && p->on_ground && (psect->floorstat & CSTAT_SECTOR_SLOPE) && p->player_int_pos().Z >= (fz - (i << 8) - (16 << 8)))
p->__int_pos.Z = fz - (i << 8);
p->player_set_int_z(fz - (i << 8));
else
{
p->on_ground = 0;
@ -1847,16 +1847,16 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz, int
int k = ((fz - (i << 8)) - p->player_int_pos().Z) >> 1;
if (abs(k) < 256) k = 0;
p->__int_pos.Z += k;
p->player_add_int_z(k);
p->vel.Z -= 768;
if (p->vel.Z < 0) p->vel.Z = 0;
}
else if (p->jumping_counter == 0)
{
p->__int_pos.Z += ((fz - (i << 7)) - p->player_int_pos().Z) >> 1; //Smooth on the water
p->player_add_int_z(((fz - (i << 7)) - p->player_int_pos().Z) >> 1); //Smooth on the water
if (p->on_warping_sector == 0 && p->player_int_pos().Z > fz - (16 << 8))
{
p->__int_pos.Z = fz - (16 << 8);
p->player_set_int_z(fz - (16 << 8));
p->vel.Z >>= 1;
}
}
@ -1907,7 +1907,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz, int
}
}
p->__int_pos.Z += p->vel.Z;
p->player_add_int_z(p->vel.Z);
if (p->player_int_pos().Z < (cz + (4 << 8)))
{
@ -1915,7 +1915,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz, int
if (p->vel.Z < 0)
p->vel.X = p->vel.Y = 0;
p->vel.Z = 128;
p->__int_pos.Z = cz + (4 << 8);
p->player_set_int_z(cz + (4 << 8));
}
}
@ -1974,14 +1974,14 @@ static void underwater(int snum, ESyncBits actions, int fz, int cz)
if (p->vel.Z > 2048)
p->vel.Z >>= 1;
p->__int_pos.Z += p->vel.Z;
p->player_add_int_z(p->vel.Z);
if (p->player_int_pos().Z > (fz - (15 << 8)))
p->__int_pos.Z += ((fz - (15 << 8)) - p->player_int_pos().Z) >> 1;
p->player_add_int_z(((fz - (15 << 8)) - p->player_int_pos().Z) >> 1);
if (p->player_int_pos().Z < (cz + (4 << 8)))
{
p->__int_pos.Z = cz + (4 << 8);
p->player_set_int_z(cz + (4 << 8));
p->vel.Z = 0;
}
@ -2034,7 +2034,7 @@ int operateTripbomb(int snum)
if ((hit.hitWall->twoSided() && hit.hitWall->nextSector()->lotag <= 2) || (!hit.hitWall->twoSided() && hit.hitSector->lotag <= 2))
if (((hit.hitpos.X - p->player_int_pos().X) * (hit.hitpos.X - p->player_int_pos().X) + (hit.hitpos.Y - p->player_int_pos().Y) * (hit.hitpos.Y - p->player_int_pos().Y)) < (290 * 290))
{
p->__int_pos.Z = p->player_int_opos().Z;
p->player_set_int_z(p->player_int_opos().Z);
p->vel.Z = 0;
return 1;
}
@ -2572,7 +2572,7 @@ static void operateweapon(int snum, ESyncBits actions)
case TRIPBOMB_WEAPON: // Claymore in NAM
if (p->kickback_pic < 4)
{
p->__int_pos.Z = p->player_int_opos().Z;
p->player_set_int_z(p->player_int_opos().Z);
p->vel.Z = 0;
if (p->kickback_pic == 3)
fi.shoot(pact, HANDHOLDINGLASER);
@ -3035,7 +3035,7 @@ HORIZONLY:
clipmove(p->__int_pos, &p->cursector, p->vel.X, p->vel.Y, 164, (4 << 8), ii, CLIPMASK0, clip);
if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk)
p->__int_pos.Z += 32 << 8;
p->player_add_int_z(32 << 8);
if (clip.type != kHitNone)
checkplayerhurt_d(p, clip);

View file

@ -2118,7 +2118,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz, int
if (p->player_int_pos().Z < (fz - (i << 8))) //falling
{
if ((actions & (SB_JUMP|SB_CROUCH)) == 0 && p->on_ground && (psect->floorstat & CSTAT_SECTOR_SLOPE) && p->player_int_pos().Z >= (fz - (i << 8) - (16 << 8)))
p->__int_pos.Z = fz - (i << 8);
p->player_set_int_z(fz - (i << 8));
else
{
p->on_ground = 0;
@ -2215,16 +2215,16 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz, int
int k = ((fz - (i << 8)) - p->player_int_pos().Z) >> 1;
if (abs(k) < 256) k = 0;
p->__int_pos.Z += k;
p->player_add_int_z(k);
p->vel.Z -= 768;
if (p->vel.Z < 0) p->vel.Z = 0;
}
else if (p->jumping_counter == 0)
{
p->__int_pos.Z += ((fz - (i << 7)) - p->player_int_pos().Z) >> 1; //Smooth on the water
p->player_add_int_z(((fz - (i << 7)) - p->player_int_pos().Z) >> 1); //Smooth on the water
if (p->on_warping_sector == 0 && p->player_int_pos().Z > fz - (16 << 8))
{
p->__int_pos.Z = fz - (16 << 8);
p->player_set_int_z(fz - (16 << 8));
p->vel.Z >>= 1;
}
}
@ -2271,7 +2271,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz, int
}
}
p->__int_pos.Z += p->vel.Z;
p->player_add_int_z(p->vel.Z);
if (p->player_int_pos().Z < (cz + (4 << 8)))
{
@ -2279,7 +2279,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz, int
if (p->vel.Z < 0)
p->vel.X = p->vel.Y = 0;
p->vel.Z = 128;
p->__int_pos.Z = cz + (4 << 8);
p->player_set_int_z(cz + (4 << 8));
}
}
@ -2334,14 +2334,14 @@ static void underwater(int snum, ESyncBits actions, int fz, int cz)
if (p->vel.Z > 2048)
p->vel.Z >>= 1;
p->__int_pos.Z += p->vel.Z;
p->player_add_int_z(p->vel.Z);
if (p->player_int_pos().Z > (fz - (15 << 8)))
p->__int_pos.Z += ((fz - (15 << 8)) - p->player_int_pos().Z) >> 1;
p->player_add_int_z(((fz - (15 << 8)) - p->player_int_pos().Z) >> 1);
if (p->player_int_pos().Z < (cz + (4 << 8)))
{
p->__int_pos.Z = cz + (4 << 8);
p->player_set_int_z(cz + (4 << 8));
p->vel.Z = 0;
}
@ -3804,7 +3804,7 @@ HORIZONLY:
clipmove(p->__int_pos, &p->cursector, p->vel.X, p->vel.Y, 164, (4 << 8), i, CLIPMASK0, clip);
if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk)
p->__int_pos.Z += 32 << 8;
p->player_add_int_z(32 << 8);
if (clip.type != kHitNone)
checkplayerhurt_r(p, clip);

View file

@ -439,7 +439,7 @@ void operateweapon_ww(int snum, ESyncBits actions)
if (aplWeaponFlags(p->curr_weapon, snum) & WEAPON_FLAG_STANDSTILL
&& p->kickback_pic < (aplWeaponFireDelay(p->curr_weapon, snum) + 1))
{
p->__int_pos.Z = p->player_int_opos().Z;
p->player_set_int_z(p->player_int_opos().Z);
p->vel.Z = 0;
}
if (p->kickback_pic == aplWeaponSound2Time(p->curr_weapon, snum))

View file

@ -391,7 +391,7 @@ void doanimations(void)
if ((dasectp->int_floorz() - ps[p].player_int_pos().Z) < (64 << 8))
if (ps[p].GetActor()->GetOwner() != nullptr)
{
ps[p].__int_pos.Z += v;
ps[p].player_add_int_z(v);
ps[p].vel.Z = 0;
}

View file

@ -371,7 +371,7 @@ struct player_struct
{
__int_pos.X = opos.X * worldtoint;
__int_pos.Y = opos.Y * worldtoint;
__int_pos.Z = opos.Z * zworldtoint;
__int_pos.Z = opos.Z * zworldtoint;
}
void backupxy()
@ -399,7 +399,7 @@ struct player_struct
void getposfromactor(DCoreActor* actor, double addz = 0)
{
__int_pos = actor->int_pos();
if (addz) __int_pos.Z += int(addz * worldtoint);
if (addz) __int_pos.Z += int(addz * worldtoint);
}
void getxyfromactor(DCoreActor* actor)
@ -420,12 +420,12 @@ struct player_struct
void player_add_int_z(int z)
{
__int_pos.Z += z;
__int_pos.Z += z;
}
void player_set_int_z(int z)
{
__int_pos.Z = z;
__int_pos.Z = z;
}
};