summaryrefslogtreecommitdiffstats
path: root/src/control/Script2.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/control/Script2.cpp792
1 files changed, 422 insertions, 370 deletions
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;