- Make playercmds[] non-global and pass through as pointer.

This commit is contained in:
Mitchell Richters 2023-09-26 22:24:07 +10:00
parent 80da809e0c
commit 7fa5df934b
13 changed files with 15 additions and 15 deletions

View file

@ -80,7 +80,6 @@ extern bool nodeingame[MAXNETNODES]; // set false as nodes leave game
extern bool hadlate; extern bool hadlate;
extern uint64_t lastglobalrecvtime; // Identify the last time a packet was received. extern uint64_t lastglobalrecvtime; // Identify the last time a packet was received.
extern bool playeringame[MAXPLAYERS]; // as long as network isn't working - true for the first player, false for all others. extern bool playeringame[MAXPLAYERS]; // as long as network isn't working - true for the first player, false for all others.
extern ticcmd_t playercmds[MAXPLAYERS];
extern short consistency[MAXPLAYERS][BACKUPTICS]; extern short consistency[MAXPLAYERS][BACKUPTICS];

View file

@ -18,6 +18,7 @@ struct tspritetype;
class DCoreActor; class DCoreActor;
struct MapRecord; struct MapRecord;
struct PlayerAngles; struct PlayerAngles;
struct ticcmd_t;
struct GameStats struct GameStats
{ {
@ -91,7 +92,7 @@ struct GameInterface
virtual void Startup() = 0; virtual void Startup() = 0;
virtual void DrawBackground() = 0; virtual void DrawBackground() = 0;
virtual void Render() = 0; virtual void Render() = 0;
virtual void Ticker() = 0; virtual void Ticker(const ticcmd_t* playercmds) = 0;
virtual int GetPlayerChecksum(int pnum) { return 0x12345678 + pnum; } virtual int GetPlayerChecksum(int pnum) { return 0x12345678 + pnum; }
virtual const char *CheckCheatMode() { return nullptr; } virtual const char *CheckCheatMode() { return nullptr; }
virtual const char* GenericCheat(int player, int cheat) = 0; virtual const char* GenericCheat(int player, int cheat) = 0;

View file

@ -98,7 +98,7 @@ CVAR(Bool, r_ticstability, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
EXTERN_CVAR(Bool, cl_capfps) EXTERN_CVAR(Bool, cl_capfps)
CVAR(Bool, cl_resumesavegame, true, CVAR_ARCHIVE) CVAR(Bool, cl_resumesavegame, true, CVAR_ARCHIVE)
ticcmd_t playercmds[MAXPLAYERS]; static ticcmd_t playercmds[MAXPLAYERS];
static uint64_t stabilityticduration = 0; static uint64_t stabilityticduration = 0;
static uint64_t stabilitystarttime = 0; static uint64_t stabilitystarttime = 0;
@ -357,7 +357,7 @@ static void GameTicker()
case GS_LEVEL: case GS_LEVEL:
gameupdatetime.Reset(); gameupdatetime.Reset();
gameupdatetime.Clock(); gameupdatetime.Clock();
gi->Ticker(); gi->Ticker(playercmds);
TickStatusBar(); TickStatusBar();
levelTextTime--; levelTextTime--;
gameupdatetime.Unclock(); gameupdatetime.Unclock();

View file

@ -409,7 +409,7 @@ int GameInterface::GetCurrentSkill()
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void GameInterface::Ticker() void GameInterface::Ticker(const ticcmd_t* playercmds)
{ {
BloodSpriteIterator it; BloodSpriteIterator it;
while (DBloodActor* act = it.Next()) act->interpolated = false; while (DBloodActor* act = it.Next()) act->interpolated = false;

View file

@ -110,7 +110,7 @@ struct GameInterface : public ::GameInterface
void MenuClosed() override; void MenuClosed() override;
bool CanSave() override; bool CanSave() override;
void UpdateSounds() override; void UpdateSounds() override;
void Ticker() override; void Ticker(const ticcmd_t* playercmds) override;
void DrawBackground() override; void DrawBackground() override;
void Startup() override; void Startup() override;
void Render() override; void Render() override;

View file

@ -47,7 +47,7 @@ struct GameInterface : public ::GameInterface
void Startup() override; void Startup() override;
void DrawBackground() override; void DrawBackground() override;
void Render() override; void Render() override;
void Ticker() override; void Ticker(const ticcmd_t* playercmds) override;
const char* GenericCheat(int player, int cheat) override; const char* GenericCheat(int player, int cheat) override;
const char* CheckCheatMode() override; const char* CheckCheatMode() override;
void NextLevel(MapRecord* map, int skill) override; void NextLevel(MapRecord* map, int skill) override;

View file

@ -44,7 +44,7 @@ BEGIN_DUKE_NS
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void GameInterface::Ticker() void GameInterface::Ticker(const ticcmd_t* playercmds)
{ {
if (rtsplaying > 0) rtsplaying--; if (rtsplaying > 0) rtsplaying--;

View file

@ -312,7 +312,7 @@ static void GameMove(void)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void GameInterface::Ticker() void GameInterface::Ticker(const ticcmd_t* playercmds)
{ {
if (paused) if (paused)
{ {

View file

@ -223,7 +223,7 @@ struct GameInterface : public ::GameInterface
bool CanSave() override; bool CanSave() override;
void UpdateSounds() override; void UpdateSounds() override;
void ErrorCleanup() override; void ErrorCleanup() override;
void Ticker() override; void Ticker(const ticcmd_t* playercmds) override;
void DrawBackground() override; void DrawBackground() override;
void Render() override; void Render() override;
//void DrawWeapons() override; //void DrawWeapons() override;

View file

@ -711,9 +711,9 @@ int GameInterface::GetCurrentSkill()
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void GameInterface::Ticker(void) void GameInterface::Ticker(const ticcmd_t* playercmds)
{ {
domovethings(); domovethings(playercmds);
r_NoInterpolate = paused; r_NoInterpolate = paused;
} }

View file

@ -1881,7 +1881,7 @@ struct GameInterface : public ::GameInterface
void UpdateSounds() override; void UpdateSounds() override;
void ErrorCleanup() override; void ErrorCleanup() override;
void DrawBackground(void) override; void DrawBackground(void) override;
void Ticker(void) override; void Ticker(const ticcmd_t* playercmds) override;
void Render() override; void Render() override;
//void DrawWeapons() override; //void DrawWeapons() override;
void Startup() override; void Startup() override;

View file

@ -6731,7 +6731,7 @@ void PauseMultiPlay(void)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void domovethings(void) void domovethings(const ticcmd_t* playercmds)
{ {
short pnum; short pnum;

View file

@ -122,7 +122,7 @@ int SetVisNorm(void);
void DoWeapon(void); void DoWeapon(void);
void HeadBobStateControl(void); void HeadBobStateControl(void);
void DoPlayer(void); void DoPlayer(void);
void domovethings(void); void domovethings(const ticcmd_t* playercmds);
void InitAllPlayers(void); void InitAllPlayers(void);
void InitMultiPlayerInfo(const DVector3& spawnpos, const DAngle startang); void InitMultiPlayerInfo(const DVector3& spawnpos, const DAngle startang);
void DoPlayerDivePalette(PLAYER* pp); void DoPlayerDivePalette(PLAYER* pp);