summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2021-01-01 12:55:00 +0100
committerNikolay Korolev <nickvnuk@gmail.com>2021-01-01 12:55:00 +0100
commitb4b9f9601b6c578668e1535fd44bcc3f31491090 (patch)
tree06e4534e9d918aacbd5611dcfedc8956eadbbd8d /src/control
parentMerge branch 'miami' into lcs-dev (diff)
parentMerge remote-tracking branch 'upstream/miami' into miami (diff)
downloadre3-b4b9f9601b6c578668e1535fd44bcc3f31491090.tar
re3-b4b9f9601b6c578668e1535fd44bcc3f31491090.tar.gz
re3-b4b9f9601b6c578668e1535fd44bcc3f31491090.tar.bz2
re3-b4b9f9601b6c578668e1535fd44bcc3f31491090.tar.lz
re3-b4b9f9601b6c578668e1535fd44bcc3f31491090.tar.xz
re3-b4b9f9601b6c578668e1535fd44bcc3f31491090.tar.zst
re3-b4b9f9601b6c578668e1535fd44bcc3f31491090.zip
Diffstat (limited to 'src/control')
-rw-r--r--src/control/Darkel.cpp32
-rw-r--r--src/control/Garages.cpp6
-rw-r--r--src/control/Pickups.cpp4
-rw-r--r--src/control/Replay.cpp15
-rw-r--r--src/control/SceneEdit.cpp36
-rw-r--r--src/control/Script.cpp6
-rw-r--r--src/control/Script.h42
-rw-r--r--src/control/Script3.cpp289
-rw-r--r--src/control/Script4.cpp15
-rw-r--r--src/control/Script5.cpp744
-rw-r--r--src/control/Script6.cpp2
11 files changed, 1114 insertions, 77 deletions
diff --git a/src/control/Darkel.cpp b/src/control/Darkel.cpp
index 722ebbcd..f1400de8 100644
--- a/src/control/Darkel.cpp
+++ b/src/control/Darkel.cpp
@@ -73,13 +73,21 @@ CDarkel::DrawMessages()
{
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
- CFont::SetCentreSize(SCREEN_SCALE_X(610.0f));
+#ifdef FIX_BUGS
+ CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 30));
+#else
+ CFont::SetCentreSize(SCREEN_WIDTH - 30);
+#endif
CFont::SetCentreOn();
CFont::SetPropOn();
uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart;
if (bStandardSoundAndMessages) {
if (timePassedSinceStart >= 3000 && timePassedSinceStart < 11000) {
+#ifdef FIX_BUGS
CFont::SetScale(SCREEN_SCALE_X(1.3f), SCREEN_SCALE_Y(1.3f));
+#else
+ CFont::SetScale(1.3f, 1.3f);
+#endif
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(255, 255, 128, CalcFade(timePassedSinceStart, 3000, 11000)));
CFont::SetFontStyle(FONT_STANDARD);
@@ -89,7 +97,11 @@ CDarkel::DrawMessages()
}
} else {
if (timePassedSinceStart < 8000) {
+#ifdef FIX_BUGS
CFont::SetScale(SCREEN_SCALE_X(1.3f), SCREEN_SCALE_Y(1.3f));
+#else
+ CFont::SetScale(1.3f, 1.3f);
+#endif
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(255, 255, 128, CalcFade(timePassedSinceStart, 0, 8000)));
CFont::SetFontStyle(FONT_STANDARD);
@@ -98,7 +110,11 @@ CDarkel::DrawMessages()
}
}
}
+#ifdef FIX_BUGS
CFont::SetScale(SCREEN_SCALE_X(0.75f), SCREEN_SCALE_Y(1.5f));
+#else
+ CFont::SetScale(0.75f, 1.5f);
+#endif
CFont::SetCentreOff();
CFont::SetRightJustifyOn();
CFont::SetFontStyle(FONT_HEADING);
@@ -127,13 +143,25 @@ CDarkel::DrawMessages()
uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart;
if (CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart < 5000) {
CFont::SetBackgroundOff();
- CFont::SetCentreSize(SCREEN_SCALE_X(620.0f));
+#ifdef FIX_BUGS
+ CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 20));
+#else
+ CFont::SetCentreSize(SCREEN_WIDTH - 20);
+#endif
CFont::SetCentreOn();
+#ifdef FIX_BUGS
CFont::SetScale(SCREEN_SCALE_X(1.5f), SCREEN_SCALE_Y(1.5f));
+#else
+ CFont::SetScale(1.5f, 1.5f);
+#endif
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(128, 255, 128, CalcFade(timePassedSinceStart, 0, 5000)));
CFont::SetFontStyle(FONT_STANDARD);
+#ifdef FIX_BUGS
int y = SCREEN_HEIGHT / 2 + SCREEN_SCALE_Y(25.0f - timePassedSinceStart * 0.01f);
+#else
+ int y = (SCREEN_HEIGHT / 2 + 25) - (timePassedSinceStart * 0.01f);
+#endif
CFont::PrintString(SCREEN_WIDTH / 2, y, TheText.Get("KF_3"));
}
}
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp
index 53cebeea..779041cc 100644
--- a/src/control/Garages.cpp
+++ b/src/control/Garages.cpp
@@ -1395,7 +1395,11 @@ void CGarages::PrintMessages()
CFont::SetPropOn();
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
- CFont::SetCentreSize(SCREEN_SCALE_X(590.0f));
+#ifdef FIX_BUGS
+ CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 50));
+#else
+ CFont::SetCentreSize(SCREEN_WIDTH - 50);
+#endif
CFont::SetCentreOn();
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetColor(CRGBA(27, 89, 130, 255));
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp
index 23b5d9ff..bd0fa989 100644
--- a/src/control/Pickups.cpp
+++ b/src/control/Pickups.cpp
@@ -1345,7 +1345,11 @@ CPickups::RenderPickUpText()
float fScaleX = aMessages[i].m_dist.x / 30.0f;
if (fScaleX > MAX_SCALE) fScaleX = MAX_SCALE;
+#ifdef FIX_BUGS
+ CFont::SetScale(SCREEN_SCALE_X(fScaleX), SCREEN_SCALE_Y(fScaleY));
+#else
CFont::SetScale(fScaleX, fScaleY);
+#endif
CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_WIDTH);
CFont::SetJustifyOff();
diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp
index d3de987e..1c68cad9 100644
--- a/src/control/Replay.cpp
+++ b/src/control/Replay.cpp
@@ -1894,13 +1894,20 @@ void CReplay::Display()
TimeCount = (TimeCount + 1) % UINT16_MAX;
if ((TimeCount & 0x20) == 0)
return;
- CFont::SetPropOn();
- CFont::SetBackgroundOff();
+
CFont::SetScale(SCREEN_SCALE_X(1.5f), SCREEN_SCALE_Y(1.5f));
- CFont::SetAlignment(ALIGN_LEFT);
+ CFont::SetJustifyOff();
+ CFont::SetBackgroundOff();
+#ifdef FIX_BUGS
+ CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-20));
+#else
+ CFont::SetCentreSize(SCREEN_WIDTH-20);
+#endif
+ CFont::SetCentreOff();
+ CFont::SetPropOn();
CFont::SetColor(CRGBA(255, 255, 200, 200));
CFont::SetFontStyle(FONT_STANDARD);
if (Mode == MODE_PLAYBACK)
- CFont::PrintString(SCREEN_SCALE_X(63.5f), SCREEN_SCALE_Y(30.0f), TheText.Get("REPLAY"));
+ CFont::PrintString(SCREEN_WIDTH/15, SCREEN_HEIGHT/10, TheText.Get("REPLAY"));
}
#endif
diff --git a/src/control/SceneEdit.cpp b/src/control/SceneEdit.cpp
index 582f7a12..20f09cb4 100644
--- a/src/control/SceneEdit.cpp
+++ b/src/control/SceneEdit.cpp
@@ -281,24 +281,44 @@ void CSceneEdit::Draw(void)
#endif
sprintf(str, "Action");
AsciiToUnicode(str, wstr);
- CFont::SetColor(CRGBA(0, 0, 0, 0));
+ CFont::SetColor(CRGBA(0, 0, 0, 255));
+#ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(ACTION_MESSAGE_X_RIGHT - SHADOW_OFFSET), SCREEN_SCALE_Y(ACTION_MESSAGE_Y + SHADOW_OFFSET), wstr);
+#else
+ CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-ACTION_MESSAGE_X_RIGHT) + SHADOW_OFFSET, SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-ACTION_MESSAGE_Y) + SHADOW_OFFSET, wstr);
+#endif
CFont::SetColor(CRGBA(193, 164, 120, 255));
+#ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(ACTION_MESSAGE_X_RIGHT), SCREEN_SCALE_Y(ACTION_MESSAGE_Y), wstr);
+#else
+ CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-ACTION_MESSAGE_X_RIGHT), SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-ACTION_MESSAGE_Y), wstr);
+#endif
sprintf(str, "Selected");
AsciiToUnicode(str, wstr);
- CFont::SetColor(CRGBA(0, 0, 0, 0));
+ CFont::SetColor(CRGBA(0, 0, 0, 255));
+#ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(SELECTED_MESSAGE_X_RIGHT - SHADOW_OFFSET), SCREEN_SCALE_Y(SELECTED_MESSAGE_Y + SHADOW_OFFSET), wstr);
+#else
+ CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-SELECTED_MESSAGE_X_RIGHT) + SHADOW_OFFSET, SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-SELECTED_MESSAGE_Y) + SHADOW_OFFSET, wstr);
+#endif
CFont::SetColor(CRGBA(193, 164, 120, 255));
+#ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(SELECTED_MESSAGE_X_RIGHT), SCREEN_SCALE_Y(SELECTED_MESSAGE_Y), wstr);
+#else
+ CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-SELECTED_MESSAGE_X_RIGHT), SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-SELECTED_MESSAGE_Y), wstr);
+#endif
CFont::SetCentreOff();
+#ifdef FIX_BUGS
CFont::SetScale(SCREEN_SCALE_X(0.7f), SCREEN_SCALE_Y(0.7f));
+#else
+ CFont::SetScale(0.7f, 0.7f);
+#endif
#ifdef FIX_BUGS
CFont::SetFontStyle(FONT_STANDARD);
#else
CFont::SetFontStyle(FONT_HEADING);
#endif
- CFont::SetColor(CRGBA(0, 0, 0, 0));
+ CFont::SetColor(CRGBA(0, 0, 0, 255));
for (int i = 0; i < NUM_COMMANDS_TO_DRAW; i++) {
int16 nCommandDrawn = m_nCurrentCommand + i - NUM_COMMANDS_TO_DRAW / 2;
if (nCommandDrawn >= MOVIE_TOTAL_COMMANDS)
@@ -307,13 +327,21 @@ void CSceneEdit::Draw(void)
nCommandDrawn += (MOVIE_TOTAL_COMMANDS - 1);
sprintf(str, "%s", pCommandStrings[nCommandDrawn]);
AsciiToUnicode(str, wstr);
- CFont::SetColor(CRGBA(0, 0, 0, 0));
+ CFont::SetColor(CRGBA(0, 0, 0, 255));
+#ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT - SHADOW_OFFSET), SCREEN_SCALE_Y(COMMAND_NAME_Y + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT), wstr);
+#else
+ CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT) + SHADOW_OFFSET, SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT), wstr);
+#endif
if (nCommandDrawn == m_nCurrentCommand)
CFont::SetColor(CRGBA(156, 91, 40, 255));
else
CFont::SetColor(CRGBA(193, 164, 120, 255));
+#ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT), SCREEN_SCALE_Y(COMMAND_NAME_Y + i * COMMAND_NAME_HEIGHT), wstr);
+#else
+ CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT), SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + i * COMMAND_NAME_HEIGHT), wstr);
+#endif
}
}
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 9d5e347b..c022cfe8 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -72,7 +72,7 @@ int32 CTheScripts::StoreVehicleIndex;
bool CTheScripts::StoreVehicleWasRandom;
CRunningScript *CTheScripts::pIdleScripts;
CRunningScript *CTheScripts::pActiveScripts;
-uint32 CTheScripts::NextFreeCollectiveIndex;
+int32 CTheScripts::NextFreeCollectiveIndex;
int32 CTheScripts::LastRandomPedId;
uint16 CTheScripts::NumberOfUsedObjects;
bool CTheScripts::bAlreadyRunningAMissionScript;
@@ -1673,7 +1673,7 @@ void CMissionCleanup::Init()
}
}
-CMissionCleanupEntity* CMissionCleanup::FindFree()
+cleanup_entity_struct* CMissionCleanup::FindFree()
{
for (int i = 0; i < MAX_CLEANUP; i++){
if (m_sEntities[i].type == CLEANUP_UNUSED)
@@ -1685,7 +1685,7 @@ CMissionCleanupEntity* CMissionCleanup::FindFree()
void CMissionCleanup::AddEntityToList(int32 id, uint8 type)
{
- CMissionCleanupEntity* pNew = FindFree();
+ cleanup_entity_struct* pNew = FindFree();
if (!pNew)
return;
pNew->id = id;
diff --git a/src/control/Script.h b/src/control/Script.h
index 983cf6e5..66c9914e 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"
@@ -40,6 +41,8 @@ void FlushLog();
#define KEY_LENGTH_IN_SCRIPT 8
+//#define GTA_SCRIPT_COLLECTIVE
+
struct intro_script_rectangle
{
bool m_bIsUsed;
@@ -131,7 +134,7 @@ enum {
CLEANUP_OBJECT
};
-struct CMissionCleanupEntity
+struct cleanup_entity_struct
{
uint8 type;
int32 id;
@@ -145,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();
@@ -217,8 +220,8 @@ enum {
struct tCollectiveData
{
- int32 index;
- uint32 unk_data;
+ int32 colIndex;
+ int32 pedIndex;
};
enum {
@@ -289,7 +292,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;
@@ -413,6 +416,25 @@ public:
static void SwitchToMission(int32 mission);
#endif
+#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();
@@ -532,6 +554,14 @@ private:
void LocateObjectCommand(int32, uint32*);
void ObjectInAreaCheckCommand(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
diff --git a/src/control/Script3.cpp b/src/control/Script3.cpp
index 2fe8b41f..a34c89a9 100644
--- a/src/control/Script3.cpp
+++ b/src/control/Script3.cpp
@@ -858,7 +858,12 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_WBState == WBSTATE_PLAYING);
return 0;
}
- //case COMMAND_SET_COLL_OBJ_NO_OBJ:
+#ifdef GTA_SCRIPT_COLLECTIVE
+ case COMMAND_SET_COLL_OBJ_NO_OBJ:
+ CollectParameters(&m_nIp, 1);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_NONE);
+ return 0;
+#endif
default:
script_assert(0);
}
@@ -868,65 +873,314 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
int8 CRunningScript::ProcessCommands600To699(int32 command)
{
switch (command){
- /* Collective commands are not implemented until LCS.
+#ifdef GTA_SCRIPT_COLLECTIVE
case COMMAND_SET_COLL_OBJ_WAIT_ON_FOOT:
+ CollectParameters(&m_nIp, 1);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_WAIT_ON_FOOT);
+ return 0;
case COMMAND_SET_COLL_OBJ_FLEE_ON_FOOT_TILL_SAFE:
+ CollectParameters(&m_nIp, 1);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE);
+ return 0;
case COMMAND_SET_COLL_OBJ_GUARD_SPOT:
+ {
+ CollectParameters(&m_nIp, 4);
+ CVector pos = *(CVector*)&ScriptParams[1];
+ if (pos.z <= MAP_Z_LOW_LIMIT)
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GUARD_AREA, pos);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_GUARD_AREA:
+ {
+ CollectParameters(&m_nIp, 5);
+ float infX = *(float*)&ScriptParams[1];
+ float supX = *(float*)&ScriptParams[3];
+ if (infX > supX) {
+ infX = *(float*)&ScriptParams[3];
+ supX = *(float*)&ScriptParams[1];
+ }
+ float infY = *(float*)&ScriptParams[2];
+ float supY = *(float*)&ScriptParams[4];
+ if (infY > supY) {
+ infY = *(float*)&ScriptParams[4];
+ supY = *(float*)&ScriptParams[2];
+ }
+ CVector pos;
+ pos.x = (infX + supX) / 2;
+ pos.y = (infY + supY) / 2;
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ float radius = Max(pos.x - infX, pos.y - infY);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GUARD_AREA, pos, radius);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_WAIT_IN_CAR:
+ CollectParameters(&m_nIp, 1);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_WAIT_IN_CAR);
+ return 0;
case COMMAND_SET_COLL_OBJ_KILL_CHAR_ON_FOOT:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_KILL_CHAR_ON_FOOT, pPed);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_KILL_PLAYER_ON_FOOT:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed;
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_KILL_CHAR_ON_FOOT, pPed);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_KILL_CHAR_ANY_MEANS:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_KILL_CHAR_ANY_MEANS, pPed);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_KILL_PLAYER_ANY_MEANS:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed;
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_KILL_CHAR_ANY_MEANS, pPed);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_FLEE_CHAR_ON_FOOT_TILL_SAFE:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pPed);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_FLEE_PLAYER_ON_FOOT_TILL_SAFE:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed;
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pPed);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_FLEE_CHAR_ON_FOOT_ALWAYS:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pPed);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_FLEE_PLAYER_ON_FOOT_ALWAYS:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed;
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pPed);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_GOTO_CHAR_ON_FOOT:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GOTO_CHAR_ON_FOOT, pPed);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_GOTO_PLAYER_ON_FOOT:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed;
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GOTO_CHAR_ON_FOOT, pPed);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_LEAVE_CAR:
+ CollectParameters(&m_nIp, 1);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_LEAVE_CAR);
+ return 0;
case COMMAND_SET_COLL_OBJ_ENTER_CAR_AS_PASSENGER:
+ {
+ CollectParameters(&m_nIp, 2);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_ENTER_CAR_AS_PASSENGER, pVehicle);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_ENTER_CAR_AS_DRIVER:
+ {
+ CollectParameters(&m_nIp, 2);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicle);
+ return 0;
+ }
+ /*
case COMMAND_SET_COLL_OBJ_FOLLOW_CAR_IN_CAR:
case COMMAND_SET_COLL_OBJ_FIRE_AT_OBJECT_FROM_VEHICLE:
case COMMAND_SET_COLL_OBJ_DESTROY_OBJECT:
+ */
case COMMAND_SET_COLL_OBJ_DESTROY_CAR:
+ {
+ CollectParameters(&m_nIp, 2);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_DESTROY_CAR, pVehicle);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_GOTO_AREA_ON_FOOT:
+ {
+ CollectParameters(&m_nIp, 5);
+ float infX = *(float*)&ScriptParams[1];
+ float supX = *(float*)&ScriptParams[3];
+ if (infX > supX) {
+ infX = *(float*)&ScriptParams[3];
+ supX = *(float*)&ScriptParams[1];
+ }
+ float infY = *(float*)&ScriptParams[2];
+ float supY = *(float*)&ScriptParams[4];
+ if (infY > supY) {
+ infY = *(float*)&ScriptParams[4];
+ supY = *(float*)&ScriptParams[2];
+ }
+ CVector pos;
+ pos.x = (infX + supX) / 2;
+ pos.y = (infY + supY) / 2;
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ float radius = Max(pos.x - infX, pos.y - infY);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GOTO_AREA_ON_FOOT, pos, radius);
+ return 0;
+ }
+ /*
case COMMAND_SET_COLL_OBJ_GOTO_AREA_IN_CAR:
case COMMAND_SET_COLL_OBJ_FOLLOW_CAR_ON_FOOT_WITH_OFFSET:
case COMMAND_SET_COLL_OBJ_GUARD_ATTACK:
+ */
case COMMAND_SET_COLL_OBJ_FOLLOW_ROUTE:
+ CollectParameters(&m_nIp, 3);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FOLLOW_ROUTE, ScriptParams[1], ScriptParams[2]);
+ return 0;
case COMMAND_SET_COLL_OBJ_GOTO_COORD_ON_FOOT:
- case COMMAND_SET_COLL_OBJ_GOTO_COORD_IN_CAR:
+ {
+ CollectParameters(&m_nIp, 3);
+ CVector pos(*(float*)&ScriptParams[1], *(float*)&ScriptParams[2], CWorld::FindGroundZForCoord(*(float*)&ScriptParams[1], *(float*)&ScriptParams[2]));
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GOTO_AREA_ON_FOOT, pos);
+ return 0;
+ }
+ //case COMMAND_SET_COLL_OBJ_GOTO_COORD_IN_CAR:
case COMMAND_SET_COLL_OBJ_RUN_TO_AREA:
+ {
+ CollectParameters(&m_nIp, 5);
+ float infX = *(float*)&ScriptParams[1];
+ float supX = *(float*)&ScriptParams[3];
+ if (infX > supX) {
+ infX = *(float*)&ScriptParams[3];
+ supX = *(float*)&ScriptParams[1];
+ }
+ float infY = *(float*)&ScriptParams[2];
+ float supY = *(float*)&ScriptParams[4];
+ if (infY > supY) {
+ infY = *(float*)&ScriptParams[4];
+ supY = *(float*)&ScriptParams[2];
+ }
+ CVector pos;
+ pos.x = (infX + supX) / 2;
+ pos.y = (infY + supY) / 2;
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ float radius = Max(pos.x - infX, pos.y - infY);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_RUN_TO_AREA, pos, radius);
+ return 0;
+ }
case COMMAND_SET_COLL_OBJ_RUN_TO_COORD:
+ {
+ CollectParameters(&m_nIp, 3);
+ CVector pos(*(float*)&ScriptParams[1], *(float*)&ScriptParams[2], CWorld::FindGroundZForCoord(*(float*)&ScriptParams[1], *(float*)&ScriptParams[2]));
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_RUN_TO_AREA, pos);
+ return 0;
+ }
case COMMAND_ADD_PEDS_IN_AREA_TO_COLL:
+ {
+ CollectParameters(&m_nIp, 3);
+ float X = *(float*)&ScriptParams[0];
+ float Y = *(float*)&ScriptParams[1];
+ float Z = CWorld::FindGroundZForCoord(X, Y);
+ float radius = *(float*)&ScriptParams[2];
+ ScriptParams[0] = CTheScripts::AddPedsInAreaToCollective(X, Y, Z, radius);
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
case COMMAND_ADD_PEDS_IN_VEHICLE_TO_COLL:
+ CollectParameters(&m_nIp, 1);
+ ScriptParams[0] = CTheScripts::AddPedsInVehicleToCollective(ScriptParams[0]);
+ StoreParameters(&m_nIp, 1);
+ return 0;
case COMMAND_CLEAR_COLL:
+ CollectParameters(&m_nIp, 1);
+ for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
+ if (CTheScripts::CollectiveArray[i].colIndex == ScriptParams[0]) {
+ CTheScripts::CollectiveArray[i].colIndex = -1;
+ CTheScripts::CollectiveArray[i].pedIndex = 0;
+ }
+ }
+ return 0;
case COMMAND_IS_COLL_IN_CARS:
+ {
+ CollectParameters(&m_nIp, 1);
+ bool result = true;
+ for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
+ CPed* pPed = CPools::GetPedPool()->GetAt(CTheScripts::CollectiveArray[i].pedIndex);
+ if (!pPed) {
+ CTheScripts::CollectiveArray[i].colIndex = -1;
+ CTheScripts::CollectiveArray[i].pedIndex = 0;
+ }
+ else {
+ result = false;
+ break;
+ }
+ }
+ UpdateCompareFlag(result);
+ return 0;
+ }
case COMMAND_LOCATE_COLL_ANY_MEANS_2D:
case COMMAND_LOCATE_COLL_ON_FOOT_2D:
case COMMAND_LOCATE_COLL_IN_CAR_2D:
case COMMAND_LOCATE_STOPPED_COLL_ANY_MEANS_2D:
case COMMAND_LOCATE_STOPPED_COLL_ON_FOOT_2D:
case COMMAND_LOCATE_STOPPED_COLL_IN_CAR_2D:
+ LocateCollectiveCommand(command, &m_nIp);
+ return 0;
case COMMAND_LOCATE_COLL_ANY_MEANS_CHAR_2D:
case COMMAND_LOCATE_COLL_ON_FOOT_CHAR_2D:
case COMMAND_LOCATE_COLL_IN_CAR_CHAR_2D:
+ LocateCollectiveCharCommand(command, &m_nIp);
+ return 0;
case COMMAND_LOCATE_COLL_ANY_MEANS_CAR_2D:
case COMMAND_LOCATE_COLL_ON_FOOT_CAR_2D:
case COMMAND_LOCATE_COLL_IN_CAR_CAR_2D:
+ LocateCollectiveCarCommand(command, &m_nIp);
+ return 0;
case COMMAND_LOCATE_COLL_ANY_MEANS_PLAYER_2D:
case COMMAND_LOCATE_COLL_ON_FOOT_PLAYER_2D:
case COMMAND_LOCATE_COLL_IN_CAR_PLAYER_2D:
+ LocateCollectivePlayerCommand(command, &m_nIp);
+ return 0;
case COMMAND_IS_COLL_IN_AREA_2D:
case COMMAND_IS_COLL_IN_AREA_ON_FOOT_2D:
case COMMAND_IS_COLL_IN_AREA_IN_CAR_2D:
case COMMAND_IS_COLL_STOPPED_IN_AREA_2D:
case COMMAND_IS_COLL_STOPPED_IN_AREA_ON_FOOT_2D:
case COMMAND_IS_COLL_STOPPED_IN_AREA_IN_CAR_2D:
+ CollectiveInAreaCheckCommand(command, &m_nIp);
+ return 0;
case COMMAND_GET_NUMBER_OF_PEDS_IN_COLL:
- */
+ {
+ CollectParameters(&m_nIp, 1);
+ int total = 0;
+ for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
+ CPed* pPed = CPools::GetPedPool()->GetAt(CTheScripts::CollectiveArray[i].pedIndex);
+ if (!pPed) {
+ CTheScripts::CollectiveArray[i].colIndex = -1;
+ CTheScripts::CollectiveArray[i].pedIndex = 0;
+ }
+ else {
+ total++;
+ }
+ }
+ ScriptParams[0] = total;
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
+#endif
case COMMAND_SET_CHAR_HEED_THREATS:
{
CollectParameters(&m_nIp, 2);
@@ -1064,7 +1318,32 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
return 0;
}
*/
- //case COMMAND_SET_COLL_OBJ_GOTO_AREA_ANY_MEANS:
+#ifdef GTA_SCRIPT_COLLECTIVE
+ case COMMAND_SET_COLL_OBJ_GOTO_AREA_ANY_MEANS:
+ {
+ CollectParameters(&m_nIp, 5);
+ float infX = *(float*)&ScriptParams[1];
+ float supX = *(float*)&ScriptParams[3];
+ if (infX > supX) {
+ infX = *(float*)&ScriptParams[3];
+ supX = *(float*)&ScriptParams[1];
+ }
+ float infY = *(float*)&ScriptParams[2];
+ float supY = *(float*)&ScriptParams[4];
+ if (infY > supY) {
+ infY = *(float*)&ScriptParams[4];
+ supY = *(float*)&ScriptParams[2];
+ }
+ CVector pos;
+ pos.x = (infX + supX) / 2;
+ pos.y = (infY + supY) / 2;
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ float radius = Max(pos.x - infX, pos.y - infY);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GOTO_AREA_ANY_MEANS, pos, radius);
+ return 0;
+ }
+#endif
+ /*
case COMMAND_IS_PLAYER_STOPPED:
{
CollectParameters(&m_nIp, 1);
diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp
index ba481b52..31f50257 100644
--- a/src/control/Script4.cpp
+++ b/src/control/Script4.cpp
@@ -254,8 +254,12 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
pPed->SetObjective(OBJECTIVE_CATCH_TRAIN);
return 0;
}
- */
- //case COMMAND_SET_COLL_OBJ_CATCH_TRAIN:
+#ifdef GTA_SCRIPT_COLLECTIVE
+ case COMMAND_SET_COLL_OBJ_CATCH_TRAIN:
+ CollectParameters(&m_nIp, 1);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_CATCH_TRAIN);
+ return 0;
+#endif
case COMMAND_SET_PLAYER_NEVER_GETS_TIRED:
{
CollectParameters(&m_nIp, 2);
@@ -1148,7 +1152,12 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
CGarages::GivePlayerDetonator();
return 0;
*/
- //case COMMAND_SET_COLL_OBJ_STEAL_ANY_CAR:
+#ifdef GTA_SCRIPT_COLLECTIVE
+ case COMMAND_SET_COLL_OBJ_STEAL_ANY_CAR:
+ CollectParameters(&m_nIp, 1);
+ CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_STEAL_ANY_CAR);
+ return 0;
+#endif
case COMMAND_SET_OBJECT_VELOCITY:
{
CollectParameters(&m_nIp, 4);
diff --git a/src/control/Script5.cpp b/src/control/Script5.cpp
index 5b7b34c5..ab3c5b7f 100644
--- a/src/control/Script5.cpp
+++ b/src/control/Script5.cpp
@@ -1422,6 +1422,488 @@ int16 CRunningScript::GetPadState(uint16 pad, uint16 button)
return 0;
}
+#ifdef GTA_SCRIPT_COLLECTIVE
+void CRunningScript::LocateCollectiveCommand(int32 command, uint32* pIp)
+{
+ bool b3D, result, debug, decided = false;
+ float X, Y, Z, dX, dY, dZ;
+ switch (command) {
+ case COMMAND_LOCATE_COLL_ANY_MEANS_2D:
+ case COMMAND_LOCATE_COLL_ON_FOOT_2D:
+ case COMMAND_LOCATE_COLL_IN_CAR_2D:
+ case COMMAND_LOCATE_STOPPED_COLL_ANY_MEANS_2D:
+ case COMMAND_LOCATE_STOPPED_COLL_ON_FOOT_2D:
+ case COMMAND_LOCATE_STOPPED_COLL_IN_CAR_2D:
+ b3D = false;
+ break;
+ default:
+ b3D = true;
+ break;
+ }
+ CollectParameters(pIp, b3D ? 8 : 6);
+ X = *(float*)&ScriptParams[1];
+ Y = *(float*)&ScriptParams[2];
+ if (b3D) {
+ Z = *(float*)&ScriptParams[3];
+ dX = *(float*)&ScriptParams[4];
+ dY = *(float*)&ScriptParams[5];
+ dZ = *(float*)&ScriptParams[6];
+ debug = ScriptParams[7];
+ }
+ else {
+ dX = *(float*)&ScriptParams[3];
+ dY = *(float*)&ScriptParams[4];
+ debug = ScriptParams[5];
+ }
+ result = true;
+ for (int i = 0; i < MAX_NUM_COLLECTIVES && result; i++) {
+ if (ScriptParams[0] != CTheScripts::CollectiveArray[i].colIndex)
+ continue;
+ CPed* pPed = CPools::GetPedPool()->GetAt(CTheScripts::CollectiveArray[i].pedIndex);
+ if (!pPed) {
+ CTheScripts::CollectiveArray[i].colIndex = -1;
+ CTheScripts::CollectiveArray[i].pedIndex = 0;
+ continue;
+ }
+ CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition();
+ switch (command) {
+ case COMMAND_LOCATE_STOPPED_COLL_ANY_MEANS_2D:
+ case COMMAND_LOCATE_STOPPED_COLL_ON_FOOT_2D:
+ case COMMAND_LOCATE_STOPPED_COLL_IN_CAR_2D:
+ if (!CTheScripts::IsPedStopped(pPed)) {
+ result = false;
+ decided = true;
+ }
+ break;
+ default:
+ break;
+ }
+ if (!decided) {
+ bool in_area;
+ if (b3D) {
+ in_area = X - dX <= pos.x &&
+ X + dX >= pos.x &&
+ Y - dY <= pos.y &&
+ Y + dY >= pos.y &&
+ Z - dZ <= pos.z &&
+ Z + dZ >= pos.z;
+ }
+ else {
+ in_area = X - dX <= pos.x &&
+ X + dX >= pos.x &&
+ Y - dY <= pos.y &&
+ Y + dY >= pos.y;
+ }
+ result = false;
+ if (in_area) {
+ switch (command) {
+ case COMMAND_LOCATE_COLL_ANY_MEANS_2D:
+ case COMMAND_LOCATE_STOPPED_COLL_ANY_MEANS_2D:
+ result = true;
+ break;
+ case COMMAND_LOCATE_COLL_ON_FOOT_2D:
+ case COMMAND_LOCATE_STOPPED_COLL_ON_FOOT_2D:
+ result = !pPed->bInVehicle;
+ break;
+ case COMMAND_LOCATE_COLL_IN_CAR_2D:
+ case COMMAND_LOCATE_STOPPED_COLL_IN_CAR_2D:
+ result = pPed->bInVehicle;
+ break;
+ default:
+ script_assert(false);
+ break;
+ }
+ }
+ }
+ }
+ UpdateCompareFlag(result);
+ if (debug)
+ CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, X - dX, Y - dY, X + dX, Y + dY, b3D ? Z : MAP_Z_LOW_LIMIT);
+ if (CTheScripts::DbgFlag) {
+ if (b3D)
+ CTheScripts::DrawDebugCube(X - dX, Y - dY, Z - dZ, X + dX, Y + dY, Z + dZ);
+ else
+ CTheScripts::DrawDebugSquare(X - dX, Y - dY, X + dX, Y + dY);
+ }
+}
+
+void CRunningScript::LocateCollectiveCharCommand(int32 command, uint32* pIp)
+{
+ bool b3D, result, debug;
+ float X, Y, Z, dX, dY, dZ;
+ switch (command) {
+ case COMMAND_LOCATE_COLL_ANY_MEANS_CHAR_2D:
+ case COMMAND_LOCATE_COLL_ON_FOOT_CHAR_2D:
+ case COMMAND_LOCATE_COLL_IN_CAR_CHAR_2D:
+ b3D = false;
+ break;
+ default:
+ b3D = true;
+ break;
+ }
+ CollectParameters(pIp, b3D ? 6 : 5);
+ CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ script_assert(pTarget);
+ if (pTarget->bInVehicle) {
+ X = pTarget->m_pMyVehicle->GetPosition().x;
+ Y = pTarget->m_pMyVehicle->GetPosition().y;
+ Z = pTarget->m_pMyVehicle->GetPosition().z;
+ }
+ else {
+ X = pTarget->GetPosition().x;
+ Y = pTarget->GetPosition().y;
+ Z = pTarget->GetPosition().z;
+ }
+ dX = *(float*)&ScriptParams[2];
+ dY = *(float*)&ScriptParams[3];
+ if (b3D) {
+ dZ = *(float*)&ScriptParams[4];
+ debug = ScriptParams[5];
+ }
+ else {
+ debug = ScriptParams[4];
+ }
+ result = true;
+ for (int i = 0; i < MAX_NUM_COLLECTIVES && result; i++) {
+ if (ScriptParams[0] != CTheScripts::CollectiveArray[i].colIndex)
+ continue;
+ CPed* pPed = CPools::GetPedPool()->GetAt(CTheScripts::CollectiveArray[i].pedIndex);
+ if (!pPed) {
+ CTheScripts::CollectiveArray[i].colIndex = -1;
+ CTheScripts::CollectiveArray[i].pedIndex = 0;
+ continue;
+ }
+ CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition();
+ bool in_area;
+ if (b3D) {
+ in_area = X - dX <= pos.x &&
+ X + dX >= pos.x &&
+ Y - dY <= pos.y &&
+ Y + dY >= pos.y &&
+ Z - dZ <= pos.z &&
+ Z + dZ >= pos.z;
+ }
+ else {
+ in_area = X - dX <= pos.x &&
+ X + dX >= pos.x &&
+ Y - dY <= pos.y &&
+ Y + dY >= pos.y;
+ }
+ result = false;
+ if (in_area) {
+ switch (command) {
+ case COMMAND_LOCATE_COLL_ANY_MEANS_CHAR_2D:
+ result = true;
+ break;
+ case COMMAND_LOCATE_COLL_ON_FOOT_CHAR_2D:
+ result = !pPed->bInVehicle;
+ break;
+ case COMMAND_LOCATE_COLL_IN_CAR_CHAR_2D:
+ result = pPed->bInVehicle;
+ break;
+ default:
+ script_assert(false);
+ break;
+ }
+ }
+ }
+ UpdateCompareFlag(result);
+ if (debug)
+ CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, X - dX, Y - dY, X + dX, Y + dY, b3D ? Z : MAP_Z_LOW_LIMIT);
+ if (CTheScripts::DbgFlag) {
+ if (b3D)
+ CTheScripts::DrawDebugCube(X - dX, Y - dY, Z - dZ, X + dX, Y + dY, Z + dZ);
+ else
+ CTheScripts::DrawDebugSquare(X - dX, Y - dY, X + dX, Y + dY);
+ }
+}
+
+void CRunningScript::LocateCollectiveCarCommand(int32 command, uint32* pIp)
+{
+ bool b3D, result, debug;
+ float X, Y, Z, dX, dY, dZ;
+ switch (command) {
+ case COMMAND_LOCATE_COLL_ANY_MEANS_CAR_2D:
+ case COMMAND_LOCATE_COLL_ON_FOOT_CAR_2D:
+ case COMMAND_LOCATE_COLL_IN_CAR_CAR_2D:
+ b3D = false;
+ break;
+ default:
+ b3D = true;
+ break;
+ }
+ CollectParameters(pIp, b3D ? 6 : 5);
+ CVehicle* pTarget = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
+ script_assert(pTarget);
+ X = pTarget->GetPosition().x;
+ Y = pTarget->GetPosition().y;
+ Z = pTarget->GetPosition().z;
+ dX = *(float*)&ScriptParams[2];
+ dY = *(float*)&ScriptParams[3];
+ if (b3D) {
+ dZ = *(float*)&ScriptParams[4];
+ debug = ScriptParams[5];
+ }
+ else {
+ debug = ScriptParams[4];
+ }
+ result = true;
+ for (int i = 0; i < MAX_NUM_COLLECTIVES && result; i++) {
+ if (ScriptParams[0] != CTheScripts::CollectiveArray[i].colIndex)
+ continue;
+ CPed* pPed = CPools::GetPedPool()->GetAt(CTheScripts::CollectiveArray[i].pedIndex);
+ if (!pPed) {
+ CTheScripts::CollectiveArray[i].colIndex = -1;
+ CTheScripts::CollectiveArray[i].pedIndex = 0;
+ continue;
+ }
+ CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition();
+ bool in_area;
+ if (b3D) {
+ in_area = X - dX <= pos.x &&
+ X + dX >= pos.x &&
+ Y - dY <= pos.y &&
+ Y + dY >= pos.y &&
+ Z - dZ <= pos.z &&
+ Z + dZ >= pos.z;
+ }
+ else {
+ in_area = X - dX <= pos.x &&
+ X + dX >= pos.x &&
+ Y - dY <= pos.y &&
+ Y + dY >= pos.y;
+ }
+ result = false;
+ if (in_area) {
+ switch (command) {
+ case COMMAND_LOCATE_COLL_ANY_MEANS_CAR_2D:
+ result = true;
+ break;
+ case COMMAND_LOCATE_COLL_ON_FOOT_CAR_2D:
+ result = !pPed->bInVehicle;
+ break;
+ case COMMAND_LOCATE_COLL_IN_CAR_CAR_2D:
+ result = pPed->bInVehicle;
+ break;
+ default:
+ script_assert(false);
+ break;
+ }
+ }
+ }
+ UpdateCompareFlag(result);
+ if (debug)
+ CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, X - dX, Y - dY, X + dX, Y + dY, b3D ? Z : MAP_Z_LOW_LIMIT);
+ if (CTheScripts::DbgFlag) {
+ if (b3D)
+ CTheScripts::DrawDebugCube(X - dX, Y - dY, Z - dZ, X + dX, Y + dY, Z + dZ);
+ else
+ CTheScripts::DrawDebugSquare(X - dX, Y - dY, X + dX, Y + dY);
+ }
+}
+
+void CRunningScript::LocateCollectivePlayerCommand(int32 command, uint32* pIp)
+{
+ bool b3D, result, debug;
+ float X, Y, Z, dX, dY, dZ;
+ switch (command) {
+ case COMMAND_LOCATE_COLL_ANY_MEANS_PLAYER_2D:
+ case COMMAND_LOCATE_COLL_ON_FOOT_PLAYER_2D:
+ case COMMAND_LOCATE_COLL_IN_CAR_PLAYER_2D:
+ b3D = false;
+ break;
+ default:
+ b3D = true;
+ break;
+ }
+ CollectParameters(pIp, b3D ? 6 : 5);
+ CVector pos = CWorld::Players[ScriptParams[1]].GetPos();
+ X = pos.x;
+ Y = pos.y;
+ Z = pos.z;
+ dX = *(float*)&ScriptParams[2];
+ dY = *(float*)&ScriptParams[3];
+ if (b3D) {
+ dZ = *(float*)&ScriptParams[4];
+ debug = ScriptParams[5];
+ }
+ else {
+ debug = ScriptParams[4];
+ }
+ result = true;
+ for (int i = 0; i < MAX_NUM_COLLECTIVES && result; i++) {
+ if (ScriptParams[0] != CTheScripts::CollectiveArray[i].colIndex)
+ continue;
+ CPed* pPed = CPools::GetPedPool()->GetAt(CTheScripts::CollectiveArray[i].pedIndex);
+ if (!pPed) {
+ CTheScripts::CollectiveArray[i].colIndex = -1;
+ CTheScripts::CollectiveArray[i].pedIndex = 0;
+ continue;
+ }
+ CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition();
+ bool in_area;
+ if (b3D) {
+ in_area = X - dX <= pos.x &&
+ X + dX >= pos.x &&
+ Y - dY <= pos.y &&
+ Y + dY >= pos.y &&
+ Z - dZ <= pos.z &&
+ Z + dZ >= pos.z;
+ }
+ else {
+ in_area = X - dX <= pos.x &&
+ X + dX >= pos.x &&
+ Y - dY <= pos.y &&
+ Y + dY >= pos.y;
+ }
+ result = false;
+ if (in_area) {
+ switch (command) {
+ case COMMAND_LOCATE_COLL_ANY_MEANS_PLAYER_2D:
+ result = true;
+ break;
+ case COMMAND_LOCATE_COLL_ON_FOOT_PLAYER_2D:
+ result = !pPed->bInVehicle;
+ break;
+ case COMMAND_LOCATE_COLL_IN_CAR_PLAYER_2D:
+ result = pPed->bInVehicle;
+ break;
+ default:
+ script_assert(false);
+ break;
+ }
+ }
+ }
+ UpdateCompareFlag(result);
+ if (debug)
+ CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, X - dX, Y - dY, X + dX, Y + dY, b3D ? Z : MAP_Z_LOW_LIMIT);
+ if (CTheScripts::DbgFlag) {
+ if (b3D)
+ CTheScripts::DrawDebugCube(X - dX, Y - dY, Z - dZ, X + dX, Y + dY, Z + dZ);
+ else
+ CTheScripts::DrawDebugSquare(X - dX, Y - dY, X + dX, Y + dY);
+ }
+}
+
+void CRunningScript::CollectiveInAreaCheckCommand(int32 command, uint32* pIp)
+{
+ bool b3D, result, debug, decided = false;
+ float infX, infY, infZ, supX, supY, supZ;
+ switch (command) {
+ case COMMAND_IS_COLL_IN_AREA_2D:
+ case COMMAND_IS_COLL_IN_AREA_ON_FOOT_2D:
+ case COMMAND_IS_COLL_IN_AREA_IN_CAR_2D:
+ case COMMAND_IS_COLL_STOPPED_IN_AREA_2D:
+ case COMMAND_IS_COLL_STOPPED_IN_AREA_ON_FOOT_2D:
+ case COMMAND_IS_COLL_STOPPED_IN_AREA_IN_CAR_2D:
+ b3D = false;
+ break;
+ default:
+ b3D = true;
+ break;
+ }
+ CollectParameters(pIp, b3D ? 8 : 6);
+ infX = *(float*)&ScriptParams[1];
+ infY = *(float*)&ScriptParams[2];
+ if (b3D) {
+ infZ = *(float*)&ScriptParams[3];
+ supX = *(float*)&ScriptParams[4];
+ supY = *(float*)&ScriptParams[5];
+ supZ = *(float*)&ScriptParams[6];
+ if (infZ > supZ) {
+ infZ = *(float*)&ScriptParams[6];
+ supZ = *(float*)&ScriptParams[3];
+ }
+ debug = ScriptParams[7];
+ }
+ else {
+ supX = *(float*)&ScriptParams[3];
+ supY = *(float*)&ScriptParams[4];
+ debug = ScriptParams[5];
+ }
+ if (infX > supX) {
+ float tmp = infX;
+ infX = supX;
+ supX = tmp;
+ }
+ if (infY > supY) {
+ float tmp = infY;
+ infY = supY;
+ supY = tmp;
+ }
+ result = true;
+ for (int i = 0; i < MAX_NUM_COLLECTIVES && result; i++) {
+ if (ScriptParams[0] != CTheScripts::CollectiveArray[i].colIndex)
+ continue;
+ CPed* pPed = CPools::GetPedPool()->GetAt(CTheScripts::CollectiveArray[i].pedIndex);
+ if (!pPed) {
+ CTheScripts::CollectiveArray[i].colIndex = -1;
+ CTheScripts::CollectiveArray[i].pedIndex = 0;
+ continue;
+ }
+ CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition();
+ switch (command) {
+ case COMMAND_IS_COLL_STOPPED_IN_AREA_2D:
+ case COMMAND_IS_COLL_STOPPED_IN_AREA_ON_FOOT_2D:
+ case COMMAND_IS_COLL_STOPPED_IN_AREA_IN_CAR_2D:
+ if (!CTheScripts::IsPedStopped(pPed)) {
+ result = false;
+ decided = true;
+ }
+ break;
+ default:
+ break;
+ }
+ if (!decided) {
+ bool in_area;
+ if (b3D) {
+ in_area = infX <= pos.x &&
+ supX >= pos.x &&
+ infY <= pos.y &&
+ supY >= pos.y &&
+ infZ <= pos.z &&
+ supZ >= pos.z;
+ }
+ else {
+ in_area = infX <= pos.x &&
+ supX >= pos.x &&
+ infY <= pos.y &&
+ supY >= pos.y;
+ }
+ result = false;
+ if (in_area) {
+ switch (command) {
+ case COMMAND_IS_COLL_IN_AREA_2D:
+ case COMMAND_IS_COLL_STOPPED_IN_AREA_2D:
+ result = true;
+ break;
+ case COMMAND_IS_COLL_IN_AREA_ON_FOOT_2D:
+ case COMMAND_IS_COLL_STOPPED_IN_AREA_ON_FOOT_2D:
+ result = !pPed->bInVehicle;
+ break;
+ case COMMAND_IS_COLL_IN_AREA_IN_CAR_2D:
+ case COMMAND_IS_COLL_STOPPED_IN_AREA_IN_CAR_2D:
+ result = pPed->bInVehicle;
+ break;
+ default:
+ script_assert(false);
+ break;
+ }
+ }
+ }
+ }
+ UpdateCompareFlag(result);
+ if (debug)
+ CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, infX, infY, supX, supY, b3D ? (infZ + supZ) / 2 : MAP_Z_LOW_LIMIT);
+ if (CTheScripts::DbgFlag) {
+ if (b3D)
+ CTheScripts::DrawDebugCube(infX, infY, infZ, supX, supY, supZ);
+ else
+ CTheScripts::DrawDebugSquare(infX, infY, supX, supY);
+ }
+}
+#endif
+
bool CRunningScript::CheckDamagedWeaponType(int32 actual, int32 type)
{
if (actual == -1)
@@ -1439,54 +1921,54 @@ bool CRunningScript::CheckDamagedWeaponType(int32 actual, int32 type)
return false;
switch (actual) {
- case WEAPONTYPE_UNARMED:
- case WEAPONTYPE_BRASSKNUCKLE:
- case WEAPONTYPE_SCREWDRIVER:
- case WEAPONTYPE_GOLFCLUB:
- case WEAPONTYPE_NIGHTSTICK:
- case WEAPONTYPE_KNIFE:
- case WEAPONTYPE_BASEBALLBAT:
- case WEAPONTYPE_HAMMER:
- case WEAPONTYPE_CLEAVER:
- case WEAPONTYPE_MACHETE:
- case WEAPONTYPE_KATANA:
- case WEAPONTYPE_CHAINSAW:
- case WEAPONTYPE_GRENADE:
- case WEAPONTYPE_DETONATOR_GRENADE:
- case WEAPONTYPE_TEARGAS:
- case WEAPONTYPE_MOLOTOV:
- case WEAPONTYPE_ROCKET:
- case WEAPONTYPE_COLT45:
- case WEAPONTYPE_PYTHON:
- case WEAPONTYPE_SHOTGUN:
- case WEAPONTYPE_SPAS12_SHOTGUN:
- case WEAPONTYPE_STUBBY_SHOTGUN:
- case WEAPONTYPE_TEC9:
- case WEAPONTYPE_UZI:
- case WEAPONTYPE_SILENCED_INGRAM:
- case WEAPONTYPE_MP5:
- case WEAPONTYPE_M4:
- case WEAPONTYPE_RUGER:
- case WEAPONTYPE_SNIPERRIFLE:
- case WEAPONTYPE_LASERSCOPE:
- case WEAPONTYPE_ROCKETLAUNCHER:
- case WEAPONTYPE_FLAMETHROWER:
- case WEAPONTYPE_M60:
- case WEAPONTYPE_MINIGUN:
- case WEAPONTYPE_DETONATOR:
- case WEAPONTYPE_HELICANNON:
- case WEAPONTYPE_CAMERA:
- case WEAPONTYPE_EXPLOSION:
- case WEAPONTYPE_UZI_DRIVEBY:
- return true;
- case WEAPONTYPE_HEALTH:
- case WEAPONTYPE_ARMOUR:
- case WEAPONTYPE_RAMMEDBYCAR:
- case WEAPONTYPE_RUNOVERBYCAR:
- case WEAPONTYPE_DROWNING:
- case WEAPONTYPE_FALL:
- case WEAPONTYPE_UNIDENTIFIED:
- return false;
+ case WEAPONTYPE_UNARMED:
+ case WEAPONTYPE_BRASSKNUCKLE:
+ case WEAPONTYPE_SCREWDRIVER:
+ case WEAPONTYPE_GOLFCLUB:
+ case WEAPONTYPE_NIGHTSTICK:
+ case WEAPONTYPE_KNIFE:
+ case WEAPONTYPE_BASEBALLBAT:
+ case WEAPONTYPE_HAMMER:
+ case WEAPONTYPE_CLEAVER:
+ case WEAPONTYPE_MACHETE:
+ case WEAPONTYPE_KATANA:
+ case WEAPONTYPE_CHAINSAW:
+ case WEAPONTYPE_GRENADE:
+ case WEAPONTYPE_DETONATOR_GRENADE:
+ case WEAPONTYPE_TEARGAS:
+ case WEAPONTYPE_MOLOTOV:
+ case WEAPONTYPE_ROCKET:
+ case WEAPONTYPE_COLT45:
+ case WEAPONTYPE_PYTHON:
+ case WEAPONTYPE_SHOTGUN:
+ case WEAPONTYPE_SPAS12_SHOTGUN:
+ case WEAPONTYPE_STUBBY_SHOTGUN:
+ case WEAPONTYPE_TEC9:
+ case WEAPONTYPE_UZI:
+ case WEAPONTYPE_SILENCED_INGRAM:
+ case WEAPONTYPE_MP5:
+ case WEAPONTYPE_M4:
+ case WEAPONTYPE_RUGER:
+ case WEAPONTYPE_SNIPERRIFLE:
+ case WEAPONTYPE_LASERSCOPE:
+ case WEAPONTYPE_ROCKETLAUNCHER:
+ case WEAPONTYPE_FLAMETHROWER:
+ case WEAPONTYPE_M60:
+ case WEAPONTYPE_MINIGUN:
+ case WEAPONTYPE_DETONATOR:
+ case WEAPONTYPE_HELICANNON:
+ case WEAPONTYPE_CAMERA:
+ case WEAPONTYPE_EXPLOSION:
+ case WEAPONTYPE_UZI_DRIVEBY:
+ return true;
+ case WEAPONTYPE_HEALTH:
+ case WEAPONTYPE_ARMOUR:
+ case WEAPONTYPE_RAMMEDBYCAR:
+ case WEAPONTYPE_RUNOVERBYCAR:
+ case WEAPONTYPE_DROWNING:
+ case WEAPONTYPE_FALL:
+ case WEAPONTYPE_UNIDENTIFIED:
+ return false;
}
return false;
@@ -1892,6 +2374,172 @@ void CTheScripts::HighlightImportantAngledArea(uint32 id, float x1, float y1, fl
CShadows::RenderIndicatorShadow(id, 2, gpGoalTex, &center, supX - center.x, 0.0f, 0.0f, center.y - supY, 0);
}
+#ifdef GTA_SCRIPT_COLLECTIVE
+int CTheScripts::AddPedsInVehicleToCollective(int index)
+{
+ int colIndex = NextFreeCollectiveIndex;
+ AdvanceCollectiveIndex();
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(index);
+ script_assert(pVehicle);
+ CPed* pDriver = pVehicle->pDriver;
+ if (pDriver && !pDriver->IsPlayer() && pDriver->CharCreatedBy != MISSION_CHAR && pDriver->m_nPedType != PEDTYPE_COP) {
+ int index = FindFreeSlotInCollectiveArray();
+ if (index > -1) {
+ CollectiveArray[index].colIndex = colIndex;
+ CollectiveArray[index].pedIndex = CPools::GetPedPool()->GetIndex(pDriver);
+ }
+ }
+ for (int i = 0; i < pVehicle->m_nNumMaxPassengers; i++) {
+ CPed* pPassenger = pVehicle->pPassengers[i];
+ if (pPassenger && !pPassenger->IsPlayer() && pPassenger->CharCreatedBy != MISSION_CHAR && pPassenger->m_nPedType != PEDTYPE_COP) {
+ int index = FindFreeSlotInCollectiveArray();
+ if (index > -1) {
+ CollectiveArray[index].colIndex = colIndex;
+ CollectiveArray[index].pedIndex = CPools::GetPedPool()->GetIndex(pPassenger);
+ }
+ }
+ }
+ return colIndex;
+}
+
+int CTheScripts::AddPedsInAreaToCollective(float x, float y, float z, float radius)
+{
+ int16 numFound;
+ CEntity* pEntities[64];
+ int colIndex = NextFreeCollectiveIndex;
+ AdvanceCollectiveIndex();
+ CWorld::FindObjectsInRange(CVector(x, y, z), radius, true, &numFound, 64, pEntities, false, true, true, false, false);
+ for (int16 i = 0; i < numFound; i++) {
+ if (pEntities[i]->GetType() == ENTITY_TYPE_PED) {
+ CPed* pPed = (CPed*)pEntities[i];
+ if (pPed && !pPed->IsPlayer() && pPed->CharCreatedBy != MISSION_CHAR && pPed->m_nPedType != PEDTYPE_COP) {
+ int index = FindFreeSlotInCollectiveArray();
+ if (index > -1) {
+ CollectiveArray[index].colIndex = colIndex;
+ CollectiveArray[index].pedIndex = CPools::GetPedPool()->GetIndex(pPed);
+ }
+ }
+ }
+ else if (pEntities[i]->GetType() == ENTITY_TYPE_VEHICLE) {
+ CVehicle* pVehicle = (CVehicle*)pEntities[i];
+ CPed* pDriver = pVehicle->pDriver;
+ if (pDriver && !pDriver->IsPlayer() && pDriver->CharCreatedBy != MISSION_CHAR && pDriver->m_nPedType != PEDTYPE_COP) {
+ int index = FindFreeSlotInCollectiveArray();
+ if (index > -1) {
+ CollectiveArray[index].colIndex = colIndex;
+ CollectiveArray[index].pedIndex = CPools::GetPedPool()->GetIndex(pDriver);
+ }
+ }
+ for (int i = 0; i < pVehicle->m_nNumMaxPassengers; i++) {
+ CPed* pPassenger = pVehicle->pPassengers[i];
+ if (pPassenger && !pPassenger->IsPlayer() && pPassenger->CharCreatedBy != MISSION_CHAR && pPassenger->m_nPedType != PEDTYPE_COP) {
+ int index = FindFreeSlotInCollectiveArray();
+ if (index > -1) {
+ CollectiveArray[index].colIndex = colIndex;
+ CollectiveArray[index].pedIndex = CPools::GetPedPool()->GetIndex(pPassenger);
+ }
+ }
+ }
+ }
+ }
+ return colIndex;
+}
+
+int CTheScripts::FindFreeSlotInCollectiveArray()
+{
+ for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
+ if (CollectiveArray[i].colIndex == -1)
+ return i;
+ }
+ return -1;
+}
+
+void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, int16 p1, int16 p2)
+{
+ for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
+ if (CollectiveArray[i].colIndex = colIndex) {
+ CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
+ if (pPed == nil) {
+ CollectiveArray[i].colIndex = -1;
+ CollectiveArray[i].pedIndex = 0;
+ }
+ else {
+ pPed->bScriptObjectiveCompleted = false;
+ pPed->SetObjective(objective, p1, p2);
+ }
+ }
+ }
+}
+
+void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1, float p2)
+{
+ for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
+ if (CollectiveArray[i].colIndex = colIndex) {
+ CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
+ if (pPed == nil) {
+ CollectiveArray[i].colIndex = -1;
+ CollectiveArray[i].pedIndex = 0;
+ }
+ else {
+ pPed->bScriptObjectiveCompleted = false;
+ pPed->SetObjective(objective, p1, p2);
+ }
+ }
+ }
+}
+
+void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1)
+{
+ for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
+ if (CollectiveArray[i].colIndex = colIndex) {
+ CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
+ if (pPed == nil) {
+ CollectiveArray[i].colIndex = -1;
+ CollectiveArray[i].pedIndex = 0;
+ }
+ else {
+ pPed->bScriptObjectiveCompleted = false;
+ pPed->SetObjective(objective, p1);
+ }
+ }
+ }
+}
+
+void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, void* p1)
+{
+ for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
+ if (CollectiveArray[i].colIndex = colIndex) {
+ CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
+ if (pPed == nil) {
+ CollectiveArray[i].colIndex = -1;
+ CollectiveArray[i].pedIndex = 0;
+ }
+ else {
+ pPed->bScriptObjectiveCompleted = false;
+ pPed->SetObjective(objective, p1);
+ }
+ }
+ }
+}
+
+void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective)
+{
+ for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
+ if (CollectiveArray[i].colIndex = colIndex) {
+ CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
+ if (pPed == nil) {
+ CollectiveArray[i].colIndex = -1;
+ CollectiveArray[i].pedIndex = 0;
+ }
+ else {
+ pPed->bScriptObjectiveCompleted = false;
+ pPed->SetObjective(objective);
+ }
+ }
+ }
+}
+#endif //GTA_SCRIPT_COLLECTIVE
+
bool CTheScripts::IsPedStopped(CPed* pPed)
{
if (pPed->InVehicle())
diff --git a/src/control/Script6.cpp b/src/control/Script6.cpp
index 272ecd4b..501a7873 100644
--- a/src/control/Script6.cpp
+++ b/src/control/Script6.cpp
@@ -3,6 +3,7 @@
#include "Script.h"
#include "ScriptCommands.h"
+#include "Bike.h"
#include "CarCtrl.h"
#include "Cranes.h"
#include "Credits.h"
@@ -31,7 +32,6 @@
#include "Weather.h"
#include "Zones.h"
#include "main.h"
-#include "Bike.h"
#include "GameLogic.h"
#include "Sprite.h"
#include "CarAI.h"