From b9f5bb71cc072a11b5e689ff12ad7eac4629f7b0 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Fri, 25 Nov 2022 17:09:11 +1100 Subject: [PATCH] - Merge `PlayerHorizon` and `PlayerAngle` structs into `PlayerAngles` struct. --- source/core/gameinput.cpp | 27 +--- source/core/gameinput.h | 211 ++++++++++++-------------- source/games/blood/src/controls.cpp | 8 +- source/games/blood/src/hudsprites.cpp | 2 +- source/games/blood/src/nnexts.cpp | 14 +- source/games/blood/src/osdcmd.cpp | 2 +- source/games/blood/src/player.cpp | 32 ++-- source/games/blood/src/player.h | 3 +- source/games/blood/src/triggers.cpp | 12 +- source/games/blood/src/view.cpp | 22 +-- source/games/duke/src/actors.cpp | 26 ++-- source/games/duke/src/actors_d.cpp | 14 +- source/games/duke/src/actors_r.cpp | 6 +- source/games/duke/src/ccmds.cpp | 2 +- source/games/duke/src/game_misc.cpp | 8 +- source/games/duke/src/gameexec.cpp | 54 +++---- source/games/duke/src/hudweapon_d.cpp | 6 +- source/games/duke/src/hudweapon_r.cpp | 4 +- source/games/duke/src/inlines.h | 2 +- source/games/duke/src/input.cpp | 18 +-- source/games/duke/src/player.cpp | 34 ++--- source/games/duke/src/player_d.cpp | 48 +++--- source/games/duke/src/player_r.cpp | 124 +++++++-------- source/games/duke/src/player_w.cpp | 8 +- source/games/duke/src/prediction.cpp | 6 +- source/games/duke/src/premap.cpp | 18 +-- source/games/duke/src/render.cpp | 10 +- source/games/duke/src/savegame.cpp | 4 +- source/games/duke/src/sectors.cpp | 4 +- source/games/duke/src/sectors_d.cpp | 20 +-- source/games/duke/src/sectors_r.cpp | 18 +-- source/games/duke/src/sounds.cpp | 2 +- source/games/duke/src/spawn.cpp | 4 +- source/games/duke/src/types.h | 3 +- source/games/duke/src/vmexports.cpp | 4 +- source/games/exhumed/src/gameloop.cpp | 4 +- source/games/exhumed/src/gun.cpp | 10 +- source/games/exhumed/src/input.cpp | 8 +- source/games/exhumed/src/map.cpp | 2 +- source/games/exhumed/src/osdcmds.cpp | 2 +- source/games/exhumed/src/player.cpp | 62 ++++---- source/games/exhumed/src/player.h | 3 +- source/games/exhumed/src/sequence.cpp | 2 +- source/games/exhumed/src/view.cpp | 12 +- source/games/sw/src/draw.cpp | 20 +-- source/games/sw/src/game.cpp | 2 +- source/games/sw/src/game.h | 5 +- source/games/sw/src/input.cpp | 6 +- source/games/sw/src/jsector.cpp | 2 +- source/games/sw/src/jweapon.cpp | 10 +- source/games/sw/src/mclip.cpp | 2 +- source/games/sw/src/ninja.cpp | 4 +- source/games/sw/src/osdcmds.cpp | 2 +- source/games/sw/src/panel.cpp | 4 +- source/games/sw/src/player.cpp | 108 ++++++------- source/games/sw/src/save.cpp | 4 +- source/games/sw/src/sector.cpp | 6 +- source/games/sw/src/sounds.cpp | 2 +- source/games/sw/src/track.cpp | 8 +- source/games/sw/src/weapon.cpp | 112 +++++++------- source/games/sw/src/zombie.cpp | 2 +- 61 files changed, 573 insertions(+), 611 deletions(-) diff --git a/source/core/gameinput.cpp b/source/core/gameinput.cpp index d412d91ae..0bc384ddb 100644 --- a/source/core/gameinput.cpp +++ b/source/core/gameinput.cpp @@ -173,7 +173,7 @@ void processMovement(InputPacket* const currInput, InputPacket* const inputBuffe // //--------------------------------------------------------------------------- -void PlayerHorizon::applyPitch(float const horz, ESyncBits* actions, double const scaleAdjust) +void PlayerAngles::applyPitch(float const horz, ESyncBits* actions, double const scaleAdjust) { // Process only if movement isn't locked. if (!lockedPitch()) @@ -222,7 +222,7 @@ void PlayerHorizon::applyPitch(float const horz, ESyncBits* actions, double cons // //--------------------------------------------------------------------------- -void PlayerAngle::applyYaw(float const avel, ESyncBits* actions, double const scaleAdjust) +void PlayerAngles::applyYaw(float const avel, ESyncBits* actions, double const scaleAdjust) { // Process angle return to zeros. scaletozero(ZzROTSCRNANG, YAW_LOOKRETURN, scaleAdjust); @@ -277,7 +277,7 @@ void PlayerAngle::applyYaw(float const avel, ESyncBits* actions, double const sc // //--------------------------------------------------------------------------- -void PlayerHorizon::doViewPitch(const DVector2& pos, DAngle const ang, bool const aimmode, bool const canslopetilt, sectortype* const cursectnum, double const scaleAdjust, bool const climbing) +void PlayerAngles::doViewPitch(const DVector2& pos, DAngle const ang, bool const aimmode, bool const canslopetilt, sectortype* const cursectnum, double const scaleAdjust, bool const climbing) { if (cl_slopetilting && cursectnum != nullptr) { @@ -330,7 +330,7 @@ void PlayerHorizon::doViewPitch(const DVector2& pos, DAngle const ang, bool cons // //--------------------------------------------------------------------------- -FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngle& w, PlayerAngle* def) +FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngles& w, PlayerAngles* def) { if (arc.BeginObject(keyname)) { @@ -339,6 +339,9 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngle& w, Pl ("rotscrnang", w.ZzROTSCRNANG) ("spin", w.YawSpin) ("inputdisabled", w.legacyDisabledYaw) + ("horiz", w.ZzHORIZON) + ("horizoff", w.ZzHORIZOFF) + ("inputdisabled", w.legacyDisabledPitch) .EndObject(); if (arc.isReading()) @@ -348,22 +351,6 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngle& w, Pl w.ZzOLDROTSCRNANG = w.ZzROTSCRNANG; w.legacyDisabledYaw = w.legacyDisabledYaw; w.resetAdjustmentYaw(); - } - } - return arc; -} - -FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerHorizon& w, PlayerHorizon* def) -{ - if (arc.BeginObject(keyname)) - { - arc("horiz", w.ZzHORIZON) - ("horizoff", w.ZzHORIZOFF) - ("inputdisabled", w.legacyDisabledPitch) - .EndObject(); - - if (arc.isReading()) - { w.ZzOLDHORIZON = w.ZzHORIZON; w.ZzOHORIZOFF = w.ZzHORIZOFF; w.legacyDisabledPitch = w.legacyDisabledPitch; diff --git a/source/core/gameinput.h b/source/core/gameinput.h index 8d7cf5468..53e2339e3 100644 --- a/source/core/gameinput.h +++ b/source/core/gameinput.h @@ -6,43 +6,22 @@ #include "gamefuncs.h" #include "packet.h" -struct PlayerHorizon +struct PlayerAngles { - DAngle ZzHORIZON, ZzOLDHORIZON, ZzHORIZOFF, ZzOHORIZOFF; + friend FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngles& w, PlayerAngles* def); - friend FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerHorizon& w, PlayerHorizon* def); - - // Prototypes for functions in gameinput.cpp. + // Prototypes for applying input. void applyPitch(float const horz, ESyncBits* actions, double const scaleAdjust = 1); + void applyYaw(float const avel, ESyncBits* actions, double const scaleAdjust = 1); + + // Prototypes for applying view. void doViewPitch(const DVector2& pos, DAngle const ang, bool const aimmode, bool const canslopetilt, sectortype* const cursectnum, double const scaleAdjust = 1, bool const climbing = false); - // Interpolation helpers. - void backupPitch() - { - ZzOLDHORIZON = ZzHORIZON; - ZzOHORIZOFF = ZzHORIZOFF; - } - void restorePitch() - { - ZzHORIZON = ZzOLDHORIZON; - ZzHORIZOFF = ZzOHORIZOFF; - } - - // Commonly used getters. - 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 resetAdjustmentPitch() { legacyAdjustmentPitch = nullAngle; } - bool targetedPitch() { return legacyTargetPitch.Sgn(); } - - // Input locking helpers. + // Pitch methods. void lockPitch() { legacyDisabledPitch = true; } void unlockPitch() { legacyDisabledPitch = false; } + bool targetedPitch() { return legacyTargetPitch.Sgn(); } bool lockedPitch() { return targetedPitch() || legacyDisabledPitch; } - - // Ticrate playsim adjustment setters and processor. void addPitch(DAngle const value) { if (!SyncInput()) @@ -54,7 +33,6 @@ struct PlayerHorizon ZzHORIZON += value; } } - void setPitch(DAngle value, bool const backup = false) { // Clamp incoming variable because sometimes the caller can exceed bounds. @@ -71,93 +49,11 @@ struct PlayerHorizon } } - void processLegacyHelperPitch(double const scaleAdjust) - { - if (targetedPitch()) - { - auto delta = deltaangle(ZzHORIZON, legacyTargetPitch); - - if (abs(delta).Degrees() > 0.45) - { - ZzHORIZON += delta * scaleAdjust; - } - else - { - ZzHORIZON = legacyTargetPitch; - legacyTargetPitch = nullAngle; - } - } - else if (legacyAdjustmentPitch.Sgn()) - { - ZzHORIZON += legacyAdjustmentPitch * scaleAdjust; - } - } - -private: - DAngle legacyTargetPitch, legacyAdjustmentPitch; - bool legacyDisabledPitch; -}; - -struct PlayerAngle -{ - DAngle ZzANGLE, ZzOLDANGLE, ZzLOOKANG, ZzOLDLOOKANG, ZzROTSCRNANG, ZzOLDROTSCRNANG, YawSpin; - - friend FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngle& w, PlayerAngle* def); - - // Prototypes for functions in gameinput.cpp. - void applyYaw(float const avel, ESyncBits* actions, double const scaleAdjust = 1); - - // Interpolation helpers. - void backupYaw() - { - ZzOLDANGLE = ZzANGLE; - ZzOLDLOOKANG = ZzLOOKANG; - ZzOLDROTSCRNANG = ZzROTSCRNANG; - } - void restoreYaw() - { - ZzANGLE = ZzOLDANGLE; - ZzLOOKANG = ZzOLDLOOKANG; - ZzROTSCRNANG = ZzOLDROTSCRNANG; - } - - // Commonly used getters. - 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 resetAdjustmentYaw() { legacyAdjustmentYaw = nullAngle; } - bool targetedYaw() { return legacyTargetYaw.Sgn(); } - - // Input locking helpers. + // Yaw methods. void lockYaw() { legacyDisabledYaw = true; } void unlockYaw() { legacyDisabledYaw = false; } + bool targetedYaw() { return legacyTargetYaw.Sgn(); } bool lockedYaw() { return targetedYaw() || legacyDisabledYaw; } - - // Draw code helpers. The logic where these are used rely heavily on Build's angle period. - 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 angCROSSHAIROFFSETS(const double interpfrac) - { - 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 angWEAPONOFFSETS(const double interpfrac) - { - auto offsets = angCROSSHAIROFFSETS(interpfrac); offsets.Y = abs(offsets.Y) * 4.; - return offsets; - } - - // Ticrate playsim adjustment setters and processor. void addYaw(const DAngle value) { if (!SyncInput()) @@ -183,6 +79,63 @@ struct PlayerAngle } } + // Miscellaneous helpers. + 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 angCROSSHAIROFFSETS(const double interpfrac) + { + 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 angWEAPONOFFSETS(const double interpfrac) + { + auto offsets = angCROSSHAIROFFSETS(interpfrac); offsets.Y = abs(offsets.Y) * 4.; + return offsets; + } + + + // Legacy, to be removed. + DAngle ZzHORIZON, ZzOLDHORIZON, ZzHORIZOFF, ZzOHORIZOFF; + void processLegacyHelperPitch(double const scaleAdjust) + { + if (targetedPitch()) + { + auto delta = deltaangle(ZzHORIZON, legacyTargetPitch); + + if (abs(delta).Degrees() > 0.45) + { + ZzHORIZON += delta * scaleAdjust; + } + else + { + ZzHORIZON = legacyTargetPitch; + legacyTargetPitch = nullAngle; + } + } + else if (legacyAdjustmentPitch.Sgn()) + { + ZzHORIZON += legacyAdjustmentPitch * scaleAdjust; + } + } + void backupPitch() + { + ZzOLDHORIZON = ZzHORIZON; + ZzOHORIZOFF = ZzHORIZOFF; + } + void restorePitch() + { + ZzHORIZON = ZzOLDHORIZON; + ZzHORIZOFF = ZzOHORIZOFF; + } + DAngle horizOLDSUM() { return ZzOLDHORIZON + ZzOHORIZOFF; } + DAngle horizSUM() { return ZzHORIZON + ZzHORIZOFF; } + DAngle horizLERPSUM(double const interpfrac) { return interpolatedvalue(horizOLDSUM(), horizSUM(), interpfrac); } + void resetAdjustmentPitch() { legacyAdjustmentPitch = nullAngle; } + + DAngle ZzANGLE, ZzOLDANGLE, ZzLOOKANG, ZzOLDLOOKANG, ZzROTSCRNANG, ZzOLDROTSCRNANG, YawSpin; void processLegacyHelperYaw(double const scaleAdjust) { if (targetedYaw()) @@ -204,15 +157,41 @@ struct PlayerAngle ZzANGLE += legacyAdjustmentYaw * scaleAdjust; } } + void backupYaw() + { + ZzOLDANGLE = ZzANGLE; + ZzOLDLOOKANG = ZzLOOKANG; + ZzOLDROTSCRNANG = ZzROTSCRNANG; + } + void restoreYaw() + { + ZzANGLE = ZzOLDANGLE; + ZzLOOKANG = ZzOLDLOOKANG; + ZzROTSCRNANG = ZzOLDROTSCRNANG; + } + 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); } + void resetAdjustmentYaw() { legacyAdjustmentYaw = nullAngle; } private: + + + // Legacy, to be removed. + DAngle legacyTargetPitch, legacyAdjustmentPitch; + bool legacyDisabledPitch; + DAngle legacyTargetYaw, legacyAdjustmentYaw; bool legacyDisabledYaw; }; class FSerializer; -FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngle& w, PlayerAngle* def); -FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerHorizon& w, PlayerHorizon* def); +FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngles& w, PlayerAngles* def); void updateTurnHeldAmt(double const scaleAdjust); diff --git a/source/games/blood/src/controls.cpp b/source/games/blood/src/controls.cpp index 26d7f5483..5712ab261 100644 --- a/source/games/blood/src/controls.cpp +++ b/source/games/blood/src/controls.cpp @@ -62,13 +62,13 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju // Perform unsynchronised angle/horizon if not dead. if (pPlayer->actor->xspr.health != 0) { - pPlayer->angle.applyYaw(input.avel, &pPlayer->input.actions, scaleAdjust); - pPlayer->horizon.applyPitch(input.horz, &pPlayer->input.actions, scaleAdjust); + pPlayer->Angles.applyYaw(input.avel, &pPlayer->input.actions, scaleAdjust); + pPlayer->Angles.applyPitch(input.horz, &pPlayer->input.actions, scaleAdjust); doslopetilting(pPlayer, scaleAdjust); } - pPlayer->angle.processLegacyHelperYaw(scaleAdjust); - pPlayer->horizon.processLegacyHelperPitch(scaleAdjust); + pPlayer->Angles.processLegacyHelperYaw(scaleAdjust); + pPlayer->Angles.processLegacyHelperPitch(scaleAdjust); UpdatePlayerSpriteAngle(pPlayer); } diff --git a/source/games/blood/src/hudsprites.cpp b/source/games/blood/src/hudsprites.cpp index dbfecda8b..83a2cd796 100644 --- a/source/games/blood/src/hudsprites.cpp +++ b/source/games/blood/src/hudsprites.cpp @@ -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.angWEAPONOFFSETS(interpfrac); + auto cXY = DVector2(160, 220) + pPlayer->Angles.angWEAPONOFFSETS(interpfrac); if (cl_weaponsway) { diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 4ec3f6097..bca2ad5f5 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -2186,8 +2186,8 @@ void trPlayerCtrlSetLookAngle(int value, PLAYER* pPlayer) if (const double adjustment = clamp(value * 0.125 * (value > 0 ? lookStepUp : lookStepDown), downAngle, upAngle)) { - pPlayer->horizon.setPitch(maphoriz(-100. * tan(adjustment * pi::pi() * (1. / 1024.)))); - pPlayer->horizon.lockPitch(); + pPlayer->Angles.setPitch(maphoriz(-100. * tan(adjustment * pi::pi() * (1. / 1024.)))); + pPlayer->Angles.lockPitch(); } } @@ -6050,13 +6050,13 @@ bool modernTypeOperateSprite(DBloodActor* actor, EVENT& event) if (actor->xspr.data4 != 0) break; else if (actor->spr.flags & kModernTypeFlag1) { - pPlayer->angle.setYaw(actor->spr.Angles.Yaw); - pPlayer->angle.lockYaw(); + pPlayer->Angles.setYaw(actor->spr.Angles.Yaw); + pPlayer->Angles.lockYaw(); } else if (valueIsBetween(actor->xspr.data2, -kAng360, kAng360)) { - pPlayer->angle.setYaw(mapangle(actor->xspr.data2)); - pPlayer->angle.lockYaw(); + pPlayer->Angles.setYaw(mapangle(actor->xspr.data2)); + pPlayer->Angles.lockYaw(); } break; case 10: // 74 (de)activate powerup @@ -9278,7 +9278,7 @@ void changeSpriteAngle(DBloodActor* pSpr, DAngle nAng) { PLAYER* pPlayer = getPlayerById(pSpr->spr.type); if (pPlayer) - pPlayer->angle.ZzANGLE = nAng; + pPlayer->Angles.ZzANGLE = nAng; else { pSpr->spr.Angles.Yaw = nAng; diff --git a/source/games/blood/src/osdcmd.cpp b/source/games/blood/src/osdcmd.cpp index ff165b451..bf686d93e 100644 --- a/source/games/blood/src/osdcmd.cpp +++ b/source/games/blood/src/osdcmd.cpp @@ -40,7 +40,7 @@ void GameInterface::WarpToCoords(double x, double y, double z, DAngle ang) if (ang != DAngle::fromDeg(INT_MIN)) { - pPlayer->angle.ZzOLDANGLE = pPlayer->angle.ZzANGLE = ang; + pPlayer->Angles.ZzOLDANGLE = pPlayer->Angles.ZzANGLE = ang; } } diff --git a/source/games/blood/src/player.cpp b/source/games/blood/src/player.cpp index 5147f374a..395b50785 100644 --- a/source/games/blood/src/player.cpp +++ b/source/games/blood/src/player.cpp @@ -812,7 +812,7 @@ void playerStart(int nPlayer, int bNewLevel) GetActorExtents(actor, &top, &bottom); actor->spr.pos.Z -= bottom - actor->spr.pos.Z; actor->spr.pal = 11 + (pPlayer->teamId & 3); - actor->spr.Angles.Yaw = pPlayer->angle.ZzANGLE = pStartZone->angle; // check me out later. + actor->spr.Angles.Yaw = pPlayer->Angles.ZzANGLE = pStartZone->angle; // check me out later. actor->spr.type = kDudePlayer1 + nPlayer; actor->clipdist = pDudeInfo->fClipdist(); actor->spr.flags = 15; @@ -821,7 +821,7 @@ void playerStart(int nPlayer, int bNewLevel) pPlayer->actor->xspr.health = pDudeInfo->startHealth << 4; pPlayer->actor->spr.cstat &= ~CSTAT_SPRITE_INVISIBLE; pPlayer->bloodlust = 0; - pPlayer->horizon.ZzHORIZON = pPlayer->horizon.ZzHORIZOFF = nullAngle; + pPlayer->Angles.ZzHORIZON = pPlayer->Angles.ZzHORIZOFF = nullAngle; pPlayer->slope = 0; pPlayer->fragger = nullptr; pPlayer->underwaterTime = 1200; @@ -829,7 +829,7 @@ void playerStart(int nPlayer, int bNewLevel) pPlayer->restTime = 0; pPlayer->kickPower = 0; pPlayer->laughCount = 0; - pPlayer->angle.YawSpin = nullAngle; + pPlayer->Angles.YawSpin = nullAngle; pPlayer->posture = 0; pPlayer->voodooTarget = nullptr; pPlayer->voodooTargets = 0; @@ -1499,7 +1499,7 @@ int ActionScan(PLAYER* pPlayer, HitInfo* out) void UpdatePlayerSpriteAngle(PLAYER* pPlayer) { - pPlayer->actor->spr.Angles.Yaw = pPlayer->angle.ZzANGLE; // check me out later. + pPlayer->actor->spr.Angles.Yaw = pPlayer->Angles.ZzANGLE; // check me out later. } //--------------------------------------------------------------------------- @@ -1513,7 +1513,7 @@ void doslopetilting(PLAYER* pPlayer, double const scaleAdjust = 1) auto plActor = pPlayer->actor; int const florhit = pPlayer->actor->hit.florhit.type; bool const va = plActor->xspr.height < 16 && (florhit == kHitSector || florhit == 0) ? 1 : 0; - pPlayer->horizon.doViewPitch(plActor->spr.pos.XY(), plActor->spr.Angles.Yaw, va, plActor->sector()->floorstat & CSTAT_SECTOR_SLOPE, plActor->sector(), scaleAdjust); + pPlayer->Angles.doViewPitch(plActor->spr.pos.XY(), plActor->spr.Angles.Yaw, va, plActor->sector()->floorstat & CSTAT_SECTOR_SLOPE, plActor->sector(), scaleAdjust); } //--------------------------------------------------------------------------- @@ -1532,8 +1532,8 @@ void ProcessInput(PLAYER* pPlayer) Item_JumpBoots = 3 }; - pPlayer->horizon.resetAdjustmentPitch(); - pPlayer->angle.resetAdjustmentYaw(); + pPlayer->Angles.resetAdjustmentPitch(); + pPlayer->Angles.resetAdjustmentYaw(); DBloodActor* actor = pPlayer->actor; POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture]; @@ -1554,11 +1554,11 @@ void ProcessInput(PLAYER* pPlayer) DBloodActor* fragger = pPlayer->fragger; if (fragger) { - pPlayer->angle.addYaw(deltaangle(pPlayer->angle.ZzANGLE, (fragger->spr.pos.XY() - actor->spr.pos.XY()).Angle())); + pPlayer->Angles.addYaw(deltaangle(pPlayer->Angles.ZzANGLE, (fragger->spr.pos.XY() - actor->spr.pos.XY()).Angle())); } pPlayer->deathTime += 4; if (!bSeqStat) - pPlayer->horizon.addPitch(deltaangle(pPlayer->horizon.ZzHORIZON, gi->playerPitchMax() * (1. - BobVal(min((pPlayer->deathTime << 3) + 512, 1536))) * 0.5)); + pPlayer->Angles.addPitch(deltaangle(pPlayer->Angles.ZzHORIZON, gi->playerPitchMax() * (1. - BobVal(min((pPlayer->deathTime << 3) + 512, 1536))) * 0.5)); if (pPlayer->curWeapon) pInput->setNewWeapon(pPlayer->curWeapon); if (pInput->actions & SB_OPEN) @@ -1597,7 +1597,7 @@ void ProcessInput(PLAYER* pPlayer) if (SyncInput()) { - pPlayer->angle.applyYaw(pInput->avel, &pInput->actions); + pPlayer->Angles.applyYaw(pInput->avel, &pInput->actions); } // unconditionally update the player's sprite angle @@ -1726,14 +1726,14 @@ void ProcessInput(PLAYER* pPlayer) if (SyncInput()) { - pPlayer->horizon.applyPitch(pInput->horz, &pInput->actions); + pPlayer->Angles.applyPitch(pInput->horz, &pInput->actions); doslopetilting(pPlayer); } - pPlayer->angle.unlockYaw(); - pPlayer->horizon.unlockPitch(); + pPlayer->Angles.unlockYaw(); + pPlayer->Angles.unlockPitch(); - pPlayer->slope = pPlayer->horizon.ZzHORIZON.Tan(); + pPlayer->slope = pPlayer->Angles.ZzHORIZON.Tan(); if (pInput->actions & SB_INVPREV) { pInput->actions &= ~SB_INVPREV; @@ -2424,8 +2424,8 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PLAYER& w, PLAYER* if (arc.BeginObject(keyname)) { arc("spritenum", w.actor) - ("horizon", w.horizon) - ("angle", w.angle) + ("horizon", w.Angles) + ("angle", w.Angles) ("newweapon", w.newWeapon) ("used1", w.used1) ("weaponqav", w.weaponQav) diff --git a/source/games/blood/src/player.h b/source/games/blood/src/player.h index b22551715..f8f70db4a 100644 --- a/source/games/blood/src/player.h +++ b/source/games/blood/src/player.h @@ -83,8 +83,7 @@ struct PLAYER DBloodActor* actor; DUDEINFO* pDudeInfo; InputPacket input; - PlayerHorizon horizon; - PlayerAngle angle; + PlayerAngles Angles; uint8_t newWeapon; int used1; // something related to game checksum int weaponQav; diff --git a/source/games/blood/src/triggers.cpp b/source/games/blood/src/triggers.cpp index d6b72f1c3..d9d0cdf47 100644 --- a/source/games/blood/src/triggers.cpp +++ b/source/games/blood/src/triggers.cpp @@ -910,7 +910,7 @@ void TranslateSector(sectortype* pSector, double wave1, double wave2, const DVec viewBackupSpriteLoc(actor); actor->spr.pos.XY() = spot + pt_w2 - pivot; actor->spr.Angles.Yaw += angleofs; - if (!VanillaMode() && actor->IsPlayerActor()) gPlayer[actor->spr.type - kDudePlayer1].angle.addYaw(angleofs); + if (!VanillaMode() && actor->IsPlayerActor()) gPlayer[actor->spr.type - kDudePlayer1].Angles.addYaw(angleofs); } else if (actor->spr.cstat & CSTAT_SPRITE_MOVE_REVERSE) @@ -922,7 +922,7 @@ void TranslateSector(sectortype* pSector, double wave1, double wave2, const DVec viewBackupSpriteLoc(actor); actor->spr.pos.XY() = spot - pt_w2 + pivot; actor->spr.Angles.Yaw += angleofs; - if (!VanillaMode() && actor->IsPlayerActor()) gPlayer[actor->spr.type - kDudePlayer1].angle.addYaw(angleofs); + if (!VanillaMode() && actor->IsPlayerActor()) gPlayer[actor->spr.type - kDudePlayer1].Angles.addYaw(angleofs); } else if (pXSector->Drag) { @@ -938,7 +938,7 @@ void TranslateSector(sectortype* pSector, double wave1, double wave2, const DVec } actor->spr.Angles.Yaw += angleofs; actor->spr.pos += position; - if (!VanillaMode() && actor->IsPlayerActor()) gPlayer[actor->spr.type - kDudePlayer1].angle.addYaw(angleofs); + if (!VanillaMode() && actor->IsPlayerActor()) gPlayer[actor->spr.type - kDudePlayer1].Angles.addYaw(angleofs); } } } @@ -963,7 +963,7 @@ void TranslateSector(sectortype* pSector, double wave1, double wave2, const DVec viewBackupSpriteLoc(ac); ac->spr.pos.XY() = spot + pt_w2 - pivot; ac->spr.Angles.Yaw += angleofs; - if (!VanillaMode() && ac->IsPlayerActor()) gPlayer[ac->spr.type - kDudePlayer1].angle.addYaw(angleofs); + if (!VanillaMode() && ac->IsPlayerActor()) gPlayer[ac->spr.type - kDudePlayer1].Angles.addYaw(angleofs); } else if (ac->spr.cstat & CSTAT_SPRITE_MOVE_REVERSE) { @@ -971,7 +971,7 @@ void TranslateSector(sectortype* pSector, double wave1, double wave2, const DVec viewBackupSpriteLoc(ac); ac->spr.pos.XY() = spot - pt_w2 + pivot; ac->spr.Angles.Yaw += angleofs; - if (!VanillaMode() && ac->IsPlayerActor()) gPlayer[ac->spr.type - kDudePlayer1].angle.addYaw(angleofs); + if (!VanillaMode() && ac->IsPlayerActor()) gPlayer[ac->spr.type - kDudePlayer1].Angles.addYaw(angleofs); } } } @@ -1627,7 +1627,7 @@ void OperateTeleport(sectortype* pSector) { playerResetInertia(pPlayer); pPlayer->zViewVel = pPlayer->zWeaponVel = 0; - pPlayer->angle.setYaw(actor->spr.Angles.Yaw, true); + pPlayer->Angles.setYaw(actor->spr.Angles.Yaw, true); } } } diff --git a/source/games/blood/src/view.cpp b/source/games/blood/src/view.cpp index c58b63d38..9783d9fc5 100644 --- a/source/games/blood/src/view.cpp +++ b/source/games/blood/src/view.cpp @@ -65,8 +65,8 @@ void viewBackupView(int nPlayer) pPlayer->obobWidth = pPlayer->bobWidth; pPlayer->oswayHeight = pPlayer->swayHeight; pPlayer->oswayWidth = pPlayer->swayWidth; - pPlayer->angle.backupYaw(); - pPlayer->horizon.backupPitch(); + pPlayer->Angles.backupYaw(); + pPlayer->Angles.backupPitch(); } //--------------------------------------------------------------------------- @@ -446,7 +446,7 @@ static void DrawMap(PLAYER* pPlayer, const double interpfrac) setViewport(Hud_Stbar); tm = 1; } - auto ang = !SyncInput() ? pPlayer->angle.angSUM() : pPlayer->angle.angLERPSUM(interpfrac); + auto ang = !SyncInput() ? pPlayer->Angles.angSUM() : pPlayer->Angles.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.angSUM(); - cH = pPlayer->horizon.horizSUM(); - rotscrnang = pPlayer->angle.ZzROTSCRNANG; + cA = pPlayer->Angles.angSUM(); + cH = pPlayer->Angles.horizSUM(); + rotscrnang = pPlayer->Angles.ZzROTSCRNANG; } else { - cA = pPlayer->angle.angLERPSUM(interpfrac); - cH = pPlayer->horizon.horizLERPSUM(interpfrac); - rotscrnang = pPlayer->angle.angLERPROTSCRN(interpfrac); + cA = pPlayer->Angles.angLERPSUM(interpfrac); + cH = pPlayer->Angles.horizLERPSUM(interpfrac); + rotscrnang = pPlayer->Angles.angLERPROTSCRN(interpfrac); } } @@ -742,8 +742,8 @@ void viewDrawScreen(bool sceneonly) bDeliriumOld = bDelirium && gDeliriumBlur; if (sceneonly) return; - auto offsets = pPlayer->angle.angCROSSHAIROFFSETS(interpfrac); - DrawCrosshair(kCrosshairTile, pPlayer->actor->xspr.health >> 4, offsets.X, offsets.Y, 2, -pPlayer->angle.angLERPROTSCRN(interpfrac)); + auto offsets = pPlayer->Angles.angCROSSHAIROFFSETS(interpfrac); + DrawCrosshair(kCrosshairTile, pPlayer->actor->xspr.health >> 4, offsets.X, offsets.Y, 2, -pPlayer->Angles.angLERPROTSCRN(interpfrac)); #if 0 // This currently does not work. May have to be redone as a hardware effect. if (v4 && gNetPlayers > 1) { diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 1cc8fdc1c..ec7d78d8d 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -204,7 +204,7 @@ void clearcamera(player_struct* ps) { ps->newOwner = nullptr; ps->GetActor()->restorepos(); - ps->angle.restoreYaw(); + ps->Angles.restoreYaw(); updatesector(ps->GetActor()->getPosWithOffsetZ(), &ps->cursector); DukeStatIterator it(STAT_ACTOR); @@ -362,7 +362,7 @@ void movedummyplayers(void) { act->spr.cstat = CSTAT_SPRITE_BLOCK_ALL; act->spr.pos.Z = act->sector()->ceilingz + 27; - act->spr.Angles.Yaw = ps[p].angle.ZzANGLE; // check me out later. + act->spr.Angles.Yaw = ps[p].Angles.ZzANGLE; // check me out later. if (act->temp_data[0] == 8) act->temp_data[0] = 0; else act->temp_data[0]++; @@ -401,7 +401,7 @@ void moveplayers(void) { act->restorepos(); act->backupz(); - act->spr.Angles.Yaw = p->angle.ZzOLDANGLE; + act->spr.Angles.Yaw = p->Angles.ZzOLDANGLE; SetActor(act, act->spr.pos); } else @@ -442,7 +442,7 @@ void moveplayers(void) if (p->actorsqu != nullptr) { - p->angle.addYaw(deltaangle(p->angle.ZzANGLE, (p->actorsqu->spr.pos.XY() - p->GetActor()->spr.pos.XY()).Angle()) * 0.25); + p->Angles.addYaw(deltaangle(p->Angles.ZzANGLE, (p->actorsqu->spr.pos.XY() - p->GetActor()->spr.pos.XY()).Angle()) * 0.25); } if (act->spr.extra > 0) @@ -462,10 +462,10 @@ void moveplayers(void) if (p->wackedbyactor != nullptr && p->wackedbyactor->spr.statnum < MAXSTATUS) { - p->angle.addYaw(deltaangle(p->angle.ZzANGLE, (p->wackedbyactor->spr.pos.XY() - p->GetActor()->spr.pos.XY()).Angle()) * 0.5); + p->Angles.addYaw(deltaangle(p->Angles.ZzANGLE, (p->wackedbyactor->spr.pos.XY() - p->GetActor()->spr.pos.XY()).Angle()) * 0.5); } } - act->spr.Angles.Yaw = p->angle.ZzANGLE; // check me out later. + act->spr.Angles.Yaw = p->Angles.ZzANGLE; // check me out later. } } else @@ -499,13 +499,13 @@ void moveplayers(void) if (act->spr.extra < 8) { act->vel.X = 8; - act->spr.Angles.Yaw = p->angle.ZzANGLE; // check me out later. + act->spr.Angles.Yaw = p->Angles.ZzANGLE; // check me out later. act->spr.extra++; ssp(act, CLIPMASK0); } else { - act->spr.Angles.Yaw = DAngle360 - minAngle - p->angle.ZzANGLE; // check me out later. + act->spr.Angles.Yaw = DAngle360 - minAngle - p->Angles.ZzANGLE; // check me out later. SetActor(act, act->spr.pos); } } @@ -787,7 +787,7 @@ bool queball(DDukeActor *actor, int pocket, int queball, int stripeball) { // if(actor->spr.pal == 12) { - auto delta = absangle(ps[p].angle.ZzANGLE, (actor->spr.pos.XY() - ps[p].GetActor()->spr.pos.XY()).Angle()); + auto delta = absangle(ps[p].Angles.ZzANGLE, (actor->spr.pos.XY() - ps[p].GetActor()->spr.pos.XY()).Angle()); if (delta < DAngle22_5 / 2 && PlayerInput(p, SB_OPEN)) if (ps[p].toggle_key_flag == 1) { @@ -797,7 +797,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.ZzANGLE, (act2->spr.pos.XY() - ps[p].GetActor()->spr.pos.XY()).Angle()); + delta = absangle(ps[p].Angles.ZzANGLE, (act2->spr.pos.XY() - ps[p].GetActor()->spr.pos.XY()).Angle()); if (delta < DAngle22_5 / 2) { double l; @@ -811,7 +811,7 @@ bool queball(DDukeActor *actor, int pocket, int queball, int stripeball) if (actor->spr.pal == 12) actor->vel.X = 10.25; else actor->vel.X = 8.75; - actor->spr.Angles.Yaw = ps[p].angle.ZzANGLE; // check me out later. + actor->spr.Angles.Yaw = ps[p].Angles.ZzANGLE; // check me out later. ps[p].toggle_key_flag = 2; } } @@ -1867,7 +1867,7 @@ void handle_se00(DDukeActor* actor) { if (ps[p].cursector == actor->sector() && ps[p].on_ground == 1) { - ps[p].angle.addYaw(ang_amount * direction); + ps[p].Angles.addYaw(ang_amount * direction); ps[p].GetActor()->spr.pos.Z += zchange; @@ -2047,7 +2047,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6) ps[p].bobpos += vec; - ps[p].angle.addYaw(diffangle); + ps[p].Angles.addYaw(diffangle); if (numplayers > 1) { diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index a9358560a..40fc165ee 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -928,7 +928,7 @@ static bool weaponhitsprite(DDukeActor* proj, DDukeActor *targ, bool fireball) if (proj->spr.picnum == SPIT) { - ps[p].horizon.addPitch(DAngle::fromDeg(-14.04)); + ps[p].Angles.addPitch(DAngle::fromDeg(-14.04)); ps[p].sync.actions |= SB_CENTERVIEW; if (ps[p].loogcnt == 0) @@ -1334,7 +1334,7 @@ void movetransports_d(void) ps[k].GetActor()->spr.extra = 0; } - ps[p].angle.ZzANGLE = Owner->spr.Angles.Yaw; // check me out later. + ps[p].Angles.ZzANGLE = Owner->spr.Angles.Yaw; // check me out later. if (Owner->GetOwner() != Owner) { @@ -1663,7 +1663,7 @@ static void greenslime(DDukeActor *actor) } else if (xx < 64 && ps[p].quick_kick == 0) { - auto ang = absangle(ps[p].angle.ZzANGLE, (actor->spr.pos.XY() - ps[p].GetActor()->spr.pos.XY()).Angle()); + auto ang = absangle(ps[p].Angles.ZzANGLE, (actor->spr.pos.XY() - ps[p].GetActor()->spr.pos.XY()).Angle()); if (ang < DAngle22_5) ps[p].quick_kick = 14; } @@ -1685,7 +1685,7 @@ static void greenslime(DDukeActor *actor) SetActor(actor, actor->spr.pos); - actor->spr.Angles.Yaw = ps[p].angle.ZzANGLE; // check me out later. + actor->spr.Angles.Yaw = ps[p].Angles.ZzANGLE; // check me out later. if ((PlayerInput(p, SB_FIRE) || (ps[p].quick_kick > 0)) && ps[p].GetActor()->spr.extra > 0) if (ps[p].quick_kick > 0 || (ps[p].curr_weapon != HANDREMOTE_WEAPON && ps[p].curr_weapon != HANDBOMB_WEAPON && ps[p].curr_weapon != TRIPBOMB_WEAPON && ps[p].ammo_amount[ps[p].curr_weapon] >= 0)) @@ -1719,7 +1719,7 @@ static void greenslime(DDukeActor *actor) return; } - actor->spr.pos.Z = ps[p].GetActor()->getOffsetZ() + 8 + ps[p].pyoff - (actor->temp_data[2] + (ps[p].horizon.ZzHORIZON.Tan() * 2048.)) * zinttoworld; + actor->spr.pos.Z = ps[p].GetActor()->getOffsetZ() + 8 + ps[p].pyoff - (actor->temp_data[2] + (ps[p].Angles.ZzHORIZON.Tan() * 2048.)) * zinttoworld; if (actor->temp_data[2] > 512) actor->temp_data[2] -= 128; @@ -1731,7 +1731,7 @@ static void greenslime(DDukeActor *actor) { ps[p].newOwner = nullptr; ps[p].GetActor()->restorepos(); - ps[p].angle.restoreYaw(); + ps[p].Angles.restoreYaw(); updatesector(ps[p].GetActor()->getPosWithOffsetZ(), &ps[p].cursector); @@ -1768,7 +1768,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].GetActor()->spr.pos.XY() + ps[p].angle.ZzANGLE.ToVector() * 8; + actor->spr.pos.XY() = ps[p].GetActor()->spr.pos.XY() + ps[p].Angles.ZzANGLE.ToVector() * 8; return; } diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 931d1ea08..b2160ac56 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -796,7 +796,7 @@ static bool weaponhitsprite(DDukeActor *proj, DDukeActor *targ, const DVector3 & guts_r(proj, RABBITJIBC, 2, myconnectindex); } - ps[p].horizon.addPitch(DAngle::fromDeg(-14.04)); + ps[p].Angles.addPitch(DAngle::fromDeg(-14.04)); ps[p].sync.actions |= SB_CENTERVIEW; if (ps[p].loogcnt == 0) @@ -1222,7 +1222,7 @@ void movetransports_r(void) ps[k].GetActor()->spr.extra = 0; } - ps[p].angle.ZzANGLE = Owner->spr.Angles.Yaw; // check me out later. + ps[p].Angles.ZzANGLE = Owner->spr.Angles.Yaw; // check me out later. if (Owner->GetOwner() != Owner) { @@ -1945,7 +1945,7 @@ void rr_specialstats() { if (act2->spr.picnum == RRTELEPORTDEST) { - ps[p].angle.ZzANGLE = act2->spr.Angles.Yaw; // check me out later. + ps[p].Angles.ZzANGLE = act2->spr.Angles.Yaw; // check me out later. ps[p].GetActor()->spr.pos = act2->spr.pos.plusZ(-36 + gs.playerheight); ps[p].GetActor()->backuppos(); ps[p].setbobpos(); diff --git a/source/games/duke/src/ccmds.cpp b/source/games/duke/src/ccmds.cpp index fea4f3887..2e6ecdf3d 100644 --- a/source/games/duke/src/ccmds.cpp +++ b/source/games/duke/src/ccmds.cpp @@ -123,7 +123,7 @@ void GameInterface::WarpToCoords(double x, double y, double z, DAngle ang) if (ang != DAngle::fromDeg(INT_MIN)) { - p->angle.ZzOLDANGLE = p->angle.ZzANGLE = ang; + p->Angles.ZzOLDANGLE = p->Angles.ZzANGLE = ang; } } diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index 87b0ea784..ab5f80931 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -274,13 +274,13 @@ void drawoverlays(double interpfrac) else { cposxy = interpolatedvalue(pp->GetActor()->getPrevPosWithOffsetZ(), pp->GetActor()->getPosWithOffsetZ(), interpfrac).XY(); - cang = !SyncInput() ? pp->angle.ZzANGLE : interpolatedvalue(pp->angle.ZzOLDANGLE, pp->angle.ZzANGLE, interpfrac); + cang = !SyncInput() ? pp->Angles.ZzANGLE : interpolatedvalue(pp->Angles.ZzOLDANGLE, pp->Angles.ZzANGLE, interpfrac); } } else { cposxy = pp->GetActor()->opos.XY(); - cang = pp->angle.ZzOLDANGLE; + cang = pp->Angles.ZzOLDANGLE; } DrawOverheadMap(cposxy, cang, interpfrac); RestoreInterpolations(); @@ -291,8 +291,8 @@ void drawoverlays(double interpfrac) if (ps[myconnectindex].newOwner == nullptr && ud.cameraactor == nullptr) { - 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)); + auto offsets = pp->Angles.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->Angles.angLERPROTSCRN(interpfrac)); } if (paused == 2) diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index df4e6d67f..f012acbfd 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -344,22 +344,22 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, { ps[iPlayer].sync.actions &= ~SB_CENTERVIEW; } - ps[iPlayer].horizon.setPitch(maphoriz(-lValue)); + ps[iPlayer].Angles.setPitch(maphoriz(-lValue)); } - else SetGameVarID(lVar2, int(ps[iPlayer].horizon.ZzHORIZON.Tan() * -128.), sActor, sPlayer); + else SetGameVarID(lVar2, int(ps[iPlayer].Angles.ZzHORIZON.Tan() * -128.), sActor, sPlayer); break; case PLAYER_OHORIZ: - if (!bSet) SetGameVarID(lVar2, int(ps[iPlayer].horizon.ZzOLDHORIZON.Tan() * -128.), sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, int(ps[iPlayer].Angles.ZzOLDHORIZON.Tan() * -128.), sActor, sPlayer); break; case PLAYER_HORIZOFF: - if (bSet) ps[iPlayer].horizon.ZzHORIZOFF = maphoriz(-lValue); - else SetGameVarID(lVar2, int(ps[iPlayer].horizon.ZzHORIZOFF.Tan() * -128.), sActor, sPlayer); + if (bSet) ps[iPlayer].Angles.ZzHORIZOFF = maphoriz(-lValue); + else SetGameVarID(lVar2, int(ps[iPlayer].Angles.ZzHORIZOFF.Tan() * -128.), sActor, sPlayer); break; case PLAYER_OHORIZOFF: - if (!bSet) SetGameVarID(lVar2, int(ps[iPlayer].horizon.ZzOHORIZOFF.Tan() * -128.), sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, int(ps[iPlayer].Angles.ZzOHORIZOFF.Tan() * -128.), sActor, sPlayer); break; case PLAYER_INVDISPTIME: @@ -472,12 +472,12 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, break; case PLAYER_ANG: - if (bSet) ps[iPlayer].angle.setYaw(mapangle(lValue)); - else SetGameVarID(lVar2, ps[iPlayer].angle.ZzANGLE.Buildang(), sActor, sPlayer); + if (bSet) ps[iPlayer].Angles.setYaw(mapangle(lValue)); + else SetGameVarID(lVar2, ps[iPlayer].Angles.ZzANGLE.Buildang(), sActor, sPlayer); break; case PLAYER_OANG: - if (!bSet) SetGameVarID(lVar2, ps[iPlayer].angle.ZzOLDANGLE.Buildang(), sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, ps[iPlayer].Angles.ZzOLDANGLE.Buildang(), sActor, sPlayer); break; case PLAYER_ANGVEL: // This no longer exists. @@ -490,8 +490,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, break; case PLAYER_LOOK_ANG: - if (bSet) ps[iPlayer].angle.ZzLOOKANG = mapangle(lValue); - else SetGameVarID(lVar2, ps[iPlayer].angle.ZzLOOKANG.Buildang(), sActor, sPlayer); + if (bSet) ps[iPlayer].Angles.ZzLOOKANG = mapangle(lValue); + else SetGameVarID(lVar2, ps[iPlayer].Angles.ZzLOOKANG.Buildang(), sActor, sPlayer); break; case PLAYER_LAST_EXTRA: @@ -650,8 +650,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, break; case PLAYER_ONE_EIGHTY_COUNT: - if (bSet) ps[iPlayer].angle.YawSpin = mapangle(lValue); - else SetGameVarID(lVar2, ps[iPlayer].angle.YawSpin.Buildang(), sActor, sPlayer); + if (bSet) ps[iPlayer].Angles.YawSpin = mapangle(lValue); + else SetGameVarID(lVar2, ps[iPlayer].Angles.YawSpin.Buildang(), sActor, sPlayer); break; case PLAYER_CHEAT_PHASE: @@ -710,8 +710,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, break; case PLAYER_ROTSCRNANG: - if (bSet) ps[iPlayer].angle.ZzOLDROTSCRNANG = ps[iPlayer].angle.ZzROTSCRNANG = mapangle(lValue); - else SetGameVarID(lVar2, ps[iPlayer].angle.ZzROTSCRNANG.Buildang(), sActor, sPlayer); + if (bSet) ps[iPlayer].Angles.ZzOLDROTSCRNANG = ps[iPlayer].Angles.ZzROTSCRNANG = mapangle(lValue); + else SetGameVarID(lVar2, ps[iPlayer].Angles.ZzROTSCRNANG.Buildang(), sActor, sPlayer); break; case PLAYER_DEAD_FLAG: @@ -925,7 +925,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, case PLAYER_RETURN_TO_CENTER: if (bSet) ps[iPlayer].sync.actions |= SB_CENTERVIEW; - else SetGameVarID(lVar2, ps[iPlayer].sync.actions & SB_CENTERVIEW ? int(abs((ps[iPlayer].horizon.ZzHORIZON * (DAngle::fromDeg(9.) / GetMaxPitch())).Degrees())) : 0, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].sync.actions & SB_CENTERVIEW ? int(abs((ps[iPlayer].Angles.ZzHORIZON * (DAngle::fromDeg(9.) / GetMaxPitch())).Degrees())) : 0, sActor, sPlayer); break; default: @@ -2046,7 +2046,7 @@ int ParseState::parse(void) { ps[g_p].newOwner = nullptr; ps[g_p].GetActor()->restorepos(); - ps[g_p].angle.restoreYaw(); + ps[g_p].Angles.restoreYaw(); updatesector(ps[g_p].GetActor()->getPosWithOffsetZ(), &ps[g_p].cursector); DukeStatIterator it(STAT_ACTOR); @@ -2247,10 +2247,10 @@ int ParseState::parse(void) ps[g_p].last_extra = g_ac->spr.extra = gs.max_player_health; ps[g_p].wantweaponfire = -1; - ps[g_p].horizon.ZzOLDHORIZON = ps[g_p].horizon.ZzHORIZON = nullAngle; + ps[g_p].Angles.ZzOLDHORIZON = ps[g_p].Angles.ZzHORIZON = nullAngle; ps[g_p].on_crane = nullptr; ps[g_p].frag_ps = g_p; - ps[g_p].horizon.ZzOHORIZOFF = ps[g_p].horizon.ZzHORIZOFF = nullAngle; + ps[g_p].Angles.ZzOHORIZOFF = ps[g_p].Angles.ZzHORIZOFF = nullAngle; ps[g_p].opyoff = 0; ps[g_p].wackedbyactor = nullptr; ps[g_p].shield_amount = gs.max_armour_amount; @@ -2261,7 +2261,7 @@ int ParseState::parse(void) ps[g_p].weapreccnt = 0; ps[g_p].ftq = 0; ps[g_p].vel.X = ps[g_p].vel.Y = 0; - if (!isRR()) ps[g_p].angle.ZzOLDROTSCRNANG = ps[g_p].angle.ZzROTSCRNANG = nullAngle; + if (!isRR()) ps[g_p].Angles.ZzOLDROTSCRNANG = ps[g_p].Angles.ZzROTSCRNANG = nullAngle; ps[g_p].falling_counter = 0; @@ -2432,9 +2432,9 @@ int ParseState::parse(void) { DAngle ang; if (g_ac->isPlayer() && ud.multimode > 1) - ang = absangle(ps[otherp].angle.ZzANGLE, (ps[g_p].GetActor()->spr.pos.XY() - ps[otherp].GetActor()->spr.pos.XY()).Angle()); + ang = absangle(ps[otherp].Angles.ZzANGLE, (ps[g_p].GetActor()->spr.pos.XY() - ps[otherp].GetActor()->spr.pos.XY()).Angle()); else - ang = absangle(ps[g_p].angle.ZzANGLE, (g_ac->spr.pos.XY() - ps[g_p].GetActor()->spr.pos.XY()).Angle()); + ang = absangle(ps[g_p].Angles.ZzANGLE, (g_ac->spr.pos.XY() - ps[g_p].GetActor()->spr.pos.XY()).Angle()); j = ang < DAngle22_5; } @@ -2455,7 +2455,7 @@ int ParseState::parse(void) case concmd_slapplayer: insptr++; forceplayerangle(g_p); - ps[g_p].vel.XY() -= ps[g_p].angle.ZzANGLE.ToVector() * 8; + ps[g_p].vel.XY() -= ps[g_p].Angles.ZzANGLE.ToVector() * 8; return 0; case concmd_wackplayer: insptr++; @@ -2463,7 +2463,7 @@ int ParseState::parse(void) forceplayerangle(g_p); else { - ps[g_p].vel.XY() -= ps[g_p].angle.ZzANGLE.ToVector() * 64; + ps[g_p].vel.XY() -= ps[g_p].Angles.ZzANGLE.ToVector() * 64; ps[g_p].jumping_counter = 767; ps[g_p].jumping_toggle = 1; } @@ -2833,7 +2833,7 @@ int ParseState::parse(void) case concmd_ifangdiffl: { insptr++; - auto ang = absangle(ps[g_p].angle.ZzANGLE, g_ac->spr.Angles.Yaw); // check me out later. + auto ang = absangle(ps[g_p].Angles.ZzANGLE, g_ac->spr.Angles.Yaw); // check me out later. parseifelse( ang <= mapangle(*insptr)); break; } @@ -3131,7 +3131,7 @@ int ParseState::parse(void) int i; insptr++; i = *(insptr++); // ID of def - SetGameVarID(i, ps[g_p].angle.ZzANGLE.Buildang(), g_ac, g_p); + SetGameVarID(i, ps[g_p].Angles.ZzANGLE.Buildang(), g_ac, g_p); break; } case concmd_setplayerangle: @@ -3139,7 +3139,7 @@ int ParseState::parse(void) int i; insptr++; i = *(insptr++); // ID of def - ps[g_p].angle.ZzANGLE = mapangle(GetGameVarID(i, g_ac, g_p).safeValue() & 2047); + ps[g_p].Angles.ZzANGLE = mapangle(GetGameVarID(i, g_ac, g_p).safeValue() & 2047); break; } case concmd_getactorangle: diff --git a/source/games/duke/src/hudweapon_d.cpp b/source/games/duke/src/hudweapon_d.cpp index eec7fbf80..289ff7256 100644 --- a/source/games/duke/src/hudweapon_d.cpp +++ b/source/games/duke/src/hudweapon_d.cpp @@ -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.angWEAPONOFFSETS(interpfrac); - auto horiz = !SyncInput() ? p->horizon.horizSUM() : p->horizon.horizLERPSUM(interpfrac); + auto offsets = p->Angles.angWEAPONOFFSETS(interpfrac); + auto horiz = !SyncInput() ? p->Angles.horizSUM() : p->Angles.horizLERPSUM(interpfrac); auto pitchoffset = interpolatedvalue(0., 16., horiz / DAngle90); auto yawinput = getavel(snum) * (1. / 16.); - auto angle = p->angle.angRENDERROTSCRN(interpfrac); + auto angle = p->Angles.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); diff --git a/source/games/duke/src/hudweapon_r.cpp b/source/games/duke/src/hudweapon_r.cpp index 8cba07d92..4bf63906c 100644 --- a/source/games/duke/src/hudweapon_r.cpp +++ b/source/games/duke/src/hudweapon_r.cpp @@ -133,8 +133,8 @@ void displayweapon_r(int snum, double interpfrac) TiltStatus = p->TiltStatus; } - look_anghalf = p->angle.angLOOKANGHALF(interpfrac); - looking_arc = p->angle.angLOOKINGARC(interpfrac); + look_anghalf = p->Angles.angLOOKANGHALF(interpfrac); + looking_arc = p->Angles.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); diff --git a/source/games/duke/src/inlines.h b/source/games/duke/src/inlines.h index 2f8b98bb7..76e683e2a 100644 --- a/source/games/duke/src/inlines.h +++ b/source/games/duke/src/inlines.h @@ -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.doViewPitch(p->GetActor()->spr.pos.XY(), p->angle.ZzANGLE, p->aim_mode == 0, canslopetilt, p->cursector, scaleAdjust); + p->Angles.doViewPitch(p->GetActor()->spr.pos.XY(), p->Angles.ZzANGLE, p->aim_mode == 0, canslopetilt, p->cursector, scaleAdjust); } //--------------------------------------------------------------------------- diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index d423b94a4..b79b140bf 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -284,7 +284,7 @@ void hud_input(int plnum) p->inven_icon = 3; auto pactor = - CreateActor(p->cursector, p->GetActor()->getPosWithOffsetZ().plusZ(30), TILE_APLAYER, -64, DVector2(0, 0), p->angle.ZzANGLE, 0., 0., nullptr, 10); + CreateActor(p->cursector, p->GetActor()->getPosWithOffsetZ().plusZ(30), TILE_APLAYER, -64, DVector2(0, 0), p->Angles.ZzANGLE, 0., 0., nullptr, 10); pactor->temp_data[3] = pactor->temp_data[4] = 0; p->holoduke_on = pactor; pactor->spr.yint = plnum; @@ -476,7 +476,7 @@ void hud_input(int plnum) } } - if (PlayerInput(plnum, SB_TURNAROUND) && p->angle.YawSpin == nullAngle && p->on_crane == nullptr) + if (PlayerInput(plnum, SB_TURNAROUND) && p->Angles.YawSpin == nullAngle && p->on_crane == nullptr) { SetGameVarID(g_iReturnVarID, 0, nullptr, plnum); OnEvent(EVENT_TURNAROUND, plnum, nullptr, -1); @@ -792,7 +792,7 @@ static void FinalizeInput(player_struct *p, InputPacket& input) loc.avel = input.avel = 0; } - if (p->newOwner != nullptr || (p->sync.actions & SB_CENTERVIEW && abs(p->horizon.ZzHORIZON.Degrees()) > 2.2370)) + if (p->newOwner != nullptr || (p->sync.actions & SB_CENTERVIEW && abs(p->Angles.ZzHORIZON.Degrees()) > 2.2370)) { loc.horz = input.horz = 0; } @@ -836,20 +836,20 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju { // Do these in the same order as the old code. doslopetilting(p, scaleAdjust); - p->angle.applyYaw(p->adjustavel(input.avel), &p->sync.actions, scaleAdjust); + p->Angles.applyYaw(p->adjustavel(input.avel), &p->sync.actions, scaleAdjust); p->apply_seasick(scaleAdjust); - p->horizon.applyPitch(input.horz, &p->sync.actions, scaleAdjust); + p->Angles.applyPitch(input.horz, &p->sync.actions, scaleAdjust); } - p->angle.processLegacyHelperYaw(scaleAdjust); - p->horizon.processLegacyHelperPitch(scaleAdjust); - p->GetActor()->spr.Angles.Yaw = p->angle.ZzANGLE; // check me out later. + p->Angles.processLegacyHelperYaw(scaleAdjust); + p->Angles.processLegacyHelperPitch(scaleAdjust); + p->GetActor()->spr.Angles.Yaw = p->Angles.ZzANGLE; // check me out later. } if (packet) { *packet = loc; - auto velvect = DVector2(loc.fvel, loc.svel).Rotated(p->angle.ZzANGLE) + p->fric; + auto velvect = DVector2(loc.fvel, loc.svel).Rotated(p->Angles.ZzANGLE) + p->fric; packet->fvel = (float)velvect.X; packet->svel = (float)velvect.Y; loc = {}; diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 40310edac..5578774c7 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -117,9 +117,9 @@ void forceplayerangle(int snum) { player_struct* p = &ps[snum]; - p->horizon.addPitch(DAngle::fromDeg(-26.566)); + p->Angles.addPitch(DAngle::fromDeg(-26.566)); p->sync.actions |= SB_CENTERVIEW; - p->angle.ZzROTSCRNANG = p->angle.ZzLOOKANG = (DAngle22_5 - randomAngle(45)) / 2.; + p->Angles.ZzROTSCRNANG = p->Angles.ZzLOOKANG = (DAngle22_5 - randomAngle(45)) / 2.; } //--------------------------------------------------------------------------- @@ -211,7 +211,7 @@ double hitawall(player_struct* p, walltype** hitw) { HitInfo hit{}; - hitscan(p->GetActor()->getPosWithOffsetZ(), p->cursector, DVector3(p->angle.ZzANGLE.ToVector() * 1024, 0), hit, CLIPMASK0); + hitscan(p->GetActor()->getPosWithOffsetZ(), p->cursector, DVector3(p->Angles.ZzANGLE.ToVector() * 1024, 0), hit, CLIPMASK0); if (hitw) *hitw = hit.hitWall; return (hit.hitpos.XY() - p->GetActor()->spr.pos.XY()).Length(); @@ -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.horizSUM(), 16.); + setFreeAimVelocity(vel, zvel, plr->Angles.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.horizSUM().Tan(); + double horiz = ps[actor->PlayerIndex()].Angles.horizSUM().Tan(); check = abs(checkval - horiz) < 0.78125; } else check = 1; @@ -378,7 +378,7 @@ void dokneeattack(int snum, const std::initializer_list & respawnlist) { p->oknee_incs = p->knee_incs; p->knee_incs++; - p->horizon.addPitch(deltaangle(p->horizon.ZzHORIZON, (p->GetActor()->getPosWithOffsetZ() - p->actorsqu->spr.pos).Pitch() * 1.1875)); + p->Angles.addPitch(deltaangle(p->Angles.ZzHORIZON, (p->GetActor()->getPosWithOffsetZ() - p->actorsqu->spr.pos).Pitch() * 1.1875)); p->sync.actions |= SB_CENTERVIEW; if (p->knee_incs > 15) { @@ -546,8 +546,8 @@ void footprints(int snum) inline void backupplayer(player_struct* p) { p->backuppos(); - p->angle.backupYaw(); - p->horizon.backupPitch(); + p->Angles.backupYaw(); + p->Angles.backupPitch(); } void playerisdead(int snum, int psectlotag, double floorz, double ceilingz) @@ -622,14 +622,14 @@ void playerisdead(int snum, int psectlotag, double floorz, double ceilingz) backupplayer(p); - p->horizon.ZzHORIZOFF = p->horizon.ZzHORIZON = nullAngle; + p->Angles.ZzHORIZOFF = p->Angles.ZzHORIZON = nullAngle; updatesector(p->GetActor()->getPosWithOffsetZ(), &p->cursector); pushmove(p->GetActor()->spr.pos.XY(), p->GetActor()->getOffsetZ(), &p->cursector, 8, 4, 20, CLIPMASK0); if (floorz > ceilingz + 16 && actor->spr.pal != 1) - p->angle.ZzROTSCRNANG = DAngle::fromBuild(p->dead_flag + ((floorz + p->GetActor()->getOffsetZ()) * 2)); + p->Angles.ZzROTSCRNANG = DAngle::fromBuild(p->dead_flag + ((floorz + p->GetActor()->getOffsetZ()) * 2)); p->on_warping_sector = 0; @@ -741,16 +741,16 @@ void player_struct::apply_seasick(double factor) if (SeaSick < 250) { if (SeaSick >= 180) - angle.ZzROTSCRNANG += DAngle::fromDeg(24 * factor * BAngToDegree); + Angles.ZzROTSCRNANG += DAngle::fromDeg(24 * factor * BAngToDegree); else if (SeaSick >= 130) - angle.ZzROTSCRNANG -= DAngle::fromDeg(24 * factor * BAngToDegree); + Angles.ZzROTSCRNANG -= DAngle::fromDeg(24 * factor * BAngToDegree); else if (SeaSick >= 70) - angle.ZzROTSCRNANG += DAngle::fromDeg(24 * factor * BAngToDegree); + Angles.ZzROTSCRNANG += DAngle::fromDeg(24 * factor * BAngToDegree); else if (SeaSick >= 20) - angle.ZzROTSCRNANG -= DAngle::fromDeg(24 * factor * BAngToDegree); + Angles.ZzROTSCRNANG -= DAngle::fromDeg(24 * factor * BAngToDegree); } if (SeaSick < 250) - angle.ZzLOOKANG = DAngle::fromDeg(((krand() & 255) - 128) * factor * BAngToDegree); + Angles.ZzLOOKANG = DAngle::fromDeg(((krand() & 255) - 128) * factor * BAngToDegree); } } @@ -807,7 +807,7 @@ void player_struct::checkhardlanding() { if (hard_landing > 0) { - horizon.addPitch(maphoriz(hard_landing << 4)); + Angles.addPitch(maphoriz(hard_landing << 4)); hard_landing--; } } @@ -865,7 +865,7 @@ void checklook(int snum, ESyncBits actions) actions &= ~SB_LOOK_RIGHT; } } - p->angle.backupYaw(); + p->Angles.backupYaw(); } //--------------------------------------------------------------------------- diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 2df9bd3ae..70f75b603 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -113,7 +113,7 @@ static void shootfireball(DDukeActor *actor, int p, DVector3 pos, DAngle ang) } else { - setFreeAimVelocity(vel, zvel, ps[p].horizon.horizSUM(), 49.); + setFreeAimVelocity(vel, zvel, ps[p].Angles.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.horizSUM(), 40.5); + setFreeAimVelocity(vel, zvel, ps[p].Angles.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.horizSUM(), 16.); + setFreeAimVelocity(vel, zvel, ps[p].Angles.horizSUM(), 16.); pos.Z += 6; ang += DAngle1 * 2.64; } @@ -294,7 +294,7 @@ static void shootknee(DDukeActor* actor, int p, DVector3 pos, DAngle ang) if (splash) { splash->spr.pos.XY() = hit.hitpos.XY(); - splash->spr.Angles.Yaw = ps[p].angle.ZzANGLE; // check me out later. // Total tweek + splash->spr.Angles.Yaw = ps[p].Angles.ZzANGLE; // check me out later. // Total tweek splash->vel.X = 2; ssp(actor, CLIPMASK0); splash->vel.X = 0; @@ -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.horizSUM(), 16.); + setFreeAimVelocity(vel, zvel, ps[p].Angles.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.horizSUM(), 16.); + setFreeAimVelocity(vel, zvel, ps[p].Angles.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.horizSUM(), 49.); + setFreeAimVelocity(vel, zvel, ps[p].Angles.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.horizSUM(), 40.5); + setFreeAimVelocity(vel, zvel, ps[p].Angles.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.horizSUM(), 16.); + setFreeAimVelocity(vel, zvel, ps[p].Angles.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.horizSUM(), 16.); + setFreeAimVelocity(vel, zvel, ps[p].Angles.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.horizSUM(), 49.); + setFreeAimVelocity(vel, zvel, ps[p].Angles.horizSUM(), 49.); } else if (actor->spr.statnum != 3) { @@ -1071,7 +1071,7 @@ void shoot_d(DDukeActor* actor, int atwith) if (actor->isPlayer()) { spos = ps[p].GetActor()->getPosWithOffsetZ().plusZ(ps[p].pyoff + 4); - sang = ps[p].angle.ZzANGLE; + sang = ps[p].Angles.ZzANGLE; ps[p].crack_time = CRACK_TIME; @@ -1992,7 +1992,7 @@ static void underwater(int snum, ESyncBits actions, double floorz, double ceilin auto j = spawn(pact, WATERBUBBLE); if (j) { - j->spr.pos += (p->angle.ZzANGLE.ToVector() + DVector2(4 - (global_random & 8), 4 - (global_random & 8))) * 16; + j->spr.pos += (p->Angles.ZzANGLE.ToVector() + DVector2(4 - (global_random & 8), 4 - (global_random & 8))) * 16; j->spr.scale = DVector2(0.046875, 0.3125); j->spr.pos.Z = p->GetActor()->getOffsetZ() + 8; } @@ -2010,9 +2010,9 @@ int operateTripbomb(int snum) auto p = &ps[snum]; HitInfo hit{}; double vel = 1024, zvel = 0; - setFreeAimVelocity(vel, zvel, p->horizon.horizSUM(), 16.); + setFreeAimVelocity(vel, zvel, p->Angles.horizSUM(), 16.); - hitscan(p->GetActor()->getPosWithOffsetZ(), p->cursector, DVector3(p->angle.ZzANGLE.ToVector() * vel, zvel), hit, CLIPMASK1); + hitscan(p->GetActor()->getPosWithOffsetZ(), p->cursector, DVector3(p->Angles.ZzANGLE.ToVector() * vel, zvel), hit, CLIPMASK1); if (hit.hitSector == nullptr || hit.actor()) return 0; @@ -2200,17 +2200,17 @@ static void operateweapon(int snum, ESyncBits actions) if (p->on_ground && (actions & SB_CROUCH)) { vel = 15/16.; - zvel = p->horizon.horizSUM().Sin() * 10.; + zvel = p->Angles.horizSUM().Sin() * 10.; } else { vel = 140/16.; - setFreeAimVelocity(vel, zvel, p->horizon.horizSUM(), 10.); + setFreeAimVelocity(vel, zvel, p->Angles.horizSUM(), 10.); zvel -= 4; } - auto spawned = CreateActor(p->cursector, p->GetActor()->getPosWithOffsetZ() + p->angle.ZzANGLE.ToVector() * 16, HEAVYHBOMB, -16, DVector2(0.140625, 0.140625), - p->angle.ZzANGLE, vel + p->hbomb_hold_delay * 2, zvel, pact, 1); + auto spawned = CreateActor(p->cursector, p->GetActor()->getPosWithOffsetZ() + p->Angles.ZzANGLE.ToVector() * 16, HEAVYHBOMB, -16, DVector2(0.140625, 0.140625), + p->Angles.ZzANGLE, vel + p->hbomb_hold_delay * 2, zvel, pact, 1); if (isNam()) { @@ -2725,8 +2725,8 @@ void processinput_d(int snum) p = &ps[snum]; auto pact = p->GetActor(); - p->horizon.resetAdjustmentPitch(); - p->angle.resetAdjustmentYaw(); + p->Angles.resetAdjustmentPitch(); + p->Angles.resetAdjustmentYaw(); ESyncBits& actions = p->sync.actions; @@ -2763,7 +2763,7 @@ void processinput_d(int snum) if (SyncInput()) { - p->horizon.backupPitch(); + p->Angles.backupPitch(); doslopetilting(p); } @@ -2904,7 +2904,7 @@ void processinput_d(int snum) // may still be needed later for demo recording sb_avel = p->adjustavel(sb_avel); - p->angle.applyYaw(sb_avel, &actions); + p->Angles.applyYaw(sb_avel, &actions); } if (p->spritebridge == 0 && pact->insector()) @@ -3137,7 +3137,7 @@ HORIZONLY: if (SyncInput()) { - p->horizon.applyPitch(GetPlayerHorizon(snum), &actions); + p->Angles.applyPitch(GetPlayerHorizon(snum), &actions); } p->checkhardlanding(); diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 85519f561..2e2719b7d 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -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.horizSUM(), 16.); + setFreeAimVelocity(vel, zvel, ps[p].Angles.horizSUM(), 16.); pos.Z += 6; ang += DAngle1 * 2.64; } @@ -185,7 +185,7 @@ static void shootmelee(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int a if (splash) { splash->spr.pos.XY() = hit.hitpos.XY(); - splash->spr.Angles.Yaw = ps[p].angle.ZzANGLE; // check me out later. // Total tweek + splash->spr.Angles.Yaw = ps[p].Angles.ZzANGLE; // check me out later. // Total tweek splash->vel.X = 2; ssp(actor, 0); splash->vel.X = 0; @@ -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.horizSUM(), 16.); + setFreeAimVelocity(vel, zvel, ps[p].Angles.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.horizSUM(), 16.); + if (aimed == nullptr) setFreeAimVelocity(vel, zvel, ps[p].Angles.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.horizSUM(), 49.); + setFreeAimVelocity(vel, zvel, ps[p].Angles.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.horizSUM(), 40.5); + setFreeAimVelocity(vel, zvel, ps[p].Angles.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.horizSUM(), 49.); + setFreeAimVelocity(vel, zvel, ps[p].Angles.horizSUM(), 49.); } else { @@ -822,7 +822,7 @@ void shoot_r(DDukeActor* actor, int atwith) { p = actor->PlayerIndex(); spos = ps[p].GetActor()->getPosWithOffsetZ().plusZ(ps[p].pyoff + 4); - sang = ps[p].angle.ZzANGLE; + sang = ps[p].Angles.ZzANGLE; if (isRRRA()) ps[p].crack_time = CRACK_TIME; } @@ -1283,7 +1283,7 @@ int doincrements_r(player_struct* p) { p->noise_radius = 1024; madenoise(screenpeek); - p->vel.XY() += p->angle.ZzANGLE.ToVector(); + p->vel.XY() += p->Angles.ZzANGLE.ToVector(); } p->eat -= 4; if (p->eat < 0) @@ -1467,12 +1467,12 @@ void checkweapons_r(player_struct* p) auto j = spawn(p->GetActor(), 7220); if (j) { - j->spr.Angles.Yaw = p->angle.ZzANGLE; // check me out later. + j->spr.Angles.Yaw = p->Angles.ZzANGLE; // check me out later. j->saved_ammo = p->ammo_amount[MOTORCYCLE_WEAPON]; } p->OnMotorcycle = 0; p->gotweapon[MOTORCYCLE_WEAPON] = false; - p->horizon.ZzHORIZON = nullAngle; + p->Angles.ZzHORIZON = nullAngle; p->moto_do_bump = 0; p->MotoSpeed = 0; p->TiltStatus = 0; @@ -1486,12 +1486,12 @@ void checkweapons_r(player_struct* p) auto j = spawn(p->GetActor(), 7233); if (j) { - j->spr.Angles.Yaw = p->angle.ZzANGLE; // check me out later. + j->spr.Angles.Yaw = p->Angles.ZzANGLE; // check me out later. j->saved_ammo = p->ammo_amount[BOAT_WEAPON]; } p->OnBoat = 0; p->gotweapon[BOAT_WEAPON] = false; - p->horizon.ZzHORIZON = nullAngle; + p->Angles.ZzHORIZON = nullAngle; p->moto_do_bump = 0; p->MotoSpeed = 0; p->TiltStatus = 0; @@ -1718,7 +1718,7 @@ static void onMotorcycle(int snum, ESyncBits &actions) } if (horiz != FRACUNIT) { - p->horizon.addPitch(deltaangle(p->horizon.ZzHORIZON, maphoriz(-horiz))); + p->Angles.addPitch(deltaangle(p->Angles.ZzHORIZON, maphoriz(-horiz))); } const DAngle adjust = mapangle(-510); @@ -1764,15 +1764,15 @@ static void onMotorcycle(int snum, ESyncBits &actions) } } - p->vel.XY() += (p->angle.ZzANGLE + velAdjustment).ToVector() * currSpeed; - p->angle.addYaw(deltaangle(p->angle.ZzANGLE, p->angle.ZzANGLE - DAngle::fromBam(angAdjustment))); + p->vel.XY() += (p->Angles.ZzANGLE + velAdjustment).ToVector() * currSpeed; + p->Angles.addYaw(deltaangle(p->Angles.ZzANGLE, p->Angles.ZzANGLE - DAngle::fromBam(angAdjustment))); } else if (p->MotoSpeed >= 20 && p->on_ground == 1 && (p->moto_on_mud || p->moto_on_oil)) { rng = krand() & 1; velAdjustment = rng == 0 ? -adjust : adjust; currSpeed = MulScale(currSpeed, p->moto_on_oil ? 10 : 5, 7); - p->vel.XY() += (p->angle.ZzANGLE + velAdjustment).ToVector() * currSpeed; + p->vel.XY() += (p->Angles.ZzANGLE + velAdjustment).ToVector() * currSpeed; } p->moto_on_mud = p->moto_on_oil = 0; @@ -1986,7 +1986,7 @@ static void onBoat(int snum, ESyncBits &actions) } if (horiz != FRACUNIT) { - p->horizon.addPitch(deltaangle(p->horizon.ZzHORIZON, maphoriz(-horiz))); + p->Angles.addPitch(deltaangle(p->Angles.ZzHORIZON, maphoriz(-horiz))); } if (p->MotoSpeed > 0 && p->on_ground == 1 && (p->vehTurnLeft || p->vehTurnRight)) @@ -2008,8 +2008,8 @@ static void onBoat(int snum, ESyncBits &actions) angAdjustment >>= 6; } - p->vel.XY() += (p->angle.ZzANGLE + velAdjustment).ToVector() * currSpeed; - p->angle.addYaw(deltaangle(p->angle.ZzANGLE, p->angle.ZzANGLE - DAngle::fromBam(angAdjustment))); + p->vel.XY() += (p->Angles.ZzANGLE + velAdjustment).ToVector() * currSpeed; + p->Angles.addYaw(deltaangle(p->Angles.ZzANGLE, p->Angles.ZzANGLE - DAngle::fromBam(angAdjustment))); } if (p->NotOnWater && p->MotoSpeed > 50) p->MotoSpeed -= (p->MotoSpeed / 2.); @@ -2311,7 +2311,7 @@ static void underwater(int snum, ESyncBits actions, double floorz, double ceilin auto j = spawn(pact, WATERBUBBLE); if (j) { - j->spr.pos += (p->angle.ZzANGLE.ToVector() + DVector2(12 - (global_random & 8), 12 - (global_random & 8))) * 16; + j->spr.pos += (p->Angles.ZzANGLE.ToVector() + DVector2(12 - (global_random & 8), 12 - (global_random & 8))) * 16; j->spr.scale = DVector2(0.046875, 0.03125); j->spr.pos.Z = p->GetActor()->getOffsetZ() + 8; j->spr.cstat = CSTAT_SPRITE_TRANS_FLIP | CSTAT_SPRITE_TRANSLUCENT; @@ -2329,11 +2329,11 @@ void onMotorcycleMove(int snum, walltype* wal) { auto p = &ps[snum]; auto pact = p->GetActor(); - double angleDelta = absangle(p->angle.ZzANGLE, wal->delta().Angle()).Degrees(); + double angleDelta = absangle(p->Angles.ZzANGLE, wal->delta().Angle()).Degrees(); double damageAmount = p->MotoSpeed * p->MotoSpeed; const double scale = (180. / 2048.); - p->angle.addYaw(DAngle::fromDeg(p->MotoSpeed * (krand() & 1 ? -scale : scale))); + p->Angles.addYaw(DAngle::fromDeg(p->MotoSpeed * (krand() & 1 ? -scale : scale))); // That's some very weird angles here... if (angleDelta >= 77.51 && angleDelta <= 102.13) @@ -2385,10 +2385,10 @@ void onBoatMove(int snum, int psectlotag, walltype* wal) { auto p = &ps[snum]; auto pact = p->GetActor(); - double angleDelta = absangle(p->angle.ZzANGLE, wal->delta().Angle()).Degrees(); + double angleDelta = absangle(p->Angles.ZzANGLE, wal->delta().Angle()).Degrees(); const double scale = (90. / 2048.); - p->angle.addYaw(DAngle::fromDeg(p->MotoSpeed * (krand() & 1 ? -scale : scale))); + p->Angles.addYaw(DAngle::fromDeg(p->MotoSpeed * (krand() & 1 ? -scale : scale))); if (angleDelta >= 77.51 && angleDelta <= 102.13) { @@ -2433,7 +2433,7 @@ void onMotorcycleHit(int snum, DDukeActor* victim) if (numplayers == 1) { Collision coll; - DAngle ang = DAngle::fromBuild(p->TiltStatus * 20) + p->angle.ZzANGLE; + DAngle ang = DAngle::fromBuild(p->TiltStatus * 20) + p->Angles.ZzANGLE; movesprite_ex(victim, DVector3(ang.ToVector() * 4, victim->vel.Z), CLIPMASK0, coll); } } @@ -2467,7 +2467,7 @@ void onBoatHit(int snum, DDukeActor* victim) if (numplayers == 1) { Collision coll; - DAngle ang = DAngle::fromBuild(p->TiltStatus * 20) + p->angle.ZzANGLE; + DAngle ang = DAngle::fromBuild(p->TiltStatus * 20) + p->Angles.ZzANGLE; movesprite_ex(victim, DVector3(ang.ToVector() * 2, victim->vel.Z), CLIPMASK0, coll); } } @@ -2674,17 +2674,17 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) if (p->on_ground && (actions & SB_CROUCH)) { vel = 15 / 16.; - zvel = p->horizon.horizSUM().Sin() * 10.; + zvel = p->Angles.horizSUM().Sin() * 10.; } else { vel = 140 / 16.; - setFreeAimVelocity(vel, zvel, p->horizon.horizSUM(), 10.); + setFreeAimVelocity(vel, zvel, p->Angles.horizSUM(), 10.); zvel -= 4; } - auto spawned = CreateActor(p->cursector, p->GetActor()->getPosWithOffsetZ() + p->angle.ZzANGLE.ToVector() * 16, DYNAMITE, -16, DVector2(0.140625, 0.140625), - p->angle.ZzANGLE, (vel + p->hbomb_hold_delay * 2) * 2, zvel, pact, 1); + auto spawned = CreateActor(p->cursector, p->GetActor()->getPosWithOffsetZ() + p->Angles.ZzANGLE.ToVector() * 16, DYNAMITE, -16, DVector2(0.140625, 0.140625), + p->Angles.ZzANGLE, (vel + p->hbomb_hold_delay * 2) * 2, zvel, pact, 1); if (spawned) { @@ -2735,7 +2735,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) p->visibility = 0; if (psectlotag != 857) { - p->vel.XY() -= p->angle.ZzANGLE.ToVector(); + p->vel.XY() -= p->Angles.ZzANGLE.ToVector(); } } else if (p->kickback_pic == 2) @@ -2834,12 +2834,12 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) if (psectlotag != 857) { - p->vel.XY() -= p->angle.ZzANGLE.ToVector() * 2; + p->vel.XY() -= p->Angles.ZzANGLE.ToVector() * 2; } } else if (psectlotag != 857) { - p->vel.XY() -= p->angle.ZzANGLE.ToVector(); + p->vel.XY() -= p->Angles.ZzANGLE.ToVector(); } } @@ -2894,7 +2894,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) case RIFLEGUN_WEAPON: p->kickback_pic++; - p->horizon.addPitch(DAngle::fromDeg(-0.4476)); + p->Angles.addPitch(DAngle::fromDeg(-0.4476)); p->recoil++; if (p->kickback_pic <= 12) @@ -2925,7 +2925,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) if (psectlotag != 857) { - p->vel.XY() -= p->angle.ZzANGLE.ToVector(); + p->vel.XY() -= p->Angles.ZzANGLE.ToVector(); } checkavailweapon(p); @@ -2985,11 +2985,11 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) } if (p->kickback_pic == 2) { - p->angle.addYaw(mapangle(16)); + p->Angles.addYaw(mapangle(16)); } else if (p->kickback_pic == 4) { - p->angle.addYaw(mapangle(-16)); + p->Angles.addYaw(mapangle(-16)); } if (p->kickback_pic > 4) p->kickback_pic = 1; @@ -3015,11 +3015,11 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) } if (p->kickback_pic == 2) { - p->angle.addYaw(mapangle(4)); + p->Angles.addYaw(mapangle(4)); } else if (p->kickback_pic == 4) { - p->angle.addYaw(mapangle(-4)); + p->Angles.addYaw(mapangle(-4)); } if (p->kickback_pic > 4) p->kickback_pic = 1; @@ -3065,8 +3065,8 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) } else if (p->kickback_pic == 12) { - p->vel.XY() -= p->angle.ZzANGLE.ToVector(); - p->horizon.addPitch(DAngle::fromDeg(-8.88)); + p->vel.XY() -= p->Angles.ZzANGLE.ToVector(); + p->Angles.addPitch(DAngle::fromDeg(-8.88)); p->recoil += 20; } if (p->kickback_pic > 20) @@ -3082,16 +3082,16 @@ 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.horizSUM(), 10.); + setFreeAimVelocity(vel, zvel, p->Angles.horizSUM(), 10.); } else { vel = 2.; - setFreeAimVelocity(vel, zvel, p->horizon.horizSUM(), 10.); + setFreeAimVelocity(vel, zvel, p->Angles.horizSUM(), 10.); zvel -= 4; } - CreateActor(p->cursector, p->GetActor()->getPosWithOffsetZ() + p->angle.ZzANGLE.ToVector() * 16, POWDERKEG, -16, DVector2(0.140625, 0.140625), p->angle.ZzANGLE, vel * 2, zvel, pact, 1); + CreateActor(p->cursector, p->GetActor()->getPosWithOffsetZ() + p->Angles.ZzANGLE.ToVector() * 16, POWDERKEG, -16, DVector2(0.140625, 0.140625), p->Angles.ZzANGLE, vel * 2, zvel, pact, 1); } p->kickback_pic++; if (p->kickback_pic > 20) @@ -3112,7 +3112,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) } if (p->kickback_pic < 30) { - p->vel.XY() += p->angle.ZzANGLE.ToVector(); + p->vel.XY() += p->Angles.ZzANGLE.ToVector(); } p->kickback_pic++; if (p->kickback_pic > 40) @@ -3272,8 +3272,8 @@ void processinput_r(int snum) auto p = &ps[snum]; auto pact = p->GetActor(); - p->horizon.resetAdjustmentPitch(); - p->angle.resetAdjustmentYaw(); + p->Angles.resetAdjustmentPitch(); + p->Angles.resetAdjustmentYaw(); ESyncBits& actions = p->sync.actions; @@ -3349,7 +3349,7 @@ void processinput_r(int snum) if (SyncInput()) { - p->horizon.backupPitch(); + p->Angles.backupPitch(); doslopetilting(p); } @@ -3559,7 +3559,7 @@ void processinput_r(int snum) // may still be needed later for demo recording sb_avel = p->adjustavel(sb_avel); - p->angle.applyYaw(sb_avel, &actions); + p->Angles.applyYaw(sb_avel, &actions); } if (p->spritebridge == 0 && pact->insector()) @@ -3890,12 +3890,12 @@ HORIZONLY: if (!d) d = 1; p->recoil -= d; - p->horizon.addPitch(maphoriz(d)); + p->Angles.addPitch(maphoriz(d)); } if (SyncInput()) { - p->horizon.applyPitch(GetPlayerHorizon(snum), &actions); + p->Angles.applyPitch(GetPlayerHorizon(snum), &actions); } p->checkhardlanding(); @@ -3949,7 +3949,7 @@ void OnMotorcycle(player_struct *p, DDukeActor* motosprite) if (motosprite) { p->GetActor()->spr.pos.XY() = motosprite->spr.pos.XY(); - p->angle.ZzANGLE = motosprite->spr.Angles.Yaw; // check me out later. + p->Angles.ZzANGLE = motosprite->spr.Angles.Yaw; // check me out later. p->ammo_amount[MOTORCYCLE_WEAPON] = motosprite->saved_ammo; motosprite->Destroy(); } @@ -3960,7 +3960,7 @@ void OnMotorcycle(player_struct *p, DDukeActor* motosprite) p->gotweapon[MOTORCYCLE_WEAPON] = true; p->vel.X = 0; p->vel.Y = 0; - p->horizon.setPitch(nullAngle); + p->Angles.setPitch(nullAngle); } if (!S_CheckActorSoundPlaying(p->GetActor(),186)) S_PlayActorSound(186, p->GetActor()); @@ -3991,7 +3991,7 @@ void OffMotorcycle(player_struct *p) p->gotweapon[MOTORCYCLE_WEAPON] = false; p->curr_weapon = p->last_full_weapon; checkavailweapon(p); - p->horizon.setPitch(nullAngle); + p->Angles.setPitch(nullAngle); p->moto_do_bump = 0; p->MotoSpeed = 0; p->TiltStatus = 0; @@ -3999,12 +3999,12 @@ void OffMotorcycle(player_struct *p) p->VBumpTarget = 0; p->VBumpNow = 0; p->TurbCount = 0; - p->vel.XY() = p->angle.ZzANGLE.ToVector() / 2048.; + p->vel.XY() = p->Angles.ZzANGLE.ToVector() / 2048.; p->moto_underwater = 0; auto spawned = spawn(p->GetActor(), EMPTYBIKE); if (spawned) { - spawned->spr.Angles.Yaw = p->angle.ZzANGLE; // check me out later. + spawned->spr.Angles.Yaw = p->Angles.ZzANGLE; // check me out later. spawned->saved_ammo = p->ammo_amount[MOTORCYCLE_WEAPON]; } } @@ -4023,7 +4023,7 @@ void OnBoat(player_struct *p, DDukeActor* boat) if (boat) { p->GetActor()->spr.pos.XY() = boat->spr.pos.XY(); - p->angle.ZzANGLE = boat->spr.Angles.Yaw; // check me out later. + p->Angles.ZzANGLE = boat->spr.Angles.Yaw; // check me out later. p->ammo_amount[BOAT_WEAPON] = boat->saved_ammo; boat->Destroy(); } @@ -4034,7 +4034,7 @@ void OnBoat(player_struct *p, DDukeActor* boat) p->gotweapon[BOAT_WEAPON] = true; p->vel.X = 0; p->vel.Y = 0; - p->horizon.setPitch(nullAngle); + p->Angles.setPitch(nullAngle); } } @@ -4052,7 +4052,7 @@ void OffBoat(player_struct *p) p->gotweapon[BOAT_WEAPON] = false; p->curr_weapon = p->last_full_weapon; checkavailweapon(p); - p->horizon.setPitch(nullAngle); + p->Angles.setPitch(nullAngle); p->moto_do_bump = 0; p->MotoSpeed = 0; p->TiltStatus = 0; @@ -4060,12 +4060,12 @@ void OffBoat(player_struct *p) p->VBumpTarget = 0; p->VBumpNow = 0; p->TurbCount = 0; - p->vel.XY() = p->angle.ZzANGLE.ToVector() / 2048.; + p->vel.XY() = p->Angles.ZzANGLE.ToVector() / 2048.; p->moto_underwater = 0; auto spawned = spawn(p->GetActor(), EMPTYBOAT); if (spawned) { - spawned->spr.Angles.Yaw = p->angle.ZzANGLE; // check me out later. + spawned->spr.Angles.Yaw = p->Angles.ZzANGLE; // check me out later. spawned->saved_ammo = p->ammo_amount[BOAT_WEAPON]; } } diff --git a/source/games/duke/src/player_w.cpp b/source/games/duke/src/player_w.cpp index 9179411f1..1a3010238 100644 --- a/source/games/duke/src/player_w.cpp +++ b/source/games/duke/src/player_w.cpp @@ -333,17 +333,17 @@ void operateweapon_ww(int snum, ESyncBits actions) if (p->on_ground && (actions & SB_CROUCH)) { vel = 15 / 16.; - setFreeAimVelocity(vel, zvel, p->horizon.horizSUM(), 10.); + setFreeAimVelocity(vel, zvel, p->Angles.horizSUM(), 10.); } else { vel = 140 / 16.; - setFreeAimVelocity(vel, zvel, p->horizon.horizSUM(), 10.); + setFreeAimVelocity(vel, zvel, p->Angles.horizSUM(), 10.); zvel -= 4; } - auto spawned = CreateActor(p->cursector, p->GetActor()->getPosWithOffsetZ() + p->angle.ZzANGLE.ToVector() * 16, HEAVYHBOMB, -16, DVector2(0.140625, 0.140625), - p->angle.ZzANGLE, vel + p->hbomb_hold_delay * 2, zvel, pact, 1); + auto spawned = CreateActor(p->cursector, p->GetActor()->getPosWithOffsetZ() + p->Angles.ZzANGLE.ToVector() * 16, HEAVYHBOMB, -16, DVector2(0.140625, 0.140625), + p->Angles.ZzANGLE, vel + p->hbomb_hold_delay * 2, zvel, pact, 1); if (spawned) { diff --git a/source/games/duke/src/prediction.cpp b/source/games/duke/src/prediction.cpp index 9c670a1e1..e429cadf0 100644 --- a/source/games/duke/src/prediction.cpp +++ b/source/games/duke/src/prediction.cpp @@ -53,9 +53,9 @@ void resetmys() { mypos = omypos = ps[myconnectindex].GetActor()->getPosWithOffsetZ(); myxvel = myyvel = myzvel = 0; - myang = ps[myconnectindex].angle.ZzANGLE; - myhoriz = omyhoriz = ps[myconnectindex].horizon.ZzHORIZON; - myhorizoff = omyhorizoff = ps[myconnectindex].horizon.ZzHORIZOFF; + myang = ps[myconnectindex].Angles.ZzANGLE; + myhoriz = omyhoriz = ps[myconnectindex].Angles.ZzHORIZON; + myhorizoff = omyhorizoff = ps[myconnectindex].Angles.ZzHORIZOFF; mycursectnum = sectindex(ps[myconnectindex].cursector); myjumpingcounter = ps[myconnectindex].jumping_counter; myjumpingtoggle = ps[myconnectindex].jumping_toggle; diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 3c3044c3d..7e81281f8 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -72,7 +72,7 @@ void pickrandomspot(int snum) p->GetActor()->spr.pos = po[i].opos; p->GetActor()->backuppos(); p->setbobpos(); - p->angle.ZzOLDANGLE = p->angle.ZzANGLE = po[i].oa; + p->Angles.ZzOLDANGLE = p->Angles.ZzANGLE = po[i].oa; p->setCursector(po[i].os); } @@ -125,8 +125,8 @@ void resetplayerstats(int snum) p->footprintpal = 0; p->footprintshade = 0; p->jumping_toggle = 0; - p->horizon.ZzOLDHORIZON = p->horizon.ZzHORIZON = DAngle::fromDeg(-17.354); - p->horizon.ZzOHORIZOFF = p->horizon.ZzHORIZOFF = nullAngle; + p->Angles.ZzOLDHORIZON = p->Angles.ZzHORIZON = DAngle::fromDeg(-17.354); + p->Angles.ZzOHORIZOFF = p->Angles.ZzHORIZOFF = nullAngle; p->bobcounter = 0; p->on_ground = 0; p->player_par = 0; @@ -151,8 +151,8 @@ void resetplayerstats(int snum) p->jetpack_on = 0; p->holoduke_on = nullptr; - p->angle.ZzOLDLOOKANG = p->angle.ZzLOOKANG = (currentLevel->levelNumber & 1)? DAngle90 : -DAngle90; - p->angle.ZzOLDROTSCRNANG = p->angle.ZzROTSCRNANG = nullAngle; + p->Angles.ZzOLDLOOKANG = p->Angles.ZzLOOKANG = (currentLevel->levelNumber & 1)? DAngle90 : -DAngle90; + p->Angles.ZzOLDROTSCRNANG = p->Angles.ZzROTSCRNANG = nullAngle; p->newOwner =nullptr; p->jumping_counter = 0; @@ -161,7 +161,7 @@ void resetplayerstats(int snum) p->fric.X = 0; p->fric.Y = 0; p->somethingonplayer = nullptr; - p->angle.YawSpin = nullAngle; + p->Angles.YawSpin = nullAngle; p->on_crane = nullptr; @@ -513,7 +513,7 @@ void resetpspritevars(int g, const DVector3& startpos) STATUSBARTYPE tsbar[MAXPLAYERS]; auto newActor = CreateActor(ps[0].cursector, startpos.plusZ(gs.playerheight), - TILE_APLAYER, 0, DVector2(0, 0), ps[0].angle.ZzANGLE, 0., 0., nullptr, 10); + TILE_APLAYER, 0, DVector2(0, 0), ps[0].Angles.ZzANGLE, 0., 0., nullptr, 10); newActor->viewzoffset = -gs.playerheight; newActor->backupz(); @@ -626,7 +626,7 @@ void resetpspritevars(int g, const DVector3& startpos) act->SetOwner(act); ps[j].setbobpos(); - ps[j].angle.ZzOLDANGLE = ps[j].angle.ZzANGLE = act->spr.Angles.Yaw; // check me out later. + ps[j].Angles.ZzOLDANGLE = ps[j].Angles.ZzANGLE = act->spr.Angles.Yaw; // check me out later. updatesector(act->spr.pos, &ps[j].cursector); @@ -982,7 +982,7 @@ static int LoadTheMap(MapRecord *mi, player_struct*p, int gamemode) STAT_NewLevel(mi->fileName); TITLE_InformName(mi->name); - p->angle.ZzANGLE = mapangle(lbang); + p->Angles.ZzANGLE = mapangle(lbang); gotpic.Zero(); diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index d2f023a88..c5a0be8fd 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -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.angLERPROTSCRN(interpfrac); + rotscrnang = !SyncInput() ? p->Angles.ZzROTSCRNANG : p->Angles.angLERPROTSCRN(interpfrac); // use player's actor initially. viewer = p->GetActor(); @@ -298,14 +298,14 @@ 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.angLERPSUM(interpfrac); - choriz = p->horizon.horizLERPSUM(interpfrac); + cang = p->Angles.angLERPSUM(interpfrac); + choriz = p->Angles.horizLERPSUM(interpfrac); } else { // This is for real time updating of the view direction. - cang = p->angle.angSUM(); - choriz = p->horizon.horizSUM(); + cang = p->Angles.angSUM(); + choriz = p->Angles.horizSUM(); } } diff --git a/source/games/duke/src/savegame.cpp b/source/games/duke/src/savegame.cpp index 3d8250405..92c197767 100644 --- a/source/games/duke/src/savegame.cpp +++ b/source/games/duke/src/savegame.cpp @@ -76,8 +76,8 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w, { if (arc.BeginObject(keyname)) { - arc("angle", w.angle) - ("horizon", w.horizon) + arc("angle", w.Angles) + ("horizon", w.Angles) .Array("gotweapon", w.gotweapon, MAX_WEAPONS) ("pals", w.pals) ("fricx", w.fric.X) diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index 2235c6f61..22332d28a 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -1296,8 +1296,8 @@ void moveclouds(double interpfrac) cloudclock = myclock + 6; // cloudx/y were an array, but all entries were always having the same value so a single pair is enough. - cloudx += (float)ps[screenpeek].angle.ZzANGLE.Cos() * 0.5f; - cloudy += (float)ps[screenpeek].angle.ZzANGLE.Sin() * 0.5f; + cloudx += (float)ps[screenpeek].Angles.ZzANGLE.Cos() * 0.5f; + cloudy += (float)ps[screenpeek].Angles.ZzANGLE.Sin() * 0.5f; for (int i = 0; i < numclouds; i++) { // no clamping here! diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 08e2d68a0..0f1b5a781 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -681,7 +681,7 @@ void checkhitwall_d(DDukeActor* spr, walltype* wal, const DVector3& pos, int atw if (wal->twoSided()) wal->nextWall()->cstat = 0; - auto spawned = CreateActor(sptr, pos, SECTOREFFECTOR, 0, DVector2(0, 0), ps[0].angle.ZzANGLE, 0., 0., spr, 3); + auto spawned = CreateActor(sptr, pos, SECTOREFFECTOR, 0, DVector2(0, 0), ps[0].Angles.ZzANGLE, 0., 0., spr, 3); if (spawned) { spawned->spr.lotag = SE_128_GLASS_BREAKING; @@ -875,15 +875,15 @@ void checkplayerhurt_d(player_struct* p, const Collision& coll) p->hurt_delay = 16; SetPlayerPal(p, PalEntry(32, 32, 0, 0)); - p->vel.XY() = -p->angle.ZzANGLE.ToVector() * 16; + p->vel.XY() = -p->Angles.ZzANGLE.ToVector() * 16; S_PlayActorSound(DUKE_LONGTERM_PAIN, p->GetActor()); - fi.checkhitwall(p->GetActor(), wal, p->GetActor()->getPosWithOffsetZ() + p->angle.ZzANGLE.ToVector() * 2, -1); + fi.checkhitwall(p->GetActor(), wal, p->GetActor()->getPosWithOffsetZ() + p->Angles.ZzANGLE.ToVector() * 2, -1); break; case BIGFORCE: p->hurt_delay = 26; - fi.checkhitwall(p->GetActor(), wal, p->GetActor()->getPosWithOffsetZ() + p->angle.ZzANGLE.ToVector() * 2, -1); + fi.checkhitwall(p->GetActor(), wal, p->GetActor()->getPosWithOffsetZ() + p->Angles.ZzANGLE.ToVector() * 2, -1); break; } @@ -1062,7 +1062,7 @@ void checkhitdefault_d(DDukeActor* targ, DDukeActor* proj) { ps[p].newOwner = nullptr; ps[p].GetActor()->restorepos(); - ps[p].angle.restoreYaw(); + ps[p].Angles.restoreYaw(); updatesector(ps[p].GetActor()->getPosWithOffsetZ(), &ps[p].cursector); @@ -1516,17 +1516,17 @@ void checksectors_d(int snum) return; } if (p->newOwner != nullptr) - neartag(p->GetActor()->getPrevPosWithOffsetZ(), p->GetActor()->sector(), p->angle.ZzOLDANGLE, near, 80., NT_Lotag); + neartag(p->GetActor()->getPrevPosWithOffsetZ(), p->GetActor()->sector(), p->Angles.ZzOLDANGLE, near, 80., NT_Lotag); else { - neartag(p->GetActor()->getPosWithOffsetZ(), p->GetActor()->sector(), p->angle.ZzOLDANGLE, near, 80., NT_Lotag); + neartag(p->GetActor()->getPosWithOffsetZ(), p->GetActor()->sector(), p->Angles.ZzOLDANGLE, near, 80., NT_Lotag); if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr) - neartag(p->GetActor()->getPosWithOffsetZ().plusZ(8), p->GetActor()->sector(), p->angle.ZzOLDANGLE, near, 80., NT_Lotag); + neartag(p->GetActor()->getPosWithOffsetZ().plusZ(8), p->GetActor()->sector(), p->Angles.ZzOLDANGLE, near, 80., NT_Lotag); if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr) - neartag(p->GetActor()->getPosWithOffsetZ().plusZ(16), p->GetActor()->sector(), p->angle.ZzOLDANGLE, near, 80., NT_Lotag); + neartag(p->GetActor()->getPosWithOffsetZ().plusZ(16), p->GetActor()->sector(), p->Angles.ZzOLDANGLE, near, 80., NT_Lotag); if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr) { - neartag(p->GetActor()->getPosWithOffsetZ().plusZ(16), p->GetActor()->sector(), p->angle.ZzOLDANGLE, near, 80., NT_Lotag | NT_Hitag); + neartag(p->GetActor()->getPosWithOffsetZ().plusZ(16), p->GetActor()->sector(), p->Angles.ZzOLDANGLE, near, 80., NT_Lotag | NT_Hitag); if (near.actor() != nullptr) { switch (near.actor()->spr.picnum) diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 968fe4434..ff81203c1 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -976,7 +976,7 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, const DVector3& pos, int atw if (wal->twoSided()) wal->nextWall()->cstat = 0; - auto spawned = CreateActor(sptr, pos, SECTOREFFECTOR, 0, DVector2(0, 0), ps[0].angle.ZzANGLE, 0., 0., spr, 3); + auto spawned = CreateActor(sptr, pos, SECTOREFFECTOR, 0, DVector2(0, 0), ps[0].Angles.ZzANGLE, 0., 0., spr, 3); if (spawned) { spawned->spr.lotag = SE_128_GLASS_BREAKING; @@ -997,7 +997,7 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, const DVector3& pos, int atw if (wal->twoSided()) wal->nextWall()->cstat = 0; - auto spawned = CreateActor(sptr, pos, SECTOREFFECTOR, 0, DVector2(0, 0), ps[0].angle.ZzANGLE, 0., 0., spr, 3); + auto spawned = CreateActor(sptr, pos, SECTOREFFECTOR, 0, DVector2(0, 0), ps[0].Angles.ZzANGLE, 0., 0., spr, 3); if (spawned) { spawned->spr.lotag = SE_128_GLASS_BREAKING; @@ -1339,7 +1339,7 @@ void checkplayerhurt_r(player_struct* p, const Collision &coll) { case BIGFORCE: p->hurt_delay = 26; - fi.checkhitwall(p->GetActor(), wal, p->GetActor()->getPosWithOffsetZ() + p->angle.ZzANGLE.ToVector() * 2, -1); + fi.checkhitwall(p->GetActor(), wal, p->GetActor()->getPosWithOffsetZ() + p->Angles.ZzANGLE.ToVector() * 2, -1); break; } @@ -2379,21 +2379,21 @@ void checksectors_r(int snum) } return; } - neartag(p->GetActor()->getPosWithOffsetZ(), p->GetActor()->sector(), p->angle.ZzOLDANGLE, near , 80., NT_Lotag | NT_Hitag); + neartag(p->GetActor()->getPosWithOffsetZ(), p->GetActor()->sector(), p->Angles.ZzOLDANGLE, near , 80., NT_Lotag | NT_Hitag); } if (p->newOwner != nullptr) - neartag(p->GetActor()->getPrevPosWithOffsetZ(), p->GetActor()->sector(), p->angle.ZzOLDANGLE, near, 80., NT_Lotag); + neartag(p->GetActor()->getPrevPosWithOffsetZ(), p->GetActor()->sector(), p->Angles.ZzOLDANGLE, near, 80., NT_Lotag); else { - neartag(p->GetActor()->getPosWithOffsetZ(), p->GetActor()->sector(), p->angle.ZzOLDANGLE, near, 80., NT_Lotag); + neartag(p->GetActor()->getPosWithOffsetZ(), p->GetActor()->sector(), p->Angles.ZzOLDANGLE, near, 80., NT_Lotag); if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr) - neartag(p->GetActor()->getPosWithOffsetZ().plusZ(8), p->GetActor()->sector(), p->angle.ZzOLDANGLE, near, 80., NT_Lotag); + neartag(p->GetActor()->getPosWithOffsetZ().plusZ(8), p->GetActor()->sector(), p->Angles.ZzOLDANGLE, near, 80., NT_Lotag); if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr) - neartag(p->GetActor()->getPosWithOffsetZ().plusZ(16), p->GetActor()->sector(), p->angle.ZzOLDANGLE, near, 80., NT_Lotag); + neartag(p->GetActor()->getPosWithOffsetZ().plusZ(16), p->GetActor()->sector(), p->Angles.ZzOLDANGLE, near, 80., NT_Lotag); if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr) { - neartag(p->GetActor()->getPosWithOffsetZ().plusZ(16), p->GetActor()->sector(), p->angle.ZzOLDANGLE, near, 80., NT_Lotag | NT_Hitag); + neartag(p->GetActor()->getPosWithOffsetZ().plusZ(16), p->GetActor()->sector(), p->Angles.ZzOLDANGLE, near, 80., NT_Lotag | NT_Hitag); if (near.actor() != nullptr) { switch (near.actor()->spr.picnum) diff --git a/source/games/duke/src/sounds.cpp b/source/games/duke/src/sounds.cpp index 167fb4e0f..8c7cf3e5c 100644 --- a/source/games/duke/src/sounds.cpp +++ b/source/games/duke/src/sounds.cpp @@ -354,7 +354,7 @@ void S_GetCamera(DVector3* c, DAngle* ca, sectortype** cs) else c->Zero(); } if (cs) *cs = p->cursector; - if (ca) *ca = p->angle.ZzANGLE; + if (ca) *ca = p->Angles.ZzANGLE; } else { diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index 423edac3a..2a5718894 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -427,10 +427,10 @@ void initshell(DDukeActor* actj, DDukeActor* act, bool isshell) if (actj->isPlayer()) { snum = actj->PlayerIndex(); - ang = ps[snum].angle.ZzANGLE - mapangle((krand() & 63) + 8); //Fine tune + ang = ps[snum].Angles.ZzANGLE - 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.horizSUM().Tan() * 8.) + (!isshell ? 3 : 0); + act->spr.pos.Z = 3 + ps[snum].GetActor()->getOffsetZ() + ps[snum].pyoff + (ps[snum].Angles.horizSUM().Tan() * 8.) + (!isshell ? 3 : 0); act->vel.Z = -krandf(1); } else diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index 865cd02fe..0abfe8c8a 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -182,8 +182,7 @@ struct player_struct DVector2 Exit; // player's horizon and angle structs. - PlayerHorizon horizon; - PlayerAngle angle; + PlayerAngles Angles; uint16_t frags[MAXPLAYERS]; diff --git a/source/games/duke/src/vmexports.cpp b/source/games/duke/src/vmexports.cpp index 8527ca7e5..e8a28244f 100644 --- a/source/games/duke/src/vmexports.cpp +++ b/source/games/duke/src/vmexports.cpp @@ -849,7 +849,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, addpos, dukeplayer_addpos) void dukeplayer_settargetangle(player_struct* self, double a, int backup) { - self->angle.setYaw(DAngle::fromDeg(a), backup); + self->Angles.setYaw(DAngle::fromDeg(a), backup); } DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, settargetangle, dukeplayer_settargetangle) @@ -863,7 +863,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, settargetangle, dukeplayer_settargeta double dukeplayer_angle(player_struct* self) { - return self->angle.ZzANGLE.Degrees(); + return self->Angles.ZzANGLE.Degrees(); } DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, angle, dukeplayer_angle) diff --git a/source/games/exhumed/src/gameloop.cpp b/source/games/exhumed/src/gameloop.cpp index 4f78ddde1..062682805 100644 --- a/source/games/exhumed/src/gameloop.cpp +++ b/source/games/exhumed/src/gameloop.cpp @@ -87,8 +87,8 @@ void GameInterface::Render() if (nFreeze != 2) // Hide when Ramses is talking. { DrawStatusBar(); - auto offsets = PlayerList[nLocalPlayer].angle.angCROSSHAIROFFSETS(interpfrac); - DrawCrosshair(kCrosshairTile, PlayerList[nLocalPlayer].nHealth >> 3, offsets.X, offsets.Y, 1, -PlayerList[nLocalPlayer].angle.angLERPROTSCRN(interpfrac)); + auto offsets = PlayerList[nLocalPlayer].Angles.angCROSSHAIROFFSETS(interpfrac); + DrawCrosshair(kCrosshairTile, PlayerList[nLocalPlayer].nHealth >> 3, offsets.X, offsets.Y, 1, -PlayerList[nLocalPlayer].Angles.angLERPROTSCRN(interpfrac)); if (paused && !M_Active()) { diff --git a/source/games/exhumed/src/gun.cpp b/source/games/exhumed/src/gun.cpp index c3a68e5e0..a77930a1f 100644 --- a/source/games/exhumed/src/gun.cpp +++ b/source/games/exhumed/src/gun.cpp @@ -729,7 +729,7 @@ loc_flag: // loc_27266: case kWeaponSword: { - nHeight += PlayerList[nLocalPlayer].horizon.ZzHORIZON.Tan() * 32.; + nHeight += PlayerList[nLocalPlayer].Angles.ZzHORIZON.Tan() * 32.; thePos.Z += nHeight; @@ -834,7 +834,7 @@ loc_flag: } case kWeaponPistol: { - double h = PlayerList[nLocalPlayer].horizon.ZzHORIZON.Tan() * 2.; + double h = PlayerList[nLocalPlayer].Angles.ZzHORIZON.Tan() * 2.; nHeight += h; DExhumedActor* target = nullptr; @@ -858,7 +858,7 @@ loc_flag: case kWeaponGrenade: { - ThrowGrenade(nPlayer, nHeight - 10, PlayerList[nLocalPlayer].horizon.ZzHORIZON.Tan()); + ThrowGrenade(nPlayer, nHeight - 10, PlayerList[nLocalPlayer].Angles.ZzHORIZON.Tan()); break; } case kWeaponStaff: @@ -1000,8 +1000,8 @@ void DrawWeapons(double interpfrac) nShade = PlayerList[nLocalPlayer].pActor->spr.shade; } - double const look_anghalf = PlayerList[nLocalPlayer].angle.angLOOKANGHALF(interpfrac); - double const looking_arc = PlayerList[nLocalPlayer].angle.angLOOKINGARC(interpfrac); + double const look_anghalf = PlayerList[nLocalPlayer].Angles.angLOOKANGHALF(interpfrac); + double const looking_arc = PlayerList[nLocalPlayer].Angles.angLOOKINGARC(interpfrac); xOffset -= look_anghalf; yOffset += looking_arc; diff --git a/source/games/exhumed/src/input.cpp b/source/games/exhumed/src/input.cpp index 19a3a35f9..3081ac938 100644 --- a/source/games/exhumed/src/input.cpp +++ b/source/games/exhumed/src/input.cpp @@ -86,8 +86,8 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju { if (!nFreeze) { - pPlayer->angle.applyYaw(input.avel, &sPlayerInput[nLocalPlayer].actions, scaleAdjust); - pPlayer->horizon.applyPitch(input.horz, &sPlayerInput[nLocalPlayer].actions, scaleAdjust); + pPlayer->Angles.applyYaw(input.avel, &sPlayerInput[nLocalPlayer].actions, scaleAdjust); + pPlayer->Angles.applyPitch(input.horz, &sPlayerInput[nLocalPlayer].actions, scaleAdjust); if (input.horz) { @@ -95,8 +95,8 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju } } - pPlayer->angle.processLegacyHelperYaw(scaleAdjust); - pPlayer->horizon.processLegacyHelperPitch(scaleAdjust); + pPlayer->Angles.processLegacyHelperYaw(scaleAdjust); + pPlayer->Angles.processLegacyHelperPitch(scaleAdjust); UpdatePlayerSpriteAngle(pPlayer); } diff --git a/source/games/exhumed/src/map.cpp b/source/games/exhumed/src/map.cpp index d729e30a8..0cc203ca7 100644 --- a/source/games/exhumed/src/map.cpp +++ b/source/games/exhumed/src/map.cpp @@ -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.angSUM() : PlayerList[nLocalPlayer].angle.angLERPSUM(interpfrac); + auto ang = !SyncInput() ? PlayerList[nLocalPlayer].Angles.angSUM() : PlayerList[nLocalPlayer].Angles.angLERPSUM(interpfrac); DrawOverheadMap(pPlayerActor->interpolatedpos(interpfrac).XY(), ang, interpfrac); } } diff --git a/source/games/exhumed/src/osdcmds.cpp b/source/games/exhumed/src/osdcmds.cpp index 8998c8974..3b3f85786 100644 --- a/source/games/exhumed/src/osdcmds.cpp +++ b/source/games/exhumed/src/osdcmds.cpp @@ -48,7 +48,7 @@ void GameInterface::WarpToCoords(double x, double y, double z, DAngle ang) if (ang != DAngle::fromDeg(INT_MIN)) { - nPlayer->angle.ZzOLDANGLE = nPlayer->angle.ZzANGLE = ang; + nPlayer->Angles.ZzOLDANGLE = nPlayer->Angles.ZzANGLE = ang; } } diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index 62f60e839..3e4f1984a 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -293,8 +293,8 @@ void RestartPlayer(int nPlayer) pActor->spr.pos = nNStartSprite->spr.pos; ChangeActorSect(pActor, nNStartSprite->sector()); - plr->angle.ZzANGLE = nNStartSprite->spr.Angles.Yaw; // check me out later. - pActor->spr.Angles.Yaw = plr->angle.ZzANGLE; // check me out later. + plr->Angles.ZzANGLE = nNStartSprite->spr.Angles.Yaw; // check me out later. + pActor->spr.Angles.Yaw = plr->Angles.ZzANGLE; // check me out later. floorsprt = insertActor(pActor->sector(), 0); @@ -307,14 +307,14 @@ void RestartPlayer(int nPlayer) { pActor->spr.pos.XY() = plr->sPlayerSave.pos.XY(); pActor->spr.pos.Z = plr->sPlayerSave.pSector->floorz; - plr->angle.ZzANGLE = plr->sPlayerSave.nAngle; - pActor->spr.Angles.Yaw = plr->angle.ZzANGLE; // check me out later. + plr->Angles.ZzANGLE = plr->sPlayerSave.nAngle; + pActor->spr.Angles.Yaw = plr->Angles.ZzANGLE; // check me out later. floorsprt = nullptr; } - plr->angle.backupYaw(); - plr->horizon.backupPitch(); + plr->Angles.backupYaw(); + plr->Angles.backupPitch(); plr->pPlayerFloorSprite = floorsprt; @@ -407,7 +407,7 @@ void RestartPlayer(int nPlayer) plr->nThrust.Zero(); - plr->nDestVertPan = plr->horizon.ZzOLDHORIZON = plr->horizon.ZzHORIZON = nullAngle; + plr->nDestVertPan = plr->Angles.ZzOLDHORIZON = plr->Angles.ZzHORIZON = nullAngle; plr->nBreathTimer = 90; plr->nTauntTimer = RandomSize(3) + 3; @@ -503,7 +503,7 @@ void StartDeathSeq(int nPlayer, int nVal) StopFiringWeapon(nPlayer); - PlayerList[nPlayer].horizon.ZzOLDHORIZON = PlayerList[nPlayer].horizon.ZzHORIZON = nullAngle; + PlayerList[nPlayer].Angles.ZzOLDHORIZON = PlayerList[nPlayer].Angles.ZzHORIZON = nullAngle; pActor->oviewzoffset = pActor->viewzoffset = -55; PlayerList[nPlayer].nInvisible = 0; dVertPan[nPlayer] = 15; @@ -664,7 +664,7 @@ static void pickupMessage(int no) void UpdatePlayerSpriteAngle(Player* pPlayer) { - inita = pPlayer->angle.ZzANGLE; + inita = pPlayer->Angles.ZzANGLE; if (pPlayer->pActor) pPlayer->pActor->spr.Angles.Yaw = inita; } @@ -904,10 +904,10 @@ void AIPlayer::Tick(RunListEvent* ev) int nAction = PlayerList[nPlayer].nAction; int nActionB = PlayerList[nPlayer].nAction; - PlayerList[nPlayer].angle.backupYaw(); - PlayerList[nPlayer].horizon.backupPitch(); - PlayerList[nPlayer].angle.resetAdjustmentYaw(); - PlayerList[nPlayer].horizon.resetAdjustmentPitch(); + PlayerList[nPlayer].Angles.backupYaw(); + PlayerList[nPlayer].Angles.backupPitch(); + PlayerList[nPlayer].Angles.resetAdjustmentYaw(); + PlayerList[nPlayer].Angles.resetAdjustmentPitch(); pPlayerActor->vel.XY() = sPlayerInput[nPlayer].vel; @@ -986,7 +986,7 @@ void AIPlayer::Tick(RunListEvent* ev) if (SyncInput()) { Player* pPlayer = &PlayerList[nPlayer]; - pPlayer->angle.applyYaw(sPlayerInput[nPlayer].nAngle, &sPlayerInput[nLocalPlayer].actions); + pPlayer->Angles.applyYaw(sPlayerInput[nPlayer].nAngle, &sPlayerInput[nLocalPlayer].actions); UpdatePlayerSpriteAngle(pPlayer); } @@ -1072,10 +1072,10 @@ void AIPlayer::Tick(RunListEvent* ev) if (nTotalPlayers <= 1) { auto ang = GetAngleToSprite(pPlayerActor, pSpiritSprite); - PlayerList[nPlayer].angle.setYaw(ang, true); + PlayerList[nPlayer].Angles.setYaw(ang, true); pPlayerActor->spr.Angles.Yaw = ang; - PlayerList[nPlayer].horizon.setPitch(nullAngle, true); + PlayerList[nPlayer].Angles.setPitch(nullAngle, true); sPlayerInput[nPlayer].vel.Zero(); pPlayerActor->vel.Zero(); @@ -1088,7 +1088,7 @@ void AIPlayer::Tick(RunListEvent* ev) InitSpiritHead(); PlayerList[nPlayer].nDestVertPan = nullAngle; - PlayerList[nPlayer].horizon.setPitch(currentLevel->ex_ramses_horiz); + PlayerList[nPlayer].Angles.setPitch(currentLevel->ex_ramses_horiz); } } else @@ -1114,7 +1114,7 @@ void AIPlayer::Tick(RunListEvent* ev) zVelB = -zVelB; } - if (zVelB > 2 && !PlayerList[nPlayer].horizon.ZzHORIZON.Sgn() && cl_slopetilting) { + if (zVelB > 2 && !PlayerList[nPlayer].Angles.ZzHORIZON.Sgn() && cl_slopetilting) { PlayerList[nPlayer].nDestVertPan = nullAngle; } } @@ -2475,17 +2475,17 @@ sectdone: if (SyncInput()) { - pPlayer->horizon.applyPitch(sPlayerInput[nPlayer].pan, &sPlayerInput[nLocalPlayer].actions); + pPlayer->Angles.applyPitch(sPlayerInput[nPlayer].pan, &sPlayerInput[nLocalPlayer].actions); } if (actions & (SB_AIM_UP | SB_AIM_DOWN) || sPlayerInput[nPlayer].pan) { - pPlayer->nDestVertPan = pPlayer->horizon.ZzHORIZON; + pPlayer->nDestVertPan = pPlayer->Angles.ZzHORIZON; pPlayer->bPlayerPan = pPlayer->bLockPan = true; } else if (actions & (SB_LOOK_UP | SB_LOOK_DOWN | SB_CENTERVIEW)) { - pPlayer->nDestVertPan = pPlayer->horizon.ZzHORIZON; + pPlayer->nDestVertPan = pPlayer->Angles.ZzHORIZON; pPlayer->bPlayerPan = pPlayer->bLockPan = false; } @@ -2496,9 +2496,9 @@ sectdone: if (cl_slopetilting && !pPlayer->bPlayerPan && !pPlayer->bLockPan) { - if (double nVertPan = deltaangle(pPlayer->horizon.ZzHORIZON, pPlayer->nDestVertPan).Tan() * 32.) + if (double nVertPan = deltaangle(pPlayer->Angles.ZzHORIZON, pPlayer->nDestVertPan).Tan() * 32.) { - pPlayer->horizon.addPitch(maphoriz(abs(nVertPan) >= 4 ? clamp(nVertPan, -4., 4.) : nVertPan * 2.)); + pPlayer->Angles.addPitch(maphoriz(abs(nVertPan) >= 4 ? clamp(nVertPan, -4., 4.) : nVertPan * 2.)); } } } @@ -2616,20 +2616,20 @@ sectdone: } else { - if (PlayerList[nPlayer].horizon.ZzHORIZON.Sgn() > 0) + if (PlayerList[nPlayer].Angles.ZzHORIZON.Sgn() > 0) { - PlayerList[nPlayer].horizon.setPitch(nullAngle); + PlayerList[nPlayer].Angles.setPitch(nullAngle); pPlayerActor->viewzoffset -= dVertPan[nPlayer]; } else { - PlayerList[nPlayer].horizon.addPitch(maphoriz(-dVertPan[nPlayer])); + PlayerList[nPlayer].Angles.addPitch(maphoriz(-dVertPan[nPlayer])); - if (PlayerList[nPlayer].horizon.ZzHORIZON.Degrees() <= 38) + if (PlayerList[nPlayer].Angles.ZzHORIZON.Degrees() <= 38) { - PlayerList[nPlayer].horizon.setPitch(DAngle::fromDeg(-37.72)); + PlayerList[nPlayer].Angles.setPitch(DAngle::fromDeg(-37.72)); } - else if (PlayerList[nPlayer].horizon.ZzHORIZON.Sgn() >= 0) + else if (PlayerList[nPlayer].Angles.ZzHORIZON.Sgn() >= 0) { if (!(pPlayerActor->sector()->Flag & kSectUnderwater)) { @@ -2690,8 +2690,8 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, Player& w, Player* ("field3a", w.nState) ("field3c", w.nLastWeapon) ("seq", w.nSeq) - ("horizon", w.horizon) - ("angle", w.angle) + ("horizon", w.Angles) + ("angle", w.Angles) ("lives", w.nLives) ("double", w.nDouble) ("invisible", w.nInvisible) diff --git a/source/games/exhumed/src/player.h b/source/games/exhumed/src/player.h index 326bf2eb4..d7480b149 100644 --- a/source/games/exhumed/src/player.h +++ b/source/games/exhumed/src/player.h @@ -78,8 +78,7 @@ struct Player bool bPlayerPan, bLockPan; DAngle nDestVertPan; - PlayerHorizon horizon; - PlayerAngle angle; + PlayerAngles Angles; sectortype* pPlayerPushSect; sectortype* pPlayerViewSect; diff --git a/source/games/exhumed/src/sequence.cpp b/source/games/exhumed/src/sequence.cpp index 6b046914f..ee374d29f 100644 --- a/source/games/exhumed/src/sequence.cpp +++ b/source/games/exhumed/src/sequence.cpp @@ -414,7 +414,7 @@ void seq_DrawPilotLightSeq(double xOffset, double yOffset) double x = ChunkXpos[nFrameBase] + (160 + xOffset); double y = ChunkYpos[nFrameBase] + (100 + yOffset); - hud_drawsprite(x, y, 65536, fmod(-2 * PlayerList[nLocalPlayer].angle.ZzANGLE.Buildfang(), kAngleMask + 1), nTile, 0, 0, 1); + hud_drawsprite(x, y, 65536, fmod(-2 * PlayerList[nLocalPlayer].Angles.ZzANGLE.Buildfang(), kAngleMask + 1), nTile, 0, 0, 1); nFrameBase++; } } diff --git a/source/games/exhumed/src/view.cpp b/source/games/exhumed/src/view.cpp index 4659ad15d..ceba85e9c 100644 --- a/source/games/exhumed/src/view.cpp +++ b/source/games/exhumed/src/view.cpp @@ -234,15 +234,15 @@ void DrawView(double interpfrac, bool sceneonly) if (!SyncInput()) { - nCamerapan = PlayerList[nLocalPlayer].horizon.horizSUM(); - nCameraang = PlayerList[nLocalPlayer].angle.angSUM(); - rotscrnang = PlayerList[nLocalPlayer].angle.ZzROTSCRNANG; + nCamerapan = PlayerList[nLocalPlayer].Angles.horizSUM(); + nCameraang = PlayerList[nLocalPlayer].Angles.angSUM(); + rotscrnang = PlayerList[nLocalPlayer].Angles.ZzROTSCRNANG; } else { - nCamerapan = PlayerList[nLocalPlayer].horizon.horizLERPSUM(interpfrac); - nCameraang = PlayerList[nLocalPlayer].angle.angLERPSUM(interpfrac); - rotscrnang = PlayerList[nLocalPlayer].angle.angLERPROTSCRN(interpfrac); + nCamerapan = PlayerList[nLocalPlayer].Angles.horizLERPSUM(interpfrac); + nCameraang = PlayerList[nLocalPlayer].Angles.angLERPSUM(interpfrac); + rotscrnang = PlayerList[nLocalPlayer].Angles.angLERPROTSCRN(interpfrac); } if (!bCamera) diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index 36d22f6cd..cce09d860 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -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.angLERPANG(interpfrac); + tsp->Angles.Yaw = pp->Angles.angLERPANG(interpfrac); } } @@ -1021,8 +1021,8 @@ void PrintSpriteInfo(PLAYER* pp) static void DrawCrosshair(PLAYER* pp, const double interpfrac) { - 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)); + auto offsets = pp->Angles.angCROSSHAIROFFSETS(interpfrac); + ::DrawCrosshair(2326, pp->actor->user.Health, offsets.X, offsets.Y + ((pp->Flags & PF_VIEW_FROM_OUTSIDE) ? 5 : 0), 2, -pp->Angles.angLERPROTSCRN(interpfrac), shadeToLight(10)); } //--------------------------------------------------------------------------- @@ -1244,15 +1244,15 @@ void drawscreen(PLAYER* pp, double interpfrac, bool sceneonly) DVector3 tpos = camerapp->actor->getRenderPos(interpfrac); if (SyncInput() || pp != Player+myconnectindex) { - tang = camerapp->angle.angLERPSUM(interpfrac); - thoriz = camerapp->horizon.horizLERPSUM(interpfrac); - trotscrnang = camerapp->angle.angLERPROTSCRN(interpfrac); + tang = camerapp->Angles.angLERPSUM(interpfrac); + thoriz = camerapp->Angles.horizLERPSUM(interpfrac); + trotscrnang = camerapp->Angles.angLERPROTSCRN(interpfrac); } else { - tang = pp->angle.angSUM(); - thoriz = pp->horizon.horizSUM(); - trotscrnang = pp->angle.ZzROTSCRNANG; + tang = pp->Angles.angSUM(); + thoriz = pp->Angles.horizSUM(); + trotscrnang = pp->Angles.ZzROTSCRNANG; } tsect = camerapp->cursector; @@ -1263,7 +1263,7 @@ void drawscreen(PLAYER* pp, double interpfrac, bool sceneonly) if (pp->sop_control && (!cl_sointerpolation || (CommEnabled && !pp->sop_remote))) { tpos = pp->actor->getPosWithOffsetZ(); - tang = pp->angle.ZzANGLE; + tang = pp->Angles.ZzANGLE; } tsect = pp->cursector; updatesectorz(tpos, &tsect); diff --git a/source/games/sw/src/game.cpp b/source/games/sw/src/game.cpp index fb9814be7..b6db93368 100644 --- a/source/games/sw/src/game.cpp +++ b/source/games/sw/src/game.cpp @@ -414,7 +414,7 @@ void InitLevel(MapRecord *maprec) SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name); STAT_NewLevel(currentLevel->fileName); TITLE_InformName(currentLevel->name); - Player[0].angle.ZzANGLE = DAngle::fromBuild(ang); + Player[0].Angles.ZzANGLE = DAngle::fromBuild(ang); auto vissect = §or[0]; // hack alert! if (vissect->extra != -1) diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 856735563..eb4450e85 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -1757,8 +1757,7 @@ struct PLAYER bool insector() const { return cursector != nullptr; } // variables that do not fit into sprite structure - PlayerHorizon horizon; - PlayerAngle angle; + PlayerAngles Angles; double recoil_amt; int16_t recoil_speed; int16_t recoil_ndx; @@ -1956,7 +1955,7 @@ inline bool SectorIsUnderwaterArea(sectortype* sect) inline bool PlayerFacingRange(PLAYER* pp, DSWActor* a, DAngle range) { - return absangle((a->spr.pos.XY() - pp->actor->spr.pos.XY()).Angle(), pp->angle.ZzANGLE) < range; + return absangle((a->spr.pos.XY() - pp->actor->spr.pos.XY()).Angle(), pp->Angles.ZzANGLE) < range; } inline bool FacingRange(DSWActor* a1, DSWActor* a2, DAngle range) diff --git a/source/games/sw/src/input.cpp b/source/games/sw/src/input.cpp index 7ac5e5628..ebb163af9 100644 --- a/source/games/sw/src/input.cpp +++ b/source/games/sw/src/input.cpp @@ -200,14 +200,14 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju DoPlayerTurnTurret(pp, input.avel); } - pp->angle.processLegacyHelperYaw(scaleAdjust); - pp->horizon.processLegacyHelperPitch(scaleAdjust); + pp->Angles.processLegacyHelperYaw(scaleAdjust); + pp->Angles.processLegacyHelperPitch(scaleAdjust); } if (packet) { *packet = loc; - auto velvect = DVector2(loc.fvel, loc.svel).Rotated(pp->angle.ZzANGLE); + auto velvect = DVector2(loc.fvel, loc.svel).Rotated(pp->Angles.ZzANGLE); packet->fvel = (float)velvect.X; packet->svel = (float)velvect.Y; loc = {}; diff --git a/source/games/sw/src/jsector.cpp b/source/games/sw/src/jsector.cpp index 387c6993c..419349007 100644 --- a/source/games/sw/src/jsector.cpp +++ b/source/games/sw/src/jsector.cpp @@ -612,7 +612,7 @@ void JS_DrawCameras(PLAYER* pp, const DVector3& campos, double smoothratio) if (TEST_BOOL11(camactor) && numplayers > 1) { - drawroomstotile(cp->actor->getPosWithOffsetZ(), cp->angle.ZzANGLE, cp->horizon.ZzHORIZON, cp->cursector, mirror[cnt].campic, smoothratio); + drawroomstotile(cp->actor->getPosWithOffsetZ(), cp->Angles.ZzANGLE, cp->Angles.ZzHORIZON, cp->cursector, mirror[cnt].campic, smoothratio); } else { diff --git a/source/games/sw/src/jweapon.cpp b/source/games/sw/src/jweapon.cpp index a23d04b3a..d99cc642b 100644 --- a/source/games/sw/src/jweapon.cpp +++ b/source/games/sw/src/jweapon.cpp @@ -1260,7 +1260,7 @@ int PlayerInitChemBomb(PLAYER* pp) // Spawn a shot // Inserting and setting up variables - auto actorNew = SpawnActor(STAT_MISSILE, CHEMBOMB, s_ChemBomb, pp->cursector, pos, pp->angle.ZzANGLE, CHEMBOMB_VELOCITY); + auto actorNew = SpawnActor(STAT_MISSILE, CHEMBOMB, s_ChemBomb, pp->cursector, pos, pp->Angles.ZzANGLE, CHEMBOMB_VELOCITY); // don't throw it as far if crawling if (pp->Flags & (PF_CRAWLING)) @@ -1285,7 +1285,7 @@ int PlayerInitChemBomb(PLAYER* pp) if (pp->Flags & (PF_DIVING) || SpriteInUnderwaterArea(actorNew)) actorNew->user.Flags |= (SPR_UNDERWATER); - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->horizon.ZzHORIZON, HORIZ_MULTF); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.ZzHORIZON, HORIZ_MULTF); double oclipdist = plActor->clipdist; plActor->clipdist = 0; @@ -1632,7 +1632,7 @@ int PlayerInitCaltrops(PLAYER* pp) auto pos = pp->actor->getPosWithOffsetZ().plusZ(pp->bob_z + 8); - auto actorNew = SpawnActor(STAT_DEAD_ACTOR, CALTROPS, s_Caltrops, pp->cursector, pos, pp->angle.ZzANGLE, (CHEMBOMB_VELOCITY + RandomRangeF(CHEMBOMB_VELOCITY)) / 2); + auto actorNew = SpawnActor(STAT_DEAD_ACTOR, CALTROPS, s_Caltrops, pp->cursector, pos, pp->Angles.ZzANGLE, (CHEMBOMB_VELOCITY + RandomRangeF(CHEMBOMB_VELOCITY)) / 2); // don't throw it as far if crawling if (pp->Flags & (PF_CRAWLING)) @@ -1655,7 +1655,7 @@ int PlayerInitCaltrops(PLAYER* pp) if (pp->Flags & (PF_DIVING) || SpriteInUnderwaterArea(actorNew)) actorNew->user.Flags |= (SPR_UNDERWATER); - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->horizon.ZzHORIZON, HORIZ_MULTF); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.ZzHORIZON, HORIZ_MULTF); double oclipdist = plActor->clipdist; plActor->clipdist = 0; @@ -2198,7 +2198,7 @@ int SpawnShell(DSWActor* actor, int ShellNum) if (actor->user.PlayerP) { - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, actor->user.PlayerP->horizon.ZzHORIZON, HORIZ_MULTF * (1. / 3.)); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, actor->user.PlayerP->Angles.ZzHORIZON, HORIZ_MULTF * (1. / 3.)); } switch (actorNew->user.ID) diff --git a/source/games/sw/src/mclip.cpp b/source/games/sw/src/mclip.cpp index bba88e4ea..3e73ebe9b 100644 --- a/source/games/sw/src/mclip.cpp +++ b/source/games/sw/src/mclip.cpp @@ -59,7 +59,7 @@ Collision MultiClipMove(PLAYER* pp, double zz, double floordist) { // move the box to position instead of using offset- this prevents small rounding errors // allowing you to move through wall - DAngle ang = (pp->angle.ZzANGLE + sop->clipbox_ang[i]); + DAngle ang = (pp->Angles.ZzANGLE + sop->clipbox_ang[i]); DVector3 spos(pp->actor->getPosWithOffsetZ(), zz); DVector2 vect = ang.ToVector() * sop->clipbox_vdist[i]; diff --git a/source/games/sw/src/ninja.cpp b/source/games/sw/src/ninja.cpp index 914d4943b..4338f0ebf 100644 --- a/source/games/sw/src/ninja.cpp +++ b/source/games/sw/src/ninja.cpp @@ -2393,7 +2393,7 @@ void InitPlayerSprite(PLAYER* pp, const DVector3& spawnpos) COVER_SetReverb(0); // Turn off any echoing that may have been going before pp->Reverb = 0; - auto actor = SpawnActor(STAT_PLAYER0 + pnum, NINJA_RUN_R0, nullptr, pp->cursector, spawnpos.plusZ(PLAYER_HEIGHTF), pp->angle.ZzANGLE); + auto actor = SpawnActor(STAT_PLAYER0 + pnum, NINJA_RUN_R0, nullptr, pp->cursector, spawnpos.plusZ(PLAYER_HEIGHTF), pp->Angles.ZzANGLE); actor->viewzoffset = -PLAYER_HEIGHTF; // if too close to the floor - stand up @@ -2475,7 +2475,7 @@ void SpawnPlayerUnderSprite(PLAYER* pp) int pnum = int(pp - Player); pp->PlayerUnderActor = SpawnActor(STAT_PLAYER_UNDER0 + pnum, - NINJA_RUN_R0, nullptr, pp->cursector, pp->actor->getPosWithOffsetZ(), pp->angle.ZzANGLE); + NINJA_RUN_R0, nullptr, pp->cursector, pp->actor->getPosWithOffsetZ(), pp->Angles.ZzANGLE); DSWActor* actor = pp->PlayerUnderActor; diff --git a/source/games/sw/src/osdcmds.cpp b/source/games/sw/src/osdcmds.cpp index 7e6d7a5ac..58de22c4e 100644 --- a/source/games/sw/src/osdcmds.cpp +++ b/source/games/sw/src/osdcmds.cpp @@ -66,7 +66,7 @@ void GameInterface::WarpToCoords(double x, double y, double z, DAngle ang) if (ang != DAngle::fromDeg(INT_MIN)) { - Player->angle.ZzOLDANGLE = Player->angle.ZzANGLE = ang; + Player->Angles.ZzOLDANGLE = Player->Angles.ZzANGLE = ang; } } diff --git a/source/games/sw/src/panel.cpp b/source/games/sw/src/panel.cpp index f0c718260..e15bfe873 100644 --- a/source/games/sw/src/panel.cpp +++ b/source/games/sw/src/panel.cpp @@ -7428,8 +7428,8 @@ void pDisplaySprites(PLAYER* pp, double interpfrac) double ang; int flags; - const auto offsets = pp->angle.angWEAPONOFFSETS(interpfrac); - const auto angle = pp->angle.angRENDERROTSCRN(interpfrac).Buildfang(); + const auto offsets = pp->Angles.angWEAPONOFFSETS(interpfrac); + const auto angle = pp->Angles.angRENDERROTSCRN(interpfrac).Buildfang(); auto list = pp->GetPanelSpriteList(); for (auto psp = list->Next; next = psp->Next, psp != list; psp = next) diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 7e9635ecb..26e91406f 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -1311,7 +1311,7 @@ void DoPlayerTeleportPause(PLAYER* pp) void DoPlayerTeleportToSprite(PLAYER* pp, DVector3& pos, DAngle ang) { - pp->angle.ZzANGLE = pp->angle.ZzOLDANGLE = ang; + pp->Angles.ZzANGLE = pp->Angles.ZzOLDANGLE = ang; pp->actor->spr.pos = pos; pp->actor->backuppos(); @@ -1510,14 +1510,14 @@ void UpdatePlayerSpriteAngle(PLAYER* pp) { DSWActor* plActor = pp->actor; plActor->backupang(); - plActor->spr.Angles.Yaw = pp->angle.ZzANGLE; // check me out later. + plActor->spr.Angles.Yaw = pp->Angles.ZzANGLE; // check me out later. plActor = pp->PlayerUnderActor; if (!Prediction && plActor) { plActor->backupang(); - plActor->spr.Angles.Yaw = pp->angle.ZzANGLE; // check me out later. + plActor->spr.Angles.Yaw = pp->Angles.ZzANGLE; // check me out later. } } @@ -1529,7 +1529,7 @@ void UpdatePlayerSpriteAngle(PLAYER* pp) void DoPlayerTurn(PLAYER* pp, float const avel, double const scaleAdjust) { - pp->angle.applyYaw(avel, &pp->input.actions, scaleAdjust); + pp->Angles.applyYaw(avel, &pp->input.actions, scaleAdjust); UpdatePlayerSpriteAngle(pp); } @@ -1557,11 +1557,11 @@ void DoPlayerTurnVehicle(PLAYER* pp, float avel, double zz, double floordist) if (avel != 0) { - auto sum = pp->angle.ZzANGLE + DAngle::fromDeg(avel); + auto sum = pp->Angles.ZzANGLE + DAngle::fromDeg(avel); if (MultiClipTurn(pp, sum, zz, floordist)) { - pp->angle.ZzANGLE = sum; - pp->actor->spr.Angles.Yaw = pp->angle.ZzANGLE; // check me out later. + pp->Angles.ZzANGLE = sum; + pp->actor->spr.Angles.Yaw = pp->Angles.ZzANGLE; // check me out later. } } } @@ -1591,11 +1591,11 @@ void DoPlayerTurnVehicleRect(PLAYER* pp, DVector2* pos, DVector2* opos) if (avel != 0) { - auto sum = pp->angle.ZzANGLE + DAngle::fromDeg(avel); + auto sum = pp->Angles.ZzANGLE + DAngle::fromDeg(avel); if (RectClipTurn(pp, sum, pos, opos)) { - pp->angle.ZzANGLE = sum; - pp->actor->spr.Angles.Yaw = pp->angle.ZzANGLE; // check me out later. + pp->Angles.ZzANGLE = sum; + pp->actor->spr.Angles.Yaw = pp->Angles.ZzANGLE; // check me out later. } } } @@ -1625,7 +1625,7 @@ void DoPlayerTurnTurret(PLAYER* pp, float avel) if (fabs(avel) >= FLT_EPSILON) { - new_ang = pp->angle.ZzANGLE + DAngle::fromDeg(avel); + new_ang = pp->Angles.ZzANGLE + DAngle::fromDeg(avel); if (sop->limit_ang_center >= nullAngle) { @@ -1640,11 +1640,11 @@ void DoPlayerTurnTurret(PLAYER* pp, float avel) } } - pp->angle.ZzANGLE = new_ang; - pp->actor->spr.Angles.Yaw = pp->angle.ZzANGLE; // check me out later. + pp->Angles.ZzANGLE = new_ang; + pp->actor->spr.Angles.Yaw = pp->Angles.ZzANGLE; // check me out later. } - OperateSectorObject(pp->sop, pp->angle.ZzANGLE, pp->sop->pmid); + OperateSectorObject(pp->sop, pp->Angles.ZzANGLE, pp->sop->pmid); } //--------------------------------------------------------------------------- @@ -1677,8 +1677,8 @@ void SlipSlope(PLAYER* pp) void DoPlayerHorizon(PLAYER* pp, float const horz, double const scaleAdjust) { bool const canslopetilt = !(pp->Flags & (PF_FLYING|PF_SWIMMING|PF_DIVING|PF_CLIMBING|PF_JUMPING|PF_FALLING)) && pp->cursector && (pp->cursector->floorstat & CSTAT_SECTOR_SLOPE); - pp->horizon.doViewPitch(pp->actor->spr.pos.XY(), pp->angle.ZzANGLE, pp->input.actions & SB_AIMMODE, canslopetilt, pp->cursector, scaleAdjust, (pp->Flags & PF_CLIMBING)); - pp->horizon.applyPitch(horz, &pp->input.actions, scaleAdjust); + pp->Angles.doViewPitch(pp->actor->spr.pos.XY(), pp->Angles.ZzANGLE, pp->input.actions & SB_AIMMODE, canslopetilt, pp->cursector, scaleAdjust, (pp->Flags & PF_CLIMBING)); + pp->Angles.applyPitch(horz, &pp->input.actions, scaleAdjust); } //--------------------------------------------------------------------------- @@ -1850,7 +1850,7 @@ void UpdatePlayerSprite(PLAYER* pp) if (pp->Flags & (PF_DEAD)) { ChangeActorSect(pp->actor, pp->cursector); - actor->spr.Angles.Yaw = pp->angle.ZzANGLE; // check me out later. + actor->spr.Angles.Yaw = pp->Angles.ZzANGLE; // check me out later. UpdatePlayerUnderSprite(pp); return; } @@ -1896,7 +1896,7 @@ void UpdatePlayerSprite(PLAYER* pp) UpdatePlayerUnderSprite(pp); - actor->spr.Angles.Yaw = pp->angle.ZzANGLE; // check me out later. + actor->spr.Angles.Yaw = pp->Angles.ZzANGLE; // check me out later. } //--------------------------------------------------------------------------- @@ -2186,7 +2186,7 @@ void DoPlayerMove(PLAYER* pp) if (interpolate_ride) { pp->actor->backupz(); - pp->angle.backupYaw(); + pp->Angles.backupYaw(); } // check for warp - probably can remove from CeilingHit @@ -2353,7 +2353,7 @@ void DoTankTreads(PLAYER* pp) return; int vel = int(pp->vect.Length() * 1024); - double dot = pp->vect.dot(pp->angle.ZzANGLE.ToVector()); + double dot = pp->vect.dot(pp->Angles.ZzANGLE.ToVector()); if (dot < 0) reverse = true; @@ -2551,7 +2551,7 @@ void DriveCrush(PLAYER* pp, DVector2* quad) continue; damage = -(actor->user.Health + 100); - PlayerDamageSlide(actor->user.PlayerP, damage, pp->angle.ZzANGLE); + PlayerDamageSlide(actor->user.PlayerP, damage, pp->Angles.ZzANGLE); PlayerUpdateHealth(actor->user.PlayerP, damage); PlayerCheckDeath(actor->user.PlayerP, pp->actor); } @@ -2671,7 +2671,7 @@ void DoPlayerMoveVehicle(PLAYER* pp) } auto save_sect = pp->cursector; - OperateSectorObject(pp->sop, pp->angle.ZzANGLE, { MAXSO, MAXSO }); + OperateSectorObject(pp->sop, pp->Angles.ZzANGLE, { MAXSO, MAXSO }); pp->setcursector(pp->sop->op_main_sector); // for speed double floordist = abs(zz - pp->sop->floor_loz); @@ -2699,7 +2699,7 @@ void DoPlayerMoveVehicle(PLAYER* pp) DVector3 hitpos((pos[0] + pos[1]) * 0.5, pp->cursector->floorz - 10); hitscan(hitpos, pp->cursector, - DVector3(pp->angle.ZzANGLE.ToVector() * 16, 0), + DVector3(pp->Angles.ZzANGLE.ToVector() * 16, 0), hit, CLIPMASK_PLAYER); if ((hit.hitpos.XY() - hitpos.XY()).LengthSquared() < 50 * 50) @@ -2772,7 +2772,7 @@ void DoPlayerMoveVehicle(PLAYER* pp) } } - OperateSectorObject(pp->sop, pp->angle.ZzANGLE, pp->actor->spr.pos.XY()); + OperateSectorObject(pp->sop, pp->Angles.ZzANGLE, pp->actor->spr.pos.XY()); pp->cursector = save_sect; // for speed if (!SyncInput()) @@ -3265,7 +3265,7 @@ void DoPlayerClimb(PLAYER* pp) pp->vect.X = pp->vect.Y = 0; double climbVel = pp->vect.Length(); - double dot = pp->vect.dot(pp->angle.ZzANGLE.ToVector()); + double dot = pp->vect.dot(pp->Angles.ZzANGLE.ToVector()); if (dot < 0) climbVel = -climbVel; @@ -3406,7 +3406,7 @@ void DoPlayerClimb(PLAYER* pp) HitInfo near; // constantly look for new ladder sector because of warping at any time - neartag(pp->actor->getPosWithOffsetZ(), pp->cursector, pp->angle.ZzANGLE, near, 50., NT_Lotag | NT_Hitag | NT_NoSpriteCheck); + neartag(pp->actor->getPosWithOffsetZ(), pp->cursector, pp->Angles.ZzANGLE, near, 50., NT_Lotag | NT_Hitag | NT_NoSpriteCheck); if (near.hitWall) { @@ -3425,7 +3425,7 @@ void DoPlayerClimb(PLAYER* pp) pp->LadderPosition = lActor->spr.pos.XY() + nvec; - pp->angle.setYaw(lActor->spr.Angles.Yaw + DAngle180); + pp->Angles.setYaw(lActor->spr.Angles.Yaw + DAngle180); } } } @@ -3446,7 +3446,7 @@ int DoPlayerWadeSuperJump(PLAYER* pp) //for (i = 0; i < SIZ(angs); i++) { - FAFhitscan(DVector3(pp->actor->spr.pos.XY(), zh), pp->cursector, DVector3(pp->angle.ZzANGLE.ToVector() * 1024, 0), hit, CLIPMASK_MISSILE); + FAFhitscan(DVector3(pp->actor->spr.pos.XY(), zh), pp->cursector, DVector3(pp->Angles.ZzANGLE.ToVector() * 1024, 0), hit, CLIPMASK_MISSILE); if (hit.hitWall != nullptr && hit.hitSector != nullptr) { @@ -3759,9 +3759,9 @@ bool PlayerOnLadder(PLAYER* pp) if (Prediction) return false; - neartag(pp->actor->getPosWithOffsetZ(), pp->cursector, pp->angle.ZzANGLE, near, 64. + 48., NT_Lotag | NT_Hitag); + neartag(pp->actor->getPosWithOffsetZ(), pp->cursector, pp->Angles.ZzANGLE, near, 64. + 48., NT_Lotag | NT_Hitag); - double dir = pp->vect.dot(pp->angle.ZzANGLE.ToVector()); + double dir = pp->vect.dot(pp->Angles.ZzANGLE.ToVector()); if (dir < 0) return false; @@ -3771,12 +3771,12 @@ bool PlayerOnLadder(PLAYER* pp) for (i = 0; i < SIZ(angles); i++) { - neartag(pp->actor->getPosWithOffsetZ(), pp->cursector, pp->angle.ZzANGLE + angles[i], near, 37.5, NT_Lotag | NT_Hitag | NT_NoSpriteCheck); + neartag(pp->actor->getPosWithOffsetZ(), pp->cursector, pp->Angles.ZzANGLE + angles[i], near, 37.5, NT_Lotag | NT_Hitag | NT_NoSpriteCheck); if (near.hitWall == nullptr || near.hitpos.X < 6.25 || near.hitWall->lotag != TAG_WALL_CLIMB) return false; - FAFhitscan(pp->actor->getPosWithOffsetZ(), pp->cursector, DVector3((pp->angle.ZzANGLE + angles[i]).ToVector() * 1024, 0), hit, CLIPMASK_MISSILE); + FAFhitscan(pp->actor->getPosWithOffsetZ(), pp->cursector, DVector3((pp->Angles.ZzANGLE + angles[i]).ToVector() * 1024, 0), hit, CLIPMASK_MISSILE); if (hit.actor() != nullptr) { @@ -3813,7 +3813,7 @@ bool PlayerOnLadder(PLAYER* pp) // the sprite pp->LadderPosition = lActor->spr.pos + npos; - pp->angle.setYaw(lActor->spr.Angles.Yaw + DAngle180); + pp->Angles.setYaw(lActor->spr.Angles.Yaw + DAngle180); return true; } @@ -5122,7 +5122,7 @@ void DoPlayerBeginOperate(PLAYER* pp) pp->sop = pp->sop_control = sop; sop->controller = pp->actor; - pp->angle.ZzOLDANGLE = pp->angle.ZzANGLE = sop->ang; + pp->Angles.ZzOLDANGLE = pp->Angles.ZzANGLE = sop->ang; pp->actor->spr.pos.XY() = sop->pmid.XY(); updatesector(pp->actor->getPosWithOffsetZ(), &pp->cursector); calcSlope(pp->cursector, pp->actor->getPosWithOffsetZ(), &cz, &fz); @@ -5212,7 +5212,7 @@ void DoPlayerBeginRemoteOperate(PLAYER* pp, SECTOR_OBJECT* sop) auto save_sect = pp->cursector; - pp->angle.ZzOLDANGLE = pp->angle.ZzANGLE = sop->ang; + pp->Angles.ZzOLDANGLE = pp->Angles.ZzANGLE = sop->ang; pp->actor->spr.pos.XY() = sop->pmid.XY(); updatesector(pp->actor->getPosWithOffsetZ(), &pp->cursector); calcSlope(pp->cursector, pp->actor->getPosWithOffsetZ(), &cz, &fz); @@ -5334,9 +5334,9 @@ void DoPlayerStopOperate(PLAYER* pp) { DSWActor* rsp = pp->remoteActor; if (TEST_BOOL1(rsp)) - pp->angle.ZzANGLE = pp->angle.ZzOLDANGLE = rsp->spr.Angles.Yaw; // check me out later. + pp->Angles.ZzANGLE = pp->Angles.ZzOLDANGLE = rsp->spr.Angles.Yaw; // check me out later. else - pp->angle.ZzANGLE = pp->angle.ZzOLDANGLE = (pp->sop_remote->pmid.XY() - pp->actor->spr.pos.XY()).Angle(); + pp->Angles.ZzANGLE = pp->Angles.ZzOLDANGLE = (pp->sop_remote->pmid.XY() - pp->actor->spr.pos.XY()).Angle(); } if (pp->sop_control) @@ -5876,11 +5876,11 @@ void DoPlayerBeginDie(PLAYER* pp) static inline void DoPlayerDeathHoriz(PLAYER* pp, const DAngle target, const double speed) { - auto targetdelta = deltaangle(pp->horizon.ZzHORIZON, target); + auto targetdelta = deltaangle(pp->Angles.ZzHORIZON, target); if (abs(targetdelta.Degrees()) > 1) { - pp->horizon.addPitch(DAngle::fromDeg(speed * targetdelta.Sgn())); + pp->Angles.addPitch(DAngle::fromDeg(speed * targetdelta.Sgn())); } } @@ -5968,7 +5968,7 @@ void DoPlayerDeathFollowKiller(PLAYER* pp) { if (FAFcansee(ActorVectOfTop(killer), killer->sector(), pp->actor->getPosWithOffsetZ(), pp->cursector)) { - pp->angle.addYaw(deltaangle(pp->angle.ZzANGLE, (killer->spr.pos.XY() - pp->actor->spr.pos.XY()).Angle()) * (1. / 16.)); + pp->Angles.addYaw(deltaangle(pp->Angles.ZzANGLE, (killer->spr.pos.XY() - pp->actor->spr.pos.XY()).Angle()) * (1. / 16.)); } } } @@ -6004,7 +6004,7 @@ void DoPlayerDeathCheckKeys(PLAYER* pp) plActor->spr.picnum = plActor->user.State->Pic; plActor->spr.picnum = plActor->user.State->Pic; plActor->spr.cstat &= ~(CSTAT_SPRITE_YCENTER); - plActor->spr.Angles.Yaw = pp->angle.ZzANGLE; // check me out later. + plActor->spr.Angles.Yaw = pp->Angles.ZzANGLE; // check me out later. DoSpawnTeleporterEffect(plActor); PlaySound(DIGI_TELEPORT, pp, v3df_none); @@ -6023,7 +6023,7 @@ void DoPlayerDeathCheckKeys(PLAYER* pp) pp->input.actions |= SB_CENTERVIEW; plActor->spr.scale = DVector2(PLAYER_NINJA_XREPEAT, PLAYER_NINJA_YREPEAT); - pp->horizon.ZzHORIZON = nullAngle; + pp->Angles.ZzHORIZON = nullAngle; plActor->user.ID = NINJA_RUN_R0; PlayerDeathReset(pp); @@ -6693,8 +6693,8 @@ void MoveSkipSavePos(void) pp->actor->backuppos(); pp->obob_z = pp->bob_z; - pp->angle.backupYaw(); - pp->horizon.backupPitch(); + pp->Angles.backupYaw(); + pp->Angles.backupPitch(); pp->opbob_amt = pp->pbob_amt; } @@ -6972,7 +6972,7 @@ void domovethings(void) // auto tracking mode for single player multi-game if (numplayers <= 1 && PlayerTrackingMode && pnum == screenpeek && screenpeek != myconnectindex) { - Player[screenpeek].angle.setYaw((Player[myconnectindex].actor->spr.pos.XY() - Player[screenpeek].actor->spr.pos.XY()).Angle()); + Player[screenpeek].Angles.setYaw((Player[myconnectindex].actor->spr.pos.XY() - Player[screenpeek].actor->spr.pos.XY()).Angle()); } if (!(pp->Flags & PF_DEAD)) @@ -6987,8 +6987,8 @@ void domovethings(void) // Reset flags used while tying input to framerate pp->Flags2 &= ~(PF2_INPUT_CAN_AIM|PF2_INPUT_CAN_TURN_GENERAL|PF2_INPUT_CAN_TURN_VEHICLE|PF2_INPUT_CAN_TURN_TURRET); - pp->horizon.resetAdjustmentPitch(); - pp->angle.resetAdjustmentYaw(); + pp->Angles.resetAdjustmentPitch(); + pp->Angles.resetAdjustmentYaw(); // disable synchronised input if set by game. resetForcedSyncInput(); @@ -7042,13 +7042,13 @@ void InitAllPlayers(void) extern bool NewGame; //int fz,cz; - pfirst->horizon.ZzHORIZON = nullAngle; + pfirst->Angles.ZzHORIZON = nullAngle; // Initialize all [MAX_SW_PLAYERS] arrays here! for (pp = Player; pp < &Player[MAX_SW_PLAYERS]; pp++) { - pp->angle.ZzANGLE = pp->angle.ZzOLDANGLE = pfirst->angle.ZzANGLE; - pp->horizon.ZzHORIZON = pp->horizon.ZzOLDHORIZON = pfirst->horizon.ZzHORIZON; + pp->Angles.ZzANGLE = pp->Angles.ZzOLDANGLE = pfirst->Angles.ZzANGLE; + pp->Angles.ZzHORIZON = pp->Angles.ZzOLDHORIZON = pfirst->Angles.ZzHORIZON; pp->cursector = pfirst->cursector; // set like this so that player can trigger something on start of the level pp->lastcursector = pfirst->cursector+1; @@ -7083,7 +7083,7 @@ void InitAllPlayers(void) pp->FadeAmt = 0; pp->FadeTics = 0; pp->StartColor = 0; - pp->horizon.ZzHORIZOFF = nullAngle; + pp->Angles.ZzHORIZOFF = nullAngle; INITLIST(&pp->PanelSpriteList); } @@ -7203,7 +7203,7 @@ void PlayerSpawnPosition(PLAYER* pp) ASSERT(spawn_sprite != nullptr); - pp->angle.ZzANGLE = pp->angle.ZzOLDANGLE = spawn_sprite->spr.Angles.Yaw; // check me out later. + pp->Angles.ZzANGLE = pp->Angles.ZzOLDANGLE = spawn_sprite->spr.Angles.Yaw; // check me out later. pp->setcursector(spawn_sprite->sector()); if (pp->actor) @@ -7266,7 +7266,7 @@ void InitMultiPlayerInfo(const DVector3& spawnpos) continue; } - auto start0 = SpawnActor(MultiStatList[stat], ST1, nullptr, pp->cursector, spawnpos.plusZ(PLAYER_HEIGHTF), pp->angle.ZzANGLE); + auto start0 = SpawnActor(MultiStatList[stat], ST1, nullptr, pp->cursector, spawnpos.plusZ(PLAYER_HEIGHTF), pp->Angles.ZzANGLE); start0->viewzoffset = -PLAYER_HEIGHTF; // if too close to the floor - stand up @@ -7559,7 +7559,7 @@ DEFINE_ACTION_FUNCTION(_SWPlayer, MaxUserHealth) DEFINE_ACTION_FUNCTION(_SWPlayer, GetBuildAngle) { PARAM_SELF_STRUCT_PROLOGUE(PLAYER); - ACTION_RETURN_INT(self->angle.ZzANGLE.Buildang()); + ACTION_RETURN_INT(self->Angles.ZzANGLE.Buildang()); } DEFINE_ACTION_FUNCTION(_SW, WeaponMaxAmmo) diff --git a/source/games/sw/src/save.cpp b/source/games/sw/src/save.cpp index 6ce80a3dc..0ded91698 100644 --- a/source/games/sw/src/save.cpp +++ b/source/games/sw/src/save.cpp @@ -473,8 +473,8 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PLAYER& w, PLAYER* ("camera_check_time_delay", w.camera_check_time_delay) ("cursectnum", w.cursector) ("lastcursectnum", w.lastcursector) - ("horizon", w.horizon) - ("angle", w.angle) + ("horizon", w.Angles) + ("angle", w.Angles) ("recoil_amt", w.recoil_amt) ("recoil_speed", w.recoil_speed) ("recoil_ndx", w.recoil_ndx) diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index 28bcc5f9b..05de16c4e 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -2140,7 +2140,7 @@ bool NearThings(PLAYER* pp) return false; } - neartag(pp->actor->getPosWithOffsetZ(), pp->cursector, pp->angle.ZzANGLE, near, 64., NT_Lotag | NT_Hitag); + neartag(pp->actor->getPosWithOffsetZ(), pp->cursector, pp->Angles.ZzANGLE, near, 64., NT_Lotag | NT_Hitag); // hit a sprite? Check to see if it has sound info in it! @@ -2173,7 +2173,7 @@ bool NearThings(PLAYER* pp) { HitInfo hit{}; - FAFhitscan(pp->actor->getPosWithOffsetZ().plusZ(-30), pp->cursector, DVector3(pp->angle.ZzANGLE.ToVector() * 1024, 0), hit, CLIPMASK_MISSILE); + FAFhitscan(pp->actor->getPosWithOffsetZ().plusZ(-30), pp->cursector, DVector3(pp->Angles.ZzANGLE.ToVector() * 1024, 0), hit, CLIPMASK_MISSILE); if (hit.hitSector == nullptr) return false; @@ -2221,7 +2221,7 @@ void NearTagList(NEAR_TAG_INFO* ntip, PLAYER* pp, double z, double dist, int typ HitInfo near; - neartag(DVector3(pp->actor->spr.pos.XY(), z), pp->cursector, pp->angle.ZzANGLE, near, dist, type); + neartag(DVector3(pp->actor->spr.pos.XY(), z), pp->cursector, pp->Angles.ZzANGLE, near, dist, type); if (near.hitSector != nullptr) { diff --git a/source/games/sw/src/sounds.cpp b/source/games/sw/src/sounds.cpp index 09d5c7df8..e03dddb8c 100644 --- a/source/games/sw/src/sounds.cpp +++ b/source/games/sw/src/sounds.cpp @@ -603,7 +603,7 @@ void GameInterface::UpdateSounds(void) else tang = (pp->sop_remote->pmid.XY() - pp->actor->spr.pos.XY()).Angle(); } - else tang = pp->angle.ZzANGLE; + else tang = pp->Angles.ZzANGLE; listener.angle = float(-tang.Radians()); listener.velocity.Zero(); diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index d3a98bd59..02ffdc413 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -1480,7 +1480,7 @@ void MovePlayer(PLAYER* pp, SECTOR_OBJECT* sop, const DVector2& move) { pp->Flags |= (PF_PLAYER_RIDING); - pp->RevolveAng = pp->angle.ZzANGLE; + pp->RevolveAng = pp->Angles.ZzANGLE; pp->Revolve.XY() = pp->actor->spr.pos.XY(); // set the delta angle to 0 when moving @@ -1502,7 +1502,7 @@ void MovePlayer(PLAYER* pp, SECTOR_OBJECT* sop, const DVector2& move) // save the current information so when Player stops // moving then you // know where he was last - pp->RevolveAng = pp->angle.ZzANGLE; + pp->RevolveAng = pp->Angles.ZzANGLE; pp->Revolve.XY() = pp->actor->spr.pos.XY(); // set the delta angle to 0 when moving @@ -1516,7 +1516,7 @@ void MovePlayer(PLAYER* pp, SECTOR_OBJECT* sop, const DVector2& move) pp->Revolve += move; // Last known angle is now adjusted by the delta angle - pp->RevolveAng = deltaangle(pp->RevolveDeltaAng, pp->angle.ZzANGLE); + pp->RevolveAng = deltaangle(pp->RevolveDeltaAng, pp->Angles.ZzANGLE); } // increment Players delta angle @@ -1529,7 +1529,7 @@ void MovePlayer(PLAYER* pp, SECTOR_OBJECT* sop, const DVector2& move) // New angle is formed by taking last known angle and // adjusting by the delta angle - pp->angle.addYaw(deltaangle(pp->RevolveAng + pp->RevolveDeltaAng, pp->angle.ZzANGLE)); + pp->Angles.addYaw(deltaangle(pp->RevolveAng + pp->RevolveDeltaAng, pp->Angles.ZzANGLE)); UpdatePlayerSprite(pp); } diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 7e514b6f6..34b6636d8 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -11534,7 +11534,7 @@ int DoRing(DSWActor* actor) // put it out there actor->spr.pos += actor->spr.Angles.Yaw.ToVector() * actor->user.Dist; - if (pp) actor->spr.pos.Z -= actor->user.Dist * pp->horizon.ZzHORIZON.Tan() * 2.; // horizon math sucks... + if (pp) actor->spr.pos.Z -= actor->user.Dist * pp->Angles.ZzHORIZON.Tan() * 2.; // horizon math sucks... SetActor(actor, actor->spr.pos); @@ -11584,7 +11584,7 @@ void InitSpellRing(PLAYER* pp) DAngle ang_diff = DAngle360 / max_missiles; - DAngle ang_start = pp->angle.ZzANGLE - DAngle180; + DAngle ang_start = pp->Angles.ZzANGLE - DAngle180; if (!SW_SHAREWARE) PlaySound(DIGI_RFWIZ, pp, v3df_none); @@ -11612,7 +11612,7 @@ void InitSpellRing(PLAYER* pp) // put it out there actorNew->spr.pos += actorNew->spr.Angles.Yaw.ToVector() * actorNew->user.Dist; - actorNew->spr.pos.Z += pp->actor->getOffsetZ() + 20 - (actorNew->user.Dist * pp->horizon.ZzHORIZON.Tan() * 2.); // horizon math sucks... + actorNew->spr.pos.Z += pp->actor->getOffsetZ() + 20 - (actorNew->user.Dist * pp->Angles.ZzHORIZON.Tan() * 2.); // horizon math sucks... actorNew->spr.Angles.Yaw += DAngle90; @@ -11971,7 +11971,7 @@ void InitSpellNapalm(PLAYER* pp) for (i = 0; i < SIZ(mp); i++) { auto actor = SpawnActor(STAT_MISSILE, FIREBALL1, s_Napalm, pp->cursector, - pp->actor->getPosWithOffsetZ().plusZ(12), pp->angle.ZzANGLE, NAPALM_VELOCITY*2); + pp->actor->getPosWithOffsetZ().plusZ(12), pp->Angles.ZzANGLE, NAPALM_VELOCITY*2); actor->spr.hitag = LUMINOUS; //Always full brightness @@ -11984,7 +11984,7 @@ void InitSpellNapalm(PLAYER* pp) actor->spr.shade = -40; actor->spr.scale = DVector2(0.5, 0.5); actor->clipdist = 0; - setFreeAimVelocity(actor->vel.X, actor->vel.Z, pp->horizon.ZzHORIZON, HORIZ_MULTF); + setFreeAimVelocity(actor->vel.X, actor->vel.Z, pp->Angles.ZzHORIZON, HORIZ_MULTF); actor->spr.cstat |= (CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_YCENTER); actor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); actor->user.Flags2 |= (SPR2_BLUR_TAPER_FAST); @@ -12106,7 +12106,7 @@ int InitSpellMirv(PLAYER* pp) if (!pp->insector()) return 0; - auto actorNew = SpawnActor(STAT_MISSILE, FIREBALL1, s_Mirv, pp->cursector, pp->actor->getPosWithOffsetZ().plusZ(12), pp->angle.ZzANGLE, MIRV_VELOCITY); + auto actorNew = SpawnActor(STAT_MISSILE, FIREBALL1, s_Mirv, pp->cursector, pp->actor->getPosWithOffsetZ().plusZ(12), pp->Angles.ZzANGLE, MIRV_VELOCITY); PlaySound(DIGI_MIRVWIZ, actorNew, v3df_follow); @@ -12114,7 +12114,7 @@ int InitSpellMirv(PLAYER* pp) actorNew->spr.shade = -40; actorNew->spr.scale = DVector2(1.125, 1.125); actorNew->clipdist = 2; - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->horizon.ZzHORIZON, HORIZ_MULTF); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.ZzHORIZON, HORIZ_MULTF); actorNew->spr.cstat |= (CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_YCENTER); actorNew->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); @@ -12201,7 +12201,7 @@ int InitSwordAttack(PLAYER* pp) bubble = SpawnBubble(pp->actor); if (bubble != nullptr) { - bubble->spr.Angles.Yaw = pp->angle.ZzANGLE; // check me out later. + bubble->spr.Angles.Yaw = pp->Angles.ZzANGLE; // check me out later. auto random_amt = RandomAngle(DAngle22_5 / 4) - DAngle22_5 / 8; @@ -12248,9 +12248,9 @@ int InitSwordAttack(PLAYER* pp) HitInfo hit{}; double dax = 1024., daz = 0; - DAngle daang = pp->angle.ZzANGLE; - setFreeAimVelocity(dax, daz, pp->horizon.ZzHORIZON, 1000. - (RandomRangeF(24000 / 256.) - 12000 / 256.)); - FAFhitscan(pp->actor->getPosWithOffsetZ(), pp->cursector, DVector3(pp->angle.ZzANGLE.ToVector() * dax, daz), hit, CLIPMASK_MISSILE); + DAngle daang = pp->Angles.ZzANGLE; + setFreeAimVelocity(dax, daz, pp->Angles.ZzHORIZON, 1000. - (RandomRangeF(24000 / 256.) - 12000 / 256.)); + FAFhitscan(pp->actor->getPosWithOffsetZ(), pp->cursector, DVector3(pp->Angles.ZzANGLE.ToVector() * dax, daz), hit, CLIPMASK_MISSILE); if (hit.hitSector == nullptr) return 0; @@ -12326,7 +12326,7 @@ int InitSwordAttack(PLAYER* pp) if (hit.hitWall->lotag == TAG_WALL_BREAK) { - HitBreakWall(hit.hitWall, hit.hitpos, pp->angle.ZzANGLE, plActor->user.ID); + HitBreakWall(hit.hitWall, hit.hitpos, pp->Angles.ZzANGLE, plActor->user.ID); } // hit non breakable wall - do sound and puff else @@ -12369,7 +12369,7 @@ int InitFistAttack(PLAYER* pp) bubble = SpawnBubble(pp->actor); if (bubble != nullptr) { - bubble->spr.Angles.Yaw = pp->angle.ZzANGLE; // check me out later. + bubble->spr.Angles.Yaw = pp->Angles.ZzANGLE; // check me out later. auto random_amt = RandomAngle(DAngle22_5 / 4) - DAngle22_5 / 8; @@ -12426,9 +12426,9 @@ int InitFistAttack(PLAYER* pp) { HitInfo hit{}; double dax = 1024., daz = 0; - auto daang = pp->angle.ZzANGLE; - setFreeAimVelocity(dax, daz, pp->horizon.ZzHORIZON, 1000. - (RandomRangeF(24000 / 256.) - 12000 / 256.)); - FAFhitscan(pp->actor->getPosWithOffsetZ(), pp->cursector, DVector3(pp->angle.ZzANGLE.ToVector() * dax, daz), hit, CLIPMASK_MISSILE); + auto daang = pp->Angles.ZzANGLE; + setFreeAimVelocity(dax, daz, pp->Angles.ZzHORIZON, 1000. - (RandomRangeF(24000 / 256.) - 12000 / 256.)); + FAFhitscan(pp->actor->getPosWithOffsetZ(), pp->cursector, DVector3(pp->Angles.ZzANGLE.ToVector() * dax, daz), hit, CLIPMASK_MISSILE); if (hit.hitSector == nullptr) return 0; @@ -12517,7 +12517,7 @@ int InitFistAttack(PLAYER* pp) if (hit.hitWall->lotag == TAG_WALL_BREAK) { - HitBreakWall(hit.hitWall, hit.hitpos, pp->angle.ZzANGLE, plActor->user.ID); + HitBreakWall(hit.hitWall, hit.hitpos, pp->Angles.ZzANGLE, plActor->user.ID); } // hit non breakable wall - do sound and puff else @@ -12980,7 +12980,7 @@ int InitStar(PLAYER* pp) // Spawn a shot // Inserting and setting up variables - auto actorNew = SpawnActor(STAT_MISSILE, STAR1, s_Star, pp->cursector, pos, pp->angle.ZzANGLE, STAR_VELOCITY); + auto actorNew = SpawnActor(STAT_MISSILE, STAR1, s_Star, pp->cursector, pos, pp->Angles.ZzANGLE, STAR_VELOCITY); SetOwner(pp->actor, actorNew); actorNew->spr.scale = DVector2(STAR_REPEAT, STAR_REPEAT); @@ -12988,7 +12988,7 @@ int InitStar(PLAYER* pp) actorNew->clipdist = 2; // zvel was overflowing with this calculation - had to move to a local long var double zvel = 0; - setFreeAimVelocity(actorNew->vel.X, zvel, pp->horizon.ZzHORIZON, (HORIZ_MULT + STAR_HORIZ_ADJ) * 0.5); + setFreeAimVelocity(actorNew->vel.X, zvel, pp->Angles.ZzHORIZON, (HORIZ_MULT + STAR_HORIZ_ADJ) * 0.5); actorNew->user.ceiling_dist = (1); actorNew->user.floor_dist = (1); @@ -13080,7 +13080,7 @@ void InitHeartAttack(PLAYER* pp) return; auto actorNew = SpawnActor(STAT_MISSILE_SKIP4, BLOOD_WORM, s_BloodWorm, pp->cursector, - pp->actor->getPosWithOffsetZ().plusZ(12), pp->angle.ZzANGLE, BLOOD_WORM_VELOCITY*2); + pp->actor->getPosWithOffsetZ().plusZ(12), pp->Angles.ZzANGLE, BLOOD_WORM_VELOCITY*2); actorNew->spr.hitag = LUMINOUS; //Always full brightness @@ -13088,7 +13088,7 @@ void InitHeartAttack(PLAYER* pp) actorNew->spr.shade = -10; actorNew->spr.scale = DVector2(0.8125, 0.8125); actorNew->clipdist = 0; - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->horizon.ZzHORIZON, HORIZ_MULTF); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.ZzHORIZON, HORIZ_MULTF); actorNew->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); actorNew->user.Flags2 |= (SPR2_DONT_TARGET_OWNER); actorNew->spr.cstat |= (CSTAT_SPRITE_INVISIBLE); @@ -13230,8 +13230,8 @@ int InitShotgun(PLAYER* pp) DAngle daang = DAngle22_5 * 0.5; if (WeaponAutoAimHitscan(pp->actor, &daz, &daang, false) == nullptr) { - setFreeAimVelocity(dax, daz, pp->horizon.ZzHORIZON, 1000.); - daang = pp->angle.ZzANGLE; + setFreeAimVelocity(dax, daz, pp->Angles.ZzHORIZON, 1000.); + daang = pp->Angles.ZzANGLE; } double ndaz; @@ -13383,7 +13383,7 @@ int InitLaser(PLAYER* pp) // Spawn a shot // Inserting and setting up variables - auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, s_Laser, pp->cursector, pos, pp->angle.ZzANGLE, 18.75); + auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, s_Laser, pp->cursector, pos, pp->Angles.ZzANGLE, 18.75); actorNew->spr.hitag = LUMINOUS; //Always full brightness SetOwner(pp->actor, actorNew); @@ -13392,7 +13392,7 @@ int InitLaser(PLAYER* pp) actorNew->clipdist = 4; // the slower the missile travels the less of a zvel it needs - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->horizon.ZzHORIZON, 16.); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.ZzHORIZON, 16.); actorNew->user.WeaponNum = actor->user.WeaponNum; actorNew->user.Radius = 200; @@ -13481,13 +13481,13 @@ int InitRail(PLAYER* pp) // Spawn a shot // Inserting and setting up variables - auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R1, &s_Rail[0][0], pp->cursector, pos, pp->angle.ZzANGLE, 75); + auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R1, &s_Rail[0][0], pp->cursector, pos, pp->Angles.ZzANGLE, 75); SetOwner(pp->actor, actorNew); actorNew->spr.scale = DVector2(0.8125, 0.8125); actorNew->spr.shade = -15; - setFreeAimVelocity(actorNew->vel.X, zvel, pp->horizon.ZzHORIZON, (HORIZ_MULT + 17) * 0.5); + setFreeAimVelocity(actorNew->vel.X, zvel, pp->Angles.ZzHORIZON, (HORIZ_MULT + 17) * 0.5); actorNew->user.RotNum = 5; NewStateGroup(actorNew, &sg_Rail[0]); @@ -13646,12 +13646,12 @@ int InitRocket(PLAYER* pp) // Spawn a shot // Inserting and setting up variables - auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, &s_Rocket[0][0], pp->cursector, pos, pp->angle.ZzANGLE, ROCKET_VELOCITY); + auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, &s_Rocket[0][0], pp->cursector, pos, pp->Angles.ZzANGLE, ROCKET_VELOCITY); SetOwner(pp->actor, actorNew); actorNew->spr.scale = DVector2(1.40626, 1.40625); actorNew->spr.shade = -15; - setFreeAimVelocity(actorNew->vel.X, zvel, pp->horizon.ZzHORIZON, (HORIZ_MULT + 35) * 0.5); + setFreeAimVelocity(actorNew->vel.X, zvel, pp->Angles.ZzHORIZON, (HORIZ_MULT + 35) * 0.5); actorNew->clipdist = 4; @@ -13753,12 +13753,12 @@ int InitBunnyRocket(PLAYER* pp) // Spawn a shot // Inserting and setting up variables - auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R4, &s_BunnyRocket[0][0], pp->cursector, pos, pp->angle.ZzANGLE, ROCKET_VELOCITY); + auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R4, &s_BunnyRocket[0][0], pp->cursector, pos, pp->Angles.ZzANGLE, ROCKET_VELOCITY); SetOwner(pp->actor, actorNew); actorNew->spr.scale = DVector2(1, 1); actorNew->spr.shade = -15; - setFreeAimVelocity(actorNew->vel.X, zvel, pp->horizon.ZzHORIZON, (HORIZ_MULT + 35) * 0.5); + setFreeAimVelocity(actorNew->vel.X, zvel, pp->Angles.ZzHORIZON, (HORIZ_MULT + 35) * 0.5); actorNew->clipdist = 4; @@ -13855,12 +13855,12 @@ int InitNuke(PLAYER* pp) // Spawn a shot // Inserting and setting up variables - auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, &s_Rocket[0][0], pp->cursector, pos, pp->angle.ZzANGLE, 700/16.); + auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, &s_Rocket[0][0], pp->cursector, pos, pp->Angles.ZzANGLE, 700/16.); SetOwner(pp->actor, actorNew); actorNew->spr.scale = DVector2(2, 2); actorNew->spr.shade = -15; - setFreeAimVelocity(actorNew->vel.X, zvel, pp->horizon.ZzHORIZON, (HORIZ_MULT + 36) * 0.5); + setFreeAimVelocity(actorNew->vel.X, zvel, pp->Angles.ZzHORIZON, (HORIZ_MULT + 36) * 0.5); actorNew->clipdist = 4; // Set to red palette @@ -13912,7 +13912,7 @@ int InitNuke(PLAYER* pp) UpdateChangeXY(actorNew); actorNew->user.change.Z = zvel; - PlayerDamageSlide(pp, -40, pp->angle.ZzANGLE + DAngle180); // Recoil slide + PlayerDamageSlide(pp, -40, pp->Angles.ZzANGLE + DAngle180); // Recoil slide return 0; } @@ -14016,7 +14016,7 @@ int InitMicro(PLAYER* pp) return 0; double vel = 75., zvel = 0; - setFreeAimVelocity(vel, zvel, pp->horizon.ZzHORIZON, HORIZ_MULTF); + setFreeAimVelocity(vel, zvel, pp->Angles.ZzHORIZON, HORIZ_MULTF); for (i = 0; i < MAX_MICRO; i++) { @@ -14031,7 +14031,7 @@ int InitMicro(PLAYER* pp) else { picked = nullptr; - angle = pp->angle.ZzANGLE; + angle = pp->Angles.ZzANGLE; } auto pos = pp->actor->getPosWithOffsetZ().plusZ(pp->bob_z + 4 + RandomRange(20)); @@ -15221,12 +15221,12 @@ int InitTracerUzi(PLAYER* pp) static const short lat_dist[] = {800,-800}; - double nz = 8 + (pp->horizon.ZzHORIZON.Tan() * 36.); + double nz = 8 + (pp->Angles.ZzHORIZON.Tan() * 36.); // Spawn a shot // Inserting and setting up variables - auto actorNew = SpawnActor(STAT_MISSILE, 0, s_Tracer, pp->cursector, pp->actor->getPosWithOffsetZ().plusZ(nz), pp->angle.ZzANGLE, TRACER_VELOCITY); + auto actorNew = SpawnActor(STAT_MISSILE, 0, s_Tracer, pp->cursector, pp->actor->getPosWithOffsetZ().plusZ(nz), pp->Angles.ZzANGLE, TRACER_VELOCITY); actorNew->spr.hitag = LUMINOUS; //Always full brightness SetOwner(pp->actor, actorNew); @@ -15260,7 +15260,7 @@ int InitTracerUzi(PLAYER* pp) return 0; } - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->horizon.ZzHORIZON, actorNew->vel.X); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.ZzHORIZON, actorNew->vel.X); plActor->clipdist = oclipdist; @@ -15524,8 +15524,8 @@ int InitUzi(PLAYER* pp) } else { - daang = pp->angle.ZzANGLE + mapangle(RandomRange(24) - 12); - setFreeAimVelocity(dax, daz, pp->horizon.ZzHORIZON, 1000. - (RandomRangeF(24000/256.) - 12000/256.)); + daang = pp->Angles.ZzANGLE + mapangle(RandomRange(24) - 12); + setFreeAimVelocity(dax, daz, pp->Angles.ZzHORIZON, 1000. - (RandomRangeF(24000/256.) - 12000/256.)); } DVector3 vect(daang.ToVector() * dax, daz); @@ -15697,7 +15697,7 @@ int InitTankShell(DSWActor* actor, PLAYER* pp) actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER); actorNew->spr.cstat |= (CSTAT_SPRITE_INVISIBLE); - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->horizon.ZzHORIZON, actorNew->vel.X); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.ZzHORIZON, actorNew->vel.X); WeaponAutoAim(actor, actorNew, DAngle22_5 / 2, false); // a bit of randomness @@ -15765,7 +15765,7 @@ int InitTurretMicro(DSWActor* actor, PLAYER* pp) SetOwner(plActor, actorNew); actorNew->spr.scale = DVector2(0.375, 0.375); actorNew->spr.shade = -15; - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->horizon.ZzHORIZON, HORIZ_MULTF - RandomRangeF(8) + 5); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.ZzHORIZON, HORIZ_MULTF - RandomRangeF(8) + 5); actorNew->clipdist = 4; @@ -15834,7 +15834,7 @@ int InitTurretRocket(DSWActor* actor, PLAYER* pp) actorNew->user.Flags2 |= (SPR2_SO_MISSILE); actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER); - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->horizon.ZzHORIZON, actorNew->vel.X); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.ZzHORIZON, actorNew->vel.X); WeaponAutoAim(actor, actorNew, DAngle22_5 / 2, false); // a bit of randomness @@ -15873,7 +15873,7 @@ int InitTurretFireball(DSWActor* actor, PLAYER* pp) actorNew->user.Flags2 |= (SPR2_SO_MISSILE); actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER); - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->horizon.ZzHORIZON, actorNew->vel.X); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.ZzHORIZON, actorNew->vel.X); WeaponAutoAim(actor, actorNew, DAngle22_5 / 2, false); // a bit of randomness @@ -15910,7 +15910,7 @@ int InitTurretRail(DSWActor* actor, PLAYER* pp) SetOwner(pp->actor, actorNew); actorNew->spr.scale = DVector2(0.8125, 0.8125); actorNew->spr.shade = -15; - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->horizon.ZzHORIZON, HORIZ_MULTF); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.ZzHORIZON, HORIZ_MULTF); actorNew->user.RotNum = 5; NewStateGroup(actorNew, &sg_Rail[0]); @@ -15957,7 +15957,7 @@ int InitTurretLaser(DSWActor* actor, PLAYER* pp) actorNew->spr.shade = -15; // the slower the missile travels the less of a zvel it needs - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->horizon.ZzHORIZON, 16.); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.ZzHORIZON, 16.); actorNew->user.Radius = 200; actorNew->user.ceiling_dist = (1); @@ -15996,7 +15996,7 @@ int InitSobjMachineGun(DSWActor* actor, PLAYER* pp) double daz = npos.Z; if (RANDOM_P2(1024) < 200) - InitTracerTurret(actor, pp->actor, pp->horizon.ZzHORIZON); + InitTracerTurret(actor, pp->actor, pp->Angles.ZzHORIZON); DAngle daang = DAngle22_5 / 2; if (WeaponAutoAimHitscan(actor, &daz, &daang, false) != nullptr) @@ -16005,7 +16005,7 @@ int InitSobjMachineGun(DSWActor* actor, PLAYER* pp) } else { - setFreeAimVelocity(dax, daz, DAngle::fromDeg(min(pp->horizon.ZzHORIZON.Degrees(), 11.0515)), 1000 - RandomRangeF(80) + 40); + setFreeAimVelocity(dax, daz, DAngle::fromDeg(min(pp->Angles.ZzHORIZON.Degrees(), 11.0515)), 1000 - RandomRangeF(80) + 40); daang = actor->spr.Angles.Yaw; } @@ -16667,7 +16667,7 @@ int InitGrenade(PLAYER* pp) // Spawn a shot // Inserting and setting up variables - auto actorNew = SpawnActor(STAT_MISSILE, GRENADE, &s_Grenade[0][0], pp->cursector, pos, pp->angle.ZzANGLE, GRENADE_VELOCITY); + auto actorNew = SpawnActor(STAT_MISSILE, GRENADE, &s_Grenade[0][0], pp->cursector, pos, pp->Angles.ZzANGLE, GRENADE_VELOCITY); // don't throw it as far if crawling if (pp->Flags & (PF_CRAWLING)) @@ -16695,7 +16695,7 @@ int InitGrenade(PLAYER* pp) if (pp->Flags & (PF_DIVING) || SpriteInUnderwaterArea(actorNew)) actorNew->user.Flags |= (SPR_UNDERWATER); - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->horizon.ZzHORIZON, HORIZ_MULTF); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.ZzHORIZON, HORIZ_MULTF); auto oclipdist = actor->clipdist; actor->clipdist = 0; @@ -16805,13 +16805,13 @@ int InitMine(PLAYER* pp) // Spawn a shot // Inserting and setting up variables - auto actorNew = SpawnActor(STAT_MISSILE, MINE, s_Mine, pp->cursector, pos, pp->angle.ZzANGLE, MINE_VELOCITY); + auto actorNew = SpawnActor(STAT_MISSILE, MINE, s_Mine, pp->cursector, pos, pp->Angles.ZzANGLE, MINE_VELOCITY); SetOwner(pp->actor, actorNew); actorNew->spr.scale = DVector2(0.5, 0.5); actorNew->spr.shade = -15; actorNew->clipdist = 8; - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->horizon.ZzHORIZON, HORIZ_MULTF); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.ZzHORIZON, HORIZ_MULTF); actorNew->user.WeaponNum = actor->user.WeaponNum; actorNew->user.Radius = 200; actorNew->user.ceiling_dist = (5); @@ -16828,7 +16828,7 @@ int InitMine(PLAYER* pp) UpdateChange(actorNew, 0.5); - double dot = pp->vect.dot(pp->angle.ZzANGLE.ToVector()); + double dot = pp->vect.dot(pp->Angles.ZzANGLE.ToVector()); // don't adjust for strafing // not really sure what to do here as the original formula was very likely to overflow, creating a Q0.32 value. @@ -16933,7 +16933,7 @@ int InitFireball(PLAYER* pp) auto pos = pp->actor->getPosWithOffsetZ().plusZ(pp->bob_z + 15); - auto actorNew = SpawnActor(STAT_MISSILE, FIREBALL1, s_Fireball, pp->cursector, pos, pp->angle.ZzANGLE, FIREBALL_VELOCITY); + auto actorNew = SpawnActor(STAT_MISSILE, FIREBALL1, s_Fireball, pp->cursector, pos, pp->Angles.ZzANGLE, FIREBALL_VELOCITY); actorNew->spr.hitag = LUMINOUS; //Always full brightness actorNew->spr.scale = DVector2(0.625, 0.625); @@ -16946,7 +16946,7 @@ int InitFireball(PLAYER* pp) actorNew->user.ceiling_dist = (6); actorNew->user.floor_dist = (6); double zvel = 0.; - setFreeAimVelocity(actorNew->vel.X, zvel, pp->horizon.ZzHORIZON, 120.); + setFreeAimVelocity(actorNew->vel.X, zvel, pp->Angles.ZzHORIZON, 120.); // at certain angles the clipping box was big enough to block the // initial positioning of the fireball. diff --git a/source/games/sw/src/zombie.cpp b/source/games/sw/src/zombie.cpp index 4236c3f85..2efda4ec6 100644 --- a/source/games/sw/src/zombie.cpp +++ b/source/games/sw/src/zombie.cpp @@ -787,7 +787,7 @@ void SpawnZombie(PLAYER* pp, DSWActor* weaponActor) if (ownerActor == nullptr) return; - auto actorNew = SpawnActor(STAT_ENEMY, ZOMBIE_RUN_R0, s_ZombieRun[0], pp->cursector, pp->actor->getPosWithOffsetZ(), pp->angle.ZzANGLE, 0); + auto actorNew = SpawnActor(STAT_ENEMY, ZOMBIE_RUN_R0, s_ZombieRun[0], pp->cursector, pp->actor->getPosWithOffsetZ(), pp->Angles.ZzANGLE, 0); SetOwner(actorNew, ownerActor); actorNew->spr.pal = actorNew->user.spal = ownerActor->user.spal; actorNew->spr.Angles.Yaw = RandomAngle();