diff options
author | erorcun <erayorcunus@gmail.com> | 2020-10-18 18:45:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-18 18:45:11 +0200 |
commit | 70f9832e14ff452e81ae580a1a15b9d6f4bd63b6 (patch) | |
tree | c2a222cfdbb5d7ebcd9acf27920b7fa6da6918d1 /src/control/Script.cpp | |
parent | typo fixes (diff) | |
parent | Merge pull request #772 from Nick007J/miami (diff) | |
download | re3-70f9832e14ff452e81ae580a1a15b9d6f4bd63b6.tar re3-70f9832e14ff452e81ae580a1a15b9d6f4bd63b6.tar.gz re3-70f9832e14ff452e81ae580a1a15b9d6f4bd63b6.tar.bz2 re3-70f9832e14ff452e81ae580a1a15b9d6f4bd63b6.tar.lz re3-70f9832e14ff452e81ae580a1a15b9d6f4bd63b6.tar.xz re3-70f9832e14ff452e81ae580a1a15b9d6f4bd63b6.tar.zst re3-70f9832e14ff452e81ae580a1a15b9d6f4bd63b6.zip |
Diffstat (limited to 'src/control/Script.cpp')
-rw-r--r-- | src/control/Script.cpp | 67 |
1 files changed, 39 insertions, 28 deletions
diff --git a/src/control/Script.cpp b/src/control/Script.cpp index d05a1442..ba53c9cf 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -1704,7 +1704,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(); } } @@ -1826,7 +1826,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(); @@ -2380,9 +2380,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; @@ -3970,7 +3972,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); @@ -6371,7 +6373,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: @@ -7041,7 +7043,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: @@ -7496,7 +7498,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; @@ -7507,8 +7509,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; } @@ -8977,7 +8978,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; @@ -9648,13 +9648,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(); } } @@ -10343,8 +10343,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; @@ -11203,7 +11202,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: { @@ -12283,10 +12282,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: @@ -12460,9 +12469,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: @@ -13251,7 +13262,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: @@ -13415,9 +13426,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); @@ -13439,7 +13450,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: @@ -13715,7 +13726,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) pVehicle->bDontLoadCollision = true; if (pVehicle->bIsStaticWaitingForCollision) { pVehicle->bIsStaticWaitingForCollision = false; - if (!pVehicle->IsStatic()) + if (!pVehicle->GetIsStatic()) pVehicle->AddToMovingList(); } } @@ -13738,7 +13749,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) pPed->bDontLoadCollision = true; if (pPed->bIsStaticWaitingForCollision) { pPed->bIsStaticWaitingForCollision = false; - if (!pPed->IsStatic()) + if (!pPed->GetIsStatic()) pPed->AddToMovingList(); } } |