From 125a453d5328552792c7bf87875c0c5a009af9e2 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Tue, 6 Feb 2024 22:08:24 +0800 Subject: [PATCH] [saco] Implement CVehiclePool ctor --- saco/game/common.h | 5 +++++ saco/main.h | 1 + saco/net/netgame.cpp | 2 ++ saco/net/netgame.h | 3 ++- saco/net/vehiclepool.cpp | 20 ++++++++++++++++++++ saco/net/vehiclepool.h | 29 +++++++++++++++++++++++++++++ saco/saco.vcproj | 6 ++++++ 7 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 saco/net/vehiclepool.cpp create mode 100644 saco/net/vehiclepool.h diff --git a/saco/game/common.h b/saco/game/common.h index 419512e..a018fcc 100644 --- a/saco/game/common.h +++ b/saco/game/common.h @@ -3,8 +3,13 @@ #include +#define MAX_VEHICLES 2000 #define PLAYER_PED_SLOTS 210 +//----------------------------------------------------------- + +typedef unsigned short VEHICLEID; + typedef struct _VECTOR { float X,Y,Z; } VECTOR, *PVECTOR; diff --git a/saco/main.h b/saco/main.h index 3d15bad..84d85da 100644 --- a/saco/main.h +++ b/saco/main.h @@ -30,6 +30,7 @@ typedef struct _GAME_SETTINGS { #include "../raknet/GetTime.h" #include "net/netrpc.h" +#include "net/vehiclepool.h" #include "net/netgame.h" #include "net/scriptrpc.h" diff --git a/saco/net/netgame.cpp b/saco/net/netgame.cpp index 20ae753..3d2409d 100644 --- a/saco/net/netgame.cpp +++ b/saco/net/netgame.cpp @@ -32,6 +32,8 @@ CNetGame::CNetGame(PCHAR szHostOrIp, int iPort, void CNetGame::InitPools() { m_pPools = (NETGAME_POOLS *)calloc(1, sizeof(NETGAME_POOLS)); + + m_pPools->pVehiclePool = new CVehiclePool(); } DWORD CNetGame::GetTime() diff --git a/saco/net/netgame.h b/saco/net/netgame.h index e1a9720..068f416 100644 --- a/saco/net/netgame.h +++ b/saco/net/netgame.h @@ -26,7 +26,8 @@ struct struc_41 }; typedef struct _NETGAME_POOLS { - char _gap0[0x24]; + CVehiclePool *pVehiclePool; + char _gap0[32]; } NETGAME_POOLS; class CNetGame // size: 994 diff --git a/saco/net/vehiclepool.cpp b/saco/net/vehiclepool.cpp new file mode 100644 index 0000000..1a28c23 --- /dev/null +++ b/saco/net/vehiclepool.cpp @@ -0,0 +1,20 @@ + +#include "../main.h" + +//---------------------------------------------------- + +CVehiclePool::CVehiclePool() +{ + // loop through and initialize all vehicle properties to 0 + for(VEHICLEID VehicleID = 0; VehicleID < MAX_VEHICLES; VehicleID++) { + field_3074[VehicleID] = 0; + field_1134[VehicleID] = 0; + field_4FB4[VehicleID] = 0; + field_9DD4[VehicleID] = GetTickCount(); + } + memset(field_FA4, 0, sizeof(field_FA4)); + field_0 = 0; + field_17894 = 1; +} + +//---------------------------------------------------- diff --git a/saco/net/vehiclepool.h b/saco/net/vehiclepool.h new file mode 100644 index 0000000..2022a1f --- /dev/null +++ b/saco/net/vehiclepool.h @@ -0,0 +1,29 @@ + +#pragma once + +//---------------------------------------------------- + +class CVehiclePool +{ +public: + int field_0; + + char _gap4[4000]; + + char field_FA4[400]; + int field_1134[MAX_VEHICLES]; + int field_3074[MAX_VEHICLES]; + int field_4FB4[MAX_VEHICLES]; + + char _gap6EF4[12000]; + + DWORD field_9DD4[MAX_VEHICLES]; + + char _gapBD14[48000]; + + int field_17894; + + CVehiclePool(); +}; + +//---------------------------------------------------- diff --git a/saco/saco.vcproj b/saco/saco.vcproj index 132a435..1331c79 100644 --- a/saco/saco.vcproj +++ b/saco/saco.vcproj @@ -258,6 +258,12 @@ + + + +