[saco] Implement/match CActorPed constructor

This commit is contained in:
RD42 2024-10-24 22:24:40 +08:00
parent a99e62029f
commit 94bfbc8947
4 changed files with 65 additions and 0 deletions

36
saco/game/actorped.cpp Normal file
View File

@ -0,0 +1,36 @@
#include "../main.h"
#include "game.h"
#include "util.h"
extern CGame *pGame;
//-----------------------------------------------------------
// This is the constructor for creating new player.
CActorPed::CActorPed(int iSkin, float fX, float fY,float fZ,float fRotation)
{
m_pPed=0;
m_dwGTAId=0;
m_byteImmune=0;
int iCounter=0;
DWORD dwActorID=0;
if(!pGame->IsModelLoaded(iSkin)) {
pGame->RequestModel(iSkin);
pGame->LoadRequestedModels();
while(!pGame->IsModelLoaded(iSkin)) Sleep(1);
}
ScriptCommand(&create_actor,5,iSkin,fX,fY,fZ-1.0f,&dwActorID);
ScriptCommand(&set_actor_z_angle,dwActorID,fRotation);
m_dwGTAId = dwActorID;
m_pPed = GamePool_Ped_GetAt(m_dwGTAId);
m_pEntity = (ENTITY_TYPE *)m_pPed;
ScriptCommand(&set_actor_can_be_decapitated,m_dwGTAId,0);
ScriptCommand(&set_actor_dicision,m_dwGTAId,65542);
}
//-----------------------------------------------------------

19
saco/game/actorped.h Normal file
View File

@ -0,0 +1,19 @@
#pragma once
//-----------------------------------------------------------
class CActorPed : public CEntity
{
public:
// Constructor/Destructor.
CActorPed(int iSkin, float fPosX, float fPosY, float fPosZ, float fRotation = 0.0f);
PED_TYPE *m_pPed;
DWORD m_dwMarkerID;
DWORD m_dwArrow;
BYTE m_byteCreateMarker;
BYTE m_byteImmune;
};
//-----------------------------------------------------------

View File

@ -32,6 +32,8 @@ int ScriptCommand(const SCRIPT_COMMAND* pScriptCommand, ...); // The main script
const SCRIPT_COMMAND request_model = { 0x0247, "i" }; // (CAR_*|BIKE_*|BOAT_*|WEAPON_*|OBJECT_*)
const SCRIPT_COMMAND load_requested_models = { 0x038B, "" }; // -/-
const SCRIPT_COMMAND create_actor = { 0x009A, "iifffv" }; // PEDTYPE_*, #MODEL, x, y, z, var_actor
const SCRIPT_COMMAND fade = { 0x016A, "ii" }; // (time in ms), FADE_*
const SCRIPT_COMMAND set_current_time = { 0x00C0, "ii" }; // Hours, Minutes
@ -109,6 +111,8 @@ const SCRIPT_COMMAND set_panel_row_enable = { 0x08D9, "iii" };
const SCRIPT_COMMAND get_panel_active_row = { 0x08D7, "iv" };
const SCRIPT_COMMAND set_actor_dicision = { 0x60B, "ii" };
const SCRIPT_COMMAND set_player_drunk_visuals = { 0x052c, "ii" }; // player, severity (0-255)
const SCRIPT_COMMAND handling_responsiveness = { 0x03fd, "ii" }; // player, severity (0-255)

View File

@ -129,6 +129,12 @@
<Filter
Name="game"
Filter="">
<File
RelativePath=".\game\actorped.cpp">
</File>
<File
RelativePath=".\game\actorped.h">
</File>
<File
RelativePath=".\game\address.h">
</File>