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;
|
2024-06-29 22:41:19 +08:00
|
|
|
FILE *field_1E2;
|
|
|
|
char _gap1E6[4];
|
|
|
|
int field_1EA;
|
|
|
|
char _gap1EE[4];
|
2023-10-22 17:08:53 +08:00
|
|
|
int field_1F2;
|
2024-06-29 22:41:19 +08:00
|
|
|
int field_1F6;
|
2023-10-22 17:08:53 +08:00
|
|
|
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-06-26 23:12:06 +08:00
|
|
|
CVehiclePool * GetVehiclePool() { return m_pVehiclePool; };
|
2024-01-29 19:34:27 +08:00
|
|
|
RakClientInterface * GetRakClient() { return m_pRakClient; };
|
2024-08-29 23:14:15 +08:00
|
|
|
CScriptTimers * GetTimers() { return m_pScriptTimers; };
|
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-29 22:45:28 +08:00
|
|
|
void SendChat(char *szText);
|
2024-06-29 22:47:25 +08:00
|
|
|
void SendCommand(char *szCommand);
|
2024-06-29 22:45:28 +08:00
|
|
|
|
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-29 23:24:41 +08:00
|
|
|
void SetPlayerState(PLAYERID playerId, BYTE byteState);
|
2024-06-29 22:53:05 +08:00
|
|
|
BYTE GetPlayerState(PLAYERID playerId);
|
2024-07-01 22:59:50 +08:00
|
|
|
BOOL GetPlayerPos(PLAYERID playerId, PVECTOR Vector);
|
2024-07-01 23:01:21 +08:00
|
|
|
VEHICLEID GetPlayerVehicleID(PLAYERID playerId);
|
2024-07-01 23:03:22 +08:00
|
|
|
BYTE GetPlayerArmedWeapon(PLAYERID playerId);
|
2024-07-03 23:23:15 +08:00
|
|
|
BYTE GetPlayerHealth(PLAYERID playerId);
|
2024-07-03 23:24:36 +08:00
|
|
|
BYTE GetPlayerArmour(PLAYERID playerId);
|
2024-07-06 22:45:04 +08:00
|
|
|
BOOL GetPlayerKeys(PLAYERID playerId, WORD *udAnalog, WORD *lrAnalog, WORD *wKeys);
|
2024-07-08 18:01:38 +08:00
|
|
|
BYTE GetPlayerSpecialAction(PLAYERID playerId);
|
2024-07-07 22:46:20 +08:00
|
|
|
BOOL IsPlayerAdded(PLAYERID playerId);
|
2024-07-05 22:43:08 +08:00
|
|
|
BOOL IsVehicleAdded(VEHICLEID VehicleID);
|
2024-07-08 18:03:56 +08:00
|
|
|
float GetDistanceFromMeToPoint(PVECTOR vecPos);
|
2024-07-07 22:40:49 +08:00
|
|
|
PVECTOR GetMyPos(PVECTOR Vector);
|
2024-07-07 22:37:45 +08:00
|
|
|
void SetMyPos(PVECTOR Vector);
|
2024-07-07 22:35:03 +08:00
|
|
|
float GetMyZAngle();
|
2024-07-07 22:46:20 +08:00
|
|
|
void SetMyZAngle(float fAngle);
|
2024-07-01 23:03:22 +08:00
|
|
|
|
2024-06-01 18:30:44 +08:00
|
|
|
void StopRecordingPlayback();
|
2024-06-29 22:38:46 +08:00
|
|
|
void PauseRecordingPlayback();
|
2024-06-29 22:41:19 +08:00
|
|
|
void ResumeRecordingPlayback();
|
2023-10-22 17:08:53 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------------------
|