From fc72ff24d0ca7c8dd011977930b90f7f4afed51f Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 20 Dec 2020 17:07:58 +0300 Subject: implemented collectives in script --- src/control/Script.h | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) (limited to 'src/control/Script.h') diff --git a/src/control/Script.h b/src/control/Script.h index 7fc18727..91eef6d2 100644 --- a/src/control/Script.h +++ b/src/control/Script.h @@ -10,6 +10,7 @@ class CVehicle; class CPed; class CObject; class CPlayerInfo; +enum eObjective; class CRunningScript; @@ -38,6 +39,10 @@ void FlushLog(); #define KEY_LENGTH_IN_SCRIPT 8 +#if GTA_VERSION <= GTA_PS2_160 +#define GTA_SCRIPT_COLLECTIVE +#endif + struct intro_script_rectangle { bool m_bIsUsed; @@ -213,8 +218,8 @@ enum { struct tCollectiveData { - int32 index; - uint32 unk_data; + int32 colIndex; + int32 pedIndex; }; enum { @@ -286,7 +291,7 @@ class CTheScripts static bool StoreVehicleWasRandom; static CRunningScript *pIdleScripts; static CRunningScript *pActiveScripts; - static uint32 NextFreeCollectiveIndex; + static int32 NextFreeCollectiveIndex; static int32 LastRandomPedId; static uint16 NumberOfUsedObjects; static bool bAlreadyRunningAMissionScript; @@ -393,6 +398,25 @@ private: static int32 GetNewUniqueScriptSphereIndex(int32 index); static void RemoveScriptSphere(int32 index); +#ifdef GTA_SCRIPT_COLLECTIVE + static void AdvanceCollectiveIndex() + { + if (NextFreeCollectiveIndex == INT32_MAX) + NextFreeCollectiveIndex = 0; + else + NextFreeCollectiveIndex++; + } + + static int AddPedsInVehicleToCollective(int); + static int AddPedsInAreaToCollective(float, float, float, float); + static int FindFreeSlotInCollectiveArray(); + static void SetObjectiveForAllPedsInCollective(int, eObjective, int16, int16); + static void SetObjectiveForAllPedsInCollective(int, eObjective, CVector, float); + static void SetObjectiveForAllPedsInCollective(int, eObjective, CVector); + static void SetObjectiveForAllPedsInCollective(int, eObjective, void*); + static void SetObjectiveForAllPedsInCollective(int, eObjective); +#endif + friend class CRunningScript; friend class CHud; friend void CMissionCleanup::Process(); @@ -511,6 +535,14 @@ private: void CharInAreaCheckCommand(int32, uint32*); void CarInAreaCheckCommand(int32, uint32*); +#ifdef GTA_SCRIPT_COLLECTIVE + void LocateCollectiveCommand(int32, uint32*); + void LocateCollectiveCharCommand(int32, uint32*); + void LocateCollectiveCarCommand(int32, uint32*); + void LocateCollectivePlayerCommand(int32, uint32*); + void CollectiveInAreaCheckCommand(int32, uint32*); +#endif + #ifdef MISSION_REPLAY bool CanAllowMissionReplay(); #endif -- cgit v1.2.3 From dcb28bfd53bf3512ee59c1124c8ac57e619193cb Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 20 Dec 2020 17:12:34 +0300 Subject: fix --- src/control/Script.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/control/Script.h') diff --git a/src/control/Script.h b/src/control/Script.h index 91eef6d2..1c4663ce 100644 --- a/src/control/Script.h +++ b/src/control/Script.h @@ -1,5 +1,6 @@ #pragma once #include "common.h" +#include "Ped.h" #include "PedType.h" #include "Text.h" #include "Sprite2d.h" @@ -10,7 +11,6 @@ class CVehicle; class CPed; class CObject; class CPlayerInfo; -enum eObjective; class CRunningScript; -- cgit v1.2.3 From 2f05c64470a2b04439a07646662ac6afb57901f5 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Fri, 1 Jan 2021 13:35:23 +0300 Subject: actual struct name --- src/control/Script.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/control/Script.h') diff --git a/src/control/Script.h b/src/control/Script.h index 1c4663ce..588c1f41 100644 --- a/src/control/Script.h +++ b/src/control/Script.h @@ -134,7 +134,7 @@ enum { CLEANUP_OBJECT }; -struct CMissionCleanupEntity +struct cleanup_entity_struct { uint8 type; int32 id; @@ -148,14 +148,14 @@ enum { class CMissionCleanup { - CMissionCleanupEntity m_sEntities[MAX_CLEANUP]; + cleanup_entity_struct m_sEntities[MAX_CLEANUP]; uint8 m_nCount; public: CMissionCleanup(); void Init(); - CMissionCleanupEntity* FindFree(); + cleanup_entity_struct* FindFree(); void AddEntityToList(int32, uint8); void RemoveEntityFromList(int32, uint8); void Process(); -- cgit v1.2.3