diff --git a/source/core/gameinput.cpp b/source/core/gameinput.cpp index 5bc9f8580..b3e4f1860 100644 --- a/source/core/gameinput.cpp +++ b/source/core/gameinput.cpp @@ -176,7 +176,7 @@ void processMovement(InputPacket* const currInput, InputPacket* const inputBuffe void PlayerHorizon::applyinput(float const horz, ESyncBits* actions, double const scaleAdjust) { // Process only if movement isn't locked. - if (!movementlocked()) + if (!lockedPitch()) { // Process mouse input. if (horz) @@ -367,7 +367,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerHorizon& w, w.ZzOLDHORIZON = w.ZzHORIZON; w.ZzOHORIZOFF = w.ZzHORIZOFF; w.inputdisabled = w.inputdisabled; - w.resetadjustment(); + w.resetAdjustmentPitch(); } } return arc; diff --git a/source/core/gameinput.h b/source/core/gameinput.h index 5618db14b..92a32a4d2 100644 --- a/source/core/gameinput.h +++ b/source/core/gameinput.h @@ -17,12 +17,12 @@ struct PlayerHorizon void calcviewpitch(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 backup() + void backupPitch() { ZzOLDHORIZON = ZzHORIZON; ZzOHORIZOFF = ZzHORIZOFF; } - void restore() + void restorePitch() { ZzHORIZON = ZzOLDHORIZON; ZzHORIZOFF = ZzOHORIZOFF; @@ -34,16 +34,16 @@ struct PlayerHorizon DAngle horizLERPSUM(double const interpfrac) { return interpolatedvalue(horizOLDSUM(), horizSUM(), interpfrac); } // Ticrate playsim adjustment helpers. - void resetadjustment() { adjustment = nullAngle; } - bool targetset() { return target.Sgn(); } + void resetAdjustmentPitch() { adjustment = nullAngle; } + bool targetedPitch() { return target.Sgn(); } // Input locking helpers. - void lockinput() { inputdisabled = true; } - void unlockinput() { inputdisabled = false; } - bool movementlocked() { return targetset() || inputdisabled; } + void lockPitch() { inputdisabled = true; } + void unlockPitch() { inputdisabled = false; } + bool lockedPitch() { return targetedPitch() || inputdisabled; } // Ticrate playsim adjustment setters and processor. - void addadjustment(DAngle const value) + void addPitch(DAngle const value) { if (!SyncInput()) { @@ -55,7 +55,7 @@ struct PlayerHorizon } } - void settarget(DAngle value, bool const backup = false) + void setPitch(DAngle value, bool const backup = false) { // Clamp incoming variable because sometimes the caller can exceed bounds. value = ClampViewPitch(value); @@ -71,9 +71,9 @@ struct PlayerHorizon } } - void processhelpers(double const scaleAdjust) + void processLegacyHelperPitch(double const scaleAdjust) { - if (targetset()) + if (targetedPitch()) { auto delta = deltaangle(ZzHORIZON, target); diff --git a/source/games/blood/src/controls.cpp b/source/games/blood/src/controls.cpp index ec1498b2c..d17d2fcdc 100644 --- a/source/games/blood/src/controls.cpp +++ b/source/games/blood/src/controls.cpp @@ -68,7 +68,7 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju } pPlayer->angle.processhelpers(scaleAdjust); - pPlayer->horizon.processhelpers(scaleAdjust); + pPlayer->horizon.processLegacyHelperPitch(scaleAdjust); UpdatePlayerSpriteAngle(pPlayer); } diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index bedf7ce5f..0fd6c670a 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.settarget(maphoriz(-100. * tan(adjustment * pi::pi() * (1. / 1024.)))); - pPlayer->horizon.lockinput(); + pPlayer->horizon.setPitch(maphoriz(-100. * tan(adjustment * pi::pi() * (1. / 1024.)))); + pPlayer->horizon.lockPitch(); } } diff --git a/source/games/blood/src/player.cpp b/source/games/blood/src/player.cpp index 2005ce446..d697f1f38 100644 --- a/source/games/blood/src/player.cpp +++ b/source/games/blood/src/player.cpp @@ -1532,7 +1532,7 @@ void ProcessInput(PLAYER* pPlayer) Item_JumpBoots = 3 }; - pPlayer->horizon.resetadjustment(); + pPlayer->horizon.resetAdjustmentPitch(); pPlayer->angle.resetadjustment(); DBloodActor* actor = pPlayer->actor; @@ -1558,7 +1558,7 @@ void ProcessInput(PLAYER* pPlayer) } pPlayer->deathTime += 4; if (!bSeqStat) - pPlayer->horizon.addadjustment(deltaangle(pPlayer->horizon.ZzHORIZON, gi->playerPitchMax() * (1. - BobVal(min((pPlayer->deathTime << 3) + 512, 1536))) * 0.5)); + pPlayer->horizon.addPitch(deltaangle(pPlayer->horizon.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) @@ -1731,7 +1731,7 @@ void ProcessInput(PLAYER* pPlayer) } pPlayer->angle.unlockinput(); - pPlayer->horizon.unlockinput(); + pPlayer->horizon.unlockPitch(); pPlayer->slope = pPlayer->horizon.ZzHORIZON.Tan(); if (pInput->actions & SB_INVPREV) diff --git a/source/games/blood/src/view.cpp b/source/games/blood/src/view.cpp index dad4c42ce..76539ef98 100644 --- a/source/games/blood/src/view.cpp +++ b/source/games/blood/src/view.cpp @@ -66,7 +66,7 @@ void viewBackupView(int nPlayer) pPlayer->oswayHeight = pPlayer->swayHeight; pPlayer->oswayWidth = pPlayer->swayWidth; pPlayer->angle.backup(); - pPlayer->horizon.backup(); + pPlayer->horizon.backupPitch(); } //--------------------------------------------------------------------------- diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index b809de479..4c7d6ee6f 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.addadjustment(DAngle::fromDeg(-14.04)); + ps[p].horizon.addPitch(DAngle::fromDeg(-14.04)); ps[p].sync.actions |= SB_CENTERVIEW; if (ps[p].loogcnt == 0) diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index a0ca286c9..9d68e2ba3 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.addadjustment(DAngle::fromDeg(-14.04)); + ps[p].horizon.addPitch(DAngle::fromDeg(-14.04)); ps[p].sync.actions |= SB_CENTERVIEW; if (ps[p].loogcnt == 0) diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index fea1b76b2..b70bf6192 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -344,7 +344,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, { ps[iPlayer].sync.actions &= ~SB_CENTERVIEW; } - ps[iPlayer].horizon.settarget(maphoriz(-lValue)); + ps[iPlayer].horizon.setPitch(maphoriz(-lValue)); } else SetGameVarID(lVar2, int(ps[iPlayer].horizon.ZzHORIZON.Tan() * -128.), sActor, sPlayer); break; diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index e52c5f997..b47da06a0 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -842,7 +842,7 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju } p->angle.processhelpers(scaleAdjust); - p->horizon.processhelpers(scaleAdjust); + p->horizon.processLegacyHelperPitch(scaleAdjust); p->GetActor()->spr.Angles.Yaw = p->angle.ang; // check me out later. } diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 571969746..55fedeb12 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -117,7 +117,7 @@ void forceplayerangle(int snum) { player_struct* p = &ps[snum]; - p->horizon.addadjustment(DAngle::fromDeg(-26.566)); + p->horizon.addPitch(DAngle::fromDeg(-26.566)); p->sync.actions |= SB_CENTERVIEW; p->angle.rotscrnang = p->angle.look_ang = (DAngle22_5 - randomAngle(45)) / 2.; } @@ -378,7 +378,7 @@ void dokneeattack(int snum, const std::initializer_list & respawnlist) { p->oknee_incs = p->knee_incs; p->knee_incs++; - p->horizon.addadjustment(deltaangle(p->horizon.ZzHORIZON, (p->GetActor()->getPosWithOffsetZ() - p->actorsqu->spr.pos).Pitch() * 1.1875)); + p->horizon.addPitch(deltaangle(p->horizon.ZzHORIZON, (p->GetActor()->getPosWithOffsetZ() - p->actorsqu->spr.pos).Pitch() * 1.1875)); p->sync.actions |= SB_CENTERVIEW; if (p->knee_incs > 15) { @@ -547,7 +547,7 @@ inline void backupplayer(player_struct* p) { p->backuppos(); p->angle.backup(); - p->horizon.backup(); + p->horizon.backupPitch(); } void playerisdead(int snum, int psectlotag, double floorz, double ceilingz) @@ -807,7 +807,7 @@ void player_struct::checkhardlanding() { if (hard_landing > 0) { - horizon.addadjustment(maphoriz(hard_landing << 4)); + horizon.addPitch(maphoriz(hard_landing << 4)); hard_landing--; } } diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index dfaea1ff2..45a85f660 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -2725,7 +2725,7 @@ void processinput_d(int snum) p = &ps[snum]; auto pact = p->GetActor(); - p->horizon.resetadjustment(); + p->horizon.resetAdjustmentPitch(); p->angle.resetadjustment(); ESyncBits& actions = p->sync.actions; @@ -2763,7 +2763,7 @@ void processinput_d(int snum) if (SyncInput()) { - p->horizon.backup(); + p->horizon.backupPitch(); doslopetilting(p); } diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index a675eebae..a1526245e 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -1718,7 +1718,7 @@ static void onMotorcycle(int snum, ESyncBits &actions) } if (horiz != FRACUNIT) { - p->horizon.addadjustment(deltaangle(p->horizon.ZzHORIZON, maphoriz(-horiz))); + p->horizon.addPitch(deltaangle(p->horizon.ZzHORIZON, maphoriz(-horiz))); } const DAngle adjust = mapangle(-510); @@ -1986,7 +1986,7 @@ static void onBoat(int snum, ESyncBits &actions) } if (horiz != FRACUNIT) { - p->horizon.addadjustment(deltaangle(p->horizon.ZzHORIZON, maphoriz(-horiz))); + p->horizon.addPitch(deltaangle(p->horizon.ZzHORIZON, maphoriz(-horiz))); } if (p->MotoSpeed > 0 && p->on_ground == 1 && (p->vehTurnLeft || p->vehTurnRight)) @@ -2894,7 +2894,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) case RIFLEGUN_WEAPON: p->kickback_pic++; - p->horizon.addadjustment(DAngle::fromDeg(-0.4476)); + p->horizon.addPitch(DAngle::fromDeg(-0.4476)); p->recoil++; if (p->kickback_pic <= 12) @@ -3066,7 +3066,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) else if (p->kickback_pic == 12) { p->vel.XY() -= p->angle.ang.ToVector(); - p->horizon.addadjustment(DAngle::fromDeg(-8.88)); + p->horizon.addPitch(DAngle::fromDeg(-8.88)); p->recoil += 20; } if (p->kickback_pic > 20) @@ -3272,7 +3272,7 @@ void processinput_r(int snum) auto p = &ps[snum]; auto pact = p->GetActor(); - p->horizon.resetadjustment(); + p->horizon.resetAdjustmentPitch(); p->angle.resetadjustment(); ESyncBits& actions = p->sync.actions; @@ -3349,7 +3349,7 @@ void processinput_r(int snum) if (SyncInput()) { - p->horizon.backup(); + p->horizon.backupPitch(); doslopetilting(p); } @@ -3890,7 +3890,7 @@ HORIZONLY: if (!d) d = 1; p->recoil -= d; - p->horizon.addadjustment(maphoriz(d)); + p->horizon.addPitch(maphoriz(d)); } if (SyncInput()) @@ -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.settarget(nullAngle); + p->horizon.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.settarget(nullAngle); + p->horizon.setPitch(nullAngle); p->moto_do_bump = 0; p->MotoSpeed = 0; p->TiltStatus = 0; @@ -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.settarget(nullAngle); + p->horizon.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.settarget(nullAngle); + p->horizon.setPitch(nullAngle); p->moto_do_bump = 0; p->MotoSpeed = 0; p->TiltStatus = 0; diff --git a/source/games/exhumed/src/input.cpp b/source/games/exhumed/src/input.cpp index 298f0b96b..9e6078c70 100644 --- a/source/games/exhumed/src/input.cpp +++ b/source/games/exhumed/src/input.cpp @@ -96,7 +96,7 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju } pPlayer->angle.processhelpers(scaleAdjust); - pPlayer->horizon.processhelpers(scaleAdjust); + pPlayer->horizon.processLegacyHelperPitch(scaleAdjust); UpdatePlayerSpriteAngle(pPlayer); } diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index 48b0aae76..85a41c94d 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -314,7 +314,7 @@ void RestartPlayer(int nPlayer) } plr->angle.backup(); - plr->horizon.backup(); + plr->horizon.backupPitch(); plr->pPlayerFloorSprite = floorsprt; @@ -905,9 +905,9 @@ void AIPlayer::Tick(RunListEvent* ev) int nActionB = PlayerList[nPlayer].nAction; PlayerList[nPlayer].angle.backup(); - PlayerList[nPlayer].horizon.backup(); + PlayerList[nPlayer].horizon.backupPitch(); PlayerList[nPlayer].angle.resetadjustment(); - PlayerList[nPlayer].horizon.resetadjustment(); + PlayerList[nPlayer].horizon.resetAdjustmentPitch(); pPlayerActor->vel.XY() = sPlayerInput[nPlayer].vel; @@ -1075,7 +1075,7 @@ void AIPlayer::Tick(RunListEvent* ev) PlayerList[nPlayer].angle.settarget(ang, true); pPlayerActor->spr.Angles.Yaw = ang; - PlayerList[nPlayer].horizon.settarget(nullAngle, true); + PlayerList[nPlayer].horizon.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.settarget(currentLevel->ex_ramses_horiz); + PlayerList[nPlayer].horizon.setPitch(currentLevel->ex_ramses_horiz); } } else @@ -2498,7 +2498,7 @@ sectdone: { if (double nVertPan = deltaangle(pPlayer->horizon.ZzHORIZON, pPlayer->nDestVertPan).Tan() * 32.) { - pPlayer->horizon.addadjustment(maphoriz(abs(nVertPan) >= 4 ? clamp(nVertPan, -4., 4.) : nVertPan * 2.)); + pPlayer->horizon.addPitch(maphoriz(abs(nVertPan) >= 4 ? clamp(nVertPan, -4., 4.) : nVertPan * 2.)); } } } @@ -2618,16 +2618,16 @@ sectdone: { if (PlayerList[nPlayer].horizon.ZzHORIZON.Sgn() > 0) { - PlayerList[nPlayer].horizon.settarget(nullAngle); + PlayerList[nPlayer].horizon.setPitch(nullAngle); pPlayerActor->viewzoffset -= dVertPan[nPlayer]; } else { - PlayerList[nPlayer].horizon.addadjustment(maphoriz(-dVertPan[nPlayer])); + PlayerList[nPlayer].horizon.addPitch(maphoriz(-dVertPan[nPlayer])); if (PlayerList[nPlayer].horizon.ZzHORIZON.Degrees() <= 38) { - PlayerList[nPlayer].horizon.settarget(DAngle::fromDeg(-37.72)); + PlayerList[nPlayer].horizon.setPitch(DAngle::fromDeg(-37.72)); } else if (PlayerList[nPlayer].horizon.ZzHORIZON.Sgn() >= 0) { diff --git a/source/games/sw/src/input.cpp b/source/games/sw/src/input.cpp index 0fecf5c76..93ae73f0f 100644 --- a/source/games/sw/src/input.cpp +++ b/source/games/sw/src/input.cpp @@ -201,7 +201,7 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju } pp->angle.processhelpers(scaleAdjust); - pp->horizon.processhelpers(scaleAdjust); + pp->horizon.processLegacyHelperPitch(scaleAdjust); } if (packet) diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index b2de3e225..9b591b39e 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -5880,7 +5880,7 @@ static inline void DoPlayerDeathHoriz(PLAYER* pp, const DAngle target, const dou if (abs(targetdelta.Degrees()) > 1) { - pp->horizon.addadjustment(DAngle::fromDeg(speed * targetdelta.Sgn())); + pp->horizon.addPitch(DAngle::fromDeg(speed * targetdelta.Sgn())); } } @@ -6694,7 +6694,7 @@ void MoveSkipSavePos(void) pp->actor->backuppos(); pp->obob_z = pp->bob_z; pp->angle.backup(); - pp->horizon.backup(); + pp->horizon.backupPitch(); pp->opbob_amt = pp->pbob_amt; } @@ -6987,7 +6987,7 @@ 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.resetadjustment(); + pp->horizon.resetAdjustmentPitch(); pp->angle.resetadjustment(); // disable synchronised input if set by game.