diff --git a/bot/net/netgame.cpp b/bot/net/netgame.cpp index d0ac3ad..0ca263a 100644 --- a/bot/net/netgame.cpp +++ b/bot/net/netgame.cpp @@ -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) { diff --git a/bot/net/netgame.h b/bot/net/netgame.h index 29bee6c..069de0c 100644 --- a/bot/net/netgame.h +++ b/bot/net/netgame.h @@ -95,8 +95,8 @@ public: void ResetPlayerPool(); void ShutdownForGameModeRestart(); - void sub_415EA0(PLAYERID playerId, BOOL a2); void sub_415EC0(VEHICLEID VehicleID, BOOL a2); + void SetPlayerAdded(PLAYERID playerId, BOOL a2); void StopRecordingPlayback(); }; diff --git a/bot/net/netrpc.cpp b/bot/net/netrpc.cpp index 97144fe..41735bb 100644 --- a/bot/net/netrpc.cpp +++ b/bot/net/netrpc.cpp @@ -219,9 +219,39 @@ void RequestSpawn(RPCParameters *rpcParams) } } -void Unk20(RPCParameters *rpcParams) +void WorldPlayerAdd(RPCParameters *rpcParams) { - // TODO: Unk20 + PCHAR Data = reinterpret_cast(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) @@ -273,7 +303,7 @@ void RegisterRPCs(RakClientInterface * pRakClient) REGISTER_STATIC_RPC(pRakClient,Chat); REGISTER_STATIC_RPC(pRakClient,RequestClass); REGISTER_STATIC_RPC(pRakClient,RequestSpawn); - REGISTER_STATIC_RPC(pRakClient,Unk20); + REGISTER_STATIC_RPC(pRakClient,WorldPlayerAdd); REGISTER_STATIC_RPC(pRakClient,UnkA6); REGISTER_STATIC_RPC(pRakClient,UnkA3); REGISTER_STATIC_RPC(pRakClient,UnkA4); @@ -303,7 +333,7 @@ void UnRegisterRPCs(RakClientInterface * pRakClient) UNREGISTER_STATIC_RPC(pRakClient,Weather); UNREGISTER_STATIC_RPC(pRakClient,Unk1D); UNREGISTER_STATIC_RPC(pRakClient,Unk1E); - UNREGISTER_STATIC_RPC(pRakClient,Unk20); + UNREGISTER_STATIC_RPC(pRakClient,WorldPlayerAdd); UNREGISTER_STATIC_RPC(pRakClient,UnkA6); UNREGISTER_STATIC_RPC(pRakClient,UnkA3); UNREGISTER_STATIC_RPC(pRakClient,UnkA4); diff --git a/bot/net/playerpool.cpp b/bot/net/playerpool.cpp index d973c70..8dfcf6f 100644 --- a/bot/net/playerpool.cpp +++ b/bot/net/playerpool.cpp @@ -32,7 +32,7 @@ CPlayerPool::~CPlayerPool() BOOL CPlayerPool::Delete(PLAYERID playerId, BYTE byteReason) { m_bPlayerSlotState[playerId] = FALSE; - pNetGame->sub_415EA0(playerId, FALSE); + pNetGame->SetPlayerAdded(playerId, FALSE); return TRUE; } diff --git a/raknet/SAMPRPC.h b/raknet/SAMPRPC.h index e404398..511a161 100644 --- a/raknet/SAMPRPC.h +++ b/raknet/SAMPRPC.h @@ -36,11 +36,11 @@ #define RPC_Unk1D "\x1D" #define RPC_Unk1E "\x1E" #define RPC_Unk3C "\x3C" -#define RPC_Unk20 "\x20" #define RPC_UnkA6 "\xA6" #define RPC_UnkA3 "\xA3" #define RPC_UnkA4 "\xA4" #define RPC_UnkA5 "\xA5" +#define RPC_WorldPlayerAdd "\x20" #define RPC_DamageVehicle "\x6A" #define RPC_Unk18 "\x18" #define RPC_EnterVehicle "\x1A" diff --git a/saco/net/netrpc.cpp b/saco/net/netrpc.cpp index 23dd768..4efc398 100644 --- a/saco/net/netrpc.cpp +++ b/saco/net/netrpc.cpp @@ -25,11 +25,11 @@ void Weather(RPCParameters *rpcParams) {} void Unk1D(RPCParameters *rpcParams) {} void Unk1E(RPCParameters *rpcParams) {} void Unk3C(RPCParameters *rpcParams) {} -void Unk20(RPCParameters *rpcParams) {} void UnkA6(RPCParameters *rpcParams) {} void UnkA3(RPCParameters *rpcParams) {} void UnkA4(RPCParameters *rpcParams) {} void UnkA5(RPCParameters *rpcParams) {} +void WorldPlayerAdd(RPCParameters *rpcParams) {} void DamageVehicle(RPCParameters *rpcParams) {} void Unk18(RPCParameters *rpcParams) {} void EnterVehicle(RPCParameters *rpcParams) {} @@ -76,11 +76,11 @@ void RegisterRPCs(RakClientInterface * pRakClient) REGISTER_STATIC_RPC(pRakClient,Unk1D); REGISTER_STATIC_RPC(pRakClient,Unk1E); REGISTER_STATIC_RPC(pRakClient,Unk3C); - REGISTER_STATIC_RPC(pRakClient,Unk20); REGISTER_STATIC_RPC(pRakClient,UnkA6); REGISTER_STATIC_RPC(pRakClient,UnkA3); REGISTER_STATIC_RPC(pRakClient,UnkA4); REGISTER_STATIC_RPC(pRakClient,UnkA5); + REGISTER_STATIC_RPC(pRakClient,WorldPlayerAdd); REGISTER_STATIC_RPC(pRakClient,DamageVehicle); REGISTER_STATIC_RPC(pRakClient,Unk18); REGISTER_STATIC_RPC(pRakClient,EnterVehicle); @@ -106,11 +106,11 @@ void RegisterRPCs(RakClientInterface * pRakClient) void UnRegisterRPCs(RakClientInterface * pRakClient) { UNREGISTER_STATIC_RPC(pRakClient,Unk3C); - UNREGISTER_STATIC_RPC(pRakClient,Unk20); UNREGISTER_STATIC_RPC(pRakClient,UnkA6); UNREGISTER_STATIC_RPC(pRakClient,UnkA3); UNREGISTER_STATIC_RPC(pRakClient,UnkA4); UNREGISTER_STATIC_RPC(pRakClient,UnkA5); + UNREGISTER_STATIC_RPC(pRakClient,WorldPlayerAdd); UNREGISTER_STATIC_RPC(pRakClient,Unk18); UNREGISTER_STATIC_RPC(pRakClient,RequestClass); UNREGISTER_STATIC_RPC(pRakClient,RequestSpawn);