- Duke: Remove player_struct::posGet().

This commit is contained in:
Mitchell Richters 2022-11-24 13:20:17 +11:00 committed by Christoph Oelckers
parent b42672dcf9
commit 27be72c7ec
18 changed files with 82 additions and 76 deletions

View file

@ -161,6 +161,11 @@ public:
return spr.pos.Z + viewzoffset;
}
DVector3 getPosWithOffsetZ()
{
return spr.pos.plusZ(viewzoffset);
}
sectortype* sector() const
{
return spr.sectp;

View file

@ -205,7 +205,7 @@ void clearcamera(player_struct* ps)
ps->newOwner = nullptr;
ps->GetActor()->restorepos();
ps->angle.restore();
updatesector(ps->posGet(), &ps->cursector);
updatesector(ps->GetActor()->getPosWithOffsetZ(), &ps->cursector);
DukeStatIterator it(STAT_ACTOR);
while (auto k = it.Next())
@ -442,7 +442,7 @@ void moveplayers(void)
if (p->actorsqu != nullptr)
{
p->angle.addadjustment(deltaangle(p->angle.ang, (p->actorsqu->spr.pos - p->posGet()).Angle()) * 0.25);
p->angle.addadjustment(deltaangle(p->angle.ang, (p->actorsqu->spr.pos.XY() - p->GetActor()->spr.pos.XY()).Angle()) * 0.25);
}
if (act->spr.extra > 0)
@ -462,7 +462,7 @@ void moveplayers(void)
if (p->wackedbyactor != nullptr && p->wackedbyactor->spr.statnum < MAXSTATUS)
{
p->angle.addadjustment(deltaangle(p->angle.ang, (p->wackedbyactor->spr.pos - p->posGet()).Angle()) * 0.5);
p->angle.addadjustment(deltaangle(p->angle.ang, (p->wackedbyactor->spr.pos.XY() - p->GetActor()->spr.pos.XY()).Angle()) * 0.5);
}
}
act->spr.angle = p->angle.ang;
@ -957,7 +957,7 @@ 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].posGet(), ps[p].cursector))
if (actor->temp_data[2] > (26 * 3) || !cansee(actor->spr.pos.plusZ(-16), actor->sector(), ps[p].GetActor()->getPosWithOffsetZ(), ps[p].cursector))
{
actor->temp_data[0] = 0;
actor->temp_data[2] = 0;
@ -979,7 +979,7 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p
else
{
actor->temp_data[2]++;
if (actor->temp_data[2] > (26 * 3) || !cansee(actor->spr.pos.plusZ(-16), actor->sector(), ps[p].posGet(), ps[p].cursector))
if (actor->temp_data[2] > (26 * 3) || !cansee(actor->spr.pos.plusZ(-16), actor->sector(), ps[p].GetActor()->getPosWithOffsetZ(), ps[p].cursector))
{
actor->temp_data[0] = 1;
actor->temp_data[2] = 0;
@ -2006,7 +2006,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
if (psp->spr.extra > 0)
{
auto sect = ps[p].cursector;
updatesector(ps[p].posGet(), &sect);
updatesector(ps[p].GetActor()->getPosWithOffsetZ(), &sect);
if ((sect == nullptr && ud.clipping == 0) || (sect == actor->sector() && ps[p].cursector != actor->sector()))
{
ps[p].GetActor()->spr.pos.XY() = actor->spr.pos.XY();
@ -2081,7 +2081,7 @@ 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].posGet(), &k);
updatesector(ps[p].GetActor()->getPosWithOffsetZ(), &k);
if ((k == nullptr && ud.clipping == 0) || (k == actor->sector() && ps[p].cursector != actor->sector()))
{
ps[p].GetActor()->spr.pos.XY() = actor->spr.pos.XY();
@ -2184,7 +2184,7 @@ void handle_se30(DDukeActor *actor, int JIBS6)
if (psp->spr.extra > 0)
{
auto k = ps[p].cursector;
updatesector(ps[p].posGet(), &k);
updatesector(ps[p].GetActor()->getPosWithOffsetZ(), &k);
if ((k == nullptr && ud.clipping == 0) || (k == actor->sector() && ps[p].cursector != actor->sector()))
{
ps[p].GetActor()->spr.pos.XY() = actor->spr.pos.XY();
@ -2240,7 +2240,7 @@ void handle_se30(DDukeActor *actor, int JIBS6)
if (ps[p].GetActor()->spr.extra > 0)
{
auto k = ps[p].cursector;
updatesector(ps[p].posGet(), &k);
updatesector(ps[p].GetActor()->getPosWithOffsetZ(), &k);
if ((k == nullptr && ud.clipping == 0) || (k == actor->sector() && ps[p].cursector != actor->sector()))
{
ps[p].GetActor()->spr.pos.XY() = actor->spr.pos.XY();
@ -2473,7 +2473,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].posGet()).Angle();
actor->spr.angle = (actor->spr.pos.XY() - ps[p].GetActor()->spr.pos.XY()).Angle();
fi.shoot(actor, FIRELASER);
actor->spr.angle = ang;
}
@ -3037,10 +3037,10 @@ void handle_se17(DDukeActor* actor)
{
int p = act3->PlayerIndex();
ps[p].posoldAdd(-ps[p].posGet());
ps[p].posoldAdd(-ps[p].GetActor()->getPosWithOffsetZ());
ps[p].GetActor()->spr.pos.XY() += act2->spr.pos.XY() - actor->spr.pos.XY();
ps[p].GetActor()->spr.pos.Z += act2->sector()->floorz - sc->floorz;
ps[p].posoldAdd(ps[p].posGet());
ps[p].posoldAdd(ps[p].GetActor()->getPosWithOffsetZ());
if (q > 0) ps[p].GetActor()->backupz();
@ -3483,7 +3483,7 @@ void handle_se27(DDukeActor* actor)
}
else if (ud.recstat == 2 && ps[p].newOwner == nullptr)
{
if (cansee(actor->spr.pos, actor->sector(), ps[p].posGet(), ps[p].cursector))
if (cansee(actor->spr.pos, actor->sector(), ps[p].GetActor()->getPosWithOffsetZ(), ps[p].cursector))
{
if (xx < sh * maptoworld)
{

View file

@ -1376,7 +1376,7 @@ void movetransports_d(void)
ps[p].GetActor()->backupz();
auto pa = ps[p].GetActor();
pa->opos = ps[p].posGet();
pa->opos = ps[p].GetActor()->getPosWithOffsetZ();
ChangeActorSect(act2, Owner->sector());
ps[p].setCursector(Owner->sector());
@ -1735,7 +1735,7 @@ static void greenslime(DDukeActor *actor)
ps[p].GetActor()->restorepos();
ps[p].angle.restore();
updatesector(ps[p].posGet(), &ps[p].cursector);
updatesector(ps[p].GetActor()->getPosWithOffsetZ(), &ps[p].cursector);
DukeStatIterator it(STAT_ACTOR);
while (auto ac = it.Next())
@ -2258,7 +2258,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].posGet(), ps[p].cursector))
if (cansee(actor->spr.pos.plusZ(-8), actor->sector(), ps[p].GetActor()->getPosWithOffsetZ(), ps[p].cursector))
if (ps[p].ammo_amount[HANDBOMB_WEAPON] < gs.max_ammo_amount[HANDBOMB_WEAPON])
{
if (ud.coop >= 1 && Owner == actor)
@ -2784,7 +2784,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].posGet(), ps[screenpeek].cursector);
int j = !!cansee(actor->spr.pos, actor->sector(), ps[screenpeek].GetActor()->getPosWithOffsetZ(), ps[screenpeek].cursector);
if (rnd(192) && (actor->temp_data[2] & 1))
{

View file

@ -2248,7 +2248,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].posGet(), ps[p].cursector))
if (cansee(actor->spr.pos.plusZ(-8), actor->sector(), ps[p].GetActor()->getPosWithOffsetZ(), ps[p].cursector))
if (ps[p].ammo_amount[DYNAMITE_WEAPON] < gs.max_ammo_amount[DYNAMITE_WEAPON])
if (actor->spr.pal == 0)
{

View file

@ -114,9 +114,12 @@ static int ccmd_spawn(CCmdFuncPtr parm)
void GameInterface::WarpToCoords(double x, double y, double z, DAngle ang)
{
player_struct* p = &ps[myconnectindex];
auto pActor = p->GetActor();
p->posSet(DVector3(x, y, z));
p->GetActor()->backuppos();
if (!pActor) return;
pActor->spr.pos = DVector3(x, y, z);
pActor->backuppos();
if (ang != DAngle::fromDeg(INT_MIN))
{

View file

@ -57,7 +57,9 @@ BEGIN_DUKE_NS
std::pair<DVector3, DAngle> GameInterface::GetCoordinates()
{
return std::make_pair(ps[screenpeek].posGet(), ps[screenpeek].angle.ang);
auto pActor = ps[screenpeek].GetActor();
if (!pActor) return std::make_pair(DVector3(DBL_MAX, 0, 0), nullAngle);
return std::make_pair(pActor->spr.pos, pActor->spr.angle);
}
GameStats GameInterface::getStats()
@ -271,7 +273,7 @@ void drawoverlays(double interpfrac)
}
else
{
cposxy = interpolatedvalue(pp->posoldGet(), pp->posGet(), interpfrac).XY();
cposxy = interpolatedvalue(pp->posoldGet(), pp->GetActor()->getPosWithOffsetZ(), interpfrac).XY();
cang = !SyncInput() ? pp->angle.ang : interpolatedvalue(pp->angle.oang, pp->angle.ang, interpfrac);
}
}

View file

@ -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].posGet(), ps[g_p].GetActor()->sector());
j = cansee(g_ac->spr.pos.plusZ(krand() & 41), g_ac->sector(), ps[g_p].GetActor()->getPosWithOffsetZ(), 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].posGet(), ps[g_p].GetActor()->sector());
j = cansee(g_ac->spr.pos, g_ac->sector(), ps[g_p].GetActor()->getPosWithOffsetZ(), ps[g_p].GetActor()->sector());
parseifelse(j);
if (j) g_ac->timetosleep = SLEEPTIME;
break;
@ -2047,7 +2047,7 @@ int ParseState::parse(void)
ps[g_p].newOwner = nullptr;
ps[g_p].GetActor()->restorepos();
ps[g_p].angle.restore();
updatesector(ps[g_p].posGet(), &ps[g_p].cursector);
updatesector(ps[g_p].GetActor()->getPosWithOffsetZ(), &ps[g_p].cursector);
DukeStatIterator it(STAT_ACTOR);
while (auto actj = it.Next())
@ -2230,11 +2230,11 @@ 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].posGet();
g_ac->spr.pos = ps[g_p].GetActor()->getPosWithOffsetZ();
ps[g_p].GetActor()->backuppos();
ps[g_p].setbobpos();
g_ac->backuppos();
updatesector(ps[g_p].posGet(), &ps[g_p].cursector);
updatesector(ps[g_p].GetActor()->getPosWithOffsetZ(), &ps[g_p].cursector);
SetActor(ps[g_p].GetActor(), ps[g_p].GetActor()->spr.pos);
g_ac->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
@ -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].posGet().plusZ(16), ps[g_p].GetActor()->sector()))
if (cansee(g_ac->spr.pos.plusZ(-4), g_ac->sector(), ps[g_p].GetActor()->getPosWithOffsetZ().plusZ(16), ps[g_p].GetActor()->sector()))
{
ps[g_p].knee_incs = 1;
if(ps[g_p].weapon_pos == 0)

View file

@ -284,7 +284,7 @@ void hud_input(int plnum)
p->inven_icon = 3;
auto pactor =
CreateActor(p->cursector, p->posGet().plusZ(30), TILE_APLAYER, -64, DVector2(0, 0), p->angle.ang, 0., 0., nullptr, 10);
CreateActor(p->cursector, p->GetActor()->getPosWithOffsetZ().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

@ -211,7 +211,7 @@ double hitawall(player_struct* p, walltype** hitw)
{
HitInfo hit{};
hitscan(p->posGet(), p->cursector, DVector3(p->angle.ang.ToVector() * 1024, 0), hit, CLIPMASK0);
hitscan(p->GetActor()->getPosWithOffsetZ(), p->cursector, DVector3(p->angle.ang.ToVector() * 1024, 0), hit, CLIPMASK0);
if (hitw) *hitw = hit.hitWall;
return (hit.hitpos.XY() - p->GetActor()->spr.pos.XY()).Length();
@ -248,7 +248,7 @@ DDukeActor* aim(DDukeActor* actor, int abase)
setFreeAimVelocity(vel, zvel, plr->horizon.sum(), 16.);
HitInfo hit{};
hitscan(plr->posGet().plusZ(4), actor->sector(), DVector3(actor->spr.angle.ToVector() * vel, zvel), hit, CLIPMASK1);
hitscan(plr->GetActor()->getPosWithOffsetZ().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->posGet() - p->actorsqu->spr.pos).Pitch() * 1.1875));
p->horizon.addadjustment(deltaangle(p->horizon.horiz, (p->GetActor()->getPosWithOffsetZ() - p->actorsqu->spr.pos).Pitch() * 1.1875));
p->sync.actions |= SB_CENTERVIEW;
if (p->knee_incs > 15)
{
@ -624,7 +624,7 @@ void playerisdead(int snum, int psectlotag, double floorz, double ceilingz)
p->horizon.horizoff = p->horizon.horiz = nullAngle;
updatesector(p->posGet(), &p->cursector);
updatesector(p->GetActor()->getPosWithOffsetZ(), &p->cursector);
pushmove(p->GetActor()->spr.pos.XY(), p->GetActor()->getOffsetZ(), &p->cursector, 8, 4, 20, CLIPMASK0);

View file

@ -392,7 +392,7 @@ static void shootweapon(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int
}
else
{
ang = (ps[j].posGet() - pos).Angle() + DAngle22_5 / 2 - randomAngle(22.5);
ang = (ps[j].GetActor()->spr.pos.XY() - pos.XY()).Angle() + DAngle22_5 / 2 - randomAngle(22.5);
}
}
@ -1070,7 +1070,7 @@ void shoot_d(DDukeActor* actor, int atwith)
if (actor->isPlayer())
{
spos = ps[p].posGet().plusZ(ps[p].pyoff + 4);
spos = ps[p].GetActor()->getPosWithOffsetZ().plusZ(ps[p].pyoff + 4);
sang = ps[p].angle.ang;
ps[p].crack_time = CRACK_TIME;
@ -2013,7 +2013,7 @@ int operateTripbomb(int snum)
double vel = 1024, zvel = 0;
setFreeAimVelocity(vel, zvel, p->horizon.sum(), 16.);
hitscan(p->posGet(), p->cursector, DVector3(p->angle.ang.ToVector() * vel, zvel), hit, CLIPMASK1);
hitscan(p->GetActor()->getPosWithOffsetZ(), p->cursector, DVector3(p->angle.ang.ToVector() * vel, zvel), hit, CLIPMASK1);
if (hit.hitSector == nullptr || hit.actor())
return 0;
@ -2210,7 +2210,7 @@ static void operateweapon(int snum, ESyncBits actions)
zvel -= 4;
}
auto spawned = CreateActor(p->cursector, p->posGet() + p->angle.ang.ToVector() * 16, HEAVYHBOMB, -16, DVector2(0.140625, 0.140625),
auto spawned = CreateActor(p->cursector, p->GetActor()->getPosWithOffsetZ() + 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())
@ -2750,10 +2750,10 @@ void processinput_d(int snum)
p->spritebridge = 0;
shrunk = (pact->spr.scale.Y < 0.5);
getzrange(p->posGet(), psectp, &ceilingz, chz, &floorz, clz, 10.1875, CLIPMASK0);
getzrange(p->GetActor()->getPosWithOffsetZ(), psectp, &ceilingz, chz, &floorz, clz, 10.1875, CLIPMASK0);
p->truefz = getflorzofslopeptr(psectp, p->posGet());
p->truecz = getceilzofslopeptr(psectp, p->posGet());
p->truefz = getflorzofslopeptr(psectp, p->GetActor()->getPosWithOffsetZ());
p->truecz = getceilzofslopeptr(psectp, p->GetActor()->getPosWithOffsetZ());
truefdist = abs(p->GetActor()->getOffsetZ() - p->truefz);
if (clz.type == kHitSector && psectlotag == 1 && truefdist > gs.playerheight + 16)
@ -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->posGet()).Angle();
auto ang = (clz.actor()->spr.pos.XY() - p->GetActor()->spr.pos.XY()).Angle();
p->vel.XY() -= ang.ToVector();
}
}
@ -3034,7 +3034,7 @@ HORIZONLY:
if (ud.clipping)
{
p->GetActor()->spr.pos.XY() += p->vel.XY() ;
updatesector(p->posGet(), &p->cursector);
updatesector(p->GetActor()->getPosWithOffsetZ(), &p->cursector);
ChangeActorSect(pact, p->cursector);
}
else

