summaryrefslogtreecommitdiffstats
path: root/src/control/Script.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/control/Script.cpp')
-rw-r--r--src/control/Script.cpp76
1 files changed, 43 insertions, 33 deletions
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 55139f2e..0df6d5a2 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -1705,7 +1705,7 @@ static void PossiblyWakeThisEntity(CPhysical* pEntity, bool ifColLoaded = false)
return;
if (!ifColLoaded || CColStore::HasCollisionLoaded(pEntity->GetPosition())) {
pEntity->bIsStaticWaitingForCollision = false;
- if (!pEntity->IsStatic())
+ if (!pEntity->GetIsStatic())
pEntity->AddToMovingList();
}
}
@@ -1805,9 +1805,8 @@ void CMissionCleanup::Process()
if (!CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle)
TheCamera.Restore();
TheCamera.SetWideScreenOff();
- // TODO(MIAMI)
- //CSpecialFX::bLiftCam = false;
- //CSpecialFX::bVideoCam = false;
+ CSpecialFX::bLiftCam = false;
+ CSpecialFX::bVideoCam = false;
CTimeCycle::StopExtraColour(0);
for (int i = 0; i < MISSION_AUDIO_SLOTS; i++)
DMAudio.ClearMissionAudio(i);
@@ -1828,7 +1827,7 @@ void CMissionCleanup::Process()
CWorld::Players[0].m_pPed->m_nDrunkCountdown = 0;
CPad::GetPad(0)->SetDrunkInputDelay(0);
CWorld::Players[0].m_bDriveByAllowed = true;
- // DMAudio::ShutUpPlayerTalking(0); // TODO(Miami)
+ DMAudio.ShutUpPlayerTalking(0);
CVehicle::bDisableRemoteDetonation = false;
CVehicle::bDisableRemoteDetonationOnContact = false;
CGameLogic::ClearShortCut();
@@ -2382,9 +2381,11 @@ void CTheScripts::Process()
case 4:
AllowMissionReplay = 5;
RetryMission(0, 0);
+ break;
case 6:
AllowMissionReplay = 7;
TimeToWaitTill = CTimer::GetTimeInMilliseconds() + 500;
+ break;
case 7:
if (TimeToWaitTill < CTimer::GetTimeInMilliseconds()) {
AllowMissionReplay = 0;
@@ -3972,7 +3973,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel();
- car->bIsStatic = false;
+ car->SetIsStatic(false);
/* Again weird usage of virtual functions. */
if (car->IsBoat()) {
car->Teleport(pos);
@@ -6373,7 +6374,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
}
case COMMAND_ADD_EXPLOSION:
CollectParameters(&m_nIp, 4);
- CExplosion::AddExplosion(nil, nil, (eExplosionType)ScriptParams[3], *(CVector*)&ScriptParams[0], 0);
+ CExplosion::AddExplosion(nil, nil, (eExplosionType)ScriptParams[3], *(CVector*)&ScriptParams[0], 0, true);
return 0;
case COMMAND_IS_CAR_UPRIGHT:
@@ -7043,7 +7044,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
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); // TODO(MIAMI): more params
+ 255, pos, *(float*)&ScriptParams[3], 150.0f, ScriptParams[4], ScriptParams[5], 1, 0, 0, 0.0f);
return 0;
}
case COMMAND_DRAW_LIGHT:
@@ -7498,7 +7499,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
CVector pos = *(CVector*)&ScriptParams[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)];
+ CPathNode* pNode = &ThePaths.m_pathNodes[ThePaths.FindNodeClosestToCoors(pos, 1, 999999.9f, true)];
*(CVector*)&ScriptParams[0] = pNode->GetPosition();
StoreParameters(&m_nIp, 3);
return 0;
@@ -7509,8 +7510,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
CVector pos = *(CVector*)&ScriptParams[0];
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
- CPathNode* pNode = &ThePaths.m_pathNodes[ThePaths.FindNodeClosestToCoors(pos, 0, 999999.9f)];
- *(CVector*)&ScriptParams[0] = pNode->GetPosition();
+ *(CVector*)&ScriptParams[0] = ThePaths.FindNodeCoorsForScript(ThePaths.FindNodeClosestToCoors(pos, 0, 999999.9f, true, true));
StoreParameters(&m_nIp, 3);
return 0;
}
@@ -8979,7 +8979,6 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
CollectParameters(&m_nIp, 1);
char zone[KEY_LENGTH_IN_SCRIPT];
CTheScripts::ReadTextLabelFromScript(&m_nIp, zone);
-// TODO(MIAMI): just getting this to compile with new argument
int zone_id = CTheZones::FindZoneByLabelAndReturnIndex(zone, ZONE_DEFAULT);
if (zone_id != -1)
m_nIp += KEY_LENGTH_IN_SCRIPT;
@@ -9650,13 +9649,13 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
script_assert(pObject);
if (ScriptParams[1]) {
if (pObject->bIsStatic) {
- pObject->bIsStatic = false;
+ pObject->SetIsStatic(false);
pObject->AddToMovingList();
}
}
else {
if (!pObject->bIsStatic) {
- pObject->bIsStatic = true;
+ pObject->SetIsStatic(true);
pObject->RemoveFromMovingList();
}
}
@@ -10345,8 +10344,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
int node = ThePaths.FindNodeClosestToCoors(pos, 0, 999999.9f, true, true);
- // TODO(MIAMI): replace GetPosition with FindNodeCoorsForScript
- *(CVector*)&ScriptParams[0] = ThePaths.m_pathNodes[node].GetPosition();
+ *(CVector*)&ScriptParams[0] = ThePaths.FindNodeCoorsForScript(node);
*(float*)&ScriptParams[3] = ThePaths.FindNodeOrientationForCarPlacement(node);
StoreParameters(&m_nIp, 4);
return 0;
@@ -11205,7 +11203,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
return 0;
*/
case COMMAND_ARE_ANY_CAR_CHEATS_ACTIVATED:
- UpdateCompareFlag(CVehicle::bAllDodosCheat || CVehicle::bCheat3 || CVehicle::bHoverCheat || CVehicle::bCheat8); // TODO(MIAMI): more cheats!
+ UpdateCompareFlag(CVehicle::bAllDodosCheat || CVehicle::bCheat3 || CVehicle::bHoverCheat || CVehicle::bCheat8 || CVehicle::bCheat9);
return 0;
case COMMAND_SET_CHAR_SUFFERS_CRITICAL_HITS:
{
@@ -12285,10 +12283,20 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
case COMMAND_GET_CLOSEST_STRAIGHT_ROAD:
{
CollectParameters(&m_nIp, 5);
- debug("GET_CLOSEST_STRAIGHT_ROAD not implemented!\n");
- for (int i = 0; i < 7; i++)
- ScriptParams[i] = 0;
- StoreParameters(&m_nIp, 7); // TODO(MIAMI)
+ int node1, node2;
+ float angle;
+ ThePaths.FindNodePairClosestToCoors(*(CVector*)&ScriptParams[0], PATH_CAR, &node1, &node2, &angle,
+ *(float*)&ScriptParams[3], *(float*)&ScriptParams[4], true, true);
+ if (node1 == -1) {
+ for (int i = 0; i < 7; i++)
+ ScriptParams[i] = 0;
+ }
+ else {
+ *(CVector*)&ScriptParams[0] = ThePaths.FindNodeCoorsForScript(node1);
+ *(CVector*)&ScriptParams[3] = ThePaths.FindNodeCoorsForScript(node2);
+ *(float*)&ScriptParams[6] = angle;
+ }
+ StoreParameters(&m_nIp, 7);
return 0;
}
case COMMAND_SET_CAR_FORWARD_SPEED:
@@ -12396,7 +12404,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
case COMMAND_SWITCH_SECURITY_CAMERA:
{
CollectParameters(&m_nIp, 1);
- debug("SWITCH_SECURITY_CAMERA is not implemented\n"); // TODO(MIAMI)
+ CSpecialFX::bVideoCam = ScriptParams[0] != 0;
return 0;
}
//case COMMAND_IS_CHAR_IN_FLYING_VEHICLE:
@@ -12462,9 +12470,11 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
case COMMAND_GET_NTH_CLOSEST_CAR_NODE:
{
CollectParameters(&m_nIp, 4);
- debug("GET_NTH_CLOSEST_CAR_NODE is not implemented\n"); // TODO(MIAMI)
- ScriptParams[0] = 0;
- StoreParameters(&m_nIp, 1);
+ CVector pos = *(CVector*)&ScriptParams[0];
+ if (pos.z <= MAP_Z_LOW_LIMIT)
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ *(CVector*)&ScriptParams[0] = ThePaths.FindNodeCoorsForScript(ThePaths.FindNthNodeClosestToCoors(pos, 0, 999999.9f, true, true, ScriptParams[3] - 1));
+ StoreParameters(&m_nIp, 3);
return 0;
}
//case COMMAND_GET_NTH_CLOSEST_CHAR_NODE:
@@ -12834,7 +12844,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
case COMMAND_SWITCH_LIFT_CAMERA:
{
CollectParameters(&m_nIp, 1);
- debug("SWITCH_LIFT_CAMERA is not implemented\n"); // TODO(MIAMI)
+ CSpecialFX::bLiftCam = ScriptParams[0] != 0;
return 0;
}
case COMMAND_CLOSE_ALL_CAR_DOORS:
@@ -13253,7 +13263,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
case COMMAND_SET_TONIGHTS_EVENT:
{
CollectParameters(&m_nIp, 1);
- debug("skipping SET_TONIGHTS_EVENT\n"); // TODO(MIAMI)
+ CScrollBar::TonightsEvent = ScriptParams[0];
return 0;
}
case COMMAND_CLEAR_CHAR_LAST_DAMAGE_ENTITY:
@@ -13417,9 +13427,9 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
script_assert(pPed);
if (pPed->bInVehicle) {
- if (pPed->GetWeapon(5).m_eWeaponType) { // TODO(MIAMI): enum
- if (pPed->GetWeapon(5).m_nAmmoTotal < ScriptParams[1])
- pPed->SetAmmo(pPed->GetWeapon(5).m_eWeaponType, ScriptParams[1]);
+ if (pPed->GetWeapon(WEAPONSLOT_SUBMACHINEGUN).m_eWeaponType) {
+ if (pPed->GetWeapon(WEAPONSLOT_SUBMACHINEGUN).m_nAmmoTotal < ScriptParams[1])
+ pPed->SetAmmo(pPed->GetWeapon(WEAPONSLOT_SUBMACHINEGUN).m_eWeaponType, ScriptParams[1]);
}
else {
pPed->GiveWeapon(WEAPONTYPE_UZI, ScriptParams[1], true);
@@ -13441,7 +13451,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
case COMMAND_ADD_EXPLOSION_NO_SOUND:
{
CollectParameters(&m_nIp, 4);
- CExplosion::AddExplosion(nil, nil, (eExplosionType)ScriptParams[3], *(CVector*)&ScriptParams[0], 0); // TODO(MIAMI): last arg is 0
+ CExplosion::AddExplosion(nil, nil, (eExplosionType)ScriptParams[3], *(CVector*)&ScriptParams[0], 0, false);
return 0;
}
case COMMAND_SET_OBJECT_AREA_VISIBLE:
@@ -13717,7 +13727,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
pVehicle->bDontLoadCollision = true;
if (pVehicle->bIsStaticWaitingForCollision) {
pVehicle->bIsStaticWaitingForCollision = false;
- if (!pVehicle->IsStatic())
+ if (!pVehicle->GetIsStatic())
pVehicle->AddToMovingList();
}
}
@@ -13740,7 +13750,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
pPed->bDontLoadCollision = true;
if (pPed->bIsStaticWaitingForCollision) {
pPed->bIsStaticWaitingForCollision = false;
- if (!pPed->IsStatic())
+ if (!pPed->GetIsStatic())
pPed->AddToMovingList();
}
}