- Move gi->getConsoleActor() directly into the header.

This commit is contained in:
Mitchell Richters 2023-03-18 16:31:38 +11:00
parent ee294d7fa0
commit 65ee4b14d6
8 changed files with 52 additions and 81 deletions

View file

@ -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; 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 playerPitchMin() override { return DAngle::fromDeg(54.575); }
DAngle playerPitchMax() override { return DAngle::fromDeg(-43.15); } DAngle playerPitchMax() override { return DAngle::fromDeg(-43.15); }
DCoreActor* getConsoleActor() override; DCoreActor* getConsoleActor() override { return gPlayer[myconnectindex].actor; }
void ToggleThirdPerson() override; void ToggleThirdPerson() override;
void SwitchCoopView() override; void SwitchCoopView() override;
void ToggleShowWeapon() override; void ToggleShowWeapon() override;

View file

@ -31,11 +31,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS BEGIN_BLD_NS
DCoreActor* GameInterface::getConsoleActor()
{
return gPlayer[myconnectindex].actor;
}
void GameInterface::ToggleThirdPerson() void GameInterface::ToggleThirdPerson()
{ {
if (gamestate != GS_LEVEL) return; if (gamestate != GS_LEVEL) return;

View file

@ -118,11 +118,6 @@ static int ccmd_spawn(CCmdFuncPtr parm)
return CCMD_OK; return CCMD_OK;
} }
DCoreActor* GameInterface::getConsoleActor()
{
return ps[myconnectindex].GetActor();
}
void GameInterface::ToggleThirdPerson() void GameInterface::ToggleThirdPerson()
{ {
if (gamestate != GS_LEVEL) return; if (gamestate != GS_LEVEL) return;

View file

@ -19,6 +19,8 @@
BEGIN_DUKE_NS BEGIN_DUKE_NS
extern player_struct ps[MAXPLAYERS];
struct GameInterface : public ::GameInterface struct GameInterface : public ::GameInterface
{ {
const char* Name() override { return "Duke"; } const char* Name() override { return "Duke"; }
@ -50,7 +52,7 @@ struct GameInterface : public ::GameInterface
void NewGame(MapRecord* map, int skill, bool) override; void NewGame(MapRecord* map, int skill, bool) override;
void LevelCompleted(MapRecord* map, int skill) 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; 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 ToggleThirdPerson() override;
void SwitchCoopView() override; void SwitchCoopView() override;
void ToggleShowWeapon() override; void ToggleShowWeapon() override;

View file

@ -34,6 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "exhumedactor.h" #include "exhumedactor.h"
#include "serialize_obj.h" #include "serialize_obj.h"
#include "texturemanager.h" #include "texturemanager.h"
#include "player.h"
BEGIN_PS_NS 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; 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 playerPitchMin() override { return DAngle::fromDeg(49.5); }
DAngle playerPitchMax() 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 ToggleThirdPerson() override;
void processSprites(tspriteArray& tsprites, const DVector3& view, DAngle viewang, double interpfrac) override; void processSprites(tspriteArray& tsprites, const DVector3& view, DAngle viewang, double interpfrac) override;
int GetCurrentSkill() override; int GetCurrentSkill() override;

View file

@ -39,17 +39,6 @@ BEGIN_PS_NS
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
DCoreActor* GameInterface::getConsoleActor()
{
return PlayerList[nLocalPlayer].pActor;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
static int osdcmd_doors(CCmdFuncPtr parm) static int osdcmd_doors(CCmdFuncPtr parm)
{ {
for (int i = 0; i < kMaxChannels; i++) for (int i = 0; i < kMaxChannels; i++)

View file

@ -1661,52 +1661,6 @@ extern int ChopTics;
extern int Bunny_Count; 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 END_SW_NS
#include "swactor.h" #include "swactor.h"
@ -1897,6 +1851,52 @@ struct PLAYER
extern PLAYER Player[MAX_SW_PLAYERS_REG+1]; 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 // OVER and UNDER water macros
inline bool SectorIsDiveArea(sectortype* sect) inline bool SectorIsDiveArea(sectortype* sect)
{ {

View file

@ -54,17 +54,6 @@ BEGIN_SW_NS
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
DCoreActor* GameInterface::getConsoleActor()
{
return Player[myconnectindex].actor;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
static int osdcmd_mirror(CCmdFuncPtr parm) static int osdcmd_mirror(CCmdFuncPtr parm)
{ {
char base[80]; char base[80];