[saco] Implement CPlayerPed ctor

This commit is contained in:
RD42 2024-02-15 22:23:36 +08:00
parent 3e6824e686
commit 696ec417f8
6 changed files with 117 additions and 1 deletions

View File

@ -15,7 +15,7 @@ public:
void SetMatrix(MATRIX4X4 Matrix);
char field_4[60];
ENTITY_TYPE *m_pEntity;
int field_44;
DWORD m_dwGTAId;
};
//----------------------------------------------------------

View File

@ -3,6 +3,7 @@
#include "address.h"
#include "common.h"
#include "playerped.h"
#include "audio.h"
#include "camera.h"
#include "scripting.h"

47
saco/game/playerped.cpp Normal file
View File

@ -0,0 +1,47 @@
#include "../main.h"
#include "util.h"
//-----------------------------------------------------------
// Used for instancing the local player.
CPlayerPed::CPlayerPed()
{
m_dwGTAId = 1; // 0x001
m_pPed = GamePool_FindPlayerPed();
m_pEntity = (ENTITY_TYPE *)GamePool_FindPlayerPed();
m_bytePlayerNumber = 0;
SetPlayerPedPtrRecord(m_bytePlayerNumber,(DWORD)m_pPed);
ScriptCommand(&set_actor_weapon_droppable,m_dwGTAId,1);
ScriptCommand(&set_actor_can_be_decapitated,m_dwGTAId,0);
field_2A8 = 1;
field_2AC = 1;
field_2CD = 0;
field_2B9 = 0;
field_2F2 = 0;
field_2D2 = 0;
field_2DE = 0;
field_2E2 = 0;
field_48 = 0;
field_2E6 = 0;
field_2C1 = 0;
field_2C5 = 0;
field_2C9 = 0;
field_2F6 = 0;
field_2F7 = 0;
field_2F8 = 0;
int x=0;
while(x!=10) {
field_4C[x];
field_27C[x] = 0;
memset(&field_74[x], 0, sizeof(struc_97));
x++;
}
field_2F9 = 0;
}
//-----------------------------------------------------------

57
saco/game/playerped.h Normal file
View File

@ -0,0 +1,57 @@
#pragma once
#include "entity.h"
struct struc_97
{
char _gap0[52];
};
//-----------------------------------------------------------
class CPlayerPed : public CEntity
{
public:
CPlayerPed();
int field_48;
int field_4C[10];
struc_97 field_74[10];
int field_27C[10];
PED_TYPE *m_pPed;
int field_2A8;
int field_2AC;
BYTE m_bytePlayerNumber;
char _gap2B1[8];
int field_2B9;
char _gap2BD[4];
int field_2C1;
int field_2C5;
int field_2C9;
int field_2CD;
char _gap2D1;
int field_2D2;
char _gap2D6[8];
int field_2DE;
int field_2E2;
int field_2E6;
char _gap2EA[8];
int field_2F2;
char field_2F6;
char field_2F7;
char field_2F8;
int field_2F9;
};
//-----------------------------------------------------------

View File

@ -23,6 +23,11 @@ const SCRIPT_COMMAND set_camera_behind_player = { 0x0373, "" }; // -/-
const SCRIPT_COMMAND point_camera = { 0x0160, "fffi" }; // x, y, z, type
const SCRIPT_COMMAND restore_camera_jumpcut = { 0x02EB, "" }; // -/-
const SCRIPT_COMMAND set_camera_position = { 0x015F, "ffffff" }; // x, y, z, vx, vy, vz
const SCRIPT_COMMAND set_actor_can_be_decapitated = { 0x0446, "ii" };
const SCRIPT_COMMAND set_actor_weapon_droppable = { 0x087e, "ii" };
const SCRIPT_COMMAND restore_camera_to_user_defined = { 0x925, "" };
const SCRIPT_COMMAND set_camera_position_to = { 0x936, "ffffffii" };
const SCRIPT_COMMAND point_camera_transverse_to = { 0x920, "ffffffii" };

View File

@ -175,6 +175,12 @@
<File
RelativePath=".\game\patches.cpp">
</File>
<File
RelativePath=".\game\playerped.cpp">
</File>
<File
RelativePath=".\game\playerped.h">
</File>
<File
RelativePath=".\game\scripting.cpp">
</File>