[bot] Implement WorldPlayerAdd(...)

* Rename `CNetGame::sub_415EC0(...)` to `CNetGame::SetPlayerAdded(...)`
This commit is contained in:
RD42 2024-06-03 22:58:59 +08:00
parent c82d3764fd
commit 26ea16aaae
6 changed files with 41 additions and 11 deletions

View File

@ -522,7 +522,7 @@ void CNetGame::ResetPlayerPool()
//---------------------------------------------------- //----------------------------------------------------
void CNetGame::sub_415EA0(PLAYERID playerId, BOOL a2) void CNetGame::SetPlayerAdded(PLAYERID playerId, BOOL a2)
{ {
if(playerId < MAX_PLAYERS) if(playerId < MAX_PLAYERS)
{ {

View File

@ -95,8 +95,8 @@ public:
void ResetPlayerPool(); void ResetPlayerPool();
void ShutdownForGameModeRestart(); void ShutdownForGameModeRestart();
void sub_415EA0(PLAYERID playerId, BOOL a2);
void sub_415EC0(VEHICLEID VehicleID, BOOL a2); void sub_415EC0(VEHICLEID VehicleID, BOOL a2);
void SetPlayerAdded(PLAYERID playerId, BOOL a2);
void StopRecordingPlayback(); void StopRecordingPlayback();
}; };

View File

@ -219,9 +219,39 @@ void RequestSpawn(RPCParameters *rpcParams)
} }
} }
void Unk20(RPCParameters *rpcParams) void WorldPlayerAdd(RPCParameters *rpcParams)
{ {
// TODO: Unk20 PCHAR Data = reinterpret_cast<PCHAR>(rpcParams->input);
int iBitLength = rpcParams->numberOfBitsOfData;
PlayerID sender = rpcParams->sender;
RakNet::BitStream bsData(Data,(iBitLength/8)+1,false);
CPlayerPool *pPlayerPool = pNetGame->GetPlayerPool();
PLAYERID playerId;
BYTE byteFightingStyle=4;
BYTE byteTeam=0;
int iSkin=0;
VECTOR vecPos;
float fRotation=0;
DWORD dwColor=0;
bsData.Read(playerId);
bsData.Read(byteTeam);
bsData.Read(iSkin);
bsData.Read(vecPos.X);
bsData.Read(vecPos.Y);
bsData.Read(vecPos.Z);
bsData.Read(fRotation);
bsData.Read(dwColor);
byteFightingStyle = 4;
if(pNetGame->GetPlayerPool()->GetSlotState(playerId) == FALSE) return;
pNetGame->SetPlayerAdded(playerId,TRUE);
if(pNetGame->GetBotMode()) {
pNetGame->GetBotMode()->OnPlayerStreamIn(playerId);
}
} }
void UnkA6(RPCParameters *rpcParams) void UnkA6(RPCParameters *rpcParams)
@ -273,7 +303,7 @@ void RegisterRPCs(RakClientInterface * pRakClient)
REGISTER_STATIC_RPC(pRakClient,Chat); REGISTER_STATIC_RPC(pRakClient,Chat);
REGISTER_STATIC_RPC(pRakClient,RequestClass); REGISTER_STATIC_RPC(pRakClient,RequestClass);
REGISTER_STATIC_RPC(pRakClient,RequestSpawn); REGISTER_STATIC_RPC(pRakClient,RequestSpawn);
REGISTER_STATIC_RPC(pRakClient,Unk20); REGISTER_STATIC_RPC(pRakClient,WorldPlayerAdd);
REGISTER_STATIC_RPC(pRakClient,UnkA6); REGISTER_STATIC_RPC(pRakClient,UnkA6);
REGISTER_STATIC_RPC(pRakClient,UnkA3); REGISTER_STATIC_RPC(pRakClient,UnkA3);
REGISTER_STATIC_RPC(pRakClient,UnkA4); REGISTER_STATIC_RPC(pRakClient,UnkA4);
@ -303,7 +333,7 @@ void UnRegisterRPCs(RakClientInterface * pRakClient)
UNREGISTER_STATIC_RPC(pRakClient,Weather); UNREGISTER_STATIC_RPC(pRakClient,Weather);
UNREGISTER_STATIC_RPC(pRakClient,Unk1D); UNREGISTER_STATIC_RPC(pRakClient,Unk1D);
UNREGISTER_STATIC_RPC(pRakClient,Unk1E); UNREGISTER_STATIC_RPC(pRakClient,Unk1E);
UNREGISTER_STATIC_RPC(pRakClient,Unk20); UNREGISTER_STATIC_RPC(pRakClient,WorldPlayerAdd);
UNREGISTER_STATIC_RPC(pRakClient,UnkA6); UNREGISTER_STATIC_RPC(pRakClient,UnkA6);
UNREGISTER_STATIC_RPC(pRakClient,UnkA3); UNREGISTER_STATIC_RPC(pRakClient,UnkA3);
UNREGISTER_STATIC_RPC(pRakClient,UnkA4); UNREGISTER_STATIC_RPC(pRakClient,UnkA4);

View File

@ -32,7 +32,7 @@ CPlayerPool::~CPlayerPool()
BOOL CPlayerPool::Delete(PLAYERID playerId, BYTE byteReason) BOOL CPlayerPool::Delete(PLAYERID playerId, BYTE byteReason)
{ {
m_bPlayerSlotState[playerId] = FALSE; m_bPlayerSlotState[playerId] = FALSE;
pNetGame->sub_415EA0(playerId, FALSE); pNetGame->SetPlayerAdded(playerId, FALSE);
return TRUE; return TRUE;
} }

View File

