summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/control/Script.cpp6
-rw-r--r--src/control/Script3.cpp6
-rw-r--r--src/control/Script4.cpp15
-rw-r--r--src/control/Script6.cpp4
-rw-r--r--src/control/Script7.cpp21
-rw-r--r--src/control/Script8.cpp44
6 files changed, 63 insertions, 33 deletions
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 5fbf5779..df851daa 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -2385,7 +2385,7 @@ int32* GetPointerToScriptVariableForDebug(CRunningScript* pScript, uint32* 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@]", ((int)(type - ARGUMENT_GLOBAL_ARRAY) << 8) + index_in_block, index_id);
+ 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)];
}
@@ -2401,7 +2401,7 @@ int32* GetPointerToScriptVariableForDebug(CRunningScript* pScript, uint32* 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@]", (type - ARGUMENT_LOCAL_ARRAY), index_id);
+ 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];
}
@@ -2412,7 +2412,7 @@ int32* GetPointerToScriptVariableForDebug(CRunningScript* pScript, uint32* pIp,
}
else {
assert(type >= ARGUMENT_TIMER);
- sprintf(tmpstr, " TIMER%d@", (type - ARGUMENT_LOCAL_ARRAY));
+ sprintf(tmpstr, " TIMER%d@", (type - ARGUMENT_TIMER));
strcat(buf, tmpstr);
return &pScript->m_anLocalVariables[NUM_LOCAL_VARS + 8 + (type - ARGUMENT_TIMER)]; // why 8?
}
diff --git a/src/control/Script3.cpp b/src/control/Script3.cpp
index 26e1187d..0134df00 100644
--- a/src/control/Script3.cpp
+++ b/src/control/Script3.cpp
@@ -1787,10 +1787,9 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
pBoat->AutoPilot.m_nCruiseSpeed = *(float*)&ScriptParams[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];
@@ -1814,7 +1813,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
continue;
// if (pPed->GetModelIndex() == MI_SCUM_WOM || pPed->GetModelIndex() == MI_SCUM_MAN)
// continue;
- if (!ThisIsAValidRandomPed(pPed->m_nPedType))
+ if (!ThisIsAValidRandomPed(pPed->m_nPedType, ScriptParams[5], ScriptParams[6], ScriptParams[7])) // TODO
continue;
if (pPed->bIsLeader || pPed->m_leader)
continue;
@@ -1836,7 +1835,6 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
StoreParameters(&m_nIp, 1);
return 0;
}
- */
case COMMAND_GET_RANDOM_CHAR_IN_ZONE:
{
char zone[KEY_LENGTH_IN_SCRIPT];
diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp
index 64928e7a..a8cc9b9c 100644
--- a/src/control/Script4.cpp
+++ b/src/control/Script4.cpp
@@ -954,7 +954,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:
{
@@ -1418,7 +1421,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 +1443,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);
@@ -1967,12 +1968,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 +2041,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 +2052,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/Script6.cpp b/src/control/Script6.cpp
index 8915a089..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);
@@ -525,7 +523,6 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
StoreParameters(&m_nIp, 1);
return 0;
}
- /*
case COMMAND_MARK_ROADS_BETWEEN_LEVELS:
{
CollectParameters(&m_nIp, 6);
@@ -574,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 344ea2c7..220a7c4d 100644
--- a/src/control/Script7.cpp
+++ b/src/control/Script7.cpp
@@ -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:
@@ -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 63102d24..f41ef8a4 100644
--- a/src/control/Script8.cpp
+++ b/src/control/Script8.cpp
@@ -421,7 +421,10 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
script_assert(false);
return 0;
case COMMAND_1451:
- script_assert(false);
+ CollectParameters(&m_nIp, 1);
+ // TODO (GET_PAD_BUTTON_STATE)
+ ScriptParams[0] = 0;
+ StoreParameters(&m_nIp, 1);
return 0;
case COMMAND_1452:
script_assert(false);
@@ -518,7 +521,8 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
script_assert(false);
return 0;
case COMMAND_1479:
- script_assert(false);
+ CollectParameters(&m_nIp, 2);
+ // TODO (SET_CHAR_ONLY_ENTER_BACK_DOOR)
return 0;
case COMMAND_1480:
script_assert(false);
@@ -644,7 +648,8 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
script_assert(false);
return 0;
case COMMAND_1518:
- script_assert(false);
+ // TODO (?)
+ UpdateCompareFlag(true);
return 0;
case COMMAND_1519:
CollectParameters(&m_nIp, 1);
@@ -768,7 +773,8 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
script_assert(false);
return 0;
case COMMAND_1558:
- script_assert(false);
+ UpdateCompareFlag(false);
+ // TODO
return 0;
case COMMAND_1559:
script_assert(false);
@@ -778,7 +784,8 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
UpdateCompareFlag(false);
return 0;
case COMMAND_1561:
- script_assert(false);
+ // TODO (check, SET_FS_DESTROYED_FLAG)
+ CTheScripts::FSDestroyedFlag = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) - (int32*)CTheScripts::ScriptSpace;
return 0;
case COMMAND_1562:
script_assert(false);
@@ -796,7 +803,8 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
script_assert(false);
return 0;
case COMMAND_1567:
- script_assert(false);
+ CollectParameters(&m_nIp, 1);
+ // TODO (BUILD_WORLD_GEOMETRY)
return 0;
case COMMAND_1568:
script_assert(false);
@@ -927,7 +935,8 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
script_assert(false);
return 0;
case COMMAND_1607:
- script_assert(false);
+ CollectParameters(&m_nIp, 1);
+ // TODO (SET_TOTAL_CARS_FOR_EXPORT)
return 0;
case COMMAND_1608:
script_assert(false);
@@ -951,10 +960,11 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
script_assert(false);
return 0;
case COMMAND_1615:
- script_assert(false);
+ // TODO (GET_DEVELOPER_FLAG?)
+ UpdateCompareFlag(false);
return 0;
case COMMAND_1616:
- script_assert(false);
+ // TODO (SET_DEVELOPER_FLAG)
return 0;
case COMMAND_1617:
script_assert(false);
@@ -969,8 +979,12 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
script_assert(false);
return 0;
case COMMAND_1621:
- script_assert(false);
+ {
+ wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp);
+ CollectParameters(&m_nIp, 2);
+ // TODO (SET_SUBTITLE_TEXT)
return 0;
+ }
case COMMAND_1622:
script_assert(false);
return 0;
@@ -1035,7 +1049,8 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
// TODO (LOCK_GARAGE?)
return 0;
case COMMAND_1641:
- script_assert(false);
+ // TODO
+ UpdateCompareFlag(true);
return 0;
case COMMAND_1642:
script_assert(false);
@@ -1054,14 +1069,17 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
// TODO (DISABLE_PAUSE_MENU?)
return 0;
case COMMAND_1647:
- script_assert(false);
+ CollectParameters(&m_nIp, 1);
+ // TODO (IS_CHANNEL_PLAYING?)
+ UpdateCompareFlag(false);
return 0;
case COMMAND_1648:
CollectParameters(&m_nIp, 3);
// TODO (SET_CLOCK_EVENT_WARNING);
return 0;
case COMMAND_1649:
- script_assert(false);
+ CollectParameters(&m_nIp, 3);
+ // TODO (SET_EXTRA_COLOUR_DIRECTION)
return 0;
case COMMAND_1650:
script_assert(false);