summaryrefslogtreecommitdiffstats
path: root/src/control/ScriptDebug.cpp
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2021-08-08 09:51:04 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2021-08-08 09:51:04 +0200
commit0c4ab5b6097692667cd1469899e2eae78fad6be6 (patch)
tree792a8821e1a799810ff5c6be9717844e8b9f0bbb /src/control/ScriptDebug.cpp
parentmore cherry-pick fix (diff)
downloadre3-0c4ab5b6097692667cd1469899e2eae78fad6be6.tar
re3-0c4ab5b6097692667cd1469899e2eae78fad6be6.tar.gz
re3-0c4ab5b6097692667cd1469899e2eae78fad6be6.tar.bz2
re3-0c4ab5b6097692667cd1469899e2eae78fad6be6.tar.lz
re3-0c4ab5b6097692667cd1469899e2eae78fad6be6.tar.xz
re3-0c4ab5b6097692667cd1469899e2eae78fad6be6.tar.zst
re3-0c4ab5b6097692667cd1469899e2eae78fad6be6.zip
Diffstat (limited to 'src/control/ScriptDebug.cpp')
-rw-r--r--src/control/ScriptDebug.cpp30
1 files changed, 10 insertions, 20 deletions
diff --git a/src/control/ScriptDebug.cpp b/src/control/ScriptDebug.cpp
index bb0cfd45..2e6fe332 100644
--- a/src/control/ScriptDebug.cpp
+++ b/src/control/ScriptDebug.cpp
@@ -1946,8 +1946,7 @@ void CRunningScript::LogAfterProcessingCommand(int32 command)
CDebug::DebugAddText(commandInfo);
}
}
-
-#endif
+}
#ifdef MISSION_SWITCHER
void
@@ -1975,30 +1974,21 @@ CTheScripts::SwitchToMission(int32 mission)
#ifdef MISSION_REPLAY
missionRetryScriptIndex = mission;
-#ifdef USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT
- if (CTheScripts::MissionSupportsMissionReplay(missionRetryScriptIndex)) {
- SaveGameForPause(4);
- }
-#endif
#endif
CTimer::Suspend();
- int offset = CTheScripts::MultiScriptArray[mission];
-#ifdef USE_DEBUG_SCRIPT_LOADER
- CFileMgr::ChangeDir("\\data\\");
- int handle = CFileMgr::OpenFile(scriptfile, "rb");
- CFileMgr::ChangeDir("\\");
-#else
- CFileMgr::ChangeDir("\\");
- int handle = CFileMgr::OpenFile("data\\main.scm", "rb");
-#endif
- CFileMgr::Seek(handle, offset, 0);
- CFileMgr::Read(handle, (const char*)&CTheScripts::ScriptSpace[SIZE_MAIN_SCRIPT], SIZE_MISSION_SCRIPT);
- CFileMgr::CloseFile(handle);
- CRunningScript* pMissionScript = CTheScripts::StartNewScript(SIZE_MAIN_SCRIPT);
+ int offset = CTheScripts::MultiScriptArray[mission] + 8;
+ int size = CTheScripts::MultiScriptArray[mission + 1] - CTheScripts::MultiScriptArray[mission];
+ if (size <= 0)
+ size = CTheScripts::LargestMissionScriptSize;
+ CFileMgr::Seek(gScriptsFile, offset, 0);
+ CFileMgr::Read(gScriptsFile, (const char*)&CTheScripts::ScriptSpace[CTheScripts::MainScriptSize], size);
+ CRunningScript* pMissionScript = CTheScripts::StartNewScript(CTheScripts::MainScriptSize);
CTimer::Resume();
pMissionScript->m_bIsMissionScript = true;
pMissionScript->m_bMissionFlag = true;
CTheScripts::bAlreadyRunningAMissionScript = true;
+ memset(&CTheScripts::ScriptSpace[CTheScripts::NumTrueGlobals * 4 + 8], 0, CTheScripts::MostGlobals * 4);
CGameLogic::ClearShortCut();
+ pMissionScript->Process();
}
#endif