[bot] Implement GameModeRestart(...)

* Implement `CNetGame::ShutdownForGameModeRestart()`

* Implement `CPlayerPool::Process()`

* Implement `CNetGame::ResetVehiclePool()`

* Implement `CNetGame::StopRecordingPlayback()`
This commit is contained in:
RD42 2024-06-01 18:30:44 +08:00
parent 271fa1844e
commit 9a61b24a2f
7 changed files with 75 additions and 9 deletions

View File

@ -82,6 +82,39 @@ CNetGame::~CNetGame()
//----------------------------------------------------
void CNetGame::ShutdownForGameModeRestart()
{
m_byteWorldTime = 12;
m_byteWorldMinute = 0;
m_byteWeather = 10;
m_byteHoldTime = 1;
m_bUseCJWalk = FALSE;
m_fGravity = (float)0.008000000;
m_iDeathDropMoney = 0;
m_iGameState = GAMESTATE_RESTARTING;
// Process the pool one last time
m_pPlayerPool->Process();
ResetVehiclePool();
StopRecordingPlayback();
memset(unnamed_1,0,sizeof(unnamed_1));
memset(unnamed_2,0,sizeof(unnamed_2));
memset(unnamed_3,0,sizeof(unnamed_3));
memset(unnamed_4,0,sizeof(unnamed_4));
memset(unnamed_5,0,sizeof(unnamed_5));
memset(unnamed_6,0,sizeof(unnamed_6));
memset(unnamed_7,0,sizeof(unnamed_7));
memset(unnamed_8,0,sizeof(unnamed_8));
m_bZoneNames = FALSE;
}
//----------------------------------------------------
void CNetGame::Init(PCHAR szHostOrIp, int iPort,
PCHAR szPlayerName, PCHAR szPass,
PCHAR szNpcMode)
@ -405,6 +438,16 @@ void CNetGame::Packet_ConnectionSucceeded(Packet *p)
//----------------------------------------------------
void CNetGame::ResetVehiclePool()
{
if(m_pVehiclePool) {
delete m_pVehiclePool;
}
m_pVehiclePool = new CVehiclePool();
}
//----------------------------------------------------
void CNetGame::sub_415EA0(PLAYERID playerId, BOOL a2)
{
if(playerId < MAX_PLAYERS)
@ -421,3 +464,11 @@ void CNetGame::sub_415EC0(VEHICLEID VehicleID, BOOL a2)
}
}
void CNetGame::StopRecordingPlayback()
{
field_1DE = 0;
field_1DA = 0;
}

View File

@ -6,6 +6,8 @@
#define GAMESTATE_CONNECTED 2
#define GAMESTATE_AWAIT_JOIN 3
#define GAMESTATE_RESTARTING 5
//----------------------------------------------------
class CNetGame // size: 910 bytes
@ -45,7 +47,7 @@ private:
bool m_bUseCJWalk;
char _gap41[9];
DWORD m_dwMapIcon[100];
char _gap1DA[4];
int field_1DA;
int field_1DE;
int field_1E2;
char _gap1E6[12];
@ -72,9 +74,13 @@ public:
void Init(PCHAR szHostOrIp,int iPort,PCHAR szPlayerName,PCHAR szPass,PCHAR szNpcMode);
void Process();
void ResetVehiclePool();
void ShutdownForGameModeRestart();
void sub_415EA0(PLAYERID playerId, BOOL a2);
void sub_415EC0(VEHICLEID VehicleID, BOOL a2);
void StopRecordingPlayback();
};
//----------------------------------------------------

View File

