summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
Diffstat (limited to 'src/control')
-rw-r--r--src/control/CarAI.cpp13
-rw-r--r--src/control/CarCtrl.cpp343
-rw-r--r--src/control/CarCtrl.h11
-rw-r--r--src/control/Garages.cpp6
-rw-r--r--src/control/Pickups.cpp6
-rw-r--r--src/control/SceneEdit.cpp4
-rw-r--r--src/control/Script.cpp1482
-rw-r--r--src/control/Script.h127
-rw-r--r--src/control/Script2.cpp792
-rw-r--r--src/control/Script3.cpp1088
-rw-r--r--src/control/Script4.cpp26
-rw-r--r--src/control/Script5.cpp40
-rw-r--r--src/control/Script6.cpp34
-rw-r--r--src/control/Script7.cpp25
-rw-r--r--src/control/Script8.cpp859
-rw-r--r--src/control/ScriptCommands.h256
16 files changed, 3197 insertions, 1915 deletions
diff --git a/src/control/CarAI.cpp b/src/control/CarAI.cpp
index e7f3a546..06438e0a 100644
--- a/src/control/CarAI.cpp
+++ b/src/control/CarAI.cpp
@@ -4,6 +4,7 @@
#include "Accident.h"
#include "AutoPilot.h"
+#include "Bridge.h"
#include "CarCtrl.h"
#include "General.h"
#include "HandlingMgr.h"
@@ -74,6 +75,18 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
case STATUS_PLAYER_DISABLED:
break;
case STATUS_SIMPLE:
+ {
+ if (pVehicle->m_pCurGroundEntity && CBridge::ThisIsABridgeObjectMovingUp(pVehicle->m_pCurGroundEntity->GetModelIndex()))
+ pVehicle->SetStatus(STATUS_PHYSICS);
+ CColPoint colPoint;
+ CEntity* pEntity;
+ if ((pVehicle->m_randomSeed & 0x3F) == (CTimer::GetFrameCounter() & 0x3F) &&
+ !CWorld::ProcessVerticalLine(pVehicle->GetPosition(), -2.0f, colPoint, pEntity, true, false, false, false, true, false, nil)) {
+ debug("FLOATING CAR TURNED INTO PHYSICS CAR!\n");
+ pVehicle->SetStatus(STATUS_PHYSICS);
+ }
+ }
+ // fallthough
case STATUS_PHYSICS:
switch (pVehicle->AutoPilot.m_nCarMission) {
case MISSION_RAMPLAYER_FARAWAY:
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index 1023f2a3..faee574c 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -11,6 +11,7 @@
#include "Cranes.h"
#include "Curves.h"
#include "CutsceneMgr.h"
+#include "Frontend.h"
#include "Gangs.h"
#include "Game.h"
#include "Garages.h"
@@ -76,10 +77,11 @@
#define DISTANCE_BETWEEN_CAR_AND_DEAD_PED (6.0f)
#define PROBABILITY_OF_PASSENGER_IN_VEHICLE (0.125f)
-#define ONSCREEN_DESPAWN_RANGE (120.0f)
-#define MINIMAL_DISTANCE_TO_SPAWN_ONSCREEN (100.0f)
-#define REQUEST_ONSCREEN_DISTANCE ((ONSCREEN_DESPAWN_RANGE + MINIMAL_DISTANCE_TO_SPAWN_ONSCREEN) / 2)
-#define OFFSCREEN_DESPAWN_RANGE (40.0f)
+#define ONSCREEN_DESPAWN_RANGE (190.0f)
+#define MINIMAL_DISTANCE_TO_SPAWN_ONSCREEN (130.0f)
+#define REQUEST_ONSCREEN_DISTANCE (140.0f)
+#define OFFSCREEN_DESPAWN_RANGE (60.0f)
+#define MINIMAL_DISTANCE_TO_SPAWN_OFFSCREEN (40.0f)
#define EXTENDED_RANGE_DESPAWN_MULTIPLIER (1.5f)
//--MIAMI: file done
@@ -95,7 +97,7 @@ int32 CCarCtrl::NumRandomCars;
int32 CCarCtrl::NumParkedCars;
int32 CCarCtrl::NumPermanentCars;
int8 CCarCtrl::CountDownToCarsAtStart;
-int32 CCarCtrl::MaxNumberOfCarsInUse = 12;
+int32 CCarCtrl::MaxNumberOfCarsInUse = 30;
uint32 CCarCtrl::LastTimeLawEnforcerCreated;
uint32 CCarCtrl::LastTimeFireTruckCreated;
uint32 CCarCtrl::LastTimeAmbulanceCreated;
@@ -161,14 +163,19 @@ CCarCtrl::GenerateOneRandomCar()
carClass = COPS;
carModel = ChoosePoliceCarModel();
}else{
- carModel = ChooseModel(&zone, &carClass);
- if (carModel == -1 || (carClass == COPS && pWanted->m_nWantedLevel >= 1))
- /* All cop spawns with wanted level are handled by condition above. */
- /* In particular it means that cop cars never spawn if player has wanted level of 1. */
- return;
+ for (int i = 0; i < 5; i++) {
+ carModel = ChooseModel(&zone, &carClass);
+ if (carModel == -1)
+ return;
+ if (!(carClass == COPS && pWanted->m_nWantedLevel >= 1))
+ /* All cop spawns with wanted level are handled by condition above. */
+ /* In particular it means that cop cars never spawn if player has wanted level of 1. */
+ break;
+ }
}
float frontX, frontY;
float preferredDistance, angleLimit;
+ float requestMultiplier = 1.0f;
bool invertAngleLimitTest;
CVector spawnPosition;
int32 curNodeId, nextNodeId;
@@ -188,11 +195,14 @@ CCarCtrl::GenerateOneRandomCar()
angleLimit = -1.0f;
bTopDownCamera = true;
invertAngleLimitTest = true;
- preferredDistance = OFFSCREEN_DESPAWN_RANGE + 15.0f;
+ preferredDistance = MINIMAL_DISTANCE_TO_SPAWN_OFFSCREEN + 15.0f;
/* BUG: testForCollision not initialized in original game. */
testForCollision = false;
}else if (!pPlayerVehicle){
/* Player is not in vehicle. */
+ requestMultiplier = 13.0f / 20.0f;
+ if (FrontEndMenuManager.m_PrefsUseWideScreen) // TODO(LCS): static
+ requestMultiplier *= 4.0f / 3.0f;
testForCollision = true;
frontX = TheCamera.CamFrontXNorm;
frontY = TheCamera.CamFrontYNorm;
@@ -202,95 +212,105 @@ CCarCtrl::GenerateOneRandomCar()
/* Forward to his current direction (camera direction). */
angleLimit = 0.707f; /* 45 degrees */
invertAngleLimitTest = true;
- preferredDistance = REQUEST_ONSCREEN_DISTANCE * TheCamera.GenerationDistMultiplier;
+ preferredDistance = REQUEST_ONSCREEN_DISTANCE * requestMultiplier * TheCamera.GenerationDistMultiplier;
break;
case 1:
/* Spawn a vehicle close to player to his side. */
/* Kinda not within camera angle. */
angleLimit = 0.707f; /* 45 degrees */
invertAngleLimitTest = false;
- preferredDistance = OFFSCREEN_DESPAWN_RANGE;
+ preferredDistance = MINIMAL_DISTANCE_TO_SPAWN_OFFSCREEN;
break;
}
- }else if (fPlayerVehicleSpeed > 0.4f){ /* 72 km/h */
+ }
+ else {
+ requestMultiplier = 13.0f / 20.0f;
+ if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON && !FrontEndMenuManager.m_PrefsUseWideScreen)
+ requestMultiplier *= 0.9f;
+ if (FrontEndMenuManager.m_PrefsUseWideScreen) // TODO(LCS): static
+ requestMultiplier *= 4.0f / 3.0f;
+ if (fPlayerVehicleSpeed > 0.4f) { /* 72 km/h */
/* Player is moving fast in vehicle */
/* Prefer spawning vehicles very far away from him. */
- frontX = vecPlayerVehicleSpeed.x / fPlayerVehicleSpeed;
- frontY = vecPlayerVehicleSpeed.y / fPlayerVehicleSpeed;
- testForCollision = false;
- switch (CTimer::GetFrameCounter() & 3) {
- case 0:
- case 1:
- /* Spawn a vehicle in a very narrow gap in front of a player */
- angleLimit = 0.85f; /* approx 30 degrees */
- invertAngleLimitTest = true;
- preferredDistance = REQUEST_ONSCREEN_DISTANCE * TheCamera.GenerationDistMultiplier;
- break;
- case 2:
- /* Spawn a vehicle relatively far away from player. */
- /* Forward to his current direction (camera direction). */
- angleLimit = 0.707f; /* 45 degrees */
- invertAngleLimitTest = true;
- preferredDistance = REQUEST_ONSCREEN_DISTANCE * TheCamera.GenerationDistMultiplier;
- break;
- case 3:
- /* Spawn a vehicle close to player to his side. */
- /* Kinda not within camera angle. */
- angleLimit = 0.707f; /* 45 degrees */
- invertAngleLimitTest = false;
- preferredDistance = OFFSCREEN_DESPAWN_RANGE;
- break;
+ frontX = vecPlayerVehicleSpeed.x / fPlayerVehicleSpeed;
+ frontY = vecPlayerVehicleSpeed.y / fPlayerVehicleSpeed;
+ testForCollision = false;
+ switch (CTimer::GetFrameCounter() & 3) {
+ case 0:
+ case 1:
+ /* Spawn a vehicle in a very narrow gap in front of a player */
+ angleLimit = 0.85f; /* approx 30 degrees */
+ invertAngleLimitTest = true;
+ preferredDistance = REQUEST_ONSCREEN_DISTANCE * requestMultiplier * TheCamera.GenerationDistMultiplier;
+ break;
+ case 2:
+ /* Spawn a vehicle relatively far away from player. */
+ /* Forward to his current direction (camera direction). */
+ angleLimit = 0.707f; /* 45 degrees */
+ invertAngleLimitTest = true;
+ preferredDistance = REQUEST_ONSCREEN_DISTANCE * requestMultiplier * TheCamera.GenerationDistMultiplier;
+ break;
+ case 3:
+ /* Spawn a vehicle close to player to his side. */
+ /* Kinda not within camera angle. */
+ angleLimit = 0.707f; /* 45 degrees */
+ invertAngleLimitTest = false;
+ preferredDistance = MINIMAL_DISTANCE_TO_SPAWN_OFFSCREEN;
+ break;
+ }
}
- }else if (fPlayerVehicleSpeed > 0.1f){ /* 18 km/h */
- /* Player is moving moderately fast in vehicle */
- /* Spawn more vehicles to player's side. */
- frontX = vecPlayerVehicleSpeed.x / fPlayerVehicleSpeed;
- frontY = vecPlayerVehicleSpeed.y / fPlayerVehicleSpeed;
- testForCollision = false;
- switch (CTimer::GetFrameCounter() & 3) {
- case 0:
- /* Spawn a vehicle in a very narrow gap in front of a player */
- angleLimit = 0.85f; /* approx 30 degrees */
- invertAngleLimitTest = true;
- preferredDistance = REQUEST_ONSCREEN_DISTANCE * TheCamera.GenerationDistMultiplier;
- break;
- case 1:
- /* Spawn a vehicle relatively far away from player. */
- /* Forward to his current direction (camera direction). */
- angleLimit = 0.707f; /* 45 degrees */
- invertAngleLimitTest = true;
- preferredDistance = REQUEST_ONSCREEN_DISTANCE * TheCamera.GenerationDistMultiplier;
- break;
- case 2:
- case 3:
- /* Spawn a vehicle close to player to his side. */
- /* Kinda not within camera angle. */
- angleLimit = 0.707f; /* 45 degrees */
- invertAngleLimitTest = false;
- preferredDistance = OFFSCREEN_DESPAWN_RANGE;
- break;
+ else if (fPlayerVehicleSpeed > 0.1f) { /* 18 km/h */
+ /* Player is moving moderately fast in vehicle */
+ /* Spawn more vehicles to player's side. */
+ frontX = vecPlayerVehicleSpeed.x / fPlayerVehicleSpeed;
+ frontY = vecPlayerVehicleSpeed.y / fPlayerVehicleSpeed;
+ testForCollision = false;
+ switch (CTimer::GetFrameCounter() & 3) {
+ case 0:
+ /* Spawn a vehicle in a very narrow gap in front of a player */
+ angleLimit = 0.85f; /* approx 30 degrees */
+ invertAngleLimitTest = true;
+ preferredDistance = REQUEST_ONSCREEN_DISTANCE * requestMultiplier * TheCamera.GenerationDistMultiplier;
+ break;
+ case 1:
+ /* Spawn a vehicle relatively far away from player. */
+ /* Forward to his current direction (camera direction). */
+ angleLimit = 0.707f; /* 45 degrees */
+ invertAngleLimitTest = true;
+ preferredDistance = REQUEST_ONSCREEN_DISTANCE * requestMultiplier * TheCamera.GenerationDistMultiplier;
+ break;
+ case 2:
+ case 3:
+ /* Spawn a vehicle close to player to his side. */
+ /* Kinda not within camera angle. */
+ angleLimit = 0.707f; /* 45 degrees */
+ invertAngleLimitTest = false;
+ preferredDistance = MINIMAL_DISTANCE_TO_SPAWN_OFFSCREEN;
+ break;
+ }
}
- }else{
- /* Player is in vehicle but moving very slow. */
- /* Then use camera direction instead of vehicle direction. */
- testForCollision = true;
- frontX = TheCamera.CamFrontXNorm;
- frontY = TheCamera.CamFrontYNorm;
- switch (CTimer::GetFrameCounter() & 1) {
- case 0:
- /* Spawn a vehicle relatively far away from player. */
- /* Forward to his current direction (camera direction). */
- angleLimit = 0.707f; /* 45 degrees */
- invertAngleLimitTest = true;
- preferredDistance = REQUEST_ONSCREEN_DISTANCE * TheCamera.GenerationDistMultiplier;
- break;
- case 1:
- /* Spawn a vehicle close to player to his side. */
- /* Kinda not within camera angle. */
- angleLimit = 0.707f; /* 45 degrees */
- invertAngleLimitTest = false;
- preferredDistance = OFFSCREEN_DESPAWN_RANGE;
- break;
+ else {
+ /* Player is in vehicle but moving very slow. */
+ /* Then use camera direction instead of vehicle direction. */
+ testForCollision = true;
+ frontX = TheCamera.CamFrontXNorm;
+ frontY = TheCamera.CamFrontYNorm;
+ switch (CTimer::GetFrameCounter() & 1) {
+ case 0:
+ /* Spawn a vehicle relatively far away from player. */
+ /* Forward to his current direction (camera direction). */
+ angleLimit = 0.707f; /* 45 degrees */
+ invertAngleLimitTest = true;
+ preferredDistance = REQUEST_ONSCREEN_DISTANCE * requestMultiplier * TheCamera.GenerationDistMultiplier;
+ break;
+ case 1:
+ /* Spawn a vehicle close to player to his side. */
+ /* Kinda not within camera angle. */
+ angleLimit = 0.707f; /* 45 degrees */
+ invertAngleLimitTest = false;
+ preferredDistance = MINIMAL_DISTANCE_TO_SPAWN_OFFSCREEN;
+ break;
+ }
}
}
if (!ThePaths.GenerateCarCreationCoors(vecTargetPos.x, vecTargetPos.y, frontX, frontY,
@@ -300,6 +320,8 @@ CCarCtrl::GenerateOneRandomCar()
CPathNode* pCurNode = &ThePaths.m_pathNodes[curNodeId];
CPathNode* pNextNode = &ThePaths.m_pathNodes[nextNodeId];
bool bBoatGenerated = false;
+ if (!OkToCreateVehicleAtThisPosition(spawnPosition))
+ return;
if ((CGeneral::GetRandomNumber() & 0xF) > Min(pCurNode->spawnRate, pNextNode->spawnRate))
return;
if (pCurNode->bWaterPath) {
@@ -599,12 +621,12 @@ CCarCtrl::GenerateOneRandomCar()
return;
}
}else{
- if ((vecTargetPos - pVehicle->GetPosition()).Magnitude2D() > TheCamera.GenerationDistMultiplier * (pVehicle->bExtendedRange ? EXTENDED_RANGE_DESPAWN_MULTIPLIER : 1.0f) * ONSCREEN_DESPAWN_RANGE ||
- (vecTargetPos - pVehicle->GetPosition()).Magnitude2D() < TheCamera.GenerationDistMultiplier * MINIMAL_DISTANCE_TO_SPAWN_ONSCREEN) {
+ if ((vecTargetPos - pVehicle->GetPosition()).Magnitude2D() > TheCamera.GenerationDistMultiplier * requestMultiplier * (pVehicle->bExtendedRange ? EXTENDED_RANGE_DESPAWN_MULTIPLIER : 1.0f) * ONSCREEN_DESPAWN_RANGE ||
+ (vecTargetPos - pVehicle->GetPosition()).Magnitude2D() < TheCamera.GenerationDistMultiplier * requestMultiplier * MINIMAL_DISTANCE_TO_SPAWN_ONSCREEN) {
delete pVehicle;
return;
}
- if ((TheCamera.GetPosition() - pVehicle->GetPosition()).Magnitude2D() < 82.5f * TheCamera.GenerationDistMultiplier || bTopDownCamera) {
+ if ((TheCamera.GetPosition() - pVehicle->GetPosition()).Magnitude2D() < 105.0f * requestMultiplier * TheCamera.GenerationDistMultiplier || bTopDownCamera) {
delete pVehicle;
return;
}
@@ -654,13 +676,13 @@ CCarCtrl::GenerateOneRandomCar()
int nMadDrivers;
switch (pVehicle->GetVehicleAppearance()) {
case VEHICLE_APPEARANCE_BIKE:
- nMadDrivers = 30;
+ nMadDrivers = 20;
break;
case VEHICLE_APPEARANCE_BOAT:
nMadDrivers = 40;
break;
default:
- nMadDrivers = 6;
+ nMadDrivers = 3;
break;
}
if ((CGeneral::GetRandomNumber() & 0x7F) < nMadDrivers || bMadDriversCheat) {
@@ -719,12 +741,6 @@ CCarCtrl::GenerateOneRandomCar()
}
}
-bool
-CCarCtrl::BoatWithTallMast(int32 mi)
-{
- return mi == MI_RIO || mi == MI_TROPIC || mi == MI_MARQUIS;
-}
-
int32
CCarCtrl::ChooseBoatModel(int32 rating)
{
@@ -944,6 +960,7 @@ CCarCtrl::RemoveCarsIfThePoolGetsFull(void)
}
}
if (pClosestVehicle) {
+ debug(":::::::::::\'Nearest removed\' cause pools was full -> NumRandomCars %d\n", NumRandomCars);
CWorld::Remove(pClosestVehicle);
delete pClosestVehicle;
}
@@ -966,7 +983,10 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
return;
}
float distanceToPlayer = (pVehicle->GetPosition() - vecPlayerPos).Magnitude2D();
- float threshold = OFFSCREEN_DESPAWN_RANGE;
+ float despawnMultiplier = 1.0f;
+ if (FindPlayerVehicle() && TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON && !FrontEndMenuManager.m_PrefsUseWideScreen)
+ despawnMultiplier = 0.75f;
+ float threshold = OFFSCREEN_DESPAWN_RANGE * despawnMultiplier;
if (pVehicle->GetIsOnScreen() ||
TheCamera.Cams[TheCamera.ActiveCam].LookingLeft ||
TheCamera.Cams[TheCamera.ActiveCam].LookingRight ||
@@ -979,7 +999,7 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
pVehicle->bIsCarParkVehicle ||
CTimer::GetTimeInMilliseconds() < pVehicle->m_nSetPieceExtendedRangeTime
){
- threshold = ONSCREEN_DESPAWN_RANGE * TheCamera.GenerationDistMultiplier;
+ threshold = ONSCREEN_DESPAWN_RANGE * despawnMultiplier * TheCamera.GenerationDistMultiplier;
}
if (TheCamera.GetForward().z < -0.9f)
threshold = 70.0f;
@@ -1572,7 +1592,7 @@ void CCarCtrl::WeaveForOtherCar(CEntity* pOtherEntity, CVehicle* pVehicle, float
if (pVehicle->AutoPilot.m_nCarMission == MISSION_RAMCAR_CLOSE && pOtherEntity == pVehicle->AutoPilot.m_pTargetCar)
return;
CVector2D vecDiff = pOtherCar->GetPosition() - pVehicle->GetPosition();
- float angleBetweenVehicles = CGeneral::GetATanOfXY(vecDiff.x, vecDiff.y);
+ float angleBetweenVehicles = GetATanOfXY(vecDiff.x, vecDiff.y);
float distance = vecDiff.Magnitude();
if (distance < 1.0f)
return;
@@ -1582,7 +1602,7 @@ void CCarCtrl::WeaveForOtherCar(CEntity* pOtherEntity, CVehicle* pVehicle, float
return;
CVector2D forward = pVehicle->GetForward();
forward.Normalise();
- float forwardAngle = CGeneral::GetATanOfXY(forward.x, forward.y);
+ float forwardAngle = GetATanOfXY(forward.x, forward.y);
float angleDiff = angleBetweenVehicles - forwardAngle;
float lenProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.y * sin(angleDiff));
float widthProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.x * cos(angleDiff));
@@ -1591,16 +1611,12 @@ void CCarCtrl::WeaveForOtherCar(CEntity* pOtherEntity, CVehicle* pVehicle, float
diffToLeftAngle = ABS(diffToLeftAngle);
float angleToWeave = lengthToEvade / 2;
if (diffToLeftAngle < angleToWeave){
- *pAngleToWeaveLeft = angleBetweenVehicles - angleToWeave;
- while (*pAngleToWeaveLeft < -PI)
- *pAngleToWeaveLeft += TWOPI;
+ *pAngleToWeaveLeft = LimitRadianAngle(angleBetweenVehicles - angleToWeave);
}
float diffToRightAngle = LimitRadianAngle(angleBetweenVehicles - *pAngleToWeaveRight);
diffToRightAngle = ABS(diffToRightAngle);
if (diffToRightAngle < angleToWeave){
- *pAngleToWeaveRight = angleBetweenVehicles + angleToWeave;
- while (*pAngleToWeaveRight > PI)
- *pAngleToWeaveRight -= TWOPI;
+ *pAngleToWeaveRight = LimitRadianAngle(angleBetweenVehicles + angleToWeave);
}
}
@@ -1632,23 +1648,19 @@ void CCarCtrl::WeaveForPed(CEntity* pOtherEntity, CVehicle* pVehicle, float* pAn
return;
CPed* pPed = (CPed*)pOtherEntity;
CVector2D vecDiff = pPed->GetPosition() - pVehicle->GetPosition();
- float angleBetweenVehicleAndPed = CGeneral::GetATanOfXY(vecDiff.x, vecDiff.y);
+ float angleBetweenVehicleAndPed = GetATanOfXY(vecDiff.x, vecDiff.y);
float distance = vecDiff.Magnitude();
float lengthToEvade = (WIDTH_COEF_TO_WEAVE_SAFELY * 2 * pVehicle->GetColModel()->boundingBox.max.x + PED_WIDTH_TO_WEAVE) / distance;
float diffToLeftAngle = LimitRadianAngle(angleBetweenVehicleAndPed - *pAngleToWeaveLeft);
diffToLeftAngle = ABS(diffToLeftAngle);
float angleToWeave = lengthToEvade / 2;
if (diffToLeftAngle < angleToWeave) {
- *pAngleToWeaveLeft = angleBetweenVehicleAndPed - angleToWeave;
- while (*pAngleToWeaveLeft < -PI)
- *pAngleToWeaveLeft += TWOPI;
+ *pAngleToWeaveLeft = LimitRadianAngle(angleBetweenVehicleAndPed - angleToWeave);
}
float diffToRightAngle = LimitRadianAngle(angleBetweenVehicleAndPed - *pAngleToWeaveRight);
diffToRightAngle = ABS(diffToRightAngle);
if (diffToRightAngle < angleToWeave) {
- *pAngleToWeaveRight = angleBetweenVehicleAndPed + angleToWeave;
- while (*pAngleToWeaveRight > PI)
- *pAngleToWeaveRight -= TWOPI;
+ *pAngleToWeaveRight = LimitRadianAngle(angleBetweenVehicleAndPed + angleToWeave);
}
}
@@ -1704,23 +1716,19 @@ void CCarCtrl::WeaveForObject(CEntity* pOtherEntity, CVehicle* pVehicle, float*
rightCoef * pObject->GetRight() +
forwardCoef * pObject->GetForward() -
pVehicle->GetPosition();
- float angleBetweenVehicleAndObject = CGeneral::GetATanOfXY(vecDiff.x, vecDiff.y);
+ float angleBetweenVehicleAndObject = GetATanOfXY(vecDiff.x, vecDiff.y);
float distance = vecDiff.Magnitude();
float lengthToEvade = (WIDTH_COEF_TO_WEAVE_SAFELY * 2 * pVehicle->GetColModel()->boundingBox.max.x + OBJECT_WIDTH_TO_WEAVE) / distance;
float diffToLeftAngle = LimitRadianAngle(angleBetweenVehicleAndObject - *pAngleToWeaveLeft);
diffToLeftAngle = ABS(diffToLeftAngle);
float angleToWeave = lengthToEvade / 2;
if (diffToLeftAngle < angleToWeave) {
- *pAngleToWeaveLeft = angleBetweenVehicleAndObject - angleToWeave;
- while (*pAngleToWeaveLeft < -PI)
- *pAngleToWeaveLeft += TWOPI;
+ *pAngleToWeaveLeft = LimitRadianAngle(angleBetweenVehicleAndObject - angleToWeave);
}
float diffToRightAngle = LimitRadianAngle(angleBetweenVehicleAndObject - *pAngleToWeaveRight);
diffToRightAngle = ABS(diffToRightAngle);
if (diffToRightAngle < angleToWeave) {
- *pAngleToWeaveRight = angleBetweenVehicleAndObject + angleToWeave;
- while (*pAngleToWeaveRight > PI)
- *pAngleToWeaveRight -= TWOPI;
+ *pAngleToWeaveRight = LimitRadianAngle(angleBetweenVehicleAndObject + angleToWeave);
}
}
@@ -1762,7 +1770,7 @@ bool CCarCtrl::PickNextNodeAccordingStrategy(CVehicle* pVehicle)
void CCarCtrl::PickNextNodeRandomly(CVehicle* pVehicle)
{
if (pVehicle->m_nRouteSeed)
- CGeneral::SetRandomSeed(pVehicle->m_nRouteSeed);
+ CGeneral::SetRandomSeed(pVehicle->m_nRouteSeed++);
int32 prevNode = pVehicle->AutoPilot.m_nCurrentRouteNode;
int32 curNode = pVehicle->AutoPilot.m_nNextRouteNode;
uint8 totalLinks = ThePaths.m_pathNodes[curNode].numLinks;
@@ -1848,13 +1856,15 @@ void CCarCtrl::PickNextNodeRandomly(CVehicle* pVehicle)
pNextPathNode = &ThePaths.m_pathNodes[pVehicle->AutoPilot.m_nNextRouteNode];
if ((!pNextPathNode->bDisabled || pPrevPathNode->bDisabled) &&
(!pNextPathNode->bBetweenLevels || pPrevPathNode->bBetweenLevels || !pVehicle->AutoPilot.m_bStayInCurrentLevel))
- /* Nice way to exit loop but this will fail because this is used for indexing! */
- nextLink = 1000;
+ break;
}
}
- if (nextLink < 999)
+ if (nextLink >= totalLinks) {
/* If everything else failed, turn vehicle around */
+ nextLink = 0;
+ debug("Couldn\'t find ANYTHING. Just go back from where we came.\n");
pVehicle->AutoPilot.m_nNextRouteNode = prevNode;
+ }
}
pNextPathNode = &ThePaths.m_pathNodes[pVehicle->AutoPilot.m_nNextRouteNode];
pNextLink = &ThePaths.m_carPathLinks[ThePaths.m_carPathConnections[nextLink + pCurPathNode->firstLink]];
@@ -1967,7 +1977,7 @@ void CCarCtrl::PickNextNodeToChaseCar(CVehicle* pVehicle, float targetX, float t
#endif
{
if (pVehicle->m_nRouteSeed)
- CGeneral::SetRandomSeed(pVehicle->m_nRouteSeed);
+ CGeneral::SetRandomSeed(pVehicle->m_nRouteSeed++);
int prevNode = pVehicle->AutoPilot.m_nCurrentRouteNode;
int curNode = pVehicle->AutoPilot.m_nNextRouteNode;
CPathNode* pPrevNode = &ThePaths.m_pathNodes[prevNode];
@@ -1987,7 +1997,7 @@ void CCarCtrl::PickNextNodeToChaseCar(CVehicle* pVehicle, float targetX, float t
int nextLink;
if (numNodes != 1 && numNodes != 2 || pTargetNode[0] == pCurNode){
if (numNodes != 2 || pTargetNode[1] == pCurNode) {
- float currentAngle = CGeneral::GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y);
+ float currentAngle = GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y);
nextLink = 0;
float lowestAngleChange = 10.0f;
int numLinks = pCurNode->numLinks;
@@ -1997,7 +2007,7 @@ void CCarCtrl::PickNextNodeToChaseCar(CVehicle* pVehicle, float targetX, float t
if (conNode == prevNode && i > 1)
continue;
CPathNode* pTestNode = &ThePaths.m_pathNodes[conNode];
- float angle = CGeneral::GetATanOfXY(pTestNode->GetX() - pCurNode->GetX(), pTestNode->GetY() - pCurNode->GetY());
+ float angle = GetATanOfXY(pTestNode->GetX() - pCurNode->GetX(), pTestNode->GetY() - pCurNode->GetY());
angle = LimitRadianAngle(angle - currentAngle);
angle = ABS(angle);
if (angle < lowestAngleChange) {
@@ -2415,6 +2425,16 @@ void CCarCtrl::SteerAICarWithPhysics_OnlyMission(CVehicle* pVehicle, float* pSwe
*pHandbrake = true;
return;
case MISSION_CRUISE:
+ if (CTrafficLights::ShouldCarStopForBridge(pVehicle)) {
+ *pAccel = 0.0f;
+ *pBrake = 1.0f;
+ *pHandbrake = true;
+#ifdef FIX_BUGS
+ *pSwerve = 0.0f;
+#endif
+ break;
+ }
+ // fallthough
case MISSION_RAMPLAYER_FARAWAY:
case MISSION_BLOCKPLAYER_FARAWAY:
case MISSION_GOTOCOORDS:
@@ -2485,11 +2505,19 @@ void CCarCtrl::SteerAICarWithPhysics_OnlyMission(CVehicle* pVehicle, float* pSwe
*pHandbrake = false;
return;
case MISSION_RAMCAR_CLOSE:
+ if (!pVehicle->AutoPilot.m_pTargetCar) {
+ debug("NO TARGET VEHICLE FOR MISSION_RAMCAR_CLOSE\n");
+ return;
+ }
SteerAICarWithPhysicsHeadingForTarget(pVehicle, pVehicle->AutoPilot.m_pTargetCar,
pVehicle->AutoPilot.m_pTargetCar->GetPosition().x, pVehicle->AutoPilot.m_pTargetCar->GetPosition().y,
pSwerve, pAccel, pBrake, pHandbrake);
return;
case MISSION_BLOCKCAR_CLOSE:
+ if (!pVehicle->AutoPilot.m_pTargetCar) {
+ debug("NO TARGET VEHICLE FOR MISSION_BLOCKCAR_CLOSE\n");
+ return;
+ }
SteerAICarWithPhysicsTryingToBlockTarget(pVehicle,
pVehicle->AutoPilot.m_pTargetCar->GetPosition().x,
pVehicle->AutoPilot.m_pTargetCar->GetPosition().y,
@@ -2498,6 +2526,9 @@ void CCarCtrl::SteerAICarWithPhysics_OnlyMission(CVehicle* pVehicle, float* pSwe
pSwerve, pAccel, pBrake, pHandbrake);
return;
case MISSION_BLOCKCAR_HANDBRAKESTOP:
+ if (!pVehicle->AutoPilot.m_pTargetCar) {
+ return;
+ }
SteerAICarWithPhysicsTryingToBlockTarget_Stop(pVehicle,
pVehicle->AutoPilot.m_pTargetCar->GetPosition().x,
pVehicle->AutoPilot.m_pTargetCar->GetPosition().y,
@@ -2575,8 +2606,8 @@ void CCarCtrl::SteerAIBoatWithPhysicsHeadingForTarget(CVehicle* pVehicle, float
{
CVector2D forward = pVehicle->GetForward();
forward.Normalise();
- float angleToTarget = CGeneral::GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y);
- float angleForward = CGeneral::GetATanOfXY(forward.x, forward.y);
+ float angleToTarget = GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y);
+ float angleForward = GetATanOfXY(forward.x, forward.y);
float steerAngle = LimitRadianAngle(angleToTarget - angleForward);
steerAngle = clamp(steerAngle, -DEFAULT_MAX_STEER_ANGLE, DEFAULT_MAX_STEER_ANGLE);
#ifdef FIX_BUGS
@@ -2607,8 +2638,8 @@ void CCarCtrl::SteerAIBoatWithPhysicsAttackingPlayer(CVehicle* pVehicle, float*
CVector2D forward = pVehicle->GetForward();
forward.Normalise();
CVector2D vecToProjection = FindPlayerCoors() + FindPlayerSpeed() * projection * GAME_SPEED_TO_CARAI_SPEED;
- float angleToTarget = CGeneral::GetATanOfXY(vecToProjection.x - pVehicle->GetPosition().x, vecToProjection.y - pVehicle->GetPosition().y);
- float angleForward = CGeneral::GetATanOfXY(forward.x, forward.y);
+ float angleToTarget = GetATanOfXY(vecToProjection.x - pVehicle->GetPosition().x, vecToProjection.y - pVehicle->GetPosition().y);
+ float angleForward = GetATanOfXY(forward.x, forward.y);
float steerAngle = LimitRadianAngle(angleToTarget - angleForward);
#ifdef FIX_BUGS
float speedTarget = pVehicle->AutoPilot.GetCruiseSpeed();
@@ -2696,7 +2727,7 @@ void CCarCtrl::SteerAIHeliTowardsTargetCoors(CAutomobile* pHeli)
if (distanceToTarget < 8.0f && pHeli->m_fHeliOrientation < 0.0f)
ZTurnSpeedTarget = 0.0f;
else {
- float fAngleTarget = CGeneral::GetATanOfXY(vecToTarget.x, vecToTarget.y) + PI;
+ float fAngleTarget = GetATanOfXY(vecToTarget.x, vecToTarget.y) + PI;
if (pHeli->m_fHeliOrientation >= 0.0f)
fAngleTarget = pHeli->m_fHeliOrientation;
fAngleTarget -= pHeli->m_fOrientation;
@@ -2739,7 +2770,7 @@ void CCarCtrl::SteerAIPlaneTowardsTargetCoors(CAutomobile* pPlane)
CVector2D vecToTarget = pPlane->AutoPilot.m_vecDestinationCoors - pPlane->GetPosition();
float fForwardZ = (pPlane->AutoPilot.m_vecDestinationCoors.z - pPlane->GetPosition().z) / vecToTarget.Magnitude();
fForwardZ = clamp(fForwardZ, -0.3f, 0.3f);
- float angle = CGeneral::GetATanOfXY(vecToTarget.x, vecToTarget.y);
+ float angle = GetATanOfXY(vecToTarget.x, vecToTarget.y);
while (angle > TWOPI)
angle -= TWOPI;
float difference = LimitRadianAngle(angle - pPlane->m_fOrientation);
@@ -2836,8 +2867,8 @@ void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerv
projectedPosition.y = positionOnCurrentLinkIncludingLane.y;
}
CVector2D distanceToProjectedPosition = projectedPosition - pVehicle->GetPosition();
- float angleCurrentLink = CGeneral::GetATanOfXY(distanceToProjectedPosition.x, distanceToProjectedPosition.y);
- float angleForward = CGeneral::GetATanOfXY(forward.x, forward.y);
+ float angleCurrentLink = GetATanOfXY(distanceToProjectedPosition.x, distanceToProjectedPosition.y);
+ float angleForward = GetATanOfXY(forward.x, forward.y);
if (pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_AVOID_CARS)
angleCurrentLink = FindAngleToWeaveThroughTraffic(pVehicle, nil, angleCurrentLink, angleForward);
float steerAngle = LimitRadianAngle(angleCurrentLink - angleForward);
@@ -2882,11 +2913,11 @@ void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerv
pCurrentLink->GetY() - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x);
trajectory -= pVehicle->GetPosition();
float speedAngleMultiplier = FindSpeedMultiplier(
- CGeneral::GetATanOfXY(trajectory.x, trajectory.y) - angleForward,
+ GetATanOfXY(trajectory.x, trajectory.y) - angleForward,
MIN_ANGLE_FOR_SPEED_LIMITING, MAX_ANGLE_FOR_SPEED_LIMITING, MIN_LOWERING_SPEED_COEFFICIENT);
float tmpWideMultiplier = FindSpeedMultiplier(
- CGeneral::GetATanOfXY(currentPathLinkForward.x, currentPathLinkForward.y) -
- CGeneral::GetATanOfXY(nextPathLinkForwardX, nextPathLinkForwardY),
+ GetATanOfXY(currentPathLinkForward.x, currentPathLinkForward.y) -
+ GetATanOfXY(nextPathLinkForwardX, nextPathLinkForwardY),
MIN_ANGLE_FOR_SPEED_LIMITING_BETWEEN_NODES, MAX_ANGLE_FOR_SPEED_LIMITING, MIN_LOWERING_SPEED_COEFFICIENT);
float speedNodesMultiplier;
if (scalarDistanceToNextNode > DISTANCE_TO_NEXT_NODE_TO_CONSIDER_SLOWING_DOWN || pVehicle->AutoPilot.m_nCruiseSpeed < 12)
@@ -2920,8 +2951,8 @@ void CCarCtrl::SteerAICarWithPhysicsHeadingForTarget(CVehicle* pVehicle, CPhysic
*pHandbrake = false;
CVector2D forward = pVehicle->GetForward();
forward.Normalise();
- float angleToTarget = CGeneral::GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y);
- float angleForward = CGeneral::GetATanOfXY(forward.x, forward.y);
+ float angleToTarget = GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y);
+ float angleForward = GetATanOfXY(forward.x, forward.y);
if (pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_AVOID_CARS)
angleToTarget = FindAngleToWeaveThroughTraffic(pVehicle, pTarget, angleToTarget, angleForward);
float steerAngle = LimitRadianAngle(angleToTarget - angleForward);
@@ -2930,7 +2961,7 @@ void CCarCtrl::SteerAICarWithPhysicsHeadingForTarget(CVehicle* pVehicle, CPhysic
*pHandbrake = true;
float maxAngle = FindMaxSteerAngle(pVehicle);
steerAngle = Min(maxAngle, Max(-maxAngle, steerAngle));
- float speedMultiplier = FindSpeedMultiplier(angleToTarget - angleForward,
+ float speedMultiplier = FindSpeedMultiplier(CGeneral::GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y) - angleForward,
MIN_ANGLE_FOR_SPEED_LIMITING, MAX_ANGLE_FOR_SPEED_LIMITING, MIN_LOWERING_SPEED_COEFFICIENT);
float speedTarget = pVehicle->AutoPilot.m_nCruiseSpeed * speedMultiplier;
float currentSpeed = pVehicle->GetMoveSpeed().Magnitude() * GAME_SPEED_TO_CARAI_SPEED;
@@ -3127,7 +3158,7 @@ bool CCarCtrl::JoinCarWithRoadSystemGotoCoors(CVehicle* pVehicle, CVector vecTar
void CCarCtrl::FindLinksToGoWithTheseNodes(CVehicle* pVehicle)
{
if (pVehicle->m_nRouteSeed)
- CGeneral::SetRandomSeed(pVehicle->m_nRouteSeed);
+ CGeneral::SetRandomSeed(pVehicle->m_nRouteSeed++);
int nextLink;
CPathNode* pCurNode = &ThePaths.m_pathNodes[pVehicle->AutoPilot.m_nCurrentRouteNode];
for (nextLink = 0; nextLink < 12; nextLink++)
@@ -3169,10 +3200,12 @@ void CCarCtrl::GenerateEmergencyServicesCar(void)
return;
if (CGame::IsInInterior())
return;
+ if (TheCamera.m_WideScreenOn) // TODO(LCS): verify
+ return;
if (NumFiretrucksOnDuty + NumAmbulancesOnDuty + NumParkedCars + NumMissionCars +
NumLawEnforcerCars + NumRandomCars > MaxNumberOfCarsInUse)
return;
- if (NumAmbulancesOnDuty == 0){
+ if (NumAmbulancesOnDuty == 0 /* TODO(LCS): && gbEmergencyVehiclesEnabled */){
if (gAccidentManager.CountActiveAccidents() < 2){
if (CStreaming::HasModelLoaded(MI_AMBULAN))
CStreaming::SetModelIsDeletable(MI_MEDIC);
@@ -3191,7 +3224,7 @@ void CCarCtrl::GenerateEmergencyServicesCar(void)
}
}
}
- if (NumFiretrucksOnDuty == 0){
+ if (NumFiretrucksOnDuty == 0 /* TODO(LCS): && gbEmergencyVehiclesEnabled */){
if (gFireManager.GetTotalActiveFires() < 3){
if (CStreaming::HasModelLoaded(MI_FIRETRUCK))
CStreaming::SetModelIsDeletable(MI_FIREMAN);
@@ -3348,6 +3381,17 @@ bool CCarCtrl::MapCouldMoveInThisArea(float x, float y)
#endif
}
+bool
+CCarCtrl::BoatWithTallMast(int32 mi)
+{
+ return mi == MI_RIO || mi == MI_TROPIC || mi == MI_MARQUIS;
+}
+
+bool CCarCtrl::OkToCreateVehicleAtThisPosition(const CVector& pos)
+{
+ return true;
+}
+
float CCarCtrl::FindSpeedMultiplierWithSpeedFromNodes(int8 type)
{
switch (type)
@@ -3357,3 +3401,8 @@ float CCarCtrl::FindSpeedMultiplierWithSpeedFromNodes(int8 type)
}
return 1.0f;
}
+
+void CCarCtrl::RenderDebugInfo(CVehicle*)
+{
+ //TODO(LCS)
+}
diff --git a/src/control/CarCtrl.h b/src/control/CarCtrl.h
index 5efbe275..fcb7929b 100644
--- a/src/control/CarCtrl.h
+++ b/src/control/CarCtrl.h
@@ -1,6 +1,7 @@
#pragma once
#include "PathFind.h"
#include "Boat.h"
+#include "General.h"
#include "Vehicle.h"
#define GAME_SPEED_TO_METERS_PER_SECOND 50.0f
@@ -130,6 +131,10 @@ public:
static void SteerAIBoatWithPhysicsAttackingPlayer(CVehicle*, float*, float*, float*, bool*);
static void SteerAICarBlockingPlayerForwardAndBack(CVehicle*, float*, float*, float*, bool*);
+ static bool OkToCreateVehicleAtThisPosition(const CVector&);
+ static void RenderDebugInfo(CVehicle*);
+ static float GetATanOfXY(float x, float y) { float t = CGeneral::GetATanOfXY(x, y); if (t < 0.0f) t += TWOPI; return t; }
+
static float GetPositionAlongCurrentCurve(CVehicle* pVehicle)
{
uint32 timeInCurve = CTimer::GetTimeInMilliseconds() - pVehicle->AutoPilot.m_nTimeEnteredCurve;
@@ -138,11 +143,7 @@ public:
static float LimitRadianAngle(float angle)
{
- while (angle < -PI)
- angle += TWOPI;
- while (angle > PI)
- angle -= TWOPI;
- return angle;
+ return CGeneral::LimitRadianAngle(angle);
}
static bool bMadDriversCheat;
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp
index 89377db5..f083ecb5 100644
--- a/src/control/Garages.cpp
+++ b/src/control/Garages.cpp
@@ -1494,9 +1494,9 @@ void CGarage::BuildRotatedDoorMatrix(CEntity * pDoor, float fPosition)
void CGarage::UpdateCrusherAngle()
{
RefreshDoorPointers(false);
- m_pDoor2->GetMatrix().SetRotateXOnly(TWOPI - m_fDoorPos);
- m_pDoor2->GetMatrix().UpdateRW();
- m_pDoor2->UpdateRwFrame();
+ //m_pDoor2->GetMatrix().SetRotateXOnly(TWOPI - m_fDoorPos); TODO
+ //m_pDoor2->GetMatrix().UpdateRW();
+ //m_pDoor2->UpdateRwFrame();
}
void CGarage::UpdateCrusherShake(float X, float Y)
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp
index 3470e475..5186a8d2 100644
--- a/src/control/Pickups.cpp
+++ b/src/control/Pickups.cpp
@@ -1186,7 +1186,9 @@ CPickups::DoPickUpEffects(CEntity *entity)
CCoronas::REFLECTION_OFF,
CCoronas::LOSCHECK_OFF,
CCoronas::STREAK_OFF,
- 0.0f);
+ 0.0f,
+ false,
+ -0.5f);
}
}
@@ -1253,7 +1255,7 @@ CPickups::DoCollectableEffects(CEntity *entity)
int32 color = (MAXDIST - dist) * (0.5f * s + 0.5f) / MAXDIST * 255.0f;
CShadows::StoreStaticShadow((uintptr)entity, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos, 2.0f, 0.0f, 0.0f, -2.0f, 0, color, color, color, 4.0f,
1.0f, 40.0f, false, 0.0f);
- CCoronas::RegisterCorona((uintptr)entity, color, color, color, 255, pos, 0.6f, 40.0f, CCoronas::TYPE_RING, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
+ CCoronas::RegisterCorona((uintptr)entity, color, color, color, 255, pos, 0.6f, 40.0f, CCoronas::TYPE_HEX, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
}
entity->GetMatrix().SetRotateZOnly((float)(CTimer::GetTimeInMilliseconds() & 0xFFF) * DEGTORAD(360.0f / 0x1000));
diff --git a/src/control/SceneEdit.cpp b/src/control/SceneEdit.cpp
index 20f09cb4..c793e027 100644
--- a/src/control/SceneEdit.cpp
+++ b/src/control/SceneEdit.cpp
@@ -331,7 +331,7 @@ void CSceneEdit::Draw(void)
#ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT - SHADOW_OFFSET), SCREEN_SCALE_Y(COMMAND_NAME_Y + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT), wstr);
#else
- CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT) + SHADOW_OFFSET, SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT), wstr);
+ CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT) + SHADOW_OFFSET, SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT, wstr);
#endif
if (nCommandDrawn == m_nCurrentCommand)
CFont::SetColor(CRGBA(156, 91, 40, 255));
@@ -340,7 +340,7 @@ void CSceneEdit::Draw(void)
#ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT), SCREEN_SCALE_Y(COMMAND_NAME_Y + i * COMMAND_NAME_HEIGHT), wstr);
#else
- CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT), SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + i * COMMAND_NAME_HEIGHT), wstr);
+ CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT), SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + i * COMMAND_NAME_HEIGHT, wstr);
#endif
}
}
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 735c2c6f..038eff6d 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -49,18 +49,20 @@
#include "Timecycle.h"
#include "TxdStore.h"
#include "Bike.h"
+#include "memoryManager.h"
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
#include <stdarg.h>
#endif
-//--MIAMI: file done
+//--LCS: file done except TODOs and command table
-uint8 CTheScripts::ScriptSpace[SIZE_SCRIPT_SPACE];
+uint8* CTheScripts::ScriptSpace;
CRunningScript CTheScripts::ScriptsArray[MAX_NUM_SCRIPTS];
intro_text_line CTheScripts::IntroTextLines[MAX_NUM_INTRO_TEXT_LINES];
intro_script_rectangle CTheScripts::IntroRectangles[MAX_NUM_INTRO_RECTANGLES];
CSprite2d CTheScripts::ScriptSprites[MAX_NUM_SCRIPT_SRPITES];
script_sphere_struct CTheScripts::ScriptSphereArray[MAX_NUM_SCRIPT_SPHERES];
+tCollectiveData CTheScripts::CollectiveArray[MAX_NUM_COLLECTIVES];
tUsedObject CTheScripts::UsedObjectArray[MAX_NUM_USED_OBJECTS];
int32 CTheScripts::MultiScriptArray[MAX_NUM_MISSION_SCRIPTS];
tBuildingSwap CTheScripts::BuildingSwapArray[MAX_NUM_BUILDING_SWAPS];
@@ -96,10 +98,16 @@ uint32 CTheScripts::LastMissionPassedTime;
uint16 CTheScripts::NumberOfExclusiveMissionScripts;
bool CTheScripts::bPlayerHasMetDebbieHarry;
bool CTheScripts::bPlayerIsInTheStatium;
-#if (defined GTA_PC && !defined GTAVC_JP_PATCH || defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT)
-int16 CTheScripts::CardStack[CARDS_IN_DECK * MAX_DECKS];
-int16 CTheScripts::CardStackPosition;
-#endif
+int CTheScripts::AllowedCollision[MAX_ALLOWED_COLLISIONS];
+bool CTheScripts::FSDestroyedFlag;
+short* CTheScripts::SavedVarIndices;
+int CTheScripts::NumSaveVars;
+int gScriptsFile = -1;
+int CTheScripts::NextProcessId = 1;
+bool CTheScripts::InTheScripts;
+CRunningScript* pCurrent;
+uint16 CTheScripts::NumTrueGlobals;
+uint16 CTheScripts::MostGlobals;
#ifdef MISSION_REPLAY
@@ -225,7 +233,7 @@ const tScriptCommandData commands[] = {
REGISTER_COMMAND(COMMAND_GOSUB, INPUT_ARGUMENTS(ARGTYPE_LABEL,), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_RETURN, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_LINE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_CREATE_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CREATE_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
REGISTER_COMMAND(COMMAND_GET_PLAYER_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""),
REGISTER_COMMAND(COMMAND_SET_PLAYER_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_BOOL,), OUTPUT_ARGUMENTS(), true, -1, ""),
@@ -284,16 +292,16 @@ const tScriptCommandData commands[] = {
REGISTER_COMMAND(COMMAND_SET_LVAR_INT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ="),
REGISTER_COMMAND(COMMAND_CSET_VAR_INT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
REGISTER_COMMAND(COMMAND_CSET_VAR_FLOAT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
- REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
- REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
+ REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"),
+ REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"),
REGISTER_COMMAND(COMMAND_CSET_VAR_INT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
REGISTER_COMMAND(COMMAND_CSET_VAR_FLOAT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
- REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
- REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
- REGISTER_COMMAND(COMMAND_ABS_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"),
- REGISTER_COMMAND(COMMAND_ABS_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"),
- REGISTER_COMMAND(COMMAND_ABS_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"),
- REGISTER_COMMAND(COMMAND_ABS_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"),
+ REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"),
+ REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"),
+ REGISTER_COMMAND(COMMAND_ABS_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"),
+ REGISTER_COMMAND(COMMAND_ABS_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"),
+ REGISTER_COMMAND(COMMAND_ABS_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"),
+ REGISTER_COMMAND(COMMAND_ABS_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"),
REGISTER_COMMAND(COMMAND_GENERATE_RANDOM_FLOAT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""),
REGISTER_COMMAND(COMMAND_GENERATE_RANDOM_INT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
REGISTER_COMMAND(COMMAND_CREATE_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_PED_HANDLE,), false, -1, ""),
@@ -356,6 +364,11 @@ const tScriptCommandData commands[] = {
REGISTER_COMMAND(COMMAND_WHILE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_WHILENOT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_ENDWHILE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_214, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_215, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_216, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_217, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_218, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_ANDOR, INPUT_ARGUMENTS(ARGTYPE_ANDOR,), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_LAUNCH_MISSION, INPUT_ARGUMENTS(ARGTYPE_LABEL,), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_MISSION_HAS_FINISHED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
@@ -922,8 +935,8 @@ const tScriptCommandData commands[] = {
REGISTER_COMMAND(COMMAND_PRINT_WITH_6_NUMBERS_NOW, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_PRINT_WITH_6_NUMBERS_SOON, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FOLLOW_CHAR_IN_FORMATION, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_PLAYER_MADE_PROGRESS, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_SET_PROGRESS_TOTAL, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PLAYER_MADE_PROGRESS, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_PROGRESS_TOTAL, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_REGISTER_JUMP_DISTANCE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_REGISTER_JUMP_HEIGHT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_REGISTER_JUMP_FLIPS, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
@@ -1578,39 +1591,222 @@ const tScriptCommandData commands[] = {
REGISTER_COMMAND(COMMAND_REGISTER_FIRE_LEVEL, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_IS_AUSTRALIAN_GAME, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
REGISTER_COMMAND(COMMAND_DISARM_CAR_BOMB, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
-#if (defined GTAVC_JP_PATCH || defined SUPPORT_JAPANESE_SCRIPT)
REGISTER_COMMAND(COMMAND_IS_JAPANESE_GAME, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
-#elif (!defined GTA_PS2)
- REGISTER_COMMAND(COMMAND_SET_ONSCREEN_COUNTER_FLASH_WHEN_FIRST_DISPLAYED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
-#endif
-#if (defined GTA_PC && !defined GTAVC_JP_PATCH || defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT)
- REGISTER_COMMAND(COMMAND_SHUFFLE_CARD_DECKS, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_FETCH_NEXT_CARD, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT, ), false, -1, ""),
- REGISTER_COMMAND(COMMAND_GET_OBJECT_VELOCITY, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), false, -1, ""),
- REGISTER_COMMAND(COMMAND_IS_DEBUG_CAMERA_ON, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
- REGISTER_COMMAND(COMMAND_ADD_TO_OBJECT_ROTATION_VELOCITY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_SET_OBJECT_ROTATION_VELOCITY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_IS_OBJECT_STATIC, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), true, -1, ""),
- REGISTER_COMMAND(COMMAND_GET_ANGLE_BETWEEN_2D_VECTORS, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ), false, -1, ""),
- REGISTER_COMMAND(COMMAND_DO_2D_RECTANGLES_COLLIDE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), true, -1, ""),
- REGISTER_COMMAND(COMMAND_GET_OBJECT_ROTATION_VELOCITY, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), false, -1, ""),
- REGISTER_COMMAND(COMMAND_ADD_VELOCITY_RELATIVE_TO_OBJECT_VELOCITY, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_GET_OBJECT_SPEED, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ), false, -1, ""),
-#endif
-#if (defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT)
- REGISTER_COMMAND(COMMAND_MARK_CUTSCENE_START, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_MARK_CUTSCENE_END, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_CUTSCENE_SCROLL, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
-#elif (defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT)
- REGISTER_COMMAND(COMMAND_IS_MISSION_SKIP, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT, ), false, -1, ""),
- REGISTER_COMMAND(COMMAND_SET_IN_AMMUNATION, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_DO_SAVE_GAME, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_IS_RETRY, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT, ), false, -1, ""),
- REGISTER_COMMAND(COMMAND_DUMMY, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_MARK_CUTSCENE_START, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_MARK_CUTSCENE_END, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_CUTSCENE_SCROLL, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
-#endif
+ REGISTER_COMMAND(COMMAND_1442, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1443, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1444, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1445, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1446, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1447, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1448, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1449, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1450, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1451, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1452, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1453, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CALL, INPUT_ARGUMENTS(ARGTYPE_FUNCTION, ), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_NOTCALL, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1456, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1457, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1458, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1459, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1460, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1461, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1462, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1463, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1464, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1465, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1466, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1467, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1468, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1469, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1470, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1471, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1472, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1473, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1474, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1475, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1476, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1477, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1478, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1479, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1480, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1481, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1482, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1483, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1484, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1485, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1486, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1487, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1488, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1489, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1490, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1491, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1492, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1493, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1494, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1495, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1496, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1497, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1498, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1499, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1500, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1501, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1502, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1503, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1504, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1505, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1506, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1507, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1508, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1509, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1510, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1511, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1512, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1513, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1514, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1515, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1516, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1517, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1518, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1519, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1520, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1521, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1522, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1523, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1524, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1525, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1526, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1527, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1528, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1529, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1530, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1531, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1532, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1533, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1534, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1535, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1536, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1537, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1538, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1539, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1540, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1541, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1542, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1543, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1544, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1545, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1546, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1547, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1548, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1549, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1550, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1551, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1552, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1553, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1554, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1555, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1556, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1557, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1558, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1559, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1560, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_1561, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1562, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1563, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1564, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1565, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1566, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1567, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1568, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1569, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_1570, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1571, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1572, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1573, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1574, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1575, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1576, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1577, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1578, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1579, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1580, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1581, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1582, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1583, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1584, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1585, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1586, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1587, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1588, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1589, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1590, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1591, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1592, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1593, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1594, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1595, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1596, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1597, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1598, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1599, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1600, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1601, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1602, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1603, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1604, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1605, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1606, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1607, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1608, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1609, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1610, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1611, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1612, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1613, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1614, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1615, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1616, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1617, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1618, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1619, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1620, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1621, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1622, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1623, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1624, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1625, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1626, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1627, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1628, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1629, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1630, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1631, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1632, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1633, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1634, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1635, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1636, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1637, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1638, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1639, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1640, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1641, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1642, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1643, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1644, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1645, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1646, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1647, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1648, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1649, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1650, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1651, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1652, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1653, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1654, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1655, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1656, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
};
#undef REGISTER_COMMAND
#undef INPUT_ARGUMENTS
@@ -1683,6 +1879,23 @@ cleanup_entity_struct* CMissionCleanup::FindFree()
return nil;
}
+void SleepThisPed(cleanup_entity_struct* pCleanup, CPed* pPed)
+{
+ printf("*** SLEEPING PED %i %i\n", pCleanup->id, pPed->GetModelIndex());
+ if (!pPed->GetIsStatic())
+ pPed->RemoveFromMovingList();
+ pPed->bIsStaticWaitingForCollision = true;
+}
+
+void WakeThisPed(cleanup_entity_struct* pCleanup, CPed* pPed)
+{
+ printf("*** WAKING UP PED %i %i\n", pCleanup->id, pPed->GetModelIndex());
+ pPed->bIsStaticWaitingForCollision = false;
+ if (!pPed->bIsStatic)
+ pPed->AddToMovingList();
+
+}
+
void CMissionCleanup::AddEntityToList(int32 id, uint8 type)
{
cleanup_entity_struct* pNew = FindFree();
@@ -1752,46 +1965,100 @@ void CMissionCleanup::CheckIfCollisionHasLoadedForMissionObjects()
{
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(m_sEntities[i].id);
if (pVehicle) {
- if (pVehicle->bIsStaticWaitingForCollision) {
- if (CColStore::HasCollisionLoaded(pVehicle->GetPosition())) {
- pVehicle->bIsStaticWaitingForCollision = false;
+ eLevelName level = CTheZones::GetLevelFromPosition(&pVehicle->GetPosition());
+ if (level == LEVEL_GENERIC)
+ level = CGame::currLevel;
+ if (!CColStore::HasCollisionLoaded(level)) {
+ if (!pVehicle->bIsStaticWaitingForCollision) {
+ if (!pVehicle->IsHeli() && !pVehicle->IsPlane() && pVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI &&
+ pVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT && pVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_PLANE) {
+ printf("*** SLEEPING VEHICLE %i %i\n", m_sEntities[i].id, pVehicle->GetModelIndex());
if (!pVehicle->GetIsStatic())
- pVehicle->AddToMovingList();
+ pVehicle->RemoveFromMovingList();
+ pVehicle->bIsStaticWaitingForCollision = true;
+ }
}
}
- }
- break;
- }
- case CLEANUP_CHAR:
- {
- CPed* pPed = CPools::GetPedPool()->GetAt(m_sEntities[i].id);
- if (pPed) {
- if (pPed->bIsStaticWaitingForCollision) {
- if (CColStore::HasCollisionLoaded(pPed->GetPosition())) {
- pPed->bIsStaticWaitingForCollision = false;
- if (!pPed->GetIsStatic())
- pPed->AddToMovingList();
+ else {
+ if (pVehicle->bIsStaticWaitingForCollision) {
+ printf("*** WAKING UP VEHICLE %i %i\n", m_sEntities[i].id, pVehicle->GetModelIndex());
+ pVehicle->bIsStaticWaitingForCollision = false;
+ if (!pVehicle->bIsStatic)
+ pVehicle->AddToMovingList();
}
}
}
- break;
}
+ break;
case CLEANUP_OBJECT:
- {
CObject* pObject = CPools::GetObjectPool()->GetAt(m_sEntities[i].id);
if (pObject) {
- if (pObject->bIsStaticWaitingForCollision) {
- if (CColStore::HasCollisionLoaded(pObject->GetPosition())) {
- pObject->bIsStaticWaitingForCollision = false;
+ eLevelName level = CTheZones::GetLevelFromPosition(&pObject->GetPosition());
+ if (level == LEVEL_GENERIC)
+ level = CGame::currLevel;
+ if (!CColStore::HasCollisionLoaded(level)) {
+ if (!pObject->bIsStaticWaitingForCollision) {
if (!pObject->GetIsStatic())
+ pObject->RemoveFromMovingList();
+ pObject->bIsStaticWaitingForCollision = true;
+ }
+ }
+ else {
+ if (pObject->bIsStaticWaitingForCollision) {
+ pObject->bIsStaticWaitingForCollision = false;
+ if (!pObject->bIsStatic)
pObject->AddToMovingList();
}
}
}
- break;
}
- default:
- break;
+ }
+ for (int i = 0; i < MAX_CLEANUP; i++) {
+ switch (m_sEntities[i].type) {
+ case CLEANUP_CHAR:
+ {
+ CPed* pPed = CPools::GetPedPool()->GetAt(m_sEntities[i].id);
+ if (pPed) {
+ eLevelName level = CTheZones::GetLevelFromPosition(&pPed->GetPosition());
+ if (level == LEVEL_GENERIC)
+ level = CGame::currLevel;
+ if (!pPed->bIsStaticWaitingForCollision) {
+ if (pPed->bInVehicle) {
+ if (pPed->m_pMyVehicle->GetIsStatic()) {
+ SleepThisPed(&m_sEntities[i], pPed);
+ continue;
+ }
+ }
+ if (!CColStore::HasCollisionLoaded(level)) {
+ if (pPed->bInVehicle && pPed->m_pMyVehicle->GetIsStatic() ||
+ pPed->m_attachedTo && pPed->m_attachedTo->GetIsStatic())
+ SleepThisPed(&m_sEntities[i], pPed);
+ }
+ }
+ else {
+ if (!pPed->bInVehicle) {
+ if (CColStore::HasCollisionLoaded(level)) {
+ if (!(pPed->bInVehicle && pPed->m_pMyVehicle->GetIsStatic() ||
+ pPed->m_attachedTo && pPed->m_attachedTo->GetIsStatic()))
+ WakeThisPed(&m_sEntities[i], pPed);
+ }
+ }
+ else {
+ if (!pPed->m_pMyVehicle->GetIsStatic()) {
+ WakeThisPed(&m_sEntities[i], pPed);
+ continue;
+ }
+ if (CColStore::HasCollisionLoaded(level)) {
+ if (!(pPed->bInVehicle && pPed->m_pMyVehicle->GetIsStatic() ||
+ pPed->m_attachedTo && pPed->m_attachedTo->GetIsStatic()))
+ WakeThisPed(&m_sEntities[i], pPed);
+ }
+ }
+ }
+
+ }
+ }
+ break;
}
}
}
@@ -1803,6 +2070,8 @@ void CMissionCleanup::Process()
CCarCtrl::CarDensityMultiplier = 1.0f;
CPed::nThreatReactionRangeMultiplier = 1;
CPed::nEnterCarRangeMultiplier = 1;
+ for (int i = 0; i < MAX_ALLOWED_COLLISIONS; i++)
+ CTheScripts::AllowedCollision[i] = 0;
FindPlayerPed()->m_pWanted->m_fCrimeSensitivity = 1.0f;
CRoadBlocks::ClearScriptRoadBlocks();
CRouteNode::Initialise();
@@ -1810,20 +2079,19 @@ void CMissionCleanup::Process()
TheCamera.Restore();
TheCamera.SetWideScreenOff();
CSpecialFX::bLiftCam = false;
- CSpecialFX::bVideoCam = false;
- CTimeCycle::StopExtraColour(0);
+ // TODO(LCS): CHud::m_ClockEventWarningMinutes = 0;
+ // TODO(LCS): CHud::m_ClockEventFlashTimer = 0;
+ CTimeCycle::StopExtraColour(0); // TODO: thiscall
for (int i = 0; i < MISSION_AUDIO_SLOTS; i++)
DMAudio.ClearMissionAudio(i);
CWeather::ReleaseWeather();
for (int i = 0; i < NUM_OF_SPECIAL_CHARS; i++)
CStreaming::SetMissionDoesntRequireSpecialChar(i);
- for (int i = 0; i < NUM_OF_CUTSCENE_OBJECTS; i++)
- CStreaming::SetMissionDoesntRequireModel(MI_CUTOBJ01 + i);
CStreaming::ms_disableStreaming = false;
- CHud::m_ItemToFlash = -1;
- CHud::SetHelpMessage(nil, false);
+ if (CHud::m_ItemToFlash != ITEM_ARMOUR && CHud::m_ItemToFlash != ITEM_HEALTH)
+ CHud::m_ItemToFlash = -1;
+ CHud::SetHelpMessage(nil, false); // nil, false, false, true TODO(LCS)
CUserDisplay::OnscnTimer.m_bDisabled = false;
- CTheScripts::RemoveScriptTextureDictionary();
CWorld::Players[0].m_pPed->m_pWanted->m_bIgnoredByCops = false;
CWorld::Players[0].m_pPed->m_pWanted->m_bIgnoredByEveryone = false;
CWorld::Players[0].MakePlayerSafe(false);
@@ -1831,10 +2099,11 @@ void CMissionCleanup::Process()
CWorld::Players[0].m_pPed->m_nDrunkCountdown = 0;
CPad::GetPad(0)->SetDrunkInputDelay(0);
CWorld::Players[0].m_bDriveByAllowed = true;
+ CPad::GetPad(0)->unk_B4 = 1.0f;
+ CPad::GetPad(0)->unk_B8 = 0.5f;
DMAudio.ShutUpPlayerTalking(0);
CVehicle::bDisableRemoteDetonation = false;
CVehicle::bDisableRemoteDetonationOnContact = false;
- CGameLogic::ClearShortCut();
CTheScripts::RiotIntensity = 0;
CTheScripts::StoreVehicleIndex = -1;
CTheScripts::StoreVehicleWasRandom = true;
@@ -1872,6 +2141,10 @@ void CMissionCleanup::Process()
m_sEntities[i].type = CLEANUP_UNUSED;
m_nCount--;
}
+ for (int i = 1; i < NUMSTREAMINFO; i++) {
+ if (CStreaming::IsScriptOwnedModel(i))
+ CStreaming::SetMissionDoesntRequireModel(i);
+ }
}
/* NB: CUpsideDownCarCheck is not used by actual script at all
@@ -1894,7 +2167,7 @@ bool CUpsideDownCarCheck::IsCarUpsideDown(int32 id)
bool CUpsideDownCarCheck::IsCarUpsideDown(CVehicle* pVehicle)
{
- assert(pVehicle);
+ script_assert(pVehicle);
return pVehicle->GetUp().z <= UPSIDEDOWN_UP_THRESHOLD &&
pVehicle->GetMoveSpeed().Magnitude() < UPSIDEDOWN_MOVE_SPEED_THRESHOLD &&
pVehicle->GetTurnSpeed().Magnitude() < UPSIDEDOWN_TURN_SPEED_THRESHOLD;
@@ -2033,109 +2306,157 @@ bool CStuckCarCheck::HasCarBeenStuckForAWhile(int32 id)
return false;
}
-void CRunningScript::CollectParameters(uint32* pIp, int16 total)
+void CRunningScript::CollectParameters(uint32* pIp, int16 total, int* pParameters)
{
- for (int16 i = 0; i < total; i++){
- uint16 varIndex;
+ while (total--){
switch (CTheScripts::Read1ByteFromScript(pIp))
{
- case ARGUMENT_INT32:
- case ARGUMENT_FLOAT:
- ScriptParams[i] = CTheScripts::Read4BytesFromScript(pIp);
+ case ARGUMENT_END:
+ return;
+ case ARGUMENT_INT_ZERO:
+ *pParameters = 0;
+ break;
+ case ARGUMENT_FLOAT_ZERO:
+ *pParameters = 0;
+ break;
+ case ARGUMENT_FLOAT_1BYTE:
+ *pParameters = (uint32)(uint8)CTheScripts::Read1ByteFromScript(pIp) << 24;
break;
- case ARGUMENT_GLOBALVAR:
- varIndex = CTheScripts::Read2BytesFromScript(pIp);
- script_assert(varIndex >= 8 && varIndex < CTheScripts::GetSizeOfVariableSpace());
- ScriptParams[i] = *((int32*)&CTheScripts::ScriptSpace[varIndex]);
+ case ARGUMENT_FLOAT_2BYTES:
+ *pParameters = (uint32)(uint16)CTheScripts::Read2BytesFromScript(pIp) << 16;
break;
- case ARGUMENT_LOCALVAR:
- varIndex = CTheScripts::Read2BytesFromScript(pIp);
- script_assert(varIndex >= 0 && varIndex < ARRAY_SIZE(m_anLocalVariables));
- ScriptParams[i] = m_anLocalVariables[varIndex];
+ case ARGUMENT_FLOAT_3BYTES:
+ *pParameters = (uint32)(uint8)CTheScripts::Read1ByteFromScript(pIp) << 8;
+ *pParameters |= (uint32)(uint16)CTheScripts::Read2BytesFromScript(pIp) << 16;
+ break;
+ case ARGUMENT_INT32:
+ case ARGUMENT_FLOAT:
+ *pParameters = CTheScripts::Read4BytesFromScript(pIp);
break;
case ARGUMENT_INT8:
- ScriptParams[i] = CTheScripts::Read1ByteFromScript(pIp);
+ *pParameters = CTheScripts::Read1ByteFromScript(pIp);
break;
case ARGUMENT_INT16:
- ScriptParams[i] = CTheScripts::Read2BytesFromScript(pIp);
+ *pParameters = CTheScripts::Read2BytesFromScript(pIp);
break;
default:
- script_assert(0);
+ *pIp -= 1;
+ *pParameters = *GetPointerToScriptVariable(pIp, 0);
break;
}
+ pParameters++;
}
}
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
-int CRunningScript::CollectParameterForDebug(char* buf, bool& var)
+int32* GetPointerToScriptVariableForDebug(CRunningScript* pScript, uint32* pIp, char* buf)
{
- uint16 varIndex;
char tmpstr[24];
+ uint8 type = CTheScripts::Read1ByteFromScript(pIp);
+ if (type >= ARGUMENT_GLOBAL_ARRAY) {
+ uint8 index_in_block = CTheScripts::Read1ByteFromScript(pIp);
+ uint8 index_id = CTheScripts::Read1ByteFromScript(pIp);
+ uint8 size = CTheScripts::Read1ByteFromScript(pIp);
+ script_assert(size > 0);
+ script_assert(pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id] < size);
+ uint8 index = Min(pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id], size - 1);
+ sprintf(tmpstr, " $%d[%d@ (%d)]", ((int)(type - ARGUMENT_GLOBAL_ARRAY) << 8) + index_in_block, index_id, pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id]);
+ strcat(buf, tmpstr);
+ return (int32*)&CTheScripts::ScriptSpace[4 * (((int)(type - ARGUMENT_GLOBAL_ARRAY) << 8) + index + index_in_block)];
+ }
+ else if (type >= ARGUMENT_GLOBAL) {
+ uint8 index_in_block = CTheScripts::Read1ByteFromScript(pIp);
+ sprintf(tmpstr, " $%d", ((int)(type - ARGUMENT_GLOBAL) << 8) + index_in_block);
+ strcat(buf, tmpstr);
+ return (int32*)&CTheScripts::ScriptSpace[4 * (((int)(type - ARGUMENT_GLOBAL) << 8) + index_in_block)];
+ }
+ else if (type >= ARGUMENT_LOCAL_ARRAY) {
+ uint8 index_id = CTheScripts::Read1ByteFromScript(pIp);
+ uint8 size = CTheScripts::Read1ByteFromScript(pIp);
+ script_assert(size > 0);
+ script_assert(pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id] < size);
+ uint8 index = Min(pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id], size - 1);
+ sprintf(tmpstr, " %d@[%d@ (%d)]", (type - ARGUMENT_LOCAL_ARRAY), index_id, pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id]);
+ strcat(buf, tmpstr);
+ return &pScript->m_anLocalVariables[pScript->m_nLocalsPointer + (type - ARGUMENT_LOCAL_ARRAY) + index];
+ }
+ else if (type >= ARGUMENT_LOCAL) {
+ sprintf(tmpstr, " %d@", (type - ARGUMENT_LOCAL));
+ strcat(buf, tmpstr);
+ return &pScript->m_anLocalVariables[pScript->m_nLocalsPointer + (type - ARGUMENT_LOCAL)];
+ }
+ else if (type >= ARGUMENT_TIMER) {
+ sprintf(tmpstr, " TIMER%d@", (type - ARGUMENT_TIMER));
+ strcat(buf, tmpstr);
+ return &pScript->m_anLocalVariables[NUM_LOCAL_VARS + 8 + (type - ARGUMENT_TIMER)]; // why 8?
+ }
+ script_assert(false && "wrong type for variable");
+ return nil;
+}
+
+int CRunningScript::CollectParameterForDebug(char* buf, bool& var)
+{
var = false;
+ int tmp;
switch (CTheScripts::Read1ByteFromScript(&m_nIp))
{
+ case ARGUMENT_END:
+ return 0; // TODO(LCS)
+ case ARGUMENT_INT_ZERO:
+ return 0;
+ case ARGUMENT_FLOAT_ZERO:
+ return 0;
+ case ARGUMENT_FLOAT_1BYTE:
+ return (uint32)(uint8)CTheScripts::Read1ByteFromScript(&m_nIp) << 24;
+ case ARGUMENT_FLOAT_2BYTES:
+ return (uint32)(uint16)CTheScripts::Read2BytesFromScript(&m_nIp) << 16;
+ case ARGUMENT_FLOAT_3BYTES:
+ tmp = (uint32)(uint8)CTheScripts::Read1ByteFromScript(&m_nIp) << 8;
+ tmp |= (uint32)(uint16)CTheScripts::Read2BytesFromScript(&m_nIp) << 16;
+ return tmp;
case ARGUMENT_INT32:
case ARGUMENT_FLOAT:
return CTheScripts::Read4BytesFromScript(&m_nIp);
- case ARGUMENT_GLOBALVAR:
- varIndex = CTheScripts::Read2BytesFromScript(&m_nIp);
- script_assert(varIndex >= 8 && varIndex < CTheScripts::GetSizeOfVariableSpace());
- var = true;
- sprintf(tmpstr, " $%d", varIndex / 4);
- strcat(buf, tmpstr);
- return *((int32*)&CTheScripts::ScriptSpace[varIndex]);
- case ARGUMENT_LOCALVAR:
- varIndex = CTheScripts::Read2BytesFromScript(&m_nIp);
- script_assert(varIndex >= 0 && varIndex < ARRAY_SIZE(m_anLocalVariables));
- var = true;
- sprintf(tmpstr, " %d@", varIndex);
- strcat(buf, tmpstr);
- return m_anLocalVariables[varIndex];
case ARGUMENT_INT8:
return CTheScripts::Read1ByteFromScript(&m_nIp);
case ARGUMENT_INT16:
return CTheScripts::Read2BytesFromScript(&m_nIp);
default:
- PrintToLog("%s - script assertion failed in CollectParameterForDebug", buf);
- script_assert(0);
- break;
+ var = true;
+ --m_nIp;
+ return *GetPointerToScriptVariableForDebug(this, &m_nIp, buf);
}
return 0;
}
void CRunningScript::GetStoredParameterForDebug(char* buf)
{
- uint16 varIndex;
- char tmpstr[24];
- switch (CTheScripts::Read1ByteFromScript(&m_nIp)) {
- case ARGUMENT_GLOBALVAR:
- varIndex = CTheScripts::Read2BytesFromScript(&m_nIp);
- sprintf(tmpstr, " $%d", varIndex / 4);
- strcat(buf, tmpstr);
- break;
- case ARGUMENT_LOCALVAR:
- varIndex = CTheScripts::Read2BytesFromScript(&m_nIp);
- sprintf(tmpstr, " %d@", varIndex);
- strcat(buf, tmpstr);
- break;
- default:
- PrintToLog("%s - script_assertion failed in GetStoredParameterForDebug", buf);
- script_assert(0);
- }
+ GetPointerToScriptVariableForDebug(this, &m_nIp, buf);
}
#endif
int32 CRunningScript::CollectNextParameterWithoutIncreasingPC(uint32 ip)
{
uint32* pIp = &ip;
+ int tmp;
switch (CTheScripts::Read1ByteFromScript(pIp))
{
+ case ARGUMENT_END:
+ return 0; // TODO(LCS)
+ case ARGUMENT_INT_ZERO:
+ return 0;
+ case ARGUMENT_FLOAT_ZERO:
+ return 0;
+ case ARGUMENT_FLOAT_1BYTE:
+ return (uint32)(uint8)CTheScripts::Read1ByteFromScript(pIp) << 24;
+ case ARGUMENT_FLOAT_2BYTES:
+ return (uint32)(uint16)CTheScripts::Read2BytesFromScript(pIp) << 16;
+ case ARGUMENT_FLOAT_3BYTES:
+ tmp = (uint32)(uint8)CTheScripts::Read1ByteFromScript(pIp) << 8;
+ tmp |= (uint32)(uint16)CTheScripts::Read2BytesFromScript(pIp) << 16;
+ return tmp;
case ARGUMENT_INT32:
return CTheScripts::Read4BytesFromScript(pIp);
- case ARGUMENT_GLOBALVAR:
- return *((int32*)&CTheScripts::ScriptSpace[(uint16)CTheScripts::Read2BytesFromScript(pIp)]);
- case ARGUMENT_LOCALVAR:
- return m_anLocalVariables[CTheScripts::Read2BytesFromScript(pIp)];
case ARGUMENT_INT8:
return CTheScripts::Read1ByteFromScript(pIp);
case ARGUMENT_INT16:
@@ -2143,7 +2464,8 @@ int32 CRunningScript::CollectNextParameterWithoutIncreasingPC(uint32 ip)
case ARGUMENT_FLOAT:
return CTheScripts::Read4BytesFromScript(pIp);
default:
- script_assert(0);
+ (*pIp)--;
+ return *GetPointerToScriptVariable(pIp, 0);
}
return -1;
}
@@ -2151,38 +2473,61 @@ int32 CRunningScript::CollectNextParameterWithoutIncreasingPC(uint32 ip)
void CRunningScript::StoreParameters(uint32* pIp, int16 number)
{
for (int16 i = 0; i < number; i++){
- switch (CTheScripts::Read1ByteFromScript(pIp)) {
- case ARGUMENT_GLOBALVAR:
- *(int32*)&CTheScripts::ScriptSpace[(uint16)CTheScripts::Read2BytesFromScript(pIp)] = ScriptParams[i];
- break;
- case ARGUMENT_LOCALVAR:
- m_anLocalVariables[CTheScripts::Read2BytesFromScript(pIp)] = ScriptParams[i];
- break;
- default:
- script_assert(0);
- }
+ *GetPointerToScriptVariable(pIp, 0) = ScriptParams[i];
}
}
+int32* GetPointerToScriptVariable(CRunningScript* pScript, uint32* pIp)
+{
+ uint8 type = CTheScripts::Read1ByteFromScript(pIp);
+ if (type >= ARGUMENT_GLOBAL_ARRAY) {
+ uint8 index_in_block = CTheScripts::Read1ByteFromScript(pIp);
+ uint8 index_id = CTheScripts::Read1ByteFromScript(pIp);
+ uint8 size = CTheScripts::Read1ByteFromScript(pIp);
+ script_assert(size > 0);
+ script_assert(pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id] < size);
+ uint8 index = Min(pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id], size - 1);
+ return (int32*)&CTheScripts::ScriptSpace[4 * (((int)(type - ARGUMENT_GLOBAL_ARRAY) << 8) + index + index_in_block)];
+ }
+ else if (type >= ARGUMENT_GLOBAL) {
+ uint8 index_in_block = CTheScripts::Read1ByteFromScript(pIp);
+ return (int32*)&CTheScripts::ScriptSpace[4 * (((int)(type - ARGUMENT_GLOBAL) << 8) + index_in_block)];
+ }
+ else if (type >= ARGUMENT_LOCAL_ARRAY) {
+ uint8 index_id = CTheScripts::Read1ByteFromScript(pIp);
+ uint8 size = CTheScripts::Read1ByteFromScript(pIp);
+ script_assert(size > 0);
+ script_assert(pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id] < size);
+ uint8 index = Min(pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id], size - 1);
+ return &pScript->m_anLocalVariables[pScript->m_nLocalsPointer + (type - ARGUMENT_LOCAL_ARRAY) + index];
+ }
+ else if (type >= ARGUMENT_LOCAL) {
+ return &pScript->m_anLocalVariables[pScript->m_nLocalsPointer + (type - ARGUMENT_LOCAL)];
+ }
+ else if (type >= ARGUMENT_TIMER) {
+ return &pScript->m_anLocalVariables[NUM_LOCAL_VARS + 8 + (type - ARGUMENT_TIMER)];
+ }
+ script_assert(false && "wrong type for variable");
+ return nil;
+}
+
int32 *CRunningScript::GetPointerToScriptVariable(uint32* pIp, int16 type)
{
- switch (CTheScripts::Read1ByteFromScript(pIp))
- {
- case ARGUMENT_GLOBALVAR:
- script_assert(type == VAR_GLOBAL);
- return (int32*)&CTheScripts::ScriptSpace[(uint16)CTheScripts::Read2BytesFromScript(pIp)];
- case ARGUMENT_LOCALVAR:
- script_assert(type == VAR_LOCAL);
- return &m_anLocalVariables[CTheScripts::Read2BytesFromScript(pIp)];
- default:
- script_assert(0);
+ return ::GetPointerToScriptVariable(this, pIp);
+}
+
+int CTheScripts::GetSaveVarIndex(int var)
+{
+ for (int i = 0; i < NumSaveVars; i++) {
+ if (SavedVarIndices[i] == var)
+ return i;
}
- return nil;
+ return -1;
}
void CRunningScript::Init()
{
- strcpy(m_abScriptName, "noname");
+ sprintf(m_abScriptName, "id%02i", m_nId);
next = prev = nil;
SetIP(0);
for (int i = 0; i < MAX_STACK_DEPTH; i++)
@@ -2193,13 +2538,28 @@ void CRunningScript::Init()
m_bCondResult = false;
m_bIsMissionScript = false;
m_bSkipWakeTime = false;
- for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
+ for (int i = 0; i < NUM_LOCAL_VARS + 8 + NUM_TIMERS; i++)
m_anLocalVariables[i] = 0;
m_nAndOrState = 0;
m_bNotFlag = false;
m_bDeatharrestEnabled = true;
m_bDeatharrestExecuted = false;
m_bMissionFlag = false;
+ m_nLocalsPointer = 0;
+}
+
+void CTheScripts::Shutdown()
+{
+ if (gScriptsFile != -1) {
+ CFileMgr::CloseFile(gScriptsFile);
+ gScriptsFile = -1;
+ }
+ if (ScriptSpace) {
+ base::cMainMemoryManager::Instance()->Free(ScriptSpace);
+ ScriptSpace = nil;
+ FSDestroyedFlag = false;
+ OnAMissionFlag = 0;
+ }
}
#ifdef USE_DEBUG_SCRIPT_LOADER
@@ -2229,10 +2589,10 @@ int open_script()
}
#endif
-void CTheScripts::Init()
+bool CTheScripts::Init(bool loaddata)
{
- for (int i = 0; i < SIZE_SCRIPT_SPACE; i++)
- ScriptSpace[i] = 0;
+ bool retval = false;
+ printf("CTheScripts::Init\n");
pActiveScripts = pIdleScripts = nil;
for (int i = 0; i < MAX_NUM_SCRIPTS; i++){
ScriptsArray[i].Init();
@@ -2241,25 +2601,38 @@ void CTheScripts::Init()
MissionCleanUp.Init();
UpsideDownCars.Init();
StuckCars.Init();
- CFileMgr::SetDir("data");
-#ifdef USE_DEBUG_SCRIPT_LOADER
- int mainf = open_script();
-#else
- int mainf = CFileMgr::OpenFile("main.scm", "rb");
-#endif
- CFileMgr::Read(mainf, (char*)ScriptSpace, SIZE_MAIN_SCRIPT);
- CFileMgr::CloseFile(mainf);
- CFileMgr::SetDir("");
StoreVehicleIndex = -1;
StoreVehicleWasRandom = true;
OnAMissionFlag = 0;
LastMissionPassedTime = (uint32)-1;
+ for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
+ CollectiveArray[i].colIndex = -1;
+ CollectiveArray[i].pedIndex = 0;
+ }
+ NextFreeCollectiveIndex = 0;
LastRandomPedId = -1;
for (int i = 0; i < MAX_NUM_USED_OBJECTS; i++){
memset(&UsedObjectArray[i].name, 0, sizeof(UsedObjectArray[i].name));
UsedObjectArray[i].index = 0;
}
NumberOfUsedObjects = 0;
+ if (ScriptSpace)
+ Shutdown();
+ CFileMgr::SetDir("DATA");
+#ifdef USE_DEBUG_SCRIPT_LOADER
+ int mainf = open_script();
+#else
+ int mainf = CFileMgr::OpenFile("main.scm", "rb");
+#endif
+ CFileMgr::Read(mainf, (char*)&MainScriptSize, sizeof(MainScriptSize));
+ int nLargestMissionSize = 0;
+ CFileMgr::Read(mainf, (char*)&nLargestMissionSize, sizeof(nLargestMissionSize));
+ // some cSmallHeap shit - TODO
+ ScriptSpace = (uint8*)base::cMainMemoryManager::Instance()->Allocate(MainScriptSize + nLargestMissionSize);
+ memset(ScriptSpace, 0, MainScriptSize + nLargestMissionSize);
+ CFileMgr::Read(mainf, (char*)ScriptSpace, MainScriptSize);
+ gScriptsFile = mainf;
+ CFileMgr::SetDir("");
ReadObjectNamesFromScript();
UpdateObjectIndices();
bAlreadyRunningAMissionScript = false;
@@ -2269,11 +2642,10 @@ void CTheScripts::Init()
NumberOfExclusiveMissionScripts = 0;
NumberOfMissionScripts = 0;
LargestMissionScriptSize = 0;
- MainScriptSize = 0;
ReadMultiScriptFileOffsetsFromScript();
FailCurrentMission = 0;
DbgFlag = false;
- NumScriptDebugLines = 0;
+ //NumScriptDebugLines = 0;
RiotIntensity = 0;
bPlayerHasMetDebbieHarry = false;
bPlayerIsInTheStatium = false;
@@ -2297,7 +2669,7 @@ void CTheScripts::Init()
IntroRectangles[i].m_sColor = CRGBA(255, 255, 255, 255);
}
NumberOfIntroRectanglesThisFrame = 0;
- RemoveScriptTextureDictionary();
+ //RemoveScriptTextureDictionary(); // TODO(LCS) - probably not needed
for (int i = 0; i < MAX_NUM_BUILDING_SWAPS; i++){
BuildingSwapArray[i].m_pBuilding = nil;
BuildingSwapArray[i].m_nNewModel = -1;
@@ -2305,6 +2677,12 @@ void CTheScripts::Init()
}
for (int i = 0; i < MAX_NUM_INVISIBILITY_SETTINGS; i++)
InvisibilitySettingArray[i] = nil;
+ if (loaddata) {
+ printf("loaddata = true\n");
+ //retval = GenericLoad(); // TODO
+ }
+ for (int i = 0; i < MAX_ALLOWED_COLLISIONS; i++)
+ AllowedCollision[i] = 0;
#if defined USE_ADVANCED_SCRIPT_DEBUG_OUTPUT && SCRIPT_LOG_FILE_LEVEL == 2
CFileMgr::SetDirMyDocuments();
@@ -2315,8 +2693,10 @@ void CTheScripts::Init()
PrintToLog(init_msg);
CFileMgr::SetDir("");
#endif
+ return retval;
}
+/*
void CTheScripts::RemoveScriptTextureDictionary()
{
for (int i = 0; i < ARRAY_SIZE(CTheScripts::ScriptSprites); i++)
@@ -2325,6 +2705,7 @@ void CTheScripts::RemoveScriptTextureDictionary()
if (slot != -1)
CTxdStore::RemoveTxd(slot);
}
+*/
void CRunningScript::RemoveScriptFromList(CRunningScript** ppScript)
{
@@ -2350,6 +2731,7 @@ CRunningScript* CTheScripts::StartNewScript(uint32 ip)
CRunningScript* pNew = pIdleScripts;
script_assert(pNew);
pNew->RemoveScriptFromList(&pIdleScripts);
+ pNew->m_nId = NextProcessId++;
pNew->Init();
pNew->SetIP(ip);
pNew->AddScriptToList(&pActiveScripts);
@@ -2361,6 +2743,8 @@ void CTheScripts::Process()
{
if (CReplay::IsPlayingBack())
return;
+ if (!ScriptSpace)
+ return;
CommandsExecuted = 0;
ScriptsUpdated = 0;
float timeStep = CTimer::GetTimeStepInMilliseconds();
@@ -2383,6 +2767,8 @@ void CTheScripts::Process()
UseTextCommands = 0;
}
+ // TODO: mCoronas
+
#ifdef MISSION_REPLAY
static uint32 TimeToWaitTill;
switch (AllowMissionReplay) {
@@ -2432,6 +2818,7 @@ void CTheScripts::Process()
#endif
CRunningScript* script = pActiveScripts;
+ InTheScripts = true;
while (script != nil){
CRunningScript* next = script->GetNext();
++ScriptsUpdated;
@@ -2466,6 +2853,7 @@ void CRunningScript::Process()
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
PrintToLog("\n\nProcessing script %s (id %d)\n\n", m_abScriptName, this - CTheScripts::ScriptsArray);
#endif
+ pCurrent = this;
if (m_bIsMissionScript)
DoDeatharrestCheck();
if (m_bMissionFlag && CTheScripts::FailCurrentMission == 1 && m_nStackPointer == 1)
@@ -2498,32 +2886,57 @@ int8 CRunningScript::ProcessOneCommand()
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
char commandInfo[1024];
uint32 ip = m_nIp;
+ uint8 nInputParams;
+ uint8 nOutputParameters;
+ uint8 nLocalsOffset;
if (command < ARRAY_SIZE(commands)) {
script_assert(commands[command].id == command);
- sprintf(commandInfo, m_nIp >= SIZE_MAIN_SCRIPT ? "M<%5d> " : "<%6d> ", m_nIp >= SIZE_MAIN_SCRIPT ? m_nIp - SIZE_MAIN_SCRIPT : m_nIp);
+ sprintf(commandInfo, m_nIp >= CTheScripts::MainScriptSize ? "M<%5d> " : "<%6d> ", m_nIp >= CTheScripts::MainScriptSize ? m_nIp - CTheScripts::MainScriptSize : m_nIp);
if (m_bNotFlag)
strcat(commandInfo, "NOT ");
if (commands[command].position == -1)
strcat(commandInfo, commands[command].name + sizeof("COMMAND_") - 1);
- for (int i = 0; commands[command].input[i] != ARGTYPE_NONE; i++) {
+ if (commands[command].input[0] == ARGTYPE_FUNCTION) {
char tmp[32];
bool var = false;
- int value;
- switch (commands[command].input[i]) {
- case ARGTYPE_INT:
- case ARGTYPE_PED_HANDLE:
- case ARGTYPE_VEHICLE_HANDLE:
- case ARGTYPE_OBJECT_HANDLE: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%d)" : " %d", value); break;
- case ARGTYPE_FLOAT: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%.3f)" : " %.3f", *(float*)&value); break;
- case ARGTYPE_STRING: sprintf(tmp, " '%s'", (const char*)&CTheScripts::ScriptSpace[m_nIp]); m_nIp += KEY_LENGTH_IN_SCRIPT; break;
- case ARGTYPE_LABEL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s(%d))" : " %s(%d)", value >= 0 ? "G" : "L", abs(value)); break;
- case ARGTYPE_BOOL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s)" : " %s", value ? "TRUE" : "FALSE"); break;
- case ARGTYPE_ANDOR: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, " %d %ss", (value + 1) % 10, value / 10 == 0 ? "AND" : "OR"); break;
- default: script_assert(0);
- }
+ nInputParams = CTheScripts::Read1ByteFromScript(&m_nIp);
+ nOutputParameters = CTheScripts::Read1ByteFromScript(&m_nIp);
+ nLocalsOffset = CTheScripts::Read1ByteFromScript(&m_nIp);
+ int value = CollectParameterForDebug(commandInfo, var);
+ sprintf(tmp, var ? " (%s(%d))" : " %s(%d)", value >= 0 ? "G" : "L", abs(value));
strcat(commandInfo, tmp);
- if (commands[command].position == i)
- strcat(commandInfo, commands[command].name_override);
+ strcat(commandInfo, "{");
+ for (int i = 0; i < nInputParams; i++) {
+ if (i != 0)
+ strcat(commandInfo, ", ");
+ value = CollectParameterForDebug(commandInfo, var);
+ sprintf(tmp, var ? "(%d)" : "%d", value);
+ strcat(commandInfo, tmp);
+
+ }
+ strcat(commandInfo, "}");
+ }
+ else {
+ for (int i = 0; commands[command].input[i] != ARGTYPE_NONE; i++) {
+ char tmp[32];
+ bool var = false;
+ int value;
+ switch (commands[command].input[i]) {
+ case ARGTYPE_INT:
+ case ARGTYPE_PED_HANDLE:
+ case ARGTYPE_VEHICLE_HANDLE:
+ case ARGTYPE_OBJECT_HANDLE: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%d)" : " %d", value); break;
+ case ARGTYPE_FLOAT: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%.3f)" : " %.3f", *(float*)&value); break;
+ case ARGTYPE_STRING: sprintf(tmp, " '%s'", (const char*)&CTheScripts::ScriptSpace[m_nIp]); m_nIp += KEY_LENGTH_IN_SCRIPT; break;
+ case ARGTYPE_LABEL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s(%d))" : " %s(%d)", value >= 0 ? "G" : "L", abs(value)); break;
+ case ARGTYPE_BOOL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s)" : " %s", value ? "TRUE" : "FALSE"); break;
+ case ARGTYPE_ANDOR: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, " %d %ss", (value + 1) % 10, value / 10 == 0 ? "AND" : "OR"); break;
+ default: script_assert(0);
+ }
+ strcat(commandInfo, tmp);
+ if (commands[command].position == i)
+ strcat(commandInfo, commands[command].name_override);
+ }
}
uint32 t = m_nIp;
m_nIp = ip;
@@ -2534,32 +2947,36 @@ int8 CRunningScript::ProcessOneCommand()
retval = ProcessCommands0To99(command);
else if (command < 200)
retval = ProcessCommands100To199(command);
- else if (command < 300)
+ else if (command < 305)
retval = ProcessCommands200To299(command);
- else if (command < 400)
+ else if (command < 405)
retval = ProcessCommands300To399(command);
- else if (command < 500)
+ else if (command < 505)
retval = ProcessCommands400To499(command);
- else if (command < 600)
+ else if (command < 605)
retval = ProcessCommands500To599(command);
- else if (command < 700)
+ else if (command < 705)
retval = ProcessCommands600To699(command);
- else if (command < 800)
+ else if (command < 805)
retval = ProcessCommands700To799(command);
- else if (command < 900)
+ else if (command < 905)
retval = ProcessCommands800To899(command);
- else if (command < 1000)
+ else if (command < 1005)
retval = ProcessCommands900To999(command);
- else if (command < 1100)
+ else if (command < 1105)
retval = ProcessCommands1000To1099(command);
- else if (command < 1200)
+ else if (command < 1205)
retval = ProcessCommands1100To1199(command);
- else if (command < 1300)
+ else if (command < 1305)
retval = ProcessCommands1200To1299(command);
- else if (command < 1400)
+ else if (command < 1405)
retval = ProcessCommands1300To1399(command);
- else if (command < 1500)
+ else if (command < 1497)
retval = ProcessCommands1400To1499(command);
+ else if (command < 1600)
+ retval = ProcessCommands1500To1599(command);
+ else if (command < 1700)
+ retval = ProcessCommands1600To1699(command);
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
if (command < ARRAY_SIZE(commands)) {
if (commands[command].cond || commands[command].output[0] != ARGTYPE_NONE) {
@@ -2569,15 +2986,17 @@ int8 CRunningScript::ProcessOneCommand()
uint32 t = m_nIp;
m_nIp = ip;
ip = t;
- for (int i = 0; commands[command].output[i] != ARGTYPE_NONE; i++) {
- char tmp[32];
- switch (commands[command].output[i]) {
- case ARGTYPE_INT:
- case ARGTYPE_PED_HANDLE:
- case ARGTYPE_VEHICLE_HANDLE:
- case ARGTYPE_OBJECT_HANDLE: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%d)", ScriptParams[i]); strcat(commandInfo, tmp); break;
- case ARGTYPE_FLOAT: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%8.3f)", *(float*)&ScriptParams[i]); strcat(commandInfo, tmp); break;
- default: script_assert(0 && "Script only returns INTs and FLOATs");
+ if (commands[command].input[0] != ARGTYPE_FUNCTION) {
+ for (int i = 0; commands[command].output[i] != ARGTYPE_NONE; i++) {
+ char tmp[32];
+ switch (commands[command].output[i]) {
+ case ARGTYPE_INT:
+ case ARGTYPE_PED_HANDLE:
+ case ARGTYPE_VEHICLE_HANDLE:
+ case ARGTYPE_OBJECT_HANDLE: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%d)", ScriptParams[i]); strcat(commandInfo, tmp); break;
+ case ARGTYPE_FLOAT: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%8.3f)", *(float*)&ScriptParams[i]); strcat(commandInfo, tmp); break;
+ default: script_assert(0 && "Script only returns INTs and FLOATs");
+ }
}
}
m_nIp = ip;
@@ -2606,16 +3025,18 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
float *fScriptVar1;
int *nScriptVar1;
switch (command) {
+ /*
case COMMAND_NOP:
return 0;
+ */
case COMMAND_WAIT:
CollectParameters(&m_nIp, 1);
- m_nWakeTime = CTimer::GetTimeInMilliseconds() + ScriptParams[0];
+ m_nWakeTime = CTimer::GetTimeInMilliseconds() + GET_INTEGER_PARAM(0);
m_bSkipWakeTime = false;
return 1;
case COMMAND_GOTO:
CollectParameters(&m_nIp, 1);
- SetIP(ScriptParams[0] >= 0 ? ScriptParams[0] : SIZE_MAIN_SCRIPT - ScriptParams[0]);
+ SetIP(GET_INTEGER_PARAM(0) >= 0 ? GET_INTEGER_PARAM(0) : CTheScripts::MainScriptSize - GET_INTEGER_PARAM(0));
/* Known issue: GOTO to 0. It might have been "better" to use > instead of >= */
/* simply because it never makes sense to jump to start of the script */
/* but jumping to start of a custom mission is an issue for simple mission-like scripts */
@@ -2624,174 +3045,174 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
return 0;
case COMMAND_SHAKE_CAM:
CollectParameters(&m_nIp, 1);
- CamShakeNoPos(&TheCamera, ScriptParams[0] / 1000.0f);
+ CamShakeNoPos(&TheCamera, GET_INTEGER_PARAM(0) / 1000.0f);
return 0;
case COMMAND_SET_VAR_INT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
CollectParameters(&m_nIp, 1);
- *ptr = ScriptParams[0];
+ *ptr = GET_INTEGER_PARAM(0);
return 0;
}
case COMMAND_SET_VAR_FLOAT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
CollectParameters(&m_nIp, 1);
- *(float*)ptr = *(float*)&ScriptParams[0];
+ *(float*)ptr = GET_FLOAT_PARAM(0);
return 0;
}
case COMMAND_SET_LVAR_INT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
CollectParameters(&m_nIp, 1);
- *ptr = ScriptParams[0];
+ *ptr = GET_INTEGER_PARAM(0);
return 0;
}
case COMMAND_SET_LVAR_FLOAT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
CollectParameters(&m_nIp, 1);
- *(float*)ptr = *(float*)&ScriptParams[0];
+ *(float*)ptr = GET_FLOAT_PARAM(0);
return 0;
}
case COMMAND_ADD_VAL_TO_INT_VAR:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
CollectParameters(&m_nIp, 1);
- *ptr += ScriptParams[0];
+ *ptr += GET_INTEGER_PARAM(0);
return 0;
}
case COMMAND_ADD_VAL_TO_FLOAT_VAR:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
CollectParameters(&m_nIp, 1);
- *(float*)ptr += *(float*)&ScriptParams[0];
+ *(float*)ptr += GET_FLOAT_PARAM(0);
return 0;
}
case COMMAND_ADD_VAL_TO_INT_LVAR:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
CollectParameters(&m_nIp, 1);
- *ptr += ScriptParams[0];
+ *ptr += GET_INTEGER_PARAM(0);
return 0;
}
case COMMAND_ADD_VAL_TO_FLOAT_LVAR:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
CollectParameters(&m_nIp, 1);
- *(float*)ptr += *(float*)&ScriptParams[0];
+ *(float*)ptr += GET_FLOAT_PARAM(0);
return 0;
}
case COMMAND_SUB_VAL_FROM_INT_VAR:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
CollectParameters(&m_nIp, 1);
- *ptr -= ScriptParams[0];
+ *ptr -= GET_INTEGER_PARAM(0);
return 0;
}
case COMMAND_SUB_VAL_FROM_FLOAT_VAR:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
CollectParameters(&m_nIp, 1);
- *(float*)ptr -= *(float*)&ScriptParams[0];
+ *(float*)ptr -= GET_FLOAT_PARAM(0);
return 0;
}
case COMMAND_SUB_VAL_FROM_INT_LVAR:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
CollectParameters(&m_nIp, 1);
- *ptr -= ScriptParams[0];
+ *ptr -= GET_INTEGER_PARAM(0);
return 0;
}
case COMMAND_SUB_VAL_FROM_FLOAT_LVAR:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
CollectParameters(&m_nIp, 1);
- *(float*)ptr -= *(float*)&ScriptParams[0];
+ *(float*)ptr -= GET_FLOAT_PARAM(0);
return 0;
}
case COMMAND_MULT_INT_VAR_BY_VAL:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
CollectParameters(&m_nIp, 1);
- *ptr *= ScriptParams[0];
+ *ptr *= GET_INTEGER_PARAM(0);
return 0;
}
case COMMAND_MULT_FLOAT_VAR_BY_VAL:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
CollectParameters(&m_nIp, 1);
- *(float*)ptr *= *(float*)&ScriptParams[0];
+ *(float*)ptr *= GET_FLOAT_PARAM(0);
return 0;
}
case COMMAND_MULT_INT_LVAR_BY_VAL:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
CollectParameters(&m_nIp, 1);
- *ptr *= ScriptParams[0];
+ *ptr *= GET_INTEGER_PARAM(0);
return 0;
}
case COMMAND_MULT_FLOAT_LVAR_BY_VAL:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
CollectParameters(&m_nIp, 1);
- *(float*)ptr *= *(float*)&ScriptParams[0];
+ *(float*)ptr *= GET_FLOAT_PARAM(0);
return 0;
}
case COMMAND_DIV_INT_VAR_BY_VAL:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
CollectParameters(&m_nIp, 1);
- *ptr /= ScriptParams[0];
+ *ptr /= GET_INTEGER_PARAM(0);
return 0;
}
case COMMAND_DIV_FLOAT_VAR_BY_VAL:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
CollectParameters(&m_nIp, 1);
- *(float*)ptr /= *(float*)&ScriptParams[0];
+ *(float*)ptr /= GET_FLOAT_PARAM(0);
return 0;
}
case COMMAND_DIV_INT_LVAR_BY_VAL:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
CollectParameters(&m_nIp, 1);
- *ptr /= ScriptParams[0];
+ *ptr /= GET_INTEGER_PARAM(0);
return 0;
}
case COMMAND_DIV_FLOAT_LVAR_BY_VAL:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
CollectParameters(&m_nIp, 1);
- *(float*)ptr /= *(float*)&ScriptParams[0];
+ *(float*)ptr /= GET_FLOAT_PARAM(0);
return 0;
}
case COMMAND_IS_INT_VAR_GREATER_THAN_NUMBER:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(*ptr > ScriptParams[0]);
+ UpdateCompareFlag(*ptr > GET_INTEGER_PARAM(0));
return 0;
}
case COMMAND_IS_INT_LVAR_GREATER_THAN_NUMBER:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(*ptr > ScriptParams[0]);
+ UpdateCompareFlag(*ptr > GET_INTEGER_PARAM(0));
return 0;
}
case COMMAND_IS_NUMBER_GREATER_THAN_INT_VAR:
{
CollectParameters(&m_nIp, 1);
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
- UpdateCompareFlag(ScriptParams[0] > *ptr);
+ UpdateCompareFlag(GET_INTEGER_PARAM(0) > *ptr);
return 0;
}
case COMMAND_IS_NUMBER_GREATER_THAN_INT_LVAR:
{
CollectParameters(&m_nIp, 1);
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
- UpdateCompareFlag(ScriptParams[0] > *ptr);
+ UpdateCompareFlag(GET_INTEGER_PARAM(0) > *ptr);
return 0;
}
case COMMAND_IS_INT_VAR_GREATER_THAN_INT_VAR:
@@ -2826,28 +3247,28 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(*(float*)ptr > *(float*)&ScriptParams[0]);
+ UpdateCompareFlag(*(float*)ptr > GET_FLOAT_PARAM(0));
return 0;
}
case COMMAND_IS_FLOAT_LVAR_GREATER_THAN_NUMBER:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(*(float*)ptr > *(float*)&ScriptParams[0]);
+ UpdateCompareFlag(*(float*)ptr > GET_FLOAT_PARAM(0));
return 0;
}
case COMMAND_IS_NUMBER_GREATER_THAN_FLOAT_VAR:
{
CollectParameters(&m_nIp, 1);
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
- UpdateCompareFlag(*(float*)&ScriptParams[0] > *(float*)ptr);
+ UpdateCompareFlag(GET_FLOAT_PARAM(0) > *(float*)ptr);
return 0;
}
case COMMAND_IS_NUMBER_GREATER_THAN_FLOAT_LVAR:
{
CollectParameters(&m_nIp, 1);
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
- UpdateCompareFlag(*(float*)&ScriptParams[0] > *(float*)ptr);
+ UpdateCompareFlag(GET_FLOAT_PARAM(0) > *(float*)ptr);
return 0;
}
case COMMAND_IS_FLOAT_VAR_GREATER_THAN_FLOAT_VAR:
@@ -2882,28 +3303,28 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(*ptr >= ScriptParams[0]);
+ UpdateCompareFlag(*ptr >= GET_INTEGER_PARAM(0));
return 0;
}
case COMMAND_IS_INT_LVAR_GREATER_OR_EQUAL_TO_NUMBER:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(*ptr >= ScriptParams[0]);
+ UpdateCompareFlag(*ptr >= GET_INTEGER_PARAM(0));
return 0;
}
case COMMAND_IS_NUMBER_GREATER_OR_EQUAL_TO_INT_VAR:
{
CollectParameters(&m_nIp, 1);
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
- UpdateCompareFlag(ScriptParams[0] >= *ptr);
+ UpdateCompareFlag(GET_INTEGER_PARAM(0) >= *ptr);
return 0;
}
case COMMAND_IS_NUMBER_GREATER_OR_EQUAL_TO_INT_LVAR:
{
CollectParameters(&m_nIp, 1);
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
- UpdateCompareFlag(ScriptParams[0] >= *ptr);
+ UpdateCompareFlag(GET_INTEGER_PARAM(0) >= *ptr);
return 0;
}
case COMMAND_IS_INT_VAR_GREATER_OR_EQUAL_TO_INT_VAR:
@@ -2938,28 +3359,28 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(*(float*)ptr >= *(float*)&ScriptParams[0]);
+ UpdateCompareFlag(*(float*)ptr >= GET_FLOAT_PARAM(0));
return 0;
}
case COMMAND_IS_FLOAT_LVAR_GREATER_OR_EQUAL_TO_NUMBER:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(*(float*)ptr >= *(float*)&ScriptParams[0]);
+ UpdateCompareFlag(*(float*)ptr >= GET_FLOAT_PARAM(0));
return 0;
}
case COMMAND_IS_NUMBER_GREATER_OR_EQUAL_TO_FLOAT_VAR:
{
CollectParameters(&m_nIp, 1);
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
- UpdateCompareFlag(*(float*)&ScriptParams[0] >= *(float*)ptr);
+ UpdateCompareFlag(GET_FLOAT_PARAM(0) >= *(float*)ptr);
return 0;
}
case COMMAND_IS_NUMBER_GREATER_OR_EQUAL_TO_FLOAT_LVAR:
{
CollectParameters(&m_nIp, 1);
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
- UpdateCompareFlag(*(float*)&ScriptParams[0] >= *(float*)ptr);
+ UpdateCompareFlag(GET_FLOAT_PARAM(0) >= *(float*)ptr);
return 0;
}
case COMMAND_IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_FLOAT_VAR:
@@ -2994,14 +3415,14 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(*ptr == ScriptParams[0]);
+ UpdateCompareFlag(*ptr == GET_INTEGER_PARAM(0));
return 0;
}
case COMMAND_IS_INT_LVAR_EQUAL_TO_NUMBER:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(*ptr == ScriptParams[0]);
+ UpdateCompareFlag(*ptr == GET_INTEGER_PARAM(0));
return 0;
}
case COMMAND_IS_INT_VAR_EQUAL_TO_INT_VAR:
@@ -3034,14 +3455,14 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(*(float*)ptr == *(float*)&ScriptParams[0]);
+ UpdateCompareFlag(*(float*)ptr == GET_FLOAT_PARAM(0));
return 0;
}
case COMMAND_IS_FLOAT_LVAR_EQUAL_TO_NUMBER:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(*(float*)ptr == *(float*)&ScriptParams[0]);
+ UpdateCompareFlag(*(float*)ptr == GET_FLOAT_PARAM(0));
return 0;
}
case COMMAND_IS_FLOAT_VAR_EQUAL_TO_FLOAT_VAR:
@@ -3070,17 +3491,15 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
//case COMMAND_IS_FLOAT_VAR_NOT_EQUAL_TO_FLOAT_VAR:
//case COMMAND_IS_FLOAT_LVAR_NOT_EQUAL_TO_FLOAT_LVAR:
//case COMMAND_IS_FLOAT_VAR_NOT_EQUAL_TO_FLOAT_LVAR:
- /*
case COMMAND_GOTO_IF_TRUE:
CollectParameters(&m_nIp, 1);
if (m_bCondResult)
- SetIP(ScriptParams[0] >= 0 ? ScriptParams[0] : SIZE_MAIN_SCRIPT - ScriptParams[0]);
+ SetIP(GET_INTEGER_PARAM(0) >= 0 ? GET_INTEGER_PARAM(0) : CTheScripts::MainScriptSize - GET_INTEGER_PARAM(0));
return 0;
- */
case COMMAND_GOTO_IF_FALSE:
CollectParameters(&m_nIp, 1);
if (!m_bCondResult)
- SetIP(ScriptParams[0] >= 0 ? ScriptParams[0] : SIZE_MAIN_SCRIPT - ScriptParams[0]);
+ SetIP(GET_INTEGER_PARAM(0) >= 0 ? GET_INTEGER_PARAM(0) : CTheScripts::MainScriptSize - GET_INTEGER_PARAM(0));
/* Check COMMAND_GOTO note. */
return 0;
case COMMAND_TERMINATE_THIS_SCRIPT:
@@ -3106,47 +3525,19 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
case COMMAND_START_NEW_SCRIPT:
{
CollectParameters(&m_nIp, 1);
- script_assert(ScriptParams[0] >= 0);
- CRunningScript* pNew = CTheScripts::StartNewScript(ScriptParams[0]);
- m_bIsActive = true;
- int8 type = CTheScripts::Read1ByteFromScript(&m_nIp);
- float tmp;
- for (int i = 0; type != ARGUMENT_END; type = CTheScripts::Read1ByteFromScript(&m_nIp), i++) {
- switch (type) {
- case ARGUMENT_INT32:
- pNew->m_anLocalVariables[i] = CTheScripts::Read4BytesFromScript(&m_nIp);
- break;
- case ARGUMENT_GLOBALVAR:
- pNew->m_anLocalVariables[i] = *(int32*)&CTheScripts::ScriptSpace[(uint16)CTheScripts::Read2BytesFromScript(&m_nIp)];
- break;
- case ARGUMENT_LOCALVAR:
- pNew->m_anLocalVariables[i] = m_anLocalVariables[CTheScripts::Read2BytesFromScript(&m_nIp)];
- break;
- case ARGUMENT_INT8:
- pNew->m_anLocalVariables[i] = CTheScripts::Read1ByteFromScript(&m_nIp);
- break;
- case ARGUMENT_INT16:
- pNew->m_anLocalVariables[i] = CTheScripts::Read2BytesFromScript(&m_nIp);
- break;
- case ARGUMENT_FLOAT:
- tmp = CTheScripts::ReadFloatFromScript(&m_nIp);
- pNew->m_anLocalVariables[i] = *(int32*)&tmp;
- break;
- default:
- break;
- }
- }
+ script_assert(GET_INTEGER_PARAM(0) >= 0);
+ CRunningScript* pNew = CTheScripts::StartNewScript(GET_INTEGER_PARAM(0));
+ CollectParameters(&m_nIp, NUM_LOCAL_VARS, pNew->m_anLocalVariables);
return 0;
}
case COMMAND_GOSUB:
CollectParameters(&m_nIp, 1);
script_assert(m_nStackPointer < MAX_STACK_DEPTH);
m_anStack[m_nStackPointer++] = m_nIp;
- SetIP(ScriptParams[0] >= 0 ? ScriptParams[0] : SIZE_MAIN_SCRIPT - ScriptParams[0]);
+ SetIP(GET_INTEGER_PARAM(0) >= 0 ? GET_INTEGER_PARAM(0) : CTheScripts::MainScriptSize - GET_INTEGER_PARAM(0));
return 0;
case COMMAND_RETURN:
- script_assert(m_nStackPointer > 0); /* No more SSU */
- SetIP(m_anStack[--m_nStackPointer]);
+ ReturnFromGosubOrFunction();
return 0;
case COMMAND_LINE:
CollectParameters(&m_nIp, 6);
@@ -3155,7 +3546,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
case COMMAND_CREATE_PLAYER:
{
CollectParameters(&m_nIp, 4);
- int32 index = ScriptParams[0];
+ int32 index = GET_INTEGER_PARAM(0);
script_assert(index < NUMPLAYERS);
printf("&&&&&&&&&&&&&Creating player: %d\n", index);
if (!CStreaming::HasModelLoaded(MI_PLAYER)) {
@@ -3165,14 +3556,14 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
CPlayerPed::SetupPlayerPed(index);
CWorld::Players[index].m_pPed->CharCreatedBy = MISSION_CHAR;
CPlayerPed::DeactivatePlayerPed(index);
- CVector pos = *(CVector*)&ScriptParams[1];
+ CVector pos = GET_VECTOR_PARAM(1);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += CWorld::Players[index].m_pPed->GetDistanceFromCentreOfMassToBaseOfModel();
CWorld::Players[index].m_pPed->SetPosition(pos);
CTheScripts::ClearSpaceForMissionEntity(pos, CWorld::Players[index].m_pPed);
CPlayerPed::ReactivatePlayerPed(index);
- ScriptParams[0] = index;
+ SET_INTEGER_PARAM(0, index);
StoreParameters(&m_nIp, 1);
return 0;
}
@@ -3180,23 +3571,23 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
{
CVector pos;
CollectParameters(&m_nIp, 1);
- if (CWorld::Players[ScriptParams[0]].m_pPed->bInVehicle)
- pos = CWorld::Players[ScriptParams[0]].m_pPed->m_pMyVehicle->GetPosition();
+ if (CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed->bInVehicle && CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed->m_pMyVehicle)
+ pos = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed->m_pMyVehicle->GetPosition();
else
- pos = CWorld::Players[ScriptParams[0]].m_pPed->GetPosition();
- *(CVector*)&ScriptParams[0] = pos;
+ pos = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed->GetPosition();
+ SET_VECTOR_PARAM(0, pos);
StoreParameters(&m_nIp, 3);
return 0;
}
case COMMAND_SET_PLAYER_COORDINATES:
{
CollectParameters(&m_nIp, 4);
- CVector pos = *(CVector*)&ScriptParams[1];
- int index = ScriptParams[0];
+ CVector pos = GET_VECTOR_PARAM(1);
+ int index = GET_INTEGER_PARAM(0);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
CPlayerPed* ped = CWorld::Players[index].m_pPed;
- if (ped->bInVehicle) {
+ if (ped->bInVehicle && ped->m_pMyVehicle) {
pos.z += ped->m_pMyVehicle->GetDistanceFromCentreOfMassToBaseOfModel();
ped->m_pMyVehicle->Teleport(pos); // removed dumb stuff that was present here
CTheScripts::ClearSpaceForMissionEntity(pos, ped->m_pMyVehicle);
@@ -3244,39 +3635,43 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
case COMMAND_IS_PLAYER_IN_AREA_2D:
{
CollectParameters(&m_nIp, 6);
- CPlayerPed* ped = CWorld::Players[ScriptParams[0]].m_pPed;
- float x1 = *(float*)&ScriptParams[1];
- float y1 = *(float*)&ScriptParams[2];
- float x2 = *(float*)&ScriptParams[3];
- float y2 = *(float*)&ScriptParams[4];
+ CPlayerPed* ped = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
+ float x1 = GET_FLOAT_PARAM(1);
+ float y1 = GET_FLOAT_PARAM(2);
+ float x2 = GET_FLOAT_PARAM(3);
+ float y2 = GET_FLOAT_PARAM(4);
if (!ped->bInVehicle)
UpdateCompareFlag(ped->IsWithinArea(x1, y1, x2, y2));
else
UpdateCompareFlag(ped->m_pMyVehicle->IsWithinArea(x1, y1, x2, y2));
- if (ScriptParams[5])
+ if (GET_INTEGER_PARAM(5))
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT);
+ /*
if (CTheScripts::DbgFlag)
CTheScripts::DrawDebugSquare(x1, y1, x2, y2);
+ */
return 0;
}
case COMMAND_IS_PLAYER_IN_AREA_3D:
{
CollectParameters(&m_nIp, 8);
- CPlayerPed* ped = CWorld::Players[ScriptParams[0]].m_pPed;
- float x1 = *(float*)&ScriptParams[1];
- float y1 = *(float*)&ScriptParams[2];
- float z1 = *(float*)&ScriptParams[3];
- float x2 = *(float*)&ScriptParams[4];
- float y2 = *(float*)&ScriptParams[5];
- float z2 = *(float*)&ScriptParams[6];
+ CPlayerPed* ped = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
+ float x1 = GET_FLOAT_PARAM(1);
+ float y1 = GET_FLOAT_PARAM(2);
+ float z1 = GET_FLOAT_PARAM(3);
+ float x2 = GET_FLOAT_PARAM(4);
+ float y2 = GET_FLOAT_PARAM(5);
+ float z2 = GET_FLOAT_PARAM(6);
if (ped->bInVehicle)
UpdateCompareFlag(ped->m_pMyVehicle->IsWithinArea(x1, y1, z1, x2, y2, z2));
else
UpdateCompareFlag(ped->IsWithinArea(x1, y1, z1, x2, y2, z2));
- if (ScriptParams[7])
+ if (GET_INTEGER_PARAM(7))
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, (z1 + z2) / 2);
+ /*
if (CTheScripts::DbgFlag)
CTheScripts::DrawDebugCube(x1, y1, z1, x2, y2, z2);
+ */
return 0;
}
case COMMAND_ADD_INT_VAR_TO_INT_VAR:
@@ -3423,33 +3818,25 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
CollectParameters(&m_nIp, 1);
- *(float*)ptr += CTimer::GetTimeStep() * *(float*)&ScriptParams[0];
+ *(float*)ptr += CTimer::GetTimeStep() * GET_FLOAT_PARAM(0);
return 0;
}
case COMMAND_ADD_TIMED_VAL_TO_FLOAT_LVAR:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
CollectParameters(&m_nIp, 1);
- *(float*)ptr += CTimer::GetTimeStep() * *(float*)&ScriptParams[0];
+ *(float*)ptr += CTimer::GetTimeStep() * GET_FLOAT_PARAM(0);
return 0;
}
case COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_VAR:
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*fScriptVar1 += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
-#ifdef FIX_BUGS
case COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR:
-#else
- case COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_VAR:
-#endif
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*fScriptVar1 += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
-#ifdef FIX_BUGS
case COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_VAR:
-#else
- case COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR:
-#endif
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*fScriptVar1 += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
@@ -3461,33 +3848,25 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
CollectParameters(&m_nIp, 1);
- *(float*)ptr -= CTimer::GetTimeStep() * *(float*)&ScriptParams[0];
+ *(float*)ptr -= CTimer::GetTimeStep() * GET_FLOAT_PARAM(0);
return 0;
}
case COMMAND_SUB_TIMED_VAL_FROM_FLOAT_LVAR:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
CollectParameters(&m_nIp, 1);
- *(float*)ptr -= CTimer::GetTimeStep() * *(float*)&ScriptParams[0];
+ *(float*)ptr -= CTimer::GetTimeStep() * GET_FLOAT_PARAM(0);
return 0;
}
case COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_VAR:
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*fScriptVar1 -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
-#ifdef FIX_BUGS // in SA it was fixed by reversing their order in enum
case COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_LVAR:
-#else
- case COMMAND_SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_VAR:
-#endif
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*fScriptVar1 -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
-#ifdef FIX_BUGS
case COMMAND_SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_VAR:
-#else
- case COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_LVAR:
-#endif
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*fScriptVar1 -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
@@ -3636,46 +4015,46 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
case COMMAND_CREATE_CHAR:
{
CollectParameters(&m_nIp, 5);
- switch (ScriptParams[1]) {
+ switch (GET_INTEGER_PARAM(1)) {
case MI_COP:
- if (ScriptParams[0] == PEDTYPE_COP)
- ScriptParams[1] = COP_STREET;
+ if (GET_INTEGER_PARAM(0) == PEDTYPE_COP)
+ SET_INTEGER_PARAM(1, COP_STREET);
break;
case MI_SWAT:
- if (ScriptParams[0] == PEDTYPE_COP)
- ScriptParams[1] = COP_SWAT;
+ if (GET_INTEGER_PARAM(0) == PEDTYPE_COP)
+ SET_INTEGER_PARAM(1, COP_SWAT);
break;
case MI_FBI:
- if (ScriptParams[0] == PEDTYPE_COP)
- ScriptParams[1] = COP_FBI;
+ if (GET_INTEGER_PARAM(0) == PEDTYPE_COP)
+ SET_INTEGER_PARAM(1, COP_FBI);
break;
case MI_ARMY:
- if (ScriptParams[0] == PEDTYPE_COP)
- ScriptParams[1] = COP_ARMY;
+ if (GET_INTEGER_PARAM(0) == PEDTYPE_COP)
+ SET_INTEGER_PARAM(1, COP_ARMY);
break;
case MI_MEDIC:
- if (ScriptParams[0] == PEDTYPE_EMERGENCY)
- ScriptParams[1] = PEDTYPE_EMERGENCY;
+ if (GET_INTEGER_PARAM(0) == PEDTYPE_EMERGENCY)
+ SET_INTEGER_PARAM(1, PEDTYPE_EMERGENCY);
break;
case MI_FIREMAN:
- if (ScriptParams[0] == PEDTYPE_FIREMAN)
- ScriptParams[1] = PEDTYPE_FIREMAN;
+ if (GET_INTEGER_PARAM(0) == PEDTYPE_FIREMAN)
+ SET_INTEGER_PARAM(1, PEDTYPE_FIREMAN);
break;
default:
break;
}
CPed* ped;
- if (ScriptParams[0] == PEDTYPE_COP)
- ped = new CCopPed((eCopType)ScriptParams[1]);
- else if (ScriptParams[0] == PEDTYPE_EMERGENCY || ScriptParams[0] == PEDTYPE_FIREMAN)
- ped = new CEmergencyPed(ScriptParams[1]);
+ if (GET_INTEGER_PARAM(0) == PEDTYPE_COP)
+ ped = new CCopPed((eCopType)GET_INTEGER_PARAM(1));
+ else if (GET_INTEGER_PARAM(0) == PEDTYPE_EMERGENCY || GET_INTEGER_PARAM(0) == PEDTYPE_FIREMAN)
+ ped = new CEmergencyPed(GET_INTEGER_PARAM(1));
else
- ped = new CCivilianPed((ePedType)ScriptParams[0], ScriptParams[1]);
+ ped = new CCivilianPed((ePedType)GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1));
ped->CharCreatedBy = MISSION_CHAR;
ped->bRespondsToThreats = false;
ped->bAllowMedicsToReviveMe = false;
ped->bIsPlayerFriend = false;
- CVector pos = *(CVector*)&ScriptParams[2];
+ CVector pos = GET_VECTOR_PARAM(2);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += 1.0f;
@@ -3687,29 +4066,29 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
CWorld::Add(ped);
ped->m_nZoneLevel = CTheZones::GetLevelFromPosition(&pos);
CPopulation::ms_nTotalMissionPeds++;
- ScriptParams[0] = CPools::GetPedPool()->GetIndex(ped);
+ SET_INTEGER_PARAM(0, CPools::GetPedPool()->GetIndex(ped));
StoreParameters(&m_nIp, 1);
if (m_bIsMissionScript)
- CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
+ CTheScripts::MissionCleanUp.AddEntityToList(GET_INTEGER_PARAM(0), CLEANUP_CHAR);
return 0;
}
case COMMAND_DELETE_CHAR:
{
CollectParameters(&m_nIp, 1);
- CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* ped = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
CTheScripts::RemoveThisPed(ped);
if (m_bIsMissionScript)
- CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
+ CTheScripts::MissionCleanUp.RemoveEntityFromList(GET_INTEGER_PARAM(0), CLEANUP_CHAR);
return 0;
}
case COMMAND_CHAR_WANDER_DIR:
{
CollectParameters(&m_nIp, 2);
- CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* ped = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(ped);
ped->ClearAll();
- int8 path = ScriptParams[1];
- if (ScriptParams[1] < 0 || ScriptParams[1] > 7)
+ int8 path = GET_INTEGER_PARAM(1);
+ if (GET_INTEGER_PARAM(1) < 0 || GET_INTEGER_PARAM(1) > 7)
// Max number GetRandomNumberInRange returns is max-1
#ifdef FIX_BUGS
path = CGeneral::GetRandomNumberInRange(0, 8);
@@ -3724,19 +4103,19 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
case COMMAND_CHAR_FOLLOW_PATH:
{
CollectParameters(&m_nIp, 6);
- CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* ped = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(ped);
if (ped->GetPedState() == PED_ATTACK || ped->GetPedState() == PED_FIGHT || !ped->IsPedInControl())
return 0;
- CVector pos = *(CVector*)&ScriptParams[1];
+ CVector pos = GET_VECTOR_PARAM(1);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
- float radius = *(float*)&ScriptParams[4];
+ float radius = GET_FLOAT_PARAM(4);
eMoveState state;
- switch (ScriptParams[5]) {
+ switch (GET_INTEGER_PARAM(5)) {
case 0: state = PEDMOVE_WALK; break;
case 1: state = PEDMOVE_RUN; break;
- default: assert(0);
+ default: state = PEDMOVE_WALK; break;
}
ped->ClearAll();
ped->m_pathNodeTimer = 0;
@@ -3746,7 +4125,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
case COMMAND_CHAR_SET_IDLE:
{
CollectParameters(&m_nIp, 1);
- CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* ped = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(ped);
ped->bScriptObjectiveCompleted = false;
ped->SetObjective(OBJECTIVE_WAIT_ON_FOOT);
@@ -3755,7 +4134,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
case COMMAND_GET_CHAR_COORDINATES:
{
CollectParameters(&m_nIp, 1);
- CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* ped = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(ped);
CVehicle* vehicle;
CVector pos;
@@ -3768,21 +4147,21 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
pos = vehicle->GetPosition();
else
pos = ped->GetPosition();
- *(CVector*)&ScriptParams[0] = pos;
+ SET_VECTOR_PARAM(0, pos);
StoreParameters(&m_nIp, 3);
return 0;
}
case COMMAND_SET_CHAR_COORDINATES:
{
CollectParameters(&m_nIp, 4);
- CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* ped = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(ped);
CVehicle* vehicle;
if (ped->bInVehicle)
vehicle = ped->m_pMyVehicle;
else
vehicle = nil;
- CVector pos = *(CVector*)&ScriptParams[1];
+ CVector pos = GET_VECTOR_PARAM(1);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
// removed dumb stuff again
@@ -3805,72 +4184,74 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
}
return 0;
}
- /*
case COMMAND_IS_CHAR_STILL_ALIVE:
{
CollectParameters(&m_nIp, 1);
- CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- UpdateCompareFlag(ped && ped->GetPedState() != PED_DEAD && ped->GetPedState() != PED_DIE);
+ CPed* ped = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
+ UpdateCompareFlag(ped && !ped->DyingOrDead());
return 0;
}
- */
case COMMAND_IS_CHAR_IN_AREA_2D:
{
CollectParameters(&m_nIp, 6);
- CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* ped = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(ped);
CVehicle* vehicle;
if (ped->bInVehicle)
vehicle = ped->m_pMyVehicle;
else
vehicle = nil;
- float x1 = *(float*)&ScriptParams[1];
- float y1 = *(float*)&ScriptParams[2];
- float x2 = *(float*)&ScriptParams[3];
- float y2 = *(float*)&ScriptParams[4];
+ float x1 = GET_FLOAT_PARAM(1);
+ float y1 = GET_FLOAT_PARAM(2);
+ float x2 = GET_FLOAT_PARAM(3);
+ float y2 = GET_FLOAT_PARAM(4);
if (vehicle)
UpdateCompareFlag(ped->m_pMyVehicle->IsWithinArea(x1, y1, x2, y2));
else
UpdateCompareFlag(ped->IsWithinArea(x1, y1, x2, y2));
- if (ScriptParams[5])
+ if (GET_INTEGER_PARAM(5))
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT);
+ /*
if (CTheScripts::DbgFlag)
CTheScripts::DrawDebugSquare(x1, y1, x2, y2);
+ */
return 0;
}
case COMMAND_IS_CHAR_IN_AREA_3D:
{
CollectParameters(&m_nIp, 8);
- CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* ped = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(ped);
CVehicle* vehicle;
if (ped->bInVehicle)
vehicle = ped->m_pMyVehicle;
else
vehicle = nil;
- float x1 = *(float*)&ScriptParams[1];
- float y1 = *(float*)&ScriptParams[2];
- float z1 = *(float*)&ScriptParams[3];
- float x2 = *(float*)&ScriptParams[4];
- float y2 = *(float*)&ScriptParams[5];
- float z2 = *(float*)&ScriptParams[6];
+ float x1 = GET_FLOAT_PARAM(1);
+ float y1 = GET_FLOAT_PARAM(2);
+ float z1 = GET_FLOAT_PARAM(3);
+ float x2 = GET_FLOAT_PARAM(4);
+ float y2 = GET_FLOAT_PARAM(5);
+ float z2 = GET_FLOAT_PARAM(6);
if (vehicle)
UpdateCompareFlag(ped->m_pMyVehicle->IsWithinArea(x1, y1, z1, x2, y2, z2));
else
UpdateCompareFlag(ped->IsWithinArea(x1, y1, z1, x2, y2, z2));
- if (ScriptParams[7])
+ if (GET_INTEGER_PARAM(7))
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, (z1 + z2) / 2);
+ /*
if (CTheScripts::DbgFlag)
CTheScripts::DrawDebugCube(x1, y1, z1, x2, y2, z2);
+ */
return 0;
}
case COMMAND_CREATE_CAR:
{
CollectParameters(&m_nIp, 4);
int32 handle;
- if (CModelInfo::IsBoatModel(ScriptParams[0])) {
- CBoat* boat = new CBoat(ScriptParams[0], MISSION_VEHICLE);
- CVector pos = *(CVector*)&ScriptParams[1];
+ if (CModelInfo::IsBoatModel(GET_INTEGER_PARAM(0))) {
+ CBoat* boat = new CBoat(GET_INTEGER_PARAM(0), MISSION_VEHICLE);
+ CVector pos = GET_VECTOR_PARAM(1);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += boat->GetDistanceFromCentreOfMassToBaseOfModel();
@@ -3889,13 +4270,13 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
else {
CVehicle* car;
- if (!CModelInfo::IsBikeModel(ScriptParams[0]))
- car = new CAutomobile(ScriptParams[0], MISSION_VEHICLE);
+ if (!CModelInfo::IsBikeModel(GET_INTEGER_PARAM(0)))
+ car = new CAutomobile(GET_INTEGER_PARAM(0), MISSION_VEHICLE);
else {
- car = new CBike(ScriptParams[0], MISSION_VEHICLE);
+ car = new CBike(GET_INTEGER_PARAM(0), MISSION_VEHICLE);
((CBike*)(car))->bIsStanding = true;
}
- CVector pos = *(CVector*)&ScriptParams[1];
+ CVector pos = GET_VECTOR_PARAM(1);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel();
@@ -3910,14 +4291,14 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
car->AutoPilot.m_nCruiseSpeed = car->AutoPilot.m_fMaxTrafficSpeed = 9.0f;
car->AutoPilot.m_nCurrentLane = car->AutoPilot.m_nNextLane = 0;
car->bEngineOn = false;
- car->m_nZoneLevel = CTheZones::GetLevelFromPosition(&pos);
+ car->m_nZoneLevel = CTheZones::GetLevelFromPosition(&pos); // TODO: gpTheZones
car->bHasBeenOwnedByPlayer = true;
if (m_bIsMissionScript)
car->bIsStaticWaitingForCollision = true;
CWorld::Add(car);
handle = CPools::GetVehiclePool()->GetIndex(car);
}
- ScriptParams[0] = handle;
+ SET_INTEGER_PARAM(0, handle);
StoreParameters(&m_nIp, 1);
if (m_bIsMissionScript)
CTheScripts::MissionCleanUp.AddEntityToList(handle, CLEANUP_CAR);
@@ -3926,25 +4307,26 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
case COMMAND_DELETE_CAR:
{
CollectParameters(&m_nIp, 1);
- CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* car = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
if (car) {
CWorld::Remove(car);
CWorld::RemoveReferencesToDeletedObject(car);
delete car;
}
if (m_bIsMissionScript)
- CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
+ CTheScripts::MissionCleanUp.RemoveEntityFromList(GET_INTEGER_PARAM(0), CLEANUP_CAR);
return 0;
}
case COMMAND_CAR_GOTO_COORDINATES:
{
CollectParameters(&m_nIp, 4);
- CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* car = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(car);
- CVector pos = *(CVector*)&ScriptParams[1];
+ CVector pos = GET_VECTOR_PARAM(1);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel();
+ uint8 nOldMission = car->AutoPilot.m_nCarMission;
if (CCarCtrl::JoinCarWithRoadSystemGotoCoors(car, pos, false))
car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_STRAIGHT;
else
@@ -3952,13 +4334,14 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
car->SetStatus(STATUS_PHYSICS);
car->bEngineOn = true;
car->AutoPilot.m_nCruiseSpeed = Max(1, car->AutoPilot.m_nCruiseSpeed);
- car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
+ if (nOldMission != car->AutoPilot.m_nCarMission)
+ car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
return 0;
}
case COMMAND_CAR_WANDER_RANDOMLY:
{
CollectParameters(&m_nIp, 1);
- CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* car = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(car);
CCarCtrl::JoinCarWithRoadSystem(car);
car->AutoPilot.m_nCarMission = MISSION_CRUISE;
@@ -3970,7 +4353,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
case COMMAND_CAR_SET_IDLE:
{
CollectParameters(&m_nIp, 1);
- CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* car = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(car);
car->AutoPilot.m_nCarMission = MISSION_NONE;
return 0;
@@ -3978,18 +4361,18 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
case COMMAND_GET_CAR_COORDINATES:
{
CollectParameters(&m_nIp, 1);
- CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* car = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(car);
- *(CVector*)&ScriptParams[0] = car->GetPosition();
+ SET_VECTOR_PARAM(0, car->GetPosition());
StoreParameters(&m_nIp, 3);
return 0;
}
case COMMAND_SET_CAR_COORDINATES:
{
CollectParameters(&m_nIp, 4);
- CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* car = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(car);
- CVector pos = *(CVector*)&ScriptParams[1];
+ CVector pos = GET_VECTOR_PARAM(1);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel();
@@ -4035,80 +4418,84 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
}
return 0;
}
- /*
case COMMAND_IS_CAR_STILL_ALIVE:
{
CollectParameters(&m_nIp, 1);
- CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* car = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
UpdateCompareFlag(car && car->GetStatus() != STATUS_WRECKED && (car->IsBoat() || !car->bIsInWater));
return 0;
}
- */
case COMMAND_SET_CAR_CRUISE_SPEED:
{
CollectParameters(&m_nIp, 2);
- CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* car = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(car);
#if defined MISSION_REPLAY && defined SIMPLIER_MISSIONS
- car->AutoPilot.m_nCruiseSpeed = *(float*)&ScriptParams[1];
+ car->AutoPilot.m_nCruiseSpeed = GET_FLOAT_PARAM(1);
if (missionRetryScriptIndex == 40 && car->GetModelIndex() == MI_CHEETAH) // Turismo
car->AutoPilot.m_nCruiseSpeed = 8 * car->AutoPilot.m_nCruiseSpeed / 10;
car->AutoPilot.m_nCruiseSpeed = Min(car->AutoPilot.m_nCruiseSpeed, 60.0f * car->pHandling->Transmission.fMaxCruiseVelocity);
#else
- car->AutoPilot.m_nCruiseSpeed = Min(*(float*)&ScriptParams[1], 60.0f * car->pHandling->Transmission.fMaxCruiseVelocity);
+ car->AutoPilot.m_nCruiseSpeed = Min(GET_FLOAT_PARAM(1), 60.0f * car->pHandling->Transmission.fMaxCruiseVelocity);
#endif
return 0;
}
case COMMAND_SET_CAR_DRIVING_STYLE:
{
CollectParameters(&m_nIp, 2);
- CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* car = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(car);
- car->AutoPilot.m_nDrivingStyle = (uint8)ScriptParams[1];
+ car->AutoPilot.m_nDrivingStyle = (uint8)GET_INTEGER_PARAM(1);
return 0;
}
case COMMAND_SET_CAR_MISSION:
{
CollectParameters(&m_nIp, 2);
- CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* car = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(car);
- car->AutoPilot.m_nCarMission = (uint8)ScriptParams[1];
- car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
+ if ((uint8)GET_INTEGER_PARAM(1) != car->AutoPilot.m_nCarMission) {
+ car->AutoPilot.m_nCarMission = (uint8)GET_INTEGER_PARAM(1);
+ car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
+ }
car->bEngineOn = true;
return 0;
}
case COMMAND_IS_CAR_IN_AREA_2D:
{
CollectParameters(&m_nIp, 6);
- CVehicle* vehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* vehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(vehicle);
- float x1 = *(float*)&ScriptParams[1];
- float y1 = *(float*)&ScriptParams[2];
- float x2 = *(float*)&ScriptParams[3];
- float y2 = *(float*)&ScriptParams[4];
+ float x1 = GET_FLOAT_PARAM(1);
+ float y1 = GET_FLOAT_PARAM(2);
+ float x2 = GET_FLOAT_PARAM(3);
+ float y2 = GET_FLOAT_PARAM(4);
UpdateCompareFlag(vehicle->IsWithinArea(x1, y1, x2, y2));
- if (ScriptParams[5])
+ if (GET_INTEGER_PARAM(5))
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT);
+ /*
if (CTheScripts::DbgFlag)
CTheScripts::DrawDebugSquare(x1, y1, x2, y2);
+ */
return 0;
}
case COMMAND_IS_CAR_IN_AREA_3D:
{
CollectParameters(&m_nIp, 8);
- CVehicle* vehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* vehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(vehicle);
- float x1 = *(float*)&ScriptParams[1];
- float y1 = *(float*)&ScriptParams[2];
- float z1 = *(float*)&ScriptParams[3];
- float x2 = *(float*)&ScriptParams[4];
- float y2 = *(float*)&ScriptParams[5];
- float z2 = *(float*)&ScriptParams[6];
+ float x1 = GET_FLOAT_PARAM(1);
+ float y1 = GET_FLOAT_PARAM(2);
+ float z1 = GET_FLOAT_PARAM(3);
+ float x2 = GET_FLOAT_PARAM(4);
+ float y2 = GET_FLOAT_PARAM(5);
+ float z2 = GET_FLOAT_PARAM(6);
UpdateCompareFlag(vehicle->IsWithinArea(x1, y1, z1, x2, y2, z2));
- if (ScriptParams[7])
+ if (GET_INTEGER_PARAM(7))
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, (z1 + z2) / 2);
+ /*
if (CTheScripts::DbgFlag)
CTheScripts::DrawDebugCube(x1, y1, z1, x2, y2, z2);
+ */
return 0;
}
case COMMAND_SPECIAL_0:
@@ -4129,72 +4516,72 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
AllowMissionReplay = 1;
#endif
CollectParameters(&m_nIp, 2);
- CMessages::AddBigMessage(key, ScriptParams[0], ScriptParams[1] - 1);
+ CMessages::AddBigMessage(key, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1) - 1);
return 0;
}
case COMMAND_PRINT:
{
wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 2);
- CMessages::AddMessage(key, ScriptParams[0], ScriptParams[1]);
+ CMessages::AddMessage(key, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1));
return 0;
}
case COMMAND_PRINT_NOW:
{
wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 2);
- CMessages::AddMessageJumpQ(key, ScriptParams[0], ScriptParams[1]);
+ CMessages::AddMessageJumpQ(key, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1));
return 0;
}
- /*
case COMMAND_PRINT_SOON:
{
wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 2);
- CMessages::AddMessageSoon(key, ScriptParams[0], ScriptParams[1]);
+ CMessages::AddMessageSoon(key, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1));
return 0;
}
- */
case COMMAND_CLEAR_PRINTS:
CMessages::ClearMessages();
return 0;
case COMMAND_GET_TIME_OF_DAY:
- ScriptParams[0] = CClock::GetHours();
- ScriptParams[1] = CClock::GetMinutes();
+ SET_INTEGER_PARAM(0, CClock::GetHours());
+ SET_INTEGER_PARAM(1, CClock::GetMinutes());
StoreParameters(&m_nIp, 2);
return 0;
case COMMAND_SET_TIME_OF_DAY:
CollectParameters(&m_nIp, 2);
- CClock::SetGameClock(ScriptParams[0], ScriptParams[1]);
+ CClock::SetGameClock(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1));
return 0;
case COMMAND_GET_MINUTES_TO_TIME_OF_DAY:
CollectParameters(&m_nIp, 2);
- ScriptParams[0] = CClock::GetGameClockMinutesUntil(ScriptParams[0], ScriptParams[1]);
+ SET_INTEGER_PARAM(0, CClock::GetGameClockMinutesUntil(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)));
StoreParameters(&m_nIp, 1);
return 0;
case COMMAND_IS_POINT_ON_SCREEN:
{
CollectParameters(&m_nIp, 4);
- CVector pos = *(CVector*)&ScriptParams[0];
+ CVector pos = GET_VECTOR_PARAM(0);
if (pos.z <= -100)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
- UpdateCompareFlag(TheCamera.IsSphereVisible(pos, *(float*)&ScriptParams[3]));
+ UpdateCompareFlag(TheCamera.IsSphereVisible(pos, GET_FLOAT_PARAM(3)));
return 0;
}
+ /*
case COMMAND_DEBUG_ON:
CTheScripts::DbgFlag = true;
return 0;
case COMMAND_DEBUG_OFF:
CTheScripts::DbgFlag = false;
return 0;
- /*
+ */
case COMMAND_RETURN_TRUE:
UpdateCompareFlag(true);
+ ReturnFromGosubOrFunction();
return 0;
case COMMAND_RETURN_FALSE:
UpdateCompareFlag(false);
+ ReturnFromGosubOrFunction();
return 0;
- */
//case COMMAND_VAR_INT:
default:
script_assert(0);
@@ -4221,10 +4608,15 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
case COMMAND_WHILE:
case COMMAND_WHILENOT:
case COMMAND_ENDWHILE:
+ case COMMAND_214:
+ case COMMAND_215:
+ case COMMAND_216:
+ case COMMAND_217:
+ case COMMAND_218:
*/
case COMMAND_ANDOR:
CollectParameters(&m_nIp, 1);
- m_nAndOrState = ScriptParams[0];
+ m_nAndOrState = GET_INTEGER_PARAM(0);
if (m_nAndOrState == ANDOR_NONE){
m_bCondResult = false; // pointless
}else if (m_nAndOrState >= ANDS_1 && m_nAndOrState <= ANDS_8){
@@ -4240,7 +4632,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
case COMMAND_LAUNCH_MISSION:
{
CollectParameters(&m_nIp, 1);
- CRunningScript* pNew = CTheScripts::StartNewScript(ScriptParams[0]);
+ CRunningScript* pNew = CTheScripts::StartNewScript(GET_INTEGER_PARAM(0));
pNew->m_bIsMissionScript = true;
return 0;
}
@@ -4254,7 +4646,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
case COMMAND_STORE_CAR_CHAR_IS_IN:
{
CollectParameters(&m_nIp, 1);
- CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* ped = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(ped);
CVehicle* pCurrent = nil;
if (ped->bInVehicle) {
@@ -4299,14 +4691,14 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
break;
}
}
- ScriptParams[0] = CTheScripts::StoreVehicleIndex;
+ SET_INTEGER_PARAM(0, CTheScripts::StoreVehicleIndex);
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_STORE_CAR_PLAYER_IS_IN:
{
CollectParameters(&m_nIp, 1);
- CPed* ped = CWorld::Players[ScriptParams[0]].m_pPed;
+ CPed* ped = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
script_assert(ped);
if (!ped->bInVehicle)
return 0; // No value written to output variable
@@ -4350,15 +4742,15 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
break;
}
}
- ScriptParams[0] = CTheScripts::StoreVehicleIndex;
+ SET_INTEGER_PARAM(0, CTheScripts::StoreVehicleIndex);
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_IS_CHAR_IN_CAR:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- CVehicle* pCheckedVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
+ CVehicle* pCheckedVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1));
CVehicle* pActualVehicle = pPed->bInVehicle ? pPed->m_pMyVehicle : nil;
UpdateCompareFlag(pActualVehicle && pActualVehicle == pCheckedVehicle);
return 0;
@@ -4366,51 +4758,51 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
case COMMAND_IS_PLAYER_IN_CAR:
{
CollectParameters(&m_nIp, 2);
- CVehicle* pCheckedVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
- CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ CVehicle* pCheckedVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1));
+ CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle == pCheckedVehicle);
return 0;
}
case COMMAND_IS_CHAR_IN_MODEL:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
CVehicle* pActualVehicle = pPed->bInVehicle ? pPed->m_pMyVehicle : nil;
- UpdateCompareFlag(pActualVehicle && pActualVehicle->GetModelIndex() == ScriptParams[1]);
+ UpdateCompareFlag(pActualVehicle && pActualVehicle->GetModelIndex() == GET_INTEGER_PARAM(1));
return 0;
}
case COMMAND_IS_PLAYER_IN_MODEL:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetModelIndex() == ScriptParams[1]);
+ CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
+ UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetModelIndex() == GET_INTEGER_PARAM(1));
return 0;
}
case COMMAND_IS_CHAR_IN_ANY_CAR:
{
CollectParameters(&m_nIp, 1);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle);
return 0;
}
case COMMAND_IS_PLAYER_IN_ANY_CAR:
{
CollectParameters(&m_nIp, 1);
- CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle);
return 0;
}
case COMMAND_IS_BUTTON_PRESSED:
{
CollectParameters(&m_nIp, 2);
- UpdateCompareFlag(GetPadState(ScriptParams[0], ScriptParams[1]) != 0);
+ UpdateCompareFlag(GetPadState(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)) != 0);
return 0;
}
/*
case COMMAND_GET_PAD_STATE:
{
CollectParameters(&m_nIp, 1);
- ScriptParams[0] = GetPadState(ScriptParams[0], ScriptParams[1]);
+ SET_INTEGER_PARAM(0, GetPadState(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)));
StoreParameters(&m_nIp, 1);
return 0;
}
@@ -4470,10 +4862,10 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
case COMMAND_CREATE_OBJECT:
{
CollectParameters(&m_nIp, 4);
- int mi = ScriptParams[0] >= 0 ? ScriptParams[0] : CTheScripts::UsedObjectArray[-ScriptParams[0]].index;
+ int mi = GET_INTEGER_PARAM(0) >= 0 ? GET_INTEGER_PARAM(0) : CTheScripts::UsedObjectArray[-GET_INTEGER_PARAM(0)].index;
CObject* pObj = new CObject(mi, false);
pObj->ObjectCreatedBy = MISSION_OBJECT;
- CVector pos = *(CVector*)&ScriptParams[1];
+ CVector pos = GET_VECTOR_PARAM(1);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += pObj->GetDistanceFromCentreOfMassToBaseOfModel();
@@ -4481,73 +4873,70 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
pObj->SetOrientation(0.0f, 0.0f, 0.0f);
pObj->GetMatrix().UpdateRW();
pObj->UpdateRwFrame();
- CBaseModelInfo* pModelInfo = CModelInfo::GetModelInfo(mi);
- if (pModelInfo->IsBuilding() && ((CSimpleModelInfo*)pModelInfo)->m_isBigBuilding)
- pObj->SetupBigBuilding();
CTheScripts::ClearSpaceForMissionEntity(pos, pObj);
CWorld::Add(pObj);
- ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pObj);
+ SET_INTEGER_PARAM(0, CPools::GetObjectPool()->GetIndex(pObj));
StoreParameters(&m_nIp, 1);
if (m_bIsMissionScript)
- CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_OBJECT);
+ CTheScripts::MissionCleanUp.AddEntityToList(GET_INTEGER_PARAM(0), CLEANUP_OBJECT);
return 0;
}
case COMMAND_DELETE_OBJECT:
{
CollectParameters(&m_nIp, 1);
- CObject* pObj = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
+ CObject* pObj = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0));
if (pObj){
CWorld::Remove(pObj);
CWorld::RemoveReferencesToDeletedObject(pObj);
delete pObj;
}
if (m_bIsMissionScript)
- CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT);
+ CTheScripts::MissionCleanUp.RemoveEntityFromList(GET_INTEGER_PARAM(0), CLEANUP_OBJECT);
return 0;
}
case COMMAND_ADD_SCORE:
CollectParameters(&m_nIp, 2);
- CWorld::Players[ScriptParams[0]].m_nMoney += ScriptParams[1];
- if (CWorld::Players[ScriptParams[0]].m_nMoney < 0)
- CWorld::Players[ScriptParams[0]].m_nMoney = 0;
+ CWorld::Players[GET_INTEGER_PARAM(0)].m_nMoney += GET_INTEGER_PARAM(1);
+ if (CWorld::Players[GET_INTEGER_PARAM(0)].m_nMoney < 0)
+ CWorld::Players[GET_INTEGER_PARAM(0)].m_nMoney = 0;
return 0;
case COMMAND_IS_SCORE_GREATER:
CollectParameters(&m_nIp, 2);
- UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_nMoney > ScriptParams[1]);
+ UpdateCompareFlag(CWorld::Players[GET_INTEGER_PARAM(0)].m_nMoney > GET_INTEGER_PARAM(1));
return 0;
case COMMAND_STORE_SCORE:
CollectParameters(&m_nIp, 1);
- ScriptParams[0] = CWorld::Players[ScriptParams[0]].m_nMoney;
+ SET_INTEGER_PARAM(0, CWorld::Players[GET_INTEGER_PARAM(0)].m_nMoney);
StoreParameters(&m_nIp, 1);
return 0;
case COMMAND_GIVE_REMOTE_CONTROLLED_CAR_TO_PLAYER:
{
CollectParameters(&m_nIp, 5);
- CVector pos = *(CVector*)&ScriptParams[1];
+ CVector pos = GET_VECTOR_PARAM(1);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
- CRemote::GivePlayerRemoteControlledCar(pos.x, pos.y, pos.z, DEGTORAD(*(float*)&ScriptParams[4]), MI_RCBANDIT);
+ CRemote::GivePlayerRemoteControlledCar(pos.x, pos.y, pos.z, DEGTORAD(GET_FLOAT_PARAM(4)), MI_RCBANDIT);
return 0;
}
case COMMAND_ALTER_WANTED_LEVEL:
CollectParameters(&m_nIp, 2);
- CWorld::Players[ScriptParams[0]].m_pPed->SetWantedLevel(ScriptParams[1]);
+ CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed->SetWantedLevel(GET_INTEGER_PARAM(1));
return 0;
case COMMAND_ALTER_WANTED_LEVEL_NO_DROP:
CollectParameters(&m_nIp, 2);
- CWorld::Players[ScriptParams[0]].m_pPed->SetWantedLevelNoDrop(ScriptParams[1]);
+ CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed->SetWantedLevelNoDrop(GET_INTEGER_PARAM(1));
return 0;
case COMMAND_IS_WANTED_LEVEL_GREATER:
CollectParameters(&m_nIp, 2);
- UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_pPed->m_pWanted->m_nWantedLevel > ScriptParams[1]);
+ UpdateCompareFlag(CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed->m_pWanted->m_nWantedLevel > GET_INTEGER_PARAM(1));
return 0;
case COMMAND_CLEAR_WANTED_LEVEL:
CollectParameters(&m_nIp, 1);
- CWorld::Players[ScriptParams[0]].m_pPed->SetWantedLevel(0);
+ CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed->SetWantedLevel(0);
return 0;
case COMMAND_SET_DEATHARREST_STATE:
CollectParameters(&m_nIp, 1);
- m_bDeatharrestEnabled = (ScriptParams[0] == 1);
+ m_bDeatharrestEnabled = (GET_INTEGER_PARAM(0) == 1);
return 0;
case COMMAND_HAS_DEATHARREST_BEEN_EXECUTED:
UpdateCompareFlag(m_bDeatharrestExecuted);
@@ -4556,51 +4945,54 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
case COMMAND_ADD_AMMO_TO_PLAYER:
{
CollectParameters(&m_nIp, 3);
- CWorld::Players[ScriptParams[0]].m_pPed->GrantAmmo((eWeaponType)ScriptParams[1], ScriptParams[2]);
+ CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed->GrantAmmo((eWeaponType)GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2));
return 0;
}
*/
case COMMAND_ADD_AMMO_TO_CHAR:
{
CollectParameters(&m_nIp, 3);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- pPed->GrantAmmo((eWeaponType)ScriptParams[1], ScriptParams[2]);
+ pPed->GrantAmmo((eWeaponType)GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2));
return 0;
}
//case COMMAND_ADD_AMMO_TO_CAR:
- //case COMMAND_IS_PLAYER_STILL_ALIVE:
+ case COMMAND_IS_PLAYER_STILL_ALIVE:
+ CollectParameters(&m_nIp, 1);
+ UpdateCompareFlag(CWorld::Players[GET_INTEGER_PARAM(0)].m_WBState != WBSTATE_WASTED);
+ return 0;
case COMMAND_IS_PLAYER_DEAD:
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_WBState == WBSTATE_WASTED);
+ UpdateCompareFlag(CWorld::Players[GET_INTEGER_PARAM(0)].m_WBState == WBSTATE_WASTED);
return 0;
case COMMAND_IS_CHAR_DEAD:
{
CollectParameters(&m_nIp, 1);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- UpdateCompareFlag(!pPed || pPed->DyingOrDead());
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
+ UpdateCompareFlag(!pPed || pPed->DyingOrDead() || pPed->m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE);
return 0;
}
case COMMAND_IS_CAR_DEAD:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
UpdateCompareFlag(!pVehicle || pVehicle->GetStatus() == STATUS_WRECKED || pVehicle->bIsDrowning);
return 0;
}
case COMMAND_SET_CHAR_THREAT_SEARCH:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- pPed->m_fearFlags |= ScriptParams[1];
+ pPed->m_fearFlags |= GET_INTEGER_PARAM(1);
return 0;
}
//case COMMAND_SET_CHAR_THREAT_REACTION:
case COMMAND_SET_CHAR_OBJ_NO_OBJ:
{
CollectParameters(&m_nIp, 1);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
pPed->bScriptObjectiveCompleted = false;
pPed->ClearObjective();
@@ -4613,7 +5005,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
case COMMAND_IS_PLAYER_IN_ZONE:
{
CollectParameters(&m_nIp, 1);
- CPlayerInfo* pPlayer = &CWorld::Players[ScriptParams[0]];
+ CPlayerInfo* pPlayer = &CWorld::Players[GET_INTEGER_PARAM(0)];
char label[12];
CTheScripts::ReadTextLabelFromScript(&m_nIp, label);
int zoneToCheck = CTheZones::FindZoneByLabelAndReturnIndex(label, ZONE_DEFAULT);
@@ -4626,15 +5018,15 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
}
case COMMAND_IS_PLAYER_PRESSING_HORN:
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_pPed->GetPedState() == PED_DRIVING &&
- CPad::GetPad(ScriptParams[0])->GetHorn());
+ UpdateCompareFlag(CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed->GetPedState() == PED_DRIVING &&
+ CPad::GetPad(GET_INTEGER_PARAM(0))->GetHorn());
return 0;
case COMMAND_HAS_CHAR_SPOTTED_PLAYER:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- UpdateCompareFlag(pPed->OurPedCanSeeThisOne(CWorld::Players[ScriptParams[1]].m_pPed));
+ UpdateCompareFlag(pPed->OurPedCanSeeThisOne(CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed));
return 0;
}
//case COMMAND_ORDER_CHAR_TO_BACKDOOR:
@@ -4642,7 +5034,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
case COMMAND_IS_CHAR_OBJECTIVE_PASSED:
{
CollectParameters(&m_nIp, 1);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
UpdateCompareFlag(pPed->bScriptObjectiveCompleted);
return 0;
@@ -4654,43 +5046,43 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
case COMMAND_CREATE_CHAR_INSIDE_CAR:
{
CollectParameters(&m_nIp, 3);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- switch (ScriptParams[2]) {
+ switch (GET_INTEGER_PARAM(2)) {
case MI_COP:
- if (ScriptParams[1] == PEDTYPE_COP)
- ScriptParams[2] = COP_STREET;
+ if (GET_INTEGER_PARAM(1) == PEDTYPE_COP)
+ SET_INTEGER_PARAM(2, COP_STREET);
break;
case MI_SWAT:
- if (ScriptParams[1] == PEDTYPE_COP)
- ScriptParams[2] = COP_SWAT;
+ if (GET_INTEGER_PARAM(1) == PEDTYPE_COP)
+ SET_INTEGER_PARAM(2, COP_SWAT);
break;
case MI_FBI:
- if (ScriptParams[1] == PEDTYPE_COP)
- ScriptParams[2] = COP_FBI;
+ if (GET_INTEGER_PARAM(1) == PEDTYPE_COP)
+ SET_INTEGER_PARAM(2, COP_FBI);
break;
case MI_ARMY:
- if (ScriptParams[1] == PEDTYPE_COP)
- ScriptParams[2] = COP_ARMY;
+ if (GET_INTEGER_PARAM(1) == PEDTYPE_COP)
+ SET_INTEGER_PARAM(2, COP_ARMY);
break;
case MI_MEDIC:
- if (ScriptParams[1] == PEDTYPE_EMERGENCY)
- ScriptParams[2] = PEDTYPE_EMERGENCY;
+ if (GET_INTEGER_PARAM(1) == PEDTYPE_EMERGENCY)
+ SET_INTEGER_PARAM(2, PEDTYPE_EMERGENCY);
break;
case MI_FIREMAN:
- if (ScriptParams[1] == PEDTYPE_FIREMAN)
- ScriptParams[2] = PEDTYPE_FIREMAN;
+ if (GET_INTEGER_PARAM(1) == PEDTYPE_FIREMAN)
+ SET_INTEGER_PARAM(2, PEDTYPE_FIREMAN);
break;
default:
break;
}
CPed* pPed;
- if (ScriptParams[1] == PEDTYPE_COP)
- pPed = new CCopPed((eCopType)ScriptParams[2]);
- else if (ScriptParams[1] == PEDTYPE_EMERGENCY || ScriptParams[1] == PEDTYPE_FIREMAN)
- pPed = new CEmergencyPed(ScriptParams[2]);
+ if (GET_INTEGER_PARAM(1) == PEDTYPE_COP)
+ pPed = new CCopPed((eCopType)GET_INTEGER_PARAM(2));
+ else if (GET_INTEGER_PARAM(1) == PEDTYPE_EMERGENCY || GET_INTEGER_PARAM(1) == PEDTYPE_FIREMAN)
+ pPed = new CEmergencyPed(GET_INTEGER_PARAM(2));
else
- pPed = new CCivilianPed((ePedType)ScriptParams[1], ScriptParams[2]);
+ pPed = new CCivilianPed((ePedType)GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2));
pPed->CharCreatedBy = MISSION_CHAR;
pPed->bRespondsToThreats = false;
pPed->bAllowMedicsToReviveMe = false;
@@ -4700,7 +5092,6 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
pPed->SetPosition(pVehicle->GetPosition());
pPed->SetOrientation(0.0f, 0.0f, 0.0f);
pPed->SetPedState(PED_DRIVING);
- CPopulation::ms_nTotalMissionPeds++;
script_assert(!pVehicle->pDriver);
pVehicle->pDriver = pPed;
pVehicle->pDriver->RegisterReference((CEntity**)&pVehicle->pDriver);
@@ -4715,17 +5106,18 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
pPed->AddInCarAnims(pVehicle, true);
pPed->m_nZoneLevel = CTheZones::GetLevelFromPosition(&pPed->GetPosition());
CWorld::Add(pPed);
- ScriptParams[0] = CPools::GetPedPool()->GetIndex(pPed);
+ CPopulation::ms_nTotalMissionPeds++;
+ SET_INTEGER_PARAM(0, CPools::GetPedPool()->GetIndex(pPed));
StoreParameters(&m_nIp, 1);
if (m_bIsMissionScript)
- CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
+ CTheScripts::MissionCleanUp.AddEntityToList(GET_INTEGER_PARAM(0), CLEANUP_CHAR);
return 0;
}
case COMMAND_WARP_PLAYER_FROM_CAR_TO_COORD:
{
CollectParameters(&m_nIp, 4);
- CVector pos = *(CVector*)&ScriptParams[1];
- CPlayerInfo* pPlayer = &CWorld::Players[ScriptParams[0]];
+ CVector pos = GET_VECTOR_PARAM(1);
+ CPlayerInfo* pPlayer = &CWorld::Players[GET_INTEGER_PARAM(0)];
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
if (pPlayer->m_pPed->bInVehicle){
@@ -4768,6 +5160,24 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
return -1;
}
+void CRunningScript::ReturnFromGosubOrFunction()
+{
+ uint32 val = m_nIp = m_anStack[--m_nStackPointer];
+ if (!(m_nIp & BIT(STACKVALUE_IS_FUNCTION_CALL_BIT)))
+ return;
+ if (m_nIp & BIT(STACKVALUE_INVERT_RETURN_BIT))
+ m_bCondResult = !m_bCondResult;
+ m_nIp = m_nIp & STACKVALUE_IP_MASK;
+ uint8 nInputParameters = CTheScripts::Read1ByteFromScript(&m_nIp);
+ uint8 nOutputParameters = CTheScripts::Read1ByteFromScript(&m_nIp);
+ uint8 nLocalsOffset = CTheScripts::Read1ByteFromScript(&m_nIp);
+ for (int i = 0; i < nOutputParameters; i++)
+ ScriptParams[i] = m_anLocalVariables[m_nLocalsPointer + nInputParameters];
+ m_nIp += val >> STACKVALUE_IP_PARAMS_OFFSET;
+ m_nLocalsPointer -= nLocalsOffset;
+ StoreParameters(&m_nIp, nOutputParameters);
+}
+
#ifdef MISSION_REPLAY
bool CRunningScript::CanAllowMissionReplay()
@@ -4848,9 +5258,9 @@ CTheScripts::SwitchToMission(int32 mission)
int handle = CFileMgr::OpenFile("data\\main.scm", "rb");
#endif
CFileMgr::Seek(handle, offset, 0);
- CFileMgr::Read(handle, (const char*)&CTheScripts::ScriptSpace[SIZE_MAIN_SCRIPT], SIZE_MISSION_SCRIPT);
+ CFileMgr::Read(handle, (const char*)&CTheScripts::ScriptSpace[CTheScripts::MainScriptSize], CTheScripts::MainScriptSize);
CFileMgr::CloseFile(handle);
- CRunningScript* pMissionScript = CTheScripts::StartNewScript(SIZE_MAIN_SCRIPT);
+ CRunningScript* pMissionScript = CTheScripts::StartNewScript(CTheScripts::MainScriptSize);
CTimer::Resume();
pMissionScript->m_bIsMissionScript = true;
pMissionScript->m_bMissionFlag = true;
diff --git a/src/control/Script.h b/src/control/Script.h
index aafc681c..60902563 100644
--- a/src/control/Script.h
+++ b/src/control/Script.h
@@ -30,9 +30,9 @@ void FlushLog();
#define UPSIDEDOWN_TURN_SPEED_THRESHOLD (0.02f)
#define UPSIDEDOWN_TIMER_THRESHOLD (1000)
-#define SPHERE_MARKER_R (252)
-#define SPHERE_MARKER_G (138)
-#define SPHERE_MARKER_B (242)
+#define SPHERE_MARKER_R (255)
+#define SPHERE_MARKER_G (255)
+#define SPHERE_MARKER_B (128)
#define SPHERE_MARKER_A (228)
#define SPHERE_MARKER_PULSE_PERIOD 2048
#define SPHERE_MARKER_PULSE_FRACTION 0.1f
@@ -47,7 +47,15 @@ void FlushLog();
#define KEY_LENGTH_IN_SCRIPT (8)
-//#define GTA_SCRIPT_COLLECTIVE
+#define GET_INTEGER_PARAM(i) (ScriptParams[i])
+#define GET_FLOAT_PARAM(i) (*(float*)&ScriptParams[i])
+#define GET_VECTOR_PARAM(i) (CVector(GET_FLOAT_PARAM(i), GET_FLOAT_PARAM(i+1), GET_FLOAT_PARAM(i+2)))
+
+#define SET_INTEGER_PARAM(i, x) ScriptParams[i] = x
+#define SET_FLOAT_PARAM(i, x) *(float*)&ScriptParams[i] = x
+#define SET_VECTOR_PARAM(i, v) { *(float*)&ScriptParams[i] = (v).x; *(float*)&ScriptParams[i+1] = (v).y; *(float*)&ScriptParams[i+2] = (v).z; }
+
+#define GTA_SCRIPT_COLLECTIVE
struct intro_script_rectangle
{
@@ -215,15 +223,33 @@ public:
};
enum {
+ MAX_STACK_DEPTH = 16,
+ NUM_LOCAL_VARS = 96,
+ NUM_TIMERS = 2,
+ NUM_GLOBAL_SLOTS = 26
+};
+
+enum {
ARGUMENT_END = 0,
+ ARGUMENT_INT_ZERO,
+ ARGUMENT_FLOAT_ZERO,
+ ARGUMENT_FLOAT_1BYTE,
+ ARGUMENT_FLOAT_2BYTES,
+ ARGUMENT_FLOAT_3BYTES,
ARGUMENT_INT32,
- ARGUMENT_GLOBALVAR,
- ARGUMENT_LOCALVAR,
ARGUMENT_INT8,
ARGUMENT_INT16,
- ARGUMENT_FLOAT
+ ARGUMENT_FLOAT,
+ ARGUMENT_TIMER,
+ ARGUMENT_LOCAL = ARGUMENT_TIMER + NUM_TIMERS,
+ ARGUMENT_LOCAL_ARRAY = ARGUMENT_LOCAL + NUM_LOCAL_VARS,
+ ARGUMENT_GLOBAL = ARGUMENT_LOCAL_ARRAY + NUM_LOCAL_VARS,
+ ARGUMENT_GLOBAL_ARRAY = ARGUMENT_GLOBAL + NUM_GLOBAL_SLOTS,
+ MAX_ARGUMENT = ARGUMENT_GLOBAL_ARRAY + NUM_GLOBAL_SLOTS
};
+static_assert(MAX_ARGUMENT <= 256, "MAX_ARGUMENT must be less or equal to 256");
+
struct tCollectiveData
{
int32 colIndex;
@@ -254,37 +280,30 @@ enum {
};
enum {
-#ifdef PS2
- SIZE_MAIN_SCRIPT = 205512,
-#else
- SIZE_MAIN_SCRIPT = 225512,
-#endif
- SIZE_MISSION_SCRIPT = 35000,
- SIZE_SCRIPT_SPACE = SIZE_MAIN_SCRIPT + SIZE_MISSION_SCRIPT
-};
-
-enum {
MAX_NUM_SCRIPTS = 128,
MAX_NUM_INTRO_TEXT_LINES = 48,
MAX_NUM_INTRO_RECTANGLES = 16,
MAX_NUM_SCRIPT_SRPITES = 16,
MAX_NUM_SCRIPT_SPHERES = 16,
- MAX_NUM_USED_OBJECTS = 220,
- MAX_NUM_MISSION_SCRIPTS = 120,
- MAX_NUM_BUILDING_SWAPS = 25,
- MAX_NUM_INVISIBILITY_SETTINGS = 20,
- MAX_NUM_STORED_LINES = 1024
+ MAX_NUM_COLLECTIVES = 32,
+ MAX_NUM_USED_OBJECTS = 305,
+ MAX_NUM_MISSION_SCRIPTS = 150,
+ MAX_NUM_BUILDING_SWAPS = 80,
+ MAX_NUM_INVISIBILITY_SETTINGS = 52,
+ MAX_NUM_STORED_LINES = 1024,
+ MAX_ALLOWED_COLLISIONS = 2
};
class CTheScripts
{
public:
- static uint8 ScriptSpace[SIZE_SCRIPT_SPACE];
+ static uint8* ScriptSpace;
static CRunningScript ScriptsArray[MAX_NUM_SCRIPTS];
static intro_text_line IntroTextLines[MAX_NUM_INTRO_TEXT_LINES];
static intro_script_rectangle IntroRectangles[MAX_NUM_INTRO_RECTANGLES];
static CSprite2d ScriptSprites[MAX_NUM_SCRIPT_SRPITES];
static script_sphere_struct ScriptSphereArray[MAX_NUM_SCRIPT_SPHERES];
+ static tCollectiveData CollectiveArray[MAX_NUM_COLLECTIVES];
static tUsedObject UsedObjectArray[MAX_NUM_USED_OBJECTS];
static int32 MultiScriptArray[MAX_NUM_MISSION_SCRIPTS];
static tBuildingSwap BuildingSwapArray[MAX_NUM_BUILDING_SWAPS];
@@ -316,20 +335,22 @@ public:
static uint16 ScriptsUpdated;
static uint32 LastMissionPassedTime;
static uint16 NumberOfExclusiveMissionScripts;
-#if (defined GTA_PC && !defined GTAVC_JP_PATCH || defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT)
-#define CARDS_IN_SUIT (13)
-#define NUM_SUITS (4)
-#define MAX_DECKS (6)
-#define CARDS_IN_DECK (CARDS_IN_SUIT * NUM_SUITS)
-#define CARDS_IN_STACK (CARDS_IN_DECK * MAX_DECKS)
- static int16 CardStack[CARDS_IN_STACK];
- static int16 CardStackPosition;
-#endif
+
static bool bPlayerIsInTheStatium;
static uint8 RiotIntensity;
static bool bPlayerHasMetDebbieHarry;
- static void Init();
+ static int AllowedCollision[MAX_ALLOWED_COLLISIONS];
+ static short* SavedVarIndices;
+ static int NumSaveVars;
+ static bool FSDestroyedFlag;
+ static int NextProcessId;
+ static bool InTheScripts;
+ static CRunningScript* pCurrent;
+ static uint16 NumTrueGlobals;
+ static uint16 MostGlobals;
+
+ static bool Init(bool loaddata = false);
static void Process();
static CRunningScript* StartTestScript();
@@ -420,6 +441,9 @@ public:
static void SwitchToMission(int32 mission);
#endif
+ static int GetSaveVarIndex(int);
+ static void Shutdown(void);
+
#ifdef GTA_SCRIPT_COLLECTIVE
static void AdvanceCollectiveIndex()
{
@@ -441,12 +465,9 @@ public:
};
+extern int ScriptParams[32];
-enum {
- MAX_STACK_DEPTH = 6,
- NUM_LOCAL_VARS = 16,
- NUM_TIMERS = 2
-};
+VALIDATE_SIZE(uStackReturnValue, 4);
class CRunningScript
{
@@ -470,14 +491,25 @@ class CRunningScript
ORS_8
};
+ enum {
+ STACKVALUE_IP_BITS = 22,
+ STACKVALUE_INVERT_RETURN_BIT = STACKVALUE_IP_BITS,
+ STACKVALUE_IS_FUNCTION_CALL_BIT,
+ STACKVALUE_IP_PARAMS_OFFSET,
+
+ STACKVALUE_IP_MASK = ((1 << STACKVALUE_IP_BITS) - 1)
+ };
+
public:
CRunningScript* next;
CRunningScript* prev;
+ int m_nId;
char m_abScriptName[8];
uint32 m_nIp;
uint32 m_anStack[MAX_STACK_DEPTH];
uint16 m_nStackPointer;
- int32 m_anLocalVariables[NUM_LOCAL_VARS + NUM_TIMERS];
+ int32 m_anLocalVariables[NUM_LOCAL_VARS + 8 + NUM_TIMERS]; // TODO(LCS): figure out why 106
+ int32 m_nLocalsPointer;
bool m_bIsActive;
bool m_bCondResult;
bool m_bIsMissionScript;
@@ -497,8 +529,8 @@ public:
void Load(uint8*& buf);
void UpdateTimers(float timeStep) {
- m_anLocalVariables[NUM_LOCAL_VARS] += timeStep;
- m_anLocalVariables[NUM_LOCAL_VARS + 1] += timeStep;
+ for (int i = 0; i < NUM_TIMERS; i++)
+ m_anLocalVariables[NUM_LOCAL_VARS + 8 + i] += timeStep;
}
void Init();
@@ -509,7 +541,7 @@ public:
static const uint32 nSaveStructSize;
- void CollectParameters(uint32*, int16);
+ void CollectParameters(uint32*, int16, int* pParams = (int*)&ScriptParams);
int32 CollectNextParameterWithoutIncreasingPC(uint32);
int32* GetPointerToScriptVariable(uint32*, int16);
void StoreParameters(uint32*, int16);
@@ -534,6 +566,8 @@ public:
int8 ProcessCommands1200To1299(int32);
int8 ProcessCommands1300To1399(int32);
int8 ProcessCommands1400To1499(int32);
+ int8 ProcessCommands1500To1599(int32);
+ int8 ProcessCommands1600To1699(int32);
void LocatePlayerCommand(int32, uint32*);
void LocatePlayerCharCommand(int32, uint32*);
@@ -571,11 +605,11 @@ public:
float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; }
bool ThisIsAValidRandomPed(uint32 pedtype, int civ, int gang, int criminal);
-
- bool CheckDamagedWeaponType(int32 actual, int32 type);
-
+ bool CheckDamagedWeaponType(int32 actual, int32 type);
static bool ThisIsAValidRandomCop(int32 mi, bool cop, bool swat, bool fbi, bool army, bool miami);
+ void ReturnFromGosubOrFunction();
+
};
#ifdef USE_DEBUG_SCRIPT_LOADER
@@ -600,3 +634,6 @@ void RetryMission(int, int);
#ifdef USE_DEBUG_SCRIPT_LOADER
extern int scriptToLoad;
#endif
+
+extern int gScriptsFile;
+
diff --git a/src/control/Script2.cpp b/src/control/Script2.cpp
index a94bf907..5cac2bfd 100644
--- a/src/control/Script2.cpp
+++ b/src/control/Script2.cpp
@@ -28,6 +28,8 @@
#include "World.h"
#include "Zones.h"
+// LCS: file done except TODOs
+
int8 CRunningScript::ProcessCommands300To399(int32 command)
{
switch (command) {
@@ -35,12 +37,10 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
//case COMMAND_SET_PLAYER_INVINCIBLE:
//case COMMAND_SET_CHAR_GRAPHIC_TYPE:
//case COMMAND_SET_PLAYER_GRAPHIC_TYPE:
- /*
case COMMAND_HAS_PLAYER_BEEN_ARRESTED:
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_WBState == WBSTATE_BUSTED);
+ UpdateCompareFlag(CWorld::Players[GET_INTEGER_PARAM(0)].m_WBState == WBSTATE_BUSTED);
return 0;
- */
//case COMMAND_STOP_CHAR_DRIVING:
//case COMMAND_KILL_CHAR:
//case COMMAND_SET_FAVOURITE_CAR_MODEL_FOR_CHAR:
@@ -49,25 +49,25 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
case COMMAND_CHANGE_CAR_LOCK:
{
CollectParameters(&m_nIp, 2);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- pVehicle->m_nDoorLock = (eCarLock)ScriptParams[1];
+ pVehicle->m_nDoorLock = (eCarLock)GET_INTEGER_PARAM(1);
return 0;
}
case COMMAND_SHAKE_CAM_WITH_POINT:
CollectParameters(&m_nIp, 4);
- TheCamera.CamShake(ScriptParams[0] / 1000.0f,
- *(float*)&ScriptParams[1],
- *(float*)&ScriptParams[2],
- *(float*)&ScriptParams[3]);
+ TheCamera.CamShake(GET_INTEGER_PARAM(0) / 1000.0f,
+ GET_FLOAT_PARAM(1),
+ GET_FLOAT_PARAM(2),
+ GET_FLOAT_PARAM(3));
return 0;
*/
case COMMAND_IS_CAR_MODEL:
{
CollectParameters(&m_nIp, 2);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- UpdateCompareFlag(pVehicle->GetModelIndex() == ScriptParams[1]);
+ UpdateCompareFlag(pVehicle->GetModelIndex() == GET_INTEGER_PARAM(1));
return 0;
}
//case COMMAND_IS_CAR_REMAP:
@@ -77,15 +77,15 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
case COMMAND_IS_CAR_DEAD_IN_AREA_2D:
{
CollectParameters(&m_nIp, 6);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- float x1 = *(float*)&ScriptParams[1];
- float y1 = *(float*)&ScriptParams[2];
- float x2 = *(float*)&ScriptParams[3];
- float y2 = *(float*)&ScriptParams[4];
+ float x1 = GET_FLOAT_PARAM(1);
+ float y1 = GET_FLOAT_PARAM(2);
+ float x2 = GET_FLOAT_PARAM(3);
+ float y2 = GET_FLOAT_PARAM(4);
UpdateCompareFlag(pVehicle->GetStatus() == STATUS_WRECKED &&
pVehicle->IsWithinArea(x1, y1, x2, y2));
- if (ScriptParams[5])
+ if (GET_INTEGER_PARAM(5))
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT);
if (CTheScripts::DbgFlag)
CTheScripts::DrawDebugSquare(x1, y1, x2, y2);
@@ -94,17 +94,17 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
case COMMAND_IS_CAR_DEAD_IN_AREA_3D:
{
CollectParameters(&m_nIp, 8);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- float x1 = *(float*)&ScriptParams[1];
- float y1 = *(float*)&ScriptParams[2];
- float z1 = *(float*)&ScriptParams[3];
- float x2 = *(float*)&ScriptParams[4];
- float y2 = *(float*)&ScriptParams[5];
- float z2 = *(float*)&ScriptParams[6];
+ float x1 = GET_FLOAT_PARAM(1);
+ float y1 = GET_FLOAT_PARAM(2);
+ float z1 = GET_FLOAT_PARAM(3);
+ float x2 = GET_FLOAT_PARAM(4);
+ float y2 = GET_FLOAT_PARAM(5);
+ float z2 = GET_FLOAT_PARAM(6);
UpdateCompareFlag(pVehicle->GetStatus() == STATUS_WRECKED &&
pVehicle->IsWithinArea(x1, y1, z1, x2, y2, z2));
- if (ScriptParams[7])
+ if (GET_INTEGER_PARAM(7))
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, (z1 + z2) / 2);
if (CTheScripts::DbgFlag)
CTheScripts::DrawDebugCube(x1, y1, z1, x2, y2, z2);
@@ -121,38 +121,45 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
//case COMMAND_SET_CAR_FLAMEPROOF:
//case COMMAND_SET_CAR_ROCKETPROOF:
//case COMMAND_IS_CARBOMB_ACTIVE:
- //case COMMAND_GIVE_CAR_ALARM:
+ case COMMAND_GIVE_CAR_ALARM:
+ {
+ CollectParameters(&m_nIp, 1);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
+ script_assert(pVehicle);
+ pVehicle->m_nAlarmState = -1;
+ return 0;
+ }
//case COMMAND_PUT_CAR_ON_TRAILER:
- /*
case COMMAND_IS_CAR_CRUSHED:
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(CGarages::HasCarBeenCrushed(ScriptParams[0]));
+ UpdateCompareFlag(CGarages::HasCarBeenCrushed(GET_INTEGER_PARAM(0)));
return 0;
- */
- //case COMMAND_CREATE_GANG_CAR:
+ //case COMMAND_CREATE_GANG_CAR:
case COMMAND_CREATE_CAR_GENERATOR:
{
CollectParameters(&m_nIp, 12);
- CVector pos = *(CVector*)&ScriptParams[0];
+ CVector pos = GET_VECTOR_PARAM(0);
if (pos.z > MAP_Z_LOW_LIMIT)
pos.z += 0.015f;
- ScriptParams[0] = CTheCarGenerators::CreateCarGenerator(
- pos.x, pos.y, pos.z, *(float*)&ScriptParams[3],
- ScriptParams[4], ScriptParams[5], ScriptParams[6], ScriptParams[7],
- ScriptParams[8], ScriptParams[9], ScriptParams[10], ScriptParams[11]);
+ SET_INTEGER_PARAM(0, CTheCarGenerators::CreateCarGenerator(
+ pos.x, pos.y, pos.z, GET_FLOAT_PARAM(3),
+ GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(5), GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(7),
+ GET_INTEGER_PARAM(8), GET_INTEGER_PARAM(9), GET_INTEGER_PARAM(10), GET_INTEGER_PARAM(11)));
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_SWITCH_CAR_GENERATOR:
{
CollectParameters(&m_nIp, 2);
- CCarGenerator* pCarGen = &CTheCarGenerators::CarGeneratorArray[ScriptParams[0]];
- if (ScriptParams[1] == 0){
+ CCarGenerator* pCarGen = &CTheCarGenerators::CarGeneratorArray[GET_INTEGER_PARAM(0)];
+ if (GET_INTEGER_PARAM(1) == 0) {
pCarGen->SwitchOff();
- }else if (ScriptParams[1] <= 100){
+ }
+ else if (GET_INTEGER_PARAM(1) <= 100) {
pCarGen->SwitchOn();
- pCarGen->SetUsesRemaining(ScriptParams[1]);
- }else{
+ pCarGen->SetUsesRemaining(GET_INTEGER_PARAM(1));
+ }
+ else {
pCarGen->SwitchOn();
}
return 0;
@@ -162,40 +169,34 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 3);
- CUserDisplay::Pager.AddMessage(text, ScriptParams[0], ScriptParams[1], ScriptParams[2]);
+ CUserDisplay::Pager.AddMessage(text, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2));
return 0;
}
*/
case COMMAND_DISPLAY_ONSCREEN_TIMER:
{
- script_assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR);
- m_nIp++;
- uint16 offset = CTheScripts::Read2BytesFromScript(&m_nIp);
+ uint16 offset = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) - (int32*)CTheScripts::ScriptSpace;
CollectParameters(&m_nIp, 1);
- CUserDisplay::OnscnTimer.AddClock(offset, nil, ScriptParams[0] != 0);
+ CUserDisplay::OnscnTimer.AddClock(offset, nil, GET_INTEGER_PARAM(0) != 0);
return 0;
}
case COMMAND_CLEAR_ONSCREEN_TIMER:
{
- script_assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR);
- m_nIp++;
- CUserDisplay::OnscnTimer.ClearClock((uint16)CTheScripts::Read2BytesFromScript(&m_nIp));
+ uint16 offset = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) - (int32*)CTheScripts::ScriptSpace;
+ CUserDisplay::OnscnTimer.ClearClock(offset);
return 0;
}
case COMMAND_DISPLAY_ONSCREEN_COUNTER:
{
- script_assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR);
- m_nIp++;
- int16 counter = CTheScripts::Read2BytesFromScript(&m_nIp);
+ uint16 counter = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) - (int32*)CTheScripts::ScriptSpace;
CollectParameters(&m_nIp, 1);
- CUserDisplay::OnscnTimer.AddCounter(counter, ScriptParams[0], nil, 0);
+ CUserDisplay::OnscnTimer.AddCounter(counter, GET_INTEGER_PARAM(0), nil, 0);
return 0;
}
case COMMAND_CLEAR_ONSCREEN_COUNTER:
{
- script_assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR);
- m_nIp++;
- CUserDisplay::OnscnTimer.ClearCounter((uint16)CTheScripts::Read2BytesFromScript(&m_nIp));
+ uint16 counter = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) - (int32*)CTheScripts::ScriptSpace;
+ CUserDisplay::OnscnTimer.ClearCounter(counter);
return 0;
}
case COMMAND_SET_ZONE_CAR_INFO:
@@ -219,7 +220,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
return 0;
}
while (zone >= 0) {
- CTheZones::SetZoneCarInfo(zone, ScriptParams[0], ScriptParams[1], ScriptParams[11], gangDensities);
+ CTheZones::SetZoneCarInfo(zone, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(11), gangDensities);
zone = CTheZones::FindNextZoneByLabelAndReturnIndex(label, ZONE_INFO);
}
return 0;
@@ -228,7 +229,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
case COMMAND_IS_CHAR_IN_ZONE:
{
CollectParameters(&m_nIp, 1);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
char label[12];
CTheScripts::ReadTextLabelFromScript(&m_nIp, label);
@@ -239,39 +240,70 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
UpdateCompareFlag(CTheZones::PointLiesWithinZone(&pos, CTheZones::GetNavigationZone(zone)));
return 0;
}
- //case COMMAND_SET_CAR_DENSITY:
- //case COMMAND_SET_PED_DENSITY:
+ case COMMAND_SET_CAR_DENSITY:
+ {
+ char label[12];
+ CTheScripts::ReadTextLabelFromScript(&m_nIp, label);
+ int16 zone = CTheZones::FindZoneByLabelAndReturnIndex(label, ZONE_INFO);
+ m_nIp += 8;
+ CollectParameters(&m_nIp, 2);
+ if (zone < 0) {
+ debug("Couldn't find zone - %s\n", label);
+ return 0;
+ }
+ while (zone >= 0) {
+ CTheZones::SetCarDensity(zone, ScriptParams[0], ScriptParams[1]);
+ zone = CTheZones::FindNextZoneByLabelAndReturnIndex(label, ZONE_INFO);
+ }
+ return 0;
+ }
+ case COMMAND_SET_PED_DENSITY:
+ {
+ char label[12];
+ CTheScripts::ReadTextLabelFromScript(&m_nIp, label);
+ int16 zone = CTheZones::FindZoneByLabelAndReturnIndex(label, ZONE_INFO);
+ m_nIp += KEY_LENGTH_IN_SCRIPT;
+ CollectParameters(&m_nIp, 2);
+ if (zone < 0) {
+ debug("Couldn't find zone - %s\n", label);
+ return 0;
+ }
+ while (zone >= 0) {
+ CTheZones::SetPedDensity(zone, ScriptParams[0], ScriptParams[1]);
+ zone = CTheZones::FindNextZoneByLabelAndReturnIndex(label, ZONE_INFO);
+ }
+ return 0;
+ }
case COMMAND_POINT_CAMERA_AT_PLAYER:
{
CollectParameters(&m_nIp, 3);
- // ScriptParams[0] is unused.
- TheCamera.TakeControl(nil, ScriptParams[1], ScriptParams[2], CAMCONTROL_SCRIPT);
+ TheCamera.TakeControl(nil, GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), CAMCONTROL_SCRIPT);
return 0;
}
case COMMAND_POINT_CAMERA_AT_CAR:
{
CollectParameters(&m_nIp, 3);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
if (pVehicle)
- TheCamera.TakeControl(pVehicle, ScriptParams[1], ScriptParams[2], CAMCONTROL_SCRIPT);
+ TheCamera.TakeControl(pVehicle, GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), CAMCONTROL_SCRIPT);
return 0;
}
case COMMAND_POINT_CAMERA_AT_CHAR:
{
CollectParameters(&m_nIp, 3);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
if (pPed)
- TheCamera.TakeControl(pPed, ScriptParams[1], ScriptParams[2], CAMCONTROL_SCRIPT);
+ TheCamera.TakeControl(pPed, GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), CAMCONTROL_SCRIPT);
return 0;
}
case COMMAND_RESTORE_CAMERA:
TheCamera.Restore();
return 0;
- /*
- case COMMAND_SHAKE_PAD:
- CPad::GetPad(ScriptParams[0])->StartShake(ScriptParams[1], ScriptParams[2]);
- return 0;
- */
+ /*
+ case COMMAND_SHAKE_PAD:
+ CPad::GetPad(GET_INTEGER_PARAM(0))->StartShake(GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2));
+ return 0;
+ */
case COMMAND_SET_ZONE_PED_INFO:
{
char label[12];
@@ -284,61 +316,61 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
return 0;
}
while (zone >= 0) {
- CTheZones::SetZonePedInfo(zone, ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3],
- ScriptParams[4], ScriptParams[5], ScriptParams[6], ScriptParams[7], ScriptParams[8], ScriptParams[9], ScriptParams[10], ScriptParams[11]);
+ CTheZones::SetZonePedInfo(zone, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3),
+ GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(5), GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(7), GET_INTEGER_PARAM(8), GET_INTEGER_PARAM(9), GET_INTEGER_PARAM(10), GET_INTEGER_PARAM(11));
zone = CTheZones::FindNextZoneByLabelAndReturnIndex(label, ZONE_INFO);
}
return 0;
}
case COMMAND_SET_TIME_SCALE:
CollectParameters(&m_nIp, 1);
- CTimer::SetTimeScale(*(float*)&ScriptParams[0]);
- return 0;
- /*
- case COMMAND_IS_CAR_IN_AIR:
- {
- CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- script_assert(pVehicle && pVehicle->IsCar());
- CAutomobile* pCar = (CAutomobile*)pVehicle;
- UpdateCompareFlag(pCar->GetAllWheelsOffGround());
- return 0;
- }
- */
+ CTimer::SetTimeScale(GET_FLOAT_PARAM(0));
+ return 0;
+ /*
+ case COMMAND_IS_CAR_IN_AIR:
+ {
+ CollectParameters(&m_nIp, 1);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
+ script_assert(pVehicle && pVehicle->IsCar());
+ CAutomobile* pCar = (CAutomobile*)pVehicle;
+ UpdateCompareFlag(pCar->GetAllWheelsOffGround());
+ return 0;
+ }
+ */
case COMMAND_SET_FIXED_CAMERA_POSITION:
{
CollectParameters(&m_nIp, 6);
TheCamera.SetCamPositionForFixedMode(
- CVector(*(float*)&ScriptParams[0], *(float*)&ScriptParams[1], *(float*)&ScriptParams[2]),
- CVector(*(float*)&ScriptParams[3], *(float*)&ScriptParams[4], *(float*)&ScriptParams[5]));
+ CVector(GET_FLOAT_PARAM(0), GET_FLOAT_PARAM(1), GET_FLOAT_PARAM(2)),
+ CVector(GET_FLOAT_PARAM(3), GET_FLOAT_PARAM(4), GET_FLOAT_PARAM(5)));
return 0;
}
case COMMAND_POINT_CAMERA_AT_POINT:
{
CollectParameters(&m_nIp, 4);
- CVector pos = *(CVector*)&ScriptParams[0];
+ CVector pos = GET_VECTOR_PARAM(0);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
- TheCamera.TakeControlNoEntity(pos, ScriptParams[3], CAMCONTROL_SCRIPT);
+ TheCamera.TakeControlNoEntity(pos, GET_INTEGER_PARAM(3), CAMCONTROL_SCRIPT);
return 0;
}
case COMMAND_ADD_BLIP_FOR_CAR_OLD:
{
CollectParameters(&m_nIp, 3);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
- ScriptParams[0] = CRadar::SetEntityBlip(BLIP_CAR, ScriptParams[0], ScriptParams[1], (eBlipDisplay)ScriptParams[2]);
+ SET_INTEGER_PARAM(0, CRadar::SetEntityBlip(BLIP_CAR, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), (eBlipDisplay)GET_INTEGER_PARAM(2)));
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_ADD_BLIP_FOR_CHAR_OLD:
{
CollectParameters(&m_nIp, 3);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
- ScriptParams[0] = CRadar::SetEntityBlip(BLIP_CHAR, ScriptParams[0], ScriptParams[1], (eBlipDisplay)ScriptParams[2]);
+ SET_INTEGER_PARAM(0, CRadar::SetEntityBlip(BLIP_CHAR, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), (eBlipDisplay)GET_INTEGER_PARAM(2)));
StoreParameters(&m_nIp, 1);
return 0;
}
@@ -346,57 +378,61 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
case COMMAND_ADD_BLIP_FOR_OBJECT_OLD:
{
CollectParameters(&m_nIp, 3);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pObject);
CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
- ScriptParams[0] = CRadar::SetEntityBlip(BLIP_OBJECT, ScriptParams[0], ScriptParams[1], (eBlipDisplay)ScriptParams[2]);
+ SET_INTEGER_PARAM(0, CRadar::SetEntityBlip(BLIP_OBJECT, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), (eBlipDisplay)GET_INTEGER_PARAM(2)));
StoreParameters(&m_nIp, 1);
return 0;
}
*/
case COMMAND_REMOVE_BLIP:
CollectParameters(&m_nIp, 1);
- CRadar::ClearBlip(ScriptParams[0]);
+ CRadar::ClearBlip(GET_INTEGER_PARAM(0));
return 0;
case COMMAND_CHANGE_BLIP_COLOUR:
CollectParameters(&m_nIp, 2);
- CRadar::ChangeBlipColour(ScriptParams[0], ScriptParams[1]);
+ CRadar::ChangeBlipColour(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1));
return 0;
case COMMAND_DIM_BLIP:
CollectParameters(&m_nIp, 2);
- CRadar::ChangeBlipBrightness(ScriptParams[0], ScriptParams[1]);
+ CRadar::ChangeBlipBrightness(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1));
return 0;
case COMMAND_ADD_BLIP_FOR_COORD_OLD:
{
CollectParameters(&m_nIp, 5);
- CVector pos = *(CVector*)&ScriptParams[0];
+ CVector pos = GET_VECTOR_PARAM(0);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
- ScriptParams[0] = CRadar::SetCoordBlip(BLIP_COORD, pos, ScriptParams[3], (eBlipDisplay)ScriptParams[4]);
+ SET_INTEGER_PARAM(0, CRadar::SetCoordBlip(BLIP_COORD, pos, GET_INTEGER_PARAM(3), (eBlipDisplay)GET_INTEGER_PARAM(4)));
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_CHANGE_BLIP_SCALE:
CollectParameters(&m_nIp, 2);
- CRadar::ChangeBlipScale(ScriptParams[0], ScriptParams[1]);
+ CRadar::ChangeBlipScale(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1));
return 0;
case COMMAND_SET_FADING_COLOUR:
CollectParameters(&m_nIp, 3);
- TheCamera.SetFadeColour(ScriptParams[0], ScriptParams[1], ScriptParams[2]);
+ TheCamera.SetFadeColour(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2));
return 0;
case COMMAND_DO_FADE:
+ {
+ // unknown empty call on PS2, not mobile
CollectParameters(&m_nIp, 2);
- TheCamera.Fade(ScriptParams[0] / 1000.0f, ScriptParams[1]);
+ float fFadeTime = GET_INTEGER_PARAM(0);
+ TheCamera.Fade(fFadeTime > 2 ? fFadeTime / 1000.0f : 0.0f, GET_INTEGER_PARAM(1));
return 0;
+ }
case COMMAND_GET_FADING_STATUS:
UpdateCompareFlag(TheCamera.GetFading());
return 0;
case COMMAND_ADD_HOSPITAL_RESTART:
{
CollectParameters(&m_nIp, 4);
- CVector pos = *(CVector*)&ScriptParams[0];
- float angle = *(float*)&ScriptParams[3];
+ CVector pos = GET_VECTOR_PARAM(0);
+ float angle = GET_FLOAT_PARAM(3);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
CRestart::AddHospitalRestartPoint(pos, angle);
@@ -405,8 +441,8 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
case COMMAND_ADD_POLICE_RESTART:
{
CollectParameters(&m_nIp, 4);
- CVector pos = *(CVector*)&ScriptParams[0];
- float angle = *(float*)&ScriptParams[3];
+ CVector pos = GET_VECTOR_PARAM(0);
+ float angle = GET_FLOAT_PARAM(3);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
CRestart::AddPoliceRestartPoint(pos, angle);
@@ -415,8 +451,8 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
case COMMAND_OVERRIDE_NEXT_RESTART:
{
CollectParameters(&m_nIp, 4);
- CVector pos = *(CVector*)&ScriptParams[0];
- float angle = *(float*)&ScriptParams[3];
+ CVector pos = GET_VECTOR_PARAM(0);
+ float angle = GET_FLOAT_PARAM(3);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
CRestart::OverrideNextRestart(pos, angle);
@@ -426,9 +462,9 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
case COMMAND_DRAW_SHADOW:
{
CollectParameters(&m_nIp, 10);
- CVector pos = *(CVector*)&ScriptParams[1];
- float angle = *(float*)&ScriptParams[4];
- float length = *(float*)&ScriptParams[5];
+ CVector pos = GET_VECTOR_PARAM(1);
+ float angle = GET_FLOAT_PARAM(4);
+ float length = GET_FLOAT_PARAM(5);
float x, y;
if (angle != 0.0f){
y = cos(angle) * length;
@@ -441,40 +477,40 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
float frontY = y;
float sideX = y;
float sideY = x;
- CShadows::StoreShadowToBeRendered(ScriptParams[0], &pos, frontX, frontY, sideX, sideY,
- ScriptParams[6], ScriptParams[7], ScriptParams[8], ScriptParams[9]);
+ CShadows::StoreShadowToBeRendered(GET_INTEGER_PARAM(0), &pos, frontX, frontY, sideX, sideY,
+ GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(7), GET_INTEGER_PARAM(8), GET_INTEGER_PARAM(9));
return 0;
}
*/
case COMMAND_GET_PLAYER_HEADING:
{
CollectParameters(&m_nIp, 1);
- CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
float angle = pPed->bInVehicle ? pPed->m_pMyVehicle->GetForward().Heading() : pPed->GetForward().Heading();
angle = RADTODEG(angle);
if (angle < 0.0f)
angle += 360.0f;
if (angle > 360.0f)
angle -= 360.0f;
- *(float*)&ScriptParams[0] = angle;
+ SET_FLOAT_PARAM(0, angle);
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_SET_PLAYER_HEADING:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
script_assert(pPed);
if (pPed->bInVehicle)
return 0;
- pPed->m_fRotationDest = pPed->m_fRotationCur = DEGTORAD(*(float*)&ScriptParams[1]);
- pPed->SetHeading(DEGTORAD(*(float*)&ScriptParams[1]));
+ pPed->m_fRotationDest = pPed->m_fRotationCur = DEGTORAD(GET_FLOAT_PARAM(1));
+ pPed->SetHeading(DEGTORAD(GET_FLOAT_PARAM(1)));
return 0;
}
case COMMAND_GET_CHAR_HEADING:
{
CollectParameters(&m_nIp, 1);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
float angle = pPed->bInVehicle ? pPed->m_pMyVehicle->GetForward().Heading() : pPed->GetForward().Heading();
angle = RADTODEG(angle);
@@ -482,25 +518,25 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
angle += 360.0f;
if (angle > 360.0f)
angle -= 360.0f;
- *(float*)&ScriptParams[0] = angle;
+ SET_FLOAT_PARAM(0, angle);
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_SET_CHAR_HEADING:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
if (pPed->bInVehicle)
return 0;
- pPed->m_fRotationDest = pPed->m_fRotationCur = DEGTORAD(*(float*)&ScriptParams[1]);
- pPed->SetHeading(DEGTORAD(*(float*)&ScriptParams[1]));
+ pPed->m_fRotationDest = pPed->m_fRotationCur = DEGTORAD(GET_FLOAT_PARAM(1));
+ pPed->SetHeading(DEGTORAD(GET_FLOAT_PARAM(1)));
return 0;
}
case COMMAND_GET_CAR_HEADING:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
float angle = pVehicle->GetForward().Heading();
angle = RADTODEG(angle);
@@ -508,22 +544,22 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
angle += 360.0f;
if (angle > 360.0f)
angle -= 360.0f;
- *(float*)&ScriptParams[0] = angle;
+ SET_FLOAT_PARAM(0, angle);
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_SET_CAR_HEADING:
{
CollectParameters(&m_nIp, 2);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- pVehicle->SetHeading(DEGTORAD(*(float*)&ScriptParams[1]));
+ pVehicle->SetHeading(DEGTORAD(GET_FLOAT_PARAM(1)));
return 0;
}
case COMMAND_GET_OBJECT_HEADING:
{
CollectParameters(&m_nIp, 1);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pObject);
float angle = pObject->GetForward().Heading();
angle = RADTODEG(angle);
@@ -531,39 +567,39 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
angle += 360.0f;
if (angle > 360.0f)
angle -= 360.0f;
- *(float*)&ScriptParams[0] = angle;
+ SET_FLOAT_PARAM(0, angle);
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_SET_OBJECT_HEADING:
{
CollectParameters(&m_nIp, 2);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pObject);
CWorld::Remove(pObject);
- pObject->SetHeading(DEGTORAD(*(float*)&ScriptParams[1]));
+ pObject->SetHeading(DEGTORAD(GET_FLOAT_PARAM(1)));
pObject->GetMatrix().UpdateRW();
pObject->UpdateRwFrame();
CWorld::Add(pObject);
return 0;
}
- /*
case COMMAND_IS_PLAYER_TOUCHING_OBJECT:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]);
+ CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
+ CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(1));
script_assert(pObject);
CPhysical* pEntityToTest = pPed->bInVehicle ? (CPhysical*)pPed->m_pMyVehicle : pPed;
UpdateCompareFlag(pEntityToTest->GetHasCollidedWith(pObject));
return 0;
}
+ /*
case COMMAND_IS_CHAR_TOUCHING_OBJECT:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(1));
script_assert(pObject);
CPhysical* pEntityToTest = pPed->bInVehicle ? (CPhysical*)pPed->m_pMyVehicle : pPed;
UpdateCompareFlag(pEntityToTest->GetHasCollidedWith(pObject));
@@ -573,121 +609,119 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
case COMMAND_SET_PLAYER_AMMO:
{
CollectParameters(&m_nIp, 3);
- CWorld::Players[0].m_pPed->SetAmmo((eWeaponType)ScriptParams[1], ScriptParams[2]);
+ CWorld::Players[0].m_pPed->SetAmmo((eWeaponType)GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2));
return 0;
}
- /*
case COMMAND_SET_CHAR_AMMO:
{
CollectParameters(&m_nIp, 3);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- pPed->SetAmmo((eWeaponType)ScriptParams[1], ScriptParams[2]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
+ pPed->SetAmmo((eWeaponType)GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2));
return 0;
}
- */
//case COMMAND_SET_CAR_AMMO:
//case COMMAND_LOAD_CAMERA_SPLINE:
//case COMMAND_MOVE_CAMERA_ALONG_SPLINE:
//case COMMAND_GET_CAMERA_POSITION_ALONG_SPLINE:
case COMMAND_DECLARE_MISSION_FLAG:
- CTheScripts::OnAMissionFlag = (uint16)CTheScripts::Read2BytesFromScript(&++m_nIp);
+ CTheScripts::OnAMissionFlag = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) - (int32*)CTheScripts::ScriptSpace;
return 0;
case COMMAND_DECLARE_MISSION_FLAG_FOR_CONTACT:
return 0;
- //case COMMAND_DECLARE_BASE_BRIEF_ID_FOR_CONTACT:
+ //case COMMAND_DECLARE_BASE_BRIEF_ID_FOR_CONTACT:
case COMMAND_IS_PLAYER_HEALTH_GREATER:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- UpdateCompareFlag(pPed->m_fHealth > ScriptParams[1]);
+ CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
+ UpdateCompareFlag(pPed->m_fHealth > GET_INTEGER_PARAM(1));
return 0;
}
case COMMAND_IS_CHAR_HEALTH_GREATER:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- UpdateCompareFlag(pPed->m_fHealth > ScriptParams[1]);
+ UpdateCompareFlag(pPed->m_fHealth > GET_INTEGER_PARAM(1));
return 0;
}
case COMMAND_IS_CAR_HEALTH_GREATER:
{
CollectParameters(&m_nIp, 2);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- UpdateCompareFlag(pVehicle->m_fHealth > ScriptParams[1]);
+ UpdateCompareFlag(pVehicle->m_fHealth > GET_INTEGER_PARAM(1));
return 0;
}
case COMMAND_ADD_BLIP_FOR_CAR:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
- int handle = CRadar::SetEntityBlip(BLIP_CAR, ScriptParams[0], 0, BLIP_DISPLAY_BOTH);
+ int handle = CRadar::SetEntityBlip(BLIP_CAR, GET_INTEGER_PARAM(0), 0, BLIP_DISPLAY_BOTH);
CRadar::ChangeBlipScale(handle, 3);
- ScriptParams[0] = handle;
+ SET_INTEGER_PARAM(0, handle);
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_ADD_BLIP_FOR_CHAR:
{
CollectParameters(&m_nIp, 1);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
- int handle = CRadar::SetEntityBlip(BLIP_CHAR, ScriptParams[0], 1, BLIP_DISPLAY_BOTH);
+ int handle = CRadar::SetEntityBlip(BLIP_CHAR, GET_INTEGER_PARAM(0), 1, BLIP_DISPLAY_BOTH);
CRadar::ChangeBlipScale(handle, 3);
- ScriptParams[0] = handle;
+ SET_INTEGER_PARAM(0, handle);
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_ADD_BLIP_FOR_OBJECT:
{
CollectParameters(&m_nIp, 1);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pObject);
CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
- int handle = CRadar::SetEntityBlip(BLIP_OBJECT, ScriptParams[0], 6, BLIP_DISPLAY_BOTH);
+ int handle = CRadar::SetEntityBlip(BLIP_OBJECT, GET_INTEGER_PARAM(0), 6, BLIP_DISPLAY_BOTH);
CRadar::ChangeBlipScale(handle, 3);
- ScriptParams[0] = handle;
+ SET_INTEGER_PARAM(0, handle);
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_ADD_BLIP_FOR_CONTACT_POINT:
{
CollectParameters(&m_nIp, 3);
- CVector pos = *(CVector*)&ScriptParams[0];
+ CVector pos = GET_VECTOR_PARAM(0);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
int handle = CRadar::SetCoordBlip(BLIP_CONTACT_POINT, pos, 2, BLIP_DISPLAY_BOTH);
CRadar::ChangeBlipScale(handle, 3);
- ScriptParams[0] = handle;
+ SET_INTEGER_PARAM(0, handle);
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_ADD_BLIP_FOR_COORD:
{
CollectParameters(&m_nIp, 3);
- CVector pos = *(CVector*)&ScriptParams[0];
+ CVector pos = GET_VECTOR_PARAM(0);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
int handle = CRadar::SetCoordBlip(BLIP_COORD, pos, 5, BLIP_DISPLAY_BOTH);
CRadar::ChangeBlipScale(handle, 3);
- ScriptParams[0] = handle;
+ SET_INTEGER_PARAM(0, handle);
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_CHANGE_BLIP_DISPLAY:
CollectParameters(&m_nIp, 2);
- CRadar::ChangeBlipDisplay(ScriptParams[0], (eBlipDisplay)ScriptParams[1]);
+ CRadar::ChangeBlipDisplay(GET_INTEGER_PARAM(0), (eBlipDisplay)GET_INTEGER_PARAM(1));
return 0;
case COMMAND_ADD_ONE_OFF_SOUND:
{
CollectParameters(&m_nIp, 4);
- switch (ScriptParams[3]) {
+ switch (GET_INTEGER_PARAM(3)) {
case SCRIPT_SOUND_PART_MISSION_COMPLETE:
DMAudio.PlayFrontEndSound(SOUND_PART_MISSION_COMPLETE, 0);
return 0;
@@ -712,14 +746,20 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
case SCRIPT_SOUND_IMRAN_ARM_BOMB:
DMAudio.PlayFrontEndSound(SOUND_AMMUNATION_IMRAN_ARM_BOMB, 0);
return 0;
+ case 0x46: // TODO
+ DMAudio.PlayFrontEndSound(0xC4, 0);
+ return 0;
+ case 0x47: // TODO
+ DMAudio.PlayFrontEndSound(0xCD, 0);
+ return 0;
default:
break;
}
- if (!DMAudio.IsAudioInitialised())
+ if (!DMAudio.IsAudioInitialised()) // LCS doesn't have it. Why?
return 0;
cAudioScriptObject* obj = new cAudioScriptObject();
- obj->Posn = *(CVector*)&ScriptParams[0];
- obj->AudioId = ScriptParams[3];
+ obj->Posn = GET_VECTOR_PARAM(0);
+ obj->AudioId = GET_INTEGER_PARAM(3);
obj->AudioEntity = AEHANDLE_NONE;
DMAudio.CreateOneShotScriptObject(obj);
return 0;
@@ -727,23 +767,23 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
case COMMAND_ADD_CONTINUOUS_SOUND:
{
CollectParameters(&m_nIp, 4);
- if (DMAudio.IsAudioInitialised()) {
+ if (DMAudio.IsAudioInitialised()) { // LCS doesn't have it. Why?
cAudioScriptObject* obj = new cAudioScriptObject();
- obj->Posn = *(CVector*)&ScriptParams[0];
- obj->AudioId = ScriptParams[3];
+ obj->Posn = GET_VECTOR_PARAM(0);
+ obj->AudioId = GET_INTEGER_PARAM(3);
obj->AudioEntity = DMAudio.CreateLoopingScriptObject(obj);
- ScriptParams[0] = CPools::GetAudioScriptObjectPool()->GetIndex(obj);
+ SET_INTEGER_PARAM(0, CPools::GetAudioScriptObjectPool()->GetIndex(obj));
}
else
- ScriptParams[0] = -1;
+ SET_INTEGER_PARAM(0, -1);
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_REMOVE_SOUND:
{
CollectParameters(&m_nIp, 1);
- cAudioScriptObject* obj = CPools::GetAudioScriptObjectPool()->GetAt(ScriptParams[0]);
- if (!obj){
+ cAudioScriptObject* obj = CPools::GetAudioScriptObjectPool()->GetAt(GET_INTEGER_PARAM(0));
+ if (!obj) {
debug("REMOVE_SOUND - Sound doesn't exist\n");
return 0;
}
@@ -754,9 +794,9 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
case COMMAND_IS_CAR_STUCK_ON_ROOF:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- UpdateCompareFlag(CTheScripts::UpsideDownCars.HasCarBeenUpsideDownForAWhile(ScriptParams[0]));
+ UpdateCompareFlag(CTheScripts::UpsideDownCars.HasCarBeenUpsideDownForAWhile(GET_INTEGER_PARAM(0)));
return 0;
}
default:
@@ -771,22 +811,22 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_ADD_UPSIDEDOWN_CAR_CHECK:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- CTheScripts::UpsideDownCars.AddCarToCheck(ScriptParams[0]);
+ CTheScripts::UpsideDownCars.AddCarToCheck(GET_INTEGER_PARAM(0));
return 0;
}
case COMMAND_REMOVE_UPSIDEDOWN_CAR_CHECK:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- CTheScripts::UpsideDownCars.RemoveCarFromCheck(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
+ CTheScripts::UpsideDownCars.RemoveCarFromCheck(GET_INTEGER_PARAM(0));
return 0;
}
case COMMAND_SET_CHAR_OBJ_WAIT_ON_FOOT:
{
CollectParameters(&m_nIp, 1);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_WAIT_ON_FOOT);
@@ -795,7 +835,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_SET_CHAR_OBJ_FLEE_ON_FOOT_TILL_SAFE:
{
CollectParameters(&m_nIp, 1);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE);
@@ -804,32 +844,31 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_SET_CHAR_OBJ_GUARD_SPOT:
{
CollectParameters(&m_nIp, 4);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- CVector pos = *(CVector*)&ScriptParams[1];
+ CVector pos = GET_VECTOR_PARAM(1);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_GUARD_SPOT, pos);
return 0;
}
- /*
case COMMAND_SET_CHAR_OBJ_GUARD_AREA:
{
CollectParameters(&m_nIp, 5);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_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];
+ float infX = GET_FLOAT_PARAM(1);
+ float infY = GET_FLOAT_PARAM(2);
+ float supX = GET_FLOAT_PARAM(3);
+ float supY = GET_FLOAT_PARAM(4);
+ if (infX > supX) {
+ infX = GET_FLOAT_PARAM(3);
+ supX = GET_FLOAT_PARAM(1);
}
if (infY > supY) {
- infY = *(float*)&ScriptParams[4];
- supY = *(float*)&ScriptParams[2];
+ infY = GET_FLOAT_PARAM(4);
+ supY = GET_FLOAT_PARAM(2);
}
CVector pos;
pos.x = (infX + supX) / 2;
@@ -843,13 +882,12 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_SET_CHAR_OBJ_WAIT_IN_CAR:
{
CollectParameters(&m_nIp, 1);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_WAIT_IN_CAR);
return 0;
}
- */
case COMMAND_IS_PLAYER_IN_AREA_ON_FOOT_2D:
case COMMAND_IS_PLAYER_IN_AREA_IN_CAR_2D:
case COMMAND_IS_PLAYER_STOPPED_IN_AREA_2D:
@@ -887,17 +925,17 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_GIVE_WEAPON_TO_PLAYER:
{
CollectParameters(&m_nIp, 3);
- CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ CPlayerPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
script_assert(pPed);
- pPed->m_nSelectedWepSlot = pPed->GiveWeapon((eWeaponType)ScriptParams[1], ScriptParams[2]);
+ pPed->m_nSelectedWepSlot = pPed->GiveWeapon((eWeaponType)GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2));
return 0;
}
case COMMAND_GIVE_WEAPON_TO_CHAR:
{
CollectParameters(&m_nIp, 3);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- pPed->SetCurrentWeapon(pPed->GiveWeapon((eWeaponType)ScriptParams[1], ScriptParams[2]));
+ pPed->SetCurrentWeapon(pPed->GiveWeapon((eWeaponType)GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2)));
if (pPed->bInVehicle && pPed->m_pMyVehicle)
pPed->RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(pPed->m_weapons[pPed->m_currentWeapon].m_eWeaponType)->m_nModelId);
return 0;
@@ -906,23 +944,35 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_SET_PLAYER_CONTROL:
{
CollectParameters(&m_nIp, 2);
- CPlayerInfo* pPlayer = &CWorld::Players[ScriptParams[0]];
- if (ScriptParams[1]){
+ CPlayerInfo* pPlayer = &CWorld::Players[GET_INTEGER_PARAM(0)];
+ if (FindPlayerPed()) {
+ if (FindPlayerPed()->GetPedState() != PED_JUMP) {
+ FindPlayerPed()->bIsLanding = false;
+ FindPlayerPed()->bIsInTheAir = false;
+ }
+ FindPlayerPed()->RestoreHeadingRate();
+ }
+ if (GET_INTEGER_PARAM(1)) {
pPlayer->MakePlayerSafe(false);
- if (strcmp(m_abScriptName, "serg1") == 0) // Four Iron
- pPlayer->m_pPed->ClearFollowPath();
- }else{
+ if (FindPlayerPed()->GetStatus() != PED_DRIVING && !FindPlayerPed()->m_attachedTo) {
+ // FindPlayerPed()->SetIdleAndResetAnim(); // TODO!
+ }
+ }
+ else {
pPlayer->MakePlayerSafe(true);
+ if (FindPlayerPed()->GetPedState() > PED_STATES_NO_AI && FindPlayerPed()->GetPedState() != PED_DRIVING && TheCamera.GetScreenFadeStatus() == FADE_2) {
+ // FindPlayerPed()->SetIdleAndResetAnim(); // TODO!
+ }
}
return 0;
}
case COMMAND_FORCE_WEATHER:
CollectParameters(&m_nIp, 1);
- CWeather::ForceWeather(ScriptParams[0]);
+ CWeather::ForceWeather(GET_INTEGER_PARAM(0));
return 0;
case COMMAND_FORCE_WEATHER_NOW:
CollectParameters(&m_nIp, 1);
- CWeather::ForceWeatherNow(ScriptParams[0]);
+ CWeather::ForceWeatherNow(GET_INTEGER_PARAM(0));
return 0;
case COMMAND_RELEASE_WEATHER:
CWeather::ReleaseWeather();
@@ -930,9 +980,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_SET_CURRENT_PLAYER_WEAPON:
{
CollectParameters(&m_nIp, 2);
- CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- for (int i = 0; i < TOTAL_WEAPON_SLOTS; i++){
- if (pPed->m_weapons[i].m_eWeaponType == ScriptParams[1])
+ CPlayerPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
+ for (int i = 0; i < TOTAL_WEAPON_SLOTS; i++) {
+ if (pPed->m_weapons[i].m_eWeaponType == GET_INTEGER_PARAM(1))
pPed->m_nSelectedWepSlot = i;
}
return 0;
@@ -940,9 +990,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_SET_CURRENT_CHAR_WEAPON:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
for (int i = 0; i < TOTAL_WEAPON_SLOTS; i++) {
- if (pPed->m_weapons[i].m_eWeaponType == ScriptParams[1])
+ if (pPed->m_weapons[i].m_eWeaponType == GET_INTEGER_PARAM(1))
pPed->SetCurrentWeapon(i);
}
return 0;
@@ -951,18 +1001,18 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_GET_OBJECT_COORDINATES:
{
CollectParameters(&m_nIp, 1);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pObject);
- *(CVector*)&ScriptParams[0] = pObject->GetPosition();
+ SET_VECTOR_PARAM(0, pObject->GetPosition());
StoreParameters(&m_nIp, 3);
return 0;
}
case COMMAND_SET_OBJECT_COORDINATES:
{
CollectParameters(&m_nIp, 4);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pObject);
- CVector pos = *(CVector*)&ScriptParams[1];
+ CVector pos = GET_VECTOR_PARAM(1);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pObject->Teleport(pos);
@@ -970,13 +1020,13 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
return 0;
}
case COMMAND_GET_GAME_TIMER:
- ScriptParams[0] = CTimer::GetTimeInMilliseconds();
+ SET_INTEGER_PARAM(0, CTimer::GetTimeInMilliseconds());
StoreParameters(&m_nIp, 1);
return 0;
case COMMAND_TURN_CHAR_TO_FACE_COORD:
{
CollectParameters(&m_nIp, 4);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
CVehicle* pVehicle;
CVector pos;
@@ -988,11 +1038,11 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
pos = pVehicle->GetPosition();
else
pos = pPed->GetPosition();
- float heading = CGeneral::GetATanOfXY(pos.x - *(float*)&ScriptParams[1], pos.y - *(float*)&ScriptParams[2]);
+ float heading = CGeneral::GetATanOfXY(pos.x - GET_FLOAT_PARAM(1), pos.y - GET_FLOAT_PARAM(2));
heading += HALFPI;
if (heading > TWOPI)
heading -= TWOPI;
- if (!pVehicle){
+ if (!pVehicle) {
pPed->m_fRotationCur = heading;
pPed->m_fRotationDest = heading;
pPed->SetHeading(heading);
@@ -1002,7 +1052,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_TURN_PLAYER_TO_FACE_COORD:
{
CollectParameters(&m_nIp, 4);
- CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
script_assert(pPed);
CVehicle* pVehicle;
CVector pos;
@@ -1014,7 +1064,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
pos = pVehicle->GetPosition();
else
pos = pPed->GetPosition();
- float heading = CGeneral::GetATanOfXY(pos.x - *(float*)&ScriptParams[1], pos.y - *(float*)&ScriptParams[2]);
+ float heading = CGeneral::GetATanOfXY(pos.x - GET_FLOAT_PARAM(1), pos.y - GET_FLOAT_PARAM(2));
heading += HALFPI;
if (heading > TWOPI)
heading -= TWOPI;
@@ -1028,16 +1078,16 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_STORE_WANTED_LEVEL:
{
CollectParameters(&m_nIp, 1);
- CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ CPlayerPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
script_assert(pPed);
- ScriptParams[0] = pPed->m_pWanted->m_nWantedLevel;
+ SET_INTEGER_PARAM(0, pPed->m_pWanted->m_nWantedLevel);
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_IS_CAR_STOPPED:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
UpdateCompareFlag(CTheScripts::IsVehicleStopped(pVehicle));
return 0;
@@ -1045,94 +1095,94 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_MARK_CHAR_AS_NO_LONGER_NEEDED:
{
CollectParameters(&m_nIp, 1);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
CTheScripts::CleanUpThisPed(pPed);
if (m_bIsMissionScript)
- CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
+ CTheScripts::MissionCleanUp.RemoveEntityFromList(GET_INTEGER_PARAM(0), CLEANUP_CHAR);
return 0;
}
case COMMAND_MARK_CAR_AS_NO_LONGER_NEEDED:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
CTheScripts::CleanUpThisVehicle(pVehicle);
if (m_bIsMissionScript)
- CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
+ CTheScripts::MissionCleanUp.RemoveEntityFromList(GET_INTEGER_PARAM(0), CLEANUP_CAR);
return 0;
}
case COMMAND_MARK_OBJECT_AS_NO_LONGER_NEEDED:
{
CollectParameters(&m_nIp, 1);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0));
CTheScripts::CleanUpThisObject(pObject);
if (m_bIsMissionScript)
- CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT);
+ CTheScripts::MissionCleanUp.RemoveEntityFromList(GET_INTEGER_PARAM(0), CLEANUP_OBJECT);
return 0;
}
case COMMAND_DONT_REMOVE_CHAR:
{
CollectParameters(&m_nIp, 1);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
+ CTheScripts::MissionCleanUp.RemoveEntityFromList(GET_INTEGER_PARAM(0), CLEANUP_CHAR);
return 0;
}
case COMMAND_DONT_REMOVE_CAR:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
+ CTheScripts::MissionCleanUp.RemoveEntityFromList(GET_INTEGER_PARAM(0), CLEANUP_CAR);
return 0;
}
case COMMAND_DONT_REMOVE_OBJECT:
{
CollectParameters(&m_nIp, 1);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pObject);
- CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT);
+ CTheScripts::MissionCleanUp.RemoveEntityFromList(GET_INTEGER_PARAM(0), CLEANUP_OBJECT);
return 0;
}
case COMMAND_CREATE_CHAR_AS_PASSENGER:
{
CollectParameters(&m_nIp, 4);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- switch (ScriptParams[2]) {
+ switch (GET_INTEGER_PARAM(2)) {
case MI_COP:
- if (ScriptParams[1] == PEDTYPE_COP)
- ScriptParams[2] = COP_STREET;
+ if (GET_INTEGER_PARAM(1) == PEDTYPE_COP)
+ SET_INTEGER_PARAM(2, COP_STREET);
break;
case MI_SWAT:
- if (ScriptParams[1] == PEDTYPE_COP)
- ScriptParams[2] = COP_SWAT;
+ if (GET_INTEGER_PARAM(1) == PEDTYPE_COP)
+ SET_INTEGER_PARAM(2, COP_SWAT);
break;
case MI_FBI:
- if (ScriptParams[1] == PEDTYPE_COP)
- ScriptParams[2] = COP_FBI;
+ if (GET_INTEGER_PARAM(1) == PEDTYPE_COP)
+ SET_INTEGER_PARAM(2, COP_FBI);
break;
case MI_ARMY:
- if (ScriptParams[1] == PEDTYPE_COP)
- ScriptParams[2] = COP_ARMY;
+ if (GET_INTEGER_PARAM(1) == PEDTYPE_COP)
+ SET_INTEGER_PARAM(2, COP_ARMY);
break;
case MI_MEDIC:
- if (ScriptParams[1] == PEDTYPE_EMERGENCY)
- ScriptParams[2] = PEDTYPE_EMERGENCY;
+ if (GET_INTEGER_PARAM(1) == PEDTYPE_EMERGENCY)
+ SET_INTEGER_PARAM(2, PEDTYPE_EMERGENCY);
break;
case MI_FIREMAN:
- if (ScriptParams[1] == PEDTYPE_FIREMAN)
- ScriptParams[2] = PEDTYPE_FIREMAN;
+ if (GET_INTEGER_PARAM(1) == PEDTYPE_FIREMAN)
+ SET_INTEGER_PARAM(2, PEDTYPE_FIREMAN);
break;
default:
break;
}
CPed* pPed;
- if (ScriptParams[1] == PEDTYPE_COP)
- pPed = new CCopPed((eCopType)ScriptParams[2]);
- else if (ScriptParams[1] == PEDTYPE_EMERGENCY || ScriptParams[1] == PEDTYPE_FIREMAN)
- pPed = new CEmergencyPed(ScriptParams[2]);
+ if (GET_INTEGER_PARAM(1) == PEDTYPE_COP)
+ pPed = new CCopPed((eCopType)GET_INTEGER_PARAM(2));
+ else if (GET_INTEGER_PARAM(1) == PEDTYPE_EMERGENCY || GET_INTEGER_PARAM(1) == PEDTYPE_FIREMAN)
+ pPed = new CEmergencyPed(GET_INTEGER_PARAM(2));
else
- pPed = new CCivilianPed((ePedType)ScriptParams[1], ScriptParams[2]);
+ pPed = new CCivilianPed((ePedType)GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2));
pPed->CharCreatedBy = MISSION_CHAR;
pPed->bRespondsToThreats = false;
pPed->bAllowMedicsToReviveMe = false;
@@ -1143,8 +1193,8 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
pPed->SetOrientation(0.0f, 0.0f, 0.0f);
CPopulation::ms_nTotalMissionPeds++;
CWorld::Add(pPed);
- if (ScriptParams[3] >= 0)
- pVehicle->AddPassenger(pPed, ScriptParams[3]);
+ if (GET_INTEGER_PARAM(3) >= 0)
+ pVehicle->AddPassenger(pPed, GET_INTEGER_PARAM(3));
else
pVehicle->AddPassenger(pPed);
pPed->m_pMyVehicle = pVehicle;
@@ -1154,18 +1204,18 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
pPed->bUsesCollision = false;
pPed->AddInCarAnims(pVehicle, false);
pPed->m_nZoneLevel = CTheZones::GetLevelFromPosition(&pPed->GetPosition());
- ScriptParams[0] = CPools::GetPedPool()->GetIndex(pPed);
+ SET_INTEGER_PARAM(0, CPools::GetPedPool()->GetIndex(pPed));
StoreParameters(&m_nIp, 1);
if (m_bIsMissionScript)
- CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
+ CTheScripts::MissionCleanUp.AddEntityToList(GET_INTEGER_PARAM(0), CLEANUP_CHAR);
return 0;
}
case COMMAND_SET_CHAR_OBJ_KILL_CHAR_ON_FOOT:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ CPed* pTarget = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1));
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, pTarget);
return 0;
@@ -1173,9 +1223,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_SET_CHAR_OBJ_KILL_PLAYER_ON_FOOT:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed;
+ CPed* pTarget = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed;
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, pTarget);
return 0;
@@ -1183,9 +1233,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_SET_CHAR_OBJ_KILL_CHAR_ANY_MEANS:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ CPed* pTarget = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1));
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_KILL_CHAR_ANY_MEANS, pTarget);
return 0;
@@ -1193,9 +1243,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_SET_CHAR_OBJ_KILL_PLAYER_ANY_MEANS:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed;
+ CPed* pTarget = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed;
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_KILL_CHAR_ANY_MEANS, pTarget);
return 0;
@@ -1204,9 +1254,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_SET_CHAR_OBJ_FLEE_CHAR_ON_FOOT_TILL_SAFE:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ CPed* pTarget = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1));
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pTarget);
return 0;
@@ -1215,9 +1265,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_SET_CHAR_OBJ_FLEE_PLAYER_ON_FOOT_TILL_SAFE:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed;
+ CPed* pTarget = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed;
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pTarget);
return 0;
@@ -1225,9 +1275,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_SET_CHAR_OBJ_FLEE_CHAR_ON_FOOT_ALWAYS:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ CPed* pTarget = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1));
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pTarget);
return 0;
@@ -1235,9 +1285,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_SET_CHAR_OBJ_FLEE_PLAYER_ON_FOOT_ALWAYS:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed;
+ CPed* pTarget = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed;
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pTarget);
return 0;
@@ -1245,9 +1295,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_SET_CHAR_OBJ_GOTO_CHAR_ON_FOOT:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ CPed* pTarget = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1));
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_GOTO_CHAR_ON_FOOT, pTarget);
return 0;
@@ -1255,9 +1305,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_SET_CHAR_OBJ_GOTO_PLAYER_ON_FOOT:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed;
+ CPed* pTarget = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed;
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_GOTO_CHAR_ON_FOOT, pTarget);
return 0;
@@ -1265,9 +1315,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_SET_CHAR_OBJ_LEAVE_CAR:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1));
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_LEAVE_CAR, pVehicle);
return 0;
@@ -1275,9 +1325,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_SET_CHAR_OBJ_ENTER_CAR_AS_PASSENGER:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1));
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, pVehicle);
return 0;
@@ -1285,9 +1335,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_SET_CHAR_OBJ_ENTER_CAR_AS_DRIVER:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1));
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicle);
return 0;
@@ -1297,9 +1347,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_SET_CHAR_OBJ_DESTROY_OBJECT:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1));
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_DESTROY_OBJECT, pVehicle);
return 0;
@@ -1307,30 +1357,29 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_SET_CHAR_OBJ_DESTROY_CAR:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1));
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_DESTROY_CAR, pVehicle);
return 0;
}
- /*
case COMMAND_SET_CHAR_OBJ_GOTO_AREA_ON_FOOT:
{
CollectParameters(&m_nIp, 5);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- float infX = *(float*)&ScriptParams[1];
- float infY = *(float*)&ScriptParams[2];
- float supX = *(float*)&ScriptParams[3];
- float supY = *(float*)&ScriptParams[4];
+ float infX = GET_FLOAT_PARAM(1);
+ float infY = GET_FLOAT_PARAM(2);
+ float supX = GET_FLOAT_PARAM(3);
+ float supY = GET_FLOAT_PARAM(4);
if (infX > supX) {
- infX = *(float*)&ScriptParams[3];
- supX = *(float*)&ScriptParams[1];
+ infX = GET_FLOAT_PARAM(3);
+ supX = GET_FLOAT_PARAM(1);
}
if (infY > supY) {
- infY = *(float*)&ScriptParams[4];
- supY = *(float*)&ScriptParams[2];
+ infY = GET_FLOAT_PARAM(4);
+ supY = GET_FLOAT_PARAM(2);
}
CVector pos;
pos.x = (infX + supX) / 2;
@@ -1341,32 +1390,31 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
pPed->SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, pos, radius);
return 0;
}
- */
//case COMMAND_SET_CHAR_OBJ_GOTO_AREA_IN_CAR:
//case COMMAND_SET_CHAR_OBJ_FOLLOW_CAR_ON_FOOT_WITH_OFFSET:
//case COMMAND_SET_CHAR_OBJ_GUARD_ATTACK:
case COMMAND_SET_CHAR_AS_LEADER:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ CPed* pTarget = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1));
pPed->SetObjective(OBJECTIVE_SET_LEADER, pTarget);
return 0;
}
case COMMAND_SET_PLAYER_AS_LEADER:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed;
+ CPed* pTarget = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed;
pPed->SetObjective(OBJECTIVE_SET_LEADER, pTarget);
return 0;
}
case COMMAND_LEAVE_GROUP:
{
CollectParameters(&m_nIp, 1);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
pPed->ClearLeader();
return 0;
@@ -1374,60 +1422,66 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_SET_CHAR_OBJ_FOLLOW_ROUTE:
{
CollectParameters(&m_nIp, 3);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
pPed->bScriptObjectiveCompleted = false;
- pPed->SetObjective(OBJECTIVE_FOLLOW_ROUTE, ScriptParams[1], ScriptParams[2]);
+ pPed->SetObjective(OBJECTIVE_FOLLOW_ROUTE, GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2));
return 0;
}
case COMMAND_ADD_ROUTE_POINT:
{
CollectParameters(&m_nIp, 4);
- CRouteNode::AddRoutePoint(ScriptParams[0], *(CVector*)&ScriptParams[1]);
+ CRouteNode::AddRoutePoint(GET_INTEGER_PARAM(0), GET_VECTOR_PARAM(1));
return 0;
}
case COMMAND_PRINT_WITH_NUMBER_BIG:
{
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 3);
- CMessages::AddBigMessageWithNumber(text, ScriptParams[1], ScriptParams[2] - 1, ScriptParams[0], -1, -1, -1, -1, -1);
+ CMessages::AddBigMessageWithNumber(text, GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2) - 1, GET_INTEGER_PARAM(0), -1, -1, -1, -1, -1);
return 0;
}
case COMMAND_PRINT_WITH_NUMBER:
{
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 3);
- CMessages::AddMessageWithNumber(text, ScriptParams[1], ScriptParams[2], ScriptParams[0], -1, -1, -1, -1, -1);
+ CMessages::AddMessageWithNumber(text, GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(0), -1, -1, -1, -1, -1);
return 0;
}
case COMMAND_PRINT_WITH_NUMBER_NOW:
{
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 3);
- CMessages::AddMessageJumpQWithNumber(text, ScriptParams[1], ScriptParams[2], ScriptParams[0], -1, -1, -1, -1, -1);
+ CMessages::AddMessageJumpQWithNumber(text, GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(0), -1, -1, -1, -1, -1);
+ return 0;
+ }
+ case COMMAND_PRINT_WITH_NUMBER_SOON:
+ {
+ wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
+ CollectParameters(&m_nIp, 3);
+ CMessages::AddMessageSoonWithNumber(text, GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(0), -1, -1, -1, -1, -1);
return 0;
}
- //case COMMAND_PRINT_WITH_NUMBER_SOON:
case COMMAND_SWITCH_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];
+ float infX = GET_FLOAT_PARAM(0);
+ float infY = GET_FLOAT_PARAM(1);
+ float infZ = GET_FLOAT_PARAM(2);
+ float supX = GET_FLOAT_PARAM(3);
+ float supY = GET_FLOAT_PARAM(4);
+ float supZ = GET_FLOAT_PARAM(5);
+ if (infX > supX) {
+ infX = GET_FLOAT_PARAM(3);
+ supX = GET_FLOAT_PARAM(0);
}
- if (infY > supY){
- infY = *(float*)&ScriptParams[4];
- supY = *(float*)&ScriptParams[1];
+ if (infY > supY) {
+ infY = GET_FLOAT_PARAM(4);
+ supY = GET_FLOAT_PARAM(1);
}
- if (infZ > supZ){
- infZ = *(float*)&ScriptParams[5];
- supZ = *(float*)&ScriptParams[2];
+ if (infZ > supZ) {
+ infZ = GET_FLOAT_PARAM(5);
+ supZ = GET_FLOAT_PARAM(2);
}
ThePaths.SwitchRoadsOffInArea(infX, supX, infY, supY, infZ, supZ, false);
return 0;
@@ -1435,23 +1489,23 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_SWITCH_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];
+ float infX = GET_FLOAT_PARAM(0);
+ float infY = GET_FLOAT_PARAM(1);
+ float infZ = GET_FLOAT_PARAM(2);
+ float supX = GET_FLOAT_PARAM(3);
+ float supY = GET_FLOAT_PARAM(4);
+ float supZ = GET_FLOAT_PARAM(5);
if (infX > supX) {
- infX = *(float*)&ScriptParams[3];
- supX = *(float*)&ScriptParams[0];
+ infX = GET_FLOAT_PARAM(3);
+ supX = GET_FLOAT_PARAM(0);
}
if (infY > supY) {
- infY = *(float*)&ScriptParams[4];
- supY = *(float*)&ScriptParams[1];
+ infY = GET_FLOAT_PARAM(4);
+ supY = GET_FLOAT_PARAM(1);
}
if (infZ > supZ) {
- infZ = *(float*)&ScriptParams[5];
- supZ = *(float*)&ScriptParams[2];
+ infZ = GET_FLOAT_PARAM(5);
+ supZ = GET_FLOAT_PARAM(2);
}
ThePaths.SwitchRoadsOffInArea(infX, supX, infY, supY, infZ, supZ, true);
return 0;
@@ -1459,85 +1513,83 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_GET_NUMBER_OF_PASSENGERS:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- ScriptParams[0] = pVehicle->m_nNumPassengers;
+ SET_INTEGER_PARAM(0, pVehicle->m_nNumPassengers);
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_GET_MAXIMUM_NUMBER_OF_PASSENGERS:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- ScriptParams[0] = pVehicle->m_nNumMaxPassengers;
+ SET_INTEGER_PARAM(0, pVehicle->m_nNumMaxPassengers);
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_SET_CAR_DENSITY_MULTIPLIER:
{
CollectParameters(&m_nIp, 1);
- CCarCtrl::CarDensityMultiplier = *(float*)&ScriptParams[0];
+ CCarCtrl::CarDensityMultiplier = GET_FLOAT_PARAM(0);
return 0;
}
case COMMAND_SET_CAR_HEAVY:
{
CollectParameters(&m_nIp, 2);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- if (ScriptParams[1] != 0) {
+ if (GET_INTEGER_PARAM(1) != 0) {
pVehicle->bIsHeavy = true;
- pVehicle->m_fMass = 3.0f * pVehicle->pHandling->fMass;
- pVehicle->m_fTurnMass = 5.0f * pVehicle->pHandling->fTurnMass;
+ pVehicle->m_fMass = 3.0f * pVehicle->pHandling->fMass; // TODO: tHandlingData::GetMass()
+ pVehicle->m_fTurnMass = 5.0f * pVehicle->pHandling->fTurnMass; // TODO: tHandlingData::GetTurnMass()
}
else {
pVehicle->bIsHeavy = false;
- pVehicle->m_fMass = pVehicle->pHandling->fMass;
- pVehicle->m_fTurnMass = pVehicle->pHandling->fTurnMass;
+ pVehicle->m_fMass = pVehicle->pHandling->fMass; // TODO: tHandlingData::GetMass()
+ pVehicle->m_fTurnMass = pVehicle->pHandling->fTurnMass; // TODO: tHandlingData::GetTurnMass()
}
return 0;
}
case COMMAND_CLEAR_CHAR_THREAT_SEARCH:
{
CollectParameters(&m_nIp, 1);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
pPed->m_fearFlags = 0;
return 0;
}
- /*
case COMMAND_ACTIVATE_CRANE:
{
CollectParameters(&m_nIp, 10);
- float infX = *(float*)&ScriptParams[2];
- float infY = *(float*)&ScriptParams[3];
- float supX = *(float*)&ScriptParams[4];
- float supY = *(float*)&ScriptParams[5];
+ float infX = GET_FLOAT_PARAM(2);
+ float infY = GET_FLOAT_PARAM(3);
+ float supX = GET_FLOAT_PARAM(4);
+ float supY = GET_FLOAT_PARAM(5);
if (infX > supX) {
- infX = *(float*)&ScriptParams[4];
- supX = *(float*)&ScriptParams[2];
+ infX = GET_FLOAT_PARAM(4);
+ supX = GET_FLOAT_PARAM(2);
}
if (infY > supY) {
- infY = *(float*)&ScriptParams[5];
- supY = *(float*)&ScriptParams[3];
+ infY = GET_FLOAT_PARAM(5);
+ supY = GET_FLOAT_PARAM(3);
}
CCranes::ActivateCrane(infX, supX, infY, supY,
- *(float*)&ScriptParams[6], *(float*)&ScriptParams[7], *(float*)&ScriptParams[8],
- DEGTORAD(*(float*)&ScriptParams[9]), false, false,
- *(float*)&ScriptParams[0], *(float*)&ScriptParams[1]);
+ GET_FLOAT_PARAM(6), GET_FLOAT_PARAM(7), GET_FLOAT_PARAM(8),
+ DEGTORAD(GET_FLOAT_PARAM(9)), false, false,
+ GET_FLOAT_PARAM(0), GET_FLOAT_PARAM(1));
return 0;
}
case COMMAND_DEACTIVATE_CRANE:
{
CollectParameters(&m_nIp, 2);
- CCranes::DeActivateCrane(*(float*)&ScriptParams[0], *(float*)&ScriptParams[1]);
+ CCranes::DeActivateCrane(GET_FLOAT_PARAM(0), GET_FLOAT_PARAM(1));
return 0;
}
- */
case COMMAND_SET_MAX_WANTED_LEVEL:
{
CollectParameters(&m_nIp, 1);
- CWanted::SetMaximumWantedLevel(ScriptParams[0]);
+ CWanted::SetMaximumWantedLevel(GET_INTEGER_PARAM(0));
return 0;
}
//case COMMAND_SAVE_VAR_INT:
@@ -1545,7 +1597,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
case COMMAND_IS_CAR_IN_AIR_PROPER:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
UpdateCompareFlag(pVehicle->m_nCollisionRecords == 0);
return 0;
diff --git a/src/control/Script3.cpp b/src/control/Script3.cpp
index 7476d8de..88df935f 100644
--- a/src/control/Script3.cpp
+++ b/src/control/Script3.cpp
@@ -6,6 +6,7 @@
#include "Boat.h"
#include "CarCtrl.h"
#include "Clock.h"
+#include "ColStore.h"
#include "Coronas.h"
#include "Cranes.h"
#include "CutsceneMgr.h"
@@ -41,17 +42,17 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
case COMMAND_IS_CAR_UPSIDEDOWN:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- UpdateCompareFlag(pVehicle->GetUp().z <= -0.97f);
+ UpdateCompareFlag(pVehicle->GetUp().z <= UPSIDEDOWN_UP_THRESHOLD);
return 0;
}
case COMMAND_GET_PLAYER_CHAR:
{
CollectParameters(&m_nIp, 1);
- CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ CPlayerPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
script_assert(pPed);
- ScriptParams[0] = CPools::GetPedPool()->GetIndex(pPed);
+ SET_INTEGER_PARAM(0, CPools::GetPedPool()->GetIndex(pPed));
StoreParameters(&m_nIp, 1);
return 0;
}
@@ -61,9 +62,9 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
case COMMAND_SET_POLICE_IGNORE_PLAYER:
{
CollectParameters(&m_nIp, 2);
- CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ CPlayerPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
script_assert(pPed);
- if (ScriptParams[1]) {
+ if (GET_INTEGER_PARAM(1)) {
pPed->m_pWanted->m_bIgnoredByCops = true;
CWorld::StopAllLawEnforcersInTheirTracks();
}
@@ -77,8 +78,8 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
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]);
+ CUserDisplay::Pager.AddMessageWithNumber(text, GET_INTEGER_PARAM(0), -1, -1, -1, -1, -1,
+ GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3));
return 0;
}
*/
@@ -86,21 +87,21 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
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);
+ CDarkel::StartFrenzy((eWeaponType)GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2),
+ GET_INTEGER_PARAM(3), text, GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(5),
+ GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(7) != 0, false);
return 0;
}
case COMMAND_READ_KILL_FRENZY_STATUS:
{
- ScriptParams[0] = CDarkel::ReadStatus();
+ SET_INTEGER_PARAM(0, CDarkel::ReadStatus());
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_SQRT:
{
CollectParameters(&m_nIp, 1);
- *(float*)&ScriptParams[0] = Sqrt(*(float*)&ScriptParams[0]);
+ SET_FLOAT_PARAM(0, Sqrt(GET_FLOAT_PARAM(0)));
StoreParameters(&m_nIp, 1);
return 0;
}
@@ -122,39 +123,40 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
return 0;
case COMMAND_GENERATE_RANDOM_FLOAT_IN_RANGE:
CollectParameters(&m_nIp, 2);
- *(float*)&ScriptParams[0] = CGeneral::GetRandomNumberInRange(*(float*)&ScriptParams[0], *(float*)&ScriptParams[1]);
+ SET_FLOAT_PARAM(0, CGeneral::GetRandomNumberInRange(GET_FLOAT_PARAM(0), GET_FLOAT_PARAM(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]);
+ SET_INTEGER_PARAM(0, CGeneral::GetRandomNumberInRange(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)));
StoreParameters(&m_nIp, 1);
return 0;
case COMMAND_LOCK_CAR_DOORS:
{
CollectParameters(&m_nIp, 2);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- pVehicle->m_nDoorLock = (eCarLock)ScriptParams[1];
+ pVehicle->m_nDoorLock = (eCarLock)GET_INTEGER_PARAM(1);
return 0;
}
case COMMAND_EXPLODE_CAR:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
+ pVehicle->bCanBeDamaged = true;
pVehicle->BlowUpCar(nil);
return 0;
}
case COMMAND_ADD_EXPLOSION:
CollectParameters(&m_nIp, 4);
- CExplosion::AddExplosion(nil, nil, (eExplosionType)ScriptParams[3], *(CVector*)&ScriptParams[0], 0, true);
+ CExplosion::AddExplosion(nil, nil, (eExplosionType)GET_INTEGER_PARAM(3), GET_VECTOR_PARAM(0), 0, true); // last argument is 0 (default? - TODO)
return 0;
case COMMAND_IS_CAR_UPRIGHT:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
UpdateCompareFlag(pVehicle->GetUp().z >= 0.0f);
return 0;
@@ -162,8 +164,8 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
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]);
+ CPed* pSourcePed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
+ CPed* pTargetPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(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();
@@ -180,8 +182,8 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
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;
+ CPed* pSourcePed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
+ CPed* pTargetPed = CWorld::Players[GET_INTEGER_PARAM(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();
@@ -198,8 +200,8 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
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]);
+ CPed* pSourcePed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
+ CPed* pTargetPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(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();
@@ -216,11 +218,11 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
case COMMAND_SET_CHAR_OBJ_GOTO_COORD_ON_FOOT:
{
CollectParameters(&m_nIp, 3);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
CVector target;
- target.x = *(float*)&ScriptParams[1];
- target.y = *(float*)&ScriptParams[2];
+ target.x = GET_FLOAT_PARAM(1);
+ target.y = GET_FLOAT_PARAM(2);
target.z = CWorld::FindGroundZForCoord(target.x, target.y);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, target);
@@ -230,63 +232,61 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
case COMMAND_CREATE_PICKUP:
{
CollectParameters(&m_nIp, 5);
- int16 model = ScriptParams[0];
+ int16 model = GET_INTEGER_PARAM(0);
if (model < 0)
model = CTheScripts::UsedObjectArray[-model].index;
- CVector pos = *(CVector*)&ScriptParams[2];
+ CVector pos = GET_VECTOR_PARAM(2);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + PICKUP_PLACEMENT_OFFSET;
CPickups::GetActualPickupIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
- ScriptParams[0] = CPickups::GenerateNewOne(pos, model, ScriptParams[1], 0);
+ SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, model, GET_INTEGER_PARAM(1), 0));
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_HAS_PICKUP_BEEN_COLLECTED:
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(CPickups::IsPickUpPickedUp(ScriptParams[0]) != 0);
+ UpdateCompareFlag(CPickups::IsPickUpPickedUp(GET_INTEGER_PARAM(0)) != 0);
return 0;
case COMMAND_REMOVE_PICKUP:
CollectParameters(&m_nIp, 1);
- CPickups::RemovePickUp(ScriptParams[0]);
+ CPickups::RemovePickUp(GET_INTEGER_PARAM(0));
return 0;
case COMMAND_SET_TAXI_LIGHTS:
{
CollectParameters(&m_nIp, 2);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
- ((CAutomobile*)pVehicle)->SetTaxiLight(ScriptParams[1] != 0);
+ ((CAutomobile*)pVehicle)->SetTaxiLight(GET_INTEGER_PARAM(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);
+ CMessages::AddBigMessageQ(text, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(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);
+ CMessages::AddBigMessageWithNumberQ(text, GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2) - 1,
+ GET_INTEGER_PARAM(0), -1, -1, -1, -1, -1);
return 0;
}
- */
case COMMAND_SET_GARAGE:
{
CollectParameters(&m_nIp, 9);
- float infX = *(float*)&ScriptParams[0];
- float infY = *(float*)&ScriptParams[1];
- float infZ = *(float*)&ScriptParams[2];
- float X2 = *(float*)&ScriptParams[3];
- float Y2 = *(float*)&ScriptParams[4];
- float supX = *(float*)&ScriptParams[5];
- float supY = *(float*)&ScriptParams[6];
- float supZ = *(float*)&ScriptParams[7];
- ScriptParams[0] = CGarages::AddOne(infX, infY, infZ, X2, Y2, supX, supY, supZ, ScriptParams[8], 0);
+ float infX = GET_FLOAT_PARAM(0);
+ float infY = GET_FLOAT_PARAM(1);
+ float infZ = GET_FLOAT_PARAM(2);
+ float X2 = GET_FLOAT_PARAM(3);
+ float Y2 = GET_FLOAT_PARAM(4);
+ float supX = GET_FLOAT_PARAM(5);
+ float supY = GET_FLOAT_PARAM(6);
+ float supZ = GET_FLOAT_PARAM(7);
+ SET_INTEGER_PARAM(0, CGarages::AddOne(infX, infY, infZ, X2, Y2, supX, supY, supZ, GET_INTEGER_PARAM(8), 0));
StoreParameters(&m_nIp, 1);
return 0;
}
@@ -294,15 +294,15 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
case COMMAND_SET_GARAGE_WITH_CAR_MODEL:
{
CollectParameters(&m_nIp, 10);
- float infX = *(float*)&ScriptParams[0];
- float infY = *(float*)&ScriptParams[1];
- float infZ = *(float*)&ScriptParams[2];
- float X2 = *(float*)&ScriptParams[3];
- float Y2 = *(float*)&ScriptParams[4];
- float supX = *(float*)&ScriptParams[5];
- float supY = *(float*)&ScriptParams[6];
- float supZ = *(float*)&ScriptParams[7];
- ScriptParams[0] = CGarages::AddOne(infX, infY, infZ, X2, Y2, supX, supY, supZ, ScriptParams[8], ScriptParams[9]);
+ float infX = GET_FLOAT_PARAM(0);
+ float infY = GET_FLOAT_PARAM(1);
+ float infZ = GET_FLOAT_PARAM(2);
+ float X2 = GET_FLOAT_PARAM(3);
+ float Y2 = GET_FLOAT_PARAM(4);
+ float supX = GET_FLOAT_PARAM(5);
+ float supY = GET_FLOAT_PARAM(6);
+ float supZ = GET_FLOAT_PARAM(7);
+ SET_INTEGER_PARAM(0, CGarages::AddOne(infX, infY, infZ, X2, Y2, supX, supY, supZ, GET_INTEGER_PARAM(8), GET_INTEGER_PARAM(9)));
StoreParameters(&m_nIp, 1);
return 0;
}
@@ -311,34 +311,34 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pTarget;
- if (ScriptParams[1] >= 0) {
- pTarget = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
+ if (GET_INTEGER_PARAM(1) >= 0) {
+ pTarget = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1));
script_assert(pTarget);
}
else {
pTarget = nil;
}
- CGarages::SetTargetCarForMissonGarage(ScriptParams[0], pTarget);
+ CGarages::SetTargetCarForMissonGarage(GET_INTEGER_PARAM(0), pTarget);
return 0;
}
case COMMAND_IS_CAR_IN_MISSION_GARAGE:
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(CGarages::HasCarBeenDroppedOffYet(ScriptParams[0]));
+ UpdateCompareFlag(CGarages::HasCarBeenDroppedOffYet(GET_INTEGER_PARAM(0)));
return 0;
-/*
case COMMAND_SET_FREE_BOMBS:
CollectParameters(&m_nIp, 1);
- CGarages::SetFreeBombs(ScriptParams[0] != 0);
+ CGarages::SetFreeBombs(GET_INTEGER_PARAM(0) != 0);
return 0;
+ /*
case COMMAND_SET_POWERPOINT:
{
CollectParameters(&m_nIp, 7);
- float f1 = *(float*)&ScriptParams[0];
- float f2 = *(float*)&ScriptParams[1];
- float f3 = *(float*)&ScriptParams[2];
- float f4 = *(float*)&ScriptParams[3];
- float f5 = *(float*)&ScriptParams[4];
- float f6 = *(float*)&ScriptParams[5];
+ float f1 = GET_FLOAT_PARAM(0);
+ float f2 = GET_FLOAT_PARAM(1);
+ float f3 = GET_FLOAT_PARAM(2);
+ float f4 = GET_FLOAT_PARAM(3);
+ float f5 = GET_FLOAT_PARAM(4);
+ float f6 = GET_FLOAT_PARAM(5);
float temp;
if (f1 > f4) {
@@ -359,43 +359,43 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
f6 = temp;
}
- CPowerPoints::GenerateNewOne(f1, f2, f3, f4, f5, f6, *(uint8*)&ScriptParams[6]);
+ CPowerPoints::GenerateNewOne(f1, f2, f3, f4, f5, f6, *(uint8*)&GET_INTEGER_PARAM(6));
return 0;
}
case COMMAND_SET_ALL_TAXI_LIGHTS:
CollectParameters(&m_nIp, 1);
- CAutomobile::SetAllTaxiLights(ScriptParams[0] != 0);
+ CAutomobile::SetAllTaxiLights(GET_INTEGER_PARAM(0) != 0);
return 0;
+ */
case COMMAND_IS_CAR_ARMED_WITH_ANY_BOMB:
{
CollectParameters(&m_nIp, 1);
- CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pCar);
script_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);
+ CPad::GetPad(GET_INTEGER_PARAM(0))->bApplyBrakes = (GET_INTEGER_PARAM(1) != 0);
return 0;
case COMMAND_SET_PLAYER_HEALTH:
{
CollectParameters(&m_nIp, 2);
- CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ CPlayerPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
script_assert(pPed);
- pPed->m_fHealth = Min(ScriptParams[1], CWorld::Players[ScriptParams[0]].m_nMaxHealth);
+ pPed->m_fHealth = Min(GET_INTEGER_PARAM(1), CWorld::Players[GET_INTEGER_PARAM(0)].m_nMaxHealth);
return 0;
}
case COMMAND_SET_CHAR_HEALTH:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- if (ScriptParams[1]) {
- pPed->m_fHealth = ScriptParams[1];
+ if (GET_INTEGER_PARAM(1)) {
+ pPed->m_fHealth = GET_INTEGER_PARAM(1);
}
else if (pPed->bInVehicle) {
pPed->SetDead();
@@ -403,86 +403,84 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
pPed->FlagToDestroyWhenNextProcessed();
}
else {
- pPed->SetDie();
+ pPed->SetDie(); // last argument = 13 (default? TODO)
}
return 0;
}
case COMMAND_SET_CAR_HEALTH:
{
CollectParameters(&m_nIp, 2);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- pVehicle->m_fHealth = ScriptParams[1];
+ pVehicle->m_fHealth = GET_INTEGER_PARAM(1);
return 0;
}
case COMMAND_GET_PLAYER_HEALTH:
{
CollectParameters(&m_nIp, 1);
- CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
script_assert(pPed);
- ScriptParams[0] = pPed->m_fHealth;
+ SET_INTEGER_PARAM(0, pPed->m_fHealth);
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_GET_CHAR_HEALTH:
{
CollectParameters(&m_nIp, 1);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- ScriptParams[0] = pPed->m_fHealth;
+ SET_INTEGER_PARAM(0, pPed->m_fHealth);
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_GET_CAR_HEALTH:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- ScriptParams[0] = pVehicle->m_fHealth;
+ SET_INTEGER_PARAM(0, pVehicle->m_fHealth);
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]);
+ CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pCar);
script_assert(pCar->m_vehType == VEHICLE_TYPE_CAR);
- UpdateCompareFlag(pCar->m_bombType == ScriptParams[1]);
+ UpdateCompareFlag(pCar->m_bombType == GET_INTEGER_PARAM(1));
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)
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
+ if (GET_INTEGER_PARAM(1) >= 256 || GET_INTEGER_PARAM(2) >= 256)
debug("CHANGE_CAR_COLOUR - Colours must be less than %d", 256);
- pVehicle->m_currentColour1 = ScriptParams[1];
- pVehicle->m_currentColour2 = ScriptParams[2];
+ pVehicle->m_currentColour1 = GET_INTEGER_PARAM(1);
+ pVehicle->m_currentColour2 = GET_INTEGER_PARAM(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];
+ float infX = GET_FLOAT_PARAM(0);
+ float infY = GET_FLOAT_PARAM(1);
+ float infZ = GET_FLOAT_PARAM(2);
+ float supX = GET_FLOAT_PARAM(3);
+ float supY = GET_FLOAT_PARAM(4);
+ float supZ = GET_FLOAT_PARAM(5);
if (infX > supX) {
- infX = *(float*)&ScriptParams[3];
- supX = *(float*)&ScriptParams[0];
+ infX = GET_FLOAT_PARAM(3);
+ supX = GET_FLOAT_PARAM(0);
}
if (infY > supY) {
- infY = *(float*)&ScriptParams[4];
- supY = *(float*)&ScriptParams[1];
+ infY = GET_FLOAT_PARAM(4);
+ supY = GET_FLOAT_PARAM(1);
}
if (infZ > supZ) {
- infZ = *(float*)&ScriptParams[5];
- supZ = *(float*)&ScriptParams[2];
+ infZ = GET_FLOAT_PARAM(5);
+ supZ = GET_FLOAT_PARAM(2);
}
ThePaths.SwitchPedRoadsOffInArea(infX, supX, infY, supY, infZ, supZ, false);
return 0;
@@ -490,23 +488,23 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
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];
+ float infX = GET_FLOAT_PARAM(0);
+ float infY = GET_FLOAT_PARAM(1);
+ float infZ = GET_FLOAT_PARAM(2);
+ float supX = GET_FLOAT_PARAM(3);
+ float supY = GET_FLOAT_PARAM(4);
+ float supZ = GET_FLOAT_PARAM(5);
if (infX > supX) {
- infX = *(float*)&ScriptParams[3];
- supX = *(float*)&ScriptParams[0];
+ infX = GET_FLOAT_PARAM(3);
+ supX = GET_FLOAT_PARAM(0);
}
if (infY > supY) {
- infY = *(float*)&ScriptParams[4];
- supY = *(float*)&ScriptParams[1];
+ infY = GET_FLOAT_PARAM(4);
+ supY = GET_FLOAT_PARAM(1);
}
if (infZ > supZ) {
- infZ = *(float*)&ScriptParams[5];
- supZ = *(float*)&ScriptParams[2];
+ infZ = GET_FLOAT_PARAM(5);
+ supZ = GET_FLOAT_PARAM(2);
}
ThePaths.SwitchPedRoadsOffInArea(infX, supX, infY, supY, infZ, supZ, true);
return 0;
@@ -514,20 +512,20 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
case COMMAND_CHAR_LOOK_AT_CHAR_ALWAYS:
{
CollectParameters(&m_nIp, 2);
- CPed* pSourcePed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pSourcePed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pSourcePed);
- CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ CPed* pTargetPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1));
script_assert(pTargetPed);
- pSourcePed->SetLookFlag(pTargetPed, true);
+ pSourcePed->SetLookFlag(pTargetPed, true, true);
pSourcePed->SetLookTimer(60000);
return 0;
}
case COMMAND_CHAR_LOOK_AT_PLAYER_ALWAYS:
{
CollectParameters(&m_nIp, 2);
- CPed* pSourcePed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pSourcePed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pSourcePed);
- CPed* pTargetPed = CWorld::Players[ScriptParams[1]].m_pPed;
+ CPed* pTargetPed = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed;
script_assert(pTargetPed);
pSourcePed->SetLookFlag(pTargetPed, true);
pSourcePed->SetLookTimer(60000);
@@ -536,9 +534,9 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
case COMMAND_PLAYER_LOOK_AT_CHAR_ALWAYS:
{
CollectParameters(&m_nIp, 2);
- CPed* pSourcePed = CWorld::Players[ScriptParams[0]].m_pPed;
+ CPed* pSourcePed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
script_assert(pSourcePed);
- CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ CPed* pTargetPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1));
script_assert(pTargetPed);
pSourcePed->SetLookFlag(pTargetPed, true);
pSourcePed->SetLookTimer(60000);
@@ -547,7 +545,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
case COMMAND_STOP_CHAR_LOOKING:
{
CollectParameters(&m_nIp, 1);
- CPed* pSourcePed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pSourcePed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pSourcePed);
pSourcePed->ClearLookFlag();
pSourcePed->bKeepTryingToLook = false;
@@ -558,7 +556,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
case COMMAND_STOP_PLAYER_LOOKING:
{
CollectParameters(&m_nIp, 1);
- CPed* pSourcePed = CWorld::Players[ScriptParams[0]].m_pPed;
+ CPed* pSourcePed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
script_assert(pSourcePed);
pSourcePed->ClearLookFlag();
pSourcePed->bKeepTryingToLook = false;
@@ -569,7 +567,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
/*
case COMMAND_SWITCH_HELICOPTER:
CollectParameters(&m_nIp, 1);
- CHeli::ActivateHeli(ScriptParams[0] != 0);
+ CHeli::ActivateHeli(GET_INTEGER_PARAM(0) != 0);
return 0;
*/
//case COMMAND_SET_GANG_ATTITUDE:
@@ -577,33 +575,33 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
//case COMMAND_SET_GANG_PLAYER_ATTITUDE:
case COMMAND_SET_GANG_PED_MODELS:
CollectParameters(&m_nIp, 3);
- CGangs::SetGangPedModels(ScriptParams[0], ScriptParams[1], ScriptParams[2]);
+ CGangs::SetGangPedModels(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2));
return 0;
case COMMAND_SET_GANG_CAR_MODEL:
CollectParameters(&m_nIp, 2);
- CGangs::SetGangVehicleModel(ScriptParams[0], ScriptParams[1]);
+ CGangs::SetGangVehicleModel(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1));
return 0;
case COMMAND_SET_GANG_WEAPONS:
CollectParameters(&m_nIp, 3);
- CGangs::SetGangWeapons(ScriptParams[0], (eWeaponType)ScriptParams[1], (eWeaponType)ScriptParams[2]);
+ CGangs::SetGangWeapons(GET_INTEGER_PARAM(0), (eWeaponType)GET_INTEGER_PARAM(1), (eWeaponType)GET_INTEGER_PARAM(2));
return 0;
/*
case COMMAND_SET_CHAR_OBJ_RUN_TO_AREA:
{
CollectParameters(&m_nIp, 5);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- float infX = *(float*)&ScriptParams[1];
- float infY = *(float*)&ScriptParams[2];
- float supX = *(float*)&ScriptParams[3];
- float supY = *(float*)&ScriptParams[4];
+ float infX = GET_FLOAT_PARAM(1);
+ float infY = GET_FLOAT_PARAM(2);
+ float supX = GET_FLOAT_PARAM(3);
+ float supY = GET_FLOAT_PARAM(4);
if (infX > supX) {
- infX = *(float*)&ScriptParams[3];
- supX = *(float*)&ScriptParams[1];
+ infX = GET_FLOAT_PARAM(3);
+ supX = GET_FLOAT_PARAM(1);
}
if (infY > supY) {
- infY = *(float*)&ScriptParams[4];
- supY = *(float*)&ScriptParams[2];
+ infY = GET_FLOAT_PARAM(4);
+ supY = GET_FLOAT_PARAM(2);
}
CVector pos;
pos.x = (infX + supX) / 2;
@@ -618,11 +616,11 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
case COMMAND_SET_CHAR_OBJ_RUN_TO_COORD:
{
CollectParameters(&m_nIp, 3);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
CVector pos;
- pos.x = *(float*)&ScriptParams[1];
- pos.y = *(float*)&ScriptParams[2];
+ pos.x = GET_FLOAT_PARAM(1);
+ pos.y = GET_FLOAT_PARAM(2);
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_RUN_TO_AREA, pos);
@@ -632,9 +630,9 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
case COMMAND_IS_PLAYER_TOUCHING_OBJECT_ON_FOOT:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
script_assert(pPed);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(1));
bool isTouching = false;
if (pPed->bInVehicle)
isTouching = false;
@@ -646,9 +644,9 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
case COMMAND_IS_CHAR_TOUCHING_OBJECT_ON_FOOT:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(1));
bool isTouching = false;
if (pPed->InVehicle())
isTouching = false;
@@ -665,110 +663,115 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
strncpy(name, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT);
for (int i = 0; i < KEY_LENGTH_IN_SCRIPT; i++)
name[i] = tolower(name[i]);
- CStreaming::RequestSpecialChar(ScriptParams[0] - 1, name, STREAMFLAGS_DEPENDENCY | STREAMFLAGS_SCRIPTOWNED);
+ CStreaming::RequestSpecialChar(GET_INTEGER_PARAM(0) - 1, name, STREAMFLAGS_DEPENDENCY | (m_bIsMissionScript ? STREAMFLAGS_SCRIPTOWNED : STREAMFLAGS_AMBIENT_SCRIPT_OWNED));
m_nIp += KEY_LENGTH_IN_SCRIPT;
return 0;
}
case COMMAND_HAS_SPECIAL_CHARACTER_LOADED:
{
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(CStreaming::HasSpecialCharLoaded(ScriptParams[0] - 1));
+ UpdateCompareFlag(CStreaming::HasSpecialCharLoaded(GET_INTEGER_PARAM(0) - 1));
return 0;
}
/*
case COMMAND_FLASH_CAR:
{
CollectParameters(&m_nIp, 2);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- pVehicle->bHasBlip = (ScriptParams[1] != 0);
+ pVehicle->bHasBlip = (GET_INTEGER_PARAM(1) != 0);
return 0;
}
case COMMAND_FLASH_CHAR:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- pPed->bHasBlip = (ScriptParams[1] != 0);
+ pPed->bHasBlip = (GET_INTEGER_PARAM(1) != 0);
return 0;
}
case COMMAND_FLASH_OBJECT:
{
CollectParameters(&m_nIp, 2);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pObject);
- pObject->bHasBlip = (ScriptParams[1] != 0);
+ pObject->bHasBlip = (GET_INTEGER_PARAM(1) != 0);
return 0;
}
*/
case COMMAND_IS_PLAYER_IN_REMOTE_MODE:
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(CWorld::Players[ScriptParams[0]].IsPlayerInRemoteMode());
+ UpdateCompareFlag(CWorld::Players[GET_INTEGER_PARAM(0)].IsPlayerInRemoteMode());
return 0;
- /*
case COMMAND_ARM_CAR_WITH_BOMB:
{
CollectParameters(&m_nIp, 2);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
- ((CAutomobile*)pVehicle)->m_bombType = ScriptParams[1];
+ ((CAutomobile*)pVehicle)->m_bombType = GET_INTEGER_PARAM(1);
((CAutomobile*)pVehicle)->m_pBombRigger = FindPlayerPed();
return 0;
}
- */
case COMMAND_SET_CHAR_PERSONALITY:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- pPed->SetPedStats((ePedStats)ScriptParams[1]);
+ pPed->SetPedStats((ePedStats)GET_INTEGER_PARAM(1));
return 0;
}
case COMMAND_SET_CUTSCENE_OFFSET:
CollectParameters(&m_nIp, 3);
- CCutsceneMgr::SetCutsceneOffset(*(CVector*)&ScriptParams[0]);
+ CCutsceneMgr::SetCutsceneOffset(GET_VECTOR_PARAM(0));
return 0;
case COMMAND_SET_ANIM_GROUP_FOR_CHAR:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- pPed->m_animGroup = (AssocGroupId)ScriptParams[1];
+ pPed->m_animGroup = (AssocGroupId)GET_INTEGER_PARAM(1);
+ pPed->b1A1_20 = false;
return 0;
}
/*
case COMMAND_SET_ANIM_GROUP_FOR_PLAYER:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
script_assert(pPed);
- pPed->m_animGroup = (AssocGroupId)ScriptParams[1];
+ pPed->m_animGroup = (AssocGroupId)GET_INTEGER_PARAM(1);
return 0;
}
*/
case COMMAND_REQUEST_MODEL:
{
CollectParameters(&m_nIp, 1);
- int model = ScriptParams[0];
+ int model = GET_INTEGER_PARAM(0);
if (model < 0)
model = CTheScripts::UsedObjectArray[-model].index;
- CStreaming::RequestModel(model, STREAMFLAGS_DEPENDENCY | STREAMFLAGS_NOFADE | STREAMFLAGS_SCRIPTOWNED);
+ CStreaming::RequestModel(model, STREAMFLAGS_DEPENDENCY | STREAMFLAGS_NOFADE | (m_bIsMissionScript ? STREAMFLAGS_SCRIPTOWNED : STREAMFLAGS_AMBIENT_SCRIPT_OWNED));
+ if (model == MI_MINIGUN)
+#ifdef FIX_BUGS
+ CStreaming::RequestModel(MI_MINIGUN2, STREAMFLAGS_DEPENDENCY | STREAMFLAGS_NOFADE | (m_bIsMissionScript ? STREAMFLAGS_SCRIPTOWNED : STREAMFLAGS_AMBIENT_SCRIPT_OWNED));
+#else
+ CStreaming::RequestModel(MI_MINIGUN2, STREAMFLAGS_DEPENDENCY | STREAMFLAGS_NOFADE | STREAMFLAGS_SCRIPTOWNED);
+#endif
return 0;
}
case COMMAND_HAS_MODEL_LOADED:
{
CollectParameters(&m_nIp, 1);
- int model = ScriptParams[0];
+ int model = GET_INTEGER_PARAM(0);
if (model < 0)
model = CTheScripts::UsedObjectArray[-model].index;
- UpdateCompareFlag(CStreaming::HasModelLoaded(model));
+ UpdateCompareFlag(CStreaming::HasModelLoaded(model)/* || cWorldStream::Instance()->pDynamic(model, 0) */); // TODO
return 0;
}
case COMMAND_MARK_MODEL_AS_NO_LONGER_NEEDED:
{
CollectParameters(&m_nIp, 1);
- int model = ScriptParams[0];
+ int model = GET_INTEGER_PARAM(0);
if (model < 0)
model = CTheScripts::UsedObjectArray[-model].index;
CStreaming::SetMissionDoesntRequireModel(model);
@@ -777,7 +780,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
case COMMAND_GRAB_PHONE:
{
CollectParameters(&m_nIp, 2);
- ScriptParams[0] = gPhoneInfo.GrabPhone(*(float*)&ScriptParams[0], *(float*)&ScriptParams[1]);
+ SET_INTEGER_PARAM(0, gPhoneInfo.GrabPhone(GET_FLOAT_PARAM(0), GET_FLOAT_PARAM(1)));
StoreParameters(&m_nIp, 1);
return 0;
}
@@ -786,80 +789,85 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 1);
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
- gPhoneInfo.SetPhoneMessage_Repeatedly(ScriptParams[0], text, nil, nil, nil, nil, nil);
+ gPhoneInfo.SetPhoneMessage_Repeatedly(GET_INTEGER_PARAM(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);
+ gPhoneInfo.SetPhoneMessage_JustOnce(GET_INTEGER_PARAM(0), text, nil, nil, nil, nil, nil);
return 0;
}
case COMMAND_HAS_PHONE_DISPLAYED_MESSAGE:
{
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(gPhoneInfo.HasMessageBeenDisplayed(ScriptParams[0]));
+ UpdateCompareFlag(gPhoneInfo.HasMessageBeenDisplayed(GET_INTEGER_PARAM(0)));
return 0;
}
*/
case COMMAND_TURN_PHONE_OFF:
{
CollectParameters(&m_nIp, 1);
- gPhoneInfo.SetPhoneMessage_JustOnce(ScriptParams[0], nil, nil, nil, nil, nil, nil);
+ gPhoneInfo.SetPhoneMessage_JustOnce(GET_INTEGER_PARAM(0), nil, nil, nil, nil, nil, nil);
return 0;
}
case COMMAND_DRAW_CORONA:
{
+ uint32 ip = m_nIp;
+ int32* ptr = GetPointerToScriptVariable(&ip, 0);
CollectParameters(&m_nIp, 9);
- CVector pos = *(CVector*)&ScriptParams[0];
+ CVector pos = GET_VECTOR_PARAM(0);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
- CCoronas::RegisterCorona((uintptr)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);
+ CCoronas::RegisterCorona((uintptr)ptr, GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(7), GET_INTEGER_PARAM(8),
+ 255, pos, -GET_FLOAT_PARAM(3), 450.0f, GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(5), 1, 0, 0, 0.0f);
return 0;
}
+ /*
case COMMAND_DRAW_LIGHT:
{
CollectParameters(&m_nIp, 6);
- CVector pos = *(CVector*)&ScriptParams[0];
+ CVector pos = GET_VECTOR_PARAM(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);
+ CPointLights::AddLight(0, GET_VECTOR_PARAM(0), CVector(0.0f, 0.0f, 0.0f), 12.0f,
+ GET_INTEGER_PARAM(3) / 255.0f, GET_INTEGER_PARAM(4) / 255.0f, GET_INTEGER_PARAM(5) / 255.0f, 0, true);
return 0;
}
- //case COMMAND_STORE_WEATHER:
- //case COMMAND_RESTORE_WEATHER:
+ */
+ case COMMAND_STORE_WEATHER:
+ CWeather::StoreWeatherState();
+ return 0;
+ case COMMAND_RESTORE_WEATHER:
+ CWeather::RestoreWeatherState();
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];
+ CVector pos = GET_VECTOR_PARAM(0);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
- CRestart::OverrideNextRestart(pos, *(float*)&ScriptParams[3]);
+ CRestart::OverrideNextRestart(pos, GET_FLOAT_PARAM(3));
if (CWorld::Players[CWorld::PlayerInFocus].m_WBState != WBSTATE_PLAYING)
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);
+ UpdateCompareFlag(CWorld::Players[GET_INTEGER_PARAM(0)].m_WBState == WBSTATE_PLAYING);
return 0;
}
#ifdef GTA_SCRIPT_COLLECTIVE
case COMMAND_SET_COLL_OBJ_NO_OBJ:
CollectParameters(&m_nIp, 1);
- CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_NONE);
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_NONE);
return 0;
#endif
default:
@@ -874,134 +882,134 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
#ifdef GTA_SCRIPT_COLLECTIVE
case COMMAND_SET_COLL_OBJ_WAIT_ON_FOOT:
CollectParameters(&m_nIp, 1);
- CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_WAIT_ON_FOOT);
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_WAIT_ON_FOOT);
return 0;
case COMMAND_SET_COLL_OBJ_FLEE_ON_FOOT_TILL_SAFE:
CollectParameters(&m_nIp, 1);
- CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE);
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE);
return 0;
case COMMAND_SET_COLL_OBJ_GUARD_SPOT:
{
CollectParameters(&m_nIp, 4);
- CVector pos = *(CVector*)&ScriptParams[1];
+ CVector pos = GET_VECTOR_PARAM(1);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
- CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GUARD_AREA, pos);
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_GUARD_AREA, pos);
return 0;
}
case COMMAND_SET_COLL_OBJ_GUARD_AREA:
{
CollectParameters(&m_nIp, 5);
- float infX = *(float*)&ScriptParams[1];
- float supX = *(float*)&ScriptParams[3];
+ float infX = GET_FLOAT_PARAM(1);
+ float supX = GET_FLOAT_PARAM(3);
if (infX > supX) {
- infX = *(float*)&ScriptParams[3];
- supX = *(float*)&ScriptParams[1];
+ infX = GET_FLOAT_PARAM(3);
+ supX = GET_FLOAT_PARAM(1);
}
- float infY = *(float*)&ScriptParams[2];
- float supY = *(float*)&ScriptParams[4];
+ float infY = GET_FLOAT_PARAM(2);
+ float supY = GET_FLOAT_PARAM(4);
if (infY > supY) {
- infY = *(float*)&ScriptParams[4];
- supY = *(float*)&ScriptParams[2];
+ infY = GET_FLOAT_PARAM(4);
+ supY = GET_FLOAT_PARAM(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);
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_GUARD_AREA, pos, radius);
return 0;
}
case COMMAND_SET_COLL_OBJ_WAIT_IN_CAR:
CollectParameters(&m_nIp, 1);
- CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_WAIT_IN_CAR);
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_WAIT_IN_CAR);
return 0;
case COMMAND_SET_COLL_OBJ_KILL_CHAR_ON_FOOT:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
- CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_KILL_CHAR_ON_FOOT, pPed);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1));
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_KILL_CHAR_ON_FOOT, pPed);
return 0;
}
case COMMAND_SET_COLL_OBJ_KILL_PLAYER_ON_FOOT:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed;
- CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_KILL_CHAR_ON_FOOT, pPed);
+ CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed;
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_KILL_CHAR_ON_FOOT, pPed);
return 0;
}
case COMMAND_SET_COLL_OBJ_KILL_CHAR_ANY_MEANS:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
- CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_KILL_CHAR_ANY_MEANS, pPed);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1));
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_KILL_CHAR_ANY_MEANS, pPed);
return 0;
}
case COMMAND_SET_COLL_OBJ_KILL_PLAYER_ANY_MEANS:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed;
- CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_KILL_CHAR_ANY_MEANS, pPed);
+ CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed;
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_KILL_CHAR_ANY_MEANS, pPed);
return 0;
}
case COMMAND_SET_COLL_OBJ_FLEE_CHAR_ON_FOOT_TILL_SAFE:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
- CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pPed);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1));
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pPed);
return 0;
}
case COMMAND_SET_COLL_OBJ_FLEE_PLAYER_ON_FOOT_TILL_SAFE:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed;
- CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pPed);
+ CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed;
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pPed);
return 0;
}
case COMMAND_SET_COLL_OBJ_FLEE_CHAR_ON_FOOT_ALWAYS:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
- CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pPed);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1));
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pPed);
return 0;
}
case COMMAND_SET_COLL_OBJ_FLEE_PLAYER_ON_FOOT_ALWAYS:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed;
- CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pPed);
+ CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed;
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pPed);
return 0;
}
case COMMAND_SET_COLL_OBJ_GOTO_CHAR_ON_FOOT:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
- CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GOTO_CHAR_ON_FOOT, pPed);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1));
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_GOTO_CHAR_ON_FOOT, pPed);
return 0;
}
case COMMAND_SET_COLL_OBJ_GOTO_PLAYER_ON_FOOT:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed;
- CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GOTO_CHAR_ON_FOOT, pPed);
+ CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed;
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_GOTO_CHAR_ON_FOOT, pPed);
return 0;
}
case COMMAND_SET_COLL_OBJ_LEAVE_CAR:
CollectParameters(&m_nIp, 1);
- CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_LEAVE_CAR);
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_LEAVE_CAR);
return 0;
case COMMAND_SET_COLL_OBJ_ENTER_CAR_AS_PASSENGER:
{
CollectParameters(&m_nIp, 2);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
- CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_ENTER_CAR_AS_PASSENGER, pVehicle);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1));
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_ENTER_CAR_AS_PASSENGER, pVehicle);
return 0;
}
case COMMAND_SET_COLL_OBJ_ENTER_CAR_AS_DRIVER:
{
CollectParameters(&m_nIp, 2);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
- CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicle);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1));
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicle);
return 0;
}
/*
@@ -1012,31 +1020,31 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
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);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1));
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_DESTROY_CAR, pVehicle);
return 0;
}
case COMMAND_SET_COLL_OBJ_GOTO_AREA_ON_FOOT:
{
CollectParameters(&m_nIp, 5);
- float infX = *(float*)&ScriptParams[1];
- float supX = *(float*)&ScriptParams[3];
+ float infX = GET_FLOAT_PARAM(1);
+ float supX = GET_FLOAT_PARAM(3);
if (infX > supX) {
- infX = *(float*)&ScriptParams[3];
- supX = *(float*)&ScriptParams[1];
+ infX = GET_FLOAT_PARAM(3);
+ supX = GET_FLOAT_PARAM(1);
}
- float infY = *(float*)&ScriptParams[2];
- float supY = *(float*)&ScriptParams[4];
+ float infY = GET_FLOAT_PARAM(2);
+ float supY = GET_FLOAT_PARAM(4);
if (infY > supY) {
- infY = *(float*)&ScriptParams[4];
- supY = *(float*)&ScriptParams[2];
+ infY = GET_FLOAT_PARAM(4);
+ supY = GET_FLOAT_PARAM(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);
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_GOTO_AREA_ON_FOOT, pos, radius);
return 0;
}
/*
@@ -1046,66 +1054,66 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
*/
case COMMAND_SET_COLL_OBJ_FOLLOW_ROUTE:
CollectParameters(&m_nIp, 3);
- CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FOLLOW_ROUTE, ScriptParams[1], ScriptParams[2]);
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_FOLLOW_ROUTE, GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2));
return 0;
case COMMAND_SET_COLL_OBJ_GOTO_COORD_ON_FOOT:
{
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);
+ CVector pos(GET_FLOAT_PARAM(1), GET_FLOAT_PARAM(2), CWorld::FindGroundZForCoord(GET_FLOAT_PARAM(1), GET_FLOAT_PARAM(2)));
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_GOTO_AREA_ON_FOOT, pos);
return 0;
}
//case COMMAND_SET_COLL_OBJ_GOTO_COORD_IN_CAR:
case COMMAND_SET_COLL_OBJ_RUN_TO_AREA:
{
CollectParameters(&m_nIp, 5);
- float infX = *(float*)&ScriptParams[1];
- float supX = *(float*)&ScriptParams[3];
+ float infX = GET_FLOAT_PARAM(1);
+ float supX = GET_FLOAT_PARAM(3);
if (infX > supX) {
- infX = *(float*)&ScriptParams[3];
- supX = *(float*)&ScriptParams[1];
+ infX = GET_FLOAT_PARAM(3);
+ supX = GET_FLOAT_PARAM(1);
}
- float infY = *(float*)&ScriptParams[2];
- float supY = *(float*)&ScriptParams[4];
+ float infY = GET_FLOAT_PARAM(2);
+ float supY = GET_FLOAT_PARAM(4);
if (infY > supY) {
- infY = *(float*)&ScriptParams[4];
- supY = *(float*)&ScriptParams[2];
+ infY = GET_FLOAT_PARAM(4);
+ supY = GET_FLOAT_PARAM(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);
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_RUN_TO_AREA, pos, radius);
return 0;
}
case COMMAND_SET_COLL_OBJ_RUN_TO_COORD:
{
CollectParameters(&m_nIp, 3);
- CVector pos(*(float*)&ScriptParams[1], *(float*)&ScriptParams[2], CWorld::FindGroundZForCoord(*(float*)&ScriptParams[1], *(float*)&ScriptParams[2]));
- CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_RUN_TO_AREA, pos);
+ CVector pos(GET_FLOAT_PARAM(1), GET_FLOAT_PARAM(2), CWorld::FindGroundZForCoord(GET_FLOAT_PARAM(1), GET_FLOAT_PARAM(2)));
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_RUN_TO_AREA, pos);
return 0;
}
case COMMAND_ADD_PEDS_IN_AREA_TO_COLL:
{
CollectParameters(&m_nIp, 3);
- float X = *(float*)&ScriptParams[0];
- float Y = *(float*)&ScriptParams[1];
+ float X = GET_FLOAT_PARAM(0);
+ float Y = GET_FLOAT_PARAM(1);
float Z = CWorld::FindGroundZForCoord(X, Y);
- float radius = *(float*)&ScriptParams[2];
- ScriptParams[0] = CTheScripts::AddPedsInAreaToCollective(X, Y, Z, radius);
+ float radius = GET_FLOAT_PARAM(2);
+ SET_INTEGER_PARAM(0, CTheScripts::AddPedsInAreaToCollective(X, Y, Z, radius));
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_ADD_PEDS_IN_VEHICLE_TO_COLL:
CollectParameters(&m_nIp, 1);
- ScriptParams[0] = CTheScripts::AddPedsInVehicleToCollective(ScriptParams[0]);
+ SET_INTEGER_PARAM(0, CTheScripts::AddPedsInVehicleToCollective(GET_INTEGER_PARAM(0)));
StoreParameters(&m_nIp, 1);
return 0;
case COMMAND_CLEAR_COLL:
CollectParameters(&m_nIp, 1);
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
- if (CTheScripts::CollectiveArray[i].colIndex == ScriptParams[0]) {
+ if (CTheScripts::CollectiveArray[i].colIndex == GET_INTEGER_PARAM(0)) {
CTheScripts::CollectiveArray[i].colIndex = -1;
CTheScripts::CollectiveArray[i].pedIndex = 0;
}
@@ -1174,7 +1182,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
total++;
}
}
- ScriptParams[0] = total;
+ SET_INTEGER_PARAM(0, total);
StoreParameters(&m_nIp, 1);
return 0;
}
@@ -1182,72 +1190,73 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
case COMMAND_SET_CHAR_HEED_THREATS:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- pPed->bRespondsToThreats = (ScriptParams[1] != 0);
+ pPed->bRespondsToThreats = (GET_INTEGER_PARAM(1) != 0);
return 0;
}
case COMMAND_SET_PLAYER_HEED_THREATS:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
script_assert(pPed);
- pPed->bRespondsToThreats = (ScriptParams[1] != 0);
+ pPed->bRespondsToThreats = (GET_INTEGER_PARAM(1) != 0);
return 0;
}
case COMMAND_GET_CONTROLLER_MODE:
#if defined(GTA_PC) && !defined(DETECT_PAD_INPUT_SWITCH)
- ScriptParams[0] = 0;
+ SET_INTEGER_PARAM(0, 0);
#else
- ScriptParams[0] = CPad::IsAffectedByController ? CPad::GetPad(0)->Mode : 0;
+ SET_INTEGER_PARAM(0, CPad::IsAffectedByController ? CPad::GetPad(0)->Mode : 0);
#endif
StoreParameters(&m_nIp, 1);
return 0;
case COMMAND_SET_CAN_RESPRAY_CAR:
{
CollectParameters(&m_nIp, 2);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
//assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
// they DO call this for bikes, we don't really want to destroy the structure...
#ifdef FIX_BUGS
if (pVehicle->m_vehType == VEHICLE_TYPE_CAR)
#endif
- ((CAutomobile*)pVehicle)->bFixedColour = (ScriptParams[1] == 0);
+ ((CAutomobile*)pVehicle)->bFixedColour = (GET_INTEGER_PARAM(1) == 0);
return 0;
}
- /*
case COMMAND_IS_TAXI:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
UpdateCompareFlag(pVehicle->IsTaxi());
return 0;
}
- */
case COMMAND_UNLOAD_SPECIAL_CHARACTER:
CollectParameters(&m_nIp, 1);
- CStreaming::SetMissionDoesntRequireSpecialChar(ScriptParams[0] - 1);
+ if (m_bIsMissionScript)
+ CStreaming::SetMissionDoesntRequireSpecialChar(GET_INTEGER_PARAM(0) - 1);
+ //else
+ // CStreaming::SetAmbientMissionDoesntRequireSpecialChar(GET_INTEGER_PARAM(0) - 1); // TODO
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]);
+ SET_INTEGER_PARAM(0, CDarkel::QueryModelsKilledByPlayer(GET_INTEGER_PARAM(0)));
StoreParameters(&m_nIp, 1);
return 0;
/*
case COMMAND_ACTIVATE_GARAGE:
CollectParameters(&m_nIp, 1);
- CGarages::ActivateGarage(ScriptParams[0]);
+ CGarages::ActivateGarage(GET_INTEGER_PARAM(0));
return 0;
case COMMAND_SWITCH_TAXI_TIMER:
{
CollectParameters(&m_nIp, 1);
- if (ScriptParams[0] != 0){
+ if (GET_INTEGER_PARAM(0) != 0){
CWorld::Players[CWorld::PlayerInFocus].m_nUnusedTaxiTimer = CTimer::GetTimeInMilliseconds();
CWorld::Players[CWorld::PlayerInFocus].m_bUnusedTaxiThing = true;
}else{
@@ -1259,10 +1268,10 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
case COMMAND_CREATE_OBJECT_NO_OFFSET:
{
CollectParameters(&m_nIp, 4);
- int mi = ScriptParams[0] >= 0 ? ScriptParams[0] : CTheScripts::UsedObjectArray[-ScriptParams[0]].index;
+ int mi = GET_INTEGER_PARAM(0) >= 0 ? GET_INTEGER_PARAM(0) : CTheScripts::UsedObjectArray[-GET_INTEGER_PARAM(0)].index;
CObject* pObj = new CObject(mi, false);
; pObj->ObjectCreatedBy = MISSION_OBJECT;
- CVector pos = *(CVector*)&ScriptParams[1];
+ CVector pos = GET_VECTOR_PARAM(1);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pObj->SetPosition(pos);
@@ -1274,37 +1283,37 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
pObj->SetupBigBuilding();
CTheScripts::ClearSpaceForMissionEntity(pos, pObj);
CWorld::Add(pObj);
- ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pObj);
+ SET_INTEGER_PARAM(0, CPools::GetObjectPool()->GetIndex(pObj));
StoreParameters(&m_nIp, 1);
if (m_bIsMissionScript)
- CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_OBJECT);
+ CTheScripts::MissionCleanUp.AddEntityToList(GET_INTEGER_PARAM(0), CLEANUP_OBJECT);
return 0;
}
- /*
case COMMAND_IS_BOAT:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- UpdateCompareFlag(pVehicle->m_vehType == VEHICLE_TYPE_BOAT);
+ UpdateCompareFlag(pVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT);
return 0;
}
+ /*
case COMMAND_SET_CHAR_OBJ_GOTO_AREA_ANY_MEANS:
{
CollectParameters(&m_nIp, 5);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- float infX = *(float*)&ScriptParams[1];
- float infY = *(float*)&ScriptParams[2];
- float supX = *(float*)&ScriptParams[3];
- float supY = *(float*)&ScriptParams[4];
+ float infX = GET_FLOAT_PARAM(1);
+ float infY = GET_FLOAT_PARAM(2);
+ float supX = GET_FLOAT_PARAM(3);
+ float supY = GET_FLOAT_PARAM(4);
if (infX > supX) {
- infX = *(float*)&ScriptParams[3];
- supX = *(float*)&ScriptParams[1];
+ infX = GET_FLOAT_PARAM(3);
+ supX = GET_FLOAT_PARAM(1);
}
if (infY > supY) {
- infY = *(float*)&ScriptParams[4];
- supY = *(float*)&ScriptParams[2];
+ infY = GET_FLOAT_PARAM(4);
+ supY = GET_FLOAT_PARAM(2);
}
CVector pos;
pos.x = (infX + supX) / 2;
@@ -1315,105 +1324,107 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
pPed->SetObjective(OBJECTIVE_GOTO_AREA_ANY_MEANS, pos, radius);
return 0;
}
- */
#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];
+ float infX = GET_FLOAT_PARAM(1);
+ float supX = GET_FLOAT_PARAM(3);
if (infX > supX) {
- infX = *(float*)&ScriptParams[3];
- supX = *(float*)&ScriptParams[1];
+ infX = GET_FLOAT_PARAM(3);
+ supX = GET_FLOAT_PARAM(1);
}
- float infY = *(float*)&ScriptParams[2];
- float supY = *(float*)&ScriptParams[4];
+ float infY = GET_FLOAT_PARAM(2);
+ float supY = GET_FLOAT_PARAM(4);
if (infY > supY) {
- infY = *(float*)&ScriptParams[4];
- supY = *(float*)&ScriptParams[2];
+ infY = GET_FLOAT_PARAM(4);
+ supY = GET_FLOAT_PARAM(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);
+ CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_GOTO_AREA_ANY_MEANS, pos, radius);
return 0;
}
#endif
+*/
case COMMAND_IS_PLAYER_STOPPED:
{
CollectParameters(&m_nIp, 1);
- CPlayerInfo* pPlayer = &CWorld::Players[ScriptParams[0]];
+ CPlayerInfo* pPlayer = &CWorld::Players[GET_INTEGER_PARAM(0)];
UpdateCompareFlag(CTheScripts::IsPlayerStopped(pPlayer));
return 0;
}
- /*
case COMMAND_IS_CHAR_STOPPED:
{
CollectParameters(&m_nIp, 1);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(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_nWakeTime = CTimer::GetTimeInMilliseconds() + GET_INTEGER_PARAM(0);
+ if (GET_INTEGER_PARAM(1) != 0)
m_bSkipWakeTime = true;
return 1;
+ /*
case COMMAND_ADD_PARTICLE_EFFECT:
{
CollectParameters(&m_nIp, 5);
- CVector pos = *(CVector*)&ScriptParams[1];
+ CVector pos = GET_VECTOR_PARAM(1);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
- CParticleObject::AddObject(ScriptParams[0], pos, ScriptParams[4] != 0);
+ CParticleObject::AddObject(GET_INTEGER_PARAM(0), pos, GET_INTEGER_PARAM(4) != 0);
return 0;
}
*/
case COMMAND_SWITCH_WIDESCREEN:
CollectParameters(&m_nIp, 1);
- if (ScriptParams[0] != 0)
+ if (GET_INTEGER_PARAM(0) != 0)
TheCamera.SetWideScreenOn();
- else
+ else {
+ // TODO: unknown field
TheCamera.SetWideScreenOff();
+ }
return 0;
/*
case COMMAND_ADD_SPRITE_BLIP_FOR_CAR:
{
CollectParameters(&m_nIp, 2);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_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;
+ int id = CRadar::SetEntityBlip(BLIP_CAR, GET_INTEGER_PARAM(0), 0, BLIP_DISPLAY_BOTH);
+ CRadar::SetBlipSprite(id, GET_INTEGER_PARAM(1));
+ SET_INTEGER_PARAM(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]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_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;
+ int id = CRadar::SetEntityBlip(BLIP_CHAR, GET_INTEGER_PARAM(0), 1, BLIP_DISPLAY_BOTH);
+ CRadar::SetBlipSprite(id, GET_INTEGER_PARAM(1));
+ SET_INTEGER_PARAM(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]);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0));
script_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;
+ int id = CRadar::SetEntityBlip(BLIP_OBJECT, GET_INTEGER_PARAM(0), 6, BLIP_DISPLAY_BOTH);
+ CRadar::SetBlipSprite(id, GET_INTEGER_PARAM(1));
+ SET_INTEGER_PARAM(0, id);
StoreParameters(&m_nIp, 1);
return 0;
}
@@ -1421,67 +1432,67 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
case COMMAND_ADD_SPRITE_BLIP_FOR_CONTACT_POINT:
{
CollectParameters(&m_nIp, 4);
- CVector pos = *(CVector*)&ScriptParams[0];
+ CVector pos = GET_VECTOR_PARAM(0);
if (pos.z <= MAP_Z_LOW_LIMIT)
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;
+ CRadar::SetBlipSprite(id, GET_INTEGER_PARAM(3));
+ SET_INTEGER_PARAM(0, id);
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_ADD_SPRITE_BLIP_FOR_COORD:
{
CollectParameters(&m_nIp, 4);
- CVector pos = *(CVector*)&ScriptParams[0];
+ CVector pos = GET_VECTOR_PARAM(0);
if (pos.z <= MAP_Z_LOW_LIMIT)
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;
+ int id = CRadar::SetCoordBlip(BLIP_COORD, pos, 4, BLIP_DISPLAY_BOTH);
+ CRadar::SetBlipSprite(id, GET_INTEGER_PARAM(3));
+ SET_INTEGER_PARAM(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]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- pPed->bOnlyDamagedByPlayer = (ScriptParams[1] != 0);
+ pPed->bOnlyDamagedByPlayer = (GET_INTEGER_PARAM(1) != 0);
return 0;
}
case COMMAND_SET_CAR_ONLY_DAMAGED_BY_PLAYER:
{
CollectParameters(&m_nIp, 2);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- pVehicle->bOnlyDamagedByPlayer = (ScriptParams[1] != 0);
+ pVehicle->bOnlyDamagedByPlayer = (GET_INTEGER_PARAM(1) != 0);
return 0;
}
case COMMAND_SET_CHAR_PROOFS:
{
CollectParameters(&m_nIp, 6);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_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);
+ pPed->bBulletProof = (GET_INTEGER_PARAM(1) != 0);
+ pPed->bFireProof = (GET_INTEGER_PARAM(2) != 0);
+ pPed->bExplosionProof = (GET_INTEGER_PARAM(3) != 0);
+ pPed->bCollisionProof = (GET_INTEGER_PARAM(4) != 0);
+ pPed->bMeleeProof = (GET_INTEGER_PARAM(5) != 0);
return 0;
}
case COMMAND_SET_CAR_PROOFS:
{
CollectParameters(&m_nIp, 6);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_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);
+ pVehicle->bBulletProof = (GET_INTEGER_PARAM(1) != 0);
+ pVehicle->bFireProof = (GET_INTEGER_PARAM(2) != 0);
+ pVehicle->bExplosionProof = (GET_INTEGER_PARAM(3) != 0);
+ pVehicle->bCollisionProof = (GET_INTEGER_PARAM(4) != 0);
+ pVehicle->bMeleeProof = (GET_INTEGER_PARAM(5) != 0);
return 0;
}
case COMMAND_IS_PLAYER_IN_ANGLED_AREA_2D:
@@ -1501,16 +1512,16 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
/*
case COMMAND_DEACTIVATE_GARAGE:
CollectParameters(&m_nIp, 1);
- CGarages::DeActivateGarage(ScriptParams[0]);
+ CGarages::DeActivateGarage(GET_INTEGER_PARAM(0));
return 0;
case COMMAND_GET_NUMBER_OF_CARS_COLLECTED_BY_GARAGE:
CollectParameters(&m_nIp, 1);
- ScriptParams[0] = CGarages::QueryCarsCollected(ScriptParams[0]);
+ SET_INTEGER_PARAM(0, CGarages::QueryCarsCollected(GET_INTEGER_PARAM(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));
+ UpdateCompareFlag(CGarages::HasThisCarBeenCollected(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1) - 1));
return 0;
*/
default:
@@ -1525,54 +1536,55 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
/*
case COMMAND_SET_SWAT_REQUIRED:
CollectParameters(&m_nIp, 1);
- FindPlayerPed()->m_pWanted->m_bSwatRequired = (ScriptParams[0] != 0);
+ FindPlayerPed()->m_pWanted->m_bSwatRequired = (GET_INTEGER_PARAM(0) != 0);
return 0;
case COMMAND_SET_FBI_REQUIRED:
CollectParameters(&m_nIp, 1);
- FindPlayerPed()->m_pWanted->m_bFbiRequired = (ScriptParams[0] != 0);
+ FindPlayerPed()->m_pWanted->m_bFbiRequired = (GET_INTEGER_PARAM(0) != 0);
return 0;
case COMMAND_SET_ARMY_REQUIRED:
CollectParameters(&m_nIp, 1);
- FindPlayerPed()->m_pWanted->m_bArmyRequired = (ScriptParams[0] != 0);
+ FindPlayerPed()->m_pWanted->m_bArmyRequired = (GET_INTEGER_PARAM(0) != 0);
return 0;
*/
case COMMAND_IS_CAR_IN_WATER:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
UpdateCompareFlag(pVehicle && pVehicle->bIsInWater);
return 0;
}
case COMMAND_GET_CLOSEST_CHAR_NODE:
{
CollectParameters(&m_nIp, 3);
- CVector pos = *(CVector*)&ScriptParams[0];
+ CVector pos = GET_VECTOR_PARAM(0);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
- CPathNode* pNode = &ThePaths.m_pathNodes[ThePaths.FindNodeClosestToCoors(pos, 1, 999999.9f, true)];
- *(CVector*)&ScriptParams[0] = pNode->GetPosition();
+ CPathNode* pNode = &ThePaths.m_pathNodes[ThePaths.FindNodeClosestToCoors(pos, 1, 800.0f, true)];
+ SET_VECTOR_PARAM(0, pNode->GetPosition());
StoreParameters(&m_nIp, 3);
return 0;
}
case COMMAND_GET_CLOSEST_CAR_NODE:
{
CollectParameters(&m_nIp, 3);
- CVector pos = *(CVector*)&ScriptParams[0];
+ CVector pos = GET_VECTOR_PARAM(0);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
- *(CVector*)&ScriptParams[0] = ThePaths.FindNodeCoorsForScript(ThePaths.FindNodeClosestToCoors(pos, 0, 999999.9f, true, true));
+ SET_VECTOR_PARAM(0, ThePaths.FindNodeCoorsForScript(ThePaths.FindNodeClosestToCoors(pos, 0, 800.0f, true, true)));
StoreParameters(&m_nIp, 3);
return 0;
}
case COMMAND_CAR_GOTO_COORDINATES_ACCURATE:
{
CollectParameters(&m_nIp, 4);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- CVector pos = *(CVector*)&ScriptParams[1];
+ CVector pos = GET_VECTOR_PARAM(1);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += pVehicle->GetDistanceFromCentreOfMassToBaseOfModel();
+ uint8 nOldMission = pVehicle->AutoPilot.m_nCarMission;
if (CCarCtrl::JoinCarWithRoadSystemGotoCoors(pVehicle, pos, false))
pVehicle->AutoPilot.m_nCarMission = MISSION_GOTO_COORDS_STRAIGHT_ACCURATE;
else
@@ -1580,19 +1592,20 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
pVehicle->SetStatus(STATUS_PHYSICS);
pVehicle->bEngineOn = true;
pVehicle->AutoPilot.m_nCruiseSpeed = Max(1, pVehicle->AutoPilot.m_nCruiseSpeed);
- pVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
+ if (nOldMission != pVehicle->AutoPilot.m_nCarMission)
+ pVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
return 0;
}
/*
case COMMAND_START_PACMAN_RACE:
CollectParameters(&m_nIp, 1);
- CPacManPickups::StartPacManRace(ScriptParams[0]);
+ CPacManPickups::StartPacManRace(GET_INTEGER_PARAM(0));
return 0;
case COMMAND_START_PACMAN_RECORD:
CPacManPickups::StartPacManRecord();
return 0;
case COMMAND_GET_NUMBER_OF_POWER_PILLS_EATEN:
- ScriptParams[0] = CPacManPickups::QueryPowerPillsEatenInRace();
+ SET_INTEGER_PARAM(0, CPacManPickups::QueryPowerPillsEatenInRace());
StoreParameters(&m_nIp, 1);
return 0;
case COMMAND_CLEAR_PACMAN:
@@ -1601,14 +1614,14 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
case COMMAND_START_PACMAN_SCRAMBLE:
{
CollectParameters(&m_nIp, 5);
- CVector pos = *(CVector*)&ScriptParams[0];
+ CVector pos = GET_VECTOR_PARAM(0);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
- CPacManPickups::StartPacManScramble(pos, *(float*)&ScriptParams[3], ScriptParams[4]);
+ CPacManPickups::StartPacManScramble(pos, GET_FLOAT_PARAM(3), GET_INTEGER_PARAM(4));
return 0;
}
case COMMAND_GET_NUMBER_OF_POWER_PILLS_CARRIED:
- ScriptParams[0] = CPacManPickups::QueryPowerPillsCarriedByPlayer();
+ SET_INTEGER_PARAM(0, CPacManPickups::QueryPowerPillsCarriedByPlayer());
StoreParameters(&m_nIp, 1);
return 0;
case COMMAND_CLEAR_NUMBER_OF_POWER_PILLS_CARRIED:
@@ -1618,7 +1631,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
case COMMAND_IS_CAR_ON_SCREEN:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
UpdateCompareFlag(TheCamera.IsSphereVisible(pVehicle->GetBoundCentre(), pVehicle->GetBoundRadius()));
return 0;
@@ -1626,7 +1639,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
case COMMAND_IS_CHAR_ON_SCREEN:
{
CollectParameters(&m_nIp, 1);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
UpdateCompareFlag(TheCamera.IsSphereVisible(pPed->GetBoundCentre(), pPed->GetBoundRadius()));
return 0;
@@ -1634,67 +1647,65 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
case COMMAND_IS_OBJECT_ON_SCREEN:
{
CollectParameters(&m_nIp, 1);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pObject);
UpdateCompareFlag(TheCamera.IsSphereVisible(pObject->GetBoundCentre(), pObject->GetBoundRadius()));
return 0;
}
- /*
case COMMAND_GOSUB_FILE:
{
CollectParameters(&m_nIp, 2);
script_assert(m_nStackPointer < MAX_STACK_DEPTH);
m_anStack[m_nStackPointer++] = m_nIp;
- SetIP(ScriptParams[0]);
- // ScriptParams[1] == filename
+ SetIP(GET_INTEGER_PARAM(0));
+ // GET_INTEGER_PARAM(1) == filename
return 0;
}
- */
case COMMAND_GET_GROUND_Z_FOR_3D_COORD:
{
CollectParameters(&m_nIp, 3);
- CVector pos = *(CVector*)&ScriptParams[0];
+ CVector pos = GET_VECTOR_PARAM(0);
bool success;
- *(float*)&ScriptParams[0] = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z, &success);
+ SET_FLOAT_PARAM(0, CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z, &success));
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_START_SCRIPT_FIRE:
{
CollectParameters(&m_nIp, 3);
- CVector pos = *(CVector*)&ScriptParams[0];
+ CVector pos = GET_VECTOR_PARAM(0);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
- ScriptParams[0] = gFireManager.StartScriptFire(pos, nil, 0.8f, 1);
+ SET_INTEGER_PARAM(0, gFireManager.StartScriptFire(pos, nil, 0.8f, 1));
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_IS_SCRIPT_FIRE_EXTINGUISHED:
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(gFireManager.IsScriptFireExtinguish(ScriptParams[0]));
+ UpdateCompareFlag(gFireManager.IsScriptFireExtinguish(GET_INTEGER_PARAM(0)));
return 0;
case COMMAND_REMOVE_SCRIPT_FIRE:
CollectParameters(&m_nIp, 1);
- gFireManager.RemoveScriptFire(ScriptParams[0]);
+ gFireManager.RemoveScriptFire(GET_INTEGER_PARAM(0));
return 0;
/*
case COMMAND_SET_COMEDY_CONTROLS:
{
CollectParameters(&m_nIp, 2);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- pVehicle->bComedyControls = (ScriptParams[1] != 0);
+ pVehicle->bComedyControls = (GET_INTEGER_PARAM(1) != 0);
return 0;
}
*/
case COMMAND_BOAT_GOTO_COORDS:
{
CollectParameters(&m_nIp, 4);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
script_assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT);
CBoat* pBoat = (CBoat*)pVehicle;
- CVector pos = *(CVector*)&ScriptParams[1];
+ CVector pos = GET_VECTOR_PARAM(1);
if (pos.z <= MAP_Z_LOW_LIMIT)
CWaterLevel::GetWaterLevel(pos.x, pos.y, pos.z, &pos.z, false);
pBoat->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_ASTHECROWSWIMS;
@@ -1707,7 +1718,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
case COMMAND_BOAT_STOP:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
script_assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT);
CBoat* pBoat = (CBoat*)pVehicle;
@@ -1720,14 +1731,14 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
case COMMAND_IS_PLAYER_SHOOTING_IN_AREA:
{
CollectParameters(&m_nIp, 6);
- CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
script_assert(pPed);
- float x1 = *(float*)&ScriptParams[1];
- float y1 = *(float*)&ScriptParams[2];
- float x2 = *(float*)&ScriptParams[3];
- float y2 = *(float*)&ScriptParams[4];
+ float x1 = GET_FLOAT_PARAM(1);
+ float y1 = GET_FLOAT_PARAM(2);
+ float x2 = GET_FLOAT_PARAM(3);
+ float y2 = GET_FLOAT_PARAM(4);
UpdateCompareFlag(pPed->bIsShooting && pPed->IsWithinArea(x1, y1, x2, y2));
- if (ScriptParams[5])
+ if (GET_INTEGER_PARAM(5))
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT);
if (CTheScripts::DbgFlag)
CTheScripts::DrawDebugSquare(x1, y1, x2, y2);
@@ -1736,14 +1747,14 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
case COMMAND_IS_CHAR_SHOOTING_IN_AREA:
{
CollectParameters(&m_nIp, 6);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- float x1 = *(float*)&ScriptParams[1];
- float y1 = *(float*)&ScriptParams[2];
- float x2 = *(float*)&ScriptParams[3];
- float y2 = *(float*)&ScriptParams[4];
+ float x1 = GET_FLOAT_PARAM(1);
+ float y1 = GET_FLOAT_PARAM(2);
+ float x2 = GET_FLOAT_PARAM(3);
+ float y2 = GET_FLOAT_PARAM(4);
UpdateCompareFlag(pPed->bIsShooting && pPed->IsWithinArea(x1, y1, x2, y2));
- if (ScriptParams[5])
+ if (GET_INTEGER_PARAM(5))
CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT);
if (CTheScripts::DbgFlag)
CTheScripts::DrawDebugSquare(x1, y1, x2, y2);
@@ -1752,17 +1763,17 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
case COMMAND_IS_CURRENT_PLAYER_WEAPON:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
script_assert(pPed);
- UpdateCompareFlag(ScriptParams[1] == pPed->GetWeapon()->m_eWeaponType);
+ UpdateCompareFlag(GET_INTEGER_PARAM(1) == pPed->GetWeapon()->m_eWeaponType);
return 0;
}
case COMMAND_IS_CURRENT_CHAR_WEAPON:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- UpdateCompareFlag(ScriptParams[1] == pPed->GetWeapon()->m_eWeaponType);
+ UpdateCompareFlag(GET_INTEGER_PARAM(1) == pPed->GetWeapon()->m_eWeaponType);
return 0;
}
/*
@@ -1772,7 +1783,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
case COMMAND_ADD_POWER_PILL:
{
CollectParameters(&m_nIp, 3);
- CVector pos = *(CVector*)&ScriptParams[0];
+ CVector pos = GET_VECTOR_PARAM(0);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
CPacManPickups::GenerateOnePMPickUp(pos);
@@ -1782,23 +1793,22 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
case COMMAND_SET_BOAT_CRUISE_SPEED:
{
CollectParameters(&m_nIp, 2);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
script_assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT);
CBoat* pBoat = (CBoat*)pVehicle;
- pBoat->AutoPilot.m_nCruiseSpeed = *(float*)&ScriptParams[1];
+ pBoat->AutoPilot.m_nCruiseSpeed = GET_FLOAT_PARAM(1);
return 0;
}
- /*
case COMMAND_GET_RANDOM_CHAR_IN_AREA:
{
- CollectParameters(&m_nIp, 4);
+ CollectParameters(&m_nIp, 7);
int ped_handle = -1;
CVector pos = FindPlayerCoors();
- float x1 = *(float*)&ScriptParams[0];
- float y1 = *(float*)&ScriptParams[1];
- float x2 = *(float*)&ScriptParams[2];
- float y2 = *(float*)&ScriptParams[3];
+ float x1 = GET_FLOAT_PARAM(0);
+ float y1 = GET_FLOAT_PARAM(1);
+ float x2 = GET_FLOAT_PARAM(2);
+ float y2 = GET_FLOAT_PARAM(3);
int i = CPools::GetPedPool()->GetSize();
while (--i && ped_handle == -1){
CPed* pPed = CPools::GetPedPool()->GetSlot(i);
@@ -1814,9 +1824,9 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
continue;
if (pPed->bFadeOut)
continue;
-// if (pPed->GetModelIndex() == MI_SCUM_WOM || pPed->GetModelIndex() == MI_SCUM_MAN)
-// continue;
- if (!ThisIsAValidRandomPed(pPed->m_nPedType))
+ if (pPed->m_nWaitState != WAITSTATE_FALSE)
+ continue;
+ if (!ThisIsAValidRandomPed(pPed->m_nPedType, GET_INTEGER_PARAM(5), GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(7)))
continue;
if (pPed->bIsLeader || pPed->m_leader)
continue;
@@ -1834,11 +1844,10 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
if (m_bIsMissionScript)
CTheScripts::MissionCleanUp.AddEntityToList(ped_handle, CLEANUP_CHAR);
}
- ScriptParams[0] = ped_handle;
+ SET_INTEGER_PARAM(0, ped_handle);
StoreParameters(&m_nIp, 1);
return 0;
}
- */
case COMMAND_GET_RANDOM_CHAR_IN_ZONE:
{
char zone[KEY_LENGTH_IN_SCRIPT];
@@ -1867,7 +1876,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
continue;
if (pPed->m_nWaitState != WAITSTATE_FALSE)
continue;
- if (!ThisIsAValidRandomPed(pPed->m_nPedType, ScriptParams[0], ScriptParams[1], ScriptParams[2]))
+ if (!ThisIsAValidRandomPed(pPed->m_nPedType, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2)))
continue;
if (pPed->bIsLeader || pPed->m_leader)
continue;
@@ -1889,14 +1898,14 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
if (m_bIsMissionScript)
CTheScripts::MissionCleanUp.AddEntityToList(ped_handle, CLEANUP_CHAR);
}
- ScriptParams[0] = ped_handle;
+ SET_INTEGER_PARAM(0, ped_handle);
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_IS_PLAYER_IN_TAXI:
{
CollectParameters(&m_nIp, 1);
- CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
script_assert(pPed);
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->IsTaxi());
return 0;
@@ -1904,7 +1913,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
case COMMAND_IS_PLAYER_SHOOTING:
{
CollectParameters(&m_nIp, 1);
- CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
script_assert(pPed);
UpdateCompareFlag(pPed->bIsShooting);
return 0;
@@ -1912,7 +1921,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
case COMMAND_IS_CHAR_SHOOTING:
{
CollectParameters(&m_nIp, 1);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
UpdateCompareFlag(pPed->bIsShooting);
return 0;
@@ -1920,28 +1929,28 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
case COMMAND_CREATE_MONEY_PICKUP:
{
CollectParameters(&m_nIp, 4);
- CVector pos = *(CVector*)&ScriptParams[0];
+ CVector pos = GET_VECTOR_PARAM(0);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + PICKUP_PLACEMENT_OFFSET;
CPickups::GetActualPickupIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
- ScriptParams[0] = CPickups::GenerateNewOne(pos, MI_MONEY, PICKUP_MONEY, ScriptParams[3]);
+ SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, MI_MONEY, PICKUP_MONEY, GET_INTEGER_PARAM(3))); // MI_MONEY -> gpModelIndices[...]
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_SET_CHAR_ACCURACY:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- pPed->m_wepAccuracy = ScriptParams[1];
+ pPed->m_wepAccuracy = GET_INTEGER_PARAM(1) * 1.25f;
return 0;
}
case COMMAND_GET_CAR_SPEED:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- *(float*)&ScriptParams[0] = pVehicle->GetSpeed().Magnitude() * GAME_SPEED_TO_METERS_PER_SECOND;
+ SET_FLOAT_PARAM(0, pVehicle->GetSpeed().Magnitude() * GAME_SPEED_TO_METERS_PER_SECOND);
StoreParameters(&m_nIp, 1);
return 0;
}
@@ -1949,15 +1958,17 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
char name[KEY_LENGTH_IN_SCRIPT];
strncpy(name, (const char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT);
+ // unknown call FUN_29df68(name) on PS2
m_nIp += KEY_LENGTH_IN_SCRIPT;
+ CColStore::RemoveAllCollision();
CCutsceneMgr::LoadCutsceneData(name);
return 0;
}
case COMMAND_CREATE_CUTSCENE_OBJECT:
{
CollectParameters(&m_nIp, 1);
- CCutsceneObject* pCutObj = CCutsceneMgr::CreateCutsceneObject(ScriptParams[0]);
- ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pCutObj);
+ CCutsceneObject* pCutObj = CCutsceneMgr::CreateCutsceneObject(GET_INTEGER_PARAM(0));
+ SET_INTEGER_PARAM(0, CPools::GetObjectPool()->GetIndex(pCutObj));
StoreParameters(&m_nIp, 1);
return 0;
}
@@ -1965,7 +1976,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 1);
char name[KEY_LENGTH_IN_SCRIPT];
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pObject);
strncpy(name, (const char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT);
m_nIp += KEY_LENGTH_IN_SCRIPT;
@@ -1973,16 +1984,23 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
return 0;
}
case COMMAND_START_CUTSCENE:
- CCutsceneMgr::ms_cutsceneLoadStatus = 1;
+ CCutsceneMgr::StartCutscene();
return 0;
case COMMAND_GET_CUTSCENE_TIME:
- ScriptParams[0] = CCutsceneMgr::GetCutsceneTimeInMilleseconds();
+ SET_INTEGER_PARAM(0, CCutsceneMgr::GetCutsceneTimeInMilleseconds());
StoreParameters(&m_nIp, 1);
return 0;
case COMMAND_HAS_CUTSCENE_FINISHED:
- UpdateCompareFlag(CCutsceneMgr::HasCutsceneFinished());
+ {
+ bool bFinished = CCutsceneMgr::HasCutsceneFinished();
+ if (bFinished)
+ printf("cutscene has now finished\n");
+ UpdateCompareFlag(bFinished);
return 0;
+ }
case COMMAND_CLEAR_CUTSCENE:
+ // unknown call on PS2 FUN_29DFA0();
+ printf("clear cutscene\n");
CCutsceneMgr::DeleteCutsceneData();
return 0;
case COMMAND_RESTORE_CAMERA_JUMPCUT:
@@ -1991,37 +2009,37 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
case COMMAND_CREATE_COLLECTABLE1:
{
CollectParameters(&m_nIp, 3);
- CVector pos = *(CVector*)&ScriptParams[0];
+ CVector pos = GET_VECTOR_PARAM(0);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + PICKUP_PLACEMENT_OFFSET;
- CPickups::GenerateNewOne(pos, MI_COLLECTABLE1, PICKUP_COLLECTABLE1, 0);
+ CPickups::GenerateNewOne(pos, MI_COLLECTABLE1, PICKUP_COLLECTABLE1, 0); // TODO: gpModelIndices
return 0;
}
case COMMAND_SET_COLLECTABLE1_TOTAL:
CollectParameters(&m_nIp, 1);
- CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages = ScriptParams[0];
+ CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages = GET_INTEGER_PARAM(0);
return 0;
/*
case COMMAND_IS_PROJECTILE_IN_AREA:
{
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];
+ float infX = GET_FLOAT_PARAM(0);
+ float infY = GET_FLOAT_PARAM(1);
+ float infZ = GET_FLOAT_PARAM(2);
+ float supX = GET_FLOAT_PARAM(3);
+ float supY = GET_FLOAT_PARAM(4);
+ float supZ = GET_FLOAT_PARAM(5);
if (infX > supX) {
- infX = *(float*)&ScriptParams[3];
- supX = *(float*)&ScriptParams[0];
+ infX = GET_FLOAT_PARAM(3);
+ supX = GET_FLOAT_PARAM(0);
}
if (infY > supY) {
- infY = *(float*)&ScriptParams[4];
- supY = *(float*)&ScriptParams[1];
+ infY = GET_FLOAT_PARAM(4);
+ supY = GET_FLOAT_PARAM(1);
}
if (infZ > supZ) {
- infZ = *(float*)&ScriptParams[5];
- supZ = *(float*)&ScriptParams[2];
+ infZ = GET_FLOAT_PARAM(5);
+ supZ = GET_FLOAT_PARAM(2);
}
UpdateCompareFlag(CProjectileInfo::IsProjectileInRange(infX, supX, infY, supY, infZ, supZ, false));
if (CTheScripts::DbgFlag)
@@ -2031,23 +2049,23 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
case COMMAND_DESTROY_PROJECTILES_IN_AREA:
{
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];
+ float infX = GET_FLOAT_PARAM(0);
+ float infY = GET_FLOAT_PARAM(1);
+ float infZ = GET_FLOAT_PARAM(2);
+ float supX = GET_FLOAT_PARAM(3);
+ float supY = GET_FLOAT_PARAM(4);
+ float supZ = GET_FLOAT_PARAM(5);
if (infX > supX) {
- infX = *(float*)&ScriptParams[3];
- supX = *(float*)&ScriptParams[0];
+ infX = GET_FLOAT_PARAM(3);
+ supX = GET_FLOAT_PARAM(0);
}
if (infY > supY) {
- infY = *(float*)&ScriptParams[4];
- supY = *(float*)&ScriptParams[1];
+ infY = GET_FLOAT_PARAM(4);
+ supY = GET_FLOAT_PARAM(1);
}
if (infZ > supZ) {
- infZ = *(float*)&ScriptParams[5];
- supZ = *(float*)&ScriptParams[2];
+ infZ = GET_FLOAT_PARAM(5);
+ supZ = GET_FLOAT_PARAM(2);
}
UpdateCompareFlag(CProjectileInfo::IsProjectileInRange(infX, supX, infY, supY, infZ, supZ, true));
if (CTheScripts::DbgFlag)
@@ -2057,7 +2075,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
case COMMAND_DROP_MINE:
{
CollectParameters(&m_nIp, 3);
- CVector pos = *(CVector*)&ScriptParams[0];
+ CVector pos = GET_VECTOR_PARAM(0);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + PICKUP_PLACEMENT_OFFSET;
CPickups::GenerateNewOne(pos, MI_CARMINE, PICKUP_MINE_INACTIVE, 0);
@@ -2066,7 +2084,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
case COMMAND_DROP_NAUTICAL_MINE:
{
CollectParameters(&m_nIp, 3);
- CVector pos = *(CVector*)&ScriptParams[0];
+ CVector pos = GET_VECTOR_PARAM(0);
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + PICKUP_PLACEMENT_OFFSET;
CPickups::GenerateNewOne(pos, MI_NAUTICALMINE, PICKUP_MINE_INACTIVE, 0);
@@ -2076,9 +2094,9 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
case COMMAND_IS_CHAR_MODEL:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- UpdateCompareFlag(ScriptParams[1] == pPed->GetModelIndex());
+ UpdateCompareFlag(GET_INTEGER_PARAM(1) == pPed->GetModelIndex());
return 0;
}
case COMMAND_LOAD_SPECIAL_MODEL:
@@ -2088,7 +2106,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
strncpy(name, (const char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT);
for (int i = 0; i < KEY_LENGTH_IN_SCRIPT; i++)
name[i] = tolower(name[i]);
- CStreaming::RequestSpecialModel(ScriptParams[0], name, STREAMFLAGS_DEPENDENCY | STREAMFLAGS_SCRIPTOWNED);
+ CStreaming::RequestSpecialModel(GET_INTEGER_PARAM(0), name, STREAMFLAGS_DEPENDENCY | (m_bIsMissionScript ? STREAMFLAGS_SCRIPTOWNED : STREAMFLAGS_AMBIENT_SCRIPT_OWNED));
m_nIp += KEY_LENGTH_IN_SCRIPT;
return 0;
}
@@ -2096,102 +2114,98 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
//case COMMAND_SET_CUTSCENE_HEAD_ANIM:
case COMMAND_SIN:
CollectParameters(&m_nIp, 1);
- *(float*)&ScriptParams[0] = Sin(DEGTORAD(*(float*)&ScriptParams[0]));
+ SET_FLOAT_PARAM(0, Sin(DEGTORAD(GET_FLOAT_PARAM(0))));
StoreParameters(&m_nIp, 1);
return 0;
case COMMAND_COS:
CollectParameters(&m_nIp, 1);
- *(float*)&ScriptParams[0] = Cos(DEGTORAD(*(float*)&ScriptParams[0]));
+ SET_FLOAT_PARAM(0, Cos(DEGTORAD(GET_FLOAT_PARAM(0))));
StoreParameters(&m_nIp, 1);
return 0;
case COMMAND_GET_CAR_FORWARD_X:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
float forwardX = pVehicle->GetForward().x / pVehicle->GetForward().Magnitude2D();
- *(float*)&ScriptParams[0] = forwardX;
+ SET_FLOAT_PARAM(0, forwardX);
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_GET_CAR_FORWARD_Y:
{
CollectParameters(&m_nIp, 1);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
float forwardY = pVehicle->GetForward().y / pVehicle->GetForward().Magnitude2D();
- *(float*)&ScriptParams[0] = forwardY;
+ SET_FLOAT_PARAM(0, forwardY);
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_CHANGE_GARAGE_TYPE:
CollectParameters(&m_nIp, 2);
- CGarages::ChangeGarageType(ScriptParams[0], ScriptParams[1], 0);
+ CGarages::ChangeGarageType(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), 0);
return 0;
- /*
case COMMAND_ACTIVATE_CRUSHER_CRANE:
{
CollectParameters(&m_nIp, 10);
- float infX = *(float*)&ScriptParams[2];
- float infY = *(float*)&ScriptParams[3];
- float supX = *(float*)&ScriptParams[4];
- float supY = *(float*)&ScriptParams[5];
+ float infX = GET_FLOAT_PARAM(2);
+ float infY = GET_FLOAT_PARAM(3);
+ float supX = GET_FLOAT_PARAM(4);
+ float supY = GET_FLOAT_PARAM(5);
if (infX > supX) {
- infX = *(float*)&ScriptParams[4];
- supX = *(float*)&ScriptParams[2];
+ infX = GET_FLOAT_PARAM(4);
+ supX = GET_FLOAT_PARAM(2);
}
if (infY > supY) {
- infY = *(float*)&ScriptParams[5];
- supY = *(float*)&ScriptParams[3];
+ infY = GET_FLOAT_PARAM(5);
+ supY = GET_FLOAT_PARAM(3);
}
CCranes::ActivateCrane(infX, supX, infY, supY,
- *(float*)&ScriptParams[6], *(float*)&ScriptParams[7], *(float*)&ScriptParams[8],
- DEGTORAD(*(float*)&ScriptParams[9]), true, false,
- *(float*)&ScriptParams[0], *(float*)&ScriptParams[1]);
+ GET_FLOAT_PARAM(6), GET_FLOAT_PARAM(7), GET_FLOAT_PARAM(8),
+ DEGTORAD(GET_FLOAT_PARAM(9)), true, false,
+ GET_FLOAT_PARAM(0), GET_FLOAT_PARAM(1));
return 0;
}
case COMMAND_PRINT_WITH_2_NUMBERS:
{
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 4);
- CMessages::AddMessageWithNumber(text, ScriptParams[2], ScriptParams[3], ScriptParams[0], ScriptParams[1], -1, -1, -1, -1);
+ CMessages::AddMessageWithNumber(text, GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), -1, -1, -1, -1);
return 0;
}
- */
case COMMAND_PRINT_WITH_2_NUMBERS_NOW:
{
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 4);
- CMessages::AddMessageJumpQWithNumber(text, ScriptParams[2], ScriptParams[3], ScriptParams[0], ScriptParams[1], -1, -1, -1, -1);
+ CMessages::AddMessageJumpQWithNumber(text, GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), -1, -1, -1, -1);
return 0;
}
- /*
case COMMAND_PRINT_WITH_2_NUMBERS_SOON:
{
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 4);
- CMessages::AddMessageSoonWithNumber(text, ScriptParams[2], ScriptParams[3], ScriptParams[0], ScriptParams[1], -1, -1, -1, -1);
+ CMessages::AddMessageSoonWithNumber(text, GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), -1, -1, -1, -1);
return 0;
}
- */
case COMMAND_PRINT_WITH_3_NUMBERS:
{
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 5);
- CMessages::AddMessageWithNumber(text, ScriptParams[3], ScriptParams[4], ScriptParams[0], ScriptParams[1], ScriptParams[2], -1, -1, -1);
+ CMessages::AddMessageWithNumber(text, GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), -1, -1, -1);
return 0;
}
- /*
case COMMAND_PRINT_WITH_3_NUMBERS_NOW:
{
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 5);
- CMessages::AddMessageJumpQWithNumber(text, ScriptParams[3], ScriptParams[4], ScriptParams[0], ScriptParams[1], ScriptParams[2], -1, -1, -1);
+ CMessages::AddMessageJumpQWithNumber(text, GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), -1, -1, -1);
return 0;
}
+ /*
case COMMAND_PRINT_WITH_3_NUMBERS_SOON:
{
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 5);
- CMessages::AddMessageSoonWithNumber(text, ScriptParams[3], ScriptParams[4], ScriptParams[0], ScriptParams[1], ScriptParams[2], -1, -1, -1);
+ CMessages::AddMessageSoonWithNumber(text, GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), -1, -1, -1);
return 0;
}
*/
@@ -2199,7 +2213,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 6);
- CMessages::AddMessageWithNumber(text, ScriptParams[4], ScriptParams[5], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], -1, -1);
+ CMessages::AddMessageWithNumber(text, GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(5), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), -1, -1);
return 0;
}
/*
@@ -2207,35 +2221,35 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 6);
- CMessages::AddMessageJumpQWithNumber(text, ScriptParams[4], ScriptParams[5], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], -1, -1);
+ CMessages::AddMessageJumpQWithNumber(text, GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(5), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), -1, -1);
return 0;
}
case COMMAND_PRINT_WITH_4_NUMBERS_SOON:
{
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 6);
- CMessages::AddMessageSoonWithNumber(text, ScriptParams[4], ScriptParams[5], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], -1, -1);
+ CMessages::AddMessageSoonWithNumber(text, GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(5), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), -1, -1);
return 0;
}
case COMMAND_PRINT_WITH_5_NUMBERS:
{
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 7);
- CMessages::AddMessageWithNumber(text, ScriptParams[5], ScriptParams[6], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], ScriptParams[4], -1);
+ CMessages::AddMessageWithNumber(text, GET_INTEGER_PARAM(5), GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(4), -1);
return 0;
}
case COMMAND_PRINT_WITH_5_NUMBERS_NOW:
{
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 7);
- CMessages::AddMessageJumpQWithNumber(text, ScriptParams[5], ScriptParams[6], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], ScriptParams[4], -1);
+ CMessages::AddMessageJumpQWithNumber(text, GET_INTEGER_PARAM(5), GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(4), -1);
return 0;
}
case COMMAND_PRINT_WITH_5_NUMBERS_SOON:
{
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 7);
- CMessages::AddMessageSoonWithNumber(text, ScriptParams[5], ScriptParams[6], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], ScriptParams[4], -1);
+ CMessages::AddMessageSoonWithNumber(text, GET_INTEGER_PARAM(5), GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(4), -1);
return 0;
}
*/
@@ -2243,7 +2257,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 8);
- CMessages::AddMessageWithNumber(text, ScriptParams[6], ScriptParams[7], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], ScriptParams[4], ScriptParams[5]);
+ CMessages::AddMessageWithNumber(text, GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(7), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(5));
return 0;
}
/*
@@ -2251,71 +2265,69 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 8);
- CMessages::AddMessageJumpQWithNumber(text, ScriptParams[6], ScriptParams[7], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], ScriptParams[4], ScriptParams[5]);
+ CMessages::AddMessageJumpQWithNumber(text, GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(7), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(5));
return 0;
}
case COMMAND_PRINT_WITH_6_NUMBERS_SOON:
{
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 8);
- CMessages::AddMessageSoonWithNumber(text, ScriptParams[6], ScriptParams[7], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], ScriptParams[4], ScriptParams[5]);
+ CMessages::AddMessageSoonWithNumber(text, GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(7), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(5));
return 0;
}
+ */
case COMMAND_SET_CHAR_OBJ_FOLLOW_CHAR_IN_FORMATION:
{
CollectParameters(&m_nIp, 3);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ CPed* pTargetPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1));
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_FOLLOW_CHAR_IN_FORMATION, pTargetPed);
- pPed->SetFormation((eFormation)ScriptParams[2]);
+ pPed->SetFormation((eFormation)GET_INTEGER_PARAM(2));
return 0;
}
- */
case COMMAND_PLAYER_MADE_PROGRESS:
CollectParameters(&m_nIp, 1);
- CStats::ProgressMade += ScriptParams[0];
+ CStats::ProgressMade += GET_INTEGER_PARAM(0);
return 0;
case COMMAND_SET_PROGRESS_TOTAL:
CollectParameters(&m_nIp, 1);
- CStats::TotalProgressInGame = ScriptParams[0];
- if (CGame::germanGame)
- CStats::TotalProgressInGame -= 2;
+ CStats::TotalProgressInGame = GET_INTEGER_PARAM(0);
return 0;
case COMMAND_REGISTER_JUMP_DISTANCE:
CollectParameters(&m_nIp, 1);
- CStats::MaximumJumpDistance = Max(CStats::MaximumJumpDistance, *(float*)&ScriptParams[0]);
+ CStats::MaximumJumpDistance = Max(CStats::MaximumJumpDistance, GET_FLOAT_PARAM(0));
return 0;
case COMMAND_REGISTER_JUMP_HEIGHT:
CollectParameters(&m_nIp, 1);
- CStats::MaximumJumpHeight = Max(CStats::MaximumJumpHeight, *(float*)&ScriptParams[0]);
+ CStats::MaximumJumpHeight = Max(CStats::MaximumJumpHeight, GET_FLOAT_PARAM(0));
return 0;
case COMMAND_REGISTER_JUMP_FLIPS:
CollectParameters(&m_nIp, 1);
- CStats::MaximumJumpFlips = Max(CStats::MaximumJumpFlips, ScriptParams[0]);
+ CStats::MaximumJumpFlips = Max(CStats::MaximumJumpFlips, GET_INTEGER_PARAM(0));
return 0;
case COMMAND_REGISTER_JUMP_SPINS:
CollectParameters(&m_nIp, 1);
- CStats::MaximumJumpSpins = Max(CStats::MaximumJumpSpins, ScriptParams[0]);
+ CStats::MaximumJumpSpins = Max(CStats::MaximumJumpSpins, GET_INTEGER_PARAM(0));
return 0;
case COMMAND_REGISTER_JUMP_STUNT:
CollectParameters(&m_nIp, 1);
- CStats::BestStuntJump = Max(CStats::BestStuntJump, ScriptParams[0]);
+ CStats::BestStuntJump = Max(CStats::BestStuntJump, GET_INTEGER_PARAM(0));
return 0;
case COMMAND_REGISTER_UNIQUE_JUMP_FOUND:
++CStats::NumberOfUniqueJumpsFound;
return 0;
case COMMAND_SET_UNIQUE_JUMPS_TOTAL:
CollectParameters(&m_nIp, 1);
- CStats::TotalNumberOfUniqueJumps = ScriptParams[0];
+ CStats::TotalNumberOfUniqueJumps = GET_INTEGER_PARAM(0);
return 0;
case COMMAND_REGISTER_PASSENGER_DROPPED_OFF_TAXI:
++CStats::PassengersDroppedOffWithTaxi;
return 0;
case COMMAND_REGISTER_MONEY_MADE_TAXI:
CollectParameters(&m_nIp, 1);
- CStats::MoneyMadeWithTaxi += ScriptParams[0];
+ CStats::MoneyMadeWithTaxi += GET_INTEGER_PARAM(0);
return 0;
case COMMAND_REGISTER_MISSION_GIVEN:
++CStats::MissionsGiven;
@@ -2335,9 +2347,9 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
case COMMAND_SET_CHAR_RUNNING:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- pPed->bIsRunning = (ScriptParams[1] != 0);
+ pPed->bIsRunning = (GET_INTEGER_PARAM(1) != 0);
return 0;
}
case COMMAND_REMOVE_ALL_SCRIPT_FIRES:
@@ -2347,32 +2359,32 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
case COMMAND_IS_FIRST_CAR_COLOUR:
{
CollectParameters(&m_nIp, 2);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- UpdateCompareFlag(pVehicle->m_currentColour1 == ScriptParams[1]);
+ UpdateCompareFlag(pVehicle->m_currentColour1 == GET_INTEGER_PARAM(1));
return 0;
}
case COMMAND_IS_SECOND_CAR_COLOUR:
{
CollectParameters(&m_nIp, 2);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- UpdateCompareFlag(pVehicle->m_currentColour2 == ScriptParams[1]);
+ UpdateCompareFlag(pVehicle->m_currentColour2 == GET_INTEGER_PARAM(1));
return 0;
}
*/
case COMMAND_HAS_CHAR_BEEN_DAMAGED_BY_WEAPON:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
bool result = false;
if (!pPed)
printf("HAS_CHAR_BEEN_DAMAGED_BY_WEAPON - Character doesn't exist\n");
else {
- if (ScriptParams[1] == WEAPONTYPE_ANYMELEE || ScriptParams[1] == WEAPONTYPE_ANYWEAPON)
- result = CheckDamagedWeaponType(pPed->m_lastWepDam, ScriptParams[1]);
+ if (GET_INTEGER_PARAM(1) == WEAPONTYPE_ANYMELEE || GET_INTEGER_PARAM(1) == WEAPONTYPE_ANYWEAPON)
+ result = CheckDamagedWeaponType(pPed->m_lastWepDam, GET_INTEGER_PARAM(1));
else
- result = ScriptParams[1] == pPed->m_lastWepDam;
+ result = GET_INTEGER_PARAM(1) == pPed->m_lastWepDam;
}
UpdateCompareFlag(result);
return 0;
@@ -2380,15 +2392,15 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
case COMMAND_HAS_CAR_BEEN_DAMAGED_BY_WEAPON:
{
CollectParameters(&m_nIp, 2);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
bool result = false;
if (!pVehicle)
printf("HAS_CAR_BEEN_DAMAGED_BY_WEAPON - Vehicle doesn't exist\n");
else {
- if (ScriptParams[1] == WEAPONTYPE_ANYMELEE || ScriptParams[1] == WEAPONTYPE_ANYWEAPON)
- result = CheckDamagedWeaponType(pVehicle->m_nLastWeaponDamage, ScriptParams[1]);
+ if (GET_INTEGER_PARAM(1) == WEAPONTYPE_ANYMELEE || GET_INTEGER_PARAM(1) == WEAPONTYPE_ANYWEAPON)
+ result = CheckDamagedWeaponType(pVehicle->m_nLastWeaponDamage, GET_INTEGER_PARAM(1));
else
- result = ScriptParams[1] == pVehicle->m_nLastWeaponDamage;
+ result = GET_INTEGER_PARAM(1) == pVehicle->m_nLastWeaponDamage;
}
UpdateCompareFlag(result);
return 0;
@@ -2396,11 +2408,11 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
case COMMAND_IS_CHAR_IN_CHARS_GROUP:
{
CollectParameters(&m_nIp, 2);
- CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- CPed* pLeader = CPools::GetPedPool()->GetAt(ScriptParams[1]);
+ CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
+ CPed* pLeader = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1));
script_assert(pPed);
script_assert(pLeader);
- UpdateCompareFlag(pPed->m_leader == pLeader);
+ UpdateCompareFlag(pPed->m_leader == pLeader && !pPed->bWaitForLeaderToComeCloser);
return 0;
}
default:
diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp
index a8658532..1337605f 100644
--- a/src/control/Script4.cpp
+++ b/src/control/Script4.cpp
@@ -106,7 +106,10 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
printf("Couldn't find zone - %s\n", zone);
return 0;
}
- CTheZones::SetPedGroup(zone_id, ScriptParams[0], ScriptParams[1]);
+ while (zone_id >= 0) {
+ CTheZones::SetPedGroup(zone_id, ScriptParams[0], ScriptParams[1]);
+ zone_id = CTheZones::FindNextZoneByLabelAndReturnIndex(zone, ZONE_INFO);
+ }
return 0;
}
case COMMAND_START_CAR_FIRE:
@@ -954,7 +957,10 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
pPed->WarpPedIntoCar(pVehicle);
return 0;
}
- //case COMMAND_SWITCH_CAR_RADIO:
+ case COMMAND_SWITCH_CAR_RADIO:
+ CollectParameters(&m_nIp, 1);
+ DMAudio.ChangeMusicMode(ScriptParams[0]);
+ return 0;
//case COMMAND_SET_AUDIO_STREAM:
case COMMAND_PRINT_WITH_2_NUMBERS_BIG:
{
@@ -1354,11 +1360,13 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
CTxdStore::AddRef(slot);
return 0;
}
+ /*
case COMMAND_REMOVE_TEXTURE_DICTIONARY:
{
CTheScripts::RemoveScriptTextureDictionary();
return 0;
}
+ */
case COMMAND_SET_OBJECT_DYNAMIC:
{
CollectParameters(&m_nIp, 2);
@@ -1418,7 +1426,6 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
pVehicle->m_bSirenOrAlarm = ScriptParams[1] != 0;
return 0;
}
- /*
case COMMAND_SWITCH_PED_ROADS_ON_ANGLED:
{
CollectParameters(&m_nIp, 7);
@@ -1441,7 +1448,6 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
ThePaths.SwitchRoadsInAngledArea(*(float*)&ScriptParams[0], *(float*)&ScriptParams[1], *(float*)&ScriptParams[2],
*(float*)&ScriptParams[3], *(float*)&ScriptParams[4], *(float*)&ScriptParams[5], *(float*)&ScriptParams[6], 1, 0);
return 0;
- */
case COMMAND_SET_CAR_WATERTIGHT:
{
CollectParameters(&m_nIp, 2);
@@ -1781,7 +1787,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
*/
case COMMAND_DISPLAY_ONSCREEN_TIMER_WITH_STRING:
{
- script_assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR);
+ //script_assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR);
uint16 var = CTheScripts::Read2BytesFromScript(&m_nIp);
CollectParameters(&m_nIp, 1);
wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); // ???
@@ -1792,7 +1798,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
}
case COMMAND_DISPLAY_ONSCREEN_COUNTER_WITH_STRING:
{
- script_assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR);
+ //script_assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR);
uint16 var = CTheScripts::Read2BytesFromScript(&m_nIp);
CollectParameters(&m_nIp, 1);
wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); // ???
@@ -1967,12 +1973,10 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
CWorld::Add(car);
return 0;
}
- /*
case COMMAND_IS_COLLISION_IN_MEMORY:
CollectParameters(&m_nIp, 1);
UpdateCompareFlag(CCollision::ms_collisionInMemory == ScriptParams[0]);
return 0;
- */
case COMMAND_SET_WANTED_MULTIPLIER:
CollectParameters(&m_nIp, 1);
FindPlayerPed()->m_pWanted->m_fCrimeSensitivity = *(float*)&ScriptParams[0];
@@ -2042,7 +2046,8 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
case COMMAND_HAS_MISSION_AUDIO_LOADED:
{
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(DMAudio.GetMissionAudioLoadingStatus(ScriptParams[0] - 1) == 1);
+ //UpdateCompareFlag(DMAudio.GetMissionAudioLoadingStatus(ScriptParams[0] - 1) == 1);
+ UpdateCompareFlag(true); // TODO
return 0;
}
case COMMAND_PLAY_MISSION_AUDIO:
@@ -2052,7 +2057,8 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
case COMMAND_HAS_MISSION_AUDIO_FINISHED:
{
CollectParameters(&m_nIp, 1);
- UpdateCompareFlag(DMAudio.IsMissionAudioSampleFinished(ScriptParams[0] - 1));
+ //UpdateCompareFlag(DMAudio.IsMissionAudioSampleFinished(ScriptParams[0] - 1)); // TODO
+ UpdateCompareFlag(true);
return 0;
}
case COMMAND_GET_CLOSEST_CAR_NODE_WITH_HEADING:
diff --git a/src/control/Script5.cpp b/src/control/Script5.cpp
index f970cf89..c0e3ecad 100644
--- a/src/control/Script5.cpp
+++ b/src/control/Script5.cpp
@@ -2531,7 +2531,7 @@ int CTheScripts::FindFreeSlotInCollectiveArray()
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) {
+ if (CollectiveArray[i].colIndex == colIndex) {
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
if (pPed == nil) {
CollectiveArray[i].colIndex = -1;
@@ -2548,7 +2548,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
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) {
+ if (CollectiveArray[i].colIndex == colIndex) {
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
if (pPed == nil) {
CollectiveArray[i].colIndex = -1;
@@ -2565,7 +2565,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1)
{
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
- if (CollectiveArray[i].colIndex = colIndex) {
+ if (CollectiveArray[i].colIndex == colIndex) {
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
if (pPed == nil) {
CollectiveArray[i].colIndex = -1;
@@ -2582,7 +2582,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, void* p1)
{
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
- if (CollectiveArray[i].colIndex = colIndex) {
+ if (CollectiveArray[i].colIndex == colIndex) {
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
if (pPed == nil) {
CollectiveArray[i].colIndex = -1;
@@ -2599,7 +2599,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective)
{
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
- if (CollectiveArray[i].colIndex = colIndex) {
+ if (CollectiveArray[i].colIndex == colIndex) {
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
if (pPed == nil) {
CollectiveArray[i].colIndex = -1;
@@ -2740,6 +2740,9 @@ void CTheScripts::ReadObjectNamesFromScript()
{
int32 varSpace = GetSizeOfVariableSpace();
uint32 ip = varSpace + 8;
+ NumSaveVars = Read4BytesFromScript(&ip);
+ SavedVarIndices = (short*)&ScriptParams[ip];
+ ip += 2 * NumSaveVars;
NumberOfUsedObjects = Read2BytesFromScript(&ip);
ip += 2;
for (uint16 i = 0; i < NumberOfUsedObjects; i++) {
@@ -2751,30 +2754,16 @@ void CTheScripts::ReadObjectNamesFromScript()
void CTheScripts::UpdateObjectIndices()
{
- char name[USED_OBJECT_NAME_LENGTH];
char error[112];
for (int i = 1; i < NumberOfUsedObjects; i++) {
- bool found = false;
- for (int j = 0; j < MODELINFOSIZE && !found; j++) {
- CBaseModelInfo* pModel = CModelInfo::GetModelInfo(j);
- if (!pModel)
- continue;
- strcpy(name, pModel->GetModelName());
-#ifdef FIX_BUGS
- for (int k = 0; k < USED_OBJECT_NAME_LENGTH && name[k]; k++)
-#else
- for (int k = 0; k < USED_OBJECT_NAME_LENGTH; k++)
-#endif
- name[k] = toupper(name[k]);
- if (strcmp(name, UsedObjectArray[i].name) == 0) {
- found = true;
- UsedObjectArray[i].index = j;
- }
- }
- if (!found) {
+ UsedObjectArray[i].index = -1;
+ CModelInfo::GetModelInfo(UsedObjectArray[i].name, &UsedObjectArray[i].index);
+#ifndef FINAL
+ if (UsedObjectArray[i].index == -1) {
sprintf(error, "CTheScripts::UpdateObjectIndices - Couldn't find %s", UsedObjectArray[i].name);
debug("%s\n", error);
}
+#endif
}
}
@@ -2784,7 +2773,8 @@ void CTheScripts::ReadMultiScriptFileOffsetsFromScript()
uint32 ip = varSpace + 3;
int32 objectSize = Read4BytesFromScript(&ip);
ip = objectSize + 8;
- MainScriptSize = Read4BytesFromScript(&ip);
+ NumTrueGlobals = Read2BytesFromScript(&ip);
+ MostGlobals = Read2BytesFromScript(&ip);
LargestMissionScriptSize = Read4BytesFromScript(&ip);
NumberOfMissionScripts = Read2BytesFromScript(&ip);
NumberOfExclusiveMissionScripts = Read2BytesFromScript(&ip);
diff --git a/src/control/Script6.cpp b/src/control/Script6.cpp
index 76780941..02427eed 100644
--- a/src/control/Script6.cpp
+++ b/src/control/Script6.cpp
@@ -83,7 +83,6 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
switch (command) {
//case COMMAND_FLASH_RADAR_BLIP:
- /*
case COMMAND_IS_CHAR_IN_CONTROL:
{
CollectParameters(&m_nIp, 1);
@@ -91,7 +90,6 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
UpdateCompareFlag(pPed->IsPedInControl());
return 0;
}
- */
case COMMAND_SET_GENERATE_CARS_AROUND_CAMERA:
CollectParameters(&m_nIp, 1);
CCarCtrl::bCarsGeneratedAroundCamera = (ScriptParams[0] != 0);
@@ -374,32 +372,30 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 1);
- if (CTheScripts::NumberOfExclusiveMissionScripts > 0 && ScriptParams[0] <= UINT16_MAX - 2)
- return 0;
+ if (CTheScripts::NumberOfExclusiveMissionScripts > 0) {
+ if (ScriptParams[0] < UINT16_MAX - 1)
+ return 0;
+ ScriptParams[0] = UINT16_MAX - ScriptParams[0];
+ }
#ifdef MISSION_REPLAY
missionRetryScriptIndex = ScriptParams[0];
if (missionRetryScriptIndex == 19)
CStats::LastMissionPassedName[0] = '\0';
#endif
CTimer::Suspend();
- int offset = CTheScripts::MultiScriptArray[ScriptParams[0]];
-#ifdef USE_DEBUG_SCRIPT_LOADER
- CFileMgr::ChangeDir("\\data\\");
- int handle = CFileMgr::OpenFile(scriptfile, "rb");
- CFileMgr::ChangeDir("\\");
-#else
- CFileMgr::ChangeDir("\\");
- int handle = CFileMgr::OpenFile("data\\main.scm", "rb");
-#endif
- CFileMgr::Seek(handle, offset, 0);
- CFileMgr::Read(handle, (const char*)&CTheScripts::ScriptSpace[SIZE_MAIN_SCRIPT], SIZE_MISSION_SCRIPT);
- CFileMgr::CloseFile(handle);
- CRunningScript* pMissionScript = CTheScripts::StartNewScript(SIZE_MAIN_SCRIPT);
+ int offset = CTheScripts::MultiScriptArray[ScriptParams[0]] + 8;
+ int size = CTheScripts::MultiScriptArray[ScriptParams[0] + 1] - CTheScripts::MultiScriptArray[ScriptParams[0]];
+ if (size <= 0)
+ size = CTheScripts::LargestMissionScriptSize;
+ CFileMgr::Seek(gScriptsFile, offset, 0);
+ CFileMgr::Read(gScriptsFile, (const char*)&CTheScripts::ScriptSpace[CTheScripts::MainScriptSize], size); // TODO
+ CRunningScript* pMissionScript = CTheScripts::StartNewScript(CTheScripts::MainScriptSize);
CTimer::Resume();
pMissionScript->m_bIsMissionScript = true;
pMissionScript->m_bMissionFlag = true;
CTheScripts::bAlreadyRunningAMissionScript = true;
- CGameLogic::ClearShortCut();
+ memset(&CTheScripts::ScriptSpace[CTheScripts::NumTrueGlobals * 4 + 8], 0, CTheScripts::MostGlobals * 4);
+ pMissionScript->Process();
return 0;
}
case COMMAND_SET_OBJECT_DRAW_LAST:
@@ -527,7 +523,6 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
StoreParameters(&m_nIp, 1);
return 0;
}
- /*
case COMMAND_MARK_ROADS_BETWEEN_LEVELS:
{
CollectParameters(&m_nIp, 6);
@@ -576,7 +571,6 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
ThePaths.PedMarkRoadsBetweenLevelsInArea(infX, supX, infY, supY, infZ, supZ);
return 0;
}
- */
case COMMAND_SET_CAR_AVOID_LEVEL_TRANSITIONS:
{
CollectParameters(&m_nIp, 2);
diff --git a/src/control/Script7.cpp b/src/control/Script7.cpp
index 5a70fd28..b3f16106 100644
--- a/src/control/Script7.cpp
+++ b/src/control/Script7.cpp
@@ -540,7 +540,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
case COMMAND_DISPLAY_NTH_ONSCREEN_COUNTER_WITH_STRING:
{
char onscreen_str[12];
- script_assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR);
+ //script_assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR);
uint16 var = CTheScripts::Read2BytesFromScript(&m_nIp);
CollectParameters(&m_nIp, 2);
wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); // ???
@@ -816,7 +816,12 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
//case COMMAND_HAS_CHAR_BEEN_DAMAGED_BY_CAR:
//case COMMAND_HAS_CAR_BEEN_DAMAGED_BY_CHAR:
//case COMMAND_HAS_CAR_BEEN_DAMAGED_BY_CAR:
- //case COMMAND_GET_RADIO_CHANNEL:
+ case COMMAND_GET_RADIO_CHANNEL:
+ {
+ // TODO
+ ScriptParams[0] = -1;
+ StoreParameters(&m_nIp, 1);
+ }
//case COMMAND_DISPLAY_TEXT_WITH_3_NUMBERS:
//case COMMAND_IS_CAR_DROWNING_IN_WATER:
case COMMAND_IS_CHAR_DROWNING_IN_WATER:
@@ -1013,7 +1018,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
return 0;
case COMMAND_REMOVE_EVERYTHING_FOR_HUGE_CUTSCENE:
{
- CCutsceneMgr::RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver();
+ //CCutsceneMgr::RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver();
return 0;
}
case COMMAND_IS_PLAYER_TOUCHING_VEHICLE:
@@ -1327,7 +1332,19 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
CollectParameters(&m_nIp, 1);
UpdateCompareFlag(CPools::GetPedPool()->GetAt(ScriptParams[0]) != 0);
return 0;
- //case COMMAND_DOES_VEHICLE_EXIST:
+ case COMMAND_DOES_VEHICLE_EXIST:
+ {
+ // TODO
+ CollectParameters(&m_nIp, 1);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ bool bExist = false;
+ if (pVehicle) {
+ int index = CPools::GetVehiclePool()->GetJustIndex_NoFreeAssert(pVehicle);
+ bExist = (index >= 0 && index <= NUMVEHICLES); // TODO: FIX_BUGS
+ }
+ UpdateCompareFlag(bExist);
+ return 0;
+ }
//case COMMAND_ADD_SHORT_RANGE_BLIP_FOR_CONTACT_POINT:
case COMMAND_ADD_SHORT_RANGE_SPRITE_BLIP_FOR_CONTACT_POINT:
{
diff --git a/src/control/Script8.cpp b/src/control/Script8.cpp
index 74552b23..2f52b150 100644
--- a/src/control/Script8.cpp
+++ b/src/control/Script8.cpp
@@ -77,7 +77,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
case COMMAND_PLAY_ANNOUNCEMENT:
{
CollectParameters(&m_nIp, 1);
- DMAudio.PlayRadioAnnouncement(ScriptParams[0] + STREAMED_SOUND_ANNOUNCE_BRIDGE_CLOSED);
+ DMAudio.PlayRadioAnnouncement(ScriptParams[0] + STREAMED_SOUND_NEWS_A);
return 0;
}
case COMMAND_SET_PLAYER_IS_IN_STADIUM:
@@ -384,7 +384,6 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
}
return 0;
}
-#if (defined GTAVC_JP_PATCH || defined SUPPORT_JAPANESE_SCRIPT)
case COMMAND_IS_JAPANESE_GAME:
#ifdef MORE_LANGUAGES
UpdateCompareFlag(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_JAPANESE);
@@ -394,218 +393,728 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
UpdateCompareFlag(false);
#endif
return 0;
-#elif (!defined GTA_PS2)
- case COMMAND_SET_ONSCREEN_COUNTER_FLASH_WHEN_FIRST_DISPLAYED:
- script_assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR);
- uint16 var = CTheScripts::Read2BytesFromScript(&m_nIp);
+ case COMMAND_1442:
+ script_assert(false);
+ return 0;
+ case COMMAND_1443:
+ script_assert(false);
+ return 0;
+ case COMMAND_1444:
+ script_assert(false);
+ return 0;
+ case COMMAND_1445:
+ script_assert(false);
+ return 0;
+ case COMMAND_1446:
+ script_assert(false);
+ return 0;
+ case COMMAND_1447:
+ script_assert(false);
+ return 0;
+ case COMMAND_1448:
+ script_assert(false);
+ return 0;
+ case COMMAND_1449:
+ script_assert(false);
+ return 0;
+ case COMMAND_1450:
+ script_assert(false);
+ return 0;
+ case COMMAND_1451:
CollectParameters(&m_nIp, 1);
- //CUserDisplay::OnscnTimer.SetCounterFlashWhenFirstDisplayed(var, ScriptParams[0]);
- break;
-#endif
-#if (defined GTA_PC && !defined GTAVC_JP_PATCH || defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT)
- case COMMAND_SHUFFLE_CARD_DECKS:
+ // TODO (GET_PAD_BUTTON_STATE)
+ ScriptParams[0] = 0;
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ case COMMAND_1452:
+ script_assert(false);
+ return 0;
+ case COMMAND_1453:
+ script_assert(false);
+ return 0;
+ case COMMAND_CALL:
+ case COMMAND_NOTCALL:
{
+ m_anStack[m_nStackPointer++] = m_nIp | BIT(STACKVALUE_IS_FUNCTION_CALL_BIT) | ((command == COMMAND_NOTCALL) ? BIT(STACKVALUE_INVERT_RETURN_BIT) : 0);
+ uint8 nInputParams = CTheScripts::Read1ByteFromScript(&m_nIp);
+ uint8 nOutputParameters = CTheScripts::Read1ByteFromScript(&m_nIp);
+ uint8 nLocalsOffset = CTheScripts::Read1ByteFromScript(&m_nIp);
+ uint32 nIPBeforeParameters = m_nIp;
CollectParameters(&m_nIp, 1);
- script_assert(ScriptParams[0] >= 0 && ScriptParams[0] <= 6);
- for (int i = 0; i < CARDS_IN_STACK; i++)
- CTheScripts::CardStack[i] = 0;
- int16 seq[CARDS_IN_STACK];
- for (int i = 0; i < MAX_DECKS * CARDS_IN_DECK; i++)
- seq[i] = i;
- int cards_left = CARDS_IN_DECK * ScriptParams[0];
- for (int k = 1; k < CARDS_IN_DECK + 1; k++) {
- for (int deck = 0; deck < ScriptParams[0]; deck++) {
- int index = CGeneral::GetRandomNumberInRange(0, cards_left);
- CTheScripts::CardStack[seq[index]] = k;
- for (int l = index; l < cards_left; l++) {
- if (l + 1 < CARDS_IN_STACK)
- seq[l] = seq[l + 1];
- else
- seq[l] = 0;
- }
- --cards_left;
- }
- }
- CTheScripts::CardStackPosition = 0;
+ if (nInputParams)
+ CollectParameters(&m_nIp, nInputParams, &m_anLocalVariables[m_nLocalsPointer + nLocalsOffset]);
+ m_nLocalsPointer += nLocalsOffset;
+ m_anStack[m_nStackPointer - 1] |= (m_nIp - nIPBeforeParameters) << STACKVALUE_IP_PARAMS_OFFSET;
+ if (ScriptParams[0] < 0)
+ m_nIp = CTheScripts::MainScriptSize - ScriptParams[0];
+ else
+ m_nIp = ScriptParams[0];
return 0;
}
- case COMMAND_FETCH_NEXT_CARD:
- {
- if (CTheScripts::CardStack[CTheScripts::CardStackPosition] == 0)
- CTheScripts::CardStackPosition = 0;
- ScriptParams[0] = CTheScripts::CardStack[CTheScripts::CardStackPosition++];
- if (CTheScripts::CardStackPosition == CARDS_IN_DECK * MAX_DECKS)
- CTheScripts::CardStackPosition = 0;
- StoreParameters(&m_nIp, 1);
+ case COMMAND_1456:
+ script_assert(false);
+ return 0;
+ case COMMAND_1457:
+ script_assert(false);
+ return 0;
+ case COMMAND_1458:
+ script_assert(false);
+ return 0;
+ case COMMAND_1459:
+ script_assert(false);
+ return 0;
+ case COMMAND_1460:
+ script_assert(false);
+ return 0;
+ case COMMAND_1461:
+ script_assert(false);
+ return 0;
+ case COMMAND_1462:
+ script_assert(false);
+ return 0;
+ case COMMAND_1463:
+ script_assert(false);
+ return 0;
+ case COMMAND_1464:
+ script_assert(false);
+ return 0;
+ case COMMAND_1465:
+ script_assert(false);
+ return 0;
+ case COMMAND_1466:
+ script_assert(false);
+ return 0;
+ case COMMAND_1467:
+ script_assert(false);
+ return 0;
+ case COMMAND_1468:
+ script_assert(false);
+ return 0;
+ case COMMAND_1469:
+ script_assert(false);
+ return 0;
+ case COMMAND_1470:
+ script_assert(false);
return 0;
+ case COMMAND_1471:
+ script_assert(false);
+ return 0;
+ case COMMAND_1472:
+ script_assert(false);
+ return 0;
+ case COMMAND_1473:
+ script_assert(false);
+ return 0;
+ case COMMAND_1474:
+ script_assert(false);
+ return 0;
+ case COMMAND_1475:
+ script_assert(false);
+ return 0;
+ case COMMAND_1476:
+ script_assert(false);
+ return 0;
+ case COMMAND_1477:
+ script_assert(false);
+ return 0;
+ case COMMAND_1478:
+ script_assert(false);
+ return 0;
+ case COMMAND_1479:
+ CollectParameters(&m_nIp, 2);
+ // TODO (SET_CHAR_ONLY_ENTER_BACK_DOOR)
+ return 0;
+ case COMMAND_1480:
+ script_assert(false);
+ return 0;
+ case COMMAND_1481:
+ script_assert(false);
+ return 0;
+ case COMMAND_1482:
+ script_assert(false);
+ return 0;
+ case COMMAND_1483:
+ script_assert(false);
+ return 0;
+ case COMMAND_1484:
+ script_assert(false);
+ return 0;
+ case COMMAND_1485:
+ script_assert(false);
+ return 0;
+ case COMMAND_1486:
+ script_assert(false);
+ return 0;
+ case COMMAND_1487:
+ script_assert(false);
+ return 0;
+ case COMMAND_1488:
+ script_assert(false);
+ return 0;
+ case COMMAND_1489:
+ script_assert(false);
+ return 0;
+ case COMMAND_1490:
+ script_assert(false);
+ return 0;
+ case COMMAND_1491:
+ script_assert(false);
+ return 0;
+ case COMMAND_1492:
+ script_assert(false);
+ return 0;
+ case COMMAND_1493:
+ script_assert(false);
+ return 0;
+ case COMMAND_1494:
+ script_assert(false);
+ return 0;
+ case COMMAND_1495:
+ script_assert(false);
+ return 0;
+ case COMMAND_1496:
+ script_assert(false);
+ return 0;
+ case COMMAND_1497:
+ script_assert(false);
+ return 0;
+ case COMMAND_1498:
+ script_assert(false);
+ return 0;
+ case COMMAND_1499:
+ script_assert(false);
+ return 0;
+ default:
+ script_assert(0);
}
- case COMMAND_GET_OBJECT_VELOCITY:
- {
+ return -1;
+}
+
+int8 CRunningScript::ProcessCommands1500To1599(int32 command)
+{
+ switch (command) {
+ case COMMAND_1500:
+ script_assert(false);
+ return 0;
+ case COMMAND_1501:
+ script_assert(false);
+ return 0;
+ case COMMAND_1502:
+ script_assert(false);
+ return 0;
+ case COMMAND_1503:
+ script_assert(false);
+ return 0;
+ case COMMAND_1504:
+ script_assert(false);
+ return 0;
+ case COMMAND_1505:
+ script_assert(false);
+ return 0;
+ case COMMAND_1506:
+ script_assert(false);
+ return 0;
+ case COMMAND_1507:
+ script_assert(false);
+ return 0;
+ case COMMAND_1508:
+ script_assert(false);
+ return 0;
+ case COMMAND_1509:
+ script_assert(false);
+ return 0;
+ case COMMAND_1510:
+ script_assert(false);
+ return 0;
+ case COMMAND_1511:
+ script_assert(false);
+ return 0;
+ case COMMAND_1512:
+ script_assert(false);
+ return 0;
+ case COMMAND_1513:
+ script_assert(false);
+ return 0;
+ case COMMAND_1514:
+ script_assert(false);
+ return 0;
+ case COMMAND_1515:
+ script_assert(false);
+ return 0;
+ case COMMAND_1516:
+ script_assert(false);
+ return 0;
+ case COMMAND_1517:
+ script_assert(false);
+ return 0;
+ case COMMAND_1518:
+ // TODO (?)
+ UpdateCompareFlag(true);
+ return 0;
+ case COMMAND_1519:
CollectParameters(&m_nIp, 1);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- *(CVector*)&ScriptParams[0] = GAME_SPEED_TO_METERS_PER_SECOND * pObject->GetMoveSpeed();
- StoreParameters(&m_nIp, 3);
+ // TODO (SET_NUMBER_USJ_FOUND?)
return 0;
- }
- case COMMAND_IS_DEBUG_CAMERA_ON:
- UpdateCompareFlag(TheCamera.WorldViewerBeingUsed);
+ case COMMAND_1520:
+ CollectParameters(&m_nIp, 1);
+ // TODO (SET_TOTAL_HIDDEN_PACKAGES?)
return 0;
- case COMMAND_ADD_TO_OBJECT_ROTATION_VELOCITY:
- {
- CollectParameters(&m_nIp, 4);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- CVector newSpeed = pObject->GetTurnSpeed() + *(CVector*)&ScriptParams[1] / GAME_SPEED_TO_METERS_PER_SECOND;
- if (pObject->bIsStatic) {
- pObject->SetIsStatic(false);
- pObject->AddToMovingList();
- }
- pObject->SetTurnSpeed(newSpeed.x, newSpeed.y, newSpeed.z);
+ case COMMAND_1521:
+ script_assert(false);
return 0;
- }
- case COMMAND_SET_OBJECT_ROTATION_VELOCITY:
- {
- CollectParameters(&m_nIp, 4);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- CVector newSpeed = *(CVector*)&ScriptParams[1] / GAME_SPEED_TO_METERS_PER_SECOND;
- if (pObject->bIsStatic) {
- pObject->SetIsStatic(false);
- pObject->AddToMovingList();
- }
- pObject->SetTurnSpeed(newSpeed.x, newSpeed.y, newSpeed.z);
+ case COMMAND_1522:
+ script_assert(false);
return 0;
- }
- case COMMAND_IS_OBJECT_STATIC:
- {
+ case COMMAND_1523:
+ script_assert(false);
+ return 0;
+ case COMMAND_1524:
+ script_assert(false);
+ return 0;
+ case COMMAND_1525:
+ script_assert(false);
+ return 0;
+ case COMMAND_1526:
+ script_assert(false);
+ return 0;
+ case COMMAND_1527:
+ script_assert(false);
+ return 0;
+ case COMMAND_1528:
+ script_assert(false);
+ return 0;
+ case COMMAND_1529:
+ script_assert(false);
+ return 0;
+ case COMMAND_1530:
+ script_assert(false);
+ return 0;
+ case COMMAND_1531:
+ script_assert(false);
+ return 0;
+ case COMMAND_1532:
+ script_assert(false);
+ return 0;
+ case COMMAND_1533:
+ script_assert(false);
+ return 0;
+ case COMMAND_1534:
+ script_assert(false);
+ return 0;
+ case COMMAND_1535:
+ script_assert(false);
+ return 0;
+ case COMMAND_1536:
+ script_assert(false);
+ return 0;
+ case COMMAND_1537:
+ script_assert(false);
+ return 0;
+ case COMMAND_1538:
+ script_assert(false);
+ return 0;
+ case COMMAND_1539:
+ //TODO (REGISTER_OUTFIT_CHANGE)
+ return 0;
+ case COMMAND_1540:
+ script_assert(false);
+ return 0;
+ case COMMAND_1541:
+ script_assert(false);
+ return 0;
+ case COMMAND_1542:
+ script_assert(false);
+ return 0;
+ case COMMAND_1543:
+ script_assert(false);
+ return 0;
+ case COMMAND_1544:
+ script_assert(false);
+ return 0;
+ case COMMAND_1545:
+ script_assert(false);
+ return 0;
+ case COMMAND_1546:
+ script_assert(false);
+ return 0;
+ case COMMAND_1547:
+ script_assert(false);
+ return 0;
+ case COMMAND_1548:
+ // TODO (GET_ONFOOT_CAMERA_MODE)
+ ScriptParams[0] = 0;
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ case COMMAND_1549:
CollectParameters(&m_nIp, 1);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- UpdateCompareFlag(pObject->GetIsStatic());
+ // TODO (SET_ONFOOT_CAMERA_MODE?)
return 0;
- }
- case COMMAND_GET_ANGLE_BETWEEN_2D_VECTORS:
+ case COMMAND_1550:
+ script_assert(false);
+ return 0;
+ case COMMAND_1551:
+ script_assert(false);
+ return 0;
+ case COMMAND_1552:
+ script_assert(false);
+ return 0;
+ case COMMAND_1553:
+ script_assert(false);
+ return 0;
+ case COMMAND_1554:
+ script_assert(false);
+ return 0;
+ case COMMAND_1555:
+ CollectParameters(&m_nIp, 1);
+ // TODO (FREEZE_ONFOOT_CAMERA_MODE?)
+ return 0;
+ case COMMAND_1556:
+ script_assert(false);
+ return 0;
+ case COMMAND_1557:
+ script_assert(false);
+ return 0;
+ case COMMAND_1558:
+ UpdateCompareFlag(false);
+ // TODO
+ return 0;
+ case COMMAND_1559:
+ script_assert(false);
+ return 0;
+ case COMMAND_1560:
+ // TODO (IS_E3_BUILD?)
+ UpdateCompareFlag(false);
+ return 0;
+ case COMMAND_1561:
+ // TODO (check, SET_FS_DESTROYED_FLAG)
+ CTheScripts::FSDestroyedFlag = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) - (int32*)CTheScripts::ScriptSpace;
+ return 0;
+ case COMMAND_1562:
+ script_assert(false);
+ return 0;
+ case COMMAND_1563:
+ script_assert(false);
+ return 0;
+ case COMMAND_1564:
+ script_assert(false);
+ return 0;
+ case COMMAND_1565:
+ script_assert(false);
+ return 0;
+ case COMMAND_1566:
+ script_assert(false);
+ return 0;
+ case COMMAND_1567:
+ CollectParameters(&m_nIp, 1);
+ // TODO (BUILD_WORLD_GEOMETRY)
+ return 0;
+ case COMMAND_1568:
+ script_assert(false);
+ return 0;
+ case COMMAND_1569:
+ // TODO (IS_MULTIPLAYER_ACTIVE?)
+ UpdateCompareFlag(false);
+ return 0;
+ case COMMAND_1570:
+ script_assert(false);
+ return 0;
+ case COMMAND_1571:
+ script_assert(false);
+ return 0;
+ case COMMAND_1572:
+ script_assert(false);
+ return 0;
+ case COMMAND_1573:
+ script_assert(false);
+ return 0;
+ case COMMAND_1574:
+ script_assert(false);
+ return 0;
+ case COMMAND_1575:
+ script_assert(false);
+ return 0;
+ case COMMAND_1576:
+ script_assert(false);
+ return 0;
+ case COMMAND_1577:
+ script_assert(false);
+ return 0;
+ case COMMAND_1578:
+ script_assert(false);
+ return 0;
+ case COMMAND_1579:
+ script_assert(false);
+ return 0;
+ case COMMAND_1580:
+ script_assert(false);
+ return 0;
+ case COMMAND_1581:
{
- CollectParameters(&m_nIp, 4);
- CVector2D v1 = *(CVector2D*)&ScriptParams[0];
- CVector2D v2 = *(CVector2D*)&ScriptParams[2];
- float c = DotProduct2D(v1, v2) / (v1.Magnitude() * v2.Magnitude());
-#ifdef FIX_BUGS // command is a SA leftover where it was fixed to this
- *(float*)&ScriptParams[0] = RADTODEG(Acos(c));
-#else
- *(float*)&ScriptParams[0] = Acos(c);
-#endif
+ // TODO (SET_HELP_MESSAGE?)
+ wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp);
return 0;
}
- case COMMAND_DO_2D_RECTANGLES_COLLIDE:
- {
- CollectParameters(&m_nIp, 8);
- float infX1 = *(float*)&ScriptParams[0] - *(float*)&ScriptParams[2] * 0.5; // NB: not float
- float supX1 = *(float*)&ScriptParams[0] + *(float*)&ScriptParams[2] * 0.5;
- float infX2 = *(float*)&ScriptParams[4] - *(float*)&ScriptParams[6] * 0.5;
- float supX2 = *(float*)&ScriptParams[4] + *(float*)&ScriptParams[6] * 0.5;
- float infY1 = *(float*)&ScriptParams[1] - *(float*)&ScriptParams[3] * 0.5;
- float supY1 = *(float*)&ScriptParams[1] + *(float*)&ScriptParams[3] * 0.5;
- float infY2 = *(float*)&ScriptParams[5] - *(float*)&ScriptParams[7] * 0.5;
- float supY2 = *(float*)&ScriptParams[5] + *(float*)&ScriptParams[7] * 0.5;
- bool collide = true;
- if (infY2 > supY1)
- collide = false;
- if (infY1 > supY2)
- collide = false;
- if (infX2 > supX1)
- collide = false;
- if (infX1 > supX2)
- collide = false;
- UpdateCompareFlag(collide);
+ case COMMAND_1582:
+ script_assert(false);
+ return 0;
+ case COMMAND_1583:
+ script_assert(false);
+ return 0;
+ case COMMAND_1584:
+ script_assert(false);
+ return 0;
+ case COMMAND_1585:
+ script_assert(false);
+ return 0;
+ case COMMAND_1586:
+ script_assert(false);
return 0;
+ case COMMAND_1587:
+ script_assert(false);
+ return 0;
+ case COMMAND_1588:
+ script_assert(false);
+ return 0;
+ case COMMAND_1589:
+ CollectParameters(&m_nIp, 2);
+ // TODO (SWAP_BUILDING?)
+ return 0;
+ case COMMAND_1590:
+ script_assert(false);
+ return 0;
+ case COMMAND_1591:
+ script_assert(false);
+ return 0;
+ case COMMAND_1592:
+ script_assert(false);
+ return 0;
+ case COMMAND_1593:
+ script_assert(false);
+ return 0;
+ case COMMAND_1594:
+ script_assert(false);
+ return 0;
+ case COMMAND_1595:
+ script_assert(false);
+ return 0;
+ case COMMAND_1596:
+ script_assert(false);
+ return 0;
+ case COMMAND_1597:
+ script_assert(false);
+ return 0;
+ case COMMAND_1598:
+ script_assert(false);
+ return 0;
+ case COMMAND_1599:
+ script_assert(false);
+ return 0;
+ default:
+ script_assert(0);
}
- case COMMAND_GET_OBJECT_ROTATION_VELOCITY:
- {
+ return -1;
+}
+
+int8 CRunningScript::ProcessCommands1600To1699(int32 command)
+{
+ switch (command) {
+ case COMMAND_1600:
+ script_assert(false);
+ return 0;
+ case COMMAND_1601:
+ script_assert(false);
+ return 0;
+ case COMMAND_1602:
+ script_assert(false);
+ return 0;
+ case COMMAND_1603:
+ script_assert(false);
+ return 0;
+ case COMMAND_1604:
+ script_assert(false);
+ return 0;
+ case COMMAND_1605:
+ script_assert(false);
+ return 0;
+ case COMMAND_1606:
+ script_assert(false);
+ return 0;
+ case COMMAND_1607:
CollectParameters(&m_nIp, 1);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- *(CVector*)&ScriptParams[0] = pObject->GetTurnSpeed() * GAME_SPEED_TO_METERS_PER_SECOND;
- StoreParameters(&m_nIp, 3);
+ // TODO (SET_TOTAL_CARS_FOR_EXPORT)
+ return 0;
+ case COMMAND_1608:
+ script_assert(false);
+ return 0;
+ case COMMAND_1609:
+ script_assert(false);
+ return 0;
+ case COMMAND_1610:
+ script_assert(false);
+ return 0;
+ case COMMAND_1611:
+ script_assert(false);
+ return 0;
+ case COMMAND_1612:
+ script_assert(false);
+ return 0;
+ case COMMAND_1613:
+ script_assert(false);
+ return 0;
+ case COMMAND_1614:
+ script_assert(false);
+ return 0;
+ case COMMAND_1615:
+ // TODO (GET_DEVELOPER_FLAG?)
+ UpdateCompareFlag(false);
+ return 0;
+ case COMMAND_1616:
+ // TODO (SET_DEVELOPER_FLAG)
+ return 0;
+ case COMMAND_1617:
+ script_assert(false);
+ return 0;
+ case COMMAND_1618:
+ script_assert(false);
+ return 0;
+ case COMMAND_1619:
+ script_assert(false);
+ return 0;
+ case COMMAND_1620:
+ script_assert(false);
+ return 0;
+ case COMMAND_1621:
+ {
+ wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp);
+ CollectParameters(&m_nIp, 2);
+ // TODO (SET_SUBTITLE_TEXT)
return 0;
}
- case COMMAND_ADD_VELOCITY_RELATIVE_TO_OBJECT_VELOCITY:
+ case COMMAND_1622:
+ script_assert(false);
+ return 0;
+ case COMMAND_1623:
+ script_assert(false);
+ return 0;
+ case COMMAND_1624:
+ script_assert(false);
+ return 0;
+ case COMMAND_1625:
+ script_assert(false);
+ return 0;
+ case COMMAND_1626:
+ script_assert(false);
+ return 0;
+ case COMMAND_1627:
+ script_assert(false);
+ return 0;
+ case COMMAND_1628:
+ script_assert(false);
+ return 0;
+ case COMMAND_1629:
+ script_assert(false);
+ return 0;
+ case COMMAND_1630:
+ script_assert(false);
+ return 0;
+ case COMMAND_1631:
+ script_assert(false);
+ return 0;
+ case COMMAND_1632:
+ script_assert(false);
+ return 0;
+ case COMMAND_1633:
+ script_assert(false);
+ return 0;
+ case COMMAND_1634:
+ script_assert(false);
+ return 0;
+ case COMMAND_1635:
{
- CollectParameters(&m_nIp, 4);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- CVector vecAddition = *(CVector*)&ScriptParams[1] * CTimer::GetTimeStep() / GAME_SPEED_TO_METERS_PER_SECOND;
- if (!pObject->bIsStatic) {
- CVector vecCurrSpeed = pObject->GetSpeed();
- vecCurrSpeed.Normalise();
- if (vecCurrSpeed.z != 1.0) { // NB: not float!
- CVector vx = CrossProduct(vecCurrSpeed, CVector(0.0f, 0.0f, 1.0f));
- vx.Normalise();
- CVector vz = CrossProduct(vx, vecCurrSpeed);
- vz.Normalise();
- CVector vecNewSpeed = pObject->GetSpeed() + vecAddition.x * vx + vecAddition.y * vecCurrSpeed + vecAddition.z * vecCurrSpeed;
- if (pObject->bIsStatic) {
- pObject->SetIsStatic(false);
- pObject->AddToMovingList();
- }
- pObject->SetMoveSpeed(vecNewSpeed);
- }
- }
+ char tmp[12]; // TODO
+ CTheScripts::ReadTextLabelFromScript(&m_nIp, tmp);
+ m_nIp += KEY_LENGTH_IN_SCRIPT;
+ // TODO (CHANGE_STORED_PLAYER_OUTFIT?)
return 0;
}
- case COMMAND_GET_OBJECT_SPEED:
+ case COMMAND_1636:
+ script_assert(false);
+ return 0;
+ case COMMAND_1637:
+ script_assert(false);
+ return 0;
+ case COMMAND_1638:
+ script_assert(false);
+ return 0;
+ case COMMAND_1639:
+ script_assert(false);
+ return 0;
+ case COMMAND_1640:
+ CollectParameters(&m_nIp, 2);
+ // TODO (LOCK_GARAGE?)
+ return 0;
+ case COMMAND_1641:
+ // TODO
+ UpdateCompareFlag(true);
+ return 0;
+ case COMMAND_1642:
+ script_assert(false);
+ return 0;
+ case COMMAND_1643:
+ script_assert(false);
+ return 0;
+ case COMMAND_1644:
+ script_assert(false);
+ return 0;
+ case COMMAND_1645:
{
CollectParameters(&m_nIp, 1);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- *(float*)&ScriptParams[0] = pObject->GetMoveSpeed().Magnitude() * GAME_SPEED_TO_METERS_PER_SECOND;
+ // TODO (GET_STORED_WEAPON?)
+ CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ script_assert(pPed);
+ ScriptParams[0] = pPed->m_storedWeapon;
StoreParameters(&m_nIp, 1);
return 0;
}
-#endif
-#if (defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT)
- case COMMAND_IS_MISSION_SKIP:
-#ifdef MISSION_REPLAY
- ScriptParams[0] = MissionSkipLevel;
-#else
- ScriptParams[0] = 0;
-#endif
- StoreParameters(&m_nIp, 1);
- return 0;
- case COMMAND_SET_IN_AMMUNATION:
+ case COMMAND_1646:
CollectParameters(&m_nIp, 1);
-#ifdef MISSION_REPLAY
- IsInAmmunation = ScriptParams[0];
-#endif
+ // TODO (DISABLE_PAUSE_MENU?)
return 0;
- case COMMAND_DO_SAVE_GAME:
+ case COMMAND_1647:
CollectParameters(&m_nIp, 1);
-#ifdef MISSION_REPLAY
- SaveGameForPause(ScriptParams[0]);
-#endif
+ // TODO (IS_CHANNEL_PLAYING?)
+ UpdateCompareFlag(false);
return 0;
- case COMMAND_IS_RETRY:
-#ifdef MISSION_REPLAY
- if (strcmp(m_abScriptName, "porno4") != 0)
- ScriptParams[0] = AllowMissionReplay;
-#ifdef FIX_BUGS
- else
- ScriptParams[0] = gbTryingPorn4Again;
-#else
- else if (gbTryingPorn4Again)
- ScriptParams[0] = 1;
-#endif
-#else
- ScriptParams[0] = 0;
-#endif
- StoreParameters(&m_nIp, 1);
+ case COMMAND_1648:
+ CollectParameters(&m_nIp, 3);
+ // TODO (SET_CLOCK_EVENT_WARNING);
return 0;
- case COMMAND_DUMMY:
+ case COMMAND_1649:
+ CollectParameters(&m_nIp, 3);
+ // TODO (SET_EXTRA_COLOUR_DIRECTION)
return 0;
-#endif
-#if (defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT)
- // it is unknown what these commands do but they don't take parameters
- case COMMAND_MARK_CUTSCENE_START:
+ case COMMAND_1650:
+ script_assert(false);
return 0;
- case COMMAND_MARK_CUTSCENE_END:
+ case COMMAND_1651:
+ script_assert(false);
return 0;
- case COMMAND_CUTSCENE_SCROLL:
+ case COMMAND_1652:
+ script_assert(false);
+ return 0;
+ case COMMAND_1653:
+ script_assert(false);
+ return 0;
+ case COMMAND_1654:
+ script_assert(false);
+ return 0;
+ case COMMAND_1655:
+ script_assert(false);
+ return 0;
+ case COMMAND_1656:
+ CollectParameters(&m_nIp, 2);
+ // TODO (?)
return 0;
-#endif
default:
script_assert(0);
}
diff --git a/src/control/ScriptCommands.h b/src/control/ScriptCommands.h
index 9863e852..105fa82f 100644
--- a/src/control/ScriptCommands.h
+++ b/src/control/ScriptCommands.h
@@ -215,6 +215,11 @@ enum {
COMMAND_WHILE,
COMMAND_WHILENOT,
COMMAND_ENDWHILE,
+ COMMAND_214,
+ COMMAND_215,
+ COMMAND_216,
+ COMMAND_217,
+ COMMAND_218,
COMMAND_ANDOR,
COMMAND_LAUNCH_MISSION,
COMMAND_MISSION_HAS_FINISHED,
@@ -1437,39 +1442,222 @@ enum {
COMMAND_REGISTER_FIRE_LEVEL,
COMMAND_IS_AUSTRALIAN_GAME,
COMMAND_DISARM_CAR_BOMB,
-#if (defined GTAVC_JP_PATCH || defined SUPPORT_JAPANESE_SCRIPT)
COMMAND_IS_JAPANESE_GAME,
-#elif (!defined GTA_PS2)
- COMMAND_SET_ONSCREEN_COUNTER_FLASH_WHEN_FIRST_DISPLAYED,
-#endif
-#if (defined GTA_PC && !defined GTAVC_JP_PATCH || defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT)
- COMMAND_SHUFFLE_CARD_DECKS,
- COMMAND_FETCH_NEXT_CARD,
- COMMAND_GET_OBJECT_VELOCITY,
- COMMAND_IS_DEBUG_CAMERA_ON,
- COMMAND_ADD_TO_OBJECT_ROTATION_VELOCITY,
- COMMAND_SET_OBJECT_ROTATION_VELOCITY,
- COMMAND_IS_OBJECT_STATIC,
- COMMAND_GET_ANGLE_BETWEEN_2D_VECTORS,
- COMMAND_DO_2D_RECTANGLES_COLLIDE,
- COMMAND_GET_OBJECT_ROTATION_VELOCITY,
- COMMAND_ADD_VELOCITY_RELATIVE_TO_OBJECT_VELOCITY,
- COMMAND_GET_OBJECT_SPEED,
-#endif
-#if (defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT)
- COMMAND_MARK_CUTSCENE_START,
- COMMAND_MARK_CUTSCENE_END,
- COMMAND_CUTSCENE_SCROLL,
-#elif (defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT)
- COMMAND_IS_MISSION_SKIP,
- COMMAND_SET_IN_AMMUNATION,
- COMMAND_DO_SAVE_GAME,
- COMMAND_IS_RETRY,
- COMMAND_DUMMY,
- COMMAND_MARK_CUTSCENE_START,
- COMMAND_MARK_CUTSCENE_END,
- COMMAND_CUTSCENE_SCROLL,
-#endif
+ COMMAND_1442,
+ COMMAND_1443,
+ COMMAND_1444,
+ COMMAND_1445,
+ COMMAND_1446,
+ COMMAND_1447,
+ COMMAND_1448,
+ COMMAND_1449,
+ COMMAND_1450,
+ COMMAND_1451,
+ COMMAND_1452,
+ COMMAND_1453,
+ COMMAND_CALL,
+ COMMAND_NOTCALL,
+ COMMAND_1456,
+ COMMAND_1457,
+ COMMAND_1458,
+ COMMAND_1459,
+ COMMAND_1460,
+ COMMAND_1461,
+ COMMAND_1462,
+ COMMAND_1463,
+ COMMAND_1464,
+ COMMAND_1465,
+ COMMAND_1466,
+ COMMAND_1467,
+ COMMAND_1468,
+ COMMAND_1469,
+ COMMAND_1470,
+ COMMAND_1471,
+ COMMAND_1472,
+ COMMAND_1473,
+ COMMAND_1474,
+ COMMAND_1475,
+ COMMAND_1476,
+ COMMAND_1477,
+ COMMAND_1478,
+ COMMAND_1479,
+ COMMAND_1480,
+ COMMAND_1481,
+ COMMAND_1482,
+ COMMAND_1483,
+ COMMAND_1484,
+ COMMAND_1485,
+ COMMAND_1486,
+ COMMAND_1487,
+ COMMAND_1488,
+ COMMAND_1489,
+ COMMAND_1490,
+ COMMAND_1491,
+ COMMAND_1492,
+ COMMAND_1493,
+ COMMAND_1494,
+ COMMAND_1495,
+ COMMAND_1496,
+ COMMAND_1497,
+ COMMAND_1498,
+ COMMAND_1499,
+ COMMAND_1500,
+ COMMAND_1501,
+ COMMAND_1502,
+ COMMAND_1503,
+ COMMAND_1504,
+ COMMAND_1505,
+ COMMAND_1506,
+ COMMAND_1507,
+ COMMAND_1508,
+ COMMAND_1509,
+ COMMAND_1510,
+ COMMAND_1511,
+ COMMAND_1512,
+ COMMAND_1513,
+ COMMAND_1514,
+ COMMAND_1515,
+ COMMAND_1516,
+ COMMAND_1517,
+ COMMAND_1518,
+ COMMAND_1519,
+ COMMAND_1520,
+ COMMAND_1521,
+ COMMAND_1522,
+ COMMAND_1523,
+ COMMAND_1524,
+ COMMAND_1525,
+ COMMAND_1526,
+ COMMAND_1527,
+ COMMAND_1528,
+ COMMAND_1529,
+ COMMAND_1530,
+ COMMAND_1531,
+ COMMAND_1532,
+ COMMAND_1533,
+ COMMAND_1534,
+ COMMAND_1535,
+ COMMAND_1536,
+ COMMAND_1537,
+ COMMAND_1538,
+ COMMAND_1539,
+ COMMAND_1540,
+ COMMAND_1541,
+ COMMAND_1542,
+ COMMAND_1543,
+ COMMAND_1544,
+ COMMAND_1545,
+ COMMAND_1546,
+ COMMAND_1547,
+ COMMAND_1548,
+ COMMAND_1549,
+ COMMAND_1550,
+ COMMAND_1551,
+ COMMAND_1552,
+ COMMAND_1553,
+ COMMAND_1554,
+ COMMAND_1555,
+ COMMAND_1556,
+ COMMAND_1557,
+ COMMAND_1558,
+ COMMAND_1559,
+ COMMAND_1560,
+ COMMAND_1561,
+ COMMAND_1562,
+ COMMAND_1563,
+ COMMAND_1564,
+ COMMAND_1565,
+ COMMAND_1566,
+ COMMAND_1567,
+ COMMAND_1568,
+ COMMAND_1569,
+ COMMAND_1570,
+ COMMAND_1571,
+ COMMAND_1572,
+ COMMAND_1573,
+ COMMAND_1574,
+ COMMAND_1575,
+ COMMAND_1576,
+ COMMAND_1577,
+ COMMAND_1578,
+ COMMAND_1579,
+ COMMAND_1580,
+ COMMAND_1581,
+ COMMAND_1582,
+ COMMAND_1583,
+ COMMAND_1584,
+ COMMAND_1585,
+ COMMAND_1586,
+ COMMAND_1587,
+ COMMAND_1588,
+ COMMAND_1589,
+ COMMAND_1590,
+ COMMAND_1591,
+ COMMAND_1592,
+ COMMAND_1593,
+ COMMAND_1594,
+ COMMAND_1595,
+ COMMAND_1596,
+ COMMAND_1597,
+ COMMAND_1598,
+ COMMAND_1599,
+ COMMAND_1600,
+ COMMAND_1601,
+ COMMAND_1602,
+ COMMAND_1603,
+ COMMAND_1604,
+ COMMAND_1605,
+ COMMAND_1606,
+ COMMAND_1607,
+ COMMAND_1608,
+ COMMAND_1609,
+ COMMAND_1610,
+ COMMAND_1611,
+ COMMAND_1612,
+ COMMAND_1613,
+ COMMAND_1614,
+ COMMAND_1615,
+ COMMAND_1616,
+ COMMAND_1617,
+ COMMAND_1618,
+ COMMAND_1619,
+ COMMAND_1620,
+ COMMAND_1621,
+ COMMAND_1622,
+ COMMAND_1623,
+ COMMAND_1624,
+ COMMAND_1625,
+ COMMAND_1626,
+ COMMAND_1627,
+ COMMAND_1628,
+ COMMAND_1629,
+ COMMAND_1630,
+ COMMAND_1631,
+ COMMAND_1632,
+ COMMAND_1633,
+ COMMAND_1634,
+ COMMAND_1635,
+ COMMAND_1636,
+ COMMAND_1637,
+ COMMAND_1638,
+ COMMAND_1639,
+ COMMAND_1640,
+ COMMAND_1641,
+ COMMAND_1642,
+ COMMAND_1643,
+ COMMAND_1644,
+ COMMAND_1645,
+ COMMAND_1646,
+ COMMAND_1647,
+ COMMAND_1648,
+ COMMAND_1649,
+ COMMAND_1650,
+ COMMAND_1651,
+ COMMAND_1652,
+ COMMAND_1653,
+ COMMAND_1654,
+ COMMAND_1655,
+ COMMAND_1656,
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
LAST_SCRIPT_COMMAND
#endif
@@ -1488,7 +1676,9 @@ enum eScriptArgument
ARGTYPE_PED_HANDLE,
ARGTYPE_VEHICLE_HANDLE,
ARGTYPE_OBJECT_HANDLE,
- ARGTYPE_ANDOR
+ ARGTYPE_ANDOR,
+ ARGTYPE_LIST,
+ ARGTYPE_FUNCTION
};
struct tScriptCommandData