diff options
Diffstat (limited to 'src/control/Script.cpp')
-rw-r--r-- | src/control/Script.cpp | 160 |
1 files changed, 132 insertions, 28 deletions
diff --git a/src/control/Script.cpp b/src/control/Script.cpp index f52dda03..02701cc0 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -127,7 +127,97 @@ static const char* nonMissionScripts[] = { "rc4", "hj", "usj", - "mayhem" + "mayhem", + "range", + "race", + "pizza", + "rcheli", + "rcplne1", + "rcrace1", + "cokerun", + "buypro1", + "carbuy1", + "buypro2", + "icecut", + "icecre1", + "buypro3", + "buypro4", + "buypro5", + "buypro6", + "buypro7", + "buypro8", + "buypro9", + "buypro10", + "buypro11", + "ovalrng", + "mm", + "kickst", + "heli1sc", + "heli2sc", + "heli3sc", + "heli4sc", + "carpark_1", + "bmx_1", + "bmx_2" +}; + +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; @@ -143,6 +233,11 @@ bool gbTryingPorn4Again; int IsInAmmunation; int MissionSkipLevel; +#ifdef USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT +bool UsingMobileScript; +bool AlreadySavedGame; +#endif + #endif #ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT @@ -2703,6 +2798,10 @@ bool CTheScripts::Init(bool loaddata) PrintToLog(init_msg); CFileMgr::SetDir(""); #endif +#ifdef USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT + UsingMobileScript = false; + AlreadySavedGame = false; +#endif return retval; } @@ -2779,6 +2878,7 @@ void CTheScripts::Process() #ifdef MISSION_REPLAY static uint32 TimeToWaitTill; + static bool AlreadyResetHealth; switch (AllowMissionReplay) { case 2: AllowMissionReplay = 3; @@ -2794,9 +2894,19 @@ void CTheScripts::Process() break; case 6: AllowMissionReplay = 7; + AlreadyResetHealth = false; TimeToWaitTill = CTimer::GetTimeInMilliseconds() + 500; break; case 7: + if (!AlreadyResetHealth) { + AlreadyResetHealth = true; + CPlayerPed* pPlayerPed = FindPlayerPed(); + if (pPlayerPed) { + CPlayerInfo* pPlayerInfo = pPlayerPed->GetPlayerInfoForThisPlayerPed(); + if (pPlayerInfo) + pPlayerPed->m_fHealth = pPlayerInfo->m_nMaxHealth; + } + } if (TimeToWaitTill < CTimer::GetTimeInMilliseconds()) { AllowMissionReplay = 0; return; @@ -3028,11 +3138,11 @@ int8 CRunningScript::ProcessOneCommand() } } #elif defined USE_BASIC_SCRIPT_DEBUG_OUTPUT - if (m_bMissionFlag) { - char tmp[128]; - sprintf(tmp, "Comm %d Cmp %d", command, m_bCondResult); - CDebug::DebugAddText(tmp); - } + if (m_bMissionFlag) { + char tmp[128]; + sprintf(tmp, "Comm %d Cmp %d", command, m_bCondResult); + CDebug::DebugAddText(tmp); + } #endif return retval; } @@ -4447,14 +4557,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) CollectParameters(&m_nIp, 2); CVehicle* car = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(car); -#if defined MISSION_REPLAY && defined SIMPLIER_MISSIONS - car->AutoPilot.m_nCruiseSpeed = GET_FLOAT_PARAM(1); - if (missionRetryScriptIndex == 40 && car->GetModelIndex() == MI_CHEETAH) // Turismo - car->AutoPilot.m_nCruiseSpeed = 8 * car->AutoPilot.m_nCruiseSpeed / 10; - car->AutoPilot.m_nCruiseSpeed = Min(car->AutoPilot.m_nCruiseSpeed, 60.0f * car->pHandling->Transmission.fMaxCruiseVelocity); -#else car->AutoPilot.m_nCruiseSpeed = Min(GET_FLOAT_PARAM(1), 60.0f * car->pHandling->Transmission.fMaxCruiseVelocity); -#endif return 0; } case COMMAND_SET_CAR_DRIVING_STYLE: @@ -4529,8 +4632,12 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) { wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp); #ifdef MISSION_REPLAY - if (strcmp((char*)&CTheScripts::ScriptSpace[m_nIp], "M_FAIL") == 0 && CanAllowMissionReplay()) - AllowMissionReplay = 1; + if (strcmp((char*)&CTheScripts::ScriptSpace[m_nIp - KEY_LENGTH_IN_SCRIPT], "M_FAIL") == 0) { + if (AllowMissionReplay == 7) + AllowMissionReplay = 0; + if (CanAllowMissionReplay()) + AllowMissionReplay = 1; + } #endif CollectParameters(&m_nIp, 2); CMessages::AddBigMessage(key, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1) - 1); @@ -5199,21 +5306,15 @@ bool CRunningScript::CanAllowMissionReplay() { if (AllowMissionReplay) return false; - if (CStats::LastMissionPassedName[0] == '\0') - return false; - for (int i = 0; i < ARRAY_SIZE(nonMissionScripts); i++) { - if (strcmp(m_abScriptName, nonMissionScripts[i]) == 0) - return false; + for (int i = 0; i < ARRAY_SIZE(MissionScripts); i++) { + if (!CGeneral::faststricmp(m_abScriptName, MissionScripts[i])) + return true; } - return true; + return false; } uint32 AddExtraDeathDelay() { - if (missionRetryScriptIndex == 63) - return 7000; - if (missionRetryScriptIndex == 64) - return 4000; return 1000; } @@ -5221,7 +5322,7 @@ void RetryMission(int type, int unk) { if (type == 0) { doingMissionRetry = true; - FrontEndMenuManager.m_nCurrScreen = 57; // MENUPAGE_MISSION_RETRY + FrontEndMenuManager.m_nCurrScreen = MENUPAGE_MISSION_RETRY; FrontEndMenuManager.RequestFrontEndStartUp(); } else if (type == 2) { @@ -5259,8 +5360,11 @@ CTheScripts::SwitchToMission(int32 mission) #ifdef MISSION_REPLAY missionRetryScriptIndex = mission; - if (missionRetryScriptIndex == 19) - CStats::LastMissionPassedName[0] = '\0'; +#ifdef USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT + if (CTheScripts::MissionSupportsMissionReplay(missionRetryScriptIndex)) { + SaveGameForPause(4); + } +#endif #endif CTimer::Suspend(); int offset = CTheScripts::MultiScriptArray[mission] + 8; |