[saco] Implement CLocalPlayer ctor

* Updates CGame ctor
* Implements `CGame::FindPlayerPed()`
* Implements `CLocalPlayer::ResetAllSyncAttributes()`
* Updates CPlayerPool ctor
This commit is contained in:
RD42 2024-02-15 22:41:04 +08:00
parent 696ec417f8
commit 3b45f9932c
8 changed files with 194 additions and 6 deletions

View File

@ -26,7 +26,7 @@ CGame::CGame()
// TODO: CGame::CGame()
m_pGameAudio = new CAudio();
m_pGameCamera = new CCamera();
field_8 = 0;
m_pGamePlayer = NULL;
field_4D = 0;
field_29 = 0;
field_31 = 0;

View File

@ -13,9 +13,10 @@
class CGame // size: 322
{
private:
CAudio *m_pGameAudio;
CCamera *m_pGameCamera;
int field_8;
CAudio *m_pGameAudio;
CCamera *m_pGameCamera;
CPlayerPed *m_pGamePlayer;
char gapC[29];
int field_29;
char gap2D[4];
@ -46,6 +47,10 @@ public:
void StartGame();
void InitGame();
CPlayerPed *FindPlayerPed() {
if(m_pGamePlayer==NULL) m_pGamePlayer = new CPlayerPed();
return m_pGamePlayer;
};
DWORD GetWeaponInfo(int iWeapon, int iUnk);

View File

@ -29,6 +29,7 @@ typedef struct _GAME_SETTINGS {
#include "../raknet/SAMPRPC.h"
#include "../raknet/GetTime.h"
#include "net/localplayer.h"
#include "net/netrpc.h"
#include "net/actorpool.h"
#include "net/playerpool.h"

79
saco/net/localplayer.cpp Normal file
View File

@ -0,0 +1,79 @@
#include "../main.h"
extern CGame *pGame;
//----------------------------------------------------------
CLocalPlayer::CLocalPlayer()
{
field_147 = GetTickCount();
field_137 = GetTickCount();
field_13B = GetTickCount();
field_1D0 = 0;
field_2E2 = 0;
field_2D6 = GetTickCount();
field_2F6 = 0;
m_pPlayerPed = pGame->FindPlayerPed();
field_F0 = 0;
field_F4 = 0;
field_10D = 0;
field_30A = 0;
field_10F = GetTickCount();
field_113 = GetTickCount();
field_13F = GetTickCount();
field_117 = field_10F;
field_11B = field_10F;
field_108 = 0;
field_30F = 0;
field_310 = -1;
field_306 = 0;
ResetAllSyncAttributes();
int x=0;
while(x!=13) {
field_18A[x] = 0;
field_197[x] = 0;
x++;
}
field_10C = -1;
}
//----------------------------------------------------------
void CLocalPlayer::ResetAllSyncAttributes()
{
field_17D = 0;
field_2FA = 0;
field_302 = 0;
field_2FE = 0;
field_1CF = 0;
field_FA = -1;
field_1D0 = 0;
field_318 = -1;
field_11F = -1;
field_121 = -1;
field_123 = -1;
memset(field_12B, 0, sizeof(field_12B));
memset(field_3F, 0, sizeof(field_3F));
memset(field_5E, 0, sizeof(field_5E));
field_92 = 0;
memset(field_94, 0, sizeof(field_94));
memset(field_0, 0, sizeof(field_0));
memset(field_3C, 0, sizeof(field_3C));
memset(field_D8, 0, sizeof(field_D8));
field_FC = 0;
field_100 = 0;
field_185 = -1;
field_187 = -1;
field_181 = GetTickCount();
field_189 = 0;
field_2DA = 0;
field_2DE = 0;
field_127 = GetTickCount();
}
//----------------------------------------------------------

97
saco/net/localplayer.h Normal file
View File

@ -0,0 +1,97 @@
#pragma once
//----------------------------------------------------------
class CLocalPlayer
{
public:
char field_0[60];
char field_3C[3];
char field_3F[31];
char field_5E[52];
short field_92;
char field_94[68];
char field_D8[24];
int field_F0;
int field_F4;
char _gapF8[2];
short field_FA;
int field_FC;
int field_100;
CPlayerPed *m_pPlayerPed;
int field_108;
char field_10C;
short field_10D;
DWORD field_10F;
DWORD field_113;
DWORD field_117;
DWORD field_11B;
short field_11F;
short field_121;
short field_123;
char _gap125[2];
DWORD field_127;
char field_12B[12];
DWORD field_137;
DWORD field_13B;
DWORD field_13F;
char _gap143[4];
DWORD field_147;
char _gap14B[50];
int field_17D;
DWORD field_181;
short field_185;
short field_187;
char field_189;
char field_18A[13];
int field_197[13];
char _gap1CB[4];
char field_1CF;
int field_1D0;
char _gap1D4[258];
DWORD field_2D6;
int field_2DA;
int field_2DE;
int field_2E2;
char _gap2E6[16];
int field_2F6;
int field_2FA;
int field_2FE;
int field_302;
int field_306;
int field_30A;
char _gap30E;
char field_30F;
int field_310;
char _gap314[4];
short field_318;
char _gap31A[10];
CLocalPlayer();
void ResetAllSyncAttributes();
};
//----------------------------------------------------------

View File

@ -10,7 +10,7 @@ CPlayerPool::CPlayerPool()
field_1F8A[playerId] = 0;
field_2A[playerId] = 0;
}
//field_26 = new sub_10004C50(); // TODO: sub_10004C50()
m_pLocalPlayer = new CLocalPlayer();
field_0 = 0;
field_22 = 0;
field_4 = 0;

View File

@ -12,7 +12,7 @@ private:
short field_4;
std::string field_6;
int field_22;
int field_26;
CLocalPlayer *m_pLocalPlayer;
int field_2A[MAX_PLAYERS];
char _gapFDA[4016];

View File

@ -267,6 +267,12 @@
<File
RelativePath=".\net\labelpool.h">
</File>
<File
RelativePath=".\net\localplayer.cpp">
</File>
<File
RelativePath=".\net\localplayer.h">
</File>
<File
RelativePath=".\net\menupool.cpp">
</File>