From 65ee4b14d6fcd2d32dd5d03d5e881ce1139efd1f Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sat, 18 Mar 2023 16:31:38 +1100 Subject: [PATCH] - Move `gi->getConsoleActor()` directly into the header. --- source/games/blood/src/blood.h | 2 +- source/games/blood/src/osdcmd.cpp | 5 -- source/games/duke/src/ccmds.cpp | 5 -- source/games/duke/src/duke3d.h | 4 +- source/games/exhumed/src/exhumed.h | 3 +- source/games/exhumed/src/osdcmds.cpp | 11 ---- source/games/sw/src/game.h | 92 ++++++++++++++-------------- source/games/sw/src/osdcmds.cpp | 11 ---- 8 files changed, 52 insertions(+), 81 deletions(-) diff --git a/source/games/blood/src/blood.h b/source/games/blood/src/blood.h index 4994f2682..b3b381854 100644 --- a/source/games/blood/src/blood.h +++ b/source/games/blood/src/blood.h @@ -132,7 +132,7 @@ struct GameInterface : public ::GameInterface bool DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos, const DAngle cang, const DVector2& xydim, const double czoom, double const interpfrac) override; DAngle playerPitchMin() override { return DAngle::fromDeg(54.575); } DAngle playerPitchMax() override { return DAngle::fromDeg(-43.15); } - DCoreActor* getConsoleActor() override; + DCoreActor* getConsoleActor() override { return gPlayer[myconnectindex].actor; } void ToggleThirdPerson() override; void SwitchCoopView() override; void ToggleShowWeapon() override; diff --git a/source/games/blood/src/osdcmd.cpp b/source/games/blood/src/osdcmd.cpp index 9ecf2429a..cead07397 100644 --- a/source/games/blood/src/osdcmd.cpp +++ b/source/games/blood/src/osdcmd.cpp @@ -31,11 +31,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -DCoreActor* GameInterface::getConsoleActor() -{ - return gPlayer[myconnectindex].actor; -} - void GameInterface::ToggleThirdPerson() { if (gamestate != GS_LEVEL) return; diff --git a/source/games/duke/src/ccmds.cpp b/source/games/duke/src/ccmds.cpp index 0cbfc875c..e46488cc5 100644 --- a/source/games/duke/src/ccmds.cpp +++ b/source/games/duke/src/ccmds.cpp @@ -118,11 +118,6 @@ static int ccmd_spawn(CCmdFuncPtr parm) return CCMD_OK; } -DCoreActor* GameInterface::getConsoleActor() -{ - return ps[myconnectindex].GetActor(); -} - void GameInterface::ToggleThirdPerson() { if (gamestate != GS_LEVEL) return; diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index 430abe230..a85ada872 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -19,6 +19,8 @@ BEGIN_DUKE_NS +extern player_struct ps[MAXPLAYERS]; + struct GameInterface : public ::GameInterface { const char* Name() override { return "Duke"; } @@ -50,7 +52,7 @@ struct GameInterface : public ::GameInterface void NewGame(MapRecord* map, int skill, bool) override; 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; + DCoreActor* getConsoleActor() override { return ps[myconnectindex].GetActor(); } void ToggleThirdPerson() override; void SwitchCoopView() override; void ToggleShowWeapon() override; diff --git a/source/games/exhumed/src/exhumed.h b/source/games/exhumed/src/exhumed.h index c89973a50..8c0269eea 100644 --- a/source/games/exhumed/src/exhumed.h +++ b/source/games/exhumed/src/exhumed.h @@ -34,6 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "exhumedactor.h" #include "serialize_obj.h" #include "texturemanager.h" +#include "player.h" BEGIN_PS_NS @@ -234,7 +235,7 @@ struct GameInterface : public ::GameInterface bool DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos, const DAngle cang, const DVector2& xydim, const double czoom, double const interpfrac) override; DAngle playerPitchMin() override { return DAngle::fromDeg(49.5); } DAngle playerPitchMax() override { return DAngle::fromDeg(-49.5); } - DCoreActor* getConsoleActor() override; + DCoreActor* getConsoleActor() override { return PlayerList[nLocalPlayer].pActor; } void ToggleThirdPerson() override; void processSprites(tspriteArray& tsprites, const DVector3& view, DAngle viewang, double interpfrac) override; int GetCurrentSkill() override; diff --git a/source/games/exhumed/src/osdcmds.cpp b/source/games/exhumed/src/osdcmds.cpp index 162e020ef..482824946 100644 --- a/source/games/exhumed/src/osdcmds.cpp +++ b/source/games/exhumed/src/osdcmds.cpp @@ -39,17 +39,6 @@ BEGIN_PS_NS // //--------------------------------------------------------------------------- -DCoreActor* GameInterface::getConsoleActor() -{ - return PlayerList[nLocalPlayer].pActor; -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - static int osdcmd_doors(CCmdFuncPtr parm) { for (int i = 0; i < kMaxChannels; i++) diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 9c3d7a7bb..68cb35b62 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -1661,52 +1661,6 @@ extern int ChopTics; extern int Bunny_Count; -struct GameInterface : public ::GameInterface -{ - const char* Name() override { return "ShadowWarrior"; } - void app_init() override; - void LoadTextureInfo(TilesetBuildInfo& info) override; - void SetupSpecialTextures(TilesetBuildInfo& info) override; - void loadPalette() override; - void clearlocalinputstate() override; - void FreeLevelData() override; - bool GenerateSavePic() override; - void MenuSound(EMenuSounds snd) override; - bool CanSave() override; - bool StartGame(FNewGameStartup& gs) override; - FSavegameInfo GetSaveSig() override; - void SerializeGameState(FSerializer& arc); - void SetAmbience(bool on) override { if (on) StartAmbientSound(); else StopAmbientSound(); } - void UpdateSounds() override; - void ErrorCleanup() override; - void GetInput(const double scaleAdjust, InputPacket* input = nullptr) override; - void DrawBackground(void) override; - void Ticker(void) override; - void Render() override; - //void DrawWeapons() override; - void Startup() override; - const char *CheckCheatMode() override; - const char* GenericCheat(int player, int cheat) override; - void LevelCompleted(MapRecord *map, int skill) override; - void NextLevel(MapRecord *map, int skill) override; - 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; - void ToggleThirdPerson() override; - void SwitchCoopView() override; - void processSprites(tspriteArray& tsprites, const DVector3& view, DAngle viewang, double smoothRatio) override; - void UpdateCameras(double smoothratio) override; - void EnterPortal(DCoreActor* viewer, int type) override; - void LeavePortal(DCoreActor* viewer, int type) override; - void ExitFromMenu() override; - int GetCurrentSkill() override; - void StartSoundEngine() override; - - - GameStats getStats() override; -}; - - END_SW_NS #include "swactor.h" @@ -1897,6 +1851,52 @@ struct PLAYER extern PLAYER Player[MAX_SW_PLAYERS_REG+1]; +struct GameInterface : public ::GameInterface +{ + const char* Name() override { return "ShadowWarrior"; } + void app_init() override; + void LoadTextureInfo(TilesetBuildInfo& info) override; + void SetupSpecialTextures(TilesetBuildInfo& info) override; + void loadPalette() override; + void clearlocalinputstate() override; + void FreeLevelData() override; + bool GenerateSavePic() override; + void MenuSound(EMenuSounds snd) override; + bool CanSave() override; + bool StartGame(FNewGameStartup& gs) override; + FSavegameInfo GetSaveSig() override; + void SerializeGameState(FSerializer& arc); + void SetAmbience(bool on) override { if (on) StartAmbientSound(); else StopAmbientSound(); } + void UpdateSounds() override; + void ErrorCleanup() override; + void GetInput(const double scaleAdjust, InputPacket* input = nullptr) override; + void DrawBackground(void) override; + void Ticker(void) override; + void Render() override; + //void DrawWeapons() override; + void Startup() override; + const char *CheckCheatMode() override; + const char* GenericCheat(int player, int cheat) override; + void LevelCompleted(MapRecord *map, int skill) override; + void NextLevel(MapRecord *map, int skill) override; + 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; } + void ToggleThirdPerson() override; + void SwitchCoopView() override; + void processSprites(tspriteArray& tsprites, const DVector3& view, DAngle viewang, double smoothRatio) override; + void UpdateCameras(double smoothratio) override; + void EnterPortal(DCoreActor* viewer, int type) override; + void LeavePortal(DCoreActor* viewer, int type) override; + void ExitFromMenu() override; + int GetCurrentSkill() override; + void StartSoundEngine() override; + + + GameStats getStats() override; +}; + + // OVER and UNDER water macros inline bool SectorIsDiveArea(sectortype* sect) { diff --git a/source/games/sw/src/osdcmds.cpp b/source/games/sw/src/osdcmds.cpp index e2720b157..5d0e0d00a 100644 --- a/source/games/sw/src/osdcmds.cpp +++ b/source/games/sw/src/osdcmds.cpp @@ -54,17 +54,6 @@ BEGIN_SW_NS // //--------------------------------------------------------------------------- -DCoreActor* GameInterface::getConsoleActor() -{ - return Player[myconnectindex].actor; -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - static int osdcmd_mirror(CCmdFuncPtr parm) { char base[80];