- Rename PlayerAngle getters in preparation for replacement work.

This commit is contained in:
Mitchell Richters 2022-11-25 16:46:48 +11:00 committed by Christoph Oelckers
parent a061f2baef
commit f305fbb370
13 changed files with 46 additions and 46 deletions

View file

@ -122,14 +122,14 @@ struct PlayerAngle
}
// Commonly used getters.
DAngle osum() { return ZzOLDANGLE + ZzOLDLOOKANG; }
DAngle sum() { return ZzANGLE + ZzLOOKANG; }
DAngle interpolatedsum(double const interpfrac) { return interpolatedvalue(osum(), sum(), interpfrac); }
DAngle interpolatedang(double const interpfrac) { return interpolatedvalue(ZzOLDANGLE, ZzANGLE, interpfrac); }
DAngle interpolatedlookang(double const interpfrac) { return interpolatedvalue(ZzOLDLOOKANG, ZzLOOKANG, interpfrac); }
DAngle interpolatedrotscrn(double const interpfrac) { return interpolatedvalue(ZzOLDROTSCRNANG, ZzROTSCRNANG, interpfrac); }
DAngle renderlookang(double const interpfrac) { return !SyncInput() ? ZzLOOKANG : interpolatedlookang(interpfrac); }
DAngle renderrotscrn(double const interpfrac) { return !SyncInput() ? ZzROTSCRNANG : interpolatedrotscrn(interpfrac); }
DAngle angOLDSUM() { return ZzOLDANGLE + ZzOLDLOOKANG; }
DAngle angSUM() { return ZzANGLE + ZzLOOKANG; }
DAngle angLERPSUM(double const interpfrac) { return interpolatedvalue(angOLDSUM(), angSUM(), interpfrac); }
DAngle angLERPANG(double const interpfrac) { return interpolatedvalue(ZzOLDANGLE, ZzANGLE, interpfrac); }
DAngle angLERPLOOKANG(double const interpfrac) { return interpolatedvalue(ZzOLDLOOKANG, ZzLOOKANG, interpfrac); }
DAngle angLERPROTSCRN(double const interpfrac) { return interpolatedvalue(ZzOLDROTSCRNANG, ZzROTSCRNANG, interpfrac); }
DAngle angRENDERLOOKANG(double const interpfrac) { return !SyncInput() ? ZzLOOKANG : angLERPLOOKANG(interpfrac); }
DAngle angRENDERROTSCRN(double const interpfrac) { return !SyncInput() ? ZzROTSCRNANG : angLERPROTSCRN(interpfrac); }
// Ticrate playsim adjustment helpers.
void resetadjustment() { adjustment = nullAngle; }
@ -141,19 +141,19 @@ struct PlayerAngle
bool movementlocked() { return targetset() || inputdisabled; }
// Draw code helpers. The logic where these are used rely heavily on Build's angle period.
double look_anghalf(double const interpfrac) { return renderlookang(interpfrac).Normalized180().Degrees() * (128. / 45.); }
double looking_arc(double const interpfrac) { return fabs(renderlookang(interpfrac).Normalized180().Degrees() * (1024. / 1620.)); }
double angLOOKANGHALF(double const interpfrac) { return angRENDERLOOKANG(interpfrac).Normalized180().Degrees() * (128. / 45.); }
double angLOOKINGARC(double const interpfrac) { return fabs(angRENDERLOOKANG(interpfrac).Normalized180().Degrees() * (1024. / 1620.)); }
// Crosshair x/y offsets based on look_ang's tangent.
DVector2 crosshairoffsets(const double interpfrac)
DVector2 angCROSSHAIROFFSETS(const double interpfrac)
{
return DVector2(159.72, 145.5 * renderrotscrn(interpfrac).Sin()) * -renderlookang(interpfrac).Tan() * (1. / tan(r_fov * pi::pi() / 360.));
return DVector2(159.72, 145.5 * angRENDERROTSCRN(interpfrac).Sin()) * -angRENDERLOOKANG(interpfrac).Tan() * (1. / tan(r_fov * pi::pi() / 360.));
}
// Weapon x/y offsets based on the above.
DVector2 weaponoffsets(const double interpfrac)
DVector2 angWEAPONOFFSETS(const double interpfrac)
{
auto offsets = crosshairoffsets(interpfrac); offsets.Y = abs(offsets.Y) * 4.;
auto offsets = angCROSSHAIROFFSETS(interpfrac); offsets.Y = abs(offsets.Y) * 4.;
return offsets;
}

