diff --git a/source/core/gameinput.cpp b/source/core/gameinput.cpp index 86f7f662eb7..4538ea9d941 100644 --- a/source/core/gameinput.cpp +++ b/source/core/gameinput.cpp @@ -350,7 +350,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngles& w, P w.ZzOLDROTSCRNANG = w.ZzROTSCRNANG; w.legacyDisabledYaw = w.legacyDisabledYaw; w.resetAdjustmentYaw(); - w.ZzOLDHORIZON = w.ZzHORIZON(); + w.ZzOLDHORIZON() = w.ZzHORIZON(); w.ZzOHORIZOFF = w.ZzHORIZOFF; w.legacyDisabledPitch = w.legacyDisabledPitch; w.resetAdjustmentPitch(); diff --git a/source/core/gameinput.h b/source/core/gameinput.h index d19935ed1e3..6776ec06ad5 100644 --- a/source/core/gameinput.h +++ b/source/core/gameinput.h @@ -14,6 +14,8 @@ struct PlayerAngles // Temporary wrappers. DAngle thisHoriz; DAngle& ZzHORIZON() { return thisHoriz; } + DAngle prevHoriz; + DAngle& ZzOLDHORIZON() { return prevHoriz; } friend FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngles& w, PlayerAngles* def); @@ -51,7 +53,7 @@ struct PlayerAngles else { ZzHORIZON() = value; - if (backup) ZzOLDHORIZON = ZzHORIZON(); + if (backup) ZzOLDHORIZON() = ZzHORIZON(); } } @@ -103,7 +105,7 @@ struct PlayerAngles // Legacy, to be removed. - DAngle ZzOLDHORIZON, ZzHORIZOFF, ZzOHORIZOFF; + DAngle ZzHORIZOFF, ZzOHORIZOFF; void processLegacyHelperPitch(double const scaleAdjust) { if (targetedPitch()) @@ -127,15 +129,15 @@ struct PlayerAngles } void backupPitch() { - ZzOLDHORIZON = ZzHORIZON(); + ZzOLDHORIZON() = ZzHORIZON(); ZzOHORIZOFF = ZzHORIZOFF; } void restorePitch() { - ZzHORIZON() = ZzOLDHORIZON; + ZzHORIZON() = ZzOLDHORIZON(); ZzHORIZOFF = ZzOHORIZOFF; } - DAngle horizOLDSUM() { return ZzOLDHORIZON + 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; } diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 65671b3052e..749a8ad6910 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -350,7 +350,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, break; case PLAYER_OHORIZ: - if (!bSet) SetGameVarID(lVar2, int(ps[iPlayer].Angles.ZzOLDHORIZON.Tan() * -128.), sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, int(ps[iPlayer].Angles.ZzOLDHORIZON().Tan() * -128.), sActor, sPlayer); break; case PLAYER_HORIZOFF: @@ -2247,7 +2247,7 @@ 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].Angles.ZzOLDHORIZON = ps[g_p].Angles.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].Angles.ZzOHORIZOFF = ps[g_p].Angles.ZzHORIZOFF = nullAngle; diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 64b680b2d77..c9bfe56acef 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -125,7 +125,7 @@ void resetplayerstats(int snum) p->footprintpal = 0; p->footprintshade = 0; p->jumping_toggle = 0; - p->Angles.ZzOLDHORIZON = p->Angles.ZzHORIZON() = DAngle::fromDeg(-17.354); + p->Angles.ZzOLDHORIZON() = p->Angles.ZzHORIZON() = DAngle::fromDeg(-17.354); p->Angles.ZzOHORIZOFF = p->Angles.ZzHORIZOFF = nullAngle; p->bobcounter = 0; p->on_ground = 0; diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index 76f212d5df3..26968530cec 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -411,7 +411,7 @@ void RestartPlayer(int nPlayer) plr->nThrust.Zero(); - plr->nDestVertPan = plr->Angles.ZzOLDHORIZON = plr->Angles.ZzHORIZON() = nullAngle; + plr->nDestVertPan = plr->Angles.ZzOLDHORIZON() = plr->Angles.ZzHORIZON() = nullAngle; plr->nBreathTimer = 90; plr->nTauntTimer = RandomSize(3) + 3; @@ -507,7 +507,7 @@ void StartDeathSeq(int nPlayer, int nVal) StopFiringWeapon(nPlayer); - PlayerList[nPlayer].Angles.ZzOLDHORIZON = PlayerList[nPlayer].Angles.ZzHORIZON() = nullAngle; + PlayerList[nPlayer].Angles.ZzOLDHORIZON() = PlayerList[nPlayer].Angles.ZzHORIZON() = nullAngle; pActor->oviewzoffset = pActor->viewzoffset = -55; PlayerList[nPlayer].nInvisible = 0; dVertPan[nPlayer] = 15; diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index e722871e34a..2ee78dc7634 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -7048,7 +7048,7 @@ void InitAllPlayers(void) for (pp = Player; pp < &Player[MAX_SW_PLAYERS]; pp++) { pp->Angles.ZzANGLE = pp->Angles.ZzOLDANGLE = pfirst->Angles.ZzANGLE; - pp->Angles.ZzHORIZON() = pp->Angles.ZzOLDHORIZON = pfirst->Angles.ZzHORIZON(); + 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;