diff options
Diffstat (limited to 'src/control')
-rw-r--r-- | src/control/Garages.cpp | 34 | ||||
-rw-r--r-- | src/control/Script.cpp | 68 | ||||
-rw-r--r-- | src/control/Script3.cpp | 63 | ||||
-rw-r--r-- | src/control/Script4.cpp | 98 | ||||
-rw-r--r-- | src/control/Script5.cpp | 9 | ||||
-rw-r--r-- | src/control/Script6.cpp | 16 | ||||
-rw-r--r-- | src/control/Script8.cpp | 22 |
7 files changed, 179 insertions, 131 deletions
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index c4916878..dd9067fc 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -627,13 +627,24 @@ void CGarage::Update() case GS_OPENED: UpdateDoorsHeight(); if (IsStaticPlayerCarEntirelyInside()) { +#ifndef BOMBS_ON_BIKES if (FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_APPEARANCE_BIKE) { CGarages::TriggerMessage("GA_22", -1, 4000, -1); m_eGarageState = GS_OPENEDCONTAINSCAR; DMAudio.PlayFrontEndSound(SOUND_GARAGE_BOMB_ALREADY_SET, 1); break; } - if (!FindPlayerVehicle() || FindPlayerVehicle()->m_bombType) { +#endif + if (!FindPlayerVehicle() +#ifdef FIX_BUGS + || (FindPlayerVehicle()->IsCar() && ((CAutomobile*)FindPlayerVehicle())->m_bombType) +#else + || ((CAutomobile*)FindPlayerVehicle())->m_bombType +#endif +#ifdef BOMBS_ON_BIKES + || (FindPlayerVehicle()->IsBike() && ((CBike*)FindPlayerVehicle())->m_bombType) +#endif + ) { CGarages::TriggerMessage("GA_5", -1, 4000, -1); //"Your car is already fitted with a bomb" m_eGarageState = GS_OPENEDCONTAINSCAR; DMAudio.PlayFrontEndSound(SOUND_GARAGE_BOMB_ALREADY_SET, 1); @@ -677,10 +688,16 @@ void CGarage::Update() if (!CGarages::BombsAreFree) CWorld::Players[CWorld::PlayerInFocus].m_nMoney = Max(0, CWorld::Players[CWorld::PlayerInFocus].m_nMoney - BOMB_PRICE); if (FindPlayerVehicle() && (FindPlayerVehicle()->IsCar() || FindPlayerVehicle()->IsBike())) { -#if (!defined GTA_PS2 || defined FIX_BUGS) // <- this remained in CAutomobile in LCS - FindPlayerVehicle()->m_bombType = CGarages::GetBombTypeForGarageType(m_eGarageType); - FindPlayerVehicle()->m_pBombRigger = FindPlayerPed(); -#else // PS2 version contained a bug: CBike was casted to CAutomobile, but due to coincidence it didn't corrupt memory +#ifdef BOMBS_ON_BIKES + if (FindPlayerVehicle()->IsCar()) { + ((CAutomobile*)(FindPlayerVehicle()))->m_bombType = CGarages::GetBombTypeForGarageType(m_eGarageType); + ((CAutomobile*)(FindPlayerVehicle()))->m_pBombRigger = FindPlayerPed(); + } + else { + ((CBike*)(FindPlayerVehicle()))->m_bombType = CGarages::GetBombTypeForGarageType(m_eGarageType); + ((CBike*)(FindPlayerVehicle()))->m_pBombRigger = FindPlayerPed(); + } +#else ((CAutomobile*)(FindPlayerVehicle()))->m_bombType = CGarages::GetBombTypeForGarageType(m_eGarageType); ((CAutomobile*)(FindPlayerVehicle()))->m_pBombRigger = FindPlayerPed(); #endif @@ -694,6 +711,13 @@ void CGarage::Update() pCar->m_pBombRigger = nil; pCar->m_pBlowUpEntity = nil; } +#ifdef BOMBS_ON_BIKES + if (pVehicle->IsBike() && pVehicle->GetStatus() == STATUS_WRECKED) { + CBike* pBike = (CBike*)pVehicle; + pBike->m_pBombRigger = nil; + pBike->m_pBlowUpEntity = nil; + } +#endif } } if (m_eGarageType == GARAGE_BOMBSHOP3) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 59af9ff2..26d9d380 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -179,65 +179,6 @@ static const char* MissionScripts[] = { "TOSH4" }; -static const char* MissionScripts[] = { - "LAWYER1", - "LAWYER2", - "LAWYER3", - "LAWYER4", - "GENERL1", - "COL2", - "GENERL3", - "COL_4", - "COL_5", - "baron1", - "baron2", - "baron3", - "baron4", - "kent1", - "baron5", - "serg1", - "serg2", - "serg3", - "bankjo1", - "bankjo2", - "bankjo3", - "bankjo4", - "phil1", - "phil2", - "porno1", - "porno2", - "porno3", - "porno4", - "protec1", - "protec2", - "protec3", - "count1", - "count2", - "CAP_1", - "FIN_1", - "bike1", - "bike2", - "bike3", - "rockb1", - "rockb2", - "rockb3", - "cuban1", - "cuban2", - "cuban3", - "cuban4", - "hait1", - "hait2", - "hait3", - "assin1", - "assin2", - "assin3", - "assin4", - "assin5", - "taxwar1", - "taxwar2", - "taxwar3" -}; - int AllowMissionReplay; uint32 NextMissionDelay; uint32 MissionStartTime; @@ -1851,7 +1792,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) if (ped) { // great time to check for (int i = 0; i < ped->m_numNearPeds; i++) { CPed* pTestedPed = ped->m_nearPeds[i]; - if (!pTestedPed || !IsPedPointerValid(pTestedPed)) + if (!pTestedPed || !IsPedPointerValid(pTestedPed) || pTestedPed->bIsFrozen) continue; if (pTestedPed->m_pedInObjective == ped && pTestedPed->m_objective == OBJECTIVE_FOLLOW_CHAR_IN_FORMATION) { CVector vFollowerPos = pTestedPed->GetFormationPosition(); @@ -1864,7 +1805,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) } } } - else if (pTestedPed->m_leader == ped) { + else if (pTestedPed->m_leader == ped && !pTestedPed->bIsFrozen) { CVector vFollowerPos; if (pTestedPed->m_pedFormation) vFollowerPos = pTestedPed->GetFormationPosition(); @@ -2551,6 +2492,9 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) } SET_INTEGER_PARAM(0, handle); StoreParameters(&m_nIp, 1); +#ifdef GTA_NETWORK + // TODO(LCS): register car +#endif if (m_bIsMissionScript) CTheScripts::MissionCleanUp.AddEntityToList(handle, CLEANUP_CAR); return 0; @@ -3128,6 +3072,8 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) case COMMAND_DELETE_OBJECT: { CollectParameters(&m_nIp, 1); + if (GET_INTEGER_PARAM(0) > (NUMOBJECTS + 2) << 8) + return 0; CObject* pObj = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0)); if (pObj){ CWorld::Remove(pObj); diff --git a/src/control/Script3.cpp b/src/control/Script3.cpp index e2646866..9d66b4fe 100644 --- a/src/control/Script3.cpp +++ b/src/control/Script3.cpp @@ -373,10 +373,19 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) case COMMAND_IS_CAR_ARMED_WITH_ANY_BOMB: { CollectParameters(&m_nIp, 1); - CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); - script_assert(pCar); - script_assert(pCar->m_vehType == VEHICLE_TYPE_CAR); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); + script_assert(pVehicle); +#ifdef FIX_BUGS + if (pVehicle->IsCar()) + UpdateCompareFlag(((CAutomobile*)pVehicle)->m_bombType != 0); + else if (pVehicle->IsBike()) + UpdateCompareFlag(((CBike*)pVehicle)->m_bombType != 0); + else + UpdateCompareFlag(false); +#else + CAutomobile* pCar = (CVehicle*)pVehicle; UpdateCompareFlag(pCar->m_bombType != 0); //TODO: enum +#endif return 0; } case COMMAND_APPLY_BRAKES_TO_PLAYERS_CAR: @@ -447,10 +456,19 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) case COMMAND_IS_CAR_ARMED_WITH_BOMB: { CollectParameters(&m_nIp, 2); - CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); - script_assert(pCar); - //script_assert(pCar->m_vehType == VEHICLE_TYPE_CAR); - UpdateCompareFlag(pCar->m_bombType == GET_INTEGER_PARAM(1)); + CAutomobile* pVehicle = (CAutomobile*)CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); + script_assert(pVehicle); +#ifdef FIX_BUGS + if (pVehicle->IsCar()) + UpdateCompareFlag(((CAutomobile*)pVehicle)->m_bombType == GET_INTEGER_PARAM(1)); + else if (pVehicle->IsBike()) + UpdateCompareFlag(((CBike*)pVehicle)->m_bombType == GET_INTEGER_PARAM(1)); + else + UpdateCompareFlag(false); +#else + CAutomobile* pCar = (CVehicle*)pVehicle; + UpdateCompareFlag(pCar->m_bombType != 0); //TODO: enum +#endif return 0; } case COMMAND_CHANGE_CAR_COLOUR: @@ -710,9 +728,19 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); +#ifdef FIX_BUGS + if (pVehicle->IsCar()) { + ((CAutomobile*)pVehicle)->m_bombType = GET_INTEGER_PARAM(1); + ((CAutomobile*)pVehicle)->m_pBombRigger = FindPlayerPed(); + } + else if (pVehicle->IsBike()) { + ((CBike*)pVehicle)->m_bombType = GET_INTEGER_PARAM(1); + ((CBike*)pVehicle)->m_pBombRigger = FindPlayerPed(); + } +#else ((CAutomobile*)pVehicle)->m_bombType = GET_INTEGER_PARAM(1); ((CAutomobile*)pVehicle)->m_pBombRigger = FindPlayerPed(); +#endif return 0; } case COMMAND_SET_CHAR_PERSONALITY: @@ -776,7 +804,10 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) int model = GET_INTEGER_PARAM(0); if (model < 0) model = CTheScripts::UsedObjectArray[-model].index; - CStreaming::SetMissionDoesntRequireModel(model); + if (m_bIsMissionScript) + CStreaming::SetMissionDoesntRequireModel(model); + else + CStreaming::SetAmbientMissionDoesntRequireModel(model); return 0; } case COMMAND_GRAB_PHONE: @@ -1243,8 +1274,8 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) CollectParameters(&m_nIp, 1); if (m_bIsMissionScript) CStreaming::SetMissionDoesntRequireSpecialChar(GET_INTEGER_PARAM(0) - 1); - //else - // CStreaming::SetAmbientMissionDoesntRequireSpecialChar(GET_INTEGER_PARAM(0) - 1); // TODO + else + CStreaming::SetAmbientMissionDoesntRequireSpecialChar(GET_INTEGER_PARAM(0) - 1); return 0; case COMMAND_RESET_NUM_OF_MODELS_KILLED_BY_PLAYER: CDarkel::ResetModelsKilledByPlayer(); @@ -1393,7 +1424,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) if (GET_INTEGER_PARAM(0) != 0) TheCamera.SetWideScreenOn(); else { - // TODO: unknown field + // TODO(LCS): unknown field TheCamera.SetWideScreenOff(); } return 0; @@ -1944,7 +1975,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + PICKUP_PLACEMENT_OFFSET; CPickups::GetActualPickupIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); - SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, MI_MONEY, PICKUP_MONEY, GET_INTEGER_PARAM(3))); // MI_MONEY -> gpModelIndices[...] + SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, MI_MONEY, PICKUP_MONEY, GET_INTEGER_PARAM(3))); StoreParameters(&m_nIp, 1); return 0; } @@ -1953,7 +1984,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - pPed->m_wepAccuracy = GET_INTEGER_PARAM(1) * 1.25f; + pPed->m_wepAccuracy = Min(100, GET_INTEGER_PARAM(1) * 1.25f); return 0; } case COMMAND_GET_CAR_SPEED: @@ -1969,7 +2000,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { char name[KEY_LENGTH_IN_SCRIPT]; strncpy(name, (const char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT); - // unknown call FUN_29df68(name) on PS2 + // unknown call FUN_29df68(name) on PS2 - not on PSP m_nIp += KEY_LENGTH_IN_SCRIPT; CColStore::RemoveAllCollision(); CCutsceneMgr::LoadCutsceneData(name); @@ -2010,7 +2041,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) return 0; } case COMMAND_CLEAR_CUTSCENE: - // unknown call on PS2 FUN_29DFA0(); + // unknown call on PS2 FUN_29DFA0() - not on PSP printf("clear cutscene\n"); CCutsceneMgr::DeleteCutsceneData(); return 0; diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp index b6bc9b4c..91c45bf2 100644 --- a/src/control/Script4.cpp +++ b/src/control/Script4.cpp @@ -789,7 +789,22 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) pPed->m_pMyVehicle->RemovePassenger(pPed); } if (pPed->m_vehDoor) { - if (pPed->GetPedState() == PED_EXIT_CAR || pPed->GetPedState() == PED_DRAG_FROM_CAR) { + eDoors door; + switch (pPed->m_vehDoor) { + case CAR_DOOR_LF: + door = DOOR_FRONT_LEFT; + break; + case CAR_DOOR_RF: + door = DOOR_FRONT_RIGHT; + break; + case CAR_DOOR_LR: + door = DOOR_REAR_LEFT; + break; + case CAR_DOOR_RR: + door = DOOR_REAR_RIGHT; + break; + } + if (pPed->GetPedState() == PED_EXIT_CAR || pPed->GetPedState() == PED_DRAG_FROM_CAR || !pPed->m_pMyVehicle->IsDoorClosed(door)) { uint8 flags = 0; if (pPed->m_pMyVehicle->IsBike()) { if (pPed->m_vehDoor == CAR_DOOR_LF || @@ -1397,7 +1412,9 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) CollectParameters(&m_nIp, 1); DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND); DMAudio.PlayFrontEndTrack(GET_INTEGER_PARAM(0) + STREAMED_SOUND_MISSION_COMPLETED - 1, FALSE); +#ifndef GTA_PSP //DMAudio.SaveAnnouncementsWhenMissionPassedPlayed(); // TODO! +#endif return 0; } case COMMAND_CLEAR_AREA: @@ -1407,6 +1424,9 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); CWorld::ClearExcitingStuffFromArea(pos, GET_FLOAT_PARAM(3), GET_INTEGER_PARAM(4)); +#ifdef GTA_MOBILE + // CPopulation::ms_blockPedCreationForAFrame = true; +#endif return 0; } case COMMAND_FREEZE_ONSCREEN_TIMER: @@ -1471,7 +1491,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) float size = Max(0.0f, GET_FLOAT_PARAM(7)); eParticleObjectType type = (eParticleObjectType)GET_INTEGER_PARAM(0); RwRGBA color; - if (type == POBJECT_SMOKE_TRAIL){ // 17 in LCS -- assuming enum is the same + if (type == POBJECT_SMOKE_TRAIL){ color.alpha = -1; color.red = GET_INTEGER_PARAM(8); color.green = GET_INTEGER_PARAM(9); @@ -1790,8 +1810,6 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) continue; if (CModelInfo::IsCarModel(model) || CModelInfo::IsBikeModel(model)) { switch (model) { - // TODO(LCS): do it right - // apparently leeds didn't :lmao: case MI_LANDSTAL: case MI_LINERUN: case MI_RIO: @@ -1804,6 +1822,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) case MI_FBICAR: case MI_MRWHOOP: case MI_BFINJECT: + case MI_HEARSE: case MI_HUNTER: case MI_POLICE: case MI_ENFORCER: @@ -1817,13 +1836,15 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) case MI_ANGEL: case MI_COACH: case MI_RCBANDIT: - //case MI_ROMERO: - //case MI_PACKER: - //case MI_SENTXS: + case MI_PACKER: + case MI_SENTXS: case MI_SQUALO: case MI_SEASPAR: case MI_PIZZABOY: - //case MI_GANGBUR: + case MI_NOODLEBOY: + case MI_ANGEL2: + case MI_SANCHEZ2: + case MI_GANGBUR: case MI_AIRTRAIN: case MI_DEADDODO: case MI_SPEEDER: @@ -1832,45 +1853,49 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) case MI_FLATBED: case MI_YANKEE: case MI_CADDY: - //case MI_ZEBRA: + case MI_BORGNINE: case MI_TOPFUN: + case MI_CAMPVAN: + case MI_BALLOT: case MI_SKIMMER: case MI_RCBARON: case MI_RCRAIDER: case MI_SPARROW: case MI_PATRIOT: - //case MI_LOVEFIST: + case MI_LOVEFIST: case MI_COASTG: case MI_DINGHY: - //case MI_HERMES: - //case MI_SABRETUR: + case MI_HERMES: + case MI_SABRETUR: case MI_PHEONIX: - //case MI_WALTON: + case MI_WALTON: case MI_COMET: - //case MI_DELUXO: - //case MI_BURRITO: - //case MI_SPAND: + case MI_DELUXO: + case MI_BURRITO: + case MI_SPAND: case MI_MARQUIS: case MI_BAGGAGE: - //case MI_KAUFMAN: + case MI_KAUFMAN: case MI_MAVERICK: case MI_VCNMAV: - //case MI_RANCHER: + case MI_RANCHER: case MI_FBIRANCH: case MI_JETMAX: - //case MI_HOTRING: + case MI_HOTRING: case MI_SANDKING: - //case MI_BLISTAC: + case MI_BLISTAC: case MI_POLMAV: - //case MI_BOXVILLE: - //case MI_BENSON: - //case MI_MESA: + case MI_BOXVILLE: + case MI_BENSON: + case MI_MESA: case MI_RCGOBLIN: - //case MI_HOTRINA: - //case MI_HOTRINB: - //case MI_BLOODRA: - //case MI_BLOODRB: + case MI_HOTRINA: + case MI_HOTRINB: + case MI_BLOODRA: + case MI_BLOODRB: case MI_VICECHEE: + case MI_CABBIE: + case MI_MAFIA: model = -1; break; case MI_IDAHO: @@ -1884,23 +1909,22 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) case MI_MOONBEAM: case MI_ESPERANT: case MI_TAXI: - //case MI_WASHING: + case MI_WASHING: case MI_BOBCAT: case MI_BANSHEE: - //case MI_CABBIE: case MI_STALLION: case MI_RUMPO: - //case MI_ADMIRAL: + case MI_ADMIRAL: case MI_PCJ600: case MI_FAGGIO: case MI_FREEWAY: - //case MI_GLENDALE: - //case MI_OCEANIC: + case MI_GLENDALE: + case MI_OCEANIC: case MI_SANCHEZ: - //case MI_SABRE: - //case MI_REGINA: - //case MI_VIRGO: - //case MI_GREENWOO: + case MI_SABRE: + case MI_REGINA: + case MI_VIRGO: + case MI_GREENWOO: break; default: printf("CREATE_RANDOM_CAR_FOR_CAR_PARK - Unknown car model %d\n", CStreaming::ms_vehiclesLoaded[index]); @@ -1973,7 +1997,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) #else CTimer::Stop(); #endif - CStreaming::LoadScene(pos); + CStreaming::LoadSceneCollision(pos); #ifdef FIX_BUGS CTimer::Suspend(); #else diff --git a/src/control/Script5.cpp b/src/control/Script5.cpp index 75e33e36..45952497 100644 --- a/src/control/Script5.cpp +++ b/src/control/Script5.cpp @@ -2476,7 +2476,7 @@ void CTheScripts::HighlightImportantArea(uint32 id, float x1, float y1, float x2 center.x = (infX + supX) / 2; center.y = (infY + supY) / 2; center.z = (z <= MAP_Z_LOW_LIMIT) ? CWorld::FindGroundZForCoord(center.x, center.y) : z; - CShadows::RenderIndicatorShadow(id, 2, gpGoalTex, ¢er, supX - center.x, 0.0f, 0.0f, center.y - supY, 0); + CShadows::RenderIndicatorShadow(id, 2, nil, ¢er, supX - center.x, 0.0f, 0.0f, center.y - supY, 0); } void CTheScripts::HighlightImportantAngledArea(uint32 id, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, float z) @@ -2670,7 +2670,10 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob } else { pPed->bScriptObjectiveCompleted = false; - pPed->SetObjective(objective); + if (objective == OBJECTIVE_LEAVE_CAR) + pPed->SetObjective(objective); + else + pPed->SetObjective(objective, pPed->m_pMyVehicle); } } } @@ -2766,7 +2769,7 @@ void CTheScripts::CleanUpThisPed(CPed* pPed) flees = true; } pPed->ClearObjective(); - pPed->SetWaitState(WAITSTATE_FALSE, nil); // third parameter is 0 TODO? + pPed->SetWaitState(WAITSTATE_FALSE, nil); pPed->bRespondsToThreats = true; pPed->bScriptObjectiveCompleted = false; pPed->bKindaStayInSamePlace = false; diff --git a/src/control/Script6.cpp b/src/control/Script6.cpp index 8dcabd30..94378cc0 100644 --- a/src/control/Script6.cpp +++ b/src/control/Script6.cpp @@ -38,6 +38,7 @@ #include "CarAI.h" #include "Pickups.h" #include "Fluff.h" +#include "CustomSoundTrack.h" // LCS: file done except TODOs @@ -109,9 +110,12 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); - CAutomobile* pCar = (CAutomobile*)pVehicle; - pCar->bNotDamagedUpsideDown = (GET_INTEGER_PARAM(1) != 0); + //assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); + // they call this for bikes again, we don't really want to destroy the structure... +#ifdef FIX_BUGS + if (pVehicle->m_vehType == VEHICLE_TYPE_CAR) +#endif + ((CAutomobile*)pVehicle)->bNotDamagedUpsideDown = (GET_INTEGER_PARAM(1) != 0); return 0; } case COMMAND_CAN_PLAYER_START_MISSION: @@ -400,7 +404,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) if (size <= 0) size = CTheScripts::LargestMissionScriptSize; CFileMgr::Seek(gScriptsFile, offset, 0); - CFileMgr::Read(gScriptsFile, (const char*)&CTheScripts::ScriptSpace[CTheScripts::MainScriptSize], size); // TODO + CFileMgr::Read(gScriptsFile, (const char*)&CTheScripts::ScriptSpace[CTheScripts::MainScriptSize], size); CRunningScript* pMissionScript = CTheScripts::StartNewScript(CTheScripts::MainScriptSize); CTimer::Resume(); pMissionScript->m_bIsMissionScript = true; @@ -468,8 +472,8 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) return 0; case COMMAND_SET_RADIO_CHANNEL: CollectParameters(&m_nIp, 2); - // if (base::cSingleton<cCustomSoundTrack>::Instance()->unk()) - TODO on PS2, but it's not on mobile - DMAudio.SetRadioChannel(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); + if (!cCustomSoundTrack::Instance()->IsPlaying()) + DMAudio.SetRadioChannel(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); return 0; /* case COMMAND_OVERRIDE_HOSPITAL_LEVEL: diff --git a/src/control/Script8.cpp b/src/control/Script8.cpp index 38c28069..c4f80e79 100644 --- a/src/control/Script8.cpp +++ b/src/control/Script8.cpp @@ -3,6 +3,7 @@ #include "Script.h" #include "ScriptCommands.h" +#include "Bike.h" #include "DMAudio.h" #ifdef MORE_LANGUAGES #include "Frontend.h" @@ -378,10 +379,25 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); - if (pVehicle->m_bombType != CARBOMB_NONE) { - pVehicle->m_bombType = CARBOMB_NONE; - pVehicle->m_pBombRigger = nil; +#ifdef FIX_BUGS + if (pVehicle->IsCar()) { + if (((CAutomobile*)pVehicle)->m_bombType != CARBOMB_NONE) { + ((CAutomobile*)pVehicle)->m_bombType = CARBOMB_NONE; + ((CAutomobile*)pVehicle)->m_pBombRigger = nil; + } + } + else if (pVehicle->IsBike()) { + if (((CBike*)pVehicle)->m_bombType != CARBOMB_NONE) { + ((CBike*)pVehicle)->m_bombType = CARBOMB_NONE; + ((CBike*)pVehicle)->m_pBombRigger = nil; + } + } +#else + if (((CAutomobile*)pVehicle)->m_bombType != CARBOMB_NONE) { + ((CAutomobile*)pVehicle)->m_bombType = CARBOMB_NONE; + ((CAutomobile*)pVehicle)->m_pBombRigger = nil; } +#endif return 0; } case COMMAND_IS_JAPANESE_GAME: |