- Rename PlayerHorizon getters in preparation for replacement work.

This commit is contained in:
Mitchell Richters 2022-11-25 15:26:15 +11:00 committed by Christoph Oelckers
parent 723631cc81
commit 3758d93ad8
11 changed files with 40 additions and 40 deletions

View file

@ -29,9 +29,9 @@ struct PlayerHorizon
}
// Commonly used getters.
DAngle osum() { return ZzOLDHORIZON + ZzOHORIZOFF; }
DAngle sum() { return ZzHORIZON + ZzHORIZOFF; }
DAngle interpolatedsum(double const interpfrac) { return interpolatedvalue(osum(), sum(), interpfrac); }
DAngle horizOLDSUM() { return ZzOLDHORIZON + ZzOHORIZOFF; }
DAngle horizSUM() { return ZzHORIZON + ZzHORIZOFF; }
DAngle horizLERPSUM(double const interpfrac) { return interpolatedvalue(horizOLDSUM(), horizSUM(), interpfrac); }
// Ticrate playsim adjustment helpers.
void resetadjustment() { adjustment = nullAngle; }

View file

@ -502,13 +502,13 @@ static void SetupView(PLAYER* pPlayer, DVector3& cPos, DAngle& cA, DAngle& cH, s
if (!SyncInput())
{
cA = pPlayer->angle.sum();
cH = pPlayer->horizon.sum();
cH = pPlayer->horizon.horizSUM();
rotscrnang = pPlayer->angle.rotscrnang;
}
else
{
cA = pPlayer->angle.interpolatedsum(interpfrac);
cH = pPlayer->horizon.interpolatedsum(interpfrac);
cH = pPlayer->horizon.horizLERPSUM(interpfrac);
rotscrnang = pPlayer->angle.interpolatedrotscrn(interpfrac);
}
}

View file

@ -229,7 +229,7 @@ void displayweapon_d(int snum, double interpfrac)
gun_pos -= fabs(p->GetActor()->spr.scale.X < 0.5 ? BobVal(weapon_sway * 4.) * 32 : BobVal(weapon_sway * 0.5) * 16) + hard_landing;
auto offsets = p->angle.weaponoffsets(interpfrac);
auto horiz = !SyncInput() ? p->horizon.sum() : p->horizon.interpolatedsum(interpfrac);
auto horiz = !SyncInput() ? p->horizon.horizSUM() : p->horizon.horizLERPSUM(interpfrac);
auto pitchoffset = interpolatedvalue(0., 16., horiz / DAngle90);
auto yawinput = getavel(snum) * (1. / 16.);
auto angle = p->angle.renderrotscrn(interpfrac);

View file