View file

@ -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].posGet() - pos).Angle() + DAngle22_5 / 2 - randomAngle(22.5);
ang = (ps[j].GetActor()->spr.pos.XY() - pos.XY()).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].posGet().plusZ(ps[p].pyoff + 4);
spos = ps[p].GetActor()->getPosWithOffsetZ().plusZ(ps[p].pyoff + 4);
sang = ps[p].angle.ang;
if (isRRRA()) ps[p].crack_time = CRACK_TIME;
@ -2708,7 +2708,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
zvel -= 4;
}
auto spawned = CreateActor(p->cursector, p->posGet() + p->angle.ang.ToVector() * 16, DYNAMITE, -16, DVector2(0.140625, 0.140625),
auto spawned = CreateActor(p->cursector, p->GetActor()->getPosWithOffsetZ() + 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->posGet() + p->angle.ang.ToVector() * 16, POWDERKEG, -16, DVector2(0.140625, 0.140625), p->angle.ang, vel * 2, zvel, pact, 1);
CreateActor(p->cursector, p->GetActor()->getPosWithOffsetZ() + 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)
@ -3353,17 +3353,17 @@ void processinput_r(int snum)
double tempfz;
if (pact->clipdist == 16)
{
getzrange(p->posGet(), psectp, &ceilingz, chz, &floorz, clz, 10.1875, CLIPMASK0);
tempfz = getflorzofslopeptr(psectp, p->posGet());
getzrange(p->GetActor()->getPosWithOffsetZ(), psectp, &ceilingz, chz, &floorz, clz, 10.1875, CLIPMASK0);
tempfz = getflorzofslopeptr(psectp, p->GetActor()->getPosWithOffsetZ());
}
else
{
getzrange(p->posGet(), psectp, &ceilingz, chz, &floorz, clz, 0.25, CLIPMASK0);
tempfz = getflorzofslopeptr(psectp, p->posGet());
getzrange(p->GetActor()->getPosWithOffsetZ(), psectp, &ceilingz, chz, &floorz, clz, 0.25, CLIPMASK0);
tempfz = getflorzofslopeptr(psectp, p->GetActor()->getPosWithOffsetZ());
}
p->truefz = tempfz;
p->truecz = getceilzofslopeptr(psectp, p->posGet());
p->truecz = getceilzofslopeptr(psectp, p->GetActor()->getPosWithOffsetZ());
double truefdist = abs(p->GetActor()->getOffsetZ() - tempfz);
if (clz.type == kHitSector && psectlotag == 1 && truefdist > gs.playerheight + 16)
@ -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->posGet()).Angle();
auto ang = (clz.actor()->spr.pos.XY() - p->GetActor()->spr.pos.XY()).Angle();
p->vel.XY() -= ang.ToVector();
}
if (clz.actor()->spr.picnum == LADDER)
@ -3738,7 +3738,7 @@ HORIZONLY:
if (ud.clipping)
{
p->GetActor()->spr.pos.XY() += p->vel.XY() ;
updatesector(p->posGet(), &p->cursector);
updatesector(p->GetActor()->getPosWithOffsetZ(), &p->cursector);
ChangeActorSect(pact, p->cursector);
}
else

