From c69edce8007178755d979f638852abb9359950c2 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 1 Aug 2021 12:54:05 +0300 Subject: mission replay --- src/control/Script6.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'src/control/Script6.cpp') diff --git a/src/control/Script6.cpp b/src/control/Script6.cpp index 0e1256fd..29487c62 100644 --- a/src/control/Script6.cpp +++ b/src/control/Script6.cpp @@ -125,10 +125,6 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) case COMMAND_MAKE_PLAYER_SAFE_FOR_CUTSCENE: { CollectParameters(&m_nIp, 1); -#ifdef MISSION_REPLAY - AllowMissionReplay = 0; - SaveGameForPause(3); -#endif CPlayerInfo* pPlayerInfo = &CWorld::Players[GET_INTEGER_PARAM(0)]; CPad::GetPad(GET_INTEGER_PARAM(0))->SetDisablePlayerControls(PLAYERCONTROL_CUTSCENE); pPlayerInfo->MakePlayerSafe(true); @@ -372,6 +368,9 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) return 0; case COMMAND_LOAD_AND_LAUNCH_MISSION_INTERNAL: { +#ifdef USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT + uint32 oldIp = m_nIp; +#endif CollectParameters(&m_nIp, 1); if (CTheScripts::NumberOfExclusiveMissionScripts > 0) { @@ -381,8 +380,19 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) } #ifdef MISSION_REPLAY missionRetryScriptIndex = GET_INTEGER_PARAM(0); - if (missionRetryScriptIndex == 19) - CStats::LastMissionPassedName[0] = '\0'; +#ifdef USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT + if (!UsingMobileScript && CTheScripts::MissionSupportsMissionReplay(missionRetryScriptIndex)){ + if (!AlreadySavedGame) { + m_nIp = oldIp - 2; + SaveGameForPause(4); + AlreadySavedGame = true; + return 0; + } + else { + AlreadySavedGame = false; + } + } +#endif #endif CTimer::Suspend(); int offset = CTheScripts::MultiScriptArray[GET_INTEGER_PARAM(0)] + 8; @@ -1094,6 +1104,9 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) } case COMMAND_FAIL_CURRENT_MISSION: CTheScripts::FailCurrentMission = 2; +#ifdef MISSION_REPLAY + MissionSkipLevel = 0; +#endif return 0; case COMMAND_GET_CLOSEST_OBJECT_OF_TYPE: { -- cgit v1.2.3