Use NUM_DUMMIES for dummy array length

This commit is contained in:
ChillerDrgon 2020-10-18 16:51:26 +02:00 committed by ChillerDragon
parent e88a7dee0a
commit f1bb5b5bd9
7 changed files with 38 additions and 36 deletions

View file

@ -18,6 +18,8 @@ enum
RECORDER_RACE = 2, RECORDER_RACE = 2,
RECORDER_REPLAYS = 3, RECORDER_REPLAYS = 3,
RECORDER_MAX = 4, RECORDER_MAX = 4,
NUM_DUMMIES = 2,
}; };
typedef bool (*CLIENTFUNC_FILTER)(const void *pData, int DataSize, void *pUser); typedef bool (*CLIENTFUNC_FILTER)(const void *pData, int DataSize, void *pUser);
@ -30,13 +32,13 @@ protected:
int m_State; int m_State;
// quick access to time variables // quick access to time variables
int m_PrevGameTick[2]; int m_PrevGameTick[NUM_DUMMIES];
int m_CurGameTick[2]; int m_CurGameTick[NUM_DUMMIES];
float m_GameIntraTick[2]; float m_GameIntraTick[NUM_DUMMIES];
float m_GameTickTime[2]; float m_GameTickTime[NUM_DUMMIES];
int m_PredTick[2]; int m_PredTick[NUM_DUMMIES];
float m_PredIntraTick[2]; float m_PredIntraTick[NUM_DUMMIES];
float m_LocalTime; float m_LocalTime;
float m_RenderFrameTime; float m_RenderFrameTime;

View file