@ -36,11 +36,11 @@
#define RPC_Unk1D "\x1D" #define RPC_Unk1D "\x1D"
#define RPC_Unk1E "\x1E" #define RPC_Unk1E "\x1E"
#define RPC_Unk3C "\x3C" #define RPC_Unk3C "\x3C"
#define RPC_Unk20 "\x20"
#define RPC_UnkA6 "\xA6" #define RPC_UnkA6 "\xA6"
#define RPC_UnkA3 "\xA3" #define RPC_UnkA3 "\xA3"
#define RPC_UnkA4 "\xA4" #define RPC_UnkA4 "\xA4"
#define RPC_UnkA5 "\xA5" #define RPC_UnkA5 "\xA5"
#define RPC_WorldPlayerAdd "\x20"
#define RPC_DamageVehicle "\x6A" #define RPC_DamageVehicle "\x6A"
#define RPC_Unk18 "\x18" #define RPC_Unk18 "\x18"
#define RPC_EnterVehicle "\x1A" #define RPC_EnterVehicle "\x1A"

View File

@ -25,11 +25,11 @@ void Weather(RPCParameters *rpcParams) {}
void Unk1D(RPCParameters *rpcParams) {} void Unk1D(RPCParameters *rpcParams) {}
void Unk1E(RPCParameters *rpcParams) {} void Unk1E(RPCParameters *rpcParams) {}
void Unk3C(RPCParameters *rpcParams) {} void Unk3C(RPCParameters *rpcParams) {}
void Unk20(RPCParameters *rpcParams) {}
void UnkA6(RPCParameters *rpcParams) {} void UnkA6(RPCParameters *rpcParams) {}
void UnkA3(RPCParameters *rpcParams) {} void UnkA3(RPCParameters *rpcParams) {}
void UnkA4(RPCParameters *rpcParams) {} void UnkA4(RPCParameters *rpcParams) {}
void UnkA5(RPCParameters *rpcParams) {} void UnkA5(RPCParameters *rpcParams) {}
void WorldPlayerAdd(RPCParameters *rpcParams) {}
void DamageVehicle(RPCParameters *rpcParams) {} void DamageVehicle(RPCParameters *rpcParams) {}
void Unk18(RPCParameters *rpcParams) {} void Unk18(RPCParameters *rpcParams) {}
void EnterVehicle(RPCParameters *rpcParams) {} void EnterVehicle(RPCParameters *rpcParams) {}
@ -76,11 +76,11 @@ void RegisterRPCs(RakClientInterface * pRakClient)
REGISTER_STATIC_RPC(pRakClient,Unk1D); REGISTER_STATIC_RPC(pRakClient,Unk1D);
REGISTER_STATIC_RPC(pRakClient,Unk1E); REGISTER_STATIC_RPC(pRakClient,Unk1E);
REGISTER_STATIC_RPC(pRakClient,Unk3C); REGISTER_STATIC_RPC(pRakClient,Unk3C);
REGISTER_STATIC_RPC(pRakClient,Unk20);
REGISTER_STATIC_RPC(pRakClient,UnkA6); REGISTER_STATIC_RPC(pRakClient,UnkA6);
REGISTER_STATIC_RPC(pRakClient,UnkA3); REGISTER_STATIC_RPC(pRakClient,UnkA3);
REGISTER_STATIC_RPC(pRakClient,UnkA4); REGISTER_STATIC_RPC(pRakClient,UnkA4);
REGISTER_STATIC_RPC(pRakClient,UnkA5); REGISTER_STATIC_RPC(pRakClient,UnkA5);
REGISTER_STATIC_RPC(pRakClient,WorldPlayerAdd);
REGISTER_STATIC_RPC(pRakClient,DamageVehicle); REGISTER_STATIC_RPC(pRakClient,DamageVehicle);
REGISTER_STATIC_RPC(pRakClient,Unk18); REGISTER_STATIC_RPC(pRakClient,Unk18);
REGISTER_STATIC_RPC(pRakClient,EnterVehicle); REGISTER_STATIC_RPC(pRakClient,EnterVehicle);
@ -106,11 +106,11 @@ void RegisterRPCs(RakClientInterface * pRakClient)
void UnRegisterRPCs(RakClientInterface * pRakClient) void UnRegisterRPCs(RakClientInterface * pRakClient)
{ {
UNREGISTER_STATIC_RPC(pRakClient,Unk3C); UNREGISTER_STATIC_RPC(pRakClient,Unk3C);
UNREGISTER_STATIC_RPC(pRakClient,Unk20);
UNREGISTER_STATIC_RPC(pRakClient,UnkA6); UNREGISTER_STATIC_RPC(pRakClient,UnkA6);
UNREGISTER_STATIC_RPC(pRakClient,UnkA3); UNREGISTER_STATIC_RPC(pRakClient,UnkA3);
UNREGISTER_STATIC_RPC(pRakClient,UnkA4); UNREGISTER_STATIC_RPC(pRakClient,UnkA4);
UNREGISTER_STATIC_RPC(pRakClient,UnkA5); UNREGISTER_STATIC_RPC(pRakClient,UnkA5);
UNREGISTER_STATIC_RPC(pRakClient,WorldPlayerAdd);
UNREGISTER_STATIC_RPC(pRakClient,Unk18); UNREGISTER_STATIC_RPC(pRakClient,Unk18);
UNREGISTER_STATIC_RPC(pRakClient,RequestClass); UNREGISTER_STATIC_RPC(pRakClient,RequestClass);
UNREGISTER_STATIC_RPC(pRakClient,RequestSpawn); UNREGISTER_STATIC_RPC(pRakClient,RequestSpawn);