diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index 0cb25e8d0..321c7aba7 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -1409,17 +1409,6 @@ void GameInterface::FreeLevelData() GC::FullGC(); } -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -void GameInterface::doPlayerMovement(const float scaleAdjust) -{ - gameInput.processMovement(scaleAdjust); -} - //--------------------------------------------------------------------------- // // DrawCrosshair diff --git a/source/core/gameinput.cpp b/source/core/gameinput.cpp index 33a615294..3f77714ec 100644 --- a/source/core/gameinput.cpp +++ b/source/core/gameinput.cpp @@ -106,7 +106,7 @@ void processCrouchToggle(bool& toggle, ESyncBits& actions, const bool crouchable // //--------------------------------------------------------------------------- -void GameInput::processMovement(const float scaleAdjust, const int drink_amt, const bool allowstrafe, const double turnscale) +void GameInput::processMovement(PlayerAngles* const plrAngles, const float scaleAdjust, const int drink_amt, const bool allowstrafe, const double turnscale) { // open up input packet for this session. InputPacket thisInput{}; @@ -158,7 +158,6 @@ void GameInput::processMovement(const float scaleAdjust, const int drink_amt, co // directly update player angles if we can. if (scaleAdjust < 1) { - const auto plrAngles = gi->getConsoleAngles(); plrAngles->CameraAngles.Yaw += DAngle::fromDeg(thisInput.avel); plrAngles->CameraAngles.Pitch += DAngle::fromDeg(thisInput.horz); } @@ -171,7 +170,7 @@ void GameInput::processMovement(const float scaleAdjust, const int drink_amt, co // //--------------------------------------------------------------------------- -void GameInput::processVehicle(const float scaleAdjust, const float baseVel, const float velScale, const bool canMove, const bool canTurn, const bool attenuate) +void GameInput::processVehicle(PlayerAngles* const plrAngles, const float scaleAdjust, const float baseVel, const float velScale, const bool canMove, const bool canTurn, const bool attenuate) { // open up input packet for this session. InputPacket thisInput{}; @@ -216,7 +215,6 @@ void GameInput::processVehicle(const float scaleAdjust, const float baseVel, con // directly update player angles if we can. if (scaleAdjust < 1) { - const auto plrAngles = gi->getConsoleAngles(); plrAngles->CameraAngles.Yaw += DAngle::fromDeg(thisInput.avel); plrAngles->CameraAngles.Pitch += DAngle::fromDeg(thisInput.horz); } diff --git a/source/core/gameinput.h b/source/core/gameinput.h index bc6491547..2f05ae907 100644 --- a/source/core/gameinput.h +++ b/source/core/gameinput.h @@ -75,8 +75,8 @@ public: } // Prototypes for large member functions. - void processMovement(const float scaleAdjust, const int drink_amt = 0, const bool allowstrafe = true, const double turnscale = 1.); - void processVehicle(const float scaleAdjust, const float baseVel, const float velScale, const bool canMove, const bool canTurn, const bool attenuate); + void processMovement(PlayerAngles* const plrAngles, const float scaleAdjust, const int drink_amt = 0, const bool allowstrafe = true, const double turnscale = 1.); + void processVehicle(PlayerAngles* const plrAngles, const float scaleAdjust, const float baseVel, const float velScale, const bool canMove, const bool canTurn, const bool attenuate); void getInput(const double scaleAdjust, InputPacket* packet = nullptr); }; @@ -89,8 +89,8 @@ struct PlayerAngles DAngle YawSpin; friend FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngles& w, PlayerAngles* def); - friend void GameInput::processMovement(const float scaleAdjust, const int drink_amt, const bool allowstrafe, const double turnscale); - friend void GameInput::processVehicle(const float scaleAdjust, const float baseVel, const float velScale, const bool canMove, const bool canTurn, const bool attenuate); + friend void GameInput::processMovement(PlayerAngles* const plrAngles, const float scaleAdjust, const int drink_amt, const bool allowstrafe, const double turnscale); + friend void GameInput::processVehicle(PlayerAngles* const plrAngles, const float scaleAdjust, const float baseVel, const float velScale, const bool canMove, const bool canTurn, const bool attenuate); // Prototypes. void doPitchKeys(InputPacket* const input); diff --git a/source/core/gamestruct.h b/source/core/gamestruct.h index 84283a036..cd20bafba 100644 --- a/source/core/gamestruct.h +++ b/source/core/gamestruct.h @@ -101,7 +101,6 @@ struct GameInterface virtual DAngle playerPitchMin() { return DAngle::fromDeg(57.375); } virtual DAngle playerPitchMax() { return DAngle::fromDeg(-57.375); } virtual DCoreActor* getConsoleActor() = 0; - virtual PlayerAngles* getConsoleAngles() = 0; virtual void ToggleThirdPerson() = 0; virtual void SwitchCoopView() { Printf("Unsupported command\n"); } virtual void ToggleShowWeapon() { Printf("Unsupported command\n"); } @@ -119,7 +118,7 @@ struct GameInterface virtual bool WantEscape() { return false; } virtual void StartSoundEngine() = 0; virtual void reapplyInputBits(InputPacket* const input) = 0; - virtual void doPlayerMovement(const float scaleAdjust); + virtual void doPlayerMovement(const float scaleAdjust) = 0; virtual FString statFPS() { diff --git a/source/games/blood/src/blood.h b/source/games/blood/src/blood.h index d5776f658..719ddd91e 100644 --- a/source/games/blood/src/blood.h +++ b/source/games/blood/src/blood.h @@ -131,7 +131,6 @@ struct GameInterface : public ::GameInterface DAngle playerPitchMin() override { return DAngle::fromDeg(54.575); } DAngle playerPitchMax() override { return DAngle::fromDeg(-43.15); } DCoreActor* getConsoleActor() override { return gPlayer[myconnectindex].actor; } - PlayerAngles* getConsoleAngles() override { return &gPlayer[myconnectindex].Angles; } void ToggleThirdPerson() override; void SwitchCoopView() override; void ToggleShowWeapon() override; @@ -146,6 +145,7 @@ struct GameInterface : public ::GameInterface void RemoveQAVInterpProps(const int res_id) override; void StartSoundEngine() override; void reapplyInputBits(InputPacket* const input) override { input->actions |= gPlayer[myconnectindex].input.actions & ~(SB_BUTTON_MASK | SB_RUN | SB_WEAPONMASK_BITS); } + void doPlayerMovement(const float scaleAdjust) override { gameInput.processMovement(&gPlayer[myconnectindex].Angles, scaleAdjust); } GameStats getStats() override; }; diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index eacb17dce..3fd861ddb 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -53,7 +53,6 @@ struct GameInterface : public ::GameInterface void LevelCompleted(MapRecord* map, int skill) override; bool DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos, const DAngle cang, const DVector2& xydim, const double czoom, double const interpfrac) override; DCoreActor* getConsoleActor() override { return ps[myconnectindex].GetActor(); } - PlayerAngles* getConsoleAngles() override { return &ps[myconnectindex].Angles; } void ToggleThirdPerson() override; void SwitchCoopView() override; void ToggleShowWeapon() override; diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index 477748a30..650720fb4 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -525,11 +525,11 @@ void GameInterface::doPlayerMovement(const float scaleAdjust) const auto canTurn = p->OnMotorcycle || p->MotoSpeed || p->moto_drink; const auto attenuate = p->OnMotorcycle && p->MotoSpeed <= 0; - gameInput.processVehicle(scaleAdjust, baseVel, velScale, canMove, canTurn, attenuate); + gameInput.processVehicle(&p->Angles, scaleAdjust, baseVel, velScale, canMove, canTurn, attenuate); } else { - gameInput.processMovement(scaleAdjust, p->drink_amt); + gameInput.processMovement(&p->Angles, scaleAdjust, p->drink_amt); } } diff --git a/source/games/exhumed/src/exhumed.h b/source/games/exhumed/src/exhumed.h index f482af5fe..8c8b283cf 100644 --- a/source/games/exhumed/src/exhumed.h +++ b/source/games/exhumed/src/exhumed.h @@ -234,12 +234,12 @@ struct GameInterface : public ::GameInterface DAngle playerPitchMin() override { return DAngle::fromDeg(49.5); } DAngle playerPitchMax() override { return DAngle::fromDeg(-49.5); } DCoreActor* getConsoleActor() override { return PlayerList[nLocalPlayer].pActor; } - PlayerAngles* getConsoleAngles() override { return &PlayerList[nLocalPlayer].Angles; } void ToggleThirdPerson() override; void processSprites(tspriteArray& tsprites, const DVector3& view, DAngle viewang, double interpfrac) override; int GetCurrentSkill() override; void StartSoundEngine() override; void reapplyInputBits(InputPacket* const input) override { input->actions |= PlayerList[nLocalPlayer].input.actions & SB_CENTERVIEW; } + void doPlayerMovement(const float scaleAdjust) override { gameInput.processMovement(&PlayerList[nLocalPlayer].Angles, scaleAdjust); } ::GameStats getStats() override; }; diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 1c15b1cc2..f4ef42f2a 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -1878,7 +1878,6 @@ struct GameInterface : public ::GameInterface void NewGame(MapRecord *map, int skill, bool) override; bool DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos, const DAngle cang, const DVector2& xydim, const double czoom, double const interpfrac) override; DCoreActor* getConsoleActor() override { return Player[myconnectindex].actor; } - PlayerAngles* getConsoleAngles() override { return &Player[myconnectindex].Angles; } void ToggleThirdPerson() override; void SwitchCoopView() override; void processSprites(tspriteArray& tsprites, const DVector3& view, DAngle viewang, double smoothRatio) override; @@ -1891,7 +1890,8 @@ struct GameInterface : public ::GameInterface void reapplyInputBits(InputPacket* const input) override { input->actions |= Player[myconnectindex].input.actions & SB_CENTERVIEW; } void doPlayerMovement(const float scaleAdjust) override { - gameInput.processMovement(scaleAdjust, 0, !Player[myconnectindex].sop, Player[myconnectindex].sop_control ? 3. / 1.40625 : 1.); + const auto pp = &Player[myconnectindex]; + gameInput.processMovement(&pp->Angles, scaleAdjust, 0, !pp->sop, pp->sop_control ? (3. / 1.40625) : 1.); }