2023-10-22 17:08:53 +08:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2024-05-17 22:48:32 +08:00
|
|
|
#define GAMESTATE_NONE 0 // used for debugging modes and such
|
2024-04-25 22:10:37 +08:00
|
|
|
#define GAMESTATE_CONNECTING 1
|
2024-01-29 19:34:27 +08:00
|
|
|
#define GAMESTATE_CONNECTED 2
|
2024-05-17 22:48:32 +08:00
|
|
|
#define GAMESTATE_AWAIT_JOIN 3
|
2024-01-29 19:34:27 +08:00
|
|
|
|
2024-06-01 18:30:44 +08:00
|
|
|
#define GAMESTATE_RESTARTING 5
|
|
|
|
|
2023-10-22 17:08:53 +08:00
|
|
|
//----------------------------------------------------
|
|
|
|
|
|
|
|
class CNetGame // size: 910 bytes
|
|
|
|
{
|
|
|
|
private:
|
2024-01-15 23:53:36 +08:00
|
|
|
RakClientInterface *m_pRakClient;
|
|
|
|
CPlayerPool *m_pPlayerPool;
|
2024-04-25 22:10:37 +08:00
|
|
|
CVehiclePool *m_pVehiclePool;
|
|
|
|
int m_iGameState;
|
|
|
|
BOOL m_bLanMode;
|
2024-01-15 23:53:36 +08:00
|
|
|
|
2024-04-25 22:14:30 +08:00
|
|
|
void UpdateNetwork();
|
|
|
|
|
|
|
|
// Packet handlers
|
2024-04-25 22:19:11 +08:00
|
|
|
void Packet_AimSync(Packet *p);
|
2024-04-25 22:33:18 +08:00
|
|
|
void Packet_PassengerSync(Packet *p);
|
2024-05-17 22:48:32 +08:00
|
|
|
void Packet_ConnectionSucceeded(Packet *p);
|
2024-06-01 19:59:47 +08:00
|
|
|
void Packet_RSAPublicKeyMismatch(Packet* packet);
|
2024-05-10 22:20:05 +08:00
|
|
|
void Packet_ConnectionBanned(Packet* packet);
|
2024-06-01 20:09:10 +08:00
|
|
|
void Packet_ConnectionRequestAccepted(Packet* packet);
|
2024-06-01 20:10:45 +08:00
|
|
|
void Packet_NoFreeIncomingConnections(Packet* packet);
|
2024-05-10 22:20:46 +08:00
|
|
|
void Packet_DisconnectionNotification(Packet* packet);
|
2024-06-01 20:34:10 +08:00
|
|
|
void Packet_ConnectionLost(Packet* packet);
|
2024-06-01 20:35:12 +08:00
|
|
|
void Packet_InvalidPassword(Packet* packet);
|
2024-04-25 22:14:30 +08:00
|
|
|
void Packet_ModifiedPacket(Packet* packet);
|
2024-06-01 18:44:36 +08:00
|
|
|
void Packet_ConnectAttemptFailed(Packet* packet);
|
2024-04-25 22:20:29 +08:00
|
|
|
void Packet_TrailerSync(Packet *p);
|
2024-04-25 22:14:30 +08:00
|
|
|
|
2024-06-03 22:51:04 +08:00
|
|
|
public:
|
|
|
|
|
2024-04-25 22:10:37 +08:00
|
|
|
int m_iSpawnsAvailable;
|
2024-06-03 22:51:04 +08:00
|
|
|
bool m_bShowPlayerMarkers;
|
|
|
|
int m_iPlayerMarkersMode;
|
|
|
|
bool m_bTirePopping;
|
2024-04-25 22:10:37 +08:00
|
|
|
BYTE m_byteWorldTime;
|
|
|
|
BYTE m_byteWorldMinute;
|
|
|
|
BYTE m_byteWeather;
|
2023-10-22 17:08:53 +08:00
|
|
|
char _gap21[16];
|
2024-04-25 22:10:37 +08:00
|
|
|
BYTE m_byteFriendlyFire;
|
2024-06-03 22:51:04 +08:00
|
|
|
bool m_bAllowWeapons;
|
|
|
|
bool m_bNameTagLOS;
|
2024-04-25 22:10:37 +08:00
|
|
|
float m_fGravity;
|
|
|
|
int m_iDeathDropMoney;
|
|
|
|
BYTE m_byteHoldTime;
|
|
|
|
bool m_bInstagib;
|
|
|
|
bool m_bZoneNames;
|
2024-06-03 22:51:04 +08:00
|
|
|
bool m_bLimitGlobalChatRadius;
|
2024-04-25 22:10:37 +08:00
|
|
|
bool m_bUseCJWalk;
|
2024-06-03 22:51:04 +08:00
|
|
|
float m_fGlobalChatRadius;
|
|
|
|
float m_fNameTagDrawDistance;
|
|
|
|
bool m_bDisableEnterExits;
|
2024-04-25 22:10:37 +08:00
|
|
|
DWORD m_dwMapIcon[100];
|
2024-06-01 18:30:44 +08:00
|
|
|
int field_1DA;
|
2023-10-22 17:08:53 +08:00
|
|
|
int field_1DE;
|
|
|
|
int field_1E2;
|
|
|
|
char _gap1E6[12];
|
|
|
|
int field_1F2;
|
|
|
|
char _gap1F6[4];
|
|
|
|
int field_1FA;
|
|
|
|
int field_1FE;
|
2023-11-18 00:00:52 +08:00
|
|
|
|
|
|
|
char m_szHostName[256];
|
|
|
|
char m_szHostOrIp[128];
|
|
|
|
int m_iPort;
|
|
|
|
|
2024-01-19 23:19:26 +08:00
|
|
|
CGameMode* m_pGameMode;
|
2023-11-18 00:00:52 +08:00
|
|
|
CScriptTimers* m_pScriptTimers;
|
2023-10-22 17:08:53 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
CNetGame();
|
|
|
|
~CNetGame();
|
|
|
|
|
2024-01-29 19:34:27 +08:00
|
|
|
int GetGameState() { return m_iGameState; };
|
2024-06-03 22:51:04 +08:00
|
|
|
void SetGameState(int iGameState) { m_iGameState = iGameState; };
|
|
|
|
void SetLanMode(BOOL bMode) { m_bLanMode = bMode; };
|
2024-01-29 19:34:27 +08:00
|
|
|
|
2024-06-01 18:40:37 +08:00
|
|
|
CPlayerPool * GetPlayerPool() { return m_pPlayerPool; };
|
2024-01-29 19:34:27 +08:00
|
|
|
RakClientInterface * GetRakClient() { return m_pRakClient; };
|
2024-06-01 19:50:36 +08:00
|
|
|
CGameMode * GetBotMode() { return m_pGameMode; };
|
2024-01-29 19:34:27 +08:00
|
|
|
|
2023-11-18 00:00:52 +08:00
|
|
|
void Init(PCHAR szHostOrIp,int iPort,PCHAR szPlayerName,PCHAR szPass,PCHAR szNpcMode);
|
2023-10-22 17:08:53 +08:00
|
|
|
void Process();
|
2024-06-01 18:30:44 +08:00
|
|
|
void ResetVehiclePool();
|
2024-06-01 18:35:59 +08:00
|
|
|
void ResetPlayerPool();
|
2024-06-01 18:30:44 +08:00
|
|
|
void ShutdownForGameModeRestart();
|
2023-10-22 17:08:53 +08:00
|
|
|
|
2024-06-08 21:52:14 +08:00
|
|
|
BOOL IsPlayerAdded(PLAYERID playerId);
|
2024-06-06 23:09:13 +08:00
|
|
|
void SetMyZAngle(float fAngle);
|
|
|
|
|
2024-06-03 22:58:59 +08:00
|
|
|
void SetPlayerAdded(PLAYERID playerId, BOOL a2);
|
2024-06-26 23:08:18 +08:00
|
|
|
void SetVehicleAdded(VEHICLEID VehicleID, BOOL a2);
|
2024-06-01 18:30:44 +08:00
|
|
|
|
|
|
|
void StopRecordingPlayback();
|
2023-10-22 17:08:53 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------------------
|