@ -19,9 +19,9 @@ void SvrStats(RPCParameters *rpcParams)
bsData.Read((char *)&RakServerStats,sizeof(RakNetStatisticsStruct));
}
void Unk28(RPCParameters *rpcParams)
void GameModeRestart(RPCParameters *rpcParams)
{
// TODO: Unk28
pNetGame->ShutdownForGameModeRestart();
}
void Unk82(RPCParameters *rpcParams)
@ -110,7 +110,7 @@ void RegisterRPCs(RakClientInterface * pRakClient)
REGISTER_STATIC_RPC(pRakClient,Unk27);
REGISTER_STATIC_RPC(pRakClient,UpdateScoresPingsIPs);
REGISTER_STATIC_RPC(pRakClient,SvrStats);
REGISTER_STATIC_RPC(pRakClient,Unk28);
REGISTER_STATIC_RPC(pRakClient,GameModeRestart);
REGISTER_STATIC_RPC(pRakClient,Unk82);
REGISTER_STATIC_RPC(pRakClient,ClientMessage);
REGISTER_STATIC_RPC(pRakClient,WorldTime);
@ -146,7 +146,7 @@ void UnRegisterRPCs(RakClientInterface * pRakClient)
UNREGISTER_STATIC_RPC(pRakClient,Unk27);
UNREGISTER_STATIC_RPC(pRakClient,UpdateScoresPingsIPs);
UNREGISTER_STATIC_RPC(pRakClient,SvrStats);
UNREGISTER_STATIC_RPC(pRakClient,Unk28);
UNREGISTER_STATIC_RPC(pRakClient,GameModeRestart);
UNREGISTER_STATIC_RPC(pRakClient,Unk82);
UNREGISTER_STATIC_RPC(pRakClient,ClientMessage);
UNREGISTER_STATIC_RPC(pRakClient,WorldTime);

View File

@ -37,3 +37,10 @@ BOOL CPlayerPool::Delete(PLAYERID playerId, BYTE byteReason)
}
//----------------------------------------------------
BOOL CPlayerPool::Process()
{
return TRUE;
}
//----------------------------------------------------

View File

@ -15,6 +15,8 @@ private:
char gap90AB[4000];
public:
// Process All CPlayers
BOOL Process();
void SetLocalPlayerName(PCHAR szName) { strcpy(m_szLocalPlayerName,szName); };

View File

@ -24,8 +24,8 @@
#define RPC_Unk27 "\x27"
#define RPC_UpdateScoresPingsIPs "\x9B"
#define RPC_SvrStats "\x66"
#define RPC_Unk28 "\x28"
#define RPC_Unk82 "\x82"
#define RPC_GameModeRestart "\x28"
#define RPC_ClientMessage "\x5D"
#define RPC_WorldTime "\x5E"
#define RPC_Unk5F "\x5F"

View File

@ -13,8 +13,8 @@ void Unk26(RPCParameters *rpcParams) {}
void Unk27(RPCParameters *rpcParams) {}
void UpdateScoresPingsIPs(RPCParameters *rpcParams) {}
void SvrStats(RPCParameters *rpcParams) {}
void Unk28(RPCParameters *rpcParams) {}
void Unk82(RPCParameters *rpcParams) {}
void GameModeRestart(RPCParameters *rpcParams) {}
void ClientMessage(RPCParameters *rpcParams) {}
void WorldTime(RPCParameters *rpcParams) {}
void Unk5F(RPCParameters *rpcParams) {}
@ -64,8 +64,8 @@ void RegisterRPCs(RakClientInterface * pRakClient)
REGISTER_STATIC_RPC(pRakClient,Unk27);
REGISTER_STATIC_RPC(pRakClient,UpdateScoresPingsIPs);
REGISTER_STATIC_RPC(pRakClient,SvrStats);
REGISTER_STATIC_RPC(pRakClient,Unk28);
REGISTER_STATIC_RPC(pRakClient,Unk82);
REGISTER_STATIC_RPC(pRakClient,GameModeRestart);
REGISTER_STATIC_RPC(pRakClient,ClientMessage);
REGISTER_STATIC_RPC(pRakClient,WorldTime);
REGISTER_STATIC_RPC(pRakClient,Unk5F);
@ -132,8 +132,8 @@ void UnRegisterRPCs(RakClientInterface * pRakClient)
UNREGISTER_STATIC_RPC(pRakClient,Unk27);
UNREGISTER_STATIC_RPC(pRakClient,UpdateScoresPingsIPs);
UNREGISTER_STATIC_RPC(pRakClient,SvrStats);
UNREGISTER_STATIC_RPC(pRakClient,Unk28);
UNREGISTER_STATIC_RPC(pRakClient,Unk82);
UNREGISTER_STATIC_RPC(pRakClient,GameModeRestart);
UNREGISTER_STATIC_RPC(pRakClient,ClientMessage);
UNREGISTER_STATIC_RPC(pRakClient,WorldTime);
UNREGISTER_STATIC_RPC(pRakClient,Unk5F);