summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/control/Garages.cpp12
-rw-r--r--src/control/Garages.h9
-rw-r--r--src/control/Script.cpp1215
-rw-r--r--src/control/Script.h5
-rw-r--r--src/core/CutsceneMgr.h1
-rw-r--r--src/core/PlayerInfo.cpp16
-rw-r--r--src/core/PlayerInfo.h2
-rw-r--r--src/core/World.cpp13
-rw-r--r--src/core/World.h2
-rw-r--r--src/core/config.h2
-rw-r--r--src/render/Weather.cpp25
-rw-r--r--src/render/Weather.h6
-rw-r--r--src/vehicles/Automobile.cpp4
-rw-r--r--src/vehicles/Automobile.h4
14 files changed, 1287 insertions, 29 deletions
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp
index b5ad37f4..d8e8df9f 100644
--- a/src/control/Garages.cpp
+++ b/src/control/Garages.cpp
@@ -75,6 +75,18 @@ WRAPPER void CGarages::TriggerMessage(const char *text, int16, uint16 time, int1
WRAPPER bool CGarages::IsPointWithinHideOutGarage(CVector&) { EAXJMP(0x428260); }
WRAPPER bool CGarages::IsPointWithinAnyGarage(CVector&) { EAXJMP(0x428320); }
WRAPPER void CGarages::PlayerArrestedOrDied() { EAXJMP(0x427F60); }
+WRAPPER int16 CGarages::AddOne(float, float, float, float, float, float, uint8, uint32) { EAXJMP(0x421FA0); }
+WRAPPER void CGarages::SetTargetCarForMissonGarage(int16, CVehicle*) { EAXJMP(0x426BD0); }
+WRAPPER bool CGarages::HasCarBeenDroppedOffYet(int16) { EAXJMP(0x426C20); }
+WRAPPER void CGarages::DeActivateGarage(int16) { EAXJMP(0x426C40); }
+WRAPPER void CGarages::ActivateGarage(int16) { EAXJMP(0x426C60); }
+
+int32 CGarages::QueryCarsCollected(int16 garage)
+{
+ return 0;
+}
+
+WRAPPER bool CGarages::HasThisCarBeenCollected(int16 garage, uint8 id) { EAXJMP(0x426D50); }
#if 0
WRAPPER void CGarages::PrintMessages(void) { EAXJMP(0x426310); }
diff --git a/src/control/Garages.h b/src/control/Garages.h
index 41c6b5ad..7960e619 100644
--- a/src/control/Garages.h
+++ b/src/control/Garages.h
@@ -1,5 +1,7 @@
#pragma once
+class CVehicle;
+
class CGarages
{
public:
@@ -30,4 +32,11 @@ public:
static void PlayerArrestedOrDied();
static void Init(void);
static void Update(void);
+ static int16 AddOne(float, float, float, float, float, float, uint8, uint32);
+ static void SetTargetCarForMissonGarage(int16, CVehicle*);
+ static bool HasCarBeenDroppedOffYet(int16);
+ static void ActivateGarage(int16);
+ static void DeActivateGarage(int16);
+ static int32 QueryCarsCollected(int16);
+ static bool HasThisCarBeenCollected(int16, uint8);
};
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index ced06f1e..b9c8bada 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -11,21 +11,30 @@
#include "CivilianPed.h"
#include "Clock.h"
#include "CopPed.h"
+#include "Coronas.h"
#include "Cranes.h"
+#include "CutsceneMgr.h"
+#include "Darkel.h"
#include "DMAudio.h"
#include "EmergencyPed.h"
+#include "Explosion.h"
#include "FileMgr.h"
+#include "Gangs.h"
#include "Garages.h"
#include "General.h"
#include "HandlingMgr.h"
+#include "Heli.h"
#include "Hud.h"
#include "Messages.h"
#include "ModelIndices.h"
#include "Pad.h"
+#include "ParticleObject.h"
#include "PedRoutes.h"
+#include "Phones.h"
#include "Pickups.h"
#include "PlayerInfo.h"
#include "PlayerPed.h"
+#include "PointLights.h"
#include "Pools.h"
#include "Population.h"
#include "Remote.h"
@@ -3572,7 +3581,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command)
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed);
- pPed->bObjectiveCompleted = false;
+ pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_IDLE);
return 0;
}
@@ -3581,7 +3590,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command)
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed);
- pPed->bObjectiveCompleted = false;
+ pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE);
return 0;
}
@@ -3593,7 +3602,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command)
CVector pos = *(CVector*)&ScriptParams[1];
if (pos.z <= -100.0f)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
- pPed->bObjectiveCompleted = false;
+ pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_GUARD_SPOT, pos);
return 0;
}
@@ -3619,7 +3628,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command)
pos.y = (infY + supY) / 2;
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
float radius = max(pos.x - infX, pos.y - infY);
- pPed->bObjectiveCompleted = false;
+ pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_GUARD_SPOT, pos, radius);
return 0;
}
@@ -3628,7 +3637,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command)
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed);
- pPed->bObjectiveCompleted = false;
+ pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_WAIT_IN_CAR);
return 0;
}
@@ -3672,6 +3681,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command)
CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
assert(pPed);
pPed->m_nSelectedWepSlot = pPed->GiveWeapon((eWeaponType)ScriptParams[1], ScriptParams[2]);
+ return 0;
}
case COMMAND_GIVE_WEAPON_TO_CHAR:
{
@@ -3956,7 +3966,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command)
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed);
CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]);
- pPed->bObjectiveCompleted = false;
+ pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, pTarget);
return 0;
}
@@ -3966,7 +3976,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command)
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed);
CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed;
- pPed->bObjectiveCompleted = false;
+ pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, pTarget);
return 0;
}
@@ -3976,7 +3986,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command)
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed);
CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]);
- pPed->bObjectiveCompleted = false;
+ pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_KILL_CHAR_ANY_MEANS, pTarget);
return 0;
}
@@ -3986,7 +3996,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command)
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed);
CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed;
- pPed->bObjectiveCompleted = false;
+ pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_KILL_CHAR_ANY_MEANS, pTarget);
return 0;
}
@@ -3996,7 +4006,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command)
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed);
CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]);
- pPed->bObjectiveCompleted = false;
+ pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pTarget);
return 0;
}
@@ -4006,7 +4016,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command)
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed);
CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed;
- pPed->bObjectiveCompleted = false;
+ pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pTarget);
return 0;
}
@@ -4016,7 +4026,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command)
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed);
CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]);
- pPed->bObjectiveCompleted = false;
+ pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pTarget);
return 0;
}
@@ -4026,7 +4036,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command)
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed);
CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed;
- pPed->bObjectiveCompleted = false;
+ pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pTarget);
return 0;
}
@@ -4036,7 +4046,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command)
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed);
CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]);
- pPed->bObjectiveCompleted = false;
+ pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_GOTO_CHAR_ON_FOOT, pTarget);
return 0;
}
@@ -4046,7 +4056,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command)
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed);
CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed;
- pPed->bObjectiveCompleted = false;
+ pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_GOTO_CHAR_ON_FOOT, pTarget);
return 0;
}
@@ -4056,7 +4066,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command)
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
- pPed->bObjectiveCompleted = false;
+ pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_LEAVE_VEHICLE, pVehicle);
return 0;
}
@@ -4066,7 +4076,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command)
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
- pPed->bObjectiveCompleted = false;
+ pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, pVehicle);
return 0;
}
@@ -4076,7 +4086,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command)
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
- pPed->bObjectiveCompleted = false;
+ pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicle);
return 0;
}
@@ -4091,7 +4101,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command)
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
- pPed->bObjectiveCompleted = false;
+ pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_DESTROY_CAR, pVehicle);
return 0;
}
@@ -4117,7 +4127,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command)
pos.y = (infY + supY) / 2;
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
float radius = max(pos.x - infX, pos.y - infY);
- pPed->bObjectiveCompleted = false;
+ pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, pos, radius);
return 0;
}
@@ -4157,7 +4167,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command)
CollectParameters(&m_nIp, 3);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed);
- pPed->bObjectiveCompleted = false;
+ pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_FOLLOW_ROUTE, ScriptParams[1], ScriptParams[2]);
return 0;
}
@@ -4331,6 +4341,1165 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command)
}
#endif
+#if 0
+WRAPPER int8 CRunningScript::ProcessCommandsFrom500To599(int32 command) { EAXJMP(0x4429C0); }
+#else
+int8 CRunningScript::ProcessCommandsFrom500To599(int32 command)
+{
+ switch (command) {
+ case COMMAND_IS_CAR_UPSIDEDOWN:
+ {
+ CollectParameters(&m_nIp, 1);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pVehicle);
+ UpdateCompareFlag(pVehicle->GetUp().z <= -0.97f);
+ return 0;
+ }
+ case COMMAND_GET_PLAYER_CHAR:
+ {
+ CollectParameters(&m_nIp, 1);
+ CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ assert(pPed);
+ ScriptParams[0] = CPools::GetPedPool()->GetIndex(pPed);
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
+ case COMMAND_CANCEL_OVERRIDE_RESTART:
+ CRestart::CancelOverrideRestart();
+ return 0;
+ case COMMAND_SET_POLICE_IGNORE_PLAYER:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ assert(pPed);
+ if (ScriptParams[0]) {
+ pPed->m_pWanted->m_bIgnoredByCops = true;
+ CWorld::StopAllLawEnforcersInTheirTracks();
+ }
+ else {
+ pPed->m_pWanted->m_bIgnoredByCops = false;
+ }
+ return 0;
+ }
+ case COMMAND_ADD_PAGER_MESSAGE_WITH_NUMBER:
+ {
+ wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
+ CollectParameters(&m_nIp, 4);
+ CUserDisplay::Pager.AddMessageWithNumber(text, ScriptParams[0], -1, -1, -1, -1, -1,
+ ScriptParams[1], ScriptParams[2], ScriptParams[3]);
+ return 0;
+ }
+ case COMMAND_START_KILL_FRENZY:
+ {
+ wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
+ CollectParameters(&m_nIp, 8);
+ CDarkel::StartFrenzy((eWeaponType)ScriptParams[0], ScriptParams[1], ScriptParams[2],
+ ScriptParams[3], text, ScriptParams[4], ScriptParams[5],
+ ScriptParams[6], ScriptParams[7] != 0, false);
+ return 0;
+ }
+ case COMMAND_READ_KILL_FRENZY_STATUS:
+ {
+ ScriptParams[0] = CDarkel::ReadStatus();
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
+ case COMMAND_SQRT:
+ {
+ CollectParameters(&m_nIp, 1);
+ *(float*)&ScriptParams[0] = Sqrt(*(float*)&ScriptParams[0]);
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
+ case COMMAND_LOCATE_PLAYER_ANY_MEANS_CAR_2D:
+ case COMMAND_LOCATE_PLAYER_ON_FOOT_CAR_2D:
+ case COMMAND_LOCATE_PLAYER_IN_CAR_CAR_2D:
+ case COMMAND_LOCATE_PLAYER_ANY_MEANS_CAR_3D:
+ case COMMAND_LOCATE_PLAYER_ON_FOOT_CAR_3D:
+ case COMMAND_LOCATE_PLAYER_IN_CAR_CAR_3D:
+ LocatePlayerCarCommand(command, &m_nIp);
+ return 0;
+ case COMMAND_LOCATE_CHAR_ANY_MEANS_CAR_2D:
+ case COMMAND_LOCATE_CHAR_ON_FOOT_CAR_2D:
+ case COMMAND_LOCATE_CHAR_IN_CAR_CAR_2D:
+ case COMMAND_LOCATE_CHAR_ANY_MEANS_CAR_3D:
+ case COMMAND_LOCATE_CHAR_ON_FOOT_CAR_3D:
+ case COMMAND_LOCATE_CHAR_IN_CAR_CAR_3D:
+ LocateCharCarCommand(command, &m_nIp);
+ return 0;
+ case COMMAND_GENERATE_RANDOM_FLOAT_IN_RANGE:
+ CollectParameters(&m_nIp, 2);
+ *(float*)&ScriptParams[0] = CGeneral::GetRandomNumberInRange(*(float*)&ScriptParams[0], *(float*)&ScriptParams[1]);
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ case COMMAND_GENERATE_RANDOM_INT_IN_RANGE:
+ CollectParameters(&m_nIp, 2);
+ ScriptParams[0] = CGeneral::GetRandomNumberInRange(ScriptParams[0], ScriptParams[1]);
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ case COMMAND_LOCK_CAR_DOORS:
+ {
+ CollectParameters(&m_nIp, 2);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pVehicle);
+ pVehicle->m_nDoorLock = (eCarLock)ScriptParams[1];
+ return 0;
+ }
+ case COMMAND_EXPLODE_CAR:
+ {
+ CollectParameters(&m_nIp, 1);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pVehicle);
+ pVehicle->BlowUpCar(nil);
+ return 0;
+ }
+ case COMMAND_ADD_EXPLOSION:
+ CollectParameters(&m_nIp, 4);
+ CExplosion::AddExplosion(nil, nil, (eExplosionType)ScriptParams[3], *(CVector*)&ScriptParams[0], 0);
+ return 0;
+
+ case COMMAND_IS_CAR_UPRIGHT:
+ {
+ CollectParameters(&m_nIp, 1);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pVehicle);
+ UpdateCompareFlag(pVehicle->GetUp().z >= 0.0f);
+ return 0;
+ }
+ case COMMAND_TURN_CHAR_TO_FACE_CHAR:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pSourcePed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ CVehicle* pVehicle = pSourcePed->bInVehicle ? pSourcePed->m_pMyVehicle : nil;
+ CVector2D sourcePos = pSourcePed->bInVehicle ? pVehicle->GetPosition() : pSourcePed->GetPosition();
+ CVector2D targetPos = pTargetPed->bInVehicle ? pTargetPed->m_pMyVehicle->GetPosition() : pTargetPed->GetPosition();
+ float angle = CGeneral::GetATanOfXY(sourcePos.x - targetPos.x, sourcePos.y - targetPos.y) + HALFPI;
+ if (angle > TWOPI)
+ angle -= TWOPI;
+ if (!pVehicle) {
+ pSourcePed->m_fRotationCur = angle;
+ pSourcePed->m_fRotationDest = angle;
+ pSourcePed->SetHeading(angle);
+ }
+ return 0;
+ }
+ case COMMAND_TURN_CHAR_TO_FACE_PLAYER:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pSourcePed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pTargetPed = CWorld::Players[ScriptParams[1]].m_pPed;
+ CVehicle* pVehicle = pSourcePed->bInVehicle ? pSourcePed->m_pMyVehicle : nil;
+ CVector2D sourcePos = pSourcePed->bInVehicle ? pVehicle->GetPosition() : pSourcePed->GetPosition();
+ CVector2D targetPos = pTargetPed->bInVehicle ? pTargetPed->m_pMyVehicle->GetPosition() : pTargetPed->GetPosition();
+ float angle = CGeneral::GetATanOfXY(sourcePos.x - targetPos.x, sourcePos.y - targetPos.y) + HALFPI;
+ if (angle > TWOPI)
+ angle -= TWOPI;
+ if (!pVehicle) {
+ pSourcePed->m_fRotationCur = angle;
+ pSourcePed->m_fRotationDest = angle;
+ pSourcePed->SetHeading(angle);
+ }
+ return 0;
+ }
+ case COMMAND_TURN_PLAYER_TO_FACE_CHAR:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pSourcePed = CWorld::Players[ScriptParams[0]].m_pPed;
+ CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ CVehicle* pVehicle = pSourcePed->bInVehicle ? pSourcePed->m_pMyVehicle : nil;
+ CVector2D sourcePos = pSourcePed->bInVehicle ? pVehicle->GetPosition() : pSourcePed->GetPosition();
+ CVector2D targetPos = pTargetPed->bInVehicle ? pTargetPed->m_pMyVehicle->GetPosition() : pTargetPed->GetPosition();
+ float angle = CGeneral::GetATanOfXY(sourcePos.x - targetPos.x, sourcePos.y - targetPos.y) + HALFPI;
+ if (angle > TWOPI)
+ angle -= TWOPI;
+ if (!pVehicle) {
+ pSourcePed->m_fRotationCur = angle;
+ pSourcePed->m_fRotationDest = angle;
+ pSourcePed->SetHeading(angle);
+ }
+ return 0;
+ }
+ case COMMAND_SET_CHAR_OBJ_GOTO_COORD_ON_FOOT:
+ {
+ CollectParameters(&m_nIp, 3);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pPed);
+ CVector target;
+ target.x = *(float*)&ScriptParams[1];
+ target.y = *(float*)&ScriptParams[2];
+ target.z = CWorld::FindGroundZForCoord(target.x, target.y);
+ pPed->bScriptObjectiveCompleted = false;
+ pPed->SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, target);
+ return 0;
+ }
+ /* Not implemented*/
+ //case COMMAND_SET_CHAR_OBJ_GOTO_COORD_IN_CAR:
+ case COMMAND_CREATE_PICKUP:
+ {
+ CollectParameters(&m_nIp, 5);
+ int16 model = ScriptParams[0];
+ if (model < 0)
+ model = CTheScripts::UsedObjectArray[-model].index;
+ CVector pos = *(CVector*)&ScriptParams[2];
+ if (pos.z <= -100.0f)
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + 0.5f;
+ // unused?
+ CPickups::GetActualPickupIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
+ ScriptParams[0] = CPickups::GenerateNewOne(pos, model, ScriptParams[1], 0);
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
+ case COMMAND_HAS_PICKUP_BEEN_COLLECTED:
+ CollectParameters(&m_nIp, 1);
+ UpdateCompareFlag(CPickups::IsPickUpPickedUp(ScriptParams[0]) != 0);
+ return 0;
+ case COMMAND_REMOVE_PICKUP:
+ CollectParameters(&m_nIp, 1);
+ CPickups::RemovePickUp(ScriptParams[0]);
+ return 0;
+ case COMMAND_SET_TAXI_LIGHTS:
+ {
+ CollectParameters(&m_nIp, 2);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pVehicle);
+ assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
+ ((CAutomobile*)pVehicle)->SetTaxiLight(ScriptParams[1] != 0);
+ return 0;
+ }
+ case COMMAND_PRINT_BIG_Q:
+ {
+ wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
+ CollectParameters(&m_nIp, 2);
+ CMessages::AddBigMessageQ(text, ScriptParams[0], ScriptParams[1] - 1);
+ return 0;
+ }
+ case COMMAND_PRINT_WITH_NUMBER_BIG_Q:
+ {
+ wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
+ CollectParameters(&m_nIp, 3);
+ CMessages::AddBigMessageWithNumberQ(text, ScriptParams[1], ScriptParams[2] - 1,
+ ScriptParams[0], -1, -1, -1, -1, -1);
+ return 0;
+ }
+ case COMMAND_SET_GARAGE:
+ {
+ CollectParameters(&m_nIp, 7);
+ float infX = *(float*)&ScriptParams[0];
+ float infY = *(float*)&ScriptParams[1];
+ float infZ = *(float*)&ScriptParams[2];
+ float supX = *(float*)&ScriptParams[3];
+ float supY = *(float*)&ScriptParams[4];
+ float supZ = *(float*)&ScriptParams[5];
+ if (infX > supX) {
+ infX = *(float*)&ScriptParams[3];
+ supX = *(float*)&ScriptParams[0];
+ }
+ if (infY > supY) {
+ infY = *(float*)&ScriptParams[4];
+ supY = *(float*)&ScriptParams[1];
+ }
+ if (infZ > supZ) {
+ infZ = *(float*)&ScriptParams[5];
+ supZ = *(float*)&ScriptParams[2];
+ }
+ ScriptParams[0] = CGarages::AddOne(infX, infY, infZ, supX, supY, supZ, ScriptParams[6], 0);
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
+ case COMMAND_SET_GARAGE_WITH_CAR_MODEL:
+ {
+ CollectParameters(&m_nIp, 8);
+ float infX = *(float*)&ScriptParams[0];
+ float infY = *(float*)&ScriptParams[1];
+ float infZ = *(float*)&ScriptParams[2];
+ float supX = *(float*)&ScriptParams[3];
+ float supY = *(float*)&ScriptParams[4];
+ float supZ = *(float*)&ScriptParams[5];
+ if (infX > supX) {
+ infX = *(float*)&ScriptParams[3];
+ supX = *(float*)&ScriptParams[0];
+ }
+ if (infY > supY) {
+ infY = *(float*)&ScriptParams[4];
+ supY = *(float*)&ScriptParams[1];
+ }
+ if (infZ > supZ) {
+ infZ = *(float*)&ScriptParams[5];
+ supZ = *(float*)&ScriptParams[2];
+ }
+ ScriptParams[0] = CGarages::AddOne(infX, infY, infZ, supX, supY, supZ, ScriptParams[6], ScriptParams[7]);
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
+ case COMMAND_SET_TARGET_CAR_FOR_MISSION_GARAGE:
+ {
+ CollectParameters(&m_nIp, 2);
+ CVehicle* pTarget;
+ if (ScriptParams[1] >= 0) {
+ pTarget = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
+ assert(pTarget);
+ }
+ else {
+ pTarget = nil;
+ }
+ CGarages::SetTargetCarForMissonGarage(ScriptParams[0], pTarget);
+ return 0;
+ }
+ case COMMAND_IS_CAR_IN_MISSION_GARAGE:
+ CollectParameters(&m_nIp, 1);
+ UpdateCompareFlag(CGarages::HasCarBeenDroppedOffYet(ScriptParams[0]));
+ return 0;
+ case COMMAND_SET_FREE_BOMBS:
+ CollectParameters(&m_nIp, 1);
+ CGarages::BombsAreFree = (ScriptParams[0] != 0);
+ return 0;
+ //case COMMAND_SET_POWERPOINT:
+ case COMMAND_SET_ALL_TAXI_LIGHTS:
+ CollectParameters(&m_nIp, 1);
+ CAutomobile::SetAllTaxiLights(ScriptParams[0] != 0);
+ return 0;
+ case COMMAND_IS_CAR_ARMED_WITH_ANY_BOMB:
+ {
+ CollectParameters(&m_nIp, 1);
+ CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pCar);
+ assert(pCar->m_vehType == VEHICLE_TYPE_CAR);
+ UpdateCompareFlag(pCar->m_bombType != 0); //TODO: enum
+ return 0;
+ }
+ case COMMAND_APPLY_BRAKES_TO_PLAYERS_CAR:
+ CollectParameters(&m_nIp, 2);
+ CPad::GetPad(ScriptParams[0])->bApplyBrakes = (ScriptParams[1] != 0);
+ return 0;
+ case COMMAND_SET_PLAYER_HEALTH:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ assert(pPed);
+ pPed->m_fHealth = *(float*)&ScriptParams[1];
+ return 0;
+ }
+ case COMMAND_SET_CHAR_HEALTH:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pPed);
+ float health = *(float*)&ScriptParams[1];
+ if (health != 0.0f) {
+ pPed->m_fHealth = *(float*)&ScriptParams[1];
+ }
+ else if (pPed->bInVehicle) {
+ pPed->SetDead();
+ if (!pPed->IsPlayer())
+ pPed->FlagToDestroyWhenNextProcessed();
+ }
+ else {
+ pPed->SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f);
+ }
+ return 0;
+ }
+ case COMMAND_SET_CAR_HEALTH:
+ {
+ CollectParameters(&m_nIp, 2);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pVehicle);
+ pVehicle->m_fHealth = *(float*)&ScriptParams[1];
+ return 0;
+ }
+ case COMMAND_GET_PLAYER_HEALTH:
+ {
+ CollectParameters(&m_nIp, 1);
+ CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ assert(pPed);
+ ScriptParams[0] = pPed->m_fHealth; // correct cast float to int
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
+ case COMMAND_GET_CHAR_HEALTH:
+ {
+ CollectParameters(&m_nIp, 1);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pPed);
+ ScriptParams[0] = pPed->m_fHealth; // correct cast float to int
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
+ case COMMAND_GET_CAR_HEALTH:
+ {
+ CollectParameters(&m_nIp, 1);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pVehicle);
+ ScriptParams[0] = pVehicle->m_fHealth; // correct cast float to int
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
+ case COMMAND_IS_CAR_ARMED_WITH_BOMB:
+ {
+ CollectParameters(&m_nIp, 2);
+ CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pCar);
+ assert(pCar->m_vehType == VEHICLE_TYPE_CAR);
+ UpdateCompareFlag(pCar->m_bombType == ScriptParams[1]); //TODO: enum
+ return 0;
+ }
+ case COMMAND_CHANGE_CAR_COLOUR:
+ {
+ CollectParameters(&m_nIp, 3);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ if (ScriptParams[1] >= 256 || ScriptParams[2] >= 256)
+ debug("CHANGE_CAR_COLOUR - Colours must be less than %d", 256);
+ pVehicle->m_currentColour1 = ScriptParams[1];
+ pVehicle->m_currentColour2 = ScriptParams[2];
+ return 0;
+ }
+ case COMMAND_SWITCH_PED_ROADS_ON:
+ {
+ CollectParameters(&m_nIp, 6);
+ float infX = *(float*)&ScriptParams[0];
+ float infY = *(float*)&ScriptParams[1];
+ float infZ = *(float*)&ScriptParams[2];
+ float supX = *(float*)&ScriptParams[3];
+ float supY = *(float*)&ScriptParams[4];
+ float supZ = *(float*)&ScriptParams[5];
+ if (infX > supX) {
+ infX = *(float*)&ScriptParams[3];
+ supX = *(float*)&ScriptParams[0];
+ }
+ if (infY > supY) {
+ infY = *(float*)&ScriptParams[4];
+ supY = *(float*)&ScriptParams[1];
+ }
+ if (infZ > supZ) {
+ infZ = *(float*)&ScriptParams[5];
+ supZ = *(float*)&ScriptParams[2];
+ }
+ ThePaths.SwitchPedRoadsOffInArea(infX, supX, infY, supY, infZ, supZ, false);
+ return 0;
+ }
+ case COMMAND_SWITCH_PED_ROADS_OFF:
+ {
+ CollectParameters(&m_nIp, 6);
+ float infX = *(float*)&ScriptParams[0];
+ float infY = *(float*)&ScriptParams[1];
+ float infZ = *(float*)&ScriptParams[2];
+ float supX = *(float*)&ScriptParams[3];
+ float supY = *(float*)&ScriptParams[4];
+ float supZ = *(float*)&ScriptParams[5];
+ if (infX > supX) {
+ infX = *(float*)&ScriptParams[3];
+ supX = *(float*)&ScriptParams[0];
+ }
+ if (infY > supY) {
+ infY = *(float*)&ScriptParams[4];
+ supY = *(float*)&ScriptParams[1];
+ }
+ if (infZ > supZ) {
+ infZ = *(float*)&ScriptParams[5];
+ supZ = *(float*)&ScriptParams[2];
+ }
+ ThePaths.SwitchPedRoadsOffInArea(infX, supX, infY, supY, infZ, supZ, true);
+ return 0;
+ }
+ case COMMAND_CHAR_LOOK_AT_CHAR_ALWAYS:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pSourcePed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pSourcePed);
+ CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ assert(pTargetPed);
+ pSourcePed->SetLookFlag(pTargetPed, true);
+ pSourcePed->SetLookTimer(60000);
+ return 0;
+ }
+ case COMMAND_CHAR_LOOK_AT_PLAYER_ALWAYS:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pSourcePed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pSourcePed);
+ CPed* pTargetPed = CWorld::Players[ScriptParams[1]].m_pPed;
+ assert(pTargetPed);
+ pSourcePed->SetLookFlag(pTargetPed, true);
+ pSourcePed->SetLookTimer(60000);
+ return 0;
+ }
+ case COMMAND_PLAYER_LOOK_AT_CHAR_ALWAYS:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pSourcePed = CWorld::Players[ScriptParams[0]].m_pPed;
+ assert(pSourcePed);
+ CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ assert(pTargetPed);
+ pSourcePed->SetLookFlag(pTargetPed, true);
+ pSourcePed->SetLookTimer(60000);
+ return 0;
+ }
+ case COMMAND_STOP_CHAR_LOOKING:
+ {
+ CollectParameters(&m_nIp, 1);
+ CPed* pSourcePed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pSourcePed);
+ pSourcePed->ClearLookFlag();
+ pSourcePed->bIsRestoringLook = false;
+ if (pSourcePed->GetPedState() == PED_LOOK_HEADING || pSourcePed->GetPedState() == PED_LOOK_ENTITY)
+ pSourcePed->RestorePreviousState();
+ return 0;
+ }
+ case COMMAND_STOP_PLAYER_LOOKING:
+ {
+ CollectParameters(&m_nIp, 1);
+ CPed* pSourcePed = CWorld::Players[ScriptParams[0]].m_pPed;
+ assert(pSourcePed);
+ pSourcePed->ClearLookFlag();
+ pSourcePed->bIsRestoringLook = false;
+ if (pSourcePed->GetPedState() == PED_LOOK_HEADING || pSourcePed->GetPedState() == PED_LOOK_ENTITY)
+ pSourcePed->RestorePreviousState();
+ return 0;
+ }
+ case COMMAND_SWITCH_HELICOPTER:
+ CollectParameters(&m_nIp, 1);
+ CHeli::ActivateHeli(ScriptParams[0] != 0);
+ return 0;
+
+ //case COMMAND_SET_GANG_ATTITUDE:
+ //case COMMAND_SET_GANG_GANG_ATTITUDE:
+ //case COMMAND_SET_GANG_PLAYER_ATTITUDE:
+ //case COMMAND_SET_GANG_PED_MODELS:
+ case COMMAND_SET_GANG_CAR_MODEL:
+ CollectParameters(&m_nIp, 2);
+ CGangs::SetGangVehicleModel(ScriptParams[0], ScriptParams[1]);
+ return 0;
+ case COMMAND_SET_GANG_WEAPONS:
+ CollectParameters(&m_nIp, 3);
+ CGangs::SetGangWeapons(ScriptParams[0], (eWeaponType)ScriptParams[1], (eWeaponType)ScriptParams[2]);
+ return 0;
+ case COMMAND_SET_CHAR_OBJ_RUN_TO_AREA:
+ {
+ CollectParameters(&m_nIp, 5);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pPed);
+ float infX = *(float*)&ScriptParams[1];
+ float infY = *(float*)&ScriptParams[2];
+ float supX = *(float*)&ScriptParams[3];
+ float supY = *(float*)&ScriptParams[4];
+ if (infX > supX) {
+ infX = *(float*)&ScriptParams[3];
+ supX = *(float*)&ScriptParams[1];
+ }
+ 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);
+ pPed->bScriptObjectiveCompleted = false;
+ pPed->SetObjective(OBJECTIVE_RUN_TO_AREA, pos, radius);
+ return 0;
+ }
+ case COMMAND_SET_CHAR_OBJ_RUN_TO_COORD:
+ {
+ CollectParameters(&m_nIp, 3);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pPed);
+ CVector pos;
+ pos.x = *(float*)&ScriptParams[1];
+ pos.y = *(float*)&ScriptParams[2];
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ pPed->bScriptObjectiveCompleted = false;
+ pPed->SetObjective(OBJECTIVE_RUN_TO_AREA, pos);
+ return 0;
+ }
+ case COMMAND_IS_PLAYER_TOUCHING_OBJECT_ON_FOOT:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ assert(pPed);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]);
+ bool isTouching = false;
+ if (pPed->bInVehicle)
+ isTouching = false;
+ else if (pPed->GetHasCollidedWith(pObject))
+ isTouching = true;
+ UpdateCompareFlag(isTouching);
+ return 0;
+ }
+ case COMMAND_IS_CHAR_TOUCHING_OBJECT_ON_FOOT:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pPed);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]);
+ bool isTouching = false;
+ if (pPed->bInVehicle && pPed->m_pMyVehicle)
+ isTouching = false;
+ else if (pPed->GetHasCollidedWith(pObject))
+ isTouching = true;
+ UpdateCompareFlag(isTouching);
+ return 0;
+ }
+ case COMMAND_LOAD_SPECIAL_CHARACTER:
+ {
+ CollectParameters(&m_nIp, 1);
+ char name[16];
+ strncpy(name, (char*)&CTheScripts::ScriptSpace[m_nIp], 8);
+ for (int i = 0; i < 8; i++) {
+ if (name[i] >= 'A' && name[i] <= 'Z')
+ name[i] += 'a' - 'A';
+ }
+ CStreaming::RequestSpecialChar(ScriptParams[0] - 1, name, STREAMFLAGS_DEPENDENCY | STREAMFLAGS_SCRIPTOWNED);
+ m_nIp += 8;
+ return 0;
+ }
+ case COMMAND_HAS_SPECIAL_CHARACTER_LOADED:
+ {
+ CollectParameters(&m_nIp, 1);
+ UpdateCompareFlag(CStreaming::HasSpecialCharLoaded(ScriptParams[0] - 1));
+ return 0;
+ }
+ case COMMAND_FLASH_CAR:
+ {
+ CollectParameters(&m_nIp, 2);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pVehicle);
+ pVehicle->bHasBlip = (ScriptParams[1] != 0);
+ return 0;
+ }
+ case COMMAND_FLASH_CHAR:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pPed);
+ pPed->bHasBlip = (ScriptParams[1] != 0);
+ return 0;
+ }
+ case COMMAND_FLASH_OBJECT:
+ {
+ CollectParameters(&m_nIp, 2);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
+ assert(pObject);
+ pObject->bHasBlip = (ScriptParams[1] != 0);
+ return 0;
+ }
+ case COMMAND_IS_PLAYER_IN_REMOTE_MODE:
+ CollectParameters(&m_nIp, 2);
+ UpdateCompareFlag(CWorld::Players[ScriptParams[0]].IsPlayerInRemoteMode());
+ return 0;
+ case COMMAND_ARM_CAR_WITH_BOMB:
+ {
+ CollectParameters(&m_nIp, 2);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pVehicle);
+ assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
+ ((CAutomobile*)pVehicle)->m_bombType = ScriptParams[1];
+ ((CAutomobile*)pVehicle)->m_pBombRigger = FindPlayerPed();
+ return 0;
+ }
+ case COMMAND_SET_CHAR_PERSONALITY:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pPed);
+ pPed->SetPedStats((ePedStats)ScriptParams[1]);
+ return 0;
+ }
+ case COMMAND_SET_CUTSCENE_OFFSET:
+ CollectParameters(&m_nIp, 3);
+ CCutsceneMgr::SetCutsceneOffset(*(CVector*)&ScriptParams[0]);
+ return 0;
+ case COMMAND_SET_ANIM_GROUP_FOR_CHAR:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pPed);
+ pPed->m_animGroup = (AssocGroupId)ScriptParams[1];
+ return 0;
+ }
+ case COMMAND_SET_ANIM_GROUP_FOR_PLAYER:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ assert(pPed);
+ pPed->m_animGroup = (AssocGroupId)ScriptParams[1];
+ return 0;
+ }
+ case COMMAND_REQUEST_MODEL:
+ {
+ CollectParameters(&m_nIp, 1);
+ int model = ScriptParams[0];
+ if (model < 0)
+ model = CTheScripts::UsedObjectArray[-model].index;
+ CStreaming::RequestModel(model, STREAMFLAGS_DEPENDENCY | STREAMFLAGS_NOFADE | STREAMFLAGS_SCRIPTOWNED);
+ return 0;
+ }
+ case COMMAND_HAS_MODEL_LOADED:
+ {
+ CollectParameters(&m_nIp, 1);
+ int model = ScriptParams[0];
+ if (model < 0)
+ model = CTheScripts::UsedObjectArray[-model].index;
+ UpdateCompareFlag(CStreaming::HasModelLoaded(model));
+ return 0;
+ }
+ case COMMAND_MARK_MODEL_AS_NO_LONGER_NEEDED:
+ {
+ CollectParameters(&m_nIp, 1);
+ int model = ScriptParams[0];
+ if (model < 0)
+ model = CTheScripts::UsedObjectArray[-model].index;
+ CStreaming::SetMissionDoesntRequireModel(model);
+ return 0;
+ }
+ case COMMAND_GRAB_PHONE:
+ {
+ CollectParameters(&m_nIp, 2);
+ ScriptParams[0] = gPhoneInfo.GrabPhone(*(float*)&ScriptParams[0], *(float*)&ScriptParams[1]);
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
+ case COMMAND_SET_REPEATED_PHONE_MESSAGE:
+ {
+ CollectParameters(&m_nIp, 1);
+ wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
+ gPhoneInfo.SetPhoneMessage_Repeatedly(ScriptParams[0], text, nil, nil, nil, nil, nil);
+ return 0;
+ }
+ case COMMAND_SET_PHONE_MESSAGE:
+ {
+ CollectParameters(&m_nIp, 1);
+ wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
+ gPhoneInfo.SetPhoneMessage_JustOnce(ScriptParams[0], text, nil, nil, nil, nil, nil);
+ return 0;
+ }
+ case COMMAND_HAS_PHONE_DISPLAYED_MESSAGE:
+ {
+ CollectParameters(&m_nIp, 1);
+ gPhoneInfo.HasMessageBeenDisplayed(ScriptParams[0]);
+ return 0;
+ }
+ case COMMAND_TURN_PHONE_OFF:
+ {
+ CollectParameters(&m_nIp, 1);
+ gPhoneInfo.SetPhoneMessage_JustOnce(ScriptParams[0], nil, nil, nil, nil, nil, nil);
+ return 0;
+ }
+ case COMMAND_DRAW_CORONA:
+ {
+ CollectParameters(&m_nIp, 9);
+ CVector pos = *(CVector*)&ScriptParams[0];
+ if (pos.z <= -100.0f)
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ CCoronas::RegisterCorona((uint32)this + m_nIp, ScriptParams[6], ScriptParams[7], ScriptParams[8],
+ 255, pos, *(float*)&ScriptParams[3], 150.0f, ScriptParams[4], ScriptParams[5], 1, 0, 0, 0.0f);
+ return 0;
+ }
+ case COMMAND_DRAW_LIGHT:
+ {
+ CollectParameters(&m_nIp, 6);
+ CVector pos = *(CVector*)&ScriptParams[0];
+ CVector unused(0.0f, 0.0f, 0.0f);
+ CPointLights::AddLight(0, *(CVector*)&ScriptParams[0], CVector(0.0f, 0.0f, 0.0f), 12.0f,
+ ScriptParams[3] / 255.0f, ScriptParams[4] / 255.0f, ScriptParams[5] / 255.0f, 0, true);
+ return 0;
+ }
+ case COMMAND_STORE_WEATHER:
+ CWeather::StoreWeatherState();
+ return 0;
+ case COMMAND_RESTORE_WEATHER:
+ CWeather::RestoreWeatherState();
+ return 0;
+ case COMMAND_STORE_CLOCK:
+ CClock::StoreClock();
+ return 0;
+ case COMMAND_RESTORE_CLOCK:
+ CClock::RestoreClock();
+ return 0;
+ case COMMAND_RESTART_CRITICAL_MISSION:
+ {
+ CollectParameters(&m_nIp, 4);
+ CVector pos = *(CVector*)&ScriptParams[0];
+ if (pos.z <= -100.0f)
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ CRestart::OverrideNextRestart(pos, *(float*)&ScriptParams[3]);
+ if (CWorld::Players[CWorld::PlayerInFocus].m_WBState != WBSTATE_PLAYING) //TODO: enum
+ printf("RESTART_CRITICAL_MISSION - Player state is not PLAYING\n");
+ CWorld::Players[CWorld::PlayerInFocus].PlayerFailedCriticalMission();
+ return 0;
+ }
+ case COMMAND_IS_PLAYER_PLAYING:
+ {
+ CollectParameters(&m_nIp, 1);
+ UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_WBState == WBSTATE_PLAYING);
+ return 0;
+ }
+ //case COMMAND_SET_COLL_OBJ_NO_OBJ:
+ default:
+ assert(0);
+ }
+ return -1;
+}
+#endif
+
+#if 0
+WRAPPER int8 CRunningScript::ProcessCommandsFrom600To699(int32 command) { EAXJMP(0x444B20); }
+#else
+int8 CRunningScript::ProcessCommandsFrom600To699(int32 command)
+{
+ switch (command){
+ /* Collective commands are not implemented until LCS.
+ case COMMAND_SET_COLL_OBJ_WAIT_ON_FOOT:
+ case COMMAND_SET_COLL_OBJ_FLEE_ON_FOOT_TILL_SAFE:
+ case COMMAND_SET_COLL_OBJ_GUARD_SPOT:
+ case COMMAND_SET_COLL_OBJ_GUARD_AREA:
+ case COMMAND_SET_COLL_OBJ_WAIT_IN_CAR:
+ case COMMAND_SET_COLL_OBJ_KILL_CHAR_ON_FOOT:
+ case COMMAND_SET_COLL_OBJ_KILL_PLAYER_ON_FOOT:
+ case COMMAND_SET_COLL_OBJ_KILL_CHAR_ANY_MEANS:
+ case COMMAND_SET_COLL_OBJ_KILL_PLAYER_ANY_MEANS:
+ case COMMAND_SET_COLL_OBJ_FLEE_CHAR_ON_FOOT_TILL_SAFE:
+ case COMMAND_SET_COLL_OBJ_FLEE_PLAYER_ON_FOOT_TILL_SAFE:
+ case COMMAND_SET_COLL_OBJ_FLEE_CHAR_ON_FOOT_ALWAYS:
+ case COMMAND_SET_COLL_OBJ_FLEE_PLAYER_ON_FOOT_ALWAYS:
+ case COMMAND_SET_COLL_OBJ_GOTO_CHAR_ON_FOOT:
+ case COMMAND_SET_COLL_OBJ_GOTO_PLAYER_ON_FOOT:
+ case COMMAND_SET_COLL_OBJ_LEAVE_CAR:
+ case COMMAND_SET_COLL_OBJ_ENTER_CAR_AS_PASSENGER:
+ case COMMAND_SET_COLL_OBJ_ENTER_CAR_AS_DRIVER:
+ 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:
+ case COMMAND_SET_COLL_OBJ_GOTO_AREA_ON_FOOT:
+ 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:
+ case COMMAND_SET_COLL_OBJ_GOTO_COORD_ON_FOOT:
+ case COMMAND_SET_COLL_OBJ_GOTO_COORD_IN_CAR:
+ case COMMAND_SET_COLL_OBJ_RUN_TO_AREA:
+ case COMMAND_SET_COLL_OBJ_RUN_TO_COORD:
+ case COMMAND_ADD_PEDS_IN_AREA_TO_COLL:
+ case COMMAND_ADD_PEDS_IN_VEHICLE_TO_COLL:
+ case COMMAND_CLEAR_COLL:
+ case COMMAND_IS_COLL_IN_CARS:
+ 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:
+ case COMMAND_LOCATE_COLL_ANY_MEANS_CHAR_2D:
+ case COMMAND_LOCATE_COLL_ON_FOOT_CHAR_2D:
+ case COMMAND_LOCATE_COLL_IN_CAR_CHAR_2D:
+ case COMMAND_LOCATE_COLL_ANY_MEANS_CAR_2D:
+ case COMMAND_LOCATE_COLL_ON_FOOT_CAR_2D:
+ case COMMAND_LOCATE_COLL_IN_CAR_CAR_2D:
+ case COMMAND_LOCATE_COLL_ANY_MEANS_PLAYER_2D:
+ case COMMAND_LOCATE_COLL_ON_FOOT_PLAYER_2D:
+ case COMMAND_LOCATE_COLL_IN_CAR_PLAYER_2D:
+ 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:
+ case COMMAND_GET_NUMBER_OF_PEDS_IN_COLL:
+ */
+ case COMMAND_SET_CHAR_HEED_THREATS:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pPed);
+ pPed->bRespondsToThreats = (ScriptParams[1] != 0);
+ return 0;
+ }
+ case COMMAND_SET_PLAYER_HEED_THREATS:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ assert(pPed);
+ pPed->bRespondsToThreats = (ScriptParams[1] != 0);
+ return 0;
+ }
+ case COMMAND_GET_CONTROLLER_MODE:
+ ScriptParams[0] = 0;
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ case COMMAND_SET_CAN_RESPRAY_CAR:
+ {
+ CollectParameters(&m_nIp, 2);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pVehicle);
+ assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
+ ((CAutomobile*)pVehicle)->bFixedColour = (ScriptParams[1] == 0);
+ return 0;
+ }
+ case COMMAND_IS_TAXI:
+ {
+ CollectParameters(&m_nIp, 1);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pVehicle);
+ int mi = pVehicle->GetModelIndex();
+ UpdateCompareFlag(mi == MI_TAXI || mi == MI_CABBIE || mi == MI_BORGNINE);
+ return 0;
+ }
+ case COMMAND_UNLOAD_SPECIAL_CHARACTER:
+ CollectParameters(&m_nIp, 1);
+ CStreaming::SetMissionDoesntRequireSpecialChar(ScriptParams[0] - 1);
+ return 0;
+ case COMMAND_RESET_NUM_OF_MODELS_KILLED_BY_PLAYER:
+ CDarkel::ResetModelsKilledByPlayer();
+ return 0;
+ case COMMAND_GET_NUM_OF_MODELS_KILLED_BY_PLAYER:
+ CollectParameters(&m_nIp, 1);
+ ScriptParams[0] = CDarkel::QueryModelsKilledByPlayer(ScriptParams[0]);
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ case COMMAND_ACTIVATE_GARAGE:
+ CollectParameters(&m_nIp, 1);
+ CGarages::ActivateGarage(ScriptParams[0]);
+ return 0;
+ case COMMAND_SWITCH_TAXI_TIMER:
+ {
+ CollectParameters(&m_nIp, 1);
+ if (ScriptParams[0] != 0){
+ CWorld::Players[CWorld::PlayerInFocus].m_nSwitchTaxiTime = CTimer::GetTimeInMilliseconds();
+ CWorld::Players[CWorld::PlayerInFocus].m_bSwitchTaxi = true;
+ }else{
+ CWorld::Players[CWorld::PlayerInFocus].m_bSwitchTaxi = false;
+ }
+ return 0;
+ }
+ case COMMAND_CREATE_OBJECT_NO_OFFSET:
+ {
+ CollectParameters(&m_nIp, 4);
+ int mi = ScriptParams[0] >= 0 ? ScriptParams[0] : CTheScripts::UsedObjectArray[-ScriptParams[0]].index;
+ CObject* pObj = new CObject(mi, 0);
+ pObj->ObjectCreatedBy = MISSION_OBJECT;
+ CVector pos = *(CVector*)&ScriptParams[1];
+ if (pos.z <= -100.0f)
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ pObj->GetPosition() = pos;
+ pObj->SetOrientation(0.0f, 0.0f, 0.0f);
+ pObj->GetMatrix().UpdateRW();
+ pObj->UpdateRwFrame();
+ CTheScripts::ClearSpaceForMissionEntity(pos, pObj);
+ CWorld::Add(pObj);
+ ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pObj);
+ StoreParameters(&m_nIp, 1);
+ if (m_bIsMissionScript)
+ CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_OBJECT);
+ return 0;
+ }
+ case COMMAND_IS_BOAT:
+ {
+ CollectParameters(&m_nIp, 1);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pVehicle);
+ UpdateCompareFlag(pVehicle->m_vehType == VEHICLE_TYPE_BOAT);
+ return 0;
+ }
+ case COMMAND_SET_CHAR_OBJ_GOTO_AREA_ANY_MEANS:
+ {
+ CollectParameters(&m_nIp, 5);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pPed);
+ float infX = *(float*)&ScriptParams[1];
+ float infY = *(float*)&ScriptParams[2];
+ float supX = *(float*)&ScriptParams[3];
+ float supY = *(float*)&ScriptParams[4];
+ if (infX > supX) {
+ infX = *(float*)&ScriptParams[3];
+ supX = *(float*)&ScriptParams[1];
+ }
+ 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);
+ pPed->bScriptObjectiveCompleted = false;
+ pPed->SetObjective(OBJECTIVE_GOTO_AREA_ANY_MEANS, pos, radius);
+ return 0;
+ }
+ //case COMMAND_SET_COLL_OBJ_GOTO_AREA_ANY_MEANS:
+ case COMMAND_IS_PLAYER_STOPPED:
+ {
+ CollectParameters(&m_nIp, 1);
+ CPlayerInfo* pPlayer = &CWorld::Players[ScriptParams[0]];
+ UpdateCompareFlag(CTheScripts::IsPlayerStopped(pPlayer));
+ return 0;
+ }
+ case COMMAND_IS_CHAR_STOPPED:
+ {
+ CollectParameters(&m_nIp, 1);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ UpdateCompareFlag(CTheScripts::IsPedStopped(pPed));
+ return 0;
+ }
+ case COMMAND_MESSAGE_WAIT:
+ CollectParameters(&m_nIp, 2);
+ m_nWakeTime = CTimer::GetTimeInMilliseconds() + ScriptParams[0];
+ if (ScriptParams[1] != 0)
+ m_bSkipWakeTime = true;
+ return 1;
+ case COMMAND_ADD_PARTICLE_EFFECT:
+ {
+ CollectParameters(&m_nIp, 5);
+ CVector pos = *(CVector*)&ScriptParams[0];
+ if (pos.z <= 100.0f)
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ CParticleObject::AddObject(ScriptParams[0], pos, ScriptParams[4] != 0);
+ return 0;
+ }
+ case COMMAND_SWITCH_WIDESCREEN:
+ CollectParameters(&m_nIp, 1);
+ if (ScriptParams[0] != 0)
+ TheCamera.SetWideScreenOn();
+ else
+ TheCamera.SetWideScreenOff();
+ return 0;
+ case COMMAND_ADD_SPRITE_BLIP_FOR_CAR:
+ {
+ CollectParameters(&m_nIp, 2);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pVehicle);
+ CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
+ int id = CRadar::SetEntityBlip(BLIP_CAR, ScriptParams[0], 0, BLIP_DISPLAY_BOTH);
+ CRadar::SetBlipSprite(id, ScriptParams[1]);
+ ScriptParams[0] = id;
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
+ case COMMAND_ADD_SPRITE_BLIP_FOR_CHAR:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pPed);
+ CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
+ int id = CRadar::SetEntityBlip(BLIP_CHAR, ScriptParams[0], 1, BLIP_DISPLAY_BOTH);
+ CRadar::SetBlipSprite(id, ScriptParams[1]);
+ ScriptParams[0] = id;
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
+ case COMMAND_ADD_SPRITE_BLIP_FOR_OBJECT:
+ {
+ CollectParameters(&m_nIp, 2);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
+ assert(pObject);
+ CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
+ int id = CRadar::SetEntityBlip(BLIP_OBJECT, ScriptParams[0], 6, BLIP_DISPLAY_BOTH);
+ CRadar::SetBlipSprite(id, ScriptParams[1]);
+ ScriptParams[0] = id;
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
+ case COMMAND_ADD_SPRITE_BLIP_FOR_CONTACT_POINT:
+ {
+ CollectParameters(&m_nIp, 4);
+ CVector pos = *(CVector*)&ScriptParams[0];
+ if (pos.z <= -100.0f)
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
+ int id = CRadar::SetCoordBlip(BLIP_CONTACT_POINT, pos, 2, BLIP_DISPLAY_BOTH);
+ CRadar::SetBlipSprite(id, ScriptParams[3]);
+ ScriptParams[0] = id;
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
+ case COMMAND_ADD_SPRITE_BLIP_FOR_COORD:
+ {
+ CollectParameters(&m_nIp, 4);
+ CVector pos = *(CVector*)&ScriptParams[0];
+ if (pos.z <= -100.0f)
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
+ int id = CRadar::SetCoordBlip(BLIP_COORD, pos, 5, BLIP_DISPLAY_BOTH);
+ CRadar::SetBlipSprite(id, ScriptParams[3]);
+ ScriptParams[0] = id;
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
+ case COMMAND_SET_CHAR_ONLY_DAMAGED_BY_PLAYER:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pPed);
+ pPed->bOnlyDamagedByPlayer = (ScriptParams[1] != 0);
+ return 0;
+ }
+ case COMMAND_SET_CAR_ONLY_DAMAGED_BY_PLAYER:
+ {
+ CollectParameters(&m_nIp, 2);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pVehicle);
+ pVehicle->bOnlyDamagedByPlayer = (ScriptParams[1] != 0);
+ return 0;
+ }
+ case COMMAND_SET_CHAR_PROOFS:
+ {
+ CollectParameters(&m_nIp, 6);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pPed);
+ pPed->bBulletProof = (ScriptParams[1] != 0);
+ pPed->bFireProof = (ScriptParams[2] != 0);
+ pPed->bExplosionProof = (ScriptParams[3] != 0);
+ pPed->bCollisionProof = (ScriptParams[4] != 0);
+ pPed->bMeleeProof = (ScriptParams[5] != 0);
+ return 0;
+ }
+ case COMMAND_SET_CAR_PROOFS:
+ {
+ CollectParameters(&m_nIp, 6);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pVehicle);
+ pVehicle->bBulletProof = (ScriptParams[1] != 0);
+ pVehicle->bFireProof = (ScriptParams[2] != 0);
+ pVehicle->bExplosionProof = (ScriptParams[3] != 0);
+ pVehicle->bCollisionProof = (ScriptParams[4] != 0);
+ pVehicle->bMeleeProof = (ScriptParams[5] != 0);
+ return 0;
+ }
+ case COMMAND_IS_PLAYER_IN_ANGLED_AREA_2D:
+ case COMMAND_IS_PLAYER_IN_ANGLED_AREA_ON_FOOT_2D:
+ case COMMAND_IS_PLAYER_IN_ANGLED_AREA_IN_CAR_2D:
+ case COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_2D:
+ case COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_ON_FOOT_2D:
+ case COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_IN_CAR_2D:
+ case COMMAND_IS_PLAYER_IN_ANGLED_AREA_3D:
+ case COMMAND_IS_PLAYER_IN_ANGLED_AREA_ON_FOOT_3D:
+ case COMMAND_IS_PLAYER_IN_ANGLED_AREA_IN_CAR_3D:
+ case COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_3D:
+ case COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_ON_FOOT_3D:
+ case COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_IN_CAR_3D:
+ PlayerInAngledAreaCheckCommand(command, &m_nIp);
+ return 0;
+ case COMMAND_DEACTIVATE_GARAGE:
+ CollectParameters(&m_nIp, 1);
+ CGarages::DeActivateGarage(ScriptParams[0]);
+ return 0;
+ case COMMAND_GET_NUMBER_OF_CARS_COLLECTED_BY_GARAGE:
+ CollectParameters(&m_nIp, 1);
+ ScriptParams[0] = CGarages::QueryCarsCollected(ScriptParams[0]);
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ case COMMAND_HAS_CAR_BEEN_TAKEN_TO_GARAGE:
+ CollectParameters(&m_nIp, 2);
+ UpdateCompareFlag(CGarages::HasThisCarBeenCollected(ScriptParams[0], ScriptParams[1] - 1));
+ return 0;
+ default:
+ assert(0);
+ }
+ return -1;
+}
+#endif
+
int16 CRunningScript::GetPadState(uint16 pad, uint16 button)
{
CPad* pPad = CPad::GetPad(pad);
@@ -4365,8 +5534,6 @@ bool CTheScripts::IsVehicleStopped(CVehicle* pVehicle)
return 0.01f * CTimer::GetTimeStep() >= pVehicle->m_fDistanceTravelled;
}
-WRAPPER int8 CRunningScript::ProcessCommandsFrom500To599(int32 command) { EAXJMP(0x4429C0); }
-WRAPPER int8 CRunningScript::ProcessCommandsFrom600To699(int32 command) { EAXJMP(0x444B20); }
WRAPPER int8 CRunningScript::ProcessCommandsFrom700To799(int32 command) { EAXJMP(0x4458A0); }
WRAPPER int8 CRunningScript::ProcessCommandsFrom800To899(int32 command) { EAXJMP(0x448240); }
WRAPPER int8 CRunningScript::ProcessCommandsFrom900To999(int32 command) { EAXJMP(0x44CB80); }
@@ -4400,6 +5567,8 @@ WRAPPER void CTheScripts::CleanUpThisObject(CObject*) { EAXJMP(0x454910); }
WRAPPER void CTheScripts::ReadObjectNamesFromScript() { EAXJMP(0x454960); }
WRAPPER void CTheScripts::UpdateObjectIndices() { EAXJMP(0x454AD0); }
WRAPPER void CTheScripts::ReadMultiScriptFileOffsetsFromScript() { EAXJMP(0x454BC0); }
+WRAPPER bool CTheScripts::IsPedStopped(CPed*) { EAXJMP(0x454670); }
+WRAPPER bool CTheScripts::IsPlayerStopped(CPlayerInfo*) { EAXJMP(0x4546C0); }
STARTPATCHES
InjectHook(0x437AE0, &CMissionCleanup::Init, PATCH_JUMP);
diff --git a/src/control/Script.h b/src/control/Script.h
index 2c4ec2c0..751ad9d5 100644
--- a/src/control/Script.h
+++ b/src/control/Script.h
@@ -8,6 +8,7 @@ class CBuilding;
class CVehicle;
class CPed;
class CObject;
+class CPlayerInfo;
struct CScriptRectangle
{
@@ -339,6 +340,9 @@ public:
static void Process();
static CRunningScript* StartTestScript();
static bool IsPlayerOnAMission();
+ static bool IsPedStopped(CPed*);
+ static bool IsPlayerStopped(CPlayerInfo*);
+ static bool IsVehicleStopped(CVehicle*);
static void ReadObjectNamesFromScript();
static void UpdateObjectIndices();
@@ -348,7 +352,6 @@ public:
static void HighlightImportantArea(uint32, float, float, float, float, float);
static void DrawDebugSquare(float, float, float, float);
static void DrawDebugCube(float, float, float, float, float, float);
- static bool IsVehicleStopped(CVehicle*);
static int32 Read4BytesFromScript(uint32* pIp){
int32 retval = 0;
diff --git a/src/core/CutsceneMgr.h b/src/core/CutsceneMgr.h
index 8c4a918b..e95a2a04 100644
--- a/src/core/CutsceneMgr.h
+++ b/src/core/CutsceneMgr.h
@@ -31,6 +31,7 @@ public:
static CCutsceneObject* GetCutsceneObject(int id) { return ms_pCutsceneObjects[id]; }
static int GetCutsceneTimeInMilleseconds(void) { return 1000.0f * ms_cutsceneTimer; }
static char *GetCutsceneName(void) { return ms_cutsceneName; }
+ static void SetCutsceneOffset(const CVector& vec) { ms_cutsceneOffset = vec; }
static bool HasCutsceneFinished(void);
static void Initialise(void);
diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp
index be2c0687..f0b7d444 100644
--- a/src/core/PlayerInfo.cpp
+++ b/src/core/PlayerInfo.cpp
@@ -72,6 +72,22 @@ CPlayerInfo::ArrestPlayer()
CStats::TimesArrested++;
}
+bool
+CPlayerInfo::IsPlayerInRemoteMode()
+{
+ return m_pRemoteVehicle || m_bInRemoteMode;
+}
+
+void
+CPlayerInfo::PlayerFailedCriticalMission()
+{
+ if (m_WBState != WBSTATE_PLAYING)
+ return;
+ m_WBState = WBSTATE_FAILED_CRITICAL_MISSION;
+ m_nWBTime = CTimer::GetTimeInMilliseconds();
+ CDarkel::ResetOnPlayerDeath();
+}
+
STARTPATCHES
InjectHook(0x4A1700, &CPlayerInfo::LoadPlayerSkin, PATCH_JUMP);
InjectHook(0x4A1750, &CPlayerInfo::DeletePlayerSkin, PATCH_JUMP);
diff --git a/src/core/PlayerInfo.h b/src/core/PlayerInfo.h
index 5784e1fb..ef21fb52 100644
--- a/src/core/PlayerInfo.h
+++ b/src/core/PlayerInfo.h
@@ -75,6 +75,8 @@ public:
void Process(void);
void KillPlayer(void);
void ArrestPlayer(void);
+ bool IsPlayerInRemoteMode(void);
+ void PlayerFailedCriticalMission(void);
};
static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerInfo: error");
diff --git a/src/core/World.cpp b/src/core/World.cpp
index 5dea09bd..ae0d67cc 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -999,6 +999,19 @@ CWorld::RemoveFallenCars(void)
}
void
+CWorld::StopAllLawEnforcersInTheirTracks(void)
+{
+ int poolSize = CPools::GetVehiclePool()->GetSize();
+ for (int poolIndex = poolSize - 1; poolIndex >= 0; poolIndex--) {
+ CVehicle* veh = CPools::GetVehiclePool()->GetSlot(poolIndex);
+ if (veh) {
+ if (veh->bIsLawEnforcer)
+ veh->SetMoveSpeed(0.0f, 0.0f, 0.0f);
+ }
+ }
+}
+
+void
CWorld::Process(void)
{
if (!(CTimer::GetFrameCounter() & 63))
diff --git a/src/core/World.h b/src/core/World.h
index a1aa0376..3b04403e 100644
--- a/src/core/World.h
+++ b/src/core/World.h
@@ -120,6 +120,8 @@ public:
static void RemoveFallenPeds();
static void RemoveFallenCars();
+ static void StopAllLawEnforcersInTheirTracks();
+
static void Initialise();
static void ShutDown();
static void RepositionCertainDynamicObjects();
diff --git a/src/core/config.h b/src/core/config.h
index 12cb7be8..ae9e2ea4 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -162,6 +162,6 @@ enum Config {
// Peds
#define ANIMATE_PED_COL_MODEL
-#define VC_PED_PORTS
+//#define VC_PED_PORTS
#define NEW_WALK_AROUND_ALGORITHM
#define CANCELLABLE_CAR_ENTER
diff --git a/src/render/Weather.cpp b/src/render/Weather.cpp
index db1bc80b..479f3404 100644
--- a/src/render/Weather.cpp
+++ b/src/render/Weather.cpp
@@ -27,6 +27,11 @@ float &CWeather::Rainbow = *(float*)0x940598;
bool &CWeather::bScriptsForceRain = *(bool*)0x95CD7D;
bool &CWeather::Stored_StateStored = *(bool*)0x95CDC1;
+float &CWeather::Stored_InterpolationValue = *(float*)0x942F54;
+int16 &CWeather::Stored_OldWeatherType = *(int16*)0x95CC68;
+int16 &CWeather::Stored_NewWeatherType = *(int16*)0x95CCAE;
+float &CWeather::Stored_Rain = *(float*)0x885B4C;
+
WRAPPER void CWeather::RenderRainStreaks(void) { EAXJMP(0x524550); }
WRAPPER void CWeather::Update(void) { EAXJMP(0x522C10); }
@@ -46,3 +51,23 @@ void CWeather::ForceWeatherNow(int16 weather)
NewWeatherType = weather;
ForcedWeatherType = weather;
}
+
+void CWeather::StoreWeatherState()
+{
+ Stored_StateStored = true;
+ Stored_InterpolationValue = InterpolationValue;
+ Stored_Rain = Rain;
+ Stored_NewWeatherType = NewWeatherType;
+ Stored_OldWeatherType = OldWeatherType;
+}
+
+void CWeather::RestoreWeatherState()
+{
+#ifdef FIX_BUGS // it's not used anyway though
+ Stored_StateStored = false;
+#endif
+ InterpolationValue = Stored_InterpolationValue;
+ Rain = Stored_Rain;
+ NewWeatherType = Stored_NewWeatherType;
+ OldWeatherType = Stored_OldWeatherType;
+} \ No newline at end of file
diff --git a/src/render/Weather.h b/src/render/Weather.h
index 41cc5c0e..b5704b01 100644
--- a/src/render/Weather.h
+++ b/src/render/Weather.h
@@ -32,6 +32,10 @@ public:
static bool &bScriptsForceRain;
static bool &Stored_StateStored;
+ static float &Stored_InterpolationValue;
+ static int16 &Stored_OldWeatherType;
+ static int16 &Stored_NewWeatherType;
+ static float &Stored_Rain;
static void RenderRainStreaks(void);
static void Update(void);
@@ -39,4 +43,6 @@ public:
static void ReleaseWeather();
static void ForceWeather(int16);
static void ForceWeatherNow(int16);
+ static void StoreWeatherState();
+ static void RestoreWeatherState();
};
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index 0fa8547e..a077bba4 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -61,8 +61,8 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy)
m_fFireBlowUpTimer = 0.0f;
field_4E0 = 0;
bTaxiLight = m_sAllTaxiLights;
- m_auto_flagA20 = false;
- m_auto_flagA40 = false;
+ bFixedColour = false;
+ bBigWheels = false;
bWaterTight = false;
SetModelIndex(id);
diff --git a/src/vehicles/Automobile.h b/src/vehicles/Automobile.h
index 534f28a4..561ab566 100644
--- a/src/vehicles/Automobile.h
+++ b/src/vehicles/Automobile.h
@@ -87,8 +87,8 @@ public:
uint8 m_bombType : 3;
uint8 bTaxiLight : 1;
uint8 bHadDriver : 1; // for bombs
- uint8 m_auto_flagA20 : 1;
- uint8 m_auto_flagA40 : 1;
+ uint8 bFixedColour : 1;
+ uint8 bBigWheels : 1;
uint8 bWaterTight : 1; // no damage for non-player peds
uint8 bNotDamagedUpsideDown : 1;
uint8 bMoreResistantToDamage : 1;