From ed7889a021a5aaa82452276e7f1e086ab8a046dc Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Sun, 27 Oct 2024 22:10:24 +0800 Subject: [PATCH] [bot] Fix compilation errors --- bot/net/netgame.cpp | 13 ++++++------ bot/net/netrpc.cpp | 30 +++++++++++++-------------- bot/net/playerpool.h | 3 ++- bot/net/scriptrpc.cpp | 48 +++++++++++++++++++++---------------------- bot/scrcustom.cpp | 3 +++ server/system.h | 17 +++++++++++++++ 6 files changed, 68 insertions(+), 46 deletions(-) diff --git a/bot/net/netgame.cpp b/bot/net/netgame.cpp index 6e656ed..265bbef 100644 --- a/bot/net/netgame.cpp +++ b/bot/net/netgame.cpp @@ -28,7 +28,7 @@ typedef struct _TRAILER_SYNC_DATA // size: 54 char _gap0[54]; } TRAILER_SYNC_DATA; -char unnamed_2[63]; +INCAR_SYNC_DATA icSync; PASSENGER_SYNC_DATA unnamed_5[MAX_PLAYERS]; BOOL bPlayerSlotState[MAX_PLAYERS]; BYTE byteState; @@ -470,13 +470,13 @@ void CNetGame::ShutdownForGameModeRestart() StopRecordingPlayback(); - memset(unnamed_2,0,sizeof(unnamed_2)); + memset(&ofSync,0,sizeof(ONFOOT_SYNC_DATA)); + memset(&icSync,0,sizeof(INCAR_SYNC_DATA)); memset(unnamed_3,0,sizeof(unnamed_3)); memset(unnamed_4,0,sizeof(unnamed_4)); memset(unnamed_5,0,sizeof(unnamed_5)); - memset(&bVehicleSlotState[0],0,sizeof(BOOL)*MAX_VEHICLES); - memset(&ofSync,0,sizeof(ONFOOT_SYNC_DATA)); memset(&bPlayerSlotState[0],0,sizeof(BOOL)*MAX_PLAYERS); + memset(&bVehicleSlotState[0],0,sizeof(BOOL)*MAX_VEHICLES); memset(&bytePlayerState[0],0,sizeof(BYTE)*MAX_PLAYERS); m_bZoneNames = FALSE; @@ -538,14 +538,15 @@ void CNetGame::Init(PCHAR szHostOrIp, int iPort, m_bZoneNames = FALSE; m_bInstagib = FALSE; - memset(unnamed_2,0,sizeof(unnamed_2)); memset(&ofSync,0,sizeof(ONFOOT_SYNC_DATA)); + memset(&icSync,0,sizeof(INCAR_SYNC_DATA)); memset(unnamed_3,0,sizeof(unnamed_3)); memset(unnamed_4,0,sizeof(unnamed_4)); memset(unnamed_5,0,sizeof(unnamed_5)); - memset(&bVehicleSlotState[0],0,sizeof(BOOL)*MAX_VEHICLES); memset(&bPlayerSlotState[0],0,sizeof(BOOL)*MAX_PLAYERS); + memset(&bVehicleSlotState[0],0,sizeof(BOOL)*MAX_VEHICLES); memset(&bytePlayerState[0],0,sizeof(BYTE)*MAX_PLAYERS); + field_1DE = 0; field_1E2 = 0; field_1F2 = GetTickCount(); diff --git a/bot/net/netrpc.cpp b/bot/net/netrpc.cpp index 7d1c274..ad85d94 100644 --- a/bot/net/netrpc.cpp +++ b/bot/net/netrpc.cpp @@ -459,19 +459,19 @@ void WorldTime(RPCParameters *rpcParams) //---------------------------------------------------- -void Unk5F(RPCParameters *rpcParams) +void Pickup(RPCParameters *rpcParams) { } //---------------------------------------------------- -void Unk3F(RPCParameters *rpcParams) +void DestroyPickup(RPCParameters *rpcParams) { } //---------------------------------------------------- -void Unk97(RPCParameters *rpcParams) +void DestroyWeaponPickup(RPCParameters *rpcParams) { } @@ -489,13 +489,13 @@ void Weather(RPCParameters *rpcParams) //---------------------------------------------------- -void Unk1D(RPCParameters *rpcParams) +void SetTimeEx(RPCParameters *rpcParams) { } //---------------------------------------------------- -void Unk1E(RPCParameters *rpcParams) +void ToggleClock(RPCParameters *rpcParams) { } @@ -515,13 +515,13 @@ void RegisterRPCs(RakClientInterface * pRakClient) REGISTER_STATIC_RPC(pRakClient,ConnectionRejected); REGISTER_STATIC_RPC(pRakClient,ClientMessage); REGISTER_STATIC_RPC(pRakClient,WorldTime); - REGISTER_STATIC_RPC(pRakClient,Unk5F); - REGISTER_STATIC_RPC(pRakClient,Unk3F); - REGISTER_STATIC_RPC(pRakClient,Unk97); + REGISTER_STATIC_RPC(pRakClient,Pickup); + REGISTER_STATIC_RPC(pRakClient,DestroyPickup); + REGISTER_STATIC_RPC(pRakClient,DestroyWeaponPickup); REGISTER_STATIC_RPC(pRakClient,ScmEvent); REGISTER_STATIC_RPC(pRakClient,Weather); - REGISTER_STATIC_RPC(pRakClient,Unk1D); - REGISTER_STATIC_RPC(pRakClient,Unk1E); + REGISTER_STATIC_RPC(pRakClient,SetTimeEx); + REGISTER_STATIC_RPC(pRakClient,ToggleClock); REGISTER_STATIC_RPC(pRakClient,ServerJoin); REGISTER_STATIC_RPC(pRakClient,ServerQuit); REGISTER_STATIC_RPC(pRakClient,InitGame); @@ -551,13 +551,13 @@ void UnRegisterRPCs(RakClientInterface * pRakClient) UNREGISTER_STATIC_RPC(pRakClient,ConnectionRejected); UNREGISTER_STATIC_RPC(pRakClient,ClientMessage); UNREGISTER_STATIC_RPC(pRakClient,WorldTime); - UNREGISTER_STATIC_RPC(pRakClient,Unk5F); - UNREGISTER_STATIC_RPC(pRakClient,Unk3F); - UNREGISTER_STATIC_RPC(pRakClient,Unk97); + UNREGISTER_STATIC_RPC(pRakClient,Pickup); + UNREGISTER_STATIC_RPC(pRakClient,DestroyPickup); + UNREGISTER_STATIC_RPC(pRakClient,DestroyWeaponPickup); UNREGISTER_STATIC_RPC(pRakClient,ScmEvent); UNREGISTER_STATIC_RPC(pRakClient,Weather); - UNREGISTER_STATIC_RPC(pRakClient,Unk1D); - UNREGISTER_STATIC_RPC(pRakClient,Unk1E); + UNREGISTER_STATIC_RPC(pRakClient,SetTimeEx); + UNREGISTER_STATIC_RPC(pRakClient,ToggleClock); UNREGISTER_STATIC_RPC(pRakClient,WorldPlayerAdd); UNREGISTER_STATIC_RPC(pRakClient,WorldPlayerDeath); UNREGISTER_STATIC_RPC(pRakClient,WorldPlayerRemove); diff --git a/bot/net/playerpool.h b/bot/net/playerpool.h index 205373a..db47f24 100644 --- a/bot/net/playerpool.h +++ b/bot/net/playerpool.h @@ -19,7 +19,8 @@ public: BOOL Process(); void SetLocalPlayerName(PCHAR szName) { strcpy(m_szLocalPlayerName,szName); }; - PCHAR GetPlayerName(BYTE bytePlayerID) { return m_szPlayerNames[bytePlayerID]; }; + PCHAR GetLocalPlayerName() { return m_szLocalPlayerName; }; + PCHAR GetPlayerName(PLAYERID playerId) { return m_szPlayerNames[playerId]; }; CPlayerPool(); ~CPlayerPool(); diff --git a/bot/net/scriptrpc.cpp b/bot/net/scriptrpc.cpp index 1c21c46..5f74af5 100644 --- a/bot/net/scriptrpc.cpp +++ b/bot/net/scriptrpc.cpp @@ -27,7 +27,7 @@ void ScrUnk45(RPCParameters *rpcParams) //---------------------------------------------------- -void ScrUnk0B(RPCParameters *rpcParams) +void ScrSetPlayerName(RPCParameters *rpcParams) { } @@ -59,7 +59,7 @@ void ScrUnk0D(RPCParameters *rpcParams) //---------------------------------------------------- -void ScrUnk0E(RPCParameters *rpcParams) +void ScrSetPlayerHealth(RPCParameters *rpcParams) { } @@ -142,13 +142,13 @@ void ScrSetInterior(RPCParameters *rpcParams) //---------------------------------------------------- -void ScrUnk9D(RPCParameters *rpcParams) +void ScrSetCameraPos(RPCParameters *rpcParams) { } //---------------------------------------------------- -void ScrUnk9E(RPCParameters *rpcParams) +void ScrSetCameraLookAt(RPCParameters *rpcParams) { } @@ -178,7 +178,7 @@ void ScrUnk41(RPCParameters *rpcParams) //---------------------------------------------------- -void ScrUnkA2(RPCParameters *rpcParams) +void ScrSetCameraBehindPlayer(RPCParameters *rpcParams) { } @@ -222,13 +222,13 @@ void ScrSetPlayerFacingAngle(RPCParameters *rpcParams) //---------------------------------------------------- -void ScrUnk14(RPCParameters *rpcParams) +void ScrResetMoney(RPCParameters *rpcParams) { } //---------------------------------------------------- -void ScrUnk15(RPCParameters *rpcParams) +void ScrResetPlayerWeapons(RPCParameters *rpcParams) { } @@ -396,7 +396,7 @@ void ScrUnk39(RPCParameters *rpcParams) //---------------------------------------------------- -void ScrUnk4A(RPCParameters *rpcParams) +void ScrForceSpawnSelection(RPCParameters *rpcParams) { } @@ -491,28 +491,28 @@ void RegisterScriptRPCs(RakClientInterface* pRakClient) REGISTER_STATIC_RPC(pRakClient, ScrSetSpawnInfo); REGISTER_STATIC_RPC(pRakClient, ScrUnk45); REGISTER_STATIC_RPC(pRakClient, ScrUnk99); - REGISTER_STATIC_RPC(pRakClient, ScrUnk0B); + REGISTER_STATIC_RPC(pRakClient, ScrSetPlayerName); REGISTER_STATIC_RPC(pRakClient, ScrSetPlayerPos); REGISTER_STATIC_RPC(pRakClient, ScrUnk0D); - REGISTER_STATIC_RPC(pRakClient, ScrUnk0E); + REGISTER_STATIC_RPC(pRakClient, ScrSetPlayerHealth); REGISTER_STATIC_RPC(pRakClient, ScrPutPlayerInVehicle); REGISTER_STATIC_RPC(pRakClient, ScrRemovePlayerFromVehicle); REGISTER_STATIC_RPC(pRakClient, ScrSetPlayerColor); REGISTER_STATIC_RPC(pRakClient, ScrDisplayGameText); - REGISTER_STATIC_RPC(pRakClient, ScrUnk9D); - REGISTER_STATIC_RPC(pRakClient, ScrUnk9E); + REGISTER_STATIC_RPC(pRakClient, ScrSetCameraPos); + REGISTER_STATIC_RPC(pRakClient, ScrSetCameraLookAt); REGISTER_STATIC_RPC(pRakClient, ScrSetInterior); REGISTER_STATIC_RPC(pRakClient, ScrUnk9F); REGISTER_STATIC_RPC(pRakClient, ScrUnkA0); REGISTER_STATIC_RPC(pRakClient, ScrUnkA1); - REGISTER_STATIC_RPC(pRakClient, ScrUnkA2); + REGISTER_STATIC_RPC(pRakClient, ScrSetCameraBehindPlayer); REGISTER_STATIC_RPC(pRakClient, ScrUnk0F); REGISTER_STATIC_RPC(pRakClient, ScrUnk10); REGISTER_STATIC_RPC(pRakClient, ScrUnk11); REGISTER_STATIC_RPC(pRakClient, ScrUnk12); REGISTER_STATIC_RPC(pRakClient, ScrSetPlayerFacingAngle); - REGISTER_STATIC_RPC(pRakClient, ScrUnk14); - REGISTER_STATIC_RPC(pRakClient, ScrUnk15); + REGISTER_STATIC_RPC(pRakClient, ScrResetMoney); + REGISTER_STATIC_RPC(pRakClient, ScrResetPlayerWeapons); REGISTER_STATIC_RPC(pRakClient, ScrUnk16); REGISTER_STATIC_RPC(pRakClient, ScrUnk40); REGISTER_STATIC_RPC(pRakClient, ScrUnk41); @@ -541,7 +541,7 @@ void RegisterScriptRPCs(RakClientInterface* pRakClient) REGISTER_STATIC_RPC(pRakClient, ScrUnk7E); REGISTER_STATIC_RPC(pRakClient, ScrUnk7F); REGISTER_STATIC_RPC(pRakClient, ScrUnk39); - REGISTER_STATIC_RPC(pRakClient, ScrUnk4A); + REGISTER_STATIC_RPC(pRakClient, ScrForceSpawnSelection); REGISTER_STATIC_RPC(pRakClient, ScrUnk4B); REGISTER_STATIC_RPC(pRakClient, ScrInitMenu); REGISTER_STATIC_RPC(pRakClient, ScrShowMenu); @@ -564,29 +564,29 @@ void UnRegisterScriptRPCs(RakClientInterface* pRakClient) { UNREGISTER_STATIC_RPC(pRakClient, ScrSetSpawnInfo); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk45); - UNREGISTER_STATIC_RPC(pRakClient, ScrUnk0B); + UNREGISTER_STATIC_RPC(pRakClient, ScrSetPlayerName); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk99); UNREGISTER_STATIC_RPC(pRakClient, ScrSetPlayerPos); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk0D); - UNREGISTER_STATIC_RPC(pRakClient, ScrUnk0E); + UNREGISTER_STATIC_RPC(pRakClient, ScrSetPlayerHealth); UNREGISTER_STATIC_RPC(pRakClient, ScrPutPlayerInVehicle); UNREGISTER_STATIC_RPC(pRakClient, ScrRemovePlayerFromVehicle); UNREGISTER_STATIC_RPC(pRakClient, ScrSetPlayerColor); UNREGISTER_STATIC_RPC(pRakClient, ScrDisplayGameText); - UNREGISTER_STATIC_RPC(pRakClient, ScrUnk9D); - UNREGISTER_STATIC_RPC(pRakClient, ScrUnk9E); + UNREGISTER_STATIC_RPC(pRakClient, ScrSetCameraPos); + UNREGISTER_STATIC_RPC(pRakClient, ScrSetCameraLookAt); UNREGISTER_STATIC_RPC(pRakClient, ScrSetInterior); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk9F); UNREGISTER_STATIC_RPC(pRakClient, ScrUnkA0); UNREGISTER_STATIC_RPC(pRakClient, ScrUnkA1); - UNREGISTER_STATIC_RPC(pRakClient, ScrUnkA2); + UNREGISTER_STATIC_RPC(pRakClient, ScrSetCameraBehindPlayer); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk0F); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk10); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk11); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk12); UNREGISTER_STATIC_RPC(pRakClient, ScrSetPlayerFacingAngle); - UNREGISTER_STATIC_RPC(pRakClient, ScrUnk14); - UNREGISTER_STATIC_RPC(pRakClient, ScrUnk15); + UNREGISTER_STATIC_RPC(pRakClient, ScrResetMoney); + UNREGISTER_STATIC_RPC(pRakClient, ScrResetPlayerWeapons); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk16); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk40); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk41); @@ -614,7 +614,7 @@ void UnRegisterScriptRPCs(RakClientInterface* pRakClient) UNREGISTER_STATIC_RPC(pRakClient, ScrUnk7E); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk7F); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk39); - UNREGISTER_STATIC_RPC(pRakClient, ScrUnk4A); + UNREGISTER_STATIC_RPC(pRakClient, ScrForceSpawnSelection); UNREGISTER_STATIC_RPC(pRakClient, ScrUnk4B); UNREGISTER_STATIC_RPC(pRakClient, ScrInitMenu); UNREGISTER_STATIC_RPC(pRakClient, ScrShowMenu); diff --git a/bot/scrcustom.cpp b/bot/scrcustom.cpp index fe6adc5..5e46a2d 100644 --- a/bot/scrcustom.cpp +++ b/bot/scrcustom.cpp @@ -3,6 +3,9 @@ #define CHECK_PARAMS(n) { if (params[0] != (n * sizeof(cell))) { logprintf("SCRIPT: Bad parameter count (Count is %d, Should be %d): ", params[0] / sizeof(cell), n); return 0; } } +char* format_amxstring(AMX *amx, cell *params, int parm, int &len); +int set_amxstring(AMX *amx,cell amx_addr,const char *source,int max); + extern CNetGame* pNetGame; //---------------------------------------------------------------------------------- diff --git a/server/system.h b/server/system.h index f43c41f..b30d3fb 100644 --- a/server/system.h +++ b/server/system.h @@ -7,6 +7,23 @@ typedef struct _VECTOR { float X,Y,Z; } VECTOR, *PVECTOR; +#pragma pack(1) +typedef struct _MATRIX4X4 { + VECTOR right; + DWORD flags; + VECTOR up; + float pad_u; + VECTOR at; + float pad_a; + VECTOR pos; + float pad_p; +} MATRIX4X4, *PMATRIX4X4; + +#pragma pack(1) +typedef struct _QUATERNION { + float W,X,Y,Z; +} QUATERNION, *PQUATERNION; + typedef struct _struc_64 { int iModelID;