@ -500,7 +500,7 @@ void CClient::SendInput()
bool Force = false; bool Force = false;
// fetch input // fetch input
for(int Dummy = 0; Dummy < 2; Dummy++) for(int Dummy = 0; Dummy < NUM_DUMMIES; Dummy++)
{ {
if(!m_DummyConnected && Dummy != 0) if(!m_DummyConnected && Dummy != 0)
{ {

View file

@ -104,7 +104,7 @@ class CClient : public IClient, public CDemoPlayer::IListener
enum enum
{ {
CLIENT_MAIN, CLIENT_MAIN = 0,
CLIENT_DUMMY, CLIENT_DUMMY,
CLIENT_CONTACT, CLIENT_CONTACT,
NUM_CLIENTS, NUM_CLIENTS,
@ -125,7 +125,7 @@ class CClient : public IClient, public CDemoPlayer::IListener
CUuid m_ConnectionID; CUuid m_ConnectionID;
unsigned m_SnapshotParts[2]; unsigned m_SnapshotParts[NUM_DUMMIES];
int64 m_LocalStartTime; int64 m_LocalStartTime;
IGraphics::CTextureHandle m_DebugFont; IGraphics::CTextureHandle m_DebugFont;
@ -145,9 +145,9 @@ class CClient : public IClient, public CDemoPlayer::IListener
bool m_SoundInitFailed; bool m_SoundInitFailed;
bool m_ResortServerBrowser; bool m_ResortServerBrowser;
int m_AckGameTick[2]; int m_AckGameTick[NUM_DUMMIES];
int m_CurrentRecvTick[2]; int m_CurrentRecvTick[NUM_DUMMIES];
int m_RconAuthed[2]; int m_RconAuthed[NUM_DUMMIES];
char m_RconPassword[32]; char m_RconPassword[32];
int m_UseTempRconCommands; int m_UseTempRconCommands;
char m_Password[32]; char m_Password[32];
@ -163,8 +163,8 @@ class CClient : public IClient, public CDemoPlayer::IListener
char m_aCurrentMap[MAX_PATH_LENGTH]; char m_aCurrentMap[MAX_PATH_LENGTH];
char m_aCurrentMapPath[MAX_PATH_LENGTH]; char m_aCurrentMapPath[MAX_PATH_LENGTH];
char m_aTimeoutCodes[2][32]; char m_aTimeoutCodes[NUM_DUMMIES][32];
bool m_aTimeoutCodeSent[2]; bool m_aTimeoutCodeSent[NUM_DUMMIES];
bool m_GenerateTimeoutSeed; bool m_GenerateTimeoutSeed;
// //
@ -195,7 +195,7 @@ class CClient : public IClient, public CDemoPlayer::IListener
char m_aDummyNameBuf[16]; char m_aDummyNameBuf[16];
// time // time
CSmoothTime m_GameTime[2]; CSmoothTime m_GameTime[NUM_DUMMIES];
CSmoothTime m_PredictedTime; CSmoothTime m_PredictedTime;
// input // input
@ -205,9 +205,9 @@ class CClient : public IClient, public CDemoPlayer::IListener
int m_Tick; // the tick that the input is for int m_Tick; // the tick that the input is for
int64 m_PredictedTime; // prediction latency when we sent this input int64 m_PredictedTime; // prediction latency when we sent this input
int64 m_Time; int64 m_Time;
} m_aInputs[2][200]; } m_aInputs[NUM_DUMMIES][200];
int m_CurrentInput[2]; int m_CurrentInput[NUM_DUMMIES];
bool m_LastDummy; bool m_LastDummy;
bool m_DummySendConnInfo; bool m_DummySendConnInfo;
@ -217,10 +217,10 @@ class CClient : public IClient, public CDemoPlayer::IListener
CGraph m_FpsGraph; CGraph m_FpsGraph;
// the game snapshots are modifiable by the game // the game snapshots are modifiable by the game
class CSnapshotStorage m_SnapshotStorage[2]; class CSnapshotStorage m_SnapshotStorage[NUM_DUMMIES];
CSnapshotStorage::CHolder *m_aSnapshots[2][NUM_SNAPSHOT_TYPES]; CSnapshotStorage::CHolder *m_aSnapshots[NUM_DUMMIES][NUM_SNAPSHOT_TYPES];
int m_ReceivedSnapshots[2]; int m_ReceivedSnapshots[NUM_DUMMIES];
char m_aSnapshotIncomingData[CSnapshot::MAX_SIZE]; char m_aSnapshotIncomingData[CSnapshot::MAX_SIZE];
class CSnapshotStorage::CHolder m_aDemorecSnapshotHolders[NUM_SNAPSHOT_TYPES]; class CSnapshotStorage::CHolder m_aDemorecSnapshotHolders[NUM_SNAPSHOT_TYPES];

View file

@ -18,7 +18,7 @@ class CCamera : public CComponent
}; };
int m_CamType; int m_CamType;
vec2 m_LastPos[2]; vec2 m_LastPos[NUM_DUMMIES];
vec2 m_PrevCenter; vec2 m_PrevCenter;
bool m_Zooming; bool m_Zooming;

View file

@ -10,8 +10,8 @@
class CControls : public CComponent class CControls : public CComponent
{ {
public: public:
vec2 m_MousePos[2]; vec2 m_MousePos[NUM_DUMMIES];
vec2 m_TargetPos[2]; vec2 m_TargetPos[NUM_DUMMIES];
float m_OldMouseX; float m_OldMouseX;
float m_OldMouseY; float m_OldMouseY;
SDL_Joystick *m_Joystick; SDL_Joystick *m_Joystick;
@ -24,12 +24,12 @@ public:
int m_AmmoCount[NUM_WEAPONS]; int m_AmmoCount[NUM_WEAPONS];
CNetObj_PlayerInput m_InputData[2]; CNetObj_PlayerInput m_InputData[NUM_DUMMIES];
CNetObj_PlayerInput m_LastData[2]; CNetObj_PlayerInput m_LastData[NUM_DUMMIES];
int m_InputDirectionLeft[2]; int m_InputDirectionLeft[NUM_DUMMIES];
int m_InputDirectionRight[2]; int m_InputDirectionRight[NUM_DUMMIES];
int m_ShowHookColl[2]; int m_ShowHookColl[NUM_DUMMIES];
int m_ResetDummy[2]; int m_ResetDummy[NUM_DUMMIES];
int m_LastDummy; int m_LastDummy;
int m_OtherFire; int m_OtherFire;

View file

@ -80,7 +80,7 @@ private:
void RenderDDRaceEffects(); void RenderDDRaceEffects();
float m_CheckpointDiff; float m_CheckpointDiff;
float m_ServerRecord; float m_ServerRecord;
float m_PlayerRecord[2]; float m_PlayerRecord[NUM_DUMMIES];
int m_DDRaceTime; int m_DDRaceTime;
int m_LastReceivedTimeTick; int m_LastReceivedTimeTick;
int m_CheckpointTick; int m_CheckpointTick;

View file

@ -102,14 +102,14 @@ class CGameClient : public IGameClient
void UpdatePositions(); void UpdatePositions();
int m_PredictedTick; int m_PredictedTick;
int m_LastNewPredictedTick[2]; int m_LastNewPredictedTick[NUM_DUMMIES];
int m_LastRoundStartTick; int m_LastRoundStartTick;
int m_LastFlagCarrierRed; int m_LastFlagCarrierRed;
int m_LastFlagCarrierBlue; int m_LastFlagCarrierBlue;
int m_CheckInfo[2]; int m_CheckInfo[NUM_DUMMIES];
char m_aDDNetVersionStr[64]; char m_aDDNetVersionStr[64];
@ -164,7 +164,7 @@ public:
int m_FlagDropTick[2]; int m_FlagDropTick[2];
// TODO: move this // TODO: move this
CTuningParams m_Tuning[2]; CTuningParams m_Tuning[NUM_DUMMIES];
enum enum
{ {
@ -421,7 +421,7 @@ public:
// DDRace // DDRace
int m_LocalIDs[2]; int m_LocalIDs[NUM_DUMMIES];
CNetObj_PlayerInput m_DummyInput; CNetObj_PlayerInput m_DummyInput;
CNetObj_PlayerInput m_HammerInput; CNetObj_PlayerInput m_HammerInput;
int m_DummyFire; int m_DummyFire;
@ -566,8 +566,8 @@ public:
bool m_EmoticonsSkinLoaded; bool m_EmoticonsSkinLoaded;
private: private:
bool m_DDRaceMsgSent[2]; bool m_DDRaceMsgSent[NUM_DUMMIES];
int m_ShowOthers[2]; int m_ShowOthers[NUM_DUMMIES];
void UpdatePrediction(); void UpdatePrediction();
void UpdateRenderedCharacters(); void UpdateRenderedCharacters();