- Duke: Rename player's pos to something identifiable.

This commit is contained in:
Mitchell Richters 2022-11-14 18:57:18 +11:00 committed by Christoph Oelckers
parent 59e8821332
commit 4aa63b5446
28 changed files with 298 additions and 298 deletions

View file

@ -205,7 +205,7 @@ void clearcamera(player_struct* ps)
ps->newOwner = nullptr;
ps->restorexyz();
ps->angle.restore();
updatesector(ps->pos, &ps->cursector);
updatesector(ps->PlayerNowPosition, &ps->cursector);
DukeStatIterator it(STAT_ACTOR);
while (auto k = it.Next())
@ -374,8 +374,8 @@ void movedummyplayers(void)
}
}
act->spr.pos.X += (ps[p].pos.X - ps[p].opos.X);
act->spr.pos.Y += (ps[p].pos.Y - ps[p].opos.Y);
act->spr.pos.X += (ps[p].PlayerNowPosition.X - ps[p].opos.X);
act->spr.pos.Y += (ps[p].PlayerNowPosition.Y - ps[p].opos.Y);
SetActor(act, act->spr.pos);
}
}
@ -443,7 +443,7 @@ void moveplayers(void)
if (p->actorsqu != nullptr)
{
p->angle.addadjustment(deltaangle(p->angle.ang, (p->actorsqu->spr.pos - p->pos).Angle()) * 0.25);
p->angle.addadjustment(deltaangle(p->angle.ang, (p->actorsqu->spr.pos - p->PlayerNowPosition).Angle()) * 0.25);
}
if (act->spr.extra > 0)
@ -458,12 +458,12 @@ void moveplayers(void)
}
else
{
p->pos = act->spr.pos.plusZ(-20);
p->PlayerNowPosition = act->spr.pos.plusZ(-20);
p->newOwner = nullptr;
if (p->wackedbyactor != nullptr && p->wackedbyactor->spr.statnum < MAXSTATUS)
{
p->angle.addadjustment(deltaangle(p->angle.ang, (p->wackedbyactor->spr.pos - p->pos).Angle()) * 0.5);
p->angle.addadjustment(deltaangle(p->angle.ang, (p->wackedbyactor->spr.pos - p->PlayerNowPosition).Angle()) * 0.5);
}
}
act->spr.angle = p->angle.ang;
@ -780,7 +780,7 @@ bool queball(DDukeActor *actor, int pocket, int queball, int stripeball)
{
// if(actor->spr.pal == 12)
{
auto delta = absangle(ps[p].angle.ang, (actor->spr.pos.XY() - ps[p].pos.XY()).Angle());
auto delta = absangle(ps[p].angle.ang, (actor->spr.pos.XY() - ps[p].PlayerNowPosition.XY()).Angle());
if (delta < DAngle22_5 / 2 && PlayerInput(p, SB_OPEN))
if (ps[p].toggle_key_flag == 1)
{
@ -790,7 +790,7 @@ bool queball(DDukeActor *actor, int pocket, int queball, int stripeball)
{
if (act2->spr.picnum == queball || act2->spr.picnum == stripeball)
{
delta = absangle(ps[p].angle.ang, (act2->spr.pos.XY() - ps[p].pos.XY()).Angle());
delta = absangle(ps[p].angle.ang, (act2->spr.pos.XY() - ps[p].PlayerNowPosition.XY()).Angle());
if (delta < DAngle22_5 / 2)
{
double l;
@ -812,7 +812,7 @@ bool queball(DDukeActor *actor, int pocket, int queball, int stripeball)
}
if (x < 32 && actor->sector() == ps[p].cursector)
{
actor->spr.angle = (actor->spr.pos.XY() - ps[p].pos.XY()).Angle();
actor->spr.angle = (actor->spr.pos.XY() - ps[p].PlayerNowPosition.XY()).Angle();
actor->vel.X = 3;
}
}
@ -958,13 +958,13 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p
fi.shoot(actor, firelaser);
actor->spr.angle = a;
}
if (actor->temp_data[2] > (26 * 3) || !cansee(actor->spr.pos.plusZ(-16), actor->sector(), ps[p].pos, ps[p].cursector))
if (actor->temp_data[2] > (26 * 3) || !cansee(actor->spr.pos.plusZ(-16), actor->sector(), ps[p].PlayerNowPosition, ps[p].cursector))
{
actor->temp_data[0] = 0;
actor->temp_data[2] = 0;
}
else actor->temp_angle +=
deltaangle(actor->temp_angle, (ps[p].pos.XY() - actor->spr.pos.XY()).Angle()) / 3;
deltaangle(actor->temp_angle, (ps[p].PlayerNowPosition.XY() - actor->spr.pos.XY()).Angle()) / 3;
}
else if (actor->temp_data[0] == 2 || actor->temp_data[0] == 3)
{
@ -973,14 +973,14 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p
if (actor->temp_data[0] == 2)
{
double l = ps[p].pos.Z - actor->spr.pos.Z;
double l = ps[p].PlayerNowPosition.Z - actor->spr.pos.Z;
if (fabs(l) < 48) actor->temp_data[0] = 3;
else actor->spr.pos.Z += (Sgn(ps[p].pos.Z - actor->spr.pos.Z) * shift); // The shift here differs between Duke and RR.
else actor->spr.pos.Z += (Sgn(ps[p].PlayerNowPosition.Z - actor->spr.pos.Z) * shift); // The shift here differs between Duke and RR.
}
else
{
actor->temp_data[2]++;
if (actor->temp_data[2] > (26 * 3) || !cansee(actor->spr.pos.plusZ(-16), actor->sector(), ps[p].pos, ps[p].cursector))
if (actor->temp_data[2] > (26 * 3) || !cansee(actor->spr.pos.plusZ(-16), actor->sector(), ps[p].PlayerNowPosition, ps[p].cursector))
{
actor->temp_data[0] = 1;
actor->temp_data[2] = 0;
@ -991,7 +991,7 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p
fi.shoot(actor, firelaser);
}
}
actor->spr.angle += deltaangle(actor->spr.angle, (ps[p].pos.XY() - actor->spr.pos.XY()).Angle()) * 0.25;
actor->spr.angle += deltaangle(actor->spr.angle, (ps[p].PlayerNowPosition.XY() - actor->spr.pos.XY()).Angle()) * 0.25;
}
if (actor->temp_data[0] != 2 && actor->temp_data[0] != 3 && Owner)
@ -1862,14 +1862,14 @@ void handle_se00(DDukeActor* actor)
{
ps[p].angle.addadjustment(ang_amount * direction);
ps[p].pos.Z += zchange;
ps[p].PlayerNowPosition.Z += zchange;
auto result = rotatepoint(Owner->spr.pos, ps[p].pos.XY(), ang_amount * direction);
auto result = rotatepoint(Owner->spr.pos, ps[p].PlayerNowPosition.XY(), ang_amount * direction);
ps[p].bobpos += (result - ps[p].pos.XY());
ps[p].bobpos += (result - ps[p].PlayerNowPosition.XY());
ps[p].pos.X = result.X;
ps[p].pos.Y = result.Y;
ps[p].PlayerNowPosition.X = result.X;
ps[p].PlayerNowPosition.Y = result.Y;
auto psp = ps[p].GetActor();
if (psp->spr.extra <= 0)
@ -1996,7 +1996,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
if (dist2 < 1280)//20480)
{
auto saved_angle = actor->spr.angle;
actor->spr.angle = (actor->spr.pos.XY() - ps[p].pos.XY()).Angle();
actor->spr.angle = (actor->spr.pos.XY() - ps[p].PlayerNowPosition.XY()).Angle();
fi.shoot(actor, RPG);
actor->spr.angle = saved_angle;
}
@ -2015,10 +2015,10 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
if (psp->spr.extra > 0)
{
auto sect = ps[p].cursector;
updatesector(ps[p].pos, &sect);
updatesector(ps[p].PlayerNowPosition, &sect);
if ((sect == nullptr && ud.clipping == 0) || (sect == actor->sector() && ps[p].cursector != actor->sector()))
{
ps[p].pos.XY() = actor->spr.pos.XY();
ps[p].PlayerNowPosition.XY() = actor->spr.pos.XY();
ps[p].setCursector(actor->sector());
SetActor(ps[p].GetActor(), actor->spr.pos);
@ -2042,9 +2042,9 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
if (actor->sector() == psp->sector())
{
auto result = rotatepoint(actor->spr.pos.XY(), ps[p].pos.XY(), diffangle);
auto result = rotatepoint(actor->spr.pos.XY(), ps[p].PlayerNowPosition.XY(), diffangle);
ps[p].pos.XY() = result + vec;
ps[p].PlayerNowPosition.XY() = result + vec;
ps[p].bobpos += vec;
@ -2056,7 +2056,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
}
if (psp->spr.extra <= 0)
{
psp->spr.pos.XY() = ps[p].pos.XY();
psp->spr.pos.XY() = ps[p].PlayerNowPosition.XY();
}
}
}
@ -2090,10 +2090,10 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
if (ps[p].GetActor()->spr.extra > 0)
{
auto k = ps[p].cursector;
updatesector(ps[p].pos, &k);
updatesector(ps[p].PlayerNowPosition, &k);
if ((k == nullptr && ud.clipping == 0) || (k == actor->sector() && ps[p].cursector != actor->sector()))
{
ps[p].pos.XY() = actor->spr.pos.XY();
ps[p].PlayerNowPosition.XY() = actor->spr.pos.XY();
ps[p].backupxy();
ps[p].setCursector(actor->sector());
@ -2193,10 +2193,10 @@ void handle_se30(DDukeActor *actor, int JIBS6)
if (psp->spr.extra > 0)
{
auto k = ps[p].cursector;
updatesector(ps[p].pos, &k);
updatesector(ps[p].PlayerNowPosition, &k);
if ((k == nullptr && ud.clipping == 0) || (k == actor->sector() && ps[p].cursector != actor->sector()))
{
ps[p].pos.XY() = actor->spr.pos.XY();
ps[p].PlayerNowPosition.XY() = actor->spr.pos.XY();
ps[p].setCursector(actor->sector());
SetActor(ps[p].GetActor(), actor->spr.pos);
@ -2209,7 +2209,7 @@ void handle_se30(DDukeActor *actor, int JIBS6)
auto psp = ps[p].GetActor();
if (psp->sector() == actor->sector())
{
ps[p].pos += vect;
ps[p].PlayerNowPosition += vect;
if (numplayers > 1)
{
@ -2249,10 +2249,10 @@ void handle_se30(DDukeActor *actor, int JIBS6)
if (ps[p].GetActor()->spr.extra > 0)
{
auto k = ps[p].cursector;
updatesector(ps[p].pos, &k);
updatesector(ps[p].PlayerNowPosition, &k);
if ((k == nullptr && ud.clipping == 0) || (k == actor->sector() && ps[p].cursector != actor->sector()))
{
ps[p].pos.XY() = actor->spr.pos.XY();
ps[p].PlayerNowPosition.XY() = actor->spr.pos.XY();
ps[p].backupxy();
ps[p].setCursector(actor->sector());
@ -2336,7 +2336,7 @@ void handle_se02(DDukeActor* actor)
for (int p = connecthead; p >= 0; p = connectpoint2[p])
if (ps[p].cursector == actor->sector() && ps[p].on_ground)
{
ps[p].pos += vect;
ps[p].PlayerNowPosition += vect;
ps[p].bobpos += vect;
}
@ -2482,7 +2482,7 @@ void handle_se05(DDukeActor* actor, int FIRELASER)
if (x < 512)
{
auto ang = actor->spr.angle;
actor->spr.angle = (actor->spr.pos.XY() - ps[p].pos).Angle();
actor->spr.angle = (actor->spr.pos.XY() - ps[p].PlayerNowPosition).Angle();
fi.shoot(actor, FIRELASER);
actor->spr.angle = ang;
}
@ -2537,7 +2537,7 @@ void handle_se05(DDukeActor* actor, int FIRELASER)
else
{
actor->temp_angle +=
deltaangle(actor->temp_angle + DAngle90, (ps[p].pos.XY() - actor->spr.pos.XY()).Angle()) * 0.25;
deltaangle(actor->temp_angle + DAngle90, (ps[p].PlayerNowPosition.XY() - actor->spr.pos.XY()).Angle()) * 0.25;
sc->ceilingshade = 0;
}
j = fi.ifhitbyweapon(actor);
@ -2997,7 +2997,7 @@ void handle_se17(DDukeActor* actor)
if (act1->spr.statnum == STAT_PLAYER && act1->GetOwner())
{
int p = act1->spr.yint;
ps[p].pos.Z += q;
ps[p].PlayerNowPosition.Z += q;
ps[p].truefz += q;
ps[p].truecz += q;
}
@ -3046,10 +3046,10 @@ void handle_se17(DDukeActor* actor)
{
int p = act3->PlayerIndex();
ps[p].opos -= ps[p].pos;
ps[p].pos.XY() += act2->spr.pos.XY() - actor->spr.pos.XY();
ps[p].pos.Z += act2->sector()->floorz - sc->floorz;
ps[p].opos += ps[p].pos;
ps[p].opos -= ps[p].PlayerNowPosition;
ps[p].PlayerNowPosition.XY() += act2->spr.pos.XY() - actor->spr.pos.XY();
ps[p].PlayerNowPosition.Z += act2->sector()->floorz - sc->floorz;
ps[p].opos += 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()].pos.Z += extra;
if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].PlayerNowPosition.Z += extra;
}
if (a2->vel.Z == 0 && a2->spr.statnum != STAT_EFFECTOR && a2->spr.statnum != STAT_PROJECTILE)
{
@ -3160,7 +3160,7 @@ void handle_se18(DDukeActor *actor, bool morecheck)
{
if (a2->isPlayer() && a2->GetOwner())
{
if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].pos.Z -= extra;
if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].PlayerNowPosition.Z -= extra;
}
if (a2->vel.Z == 0 && a2->spr.statnum != STAT_EFFECTOR && a2->spr.statnum != STAT_PROJECTILE)
{
@ -3346,10 +3346,10 @@ void handle_se20(DDukeActor* actor)
for (int p = connecthead; p >= 0; p = connectpoint2[p])
if (ps[p].cursector == actor->sector() && ps[p].on_ground)
{
ps[p].pos += vec;
ps[p].PlayerNowPosition += vec;
ps[p].backupxy();
SetActor(ps[p].GetActor(), ps[p].pos.plusZ(gs.playerheight));
SetActor(ps[p].GetActor(), ps[p].PlayerNowPosition.plusZ(gs.playerheight));
}
sc->addfloorxpan(-(float)vec.X * 2);
@ -3459,7 +3459,7 @@ void handle_se26(DDukeActor* actor)
{
ps[p].fric.X += vect.X;
ps[p].fric.Y += vect.Y;
ps[p].pos.Z += zvel;
ps[p].PlayerNowPosition.Z += zvel;
}
movesector(actor, actor->temp_data[1], nullAngle);
@ -3492,14 +3492,14 @@ void handle_se27(DDukeActor* actor)
}
else if (ud.recstat == 2 && ps[p].newOwner == nullptr)
{
if (cansee(actor->spr.pos, actor->sector(), ps[p].pos, ps[p].cursector))
if (cansee(actor->spr.pos, actor->sector(), ps[p].PlayerNowPosition, ps[p].cursector))
{
if (xx < sh * maptoworld)
{
ud.cameraactor = actor;
actor->temp_data[0] = 999;
actor->spr.angle += deltaangle(actor->spr.angle, (ps[p].pos.XY() - actor->spr.pos.XY()).Angle()) * 0.125;
actor->spr.yint = 100 + int((actor->spr.pos.Z - ps[p].pos.Z) * (256. / 257.));
actor->spr.angle += deltaangle(actor->spr.angle, (ps[p].PlayerNowPosition.XY() - actor->spr.pos.XY()).Angle()) * 0.125;
actor->spr.yint = 100 + int((actor->spr.pos.Z - ps[p].PlayerNowPosition.Z) * (256. / 257.));
}
else if (actor->temp_data[0] == 999)
@ -3513,7 +3513,7 @@ void handle_se27(DDukeActor* actor)
}
else
{
actor->spr.angle = (ps[p].pos.XY() - actor->spr.pos.XY()).Angle();
actor->spr.angle = (ps[p].PlayerNowPosition.XY() - actor->spr.pos.XY()).Angle();
if (actor->temp_data[0] == 999)
{
@ -3579,7 +3579,7 @@ void handle_se24(DDukeActor *actor, bool scroll, double mult)
{
if (ps[p].cursector == actor->sector() && ps[p].on_ground)
{
if (abs(ps[p].pos.Z - ps[p].truefz) < gs.playerheight + 9)
if (abs(ps[p].PlayerNowPosition.Z - ps[p].truefz) < gs.playerheight + 9)
{
ps[p].fric += vec * (1. / 8.); // keeping the original velocity. to match the animation it should be ~1/24.
}
@ -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()].pos.Z +=l;
ps[a2->PlayerIndex()].PlayerNowPosition.Z +=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()].pos.Z += l;
ps[a2->PlayerIndex()].PlayerNowPosition.Z += 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()].pos.Z += l;
ps[a2->PlayerIndex()].PlayerNowPosition.Z += l;
if (a2->vel.Z == 0 && a2->spr.statnum != STAT_EFFECTOR && (!choosedir || a2->spr.statnum != STAT_PROJECTILE))
{
a2->spr.pos.Z += l;
@ -3957,7 +3957,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
{
if (a2->isPlayer() && a2->GetOwner())
if (ps[a2->PlayerIndex()].on_ground == 1)
ps[a2->PlayerIndex()].pos.Z -= l;
ps[a2->PlayerIndex()].PlayerNowPosition.Z -= l;
if (a2->vel.Z == 0 && a2->spr.statnum != STAT_EFFECTOR && (!choosedir || a2->spr.statnum != STAT_PROJECTILE))
{
a2->spr.pos.Z -= l;

View file

@ -1345,7 +1345,7 @@ void movetransports_d(void)
ps[p].transporter_hold = 13;
}
ps[p].pos = Owner->spr.pos.plusZ(-gs.playerheight);
ps[p].PlayerNowPosition = Owner->spr.pos.plusZ(-gs.playerheight);
ps[p].backupxyz();
ps[p].setbobpos();
@ -1363,21 +1363,21 @@ void movetransports_d(void)
}
else if (!(sectlotag == 1 && ps[p].on_ground == 1)) break;
if (onfloorz == 0 && abs(act->spr.pos.Z - ps[p].pos.Z) < 24)
if (onfloorz == 0 && abs(act->spr.pos.Z - ps[p].PlayerNowPosition.Z) < 24)
if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP))) ||
(ps[p].jetpack_on && PlayerInput(p, SB_CROUCH)))
{
ps[p].pos.X += Owner->spr.pos.X - act->spr.pos.X;
ps[p].pos.Y += Owner->spr.pos.Y - act->spr.pos.Y;
ps[p].PlayerNowPosition.X += Owner->spr.pos.X - act->spr.pos.X;
ps[p].PlayerNowPosition.Y += Owner->spr.pos.Y - act->spr.pos.Y;
ps[p].backupxy();
if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11))
ps[p].pos.Z = Owner->spr.pos.Z - 24;
else ps[p].pos.Z = Owner->spr.pos.Z + 24;
ps[p].PlayerNowPosition.Z = Owner->spr.pos.Z - 24;
else ps[p].PlayerNowPosition.Z = Owner->spr.pos.Z + 24;
ps[p].backupz();
auto pa = ps[p].GetActor();
pa->opos = ps[p].pos;
pa->opos = ps[p].PlayerNowPosition;
ChangeActorSect(act2, Owner->sector());
ps[p].setCursector(Owner->sector());
@ -1387,7 +1387,7 @@ void movetransports_d(void)
int k = 0;
if (onfloorz && sectlotag == ST_1_ABOVE_WATER && ps[p].on_ground && ps[p].pos.Z > (sectp->floorz - 16) && (PlayerInput(p, SB_CROUCH) || ps[p].vel.Z > 8))
if (onfloorz && sectlotag == ST_1_ABOVE_WATER && ps[p].on_ground && ps[p].PlayerNowPosition.Z > (sectp->floorz - 16) && (PlayerInput(p, SB_CROUCH) || ps[p].vel.Z > 8))
// if( onfloorz && sectlotag == 1 && ps[p].pos.z > (sectp->floorz-(6<<8)) )
{
k = 1;
@ -1397,7 +1397,7 @@ void movetransports_d(void)
}
if (ps[p].GetActor()->spr.extra > 0)
S_PlayActorSound(DUKE_UNDERWATER, act2);
ps[p].pos.Z = Owner->sector()->ceilingz + 7;
ps[p].PlayerNowPosition.Z = Owner->sector()->ceilingz + 7;
ps[p].backupz();
// this is actually below the precision óf the original Build coordinate system...
@ -1406,7 +1406,7 @@ void movetransports_d(void)
}
if (onfloorz && sectlotag == ST_2_UNDERWATER && ps[p].pos.Z < (sectp->ceilingz + 6))
if (onfloorz && sectlotag == ST_2_UNDERWATER && ps[p].PlayerNowPosition.Z < (sectp->ceilingz + 6))
{
k = 1;
// if( act2->spr.extra <= 0) break;
@ -1416,7 +1416,7 @@ void movetransports_d(void)
}
S_PlayActorSound(DUKE_GASP, act2);
ps[p].pos.Z = Owner->sector()->floorz - 7;
ps[p].PlayerNowPosition.Z = Owner->sector()->floorz - 7;
ps[p].backupz();
ps[p].jumping_toggle = 1;
@ -1425,8 +1425,8 @@ void movetransports_d(void)
if (k == 1)
{
ps[p].pos.X += Owner->spr.pos.X - act->spr.pos.X;
ps[p].pos.Y += Owner->spr.pos.Y - act->spr.pos.Y;
ps[p].PlayerNowPosition.X += Owner->spr.pos.X - act->spr.pos.X;
ps[p].PlayerNowPosition.Y += Owner->spr.pos.Y - act->spr.pos.Y;
ps[p].backupxy();
if (!Owner || Owner->GetOwner() != Owner)
@ -1434,7 +1434,7 @@ void movetransports_d(void)
ps[p].setCursector(Owner->sector());
ChangeActorSect(act2, Owner->sector());
SetActor(ps[p].GetActor(), ps[p].pos.plusZ(gs.playerheight));
SetActor(ps[p].GetActor(), ps[p].PlayerNowPosition.plusZ(gs.playerheight));
if ((krand() & 255) < 32)
spawn(act2, WATERSPLASH2);
@ -1667,7 +1667,7 @@ static void greenslime(DDukeActor *actor)
}
else if (xx < 64 && ps[p].quick_kick == 0)
{
auto ang = absangle(ps[p].angle.ang, (actor->spr.pos.XY() - ps[p].pos.XY()).Angle());
auto ang = absangle(ps[p].angle.ang, (actor->spr.pos.XY() - ps[p].PlayerNowPosition.XY()).Angle());
if (ang < DAngle22_5)
ps[p].quick_kick = 14;
}
@ -1723,7 +1723,7 @@ static void greenslime(DDukeActor *actor)
return;
}
actor->spr.pos.Z = ps[p].pos.Z + 8 + ps[p].pyoff - (actor->temp_data[2] + (ps[p].horizon.horiz.Tan() * 2048.)) * zinttoworld;
actor->spr.pos.Z = ps[p].PlayerNowPosition.Z + 8 + ps[p].pyoff - (actor->temp_data[2] + (ps[p].horizon.horiz.Tan() * 2048.)) * zinttoworld;
if (actor->temp_data[2] > 512)
actor->temp_data[2] -= 128;
@ -1737,7 +1737,7 @@ static void greenslime(DDukeActor *actor)
ps[p].restorexyz();
ps[p].angle.restore();
updatesector(ps[p].pos, &ps[p].cursector);
updatesector(ps[p].PlayerNowPosition, &ps[p].cursector);
DukeStatIterator it(STAT_ACTOR);
while (auto ac = it.Next())
@ -1772,7 +1772,7 @@ static void greenslime(DDukeActor *actor)
double add = (BobVal(actor->temp_data[1]) * 2) * REPEAT_SCALE;
actor->spr.scale = DVector2(0.3125 + add, 0.234375 + add);
actor->spr.pos.XY() = ps[p].pos.XY() + ps[p].angle.ang.ToVector() * 8;
actor->spr.pos.XY() = ps[p].PlayerNowPosition.XY() + ps[p].angle.ang.ToVector() * 8;
return;
}
@ -1934,7 +1934,7 @@ static void greenslime(DDukeActor *actor)
{
if (actor->vel.X < 2) actor->vel.X += 0.25;
actor->vel.X = 4 - BobVal(512 + actor->temp_data[1]) * 2;
actor->spr.angle += deltaangle(actor->spr.angle, (ps[p].pos.XY() - actor->spr.pos.XY()).Angle()) * 0.125;
actor->spr.angle += deltaangle(actor->spr.angle, (ps[p].PlayerNowPosition.XY() - actor->spr.pos.XY()).Angle()) * 0.125;
// TJR
}
@ -2260,7 +2260,7 @@ DETONATEB:
}
}
else if (actor->spr.picnum == HEAVYHBOMB && xx < 788 / 16. && actor->temp_data[0] > 7 && actor->vel.X == 0)
if (cansee(actor->spr.pos.plusZ(-8), actor->sector(), ps[p].pos, ps[p].cursector))
if (cansee(actor->spr.pos.plusZ(-8), actor->sector(), ps[p].PlayerNowPosition, ps[p].cursector))
if (ps[p].ammo_amount[HANDBOMB_WEAPON] < gs.max_ammo_amount[HANDBOMB_WEAPON])
{
if (ud.coop >= 1 && Owner == actor)
@ -2786,7 +2786,7 @@ static void handle_se28(DDukeActor* actor)
}
else if (actor->temp_data[2] > (actor->temp_data[1] >> 3) && actor->temp_data[2] < (actor->temp_data[1] >> 2))
{
int j = !!cansee(actor->spr.pos, actor->sector(), ps[screenpeek].pos, ps[screenpeek].cursector);
int j = !!cansee(actor->spr.pos, actor->sector(), ps[screenpeek].PlayerNowPosition, ps[screenpeek].cursector);
if (rnd(192) && (actor->temp_data[2] & 1))
{
@ -3035,7 +3035,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
{
if (ps[playernum].newOwner != nullptr)
goalang = (ps[playernum].opos.XY() - actor->spr.pos.XY()).Angle();
else goalang = (ps[playernum].pos.XY() - actor->spr.pos.XY()).Angle();
else goalang = (ps[playernum].PlayerNowPosition.XY() - actor->spr.pos.XY()).Angle();
angdif = deltaangle(actor->spr.angle, goalang) * 0.25;
if (angdif > -DAngle22_5 / 16 && angdif < nullAngle) angdif = nullAngle;
actor->spr.angle += angdif;
@ -3048,7 +3048,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
{
if (ps[playernum].newOwner != nullptr)
goalang = (ps[playernum].opos.XY() - actor->spr.pos.XY()).Angle();
else goalang = (ps[playernum].pos.XY() - actor->spr.pos.XY()).Angle();
else goalang = (ps[playernum].PlayerNowPosition.XY() - 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;
}
@ -3062,7 +3062,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
if (a & face_player_smart)
{
DVector2 newpos = ps[playernum].pos.XY() + (ps[playernum].vel.XY() * (4. / 3.));
DVector2 newpos = ps[playernum].PlayerNowPosition.XY() + (ps[playernum].vel.XY() * (4. / 3.));
goalang = (newpos - actor->spr.pos.XY()).Angle();
angdif = deltaangle(actor->spr.angle, goalang) * 0.25;
if (angdif > -DAngle22_5/16 && angdif < nullAngle) angdif = nullAngle;
@ -3173,7 +3173,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
{
daxvel = -(1024 - xvel) * maptoworld;
angdif = (ps[playernum].pos.XY() - actor->spr.pos.XY()).Angle();
angdif = (ps[playernum].PlayerNowPosition.XY() - actor->spr.pos.XY()).Angle();
if (xvel < 512)
{

View file

@ -1233,7 +1233,7 @@ void movetransports_r(void)
ps[p].transporter_hold = 13;
}
ps[p].pos = Owner->spr.pos.plusZ(-gs.playerheight + 4);
ps[p].PlayerNowPosition = Owner->spr.pos.plusZ(-gs.playerheight + 4);
ps[p].backupxyz();
ps[p].setbobpos();
@ -1248,17 +1248,17 @@ void movetransports_r(void)
}
else break;
if (onfloorz == 0 && fabs(act->spr.pos.Z - ps[p].pos.Z) < 24)
if (onfloorz == 0 && fabs(act->spr.pos.Z - ps[p].PlayerNowPosition.Z) < 24)
if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && PlayerInput(p, SB_JUMP)) ||
(ps[p].jetpack_on && PlayerInput(p, SB_CROUCH)))
{
ps[p].pos.X += Owner->spr.pos.X - act->spr.pos.X;
ps[p].pos.Y += Owner->spr.pos.Y - act->spr.pos.Y;
ps[p].PlayerNowPosition.X += Owner->spr.pos.X - act->spr.pos.X;
ps[p].PlayerNowPosition.Y += Owner->spr.pos.Y - act->spr.pos.Y;
ps[p].backupxy();
if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11))
ps[p].pos.Z = Owner->spr.pos.Z - 24;
else ps[p].pos.Z = Owner->spr.pos.Z + 24;
ps[p].PlayerNowPosition.Z = Owner->spr.pos.Z - 24;
else ps[p].PlayerNowPosition.Z = Owner->spr.pos.Z + 24;
ps[p].backupz();
ChangeActorSect(act2, Owner->sector());
@ -1271,23 +1271,23 @@ void movetransports_r(void)
if (isRRRA())
{
if (onfloorz && sectlotag == 160 && ps[p].pos.Z > sectp->floorz - 48)
if (onfloorz && sectlotag == 160 && ps[p].PlayerNowPosition.Z > sectp->floorz - 48)
{
k = 2;
ps[p].pos.Z = Owner->sector()->ceilingz + 7;
ps[p].PlayerNowPosition.Z = Owner->sector()->ceilingz + 7;
ps[p].backupz();
}
if (onfloorz && sectlotag == 161 && ps[p].pos.Z < sectp->ceilingz + 6)
if (onfloorz && sectlotag == 161 && ps[p].PlayerNowPosition.Z < sectp->ceilingz + 6)
{
k = 2;
if (ps[p].GetActor()->spr.extra <= 0) break;
ps[p].pos.Z = Owner->sector()->floorz - 49;
ps[p].PlayerNowPosition.Z = Owner->sector()->floorz - 49;
ps[p].backupz();
}
}
if ((onfloorz && sectlotag == ST_1_ABOVE_WATER && ps[p].pos.Z > sectp->floorz - 6) ||
if ((onfloorz && sectlotag == ST_1_ABOVE_WATER && ps[p].PlayerNowPosition.Z > sectp->floorz - 6) ||
(onfloorz && sectlotag == ST_1_ABOVE_WATER && ps[p].OnMotorcycle))
{
if (ps[p].OnBoat) break;
@ -1297,13 +1297,13 @@ void movetransports_r(void)
FX_StopAllSounds();
}
S_PlayActorSound(DUKE_UNDERWATER, ps[p].GetActor());
ps[p].pos.Z = Owner->sector()->ceilingz + 7;
ps[p].PlayerNowPosition.Z = Owner->sector()->ceilingz + 7;
ps[p].backupz();
if (ps[p].OnMotorcycle)
ps[p].moto_underwater = 1;
}
if (onfloorz && sectlotag == ST_2_UNDERWATER && ps[p].pos.Z < sectp->ceilingz + 6)
if (onfloorz && sectlotag == ST_2_UNDERWATER && ps[p].PlayerNowPosition.Z < sectp->ceilingz + 6)
{
k = 1;
if (ps[p].GetActor()->spr.extra <= 0) break;
@ -1313,14 +1313,14 @@ void movetransports_r(void)
}
S_PlayActorSound(DUKE_GASP, ps[p].GetActor());
ps[p].pos.Z = Owner->sector()->floorz - 7;
ps[p].PlayerNowPosition.Z = Owner->sector()->floorz - 7;
ps[p].backupz();
}
if (k == 1)
{
ps[p].pos.X += Owner->spr.pos.X - act->spr.pos.X;
ps[p].pos.Y += Owner->spr.pos.Y - act->spr.pos.Y;
ps[p].PlayerNowPosition.X += Owner->spr.pos.X - act->spr.pos.X;
ps[p].PlayerNowPosition.Y += Owner->spr.pos.Y - act->spr.pos.Y;
ps[p].backupxy();
if (Owner->GetOwner() != Owner)
@ -1334,8 +1334,8 @@ void movetransports_r(void)
}
else if (isRRRA() && k == 2)
{
ps[p].opos.X = ps[p].pos.X += Owner->spr.pos.X - act->spr.pos.X;
ps[p].opos.Y = ps[p].pos.Y += Owner->spr.pos.Y - act->spr.pos.Y;
ps[p].opos.X = ps[p].PlayerNowPosition.X += Owner->spr.pos.X - act->spr.pos.X;
ps[p].opos.Y = ps[p].PlayerNowPosition.Y += Owner->spr.pos.Y - act->spr.pos.Y;
ps[p].backupxy();
if (Owner->GetOwner() != Owner)
@ -2049,7 +2049,7 @@ void rr_specialstats()
if (act2->spr.picnum == RRTELEPORTDEST)
{
ps[p].angle.ang = act2->spr.angle;
ps[p].pos = act2->spr.pos.plusZ(-36);
ps[p].PlayerNowPosition = act2->spr.pos.plusZ(-36);
ps[p].backupxyz();
ps[p].setbobpos();
auto pact = ps[p].GetActor();
@ -2251,7 +2251,7 @@ DETONATEB:
}
}
else if (actor->spr.picnum == DYNAMITE && xx < 788 / 16. && actor->temp_data[0] > 7 && actor->vel.X == 0)
if (cansee(actor->spr.pos.plusZ(-8), actor->sector(), ps[p].pos, ps[p].cursector))
if (cansee(actor->spr.pos.plusZ(-8), actor->sector(), ps[p].PlayerNowPosition, ps[p].cursector))
if (ps[p].ammo_amount[DYNAMITE_WEAPON] < gs.max_ammo_amount[DYNAMITE_WEAPON])
if (actor->spr.pal == 0)
{
@ -3213,7 +3213,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
{
if (ps[pnum].newOwner != nullptr)
goalang = (ps[pnum].opos.XY() - actor->spr.pos.XY()).Angle();
else goalang = (ps[pnum].pos.XY() - actor->spr.pos.XY()).Angle();
else goalang = (ps[pnum].PlayerNowPosition.XY() - actor->spr.pos.XY()).Angle();
angdif = deltaangle(actor->spr.angle, goalang) * 0.25;
if (angdif > -DAngle22_5 / 16 && angdif < nullAngle) angdif = nullAngle;
actor->spr.angle += angdif;
@ -3226,7 +3226,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
{
if (ps[pnum].newOwner != nullptr)
goalang = (ps[pnum].opos.XY() - actor->spr.pos.XY()).Angle();
else goalang = (ps[pnum].pos.XY() - actor->spr.pos.XY()).Angle();
else goalang = (ps[pnum].PlayerNowPosition.XY() - 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;
}
@ -3237,7 +3237,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
{
if (ps[pnum].newOwner != nullptr)
goalang = ((ps[pnum].opos.XY() - actor->spr.pos.XY()).Angle() + DAngle180);
else goalang = ((ps[pnum].pos.XY() - actor->spr.pos.XY()).Angle() + DAngle180);
else goalang = ((ps[pnum].PlayerNowPosition.XY() - 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;
}
@ -3296,7 +3296,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
if (a & face_player_smart)
{
DVector2 newpos = ps[pnum].pos.XY() + (ps[pnum].vel.XY() * (4. / 3.));
DVector2 newpos = ps[pnum].PlayerNowPosition.XY() + (ps[pnum].vel.XY() * (4. / 3.));
goalang = (newpos - actor->spr.pos.XY()).Angle();
angdif = deltaangle(actor->spr.angle, goalang) * 0.25;
if (angdif > -DAngle22_5 / 16 && angdif < nullAngle) angdif = nullAngle;
@ -3396,7 +3396,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
{
daxvel = -(1024 - xvel) * maptoworld;
angdif = (ps[pnum].pos.XY() - actor->spr.pos.XY()).Angle();
angdif = (ps[pnum].PlayerNowPosition.XY() - actor->spr.pos.XY()).Angle();
if (xvel < 512)
{

View file

@ -165,7 +165,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
auto pp = &ps[h->PlayerIndex()];
if (h->spr.statnum != STAT_ACTOR && h->spr.picnum == APLAYER && pp->newOwner == nullptr && h->GetOwner())
{
t->pos = interpolatedvalue(pp->opos, pp->pos, interpfrac).plusZ(gs.playerheight);
t->pos = interpolatedvalue(pp->opos, pp->PlayerNowPosition, interpfrac).plusZ(gs.playerheight);
}
else if (!actorflag(h, SFLAG_NOINTERPOLATE))
{
@ -217,7 +217,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
case FORCESPHERE:
if (t->statnum == STAT_MISC && OwnerAc)
{
auto sqa = ( OwnerAc->spr.pos.XY() - ps[screenpeek].pos.XY()).Angle();
auto sqa = ( OwnerAc->spr.pos.XY() - ps[screenpeek].PlayerNowPosition.XY()).Angle();
auto sqb = (OwnerAc->spr.pos.XY() - t->pos.XY()).Angle();
if (absangle(sqa, sqb) > DAngle90)
@ -345,7 +345,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
case DEVISTATOR_WEAPON: newtspr->picnum = DEVISTATORSPRITE; break;
}
if (h->GetOwner()) newtspr->pos.Z = ps[p].pos.Z - 12;
if (h->GetOwner()) newtspr->pos.Z = ps[p].PlayerNowPosition.Z - 12;
else newtspr->pos.Z = h->spr.pos.Z - 51;
if (ps[p].curr_weapon == HANDBOMB_WEAPON)
{
@ -541,7 +541,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
floorz = h->floorz;
if (h->spr.pos.Z - floorz < 8 && ps[screenpeek].pos.Z < floorz)
if (h->spr.pos.Z - floorz < 8 && ps[screenpeek].PlayerNowPosition.Z < floorz)
{
auto shadowspr = tsprites.newTSprite();
*shadowspr = *t;
@ -566,7 +566,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
else
{
// Alter the shadow's position so that it appears behind the sprite itself.
auto look = (shadowspr->pos.XY() - ps[screenpeek].pos.XY()).Angle();
auto look = (shadowspr->pos.XY() - ps[screenpeek].PlayerNowPosition.XY()).Angle();
shadowspr->pos.XY() += look.ToVector() * 2;
}
}

View file

@ -144,7 +144,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
auto pp = &ps[h->PlayerIndex()];
if (h->spr.statnum != STAT_ACTOR && h->spr.picnum == APLAYER && pp->newOwner == nullptr && h->GetOwner())
{
t->pos = interpolatedvalue(pp->opos, pp->pos, interpfrac).plusZ(gs.playerheight);
t->pos = interpolatedvalue(pp->opos, pp->PlayerNowPosition, interpfrac).plusZ(gs.playerheight);
h->spr.scale = DVector2(0.375, 0.265625);
}
else if (!actorflag(h, SFLAG_NOINTERPOLATE))
@ -209,7 +209,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
case FORCESPHERE:
if (t->statnum == STAT_MISC && OwnerAc)
{
auto sqa = (OwnerAc->spr.pos.XY() - ps[screenpeek].pos.XY()).Angle();
auto sqa = (OwnerAc->spr.pos.XY() - ps[screenpeek].PlayerNowPosition.XY()).Angle();
auto sqb = (OwnerAc->spr.pos.XY() - t->pos.XY()).Angle();
if (absangle(sqa, sqb) > DAngle90)
@ -397,7 +397,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
case TIT_WEAPON: newtspr->picnum = TITSPRITE; break;
}
if (h->GetOwner()) newtspr->pos.Z = ps[p].pos.Z - 12;
if (h->GetOwner()) newtspr->pos.Z = ps[p].PlayerNowPosition.Z - 12;
else newtspr->pos.Z = h->spr.pos.Z - 51;
if (ps[p].curr_weapon == HANDBOMB_WEAPON)
{
@ -705,7 +705,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
else
floorz = h->floorz;
if (h->spr.pos.Z - floorz < 8 && ps[screenpeek].pos.Z < floorz)
if (h->spr.pos.Z - floorz < 8 && ps[screenpeek].PlayerNowPosition.Z < floorz)
{
auto shadowspr = tsprites.newTSprite();
*shadowspr = *t;
@ -730,7 +730,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
else
{
// Alter the shadow's position so that it appears behind the sprite itself.
auto look = (shadowspr->pos.XY() - ps[screenpeek].pos.XY()).Angle();
auto look = (shadowspr->pos.XY() - ps[screenpeek].PlayerNowPosition.XY()).Angle();
shadowspr->pos.XY() += look.ToVector() * 2;
}
}

View file

@ -115,7 +115,7 @@ void GameInterface::WarpToCoords(double x, double y, double z, DAngle ang)
{
player_struct* p = &ps[myconnectindex];
p->pos = DVector3(x, y, z);
p->PlayerNowPosition = DVector3(x, y, z);
p->backupxyz();
if (ang != DAngle::fromDeg(INT_MIN))

View file

@ -57,7 +57,7 @@ BEGIN_DUKE_NS
std::pair<DVector3, DAngle> GameInterface::GetCoordinates()
{
return std::make_pair(ps[screenpeek].pos, ps[screenpeek].angle.ang);
return std::make_pair(ps[screenpeek].PlayerNowPosition, ps[screenpeek].angle.ang);
}
GameStats GameInterface::getStats()
@ -271,7 +271,7 @@ void drawoverlays(double interpfrac)
}
else
{
cposxy = interpolatedvalue(pp->opos, pp->pos, interpfrac).XY();
cposxy = interpolatedvalue(pp->opos, pp->PlayerNowPosition, interpfrac).XY();
cang = !SyncInput() ? pp->angle.ang : interpolatedvalue(pp->angle.oang, pp->angle.ang, interpfrac);
}
}
@ -431,7 +431,7 @@ bool GameInterface::DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos,
auto& pp = ps[p];
auto act = pp.GetActor();
int i = TILE_APLAYERTOP + (act->vel.X > 1 && pp.on_ground ? (PlayClock >> 4) & 3 : 0);
double j = clamp(czoom * act->spr.scale.Y + abs(pp.truefz - pp.pos.Z) * REPEAT_SCALE, 0.333, 2.);
double j = clamp(czoom * act->spr.scale.Y + abs(pp.truefz - pp.PlayerNowPosition.Z) * REPEAT_SCALE, 0.333, 2.);
auto const vec = OutAutomapVector(mxy - cpos, cangvect, czoom, xydim);
auto const daang = -((!SyncInput() ? act->spr.angle : act->interpolatedangle(interpfrac)) - cang).Normalized360().Degrees();

View file

@ -326,15 +326,15 @@ 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].pos.X * (1/maptoworld)), sActor, sPlayer);
if (!bSet) SetGameVarID(lVar2, int(ps[iPlayer].PlayerNowPosition.X * (1/maptoworld)), sActor, sPlayer);
break;
case PLAYER_POSY:
if (!bSet) SetGameVarID(lVar2, int(ps[iPlayer].pos.Y * (1 / maptoworld)), sActor, sPlayer);
if (!bSet) SetGameVarID(lVar2, int(ps[iPlayer].PlayerNowPosition.Y * (1 / maptoworld)), sActor, sPlayer);
break;
case PLAYER_POSZ:
if (!bSet) SetGameVarID(lVar2, int(ps[iPlayer].pos.Z * (1 / zmaptoworld)), sActor, sPlayer);
if (!bSet) SetGameVarID(lVar2, int(ps[iPlayer].PlayerNowPosition.Z * (1 / zmaptoworld)), sActor, sPlayer);
break;
case PLAYER_HORIZ:
@ -1517,12 +1517,12 @@ int ParseState::parse(void)
parseifelse(ifcanshoottarget(g_ac, g_p, g_x));
break;
case concmd_ifcanseetarget:
j = cansee(g_ac->spr.pos.plusZ(krand() & 41), g_ac->sector(), ps[g_p].pos, ps[g_p].GetActor()->sector());
j = cansee(g_ac->spr.pos.plusZ(krand() & 41), g_ac->sector(), ps[g_p].PlayerNowPosition, ps[g_p].GetActor()->sector());
parseifelse(j);
if (j) g_ac->timetosleep = SLEEPTIME;
break;
case concmd_ifnocover:
j = cansee(g_ac->spr.pos, g_ac->sector(), ps[g_p].pos, ps[g_p].GetActor()->sector());
j = cansee(g_ac->spr.pos, g_ac->sector(), ps[g_p].PlayerNowPosition, ps[g_p].GetActor()->sector());
parseifelse(j);
if (j) g_ac->timetosleep = SLEEPTIME;
break;
@ -1980,7 +1980,7 @@ int ParseState::parse(void)
break;
case concmd_larrybird:
insptr++;
ps[g_p].GetActor()->spr.pos.Z = ps[g_p].pos.Z = ps[g_p].GetActor()->sector()->ceilingz;
ps[g_p].GetActor()->spr.pos.Z = ps[g_p].PlayerNowPosition.Z = ps[g_p].GetActor()->sector()->ceilingz;
break;
case concmd_destroyit:
insptr++;
@ -2047,7 +2047,7 @@ int ParseState::parse(void)
ps[g_p].newOwner = nullptr;
ps[g_p].restorexyz();
ps[g_p].angle.restore();
updatesector(ps[g_p].pos, &ps[g_p].cursector);
updatesector(ps[g_p].PlayerNowPosition, &ps[g_p].cursector);
DukeStatIterator it(STAT_ACTOR);
while (auto actj = it.Next())
@ -2230,12 +2230,12 @@ int ParseState::parse(void)
{
// I am not convinced this is even remotely smart to be executed from here..
pickrandomspot(g_p);
g_ac->spr.pos = ps[g_p].pos;
g_ac->spr.pos = ps[g_p].PlayerNowPosition;
ps[g_p].backupxyz();
ps[g_p].setbobpos();
g_ac->backuppos();
updatesector(ps[g_p].pos, &ps[g_p].cursector);
SetActor(ps[g_p].GetActor(), ps[g_p].pos.plusZ(gs.playerheight ));
updatesector(ps[g_p].PlayerNowPosition, &ps[g_p].cursector);
SetActor(ps[g_p].GetActor(), ps[g_p].PlayerNowPosition.plusZ(gs.playerheight ));
g_ac->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
g_ac->spr.shade = -12;
@ -2408,7 +2408,7 @@ int ParseState::parse(void)
j = 1;
else if( (l& prunning) && vel >= 0.5 && PlayerInput(g_p, SB_RUN) )
j = 1;
else if( (l& phigher) && ps[g_p].pos.Z < g_ac->spr.pos.Z - 48)
else if( (l& phigher) && ps[g_p].PlayerNowPosition.Z < g_ac->spr.pos.Z - 48)
j = 1;
else if( (l& pwalkingback) && vel <= -0.5 && !(PlayerInput(g_p, SB_RUN)) )
j = 1;
@ -2432,9 +2432,9 @@ int ParseState::parse(void)
{
DAngle ang;
if (g_ac->isPlayer() && ud.multimode > 1)
ang = absangle(ps[otherp].angle.ang, (ps[g_p].pos.XY() - ps[otherp].pos.XY()).Angle());
ang = absangle(ps[otherp].angle.ang, (ps[g_p].PlayerNowPosition.XY() - ps[otherp].PlayerNowPosition.XY()).Angle());
else
ang = absangle(ps[g_p].angle.ang, (g_ac->spr.pos.XY() - ps[g_p].pos.XY()).Angle());
ang = absangle(ps[g_p].angle.ang, (g_ac->spr.pos.XY() - ps[g_p].PlayerNowPosition.XY()).Angle());
j = ang < DAngle22_5;
}
@ -2793,7 +2793,7 @@ int ParseState::parse(void)
case concmd_pstomp:
insptr++;
if( ps[g_p].knee_incs == 0 && ps[g_p].GetActor()->spr.scale.X >= (isRR()? 0.140625 : 0.625) )
if (cansee(g_ac->spr.pos.plusZ(-4), g_ac->sector(), ps[g_p].pos.plusZ(16), ps[g_p].GetActor()->sector()))
if (cansee(g_ac->spr.pos.plusZ(-4), g_ac->sector(), ps[g_p].PlayerNowPosition.plusZ(16), ps[g_p].GetActor()->sector()))
{
ps[g_p].knee_incs = 1;
if(ps[g_p].weapon_pos == 0)

View file

@ -211,7 +211,7 @@ inline bool playrunning()
inline void doslopetilting(player_struct* p, double const scaleAdjust = 1)
{
bool const canslopetilt = p->on_ground && p->insector() && p->cursector->lotag != ST_2_UNDERWATER && (p->cursector->floorstat & CSTAT_SECTOR_SLOPE);
p->horizon.calcviewpitch(p->pos.XY(), p->angle.ang, p->aim_mode == 0, canslopetilt, p->cursector, scaleAdjust);
p->horizon.calcviewpitch(p->PlayerNowPosition.XY(), p->angle.ang, p->aim_mode == 0, canslopetilt, p->cursector, scaleAdjust);
}
//---------------------------------------------------------------------------

View file

@ -284,7 +284,7 @@ void hud_input(int plnum)
p->inven_icon = 3;
auto pactor =
CreateActor(p->cursector, p->pos.plusZ(30), TILE_APLAYER, -64, DVector2(0, 0), p->angle.ang, 0., 0., nullptr, 10);
CreateActor(p->cursector, p->PlayerNowPosition.plusZ(30), TILE_APLAYER, -64, DVector2(0, 0), p->angle.ang, 0., 0., nullptr, 10);
pactor->temp_data[3] = pactor->temp_data[4] = 0;
p->holoduke_on = pactor;
pactor->spr.yint = plnum;

View file

@ -35,7 +35,7 @@ int madenoise(int snum)
player_struct *p;
p = &ps[snum];
p->donoise = 1;
p->noise = p->pos.XY();
p->noise = p->PlayerNowPosition.XY();
return 1;
}

View file

@ -211,10 +211,10 @@ double hitawall(player_struct* p, walltype** hitw)
{
HitInfo hit{};
hitscan(p->pos, p->cursector, DVector3(p->angle.ang.ToVector() * 1024, 0), hit, CLIPMASK0);
hitscan(p->PlayerNowPosition, p->cursector, DVector3(p->angle.ang.ToVector() * 1024, 0), hit, CLIPMASK0);
if (hitw) *hitw = hit.hitWall;
return (hit.hitpos.XY() - p->pos.XY()).Length();
return (hit.hitpos.XY() - p->PlayerNowPosition.XY()).Length();
}
@ -248,7 +248,7 @@ DDukeActor* aim(DDukeActor* actor, int abase)
setFreeAimVelocity(vel, zvel, plr->horizon.sum(), 16.);
HitInfo hit{};
hitscan(plr->pos.plusZ(4), actor->sector(), DVector3(actor->spr.angle.ToVector() * vel, zvel), hit, CLIPMASK1);
hitscan(plr->PlayerNowPosition.plusZ(4), actor->sector(), DVector3(actor->spr.angle.ToVector() * vel, zvel), hit, CLIPMASK1);
if (hit.actor() != nullptr)
{
@ -378,7 +378,7 @@ void dokneeattack(int snum, const std::initializer_list<int> & respawnlist)
{
p->oknee_incs = p->knee_incs;
p->knee_incs++;
p->horizon.addadjustment(deltaangle(p->horizon.horiz, (p->pos - p->actorsqu->spr.pos).Pitch() * 1.1875));
p->horizon.addadjustment(deltaangle(p->horizon.horiz, (p->PlayerNowPosition - p->actorsqu->spr.pos).Pitch() * 1.1875));
p->sync.actions |= SB_CENTERVIEW;
if (p->knee_incs > 15)
{
@ -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->pos.X) < 24)
if (abs(act->spr.pos.Y - p->pos.Y) < 24)
if (abs(act->spr.pos.X - p->PlayerNowPosition.X) < 24)
if (abs(act->spr.pos.Y - p->PlayerNowPosition.Y) < 24)
{
j = 1;
break;
@ -560,7 +560,7 @@ void playerisdead(int snum, int psectlotag, double floorz, double ceilingz)
if (actor->spr.pal != 1)
{
SetPlayerPal(p, PalEntry(63, 63, 0, 0));
p->pos.Z -= 16;
p->PlayerNowPosition.Z -= 16;
actor->spr.pos.Z -= 16;
}
#if 0
@ -608,8 +608,8 @@ void playerisdead(int snum, int psectlotag, double floorz, double ceilingz)
{
if (p->on_warping_sector == 0)
{
if (abs(p->pos.Z - floorz) > (gs.playerheight * 0.5))
p->pos.Z += 348/ 256.;
if (abs(p->PlayerNowPosition.Z - floorz) > (gs.playerheight * 0.5))
p->PlayerNowPosition.Z += 348/ 256.;
}
else
{
@ -618,19 +618,19 @@ void playerisdead(int snum, int psectlotag, double floorz, double ceilingz)
}
Collision coll;
clipmove(p->pos, &p->cursector, DVector2( 0, 0), 10.25, 4., 4., CLIPMASK0, coll);
clipmove(p->PlayerNowPosition, &p->cursector, DVector2( 0, 0), 10.25, 4., 4., CLIPMASK0, coll);
}
backupplayer(p);
p->horizon.horizoff = p->horizon.horiz = nullAngle;
updatesector(p->pos, &p->cursector);
updatesector(p->PlayerNowPosition, &p->cursector);
pushmove(p->pos, &p->cursector, 8, 4, 20, CLIPMASK0);
pushmove(p->PlayerNowPosition, &p->cursector, 8, 4, 20, CLIPMASK0);
if (floorz > ceilingz + 16 && actor->spr.pal != 1)
p->angle.rotscrnang = DAngle::fromBuild(p->dead_flag + ((floorz + p->pos.Z) * 2));
p->angle.rotscrnang = DAngle::fromBuild(p->dead_flag + ((floorz + p->PlayerNowPosition.Z) * 2));
p->on_warping_sector = 0;
@ -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->pos.Z += 8 + 3;
p->PlayerNowPosition.Z += 8 + 3;
p->crack_time = CRACK_TIME;
}
}
@ -765,17 +765,17 @@ void player_struct::backuppos(bool noclipping)
{
if (!noclipping)
{
opos.X = pos.X;
opos.Y = pos.Y;
opos.X = PlayerNowPosition.X;
opos.Y = PlayerNowPosition.Y;
}
else
{
pos.X = opos.X;
pos.Y = opos.Y;
PlayerNowPosition.X = opos.X;
PlayerNowPosition.Y = opos.Y;
}
opos.Z = pos.Z;
bobpos = pos.XY();
opos.Z = PlayerNowPosition.Z;
bobpos = PlayerNowPosition.XY();
opyoff = pyoff;
}

View file

@ -178,7 +178,7 @@ static void shootflamethrowerflame(DDukeActor* actor, int p, DVector3 spos, DAng
setFreeAimVelocity(vel, zvel, ps[p].horizon.sum(), 40.5);
// WTF???
DAngle myang = DAngle90 - (DAngle180 - abs(abs((spos.XY() - ps[p].pos.XY()).Angle() - sang) - DAngle180));
DAngle myang = DAngle90 - (DAngle180 - abs(abs((spos.XY() - ps[p].PlayerNowPosition.XY()).Angle() - sang) - DAngle180));
if (ps[p].GetActor()->vel.X != 0)
vel = ((myang / DAngle90) * ps[p].GetActor()->vel.X) + 25;
if (actor->sector()->lotag == 2 && (krand() % 5) == 0)
@ -384,7 +384,7 @@ static void shootweapon(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int
int j = findplayer(actor, &x);
pos.Z -= 4;
double dist = (ps[j].GetActor()->spr.pos.XY() - actor->spr.pos.XY()).Length();
zvel = ((ps[j].pos.Z - pos.Z) * 16) / dist;
zvel = ((ps[j].PlayerNowPosition.Z - pos.Z) * 16) / dist;
zvel += 0.5 - krandf(1);
if (actor->spr.picnum != BOSS1)
{
@ -392,7 +392,7 @@ static void shootweapon(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int
}
else
{
ang = (ps[j].pos - pos).Angle() + DAngle22_5 / 2 - randomAngle(22.5);
ang = (ps[j].PlayerNowPosition - pos).Angle() + DAngle22_5 / 2 - randomAngle(22.5);
}
}
@ -933,7 +933,7 @@ static void shootgrowspark(DDukeActor* actor, int p, DVector3 pos, DAngle ang)
int j = findplayer(actor, &x);
pos.Z -= 4;
double dist = (ps[j].GetActor()->spr.pos.XY() - actor->spr.pos.XY()).Length();
zvel = ((ps[j].pos.Z - pos.Z) * 16) / dist;
zvel = ((ps[j].PlayerNowPosition.Z - pos.Z) * 16) / dist;
zvel += 0.5 - krandf(1);
ang += DAngle22_5 / 4 - randomAngle(22.5 / 2);
}
@ -1022,7 +1022,7 @@ static void shootshrinker(DDukeActor* actor, int p, const DVector3& pos, DAngle
double x;
int j = findplayer(actor, &x);
double dist = (ps[j].GetActor()->spr.pos.XY() - actor->spr.pos.XY()).Length();
zvel = ((ps[j].pos.Z - pos.Z) * 32) / dist;
zvel = ((ps[j].PlayerNowPosition.Z - pos.Z) * 32) / dist;
}
else zvel = 0;
@ -1070,7 +1070,7 @@ void shoot_d(DDukeActor* actor, int atwith)
if (actor->isPlayer())
{
spos = ps[p].pos.plusZ(ps[p].pyoff + 4);
spos = ps[p].PlayerNowPosition.plusZ(ps[p].pyoff + 4);
sang = ps[p].angle.ang;
ps[p].crack_time = CRACK_TIME;
@ -1689,7 +1689,7 @@ static void operateJetpack(int snum, ESyncBits actions, int psectlotag, double f
if (p->jetpack_on < 11)
{
p->jetpack_on++;
p->pos.Z -= (p->jetpack_on * 0.5); //Goin up
p->PlayerNowPosition.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->pos.Z -= dist;
p->PlayerNowPosition.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->pos.Z += dist;
p->PlayerNowPosition.Z += dist;
p->crack_time = CRACK_TIME;
}
}
@ -1729,10 +1729,10 @@ static void operateJetpack(int snum, ESyncBits actions, int psectlotag, double f
if (psectlotag != 2 && p->scuba_on == 1)
p->scuba_on = 0;
if (p->pos.Z > floorz - k)
p->pos.Z += ((floorz - k) - p->pos.Z) * 0.5;
if (p->pos.Z < pact->ceilingz + 18)
p->pos.Z = pact->ceilingz + 18;
if (p->PlayerNowPosition.Z > floorz - k)
p->PlayerNowPosition.Z += ((floorz - k) - p->PlayerNowPosition.Z) * 0.5;
if (p->PlayerNowPosition.Z < pact->ceilingz + 18)
p->PlayerNowPosition.Z = pact->ceilingz + 18;
}
@ -1786,12 +1786,12 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
footprints(snum);
}
if (p->pos.Z < floorz - i) //falling
if (p->PlayerNowPosition.Z < floorz - i) //falling
{
// not jumping or crouching
if ((actions & (SB_JUMP|SB_CROUCH)) == 0 && p->on_ground && (psect->floorstat & CSTAT_SECTOR_SLOPE) && p->pos.Z >= (floorz - i - 16))
p->pos.Z = floorz - i;
if ((actions & (SB_JUMP|SB_CROUCH)) == 0 && p->on_ground && (psect->floorstat & CSTAT_SECTOR_SLOPE) && p->PlayerNowPosition.Z >= (floorz - i - 16))
p->PlayerNowPosition.Z = floorz - i;
else
{
p->on_ground = 0;
@ -1804,7 +1804,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
S_PlayActorSound(DUKE_SCREAM, pact);
}
if (p->pos.Z + p->vel.Z >= floorz - i) // hit the ground
if (p->PlayerNowPosition.Z + p->vel.Z >= floorz - i) // hit the ground
{
S_StopSound(DUKE_SCREAM, pact);
if (!p->insector() || p->cursector->lotag != 1)
@ -1848,18 +1848,18 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
{
//Smooth on the ground
double k = (floorz - i - p->pos.Z) * 0.5;
double k = (floorz - i - p->PlayerNowPosition.Z) * 0.5;
if (abs(k) < 1) k = 0;
p->pos.Z += k;
p->PlayerNowPosition.Z += k;
p->vel.Z -= 3;
if (p->vel.Z < 0) p->vel.Z = 0;
}
else if (p->jumping_counter == 0)
{
p->pos.Z += ((floorz - i * 0.5) - p->pos.Z) * 0.5; //Smooth on the water
if (p->on_warping_sector == 0 && p->pos.Z > floorz - 16)
p->PlayerNowPosition.Z += ((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->pos.Z = floorz - 16;
p->PlayerNowPosition.Z = floorz - 16;
p->vel.Z *= 0.5;
}
}
@ -1910,15 +1910,15 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
}
}
p->pos.Z += p->vel.Z ;
p->PlayerNowPosition.Z += p->vel.Z ;
if (p->pos.Z < ceilingz + 4)
if (p->PlayerNowPosition.Z < ceilingz + 4)
{
p->jumping_counter = 0;
if (p->vel.Z < 0)
p->vel.X = p->vel.Y = 0;
p->vel.Z = 0.5;
p->pos.Z = ceilingz + 4;
p->PlayerNowPosition.Z = ceilingz + 4;
}
}
@ -1977,14 +1977,14 @@ static void underwater(int snum, ESyncBits actions, double floorz, double ceilin
if (p->vel.Z > 8)
p->vel.Z *= 0.5;
p->pos.Z += p->vel.Z ;
p->PlayerNowPosition.Z += p->vel.Z ;
if (p->pos.Z > floorz - 15)
p->pos.Z += (((floorz - 15) - p->pos.Z) * 0.5);
if (p->PlayerNowPosition.Z > floorz - 15)
p->PlayerNowPosition.Z += (((floorz - 15) - p->PlayerNowPosition.Z) * 0.5);
if (p->pos.Z < ceilingz + 4)
if (p->PlayerNowPosition.Z < ceilingz + 4)
{
p->pos.Z = ceilingz + 4;
p->PlayerNowPosition.Z = ceilingz + 4;
p->vel.Z = 0;
}
@ -1995,7 +1995,7 @@ static void underwater(int snum, ESyncBits actions, double floorz, double ceilin
{
j->spr.pos += (p->angle.ang.ToVector() + DVector2(4 - (global_random & 8), 4 - (global_random & 8))) * 16;
j->spr.scale = DVector2(0.046875, 0.3125);
j->spr.pos.Z = p->pos.Z + 8;
j->spr.pos.Z = p->PlayerNowPosition.Z + 8;
}
}
}
@ -2013,7 +2013,7 @@ int operateTripbomb(int snum)
double vel = 1024, zvel = 0;
setFreeAimVelocity(vel, zvel, p->horizon.sum(), 16.);
hitscan(p->pos, p->cursector, DVector3(p->angle.ang.ToVector() * vel, zvel), hit, CLIPMASK1);
hitscan(p->PlayerNowPosition, p->cursector, DVector3(p->angle.ang.ToVector() * vel, zvel), hit, CLIPMASK1);
if (hit.hitSector == nullptr || hit.actor())
return 0;
@ -2040,10 +2040,10 @@ int operateTripbomb(int snum)
if (act == nullptr && hit.hitWall != nullptr && (hit.hitWall->cstat & CSTAT_WALL_MASKED) == 0)
if ((hit.hitWall->twoSided() && hit.hitWall->nextSector()->lotag <= 2) || (!hit.hitWall->twoSided() && hit.hitSector->lotag <= 2))
{
auto delta = hit.hitpos.XY() - p->pos.XY();
auto delta = hit.hitpos.XY() - p->PlayerNowPosition.XY();
if (delta.LengthSquared() < (18.125 * 18.125))
{
p->pos.Z = p->opos.Z;
p->PlayerNowPosition.Z = p->opos.Z;
p->vel.Z = 0;
return 1;
}
@ -2210,7 +2210,7 @@ static void operateweapon(int snum, ESyncBits actions)
zvel -= 4;
}
auto spawned = CreateActor(p->cursector, p->pos + p->angle.ang.ToVector() * 16, HEAVYHBOMB, -16, DVector2(0.140625, 0.140625),
auto spawned = CreateActor(p->cursector, p->PlayerNowPosition + p->angle.ang.ToVector() * 16, HEAVYHBOMB, -16, DVector2(0.140625, 0.140625),
p->angle.ang, vel + p->hbomb_hold_delay * 2, zvel, pact, 1);
if (isNam())
@ -2585,7 +2585,7 @@ static void operateweapon(int snum, ESyncBits actions)
case TRIPBOMB_WEAPON: // Claymore in NAM
if (p->kickback_pic < 4)
{
p->pos.Z = p->opos.Z;
p->PlayerNowPosition.Z = p->opos.Z;
p->vel.Z = 0;
if (p->kickback_pic == 3)
fi.shoot(pact, HANDHOLDINGLASER);
@ -2750,12 +2750,12 @@ void processinput_d(int snum)
p->spritebridge = 0;
shrunk = (pact->spr.scale.Y < 0.5);
getzrange(p->pos, psectp, &ceilingz, chz, &floorz, clz, 10.1875, CLIPMASK0);
getzrange(p->PlayerNowPosition, psectp, &ceilingz, chz, &floorz, clz, 10.1875, CLIPMASK0);
p->truefz = getflorzofslopeptr(psectp, p->pos);
p->truecz = getceilzofslopeptr(psectp, p->pos);
p->truefz = getflorzofslopeptr(psectp, p->PlayerNowPosition);
p->truecz = getceilzofslopeptr(psectp, p->PlayerNowPosition);
truefdist = abs(p->pos.Z - p->truefz);
truefdist = abs(p->PlayerNowPosition.Z - p->truefz);
if (clz.type == kHitSector && psectlotag == 1 && truefdist > gs.playerheight + 16)
psectlotag = 0;
@ -2787,7 +2787,7 @@ void processinput_d(int snum)
}
else if (badguy(clz.actor()) && clz.actor()->spr.scale.X > 0.375 && abs(pact->spr.pos.Z - clz.actor()->spr.pos.Z) < 84)
{
auto ang = (clz.actor()->spr.pos - p->pos).Angle();
auto ang = (clz.actor()->spr.pos - p->PlayerNowPosition).Angle();
p->vel.XY() -= ang.ToVector();
}
}
@ -2867,7 +2867,7 @@ void processinput_d(int snum)
p->playerweaponsway(pact->vel.X);
pact->vel.X = clamp((p->pos.XY() - p->bobpos).Length(), 0., 32.);
pact->vel.X = clamp((p->PlayerNowPosition.XY() - p->bobpos).Length(), 0., 32.);
if (p->on_ground) p->bobcounter += int(p->GetActor()->vel.X * 8);
p->backuppos(ud.clipping == 0 && ((p->insector() && p->cursector->floorpicnum == MIRROR) || !p->insector()));
@ -3033,15 +3033,15 @@ HORIZONLY:
Collision clip{};
if (ud.clipping)
{
p->pos.XY() += p->vel.XY() ;
updatesector(p->pos, &p->cursector);
p->PlayerNowPosition.XY() += p->vel.XY() ;
updatesector(p->PlayerNowPosition, &p->cursector);
ChangeActorSect(pact, p->cursector);
}
else
clipmove(p->pos, &p->cursector, p->vel, 10.25, 4., iif, CLIPMASK0, clip);
clipmove(p->PlayerNowPosition, &p->cursector, p->vel, 10.25, 4., iif, CLIPMASK0, clip);
if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk)
p->pos.Z += 32;
p->PlayerNowPosition.Z += 32;
if (clip.type != kHitNone)
checkplayerhurt_d(p, clip);
@ -3063,7 +3063,7 @@ HORIZONLY:
}
// RBG***
SetActor(pact, p->pos.plusZ(gs.playerheight));
SetActor(pact, p->PlayerNowPosition.plusZ(gs.playerheight));
if (psectlotag < 3)
{
@ -3090,7 +3090,7 @@ HORIZONLY:
while (ud.clipping == 0)
{
int blocked;
blocked = (pushmove(p->pos, &p->cursector, 10.25, 4, 4, CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < DAngle90);
blocked = (pushmove(p->PlayerNowPosition, &p->cursector, 10.25, 4, 4, CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < DAngle90);
if (fabs(pact->floorz - pact->ceilingz) < 48 || blocked)
{
@ -3101,7 +3101,7 @@ HORIZONLY:
{
if (!retry++)
{
p->pos = p->opos = oldpos;
p->PlayerNowPosition = p->opos = oldpos;
continue;
}
quickkill(p);

View file

@ -245,7 +245,7 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int
int j = findplayer(actor, &x);
pos.Z -= 4;
double dist = (ps[j].GetActor()->spr.pos.XY() - actor->spr.pos.XY()).Length();
zvel = ((ps[j].pos.Z - pos.Z) * 16) / dist;
zvel = ((ps[j].PlayerNowPosition.Z - pos.Z) * 16) / dist;
if (actor->spr.picnum != BOSS1)
{
zvel += 0.5 - krandf(1);
@ -254,7 +254,7 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int
else
{
zvel += 0.5 - krandf(1);
ang = (ps[j].pos - pos).Angle() + DAngle22_5 / 2 - randomAngle(22.5);
ang = (ps[j].PlayerNowPosition - pos).Angle() + DAngle22_5 / 2 - randomAngle(22.5);
}
}
@ -821,7 +821,7 @@ void shoot_r(DDukeActor* actor, int atwith)
if (actor->isPlayer())
{
p = actor->PlayerIndex();
spos = ps[p].pos.plusZ(ps[p].pyoff + 4);
spos = ps[p].PlayerNowPosition.plusZ(ps[p].pyoff + 4);
sang = ps[p].angle.ang;
if (isRRRA()) ps[p].crack_time = CRACK_TIME;
@ -2077,15 +2077,15 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
footprints(snum);
}
if (p->pos.Z < floorz - i) //falling
if (p->PlayerNowPosition.Z < floorz - i) //falling
{
if ((actions & (SB_JUMP|SB_CROUCH)) == 0 && p->on_ground && (psect->floorstat & CSTAT_SECTOR_SLOPE) && p->pos.Z >= (floorz - i - 16))
p->pos.Z = floorz - i;
if ((actions & (SB_JUMP|SB_CROUCH)) == 0 && p->on_ground && (psect->floorstat & CSTAT_SECTOR_SLOPE) && p->PlayerNowPosition.Z >= (floorz - i - 16))
p->PlayerNowPosition.Z = floorz - i;
else
{
p->on_ground = 0;
if ((p->OnMotorcycle || p->OnBoat) && floorz - i * 2 > p->pos.Z)
if ((p->OnMotorcycle || p->OnBoat) && floorz - i * 2 > p->PlayerNowPosition.Z)
{
if (p->MotoOnGround)
{
@ -2115,7 +2115,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
S_PlayActorSound(DUKE_SCREAM, pact);
}
if (p->pos.Z + p->vel.Z >= floorz - i) // hit the ground
if (p->PlayerNowPosition.Z + p->vel.Z >= floorz - i) // hit the ground
{
S_StopSound(DUKE_SCREAM, pact);
if (!p->insector() || p->cursector->lotag != 1)
@ -2175,18 +2175,18 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
{
//Smooth on the ground
double k = (floorz - i - p->pos.Z) * 0.5;
double k = (floorz - i - p->PlayerNowPosition.Z) * 0.5;
if (abs(k) < 1) k = 0;
p->pos.Z += k;
p->PlayerNowPosition.Z += k;
p->vel.Z -= 3;
if (p->vel.Z < 0) p->vel.Z = 0;
}
else if (p->jumping_counter == 0)
{
p->pos.Z += ((floorz - i * 0.5) - p->pos.Z) * 0.5; //Smooth on the water
if (p->on_warping_sector == 0 && p->pos.Z > floorz - 16)
p->PlayerNowPosition.Z += ((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->pos.Z = floorz - 16;
p->PlayerNowPosition.Z = floorz - 16;
p->vel.Z *= 0.5;
}
}
@ -2233,15 +2233,15 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
}
}
p->pos.Z += p->vel.Z ;
p->PlayerNowPosition.Z += p->vel.Z ;
if (p->pos.Z < ceilingz + 4)
if (p->PlayerNowPosition.Z < ceilingz + 4)
{
p->jumping_counter = 0;
if (p->vel.Z < 0)
p->vel.X = p->vel.Y = 0;
p->vel.Z = 0.5;
p->pos.Z = ceilingz + 4;
p->PlayerNowPosition.Z = ceilingz + 4;
}
}
@ -2296,14 +2296,14 @@ static void underwater(int snum, ESyncBits actions, double floorz, double ceilin
if (p->vel.Z > 8)
p->vel.Z *= 0.5;
p->pos.Z += p->vel.Z ;
p->PlayerNowPosition.Z += p->vel.Z ;
if (p->pos.Z > floorz - 15)
p->pos.Z += (((floorz - 15) - p->pos.Z) * 0.5);
if (p->PlayerNowPosition.Z > floorz - 15)
p->PlayerNowPosition.Z += (((floorz - 15) - p->PlayerNowPosition.Z) * 0.5);
if (p->pos.Z < ceilingz + 4)
if (p->PlayerNowPosition.Z < ceilingz + 4)
{
p->pos.Z = ceilingz + 4;
p->PlayerNowPosition.Z = ceilingz + 4;
p->vel.Z = 0;
}
@ -2314,7 +2314,7 @@ static void underwater(int snum, ESyncBits actions, double floorz, double ceilin
{
j->spr.pos += (p->angle.ang.ToVector() + DVector2(12 - (global_random & 8), 12 - (global_random & 8))) * 16;
j->spr.scale = DVector2(0.046875, 0.03125);
j->spr.pos.Z = p->pos.Z + 8;
j->spr.pos.Z = p->PlayerNowPosition.Z + 8;
j->spr.cstat = CSTAT_SPRITE_TRANS_FLIP | CSTAT_SPRITE_TRANSLUCENT;
}
}
@ -2708,7 +2708,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
zvel -= 4;
}
auto spawned = CreateActor(p->cursector, p->pos + p->angle.ang.ToVector() * 16, DYNAMITE, -16, DVector2(0.140625, 0.140625),
auto spawned = CreateActor(p->cursector, p->PlayerNowPosition + p->angle.ang.ToVector() * 16, DYNAMITE, -16, DVector2(0.140625, 0.140625),
p->angle.ang, (vel + p->hbomb_hold_delay * 2) * 2, zvel, pact, 1);
if (spawned)
@ -3116,7 +3116,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
zvel -= 4;
}
CreateActor(p->cursector, p->pos + p->angle.ang.ToVector() * 16, POWDERKEG, -16, DVector2(0.140625, 0.140625), p->angle.ang, vel * 2, zvel, pact, 1);
CreateActor(p->cursector, p->PlayerNowPosition + p->angle.ang.ToVector() * 16, POWDERKEG, -16, DVector2(0.140625, 0.140625), p->angle.ang, vel * 2, zvel, pact, 1);
}
p->kickback_pic++;
if (p->kickback_pic > 20)
@ -3332,7 +3332,7 @@ void processinput_r(int snum)
while (auto act2 = it.Next())
{
if (act2->spr.picnum == RRTILE380)
if (act2->spr.pos.Z - 8 < p->pos.Z)
if (act2->spr.pos.Z - 8 < p->PlayerNowPosition.Z)
psectlotag = 2;
}
}
@ -3353,19 +3353,19 @@ void processinput_r(int snum)
double tempfz;
if (pact->clipdist == 16)
{
getzrange(p->pos, psectp, &ceilingz, chz, &floorz, clz, 10.1875, CLIPMASK0);
tempfz = getflorzofslopeptr(psectp, p->pos);
getzrange(p->PlayerNowPosition, psectp, &ceilingz, chz, &floorz, clz, 10.1875, CLIPMASK0);
tempfz = getflorzofslopeptr(psectp, p->PlayerNowPosition);
}
else
{
getzrange(p->pos, psectp, &ceilingz, chz, &floorz, clz, 0.25, CLIPMASK0);
tempfz = getflorzofslopeptr(psectp, p->pos);
getzrange(p->PlayerNowPosition, psectp, &ceilingz, chz, &floorz, clz, 0.25, CLIPMASK0);
tempfz = getflorzofslopeptr(psectp, p->PlayerNowPosition);
}
p->truefz = tempfz;
p->truecz = getceilzofslopeptr(psectp, p->pos);
p->truecz = getceilzofslopeptr(psectp, p->PlayerNowPosition);
double truefdist = abs(p->pos.Z - tempfz);
double truefdist = abs(p->PlayerNowPosition.Z - tempfz);
if (clz.type == kHitSector && psectlotag == 1 && truefdist > gs.playerheight + 16)
psectlotag = 0;
@ -3427,7 +3427,7 @@ void processinput_r(int snum)
}
else if (badguy(clz.actor()) && clz.actor()->spr.scale.X > 0.375 && abs(pact->spr.pos.Z - clz.actor()->spr.pos.Z) < 84)
{
auto ang = (clz.actor()->spr.pos - p->pos).Angle();
auto ang = (clz.actor()->spr.pos - p->PlayerNowPosition).Angle();
p->vel.XY() -= ang.ToVector();
}
if (clz.actor()->spr.picnum == LADDER)
@ -3532,7 +3532,7 @@ void processinput_r(int snum)
p->playerweaponsway(pact->vel.X);
pact->vel.X = clamp((p->pos.XY() - p->bobpos).Length(), 0., 32.);
pact->vel.X = clamp((p->PlayerNowPosition.XY() - p->bobpos).Length(), 0., 32.);
if (p->on_ground) p->bobcounter += int(p->GetActor()->vel.X * 8);
p->backuppos(ud.clipping == 0 && ((p->insector() && p->cursector->floorpicnum == MIRROR) || !p->insector()));
@ -3737,15 +3737,15 @@ HORIZONLY:
Collision clip{};
if (ud.clipping)
{
p->pos.XY() += p->vel.XY() ;
updatesector(p->pos, &p->cursector);
p->PlayerNowPosition.XY() += p->vel.XY() ;
updatesector(p->PlayerNowPosition, &p->cursector);
ChangeActorSect(pact, p->cursector);
}
else
clipmove(p->pos, &p->cursector, p->vel, 10.25, 4., iif, CLIPMASK0, clip);
clipmove(p->PlayerNowPosition, &p->cursector, p->vel, 10.25, 4., iif, CLIPMASK0, clip);
if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk)
p->pos.Z += 32;
p->PlayerNowPosition.Z += 32;
if (clip.type != kHitNone)
checkplayerhurt_r(p, clip);
@ -3771,10 +3771,10 @@ HORIZONLY:
if (wal->lotag < 44)
{
dofurniture(clip.hitWall, p->cursector, snum);
pushmove(p->pos, &p->cursector, 10.75, 4, 4, CLIPMASK0);
pushmove(p->PlayerNowPosition, &p->cursector, 10.75, 4, 4, CLIPMASK0);
}
else
pushmove(p->pos, &p->cursector, 10.75, 4, 4, CLIPMASK0);
pushmove(p->PlayerNowPosition, &p->cursector, 10.75, 4, 4, CLIPMASK0);
}
}
}
@ -3839,7 +3839,7 @@ HORIZONLY:
}
// RBG***
SetActor(pact, p->pos.plusZ(gs.playerheight));
SetActor(pact, p->PlayerNowPosition.plusZ(gs.playerheight));
if (psectlotag == 800 && (!isRRRA() || !p->lotag800kill))
{
@ -3875,9 +3875,9 @@ HORIZONLY:
{
int blocked;
if (pact->clipdist == 16)
blocked = (pushmove(p->pos, &p->cursector, 8, 4, 4, CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < DAngle90);
blocked = (pushmove(p->PlayerNowPosition, &p->cursector, 8, 4, 4, CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < DAngle90);
else
blocked = (pushmove(p->pos, &p->cursector, 1, 4, 4, CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < DAngle90);
blocked = (pushmove(p->PlayerNowPosition, &p->cursector, 1, 4, 4, CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < DAngle90);
if (fabs(pact->floorz - pact->ceilingz) < 48 || blocked)
{
@ -3888,7 +3888,7 @@ HORIZONLY:
{
if (!retry++)
{
p->pos = p->opos = oldpos;
p->PlayerNowPosition = p->opos = oldpos;
continue;
}
quickkill(p);
@ -3990,8 +3990,8 @@ void OnMotorcycle(player_struct *p, DDukeActor* motosprite)
{
if (motosprite)
{
p->pos.X = motosprite->spr.pos.X;
p->pos.Y = motosprite->spr.pos.Y;
p->PlayerNowPosition.X = motosprite->spr.pos.X;
p->PlayerNowPosition.Y = motosprite->spr.pos.Y;
p->angle.ang = motosprite->spr.angle;
p->ammo_amount[MOTORCYCLE_WEAPON] = motosprite->saved_ammo;
motosprite->Destroy();
@ -4065,8 +4065,8 @@ void OnBoat(player_struct *p, DDukeActor* boat)
{
if (boat)
{
p->pos.X = boat->spr.pos.X;
p->pos.Y = boat->spr.pos.Y;
p->PlayerNowPosition.X = boat->spr.pos.X;
p->PlayerNowPosition.Y = boat->spr.pos.Y;
p->angle.ang = boat->spr.angle;
p->ammo_amount[BOAT_WEAPON] = boat->saved_ammo;
boat->Destroy();

View file

@ -342,7 +342,7 @@ void operateweapon_ww(int snum, ESyncBits actions)
zvel -= 4;
}
auto spawned = CreateActor(p->cursector, p->pos + p->angle.ang.ToVector() * 16, HEAVYHBOMB, -16, DVector2(0.140625, 0.140625),
auto spawned = CreateActor(p->cursector, p->PlayerNowPosition + p->angle.ang.ToVector() * 16, HEAVYHBOMB, -16, DVector2(0.140625, 0.140625),
p->angle.ang, vel + p->hbomb_hold_delay * 2, zvel, pact, 1);
if (spawned)
@ -436,7 +436,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->pos.Z = p->opos.Z;
p->PlayerNowPosition.Z = p->opos.Z;
p->vel.Z = 0;
}
if (p->kickback_pic == aplWeaponSound2Time(p->curr_weapon, snum))

View file

@ -51,7 +51,7 @@ short myangbak[MOVEFIFOSIZ];
void resetmys()
{
mypos = omypos = ps[myconnectindex].pos;
mypos = omypos = ps[myconnectindex].PlayerNowPosition;
myxvel = myyvel = myzvel = 0;
myang = ps[myconnectindex].angle.ang;
myhoriz = omyhoriz = ps[myconnectindex].horizon.horiz;

View file

@ -69,7 +69,7 @@ void pickrandomspot(int snum)
i = krand()%numplayersprites;
else i = snum;
p->pos = po[i].opos;
p->PlayerNowPosition = po[i].opos;
p->backupxyz();
p->setbobpos();
p->angle.oang = p->angle.ang = po[i].oa;
@ -512,7 +512,7 @@ void resetpspritevars(int g)
int aimmode[MAXPLAYERS];
STATUSBARTYPE tsbar[MAXPLAYERS];
CreateActor(ps[0].cursector, ps[0].pos,
CreateActor(ps[0].cursector, ps[0].PlayerNowPosition,
TILE_APLAYER, 0, DVector2(0, 0), ps[0].angle.ang, 0., 0., nullptr, 10);
if (ud.recstat != 2) for (i = 0; i < MAXPLAYERS; i++)
@ -622,7 +622,7 @@ void resetpspritevars(int g)
ps[j].frag_ps = j;
act->SetOwner(act);
ps[j].pos = act->spr.pos;
ps[j].PlayerNowPosition = act->spr.pos;
ps[j].backupxyz();
ps[j].setbobpos();
act->backuppos();
@ -976,7 +976,7 @@ static int LoadTheMap(MapRecord *mi, player_struct*p, int gamemode)
SpawnSpriteDef sprites;
DVector3 pos;
loadMap(mi->fileName, isShareware(), &pos, &lbang, &sect, sprites);
p->pos = pos;
p->PlayerNowPosition = pos;
p->cursector = sect;
SECRET_SetMapName(mi->DisplayName(), mi->name);

View file

@ -290,7 +290,7 @@ void displayrooms(int snum, double interpfrac, bool sceneonly)
}
else
{
cpos = interpolatedvalue(p->opos, p->pos, interpfrac);
cpos = interpolatedvalue(p->opos, p->PlayerNowPosition, interpfrac);
if (SyncInput())
{

View file

@ -76,9 +76,9 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
{
if (arc.BeginObject(keyname))
{
arc("posx", w.pos.X)
("posy", w.pos.Y)
("posz", w.pos.Z)
arc("posx", w.PlayerNowPosition.X)
("posy", w.PlayerNowPosition.Y)
("posz", w.PlayerNowPosition.Z)
("angle", w.angle)
("horizon", w.horizon)
.Array("gotweapon", w.gotweapon, MAX_WEAPONS)

View file

@ -263,7 +263,7 @@ int findotherplayer(int p, double* d)
for (j = connecthead; j >= 0; j = connectpoint2[j])
if (p != j && ps[j].GetActor()->spr.extra > 0)
{
double x = (ps[j].opos - ps[p].pos).Sum();
double x = (ps[j].opos - ps[p].PlayerNowPosition).Sum();
if (x < closest)
{
@ -380,10 +380,10 @@ void doanimations(void)
{
for (auto p = connecthead; p >= 0; p = connectpoint2[p])
if (ps[p].cursector == dasectp)
if ((dasectp->floorz - ps[p].pos.Z) < 64)
if ((dasectp->floorz - ps[p].PlayerNowPosition.Z) < 64)
if (ps[p].GetActor()->GetOwner() != nullptr)
{
ps[p].pos.Z += v;
ps[p].PlayerNowPosition.Z += v;
ps[p].vel.Z = 0;
}

View file

@ -452,7 +452,7 @@ bool checkhitswitch_d(int snum, walltype* wwal, DDukeActor *act)
return 1;
}
DVector3 v(spos, ps[snum].pos.Z);
DVector3 v(spos, ps[snum].PlayerNowPosition.Z);
switch (picnum)
{
default:
@ -878,12 +878,12 @@ void checkplayerhurt_d(player_struct* p, const Collision& coll)
p->vel.XY() = -p->angle.ang.ToVector() * 16;
S_PlayActorSound(DUKE_LONGTERM_PAIN, p->GetActor());
fi.checkhitwall(p->GetActor(), wal, p->pos + p->angle.ang.ToVector() * 2, -1);
fi.checkhitwall(p->GetActor(), wal, p->PlayerNowPosition + p->angle.ang.ToVector() * 2, -1);
break;
case BIGFORCE:
p->hurt_delay = 26;
fi.checkhitwall(p->GetActor(), wal, p->pos + p->angle.ang.ToVector() * 2, -1);
fi.checkhitwall(p->GetActor(), wal, p->PlayerNowPosition + p->angle.ang.ToVector() * 2, -1);
break;
}
@ -1064,7 +1064,7 @@ void checkhitdefault_d(DDukeActor* targ, DDukeActor* proj)
ps[p].restorexyz();
ps[p].angle.restore();
updatesector(ps[p].pos, &ps[p].cursector);
updatesector(ps[p].PlayerNowPosition, &ps[p].cursector);
DukeStatIterator it(STAT_ACTOR);
while (auto itActor = it.Next())
@ -1414,7 +1414,7 @@ void clearcameras(player_struct* p)
p->restorexyz();
p->newOwner = nullptr;
updatesector(p->pos, &p->cursector);
updatesector(p->PlayerNowPosition, &p->cursector);
DukeStatIterator it(STAT_ACTOR);
while (auto act = it.Next())
@ -1519,14 +1519,14 @@ void checksectors_d(int snum)
neartag(p->opos, p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
else
{
neartag(p->pos, p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
neartag(p->PlayerNowPosition, p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr)
neartag(p->pos.plusZ(8), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
neartag(p->PlayerNowPosition.plusZ(8), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr)
neartag(p->pos.plusZ(16), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
neartag(p->PlayerNowPosition.plusZ(16), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr)
{
neartag(p->pos.plusZ(16), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag | NT_Hitag);
neartag(p->PlayerNowPosition.plusZ(16), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag | NT_Hitag);
if (near.actor() != nullptr)
{
switch (near.actor()->spr.picnum)

View file

@ -646,7 +646,7 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
setnextmap(false);
}
DVector3 v(pos, ps[snum].pos.Z);
DVector3 v(pos, ps[snum].PlayerNowPosition.Z);
switch (picnum)
{
default:
@ -1367,7 +1367,7 @@ void checkplayerhurt_r(player_struct* p, const Collision &coll)
{
case BIGFORCE:
p->hurt_delay = 26;
fi.checkhitwall(p->GetActor(), wal, p->pos + p->angle.ang.ToVector() * 2, -1);
fi.checkhitwall(p->GetActor(), wal, p->PlayerNowPosition + p->angle.ang.ToVector() * 2, -1);
break;
}
@ -1546,7 +1546,7 @@ void checkhitdefault_r(DDukeActor* targ, DDukeActor* proj)
ps[p].newOwner = nullptr;
ps[p].restorexyz();
updatesector(ps[p].pos, &ps[p].cursector);
updatesector(ps[p].PlayerNowPosition, &ps[p].cursector);
DukeStatIterator it(STAT_EFFECTOR);
while (auto act = it.Next())
@ -2462,21 +2462,21 @@ void checksectors_r(int snum)
}
return;
}
neartag(p->pos, p->GetActor()->sector(), p->angle.oang, near , 80., NT_Lotag | NT_Hitag);
neartag(p->PlayerNowPosition, p->GetActor()->sector(), p->angle.oang, near , 80., NT_Lotag | NT_Hitag);
}
if (p->newOwner != nullptr)
neartag(p->opos, p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
else
{
neartag(p->pos, p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
neartag(p->PlayerNowPosition, p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr)
neartag(p->pos.plusZ(8), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
neartag(p->PlayerNowPosition.plusZ(8), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr)
neartag(p->pos.plusZ(16), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
neartag(p->PlayerNowPosition.plusZ(16), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr)
{
neartag(p->pos.plusZ(16), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag | NT_Hitag);
neartag(p->PlayerNowPosition.plusZ(16), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag | NT_Hitag);
if (near.actor() != nullptr)
{
switch (near.actor()->spr.picnum)

View file

@ -318,7 +318,7 @@ void S_GetCamera(DVector3* c, DAngle* ca, sectortype** cs)
if (ud.cameraactor == nullptr)
{
auto p = &ps[screenpeek];
if (c) *c = p->pos;
if (c) *c = p->PlayerNowPosition;
if (cs) *cs = p->cursector;
if (ca) *ca = p->angle.ang;
}

View file

@ -430,7 +430,7 @@ void initshell(DDukeActor* actj, DDukeActor* act, bool isshell)
ang = ps[snum].angle.ang - mapangle((krand() & 63) + 8); //Fine tune
act->temp_data[0] = krand() & 1;
act->spr.pos.Z = 3 + ps[snum].pos.Z + ps[snum].pyoff + (ps[snum].horizon.sum().Sin() * 8.) + (!isshell ? 3 : 0);
act->spr.pos.Z = 3 + ps[snum].PlayerNowPosition.Z + ps[snum].pyoff + (ps[snum].horizon.sum().Tan() * 8.) + (!isshell ? 3 : 0);
act->vel.Z = -krandf(1);
}
else

View file

@ -176,7 +176,7 @@ struct player_orig
struct player_struct
{
DVector3 vel;
DVector3 pos, opos;
DVector3 PlayerNowPosition, opos;
DVector2 bobpos;
DVector2 fric;
DVector2 Exit;
@ -333,28 +333,28 @@ struct player_struct
void backupxyz()
{
opos = pos;
opos = PlayerNowPosition;
}
void restorexyz()
{
pos = opos;
PlayerNowPosition = opos;
}
void backupxy()
{
opos.X = pos.X;
opos.Y = pos.Y;
opos.X = PlayerNowPosition.X;
opos.Y = PlayerNowPosition.Y;
}
void backupz()
{
opos.Z = pos.Z;
opos.Z = PlayerNowPosition.Z;
}
void setbobpos()
{
bobpos = pos.XY();
bobpos = PlayerNowPosition.XY();
}
};

View file

@ -513,7 +513,7 @@ DEFINE_FIELD_X(DukePlayer, player_struct, loogcnt)
DEFINE_FIELD_X(DukePlayer, player_struct, invdisptime)
//DEFINE_FIELD_X(DukePlayer, player_struct, bobposx)
//DEFINE_FIELD_X(DukePlayer, player_struct, bobposy)
DEFINE_FIELD_X(DukePlayer, player_struct, pos)
DEFINE_FIELD_X(DukePlayer, player_struct, PlayerNowPosition)
DEFINE_FIELD_X(DukePlayer, player_struct, pyoff)
DEFINE_FIELD_X(DukePlayer, player_struct, opyoff)
//DEFINE_FIELD_X(DukePlayer, player_struct, posxv)
@ -703,7 +703,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, backupxyz, dukeplayer_backupxyz)
void dukeplayer_setpos(player_struct* self, double x, double y, double z)
{
self->pos = { x, y, z };
self->PlayerNowPosition = { x, y, z };
}
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, setpos, dukeplayer_setpos)

View file

@ -236,9 +236,9 @@ class DukeCrane : DukeActor
{
let ang = p.angle();
p.backupxyz();
p.pos.XY = self.pos.XY - CRANE_STEP * ang.ToVector();
p.pos.Z = self.pos.Z + 2;
p.actor.SetPosition(p.pos);
p.PlayerNowPosition.XY = self.pos.XY - CRANE_STEP * ang.ToVector();
p.PlayerNowPosition.Z = self.pos.Z + 2;
p.actor.SetPosition(p.PlayerNowPosition);
p.cursector = p.actor.sector;
}
}

View file

@ -146,7 +146,7 @@ struct Duke native
struct DukePlayer native
{
native Vector3 pos;
native Vector3 PlayerNowPosition;
/*
// player's horizon and angle structs.