From 94bfbc8947ca6523c62469ca4f10b3c6102cce58 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Thu, 24 Oct 2024 22:24:40 +0800 Subject: [PATCH] [saco] Implement/match CActorPed constructor --- saco/game/actorped.cpp | 36 ++++++++++++++++++++++++++++++++++++ saco/game/actorped.h | 19 +++++++++++++++++++ saco/game/scripting.h | 4 ++++ saco/saco.vcproj | 6 ++++++ 4 files changed, 65 insertions(+) create mode 100644 saco/game/actorped.cpp create mode 100644 saco/game/actorped.h diff --git a/saco/game/actorped.cpp b/saco/game/actorped.cpp new file mode 100644 index 0000000..877ba33 --- /dev/null +++ b/saco/game/actorped.cpp @@ -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); +} + +//----------------------------------------------------------- + diff --git a/saco/game/actorped.h b/saco/game/actorped.h new file mode 100644 index 0000000..b24c0b2 --- /dev/null +++ b/saco/game/actorped.h @@ -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; +}; + +//----------------------------------------------------------- diff --git a/saco/game/scripting.h b/saco/game/scripting.h index 92abc06..dfc4166 100644 --- a/saco/game/scripting.h +++ b/saco/game/scripting.h @@ -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) diff --git a/saco/saco.vcproj b/saco/saco.vcproj index 4977ea3..cd9c9a1 100644 --- a/saco/saco.vcproj +++ b/saco/saco.vcproj @@ -129,6 +129,12 @@ + + + +