View file

@ -108,7 +108,7 @@ void hudDraw(PLAYER* pPlayer, sectortype* pSector, double bobx, double boby, dou
{
if (gViewPos == 0)
{
auto cXY = DVector2(160, 220) + pPlayer->angle.weaponoffsets(interpfrac);
auto cXY = DVector2(160, 220) + pPlayer->angle.angWEAPONOFFSETS(interpfrac);
if (cl_weaponsway)
{

View file

@ -446,7 +446,7 @@ static void DrawMap(PLAYER* pPlayer, const double interpfrac)
setViewport(Hud_Stbar);
tm = 1;
}
auto ang = !SyncInput() ? pPlayer->angle.sum() : pPlayer->angle.interpolatedsum(interpfrac);
auto ang = !SyncInput() ? pPlayer->angle.angSUM() : pPlayer->angle.angLERPSUM(interpfrac);
DrawOverheadMap(pPlayer->actor->interpolatedpos(interpfrac).XY(), ang, interpfrac);
if (tm)
setViewport(hud_size);
@ -501,15 +501,15 @@ static void SetupView(PLAYER* pPlayer, DVector3& cPos, DAngle& cA, DAngle& cH, s
if (!SyncInput())
{
cA = pPlayer->angle.sum();
cA = pPlayer->angle.angSUM();
cH = pPlayer->horizon.horizSUM();
rotscrnang = pPlayer->angle.ZzROTSCRNANG;
}
else
{
cA = pPlayer->angle.interpolatedsum(interpfrac);
cA = pPlayer->angle.angLERPSUM(interpfrac);
cH = pPlayer->horizon.horizLERPSUM(interpfrac);
rotscrnang = pPlayer->angle.interpolatedrotscrn(interpfrac);
rotscrnang = pPlayer->angle.angLERPROTSCRN(interpfrac);
}
}
@ -742,8 +742,8 @@ void viewDrawScreen(bool sceneonly)
bDeliriumOld = bDelirium && gDeliriumBlur;
if (sceneonly) return;
auto offsets = pPlayer->angle.crosshairoffsets(interpfrac);
DrawCrosshair(kCrosshairTile, pPlayer->actor->xspr.health >> 4, offsets.X, offsets.Y, 2, -pPlayer->angle.interpolatedrotscrn(interpfrac));
auto offsets = pPlayer->angle.angCROSSHAIROFFSETS(interpfrac);
DrawCrosshair(kCrosshairTile, pPlayer->actor->xspr.health >> 4, offsets.X, offsets.Y, 2, -pPlayer->angle.angLERPROTSCRN(interpfrac));
#if 0 // This currently does not work. May have to be redone as a hardware effect.
if (v4 && gNetPlayers > 1)
{

View file

@ -291,8 +291,8 @@ void drawoverlays(double interpfrac)
if (ps[myconnectindex].newOwner == nullptr && ud.cameraactor == nullptr)
{
auto offsets = pp->angle.crosshairoffsets(interpfrac);
DrawCrosshair(TILE_CROSSHAIR, ps[screenpeek].last_extra, offsets.X, offsets.Y + (pp->over_shoulder_on ? 2.5 : 0), isRR() ? 0.5 : 1, -pp->angle.interpolatedrotscrn(interpfrac));
auto offsets = pp->angle.angCROSSHAIROFFSETS(interpfrac);
DrawCrosshair(TILE_CROSSHAIR, ps[screenpeek].last_extra, offsets.X, offsets.Y + (pp->over_shoulder_on ? 2.5 : 0), isRR() ? 0.5 : 1, -pp->angle.angLERPROTSCRN(interpfrac));
}
if (paused == 2)

View file

@ -228,11 +228,11 @@ void displayweapon_d(int snum, double interpfrac)
hard_landing *= 8.;
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 offsets = p->angle.angWEAPONOFFSETS(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);
auto angle = p->angle.angRENDERROTSCRN(interpfrac);
auto weapon_xoffset = 160 - 90 - (BobVal(512 + weapon_sway * 0.5) * (16384. / 1536.)) - 58 - p->weapon_ang;
auto shade = min(p->GetActor()->spr.shade, (int8_t)24);

View file

@ -133,8 +133,8 @@ void displayweapon_r(int snum, double interpfrac)
TiltStatus = p->TiltStatus;
}
look_anghalf = p->angle.look_anghalf(interpfrac);
looking_arc = p->angle.looking_arc(interpfrac);
look_anghalf = p->angle.angLOOKANGHALF(interpfrac);
looking_arc = p->angle.angLOOKINGARC(interpfrac);
hard_landing *= 8.;
gun_pos -= fabs(p->GetActor()->spr.scale.X < 0.125 ? BobVal(weapon_sway * 4.) * 32 : BobVal(weapon_sway * 0.5) * 16);

View file

@ -271,7 +271,7 @@ void displayrooms(int snum, double interpfrac, bool sceneonly)
setgamepalette(setpal(p));
// set screen rotation.
rotscrnang = !SyncInput() ? p->angle.ZzROTSCRNANG : p->angle.interpolatedrotscrn(interpfrac);
rotscrnang = !SyncInput() ? p->angle.ZzROTSCRNANG : p->angle.angLERPROTSCRN(interpfrac);
// use player's actor initially.
viewer = p->GetActor();
@ -298,13 +298,13 @@ void displayrooms(int snum, double interpfrac, bool sceneonly)
if (SyncInput())
{
// Original code for when the values are passed through the sync struct
cang = p->angle.interpolatedsum(interpfrac);
cang = p->angle.angLERPSUM(interpfrac);
choriz = p->horizon.horizLERPSUM(interpfrac);
}
else
{
// This is for real time updating of the view direction.
cang = p->angle.sum();
cang = p->angle.angSUM();
choriz = p->horizon.horizSUM();
}
}

View file

@ -87,8 +87,8 @@ void GameInterface::Render()
if (nFreeze != 2) // Hide when Ramses is talking.
{
DrawStatusBar();
auto offsets = PlayerList[nLocalPlayer].angle.crosshairoffsets(interpfrac);
DrawCrosshair(kCrosshairTile, PlayerList[nLocalPlayer].nHealth >> 3, offsets.X, offsets.Y, 1, -PlayerList[nLocalPlayer].angle.interpolatedrotscrn(interpfrac));
auto offsets = PlayerList[nLocalPlayer].angle.angCROSSHAIROFFSETS(interpfrac);
DrawCrosshair(kCrosshairTile, PlayerList[nLocalPlayer].nHealth >> 3, offsets.X, offsets.Y, 1, -PlayerList[nLocalPlayer].angle.angLERPROTSCRN(interpfrac));
if (paused && !M_Active())
{

View file

@ -1000,8 +1000,8 @@ void DrawWeapons(double interpfrac)
nShade = PlayerList[nLocalPlayer].pActor->spr.shade;
}
double const look_anghalf = PlayerList[nLocalPlayer].angle.look_anghalf(interpfrac);
double const looking_arc = PlayerList[nLocalPlayer].angle.looking_arc(interpfrac);
double const look_anghalf = PlayerList[nLocalPlayer].angle.angLOOKANGHALF(interpfrac);
double const looking_arc = PlayerList[nLocalPlayer].angle.angLOOKINGARC(interpfrac);
xOffset -= look_anghalf;
yOffset += looking_arc;

View file

@ -55,7 +55,7 @@ void DrawMap(double const interpfrac)
if (!nFreeze && automapMode != am_off)
{
auto pPlayerActor = PlayerList[nLocalPlayer].pActor;
auto ang = !SyncInput() ? PlayerList[nLocalPlayer].angle.sum() : PlayerList[nLocalPlayer].angle.interpolatedsum(interpfrac);
auto ang = !SyncInput() ? PlayerList[nLocalPlayer].angle.angSUM() : PlayerList[nLocalPlayer].angle.angLERPSUM(interpfrac);
DrawOverheadMap(pPlayerActor->interpolatedpos(interpfrac).XY(), ang, interpfrac);
}
}

View file

@ -235,14 +235,14 @@ void DrawView(double interpfrac, bool sceneonly)
if (!SyncInput())
{
nCamerapan = PlayerList[nLocalPlayer].horizon.horizSUM();
nCameraang = PlayerList[nLocalPlayer].angle.sum();
nCameraang = PlayerList[nLocalPlayer].angle.angSUM();
rotscrnang = PlayerList[nLocalPlayer].angle.ZzROTSCRNANG;
}
else
{
nCamerapan = PlayerList[nLocalPlayer].horizon.horizLERPSUM(interpfrac);
nCameraang = PlayerList[nLocalPlayer].angle.interpolatedsum(interpfrac);
rotscrnang = PlayerList[nLocalPlayer].angle.interpolatedrotscrn(interpfrac);
nCameraang = PlayerList[nLocalPlayer].angle.angLERPSUM(interpfrac);
rotscrnang = PlayerList[nLocalPlayer].angle.angLERPROTSCRN(interpfrac);
}
if (!bCamera)

View file

@ -812,7 +812,7 @@ static void analyzesprites(tspriteArray& tsprites, const DVector3& viewpos, doub
{
pp = tActor->user.PlayerP;
tsp->pos = pp->actor->getRenderPos(interpfrac);
tsp->Angles.Yaw = pp->angle.interpolatedang(interpfrac);
tsp->Angles.Yaw = pp->angle.angLERPANG(interpfrac);
}
}
@ -1021,8 +1021,8 @@ void PrintSpriteInfo(PLAYER* pp)
static void DrawCrosshair(PLAYER* pp, const double interpfrac)
{
auto offsets = pp->angle.crosshairoffsets(interpfrac);
::DrawCrosshair(2326, pp->actor->user.Health, offsets.X, offsets.Y + ((pp->Flags & PF_VIEW_FROM_OUTSIDE) ? 5 : 0), 2, -pp->angle.interpolatedrotscrn(interpfrac), shadeToLight(10));
auto offsets = pp->angle.angCROSSHAIROFFSETS(interpfrac);
::DrawCrosshair(2326, pp->actor->user.Health, offsets.X, offsets.Y + ((pp->Flags & PF_VIEW_FROM_OUTSIDE) ? 5 : 0), 2, -pp->angle.angLERPROTSCRN(interpfrac), shadeToLight(10));
}
//---------------------------------------------------------------------------
@ -1244,13 +1244,13 @@ void drawscreen(PLAYER* pp, double interpfrac, bool sceneonly)
DVector3 tpos = camerapp->actor->getRenderPos(interpfrac);
if (SyncInput() || pp != Player+myconnectindex)
{
tang = camerapp->angle.interpolatedsum(interpfrac);
tang = camerapp->angle.angLERPSUM(interpfrac);
thoriz = camerapp->horizon.horizLERPSUM(interpfrac);
trotscrnang = camerapp->angle.interpolatedrotscrn(interpfrac);
trotscrnang = camerapp->angle.angLERPROTSCRN(interpfrac);
}
else
{
tang = pp->angle.sum();
tang = pp->angle.angSUM();
thoriz = pp->horizon.horizSUM();
trotscrnang = pp->angle.ZzROTSCRNANG;
}

View file

@ -7428,8 +7428,8 @@ void pDisplaySprites(PLAYER* pp, double interpfrac)
double ang;
int flags;
const auto offsets = pp->angle.weaponoffsets(interpfrac);
const auto angle = pp->angle.renderrotscrn(interpfrac).Buildfang();
const auto offsets = pp->angle.angWEAPONOFFSETS(interpfrac);
const auto angle = pp->angle.angRENDERROTSCRN(interpfrac).Buildfang();
auto list = pp->GetPanelSpriteList();
for (auto psp = list->Next; next = psp->Next, psp != list; psp = next)