@ -245,7 +245,7 @@ DDukeActor* aim(DDukeActor* actor, int abase)
if (plr->curr_weapon == PISTOL_WEAPON && !isWW2GI())
{
double vel = 1024, zvel = 0;
setFreeAimVelocity(vel, zvel, plr->horizon.sum(), 16.);
setFreeAimVelocity(vel, zvel, plr->horizon.horizSUM(), 16.);
HitInfo hit{};
hitscan(plr->GetActor()->getPosWithOffsetZ().plusZ(4), actor->sector(), DVector3(actor->spr.Angles.Yaw.ToVector() * vel, zvel), hit, CLIPMASK1);
@ -343,7 +343,7 @@ DDukeActor* aim(DDukeActor* actor, int abase)
if (actor->isPlayer())
{
double checkval = (act->spr.pos.Z - actor->spr.pos.Z) * 1.25 / sdist;
double horiz = ps[actor->PlayerIndex()].horizon.sum().Tan();
double horiz = ps[actor->PlayerIndex()].horizon.horizSUM().Tan();
check = abs(checkval - horiz) < 0.78125;
}
else check = 1;

View file

@ -113,7 +113,7 @@ static void shootfireball(DDukeActor *actor, int p, DVector3 pos, DAngle ang)
}
else
{
setFreeAimVelocity(vel, zvel, ps[p].horizon.sum(), 49.);
setFreeAimVelocity(vel, zvel, ps[p].horizon.horizSUM(), 49.);
pos += (ang + DAngle1 * 61.171875).ToVector() * (1024. / 448.);
pos.Z += 3;
}
@ -175,7 +175,7 @@ static void shootflamethrowerflame(DDukeActor* actor, int p, DVector3 spos, DAng
}
else
{
setFreeAimVelocity(vel, zvel, ps[p].horizon.sum(), 40.5);
setFreeAimVelocity(vel, zvel, ps[p].horizon.horizSUM(), 40.5);
// WTF???
DAngle myang = DAngle90 - (DAngle180 - abs(abs((spos.XY() - ps[p].GetActor()->spr.pos.XY()).Angle() - sang) - DAngle180));
@ -233,7 +233,7 @@ static void shootknee(DDukeActor* actor, int p, DVector3 pos, DAngle ang)
if (p >= 0)
{
setFreeAimVelocity(vel, zvel, ps[p].horizon.sum(), 16.);
setFreeAimVelocity(vel, zvel, ps[p].horizon.horizSUM(), 16.);
pos.Z += 6;
ang += DAngle1 * 2.64;
}
@ -365,14 +365,14 @@ static void shootweapon(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int
if (aimed == nullptr)
{
// no target
setFreeAimVelocity(vel, zvel, ps[p].horizon.sum(), 16.);
setFreeAimVelocity(vel, zvel, ps[p].horizon.horizSUM(), 16.);
}
zvel += (zRange / 2) - krandf(zRange);
}
else if (aimed == nullptr)
{
ang += DAngle22_5 / 8 - randomAngle(22.5 / 4);
setFreeAimVelocity(vel, zvel, ps[p].horizon.sum(), 16.);
setFreeAimVelocity(vel, zvel, ps[p].horizon.horizSUM(), 16.);
zvel += 0.5 - krandf(1);
}
@ -596,7 +596,7 @@ static void shootstuff(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int a
ang = (aimed->spr.pos.XY() - pos.XY()).Angle();
}
else
setFreeAimVelocity(vel, zvel, ps[p].horizon.sum(), 49.);
setFreeAimVelocity(vel, zvel, ps[p].horizon.horizSUM(), 49.);
}
else
{
@ -683,7 +683,7 @@ static void shootrpg(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int atw
ang = (aimed->spr.pos.XY() - pos.XY()).Angle();
}
else
setFreeAimVelocity(vel, zvel, ps[p].horizon.sum(), 40.5);
setFreeAimVelocity(vel, zvel, ps[p].horizon.horizSUM(), 40.5);
if (atwith == RPG)
S_PlayActorSound(RPG_SHOOT, actor);
@ -822,7 +822,7 @@ static void shootlaser(DDukeActor* actor, int p, DVector3 pos, DAngle ang)
HitInfo hit{};
if (p >= 0)
setFreeAimVelocity(vel, zvel, ps[p].horizon.sum(), 16.);
setFreeAimVelocity(vel, zvel, ps[p].horizon.horizSUM(), 16.);
else zvel = 0;
hitscan(pos, sectp, DVector3(ang.ToVector() * vel, zvel * 64), hit, CLIPMASK1);
@ -921,7 +921,7 @@ static void shootgrowspark(DDukeActor* actor, int p, DVector3 pos, DAngle ang)
else
{
ang += DAngle22_5 / 8 - randomAngle(22.5 / 4);
setFreeAimVelocity(vel, zvel, ps[p].horizon.sum(), 16.);
setFreeAimVelocity(vel, zvel, ps[p].horizon.horizSUM(), 16.);
zvel += 0.5 - krandf(1);
}
@ -1015,7 +1015,7 @@ static void shootshrinker(DDukeActor* actor, int p, const DVector3& pos, DAngle
ang = (aimed->spr.pos.XY() - pos.XY()).Angle();
}
else
setFreeAimVelocity(vel, zvel, ps[p].horizon.sum(), 49.);
setFreeAimVelocity(vel, zvel, ps[p].horizon.horizSUM(), 49.);
}
else if (actor->spr.statnum != 3)
{
@ -2010,7 +2010,7 @@ int operateTripbomb(int snum)
auto p = &ps[snum];
HitInfo hit{};
double vel = 1024, zvel = 0;
setFreeAimVelocity(vel, zvel, p->horizon.sum(), 16.);
setFreeAimVelocity(vel, zvel, p->horizon.horizSUM(), 16.);
hitscan(p->GetActor()->getPosWithOffsetZ(), p->cursector, DVector3(p->angle.ang.ToVector() * vel, zvel), hit, CLIPMASK1);
@ -2200,12 +2200,12 @@ static void operateweapon(int snum, ESyncBits actions)
if (p->on_ground && (actions & SB_CROUCH))
{
vel = 15/16.;
zvel = p->horizon.sum().Sin() * 10.;
zvel = p->horizon.horizSUM().Sin() * 10.;
}
else
{
vel = 140/16.;
setFreeAimVelocity(vel, zvel, p->horizon.sum(), 10.);
setFreeAimVelocity(vel, zvel, p->horizon.horizSUM(), 10.);
zvel -= 4;
}

View file

@ -91,7 +91,7 @@ static void shootmelee(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int a
if (p >= 0)
{
setFreeAimVelocity(vel, zvel, ps[p].horizon.sum(), 16.);
setFreeAimVelocity(vel, zvel, ps[p].horizon.horizSUM(), 16.);
pos.Z += 6;
ang += DAngle1 * 2.64;
}
@ -224,7 +224,7 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int
if (aimed == nullptr)
{
ang += DAngle22_5 / 8 - randomAngle(22.5 / 4);
setFreeAimVelocity(vel, zvel, ps[p].horizon.sum(), 16.);
setFreeAimVelocity(vel, zvel, ps[p].horizon.horizSUM(), 16.);
zvel += 0.5 - krandf(1);
}
}
@ -234,7 +234,7 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int
ang += DAngle22_5 / 2 - randomAngle(22.5);
else
ang += DAngle22_5 / 8 - randomAngle(22.5 / 4);
if (aimed == nullptr) setFreeAimVelocity(vel, zvel, ps[p].horizon.sum(), 16.);
if (aimed == nullptr) setFreeAimVelocity(vel, zvel, ps[p].horizon.horizSUM(), 16.);
zvel += 0.5 - krandf(1);
}
pos.Z -= 2;
@ -511,7 +511,7 @@ static void shootstuff(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int a
}
else
{
setFreeAimVelocity(vel, zvel, ps[p].horizon.sum(), 49.);
setFreeAimVelocity(vel, zvel, ps[p].horizon.horizSUM(), 49.);
}
}
else
@ -596,7 +596,7 @@ static void shootrpg(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int atw
ang = (aimed->spr.pos.XY() - pos.XY()).Angle();
}
else
setFreeAimVelocity(vel, zvel, ps[p].horizon.sum(), 40.5);
setFreeAimVelocity(vel, zvel, ps[p].horizon.horizSUM(), 40.5);
if (atwith == RPG)
S_PlayActorSound(RPG_SHOOT, actor);
@ -746,7 +746,7 @@ static void shootwhip(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int at
ang = (aimed->spr.pos.XY() - pos.XY()).Angle();
}
else
setFreeAimVelocity(vel, zvel, ps[p].horizon.sum(), 49.);
setFreeAimVelocity(vel, zvel, ps[p].horizon.horizSUM(), 49.);
}
else
{
@ -2674,12 +2674,12 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
if (p->on_ground && (actions & SB_CROUCH))
{
vel = 15 / 16.;
zvel = p->horizon.sum().Sin() * 10.;
zvel = p->horizon.horizSUM().Sin() * 10.;
}
else
{
vel = 140 / 16.;
setFreeAimVelocity(vel, zvel, p->horizon.sum(), 10.);
setFreeAimVelocity(vel, zvel, p->horizon.horizSUM(), 10.);
zvel -= 4;
}
@ -3082,12 +3082,12 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
if (p->on_ground && (actions & SB_CROUCH) && !p->OnMotorcycle)
{
vel = 15 / 16.;
setFreeAimVelocity(vel, zvel, p->horizon.sum(), 10.);
setFreeAimVelocity(vel, zvel, p->horizon.horizSUM(), 10.);
}
else
{
vel = 2.;
setFreeAimVelocity(vel, zvel, p->horizon.sum(), 10.);
setFreeAimVelocity(vel, zvel, p->horizon.horizSUM(), 10.);
zvel -= 4;
}

View file

@ -333,12 +333,12 @@ void operateweapon_ww(int snum, ESyncBits actions)
if (p->on_ground && (actions & SB_CROUCH))
{
vel = 15 / 16.;
setFreeAimVelocity(vel, zvel, p->horizon.sum(), 10.);
setFreeAimVelocity(vel, zvel, p->horizon.horizSUM(), 10.);
}
else
{
vel = 140 / 16.;
setFreeAimVelocity(vel, zvel, p->horizon.sum(), 10.);
setFreeAimVelocity(vel, zvel, p->horizon.horizSUM(), 10.);
zvel -= 4;
}

View file

@ -299,13 +299,13 @@ void displayrooms(int snum, double interpfrac, bool sceneonly)
{
// Original code for when the values are passed through the sync struct
cang = p->angle.interpolatedsum(interpfrac);
choriz = p->horizon.interpolatedsum(interpfrac);
choriz = p->horizon.horizLERPSUM(interpfrac);
}
else
{
// This is for real time updating of the view direction.
cang = p->angle.sum();
choriz = p->horizon.sum();
choriz = p->horizon.horizSUM();
}
}

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].GetActor()->getOffsetZ() + ps[snum].pyoff + (ps[snum].horizon.sum().Tan() * 8.) + (!isshell ? 3 : 0);
act->spr.pos.Z = 3 + ps[snum].GetActor()->getOffsetZ() + ps[snum].pyoff + (ps[snum].horizon.horizSUM().Tan() * 8.) + (!isshell ? 3 : 0);
act->vel.Z = -krandf(1);
}
else