View file

@ -342,7 +342,7 @@ void operateweapon_ww(int snum, ESyncBits actions)
zvel -= 4;
}
auto spawned = CreateActor(p->cursector, p->posGet() + p->angle.ang.ToVector() * 16, HEAVYHBOMB, -16, DVector2(0.140625, 0.140625),
auto spawned = CreateActor(p->cursector, p->GetActor()->getPosWithOffsetZ() + 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)

View file

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

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].posoldGet() - ps[p].posGet()).Sum();
double x = (ps[j].posoldGet() - ps[p].GetActor()->getPosWithOffsetZ()).Sum();
if (x < closest)
{

View file

@ -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->posGet() + p->angle.ang.ToVector() * 2, -1);
fi.checkhitwall(p->GetActor(), wal, p->GetActor()->getPosWithOffsetZ() + p->angle.ang.ToVector() * 2, -1);
break;
case BIGFORCE:
p->hurt_delay = 26;
fi.checkhitwall(p->GetActor(), wal, p->posGet() + p->angle.ang.ToVector() * 2, -1);
fi.checkhitwall(p->GetActor(), wal, p->GetActor()->getPosWithOffsetZ() + p->angle.ang.ToVector() * 2, -1);
break;
}
@ -1064,7 +1064,7 @@ void checkhitdefault_d(DDukeActor* targ, DDukeActor* proj)
ps[p].GetActor()->restorepos();
ps[p].angle.restore();
updatesector(ps[p].posGet(), &ps[p].cursector);
updatesector(ps[p].GetActor()->getPosWithOffsetZ(), &ps[p].cursector);
DukeStatIterator it(STAT_ACTOR);
while (auto itActor = it.Next())
@ -1414,7 +1414,7 @@ void clearcameras(player_struct* p)
p->GetActor()->restorepos();
p->newOwner = nullptr;
updatesector(p->posGet(), &p->cursector);
updatesector(p->GetActor()->getPosWithOffsetZ(), &p->cursector);
DukeStatIterator it(STAT_ACTOR);
while (auto act = it.Next())
@ -1519,14 +1519,14 @@ void checksectors_d(int snum)
neartag(p->posoldGet(), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
else
{
neartag(p->posGet(), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
neartag(p->GetActor()->getPosWithOffsetZ(), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr)
neartag(p->posGet().plusZ(8), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
neartag(p->GetActor()->getPosWithOffsetZ().plusZ(8), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr)
neartag(p->posGet().plusZ(16), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
neartag(p->GetActor()->getPosWithOffsetZ().plusZ(16), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr)
{
neartag(p->posGet().plusZ(16), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag | NT_Hitag);
neartag(p->GetActor()->getPosWithOffsetZ().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

@ -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->posGet() + p->angle.ang.ToVector() * 2, -1);
fi.checkhitwall(p->GetActor(), wal, p->GetActor()->getPosWithOffsetZ() + p->angle.ang.ToVector() * 2, -1);
break;
}
@ -1546,7 +1546,7 @@ void checkhitdefault_r(DDukeActor* targ, DDukeActor* proj)
ps[p].newOwner = nullptr;
ps[p].GetActor()->restorepos();
updatesector(ps[p].posGet(), &ps[p].cursector);
updatesector(ps[p].GetActor()->getPosWithOffsetZ(), &ps[p].cursector);
DukeStatIterator it(STAT_EFFECTOR);
while (auto act = it.Next())
@ -2462,21 +2462,21 @@ void checksectors_r(int snum)
}
return;
}
neartag(p->posGet(), p->GetActor()->sector(), p->angle.oang, near , 80., NT_Lotag | NT_Hitag);
neartag(p->GetActor()->getPosWithOffsetZ(), p->GetActor()->sector(), p->angle.oang, near , 80., NT_Lotag | NT_Hitag);
}
if (p->newOwner != nullptr)
neartag(p->posoldGet(), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
else
{
neartag(p->posGet(), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
neartag(p->GetActor()->getPosWithOffsetZ(), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr)
neartag(p->posGet().plusZ(8), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
neartag(p->GetActor()->getPosWithOffsetZ().plusZ(8), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr)
neartag(p->posGet().plusZ(16), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
neartag(p->GetActor()->getPosWithOffsetZ().plusZ(16), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag);
if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr)
{
neartag(p->posGet().plusZ(16), p->GetActor()->sector(), p->angle.oang, near, 80., NT_Lotag | NT_Hitag);
neartag(p->GetActor()->getPosWithOffsetZ().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

@ -320,7 +320,7 @@ void S_GetCamera(DVector3* c, DAngle* ca, sectortype** cs)
auto p = &ps[screenpeek];
if (c)
{
if (p->GetActor()) *c = p->posGet();
if (p->GetActor()) *c = p->GetActor()->getPosWithOffsetZ();
else c->Zero();
}
if (cs) *cs = p->cursector;

View file

@ -348,10 +348,6 @@ struct player_struct
{
GetActor()->spr.pos.XY() += val;
}
DVector3 posGet()
{
return GetActor()->spr.pos.plusZ(GetActor()->viewzoffset);
}
double& posoldX()
{