SA-MP/bot/net/netgame.h

113 lines
2.8 KiB
C
Raw Normal View History

2023-10-22 17:08:53 +08:00
#pragma once
#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
#define GAMESTATE_AWAIT_JOIN 3
2024-01-29 19:34:27 +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
void UpdateNetwork();
// Packet handlers
void Packet_AimSync(Packet *p);
void Packet_PassengerSync(Packet *p);
void Packet_ConnectionSucceeded(Packet *p);
void Packet_RSAPublicKeyMismatch(Packet* packet);
void Packet_ConnectionBanned(Packet* packet);
void Packet_ConnectionRequestAccepted(Packet* packet);
void Packet_NoFreeIncomingConnections(Packet* packet);
void Packet_DisconnectionNotification(Packet* packet);
void Packet_ConnectionLost(Packet* packet);
void Packet_InvalidPassword(Packet* packet);
void Packet_ModifiedPacket(Packet* packet);
void Packet_ConnectAttemptFailed(Packet* packet);
void Packet_TrailerSync(Packet *p);
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];
int field_1DA;
2023-10-22 17:08:53 +08:00
int field_1DE;
FILE *field_1E2;
char _gap1E6[4];
int field_1EA;
char _gap1EE[4];
2023-10-22 17:08:53 +08:00
int field_1F2;
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
CPlayerPool * GetPlayerPool() { return m_pPlayerPool; };
CVehiclePool * GetVehiclePool() { return m_pVehiclePool; };
2024-01-29 19:34:27 +08:00
RakClientInterface * GetRakClient() { return m_pRakClient; };
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();
void ResetVehiclePool();
void ResetPlayerPool();
void ShutdownForGameModeRestart();
2023-10-22 17:08:53 +08:00
BOOL IsPlayerAdded(PLAYERID playerId);
void SetMyZAngle(float fAngle);
void SetPlayerAdded(PLAYERID playerId, BOOL a2);
void SetVehicleAdded(VEHICLEID VehicleID, BOOL a2);
void StopRecordingPlayback();
void PauseRecordingPlayback();
void ResumeRecordingPlayback();
2023-10-22 17:08:53 +08:00
};
//----------------------------------------------------