- Remove GameInterface::getConsoleAngles(), it's not needed anymore.

This commit is contained in:
Mitchell Richters 2023-04-04 07:02:39 +10:00
parent 3ef431a428
commit a68fcfc71c
9 changed files with 13 additions and 28 deletions

View file

@ -1409,17 +1409,6 @@ void GameInterface::FreeLevelData()
GC::FullGC();
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void GameInterface::doPlayerMovement(const float scaleAdjust)
{
gameInput.processMovement(scaleAdjust);
}
//---------------------------------------------------------------------------
//
// DrawCrosshair

View file

@ -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);
}

View file

@ -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);

View file

@ -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()
{

View file

@ -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;
};

View file

@ -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;

View file

@ -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);
}
}

View file

@ -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;
};

View file

@ -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.);
}