mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-11-18 06:37:46 +00:00
Merge branch 'miami' into lcs-dev
This commit is contained in:
commit
b4b9f9601b
|
@ -73,13 +73,21 @@ CDarkel::DrawMessages()
|
||||||
{
|
{
|
||||||
CFont::SetJustifyOff();
|
CFont::SetJustifyOff();
|
||||||
CFont::SetBackgroundOff();
|
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::SetCentreOn();
|
||||||
CFont::SetPropOn();
|
CFont::SetPropOn();
|
||||||
uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart;
|
uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart;
|
||||||
if (bStandardSoundAndMessages) {
|
if (bStandardSoundAndMessages) {
|
||||||
if (timePassedSinceStart >= 3000 && timePassedSinceStart < 11000) {
|
if (timePassedSinceStart >= 3000 && timePassedSinceStart < 11000) {
|
||||||
|
#ifdef FIX_BUGS
|
||||||
CFont::SetScale(SCREEN_SCALE_X(1.3f), SCREEN_SCALE_Y(1.3f));
|
CFont::SetScale(SCREEN_SCALE_X(1.3f), SCREEN_SCALE_Y(1.3f));
|
||||||
|
#else
|
||||||
|
CFont::SetScale(1.3f, 1.3f);
|
||||||
|
#endif
|
||||||
CFont::SetJustifyOff();
|
CFont::SetJustifyOff();
|
||||||
CFont::SetColor(CRGBA(255, 255, 128, CalcFade(timePassedSinceStart, 3000, 11000)));
|
CFont::SetColor(CRGBA(255, 255, 128, CalcFade(timePassedSinceStart, 3000, 11000)));
|
||||||
CFont::SetFontStyle(FONT_STANDARD);
|
CFont::SetFontStyle(FONT_STANDARD);
|
||||||
|
@ -89,7 +97,11 @@ CDarkel::DrawMessages()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (timePassedSinceStart < 8000) {
|
if (timePassedSinceStart < 8000) {
|
||||||
|
#ifdef FIX_BUGS
|
||||||
CFont::SetScale(SCREEN_SCALE_X(1.3f), SCREEN_SCALE_Y(1.3f));
|
CFont::SetScale(SCREEN_SCALE_X(1.3f), SCREEN_SCALE_Y(1.3f));
|
||||||
|
#else
|
||||||
|
CFont::SetScale(1.3f, 1.3f);
|
||||||
|
#endif
|
||||||
CFont::SetJustifyOff();
|
CFont::SetJustifyOff();
|
||||||
CFont::SetColor(CRGBA(255, 255, 128, CalcFade(timePassedSinceStart, 0, 8000)));
|
CFont::SetColor(CRGBA(255, 255, 128, CalcFade(timePassedSinceStart, 0, 8000)));
|
||||||
CFont::SetFontStyle(FONT_STANDARD);
|
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));
|
CFont::SetScale(SCREEN_SCALE_X(0.75f), SCREEN_SCALE_Y(1.5f));
|
||||||
|
#else
|
||||||
|
CFont::SetScale(0.75f, 1.5f);
|
||||||
|
#endif
|
||||||
CFont::SetCentreOff();
|
CFont::SetCentreOff();
|
||||||
CFont::SetRightJustifyOn();
|
CFont::SetRightJustifyOn();
|
||||||
CFont::SetFontStyle(FONT_HEADING);
|
CFont::SetFontStyle(FONT_HEADING);
|
||||||
|
@ -127,13 +143,25 @@ CDarkel::DrawMessages()
|
||||||
uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart;
|
uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart;
|
||||||
if (CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart < 5000) {
|
if (CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart < 5000) {
|
||||||
CFont::SetBackgroundOff();
|
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();
|
CFont::SetCentreOn();
|
||||||
|
#ifdef FIX_BUGS
|
||||||
CFont::SetScale(SCREEN_SCALE_X(1.5f), SCREEN_SCALE_Y(1.5f));
|
CFont::SetScale(SCREEN_SCALE_X(1.5f), SCREEN_SCALE_Y(1.5f));
|
||||||
|
#else
|
||||||
|
CFont::SetScale(1.5f, 1.5f);
|
||||||
|
#endif
|
||||||
CFont::SetJustifyOff();
|
CFont::SetJustifyOff();
|
||||||
CFont::SetColor(CRGBA(128, 255, 128, CalcFade(timePassedSinceStart, 0, 5000)));
|
CFont::SetColor(CRGBA(128, 255, 128, CalcFade(timePassedSinceStart, 0, 5000)));
|
||||||
CFont::SetFontStyle(FONT_STANDARD);
|
CFont::SetFontStyle(FONT_STANDARD);
|
||||||
|
#ifdef FIX_BUGS
|
||||||
int y = SCREEN_HEIGHT / 2 + SCREEN_SCALE_Y(25.0f - timePassedSinceStart * 0.01f);
|
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"));
|
CFont::PrintString(SCREEN_WIDTH / 2, y, TheText.Get("KF_3"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1395,7 +1395,11 @@ void CGarages::PrintMessages()
|
||||||
CFont::SetPropOn();
|
CFont::SetPropOn();
|
||||||
CFont::SetJustifyOff();
|
CFont::SetJustifyOff();
|
||||||
CFont::SetBackgroundOff();
|
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::SetCentreOn();
|
||||||
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
|
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
|
||||||
CFont::SetColor(CRGBA(27, 89, 130, 255));
|
CFont::SetColor(CRGBA(27, 89, 130, 255));
|
||||||
|
|
|
@ -1345,7 +1345,11 @@ CPickups::RenderPickUpText()
|
||||||
float fScaleX = aMessages[i].m_dist.x / 30.0f;
|
float fScaleX = aMessages[i].m_dist.x / 30.0f;
|
||||||
if (fScaleX > MAX_SCALE) fScaleX = MAX_SCALE;
|
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);
|
CFont::SetScale(fScaleX, fScaleY);
|
||||||
|
#endif
|
||||||
CFont::SetCentreOn();
|
CFont::SetCentreOn();
|
||||||
CFont::SetCentreSize(SCREEN_WIDTH);
|
CFont::SetCentreSize(SCREEN_WIDTH);
|
||||||
CFont::SetJustifyOff();
|
CFont::SetJustifyOff();
|
||||||
|
|
|
@ -1894,13 +1894,20 @@ void CReplay::Display()
|
||||||
TimeCount = (TimeCount + 1) % UINT16_MAX;
|
TimeCount = (TimeCount + 1) % UINT16_MAX;
|
||||||
if ((TimeCount & 0x20) == 0)
|
if ((TimeCount & 0x20) == 0)
|
||||||
return;
|
return;
|
||||||
CFont::SetPropOn();
|
|
||||||
CFont::SetBackgroundOff();
|
|
||||||
CFont::SetScale(SCREEN_SCALE_X(1.5f), SCREEN_SCALE_Y(1.5f));
|
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::SetColor(CRGBA(255, 255, 200, 200));
|
||||||
CFont::SetFontStyle(FONT_STANDARD);
|
CFont::SetFontStyle(FONT_STANDARD);
|
||||||
if (Mode == MODE_PLAYBACK)
|
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
|
#endif
|
||||||
|
|
|
@ -281,24 +281,44 @@ void CSceneEdit::Draw(void)
|
||||||
#endif
|
#endif
|
||||||
sprintf(str, "Action");
|
sprintf(str, "Action");
|
||||||
AsciiToUnicode(str, wstr);
|
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);
|
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));
|
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);
|
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");
|
sprintf(str, "Selected");
|
||||||
AsciiToUnicode(str, wstr);
|
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);
|
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));
|
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);
|
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();
|
CFont::SetCentreOff();
|
||||||
|
#ifdef FIX_BUGS
|
||||||
CFont::SetScale(SCREEN_SCALE_X(0.7f), SCREEN_SCALE_Y(0.7f));
|
CFont::SetScale(SCREEN_SCALE_X(0.7f), SCREEN_SCALE_Y(0.7f));
|
||||||
|
#else
|
||||||
|
CFont::SetScale(0.7f, 0.7f);
|
||||||
|
#endif
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
CFont::SetFontStyle(FONT_STANDARD);
|
CFont::SetFontStyle(FONT_STANDARD);
|
||||||
#else
|
#else
|
||||||
CFont::SetFontStyle(FONT_HEADING);
|
CFont::SetFontStyle(FONT_HEADING);
|
||||||
#endif
|
#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++) {
|
for (int i = 0; i < NUM_COMMANDS_TO_DRAW; i++) {
|
||||||
int16 nCommandDrawn = m_nCurrentCommand + i - NUM_COMMANDS_TO_DRAW / 2;
|
int16 nCommandDrawn = m_nCurrentCommand + i - NUM_COMMANDS_TO_DRAW / 2;
|
||||||
if (nCommandDrawn >= MOVIE_TOTAL_COMMANDS)
|
if (nCommandDrawn >= MOVIE_TOTAL_COMMANDS)
|
||||||
|
@ -307,13 +327,21 @@ void CSceneEdit::Draw(void)
|
||||||
nCommandDrawn += (MOVIE_TOTAL_COMMANDS - 1);
|
nCommandDrawn += (MOVIE_TOTAL_COMMANDS - 1);
|
||||||
sprintf(str, "%s", pCommandStrings[nCommandDrawn]);
|
sprintf(str, "%s", pCommandStrings[nCommandDrawn]);
|
||||||
AsciiToUnicode(str, wstr);
|
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);
|
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)
|
if (nCommandDrawn == m_nCurrentCommand)
|
||||||
CFont::SetColor(CRGBA(156, 91, 40, 255));
|
CFont::SetColor(CRGBA(156, 91, 40, 255));
|
||||||
else
|
else
|
||||||
CFont::SetColor(CRGBA(193, 164, 120, 255));
|
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);
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ int32 CTheScripts::StoreVehicleIndex;
|
||||||
bool CTheScripts::StoreVehicleWasRandom;
|
bool CTheScripts::StoreVehicleWasRandom;
|
||||||
CRunningScript *CTheScripts::pIdleScripts;
|
CRunningScript *CTheScripts::pIdleScripts;
|
||||||
CRunningScript *CTheScripts::pActiveScripts;
|
CRunningScript *CTheScripts::pActiveScripts;
|
||||||
uint32 CTheScripts::NextFreeCollectiveIndex;
|
int32 CTheScripts::NextFreeCollectiveIndex;
|
||||||
int32 CTheScripts::LastRandomPedId;
|
int32 CTheScripts::LastRandomPedId;
|
||||||
uint16 CTheScripts::NumberOfUsedObjects;
|
uint16 CTheScripts::NumberOfUsedObjects;
|
||||||
bool CTheScripts::bAlreadyRunningAMissionScript;
|
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++){
|
for (int i = 0; i < MAX_CLEANUP; i++){
|
||||||
if (m_sEntities[i].type == CLEANUP_UNUSED)
|
if (m_sEntities[i].type == CLEANUP_UNUSED)
|
||||||
|
@ -1685,7 +1685,7 @@ CMissionCleanupEntity* CMissionCleanup::FindFree()
|
||||||
|
|
||||||
void CMissionCleanup::AddEntityToList(int32 id, uint8 type)
|
void CMissionCleanup::AddEntityToList(int32 id, uint8 type)
|
||||||
{
|
{
|
||||||
CMissionCleanupEntity* pNew = FindFree();
|
cleanup_entity_struct* pNew = FindFree();
|
||||||
if (!pNew)
|
if (!pNew)
|
||||||
return;
|
return;
|
||||||
pNew->id = id;
|
pNew->id = id;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "Ped.h"
|
||||||
#include "PedType.h"
|
#include "PedType.h"
|
||||||
#include "Text.h"
|
#include "Text.h"
|
||||||
#include "Sprite2d.h"
|
#include "Sprite2d.h"
|
||||||
|
@ -40,6 +41,8 @@ void FlushLog();
|
||||||
|
|
||||||
#define KEY_LENGTH_IN_SCRIPT 8
|
#define KEY_LENGTH_IN_SCRIPT 8
|
||||||
|
|
||||||
|
//#define GTA_SCRIPT_COLLECTIVE
|
||||||
|
|
||||||
struct intro_script_rectangle
|
struct intro_script_rectangle
|
||||||
{
|
{
|
||||||
bool m_bIsUsed;
|
bool m_bIsUsed;
|
||||||
|
@ -131,7 +134,7 @@ enum {
|
||||||
CLEANUP_OBJECT
|
CLEANUP_OBJECT
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CMissionCleanupEntity
|
struct cleanup_entity_struct
|
||||||
{
|
{
|
||||||
uint8 type;
|
uint8 type;
|
||||||
int32 id;
|
int32 id;
|
||||||
|
@ -145,14 +148,14 @@ enum {
|
||||||
|
|
||||||
class CMissionCleanup
|
class CMissionCleanup
|
||||||
{
|
{
|
||||||
CMissionCleanupEntity m_sEntities[MAX_CLEANUP];
|
cleanup_entity_struct m_sEntities[MAX_CLEANUP];
|
||||||
uint8 m_nCount;
|
uint8 m_nCount;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMissionCleanup();
|
CMissionCleanup();
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
CMissionCleanupEntity* FindFree();
|
cleanup_entity_struct* FindFree();
|
||||||
void AddEntityToList(int32, uint8);
|
void AddEntityToList(int32, uint8);
|
||||||
void RemoveEntityFromList(int32, uint8);
|
void RemoveEntityFromList(int32, uint8);
|
||||||
void Process();
|
void Process();
|
||||||
|
@ -217,8 +220,8 @@ enum {
|
||||||
|
|
||||||
struct tCollectiveData
|
struct tCollectiveData
|
||||||
{
|
{
|
||||||
int32 index;
|
int32 colIndex;
|
||||||
uint32 unk_data;
|
int32 pedIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -289,7 +292,7 @@ class CTheScripts
|
||||||
static bool StoreVehicleWasRandom;
|
static bool StoreVehicleWasRandom;
|
||||||
static CRunningScript *pIdleScripts;
|
static CRunningScript *pIdleScripts;
|
||||||
static CRunningScript *pActiveScripts;
|
static CRunningScript *pActiveScripts;
|
||||||
static uint32 NextFreeCollectiveIndex;
|
static int32 NextFreeCollectiveIndex;
|
||||||
static int32 LastRandomPedId;
|
static int32 LastRandomPedId;
|
||||||
static uint16 NumberOfUsedObjects;
|
static uint16 NumberOfUsedObjects;
|
||||||
static bool bAlreadyRunningAMissionScript;
|
static bool bAlreadyRunningAMissionScript;
|
||||||
|
@ -413,6 +416,25 @@ public:
|
||||||
static void SwitchToMission(int32 mission);
|
static void SwitchToMission(int32 mission);
|
||||||
#endif
|
#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 CRunningScript;
|
||||||
friend class CHud;
|
friend class CHud;
|
||||||
friend void CMissionCleanup::Process();
|
friend void CMissionCleanup::Process();
|
||||||
|
@ -532,6 +554,14 @@ private:
|
||||||
void LocateObjectCommand(int32, uint32*);
|
void LocateObjectCommand(int32, uint32*);
|
||||||
void ObjectInAreaCheckCommand(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
|
#ifdef MISSION_REPLAY
|
||||||
bool CanAllowMissionReplay();
|
bool CanAllowMissionReplay();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -858,7 +858,12 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
|
||||||
UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_WBState == WBSTATE_PLAYING);
|
UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_WBState == WBSTATE_PLAYING);
|
||||||
return 0;
|
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:
|
default:
|
||||||
script_assert(0);
|
script_assert(0);
|
||||||
}
|
}
|
||||||
|
@ -868,65 +873,314 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
|
||||||
int8 CRunningScript::ProcessCommands600To699(int32 command)
|
int8 CRunningScript::ProcessCommands600To699(int32 command)
|
||||||
{
|
{
|
||||||
switch (command){
|
switch (command){
|
||||||
/* Collective commands are not implemented until LCS.
|
#ifdef GTA_SCRIPT_COLLECTIVE
|
||||||
case COMMAND_SET_COLL_OBJ_WAIT_ON_FOOT:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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_FOLLOW_CAR_IN_CAR:
|
||||||
case COMMAND_SET_COLL_OBJ_FIRE_AT_OBJECT_FROM_VEHICLE:
|
case COMMAND_SET_COLL_OBJ_FIRE_AT_OBJECT_FROM_VEHICLE:
|
||||||
case COMMAND_SET_COLL_OBJ_DESTROY_OBJECT:
|
case COMMAND_SET_COLL_OBJ_DESTROY_OBJECT:
|
||||||
|
*/
|
||||||
case COMMAND_SET_COLL_OBJ_DESTROY_CAR:
|
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:
|
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_GOTO_AREA_IN_CAR:
|
||||||
case COMMAND_SET_COLL_OBJ_FOLLOW_CAR_ON_FOOT_WITH_OFFSET:
|
case COMMAND_SET_COLL_OBJ_FOLLOW_CAR_ON_FOOT_WITH_OFFSET:
|
||||||
case COMMAND_SET_COLL_OBJ_GUARD_ATTACK:
|
case COMMAND_SET_COLL_OBJ_GUARD_ATTACK:
|
||||||
|
*/
|
||||||
case COMMAND_SET_COLL_OBJ_FOLLOW_ROUTE:
|
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_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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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_ANY_MEANS_2D:
|
||||||
case COMMAND_LOCATE_COLL_ON_FOOT_2D:
|
case COMMAND_LOCATE_COLL_ON_FOOT_2D:
|
||||||
case COMMAND_LOCATE_COLL_IN_CAR_2D:
|
case COMMAND_LOCATE_COLL_IN_CAR_2D:
|
||||||
case COMMAND_LOCATE_STOPPED_COLL_ANY_MEANS_2D:
|
case COMMAND_LOCATE_STOPPED_COLL_ANY_MEANS_2D:
|
||||||
case COMMAND_LOCATE_STOPPED_COLL_ON_FOOT_2D:
|
case COMMAND_LOCATE_STOPPED_COLL_ON_FOOT_2D:
|
||||||
case COMMAND_LOCATE_STOPPED_COLL_IN_CAR_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_ANY_MEANS_CHAR_2D:
|
||||||
case COMMAND_LOCATE_COLL_ON_FOOT_CHAR_2D:
|
case COMMAND_LOCATE_COLL_ON_FOOT_CHAR_2D:
|
||||||
case COMMAND_LOCATE_COLL_IN_CAR_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_ANY_MEANS_CAR_2D:
|
||||||
case COMMAND_LOCATE_COLL_ON_FOOT_CAR_2D:
|
case COMMAND_LOCATE_COLL_ON_FOOT_CAR_2D:
|
||||||
case COMMAND_LOCATE_COLL_IN_CAR_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_ANY_MEANS_PLAYER_2D:
|
||||||
case COMMAND_LOCATE_COLL_ON_FOOT_PLAYER_2D:
|
case COMMAND_LOCATE_COLL_ON_FOOT_PLAYER_2D:
|
||||||
case COMMAND_LOCATE_COLL_IN_CAR_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_2D:
|
||||||
case COMMAND_IS_COLL_IN_AREA_ON_FOOT_2D:
|
case COMMAND_IS_COLL_IN_AREA_ON_FOOT_2D:
|
||||||
case COMMAND_IS_COLL_IN_AREA_IN_CAR_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_2D:
|
||||||
case COMMAND_IS_COLL_STOPPED_IN_AREA_ON_FOOT_2D:
|
case COMMAND_IS_COLL_STOPPED_IN_AREA_ON_FOOT_2D:
|
||||||
case COMMAND_IS_COLL_STOPPED_IN_AREA_IN_CAR_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:
|
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:
|
case COMMAND_SET_CHAR_HEED_THREATS:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 2);
|
CollectParameters(&m_nIp, 2);
|
||||||
|
@ -1064,7 +1318,32 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
|
||||||
return 0;
|
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:
|
case COMMAND_IS_PLAYER_STOPPED:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
|
|
|
@ -254,8 +254,12 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
||||||
pPed->SetObjective(OBJECTIVE_CATCH_TRAIN);
|
pPed->SetObjective(OBJECTIVE_CATCH_TRAIN);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*/
|
#ifdef GTA_SCRIPT_COLLECTIVE
|
||||||
//case COMMAND_SET_COLL_OBJ_CATCH_TRAIN:
|
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:
|
case COMMAND_SET_PLAYER_NEVER_GETS_TIRED:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 2);
|
CollectParameters(&m_nIp, 2);
|
||||||
|
@ -1148,7 +1152,12 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
||||||
CGarages::GivePlayerDetonator();
|
CGarages::GivePlayerDetonator();
|
||||||
return 0;
|
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:
|
case COMMAND_SET_OBJECT_VELOCITY:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 4);
|
CollectParameters(&m_nIp, 4);
|
||||||
|
|
|
@ -1422,6 +1422,488 @@ int16 CRunningScript::GetPadState(uint16 pad, uint16 button)
|
||||||
return 0;
|
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)
|
bool CRunningScript::CheckDamagedWeaponType(int32 actual, int32 type)
|
||||||
{
|
{
|
||||||
if (actual == -1)
|
if (actual == -1)
|
||||||
|
@ -1892,6 +2374,172 @@ void CTheScripts::HighlightImportantAngledArea(uint32 id, float x1, float y1, fl
|
||||||
CShadows::RenderIndicatorShadow(id, 2, gpGoalTex, ¢er, supX - center.x, 0.0f, 0.0f, center.y - supY, 0);
|
CShadows::RenderIndicatorShadow(id, 2, gpGoalTex, ¢er, 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)
|
bool CTheScripts::IsPedStopped(CPed* pPed)
|
||||||
{
|
{
|
||||||
if (pPed->InVehicle())
|
if (pPed->InVehicle())
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "Script.h"
|
#include "Script.h"
|
||||||
#include "ScriptCommands.h"
|
#include "ScriptCommands.h"
|
||||||
|
|
||||||
|
#include "Bike.h"
|
||||||
#include "CarCtrl.h"
|
#include "CarCtrl.h"
|
||||||
#include "Cranes.h"
|
#include "Cranes.h"
|
||||||
#include "Credits.h"
|
#include "Credits.h"
|
||||||
|
@ -31,7 +32,6 @@
|
||||||
#include "Weather.h"
|
#include "Weather.h"
|
||||||
#include "Zones.h"
|
#include "Zones.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "Bike.h"
|
|
||||||
#include "GameLogic.h"
|
#include "GameLogic.h"
|
||||||
#include "Sprite.h"
|
#include "Sprite.h"
|
||||||
#include "CarAI.h"
|
#include "CarAI.h"
|
||||||
|
|
|
@ -3331,10 +3331,18 @@ void CPad::PrintErrorMessage(void)
|
||||||
if ( bDisplayNoControllerMessage && !CGame::playingIntro && !FrontEndMenuManager.m_bMenuActive )
|
if ( bDisplayNoControllerMessage && !CGame::playingIntro && !FrontEndMenuManager.m_bMenuActive )
|
||||||
{
|
{
|
||||||
CSprite2d::DrawRect(CRect(SCREEN_STRETCH_X(20.0f), SCREEN_SCALE_FROM_BOTTOM(130.0f), SCREEN_STRETCH_FROM_RIGHT(20.0f), SCREEN_SCALE_Y(140.0f)), CRGBA(50, 50, 50, 210));
|
CSprite2d::DrawRect(CRect(SCREEN_STRETCH_X(20.0f), SCREEN_SCALE_FROM_BOTTOM(130.0f), SCREEN_STRETCH_FROM_RIGHT(20.0f), SCREEN_SCALE_Y(140.0f)), CRGBA(50, 50, 50, 210));
|
||||||
|
#ifdef FIX_BUGS
|
||||||
CFont::SetScale(SCREEN_SCALE_X(0.85f), SCREEN_SCALE_Y(1.0f));
|
CFont::SetScale(SCREEN_SCALE_X(0.85f), SCREEN_SCALE_Y(1.0f));
|
||||||
|
#else
|
||||||
|
CFont::SetScale(0.85f, 1.0f);
|
||||||
|
#endif
|
||||||
CFont::SetJustifyOff();
|
CFont::SetJustifyOff();
|
||||||
CFont::SetBackgroundOff();
|
CFont::SetBackgroundOff();
|
||||||
CFont::SetCentreSize(SCREEN_SCALE_X(590.0f));
|
#ifdef FIX_BUGS
|
||||||
|
CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 20));
|
||||||
|
#else
|
||||||
|
CFont::SetCentreSize(SCREEN_WIDTH - 20);
|
||||||
|
#endif
|
||||||
CFont::SetCentreOn();
|
CFont::SetCentreOn();
|
||||||
CFont::SetPropOn();
|
CFont::SetPropOn();
|
||||||
CFont::SetColor(CRGBA(255, 255, 200, 200));
|
CFont::SetColor(CRGBA(255, 255, 200, 200));
|
||||||
|
@ -3349,10 +3357,18 @@ void CPad::PrintErrorMessage(void)
|
||||||
else if ( bObsoleteControllerMessage )
|
else if ( bObsoleteControllerMessage )
|
||||||
{
|
{
|
||||||
CSprite2d::DrawRect(CRect(SCREEN_STRETCH_X(20.0f), SCREEN_SCALE_FROM_BOTTOM(130.0f), SCREEN_STRETCH_FROM_RIGHT(20.0f), SCREEN_SCALE_Y(140.0f)), CRGBA(50, 50, 50, 210));
|
CSprite2d::DrawRect(CRect(SCREEN_STRETCH_X(20.0f), SCREEN_SCALE_FROM_BOTTOM(130.0f), SCREEN_STRETCH_FROM_RIGHT(20.0f), SCREEN_SCALE_Y(140.0f)), CRGBA(50, 50, 50, 210));
|
||||||
|
#ifdef FIX_BUGS
|
||||||
CFont::SetScale(SCREEN_SCALE_X(0.85f), SCREEN_SCALE_Y(1.0f));
|
CFont::SetScale(SCREEN_SCALE_X(0.85f), SCREEN_SCALE_Y(1.0f));
|
||||||
|
#else
|
||||||
|
CFont::SetScale(0.85f, 1.0f);
|
||||||
|
#endif
|
||||||
CFont::SetJustifyOff();
|
CFont::SetJustifyOff();
|
||||||
CFont::SetBackgroundOff();
|
CFont::SetBackgroundOff();
|
||||||
CFont::SetCentreSize(SCREEN_SCALE_X(590.0f));
|
#ifdef FIX_BUGS
|
||||||
|
CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 20));
|
||||||
|
#else
|
||||||
|
CFont::SetCentreSize(SCREEN_WIDTH - 20);
|
||||||
|
#endif
|
||||||
CFont::SetCentreOn();
|
CFont::SetCentreOn();
|
||||||
CFont::SetPropOn();
|
CFont::SetPropOn();
|
||||||
CFont::SetColor(CRGBA(255, 255, 200, 200));
|
CFont::SetColor(CRGBA(255, 255, 200, 200));
|
||||||
|
|
|
@ -1937,11 +1937,11 @@ CWorld::Process(void)
|
||||||
if(csObj->m_rwObject && RwObjectGetType(csObj->m_rwObject) == rpCLUMP &&
|
if(csObj->m_rwObject && RwObjectGetType(csObj->m_rwObject) == rpCLUMP &&
|
||||||
RpAnimBlendClumpGetFirstAssociation(csObj->GetClump())) {
|
RpAnimBlendClumpGetFirstAssociation(csObj->GetClump())) {
|
||||||
if (csObj->IsObject())
|
if (csObj->IsObject())
|
||||||
RpAnimBlendClumpUpdateAnimations(csObj->GetClump(), 0.02f * CTimer::GetTimeStepNonClipped());
|
RpAnimBlendClumpUpdateAnimations(csObj->GetClump(), CTimer::GetTimeStepNonClippedInSeconds());
|
||||||
else {
|
else {
|
||||||
if (!csObj->bOffscreen)
|
if (!csObj->bOffscreen)
|
||||||
csObj->bOffscreen = !csObj->GetIsOnScreen();
|
csObj->bOffscreen = !csObj->GetIsOnScreen();
|
||||||
RpAnimBlendClumpUpdateAnimations(csObj->GetClump(), 0.02f * CTimer::GetTimeStep(), !csObj->bOffscreen);
|
RpAnimBlendClumpUpdateAnimations(csObj->GetClump(), CTimer::GetTimeStepInSeconds(), !csObj->bOffscreen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
csObj->ProcessControl();
|
csObj->ProcessControl();
|
||||||
|
@ -1958,11 +1958,11 @@ CWorld::Process(void)
|
||||||
if(!movingEnt->bRemoveFromWorld && movingEnt->m_rwObject && RwObjectGetType(movingEnt->m_rwObject) == rpCLUMP &&
|
if(!movingEnt->bRemoveFromWorld && movingEnt->m_rwObject && RwObjectGetType(movingEnt->m_rwObject) == rpCLUMP &&
|
||||||
RpAnimBlendClumpGetFirstAssociation(movingEnt->GetClump())) {
|
RpAnimBlendClumpGetFirstAssociation(movingEnt->GetClump())) {
|
||||||
if (movingEnt->IsObject())
|
if (movingEnt->IsObject())
|
||||||
RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(), 0.02f * CTimer::GetTimeStepNonClipped());
|
RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(), CTimer::GetTimeStepNonClippedInSeconds());
|
||||||
else {
|
else {
|
||||||
if (!movingEnt->bOffscreen)
|
if (!movingEnt->bOffscreen)
|
||||||
movingEnt->bOffscreen = !movingEnt->GetIsOnScreen();
|
movingEnt->bOffscreen = !movingEnt->GetIsOnScreen();
|
||||||
RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(), 0.02f * CTimer::GetTimeStep(), !movingEnt->bOffscreen);
|
RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(), CTimer::GetTimeStepInSeconds(), !movingEnt->bOffscreen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,13 +42,30 @@ public:
|
||||||
bottom += y;
|
bottom += y;
|
||||||
top += y;
|
top += y;
|
||||||
}
|
}
|
||||||
void Grow(float r){
|
|
||||||
|
void Grow(float r) {
|
||||||
left -= r;
|
left -= r;
|
||||||
right += r;
|
right += r;
|
||||||
top -= r;
|
top -= r;
|
||||||
bottom += r;
|
bottom += r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Grow(float l, float r)
|
||||||
|
{
|
||||||
|
left -= l;
|
||||||
|
top -= l;
|
||||||
|
right += r;
|
||||||
|
bottom += r;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Grow(float l, float r, float t, float b)
|
||||||
|
{
|
||||||
|
left -= l;
|
||||||
|
top -= t;
|
||||||
|
right += r;
|
||||||
|
bottom += b;
|
||||||
|
}
|
||||||
|
|
||||||
float GetWidth(void) { return right - left; }
|
float GetWidth(void) { return right - left; }
|
||||||
float GetHeight(void) { return bottom - top; }
|
float GetHeight(void) { return bottom - top; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -4105,7 +4105,9 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
|
||||||
|
|
||||||
if (veh->pDriver == ped) {
|
if (veh->pDriver == ped) {
|
||||||
veh->RemoveDriver();
|
veh->RemoveDriver();
|
||||||
|
#ifndef FIX_BUGS // RemoveDriver does it anyway
|
||||||
veh->SetStatus(STATUS_ABANDONED);
|
veh->SetStatus(STATUS_ABANDONED);
|
||||||
|
#endif
|
||||||
if (veh->m_nDoorLock == CARLOCK_LOCKED_INITIALLY)
|
if (veh->m_nDoorLock == CARLOCK_LOCKED_INITIALLY)
|
||||||
veh->m_nDoorLock = CARLOCK_UNLOCKED;
|
veh->m_nDoorLock = CARLOCK_UNLOCKED;
|
||||||
if (ped->m_nPedType == PEDTYPE_COP && veh->IsLawEnforcementVehicle())
|
if (ped->m_nPedType == PEDTYPE_COP && veh->IsLawEnforcementVehicle())
|
||||||
|
|
|
@ -254,7 +254,6 @@ CPedStats::LoadPedStats(void)
|
||||||
float fleeDist, headingChangeRate, attackStrength, defendWeakness;
|
float fleeDist, headingChangeRate, attackStrength, defendWeakness;
|
||||||
int fear, temper, lawfullness, sexiness, flags;
|
int fear, temper, lawfullness, sexiness, flags;
|
||||||
|
|
||||||
|
|
||||||
type = 0;
|
type = 0;
|
||||||
buf = new char[16 * 1024];
|
buf = new char[16 * 1024];
|
||||||
|
|
||||||
|
|
|
@ -803,8 +803,14 @@ CCredits::Render(void)
|
||||||
if(TheCamera.m_WideScreenOn)
|
if(TheCamera.m_WideScreenOn)
|
||||||
TheCamera.DrawBordersForWideScreen();
|
TheCamera.DrawBordersForWideScreen();
|
||||||
|
|
||||||
|
#ifdef FIX_BUGS
|
||||||
if(lineoffset + DEFAULT_SCREEN_HEIGHT - scrolloffset < -10.0f)
|
if(lineoffset + DEFAULT_SCREEN_HEIGHT - scrolloffset < -10.0f)
|
||||||
|
#else
|
||||||
|
if(lineoffset + SCREEN_HEIGHT - scrolloffset < -10.0f)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
bCreditsGoing = false;
|
bCreditsGoing = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCredits::AreCreditsDone(void)
|
bool CCredits::AreCreditsDone(void)
|
||||||
|
|
|
@ -849,7 +849,7 @@ C3dMarkers::PlaceMarker(uint32 identifier, uint16 type, CVector &pos, float size
|
||||||
} else {
|
} else {
|
||||||
pMarker->m_fStdSize = size;
|
pMarker->m_fStdSize = size;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (type == MARKERTYPE_CYLINDER) {
|
||||||
if (dist < size + 12.0f) {
|
if (dist < size + 12.0f) {
|
||||||
if (dist > size + 1.0f)
|
if (dist > size + 1.0f)
|
||||||
pMarker->m_Color.alpha = (1.0f - (size + 12.0f - dist) * 0.7f / 11.0f) * (float)a;
|
pMarker->m_Color.alpha = (1.0f - (size + 12.0f - dist) * 0.7f / 11.0f) * (float)a;
|
||||||
|
@ -862,8 +862,14 @@ C3dMarkers::PlaceMarker(uint32 identifier, uint16 type, CVector &pos, float size
|
||||||
float someSin = Sin(TWOPI * (float)((pMarker->m_nPulsePeriod - 1) & (CTimer::GetTimeInMilliseconds() - pMarker->m_nStartTime)) / (float)pMarker->m_nPulsePeriod);
|
float someSin = Sin(TWOPI * (float)((pMarker->m_nPulsePeriod - 1) & (CTimer::GetTimeInMilliseconds() - pMarker->m_nStartTime)) / (float)pMarker->m_nPulsePeriod);
|
||||||
pMarker->m_fSize = pMarker->m_fStdSize - pulseFraction * pMarker->m_fStdSize * someSin;
|
pMarker->m_fSize = pMarker->m_fStdSize - pulseFraction * pMarker->m_fStdSize * someSin;
|
||||||
|
|
||||||
if (type == MARKERTYPE_ARROW)
|
if (type == MARKERTYPE_ARROW) {
|
||||||
pos.z += 0.25f * pMarker->m_fStdSize * someSin;
|
pos.z += 0.25f * pMarker->m_fStdSize * someSin;
|
||||||
|
} else if (type == MARKERTYPE_0) {
|
||||||
|
if (someSin > 0.0f)
|
||||||
|
pMarker->m_Color.alpha = (float)a * 0.7f * someSin + a;
|
||||||
|
else
|
||||||
|
pMarker->m_Color.alpha = (float)a * 0.4f * someSin + a;
|
||||||
|
}
|
||||||
if (pMarker->m_nRotateRate != 0) {
|
if (pMarker->m_nRotateRate != 0) {
|
||||||
RwV3d pos = pMarker->m_Matrix.m_matrix.pos;
|
RwV3d pos = pMarker->m_Matrix.m_matrix.pos;
|
||||||
pMarker->m_Matrix.RotateZ(DEGTORAD(pMarker->m_nRotateRate * CTimer::GetTimeStep()));
|
pMarker->m_Matrix.RotateZ(DEGTORAD(pMarker->m_nRotateRate * CTimer::GetTimeStep()));
|
||||||
|
@ -888,7 +894,7 @@ C3dMarkers::PlaceMarker(uint32 identifier, uint16 type, CVector &pos, float size
|
||||||
pMarker->DeleteMarkerObject();
|
pMarker->DeleteMarkerObject();
|
||||||
|
|
||||||
pMarker->AddMarker(identifier, type, size, r, g, b, a, pulsePeriod, pulseFraction, rotateRate);
|
pMarker->AddMarker(identifier, type, size, r, g, b, a, pulsePeriod, pulseFraction, rotateRate);
|
||||||
if (type == MARKERTYPE_CYLINDER) {
|
if (type == MARKERTYPE_CYLINDER || type == MARKERTYPE_0 || type == MARKERTYPE_2) {
|
||||||
if ((playerPos - pos).MagnitudeSqr() < sq(100.f) && CColStore::HasCollisionLoaded(CVector2D(pos))) {
|
if ((playerPos - pos).MagnitudeSqr() < sq(100.f) && CColStore::HasCollisionLoaded(CVector2D(pos))) {
|
||||||
float z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z + 1.0f, nil);
|
float z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z + 1.0f, nil);
|
||||||
if (z != 0.0f)
|
if (z != 0.0f)
|
||||||
|
@ -899,6 +905,10 @@ C3dMarkers::PlaceMarker(uint32 identifier, uint16 type, CVector &pos, float size
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pMarker->m_Matrix.SetTranslate(pos.x, pos.y, pos.z);
|
pMarker->m_Matrix.SetTranslate(pos.x, pos.y, pos.z);
|
||||||
|
if (type == MARKERTYPE_2) {
|
||||||
|
pMarker->m_Matrix.RotateX(PI);
|
||||||
|
pMarker->m_Matrix.GetPosition() = pos;
|
||||||
|
}
|
||||||
pMarker->m_Matrix.UpdateRW();
|
pMarker->m_Matrix.UpdateRW();
|
||||||
if (type == MARKERTYPE_ARROW) {
|
if (type == MARKERTYPE_ARROW) {
|
||||||
if (dist < 25.0f) {
|
if (dist < 25.0f) {
|
||||||
|
@ -909,7 +919,7 @@ C3dMarkers::PlaceMarker(uint32 identifier, uint16 type, CVector &pos, float size
|
||||||
} else {
|
} else {
|
||||||
pMarker->m_fStdSize = size;
|
pMarker->m_fStdSize = size;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (type == MARKERTYPE_CYLINDER) {
|
||||||
if (dist < size + 12.0f) {
|
if (dist < size + 12.0f) {
|
||||||
if (dist > size + 1.0f)
|
if (dist > size + 1.0f)
|
||||||
pMarker->m_Color.alpha = (1.0f - (size + 12.0f - dist) * 0.7f / 11.0f) * (float)a;
|
pMarker->m_Color.alpha = (1.0f - (size + 12.0f - dist) * 0.7f / 11.0f) * (float)a;
|
||||||
|
@ -1347,13 +1357,18 @@ CMoneyMessage::Render()
|
||||||
RwV3d vecOut;
|
RwV3d vecOut;
|
||||||
float fDistX, fDistY;
|
float fDistX, fDistY;
|
||||||
if (CSprite::CalcScreenCoors(m_vecPosition + CVector(0.0f, 0.0f, fLifeTime), &vecOut, &fDistX, &fDistY, true)) {
|
if (CSprite::CalcScreenCoors(m_vecPosition + CVector(0.0f, 0.0f, fLifeTime), &vecOut, &fDistX, &fDistY, true)) {
|
||||||
fDistX *= (0.7 * fLifeTime + 2.0) * m_fSize;
|
fDistX *= (0.7f * fLifeTime + 2.0f) * m_fSize;
|
||||||
fDistY *= (0.7 * fLifeTime + 2.0) * m_fSize;
|
fDistY *= (0.7f * fLifeTime + 2.0f) * m_fSize;
|
||||||
CFont::SetPropOn();
|
CFont::SetPropOn();
|
||||||
CFont::SetBackgroundOff();
|
CFont::SetBackgroundOff();
|
||||||
float fScaleY = Min(fDistY / 100.0f, MAX_SCALE);
|
float fScaleY = Min(fDistY / 100.0f, MAX_SCALE);
|
||||||
float fScaleX = Min(fDistX / 100.0f, MAX_SCALE);
|
float fScaleX = Min(fDistX / 100.0f, MAX_SCALE);
|
||||||
CFont::SetScale(fScaleX, fScaleY); // maybe use SCREEN_SCALE_X and SCREEN_SCALE_Y here?
|
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
CFont::SetScale(SCREEN_SCALE_X(fScaleX), SCREEN_SCALE_Y(fScaleY));
|
||||||
|
#else
|
||||||
|
CFont::SetScale(fScaleX, fScaleY);
|
||||||
|
#endif
|
||||||
CFont::SetCentreOn();
|
CFont::SetCentreOn();
|
||||||
CFont::SetCentreSize(SCREEN_WIDTH);
|
CFont::SetCentreSize(SCREEN_WIDTH);
|
||||||
CFont::SetJustifyOff();
|
CFont::SetJustifyOff();
|
||||||
|
|
|
@ -1914,6 +1914,9 @@ CVehicle::AddPassenger(CPed *passenger, uint8 n)
|
||||||
void
|
void
|
||||||
CVehicle::RemoveDriver(void)
|
CVehicle::RemoveDriver(void)
|
||||||
{
|
{
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
if (GetStatus() != STATUS_WRECKED)
|
||||||
|
#endif
|
||||||
SetStatus(STATUS_ABANDONED);
|
SetStatus(STATUS_ABANDONED);
|
||||||
if(pDriver == FindPlayerPed()){
|
if(pDriver == FindPlayerPed()){
|
||||||
if(GetModelIndex() == MI_POLICE && CStreaming::HasModelLoaded(MI_SHOTGUN)){
|
if(GetModelIndex() == MI_POLICE && CStreaming::HasModelLoaded(MI_SHOTGUN)){
|
||||||
|
|
Loading…
Reference in a new issue