View file

@ -234,13 +234,13 @@ void DrawView(double interpfrac, bool sceneonly)
if (!SyncInput())
{
nCamerapan = PlayerList[nLocalPlayer].horizon.sum();
nCamerapan = PlayerList[nLocalPlayer].horizon.horizSUM();
nCameraang = PlayerList[nLocalPlayer].angle.sum();
rotscrnang = PlayerList[nLocalPlayer].angle.rotscrnang;
}
else
{
nCamerapan = PlayerList[nLocalPlayer].horizon.interpolatedsum(interpfrac);
nCamerapan = PlayerList[nLocalPlayer].horizon.horizLERPSUM(interpfrac);
nCameraang = PlayerList[nLocalPlayer].angle.interpolatedsum(interpfrac);
rotscrnang = PlayerList[nLocalPlayer].angle.interpolatedrotscrn(interpfrac);
}

View file

@ -1245,13 +1245,13 @@ void drawscreen(PLAYER* pp, double interpfrac, bool sceneonly)
if (SyncInput() || pp != Player+myconnectindex)
{
tang = camerapp->angle.interpolatedsum(interpfrac);
thoriz = camerapp->horizon.interpolatedsum(interpfrac);
thoriz = camerapp->horizon.horizLERPSUM(interpfrac);
trotscrnang = camerapp->angle.interpolatedrotscrn(interpfrac);
}
else
{
tang = pp->angle.sum();
thoriz = pp->horizon.sum();
thoriz = pp->horizon.horizSUM();
trotscrnang = pp->angle.rotscrnang;
}
tsect = camerapp->cursector;