diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2021-01-18 22:03:52 +0100 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2021-01-18 22:03:52 +0100 |
commit | 923abb94d8bca906427f83873dca85596bd4c8fc (patch) | |
tree | fc3907f15a913fc1f323838d5aa8d2d2376609fa /src/control/Script.cpp | |
parent | fix (diff) | |
parent | fixes (diff) | |
download | re3-923abb94d8bca906427f83873dca85596bd4c8fc.tar re3-923abb94d8bca906427f83873dca85596bd4c8fc.tar.gz re3-923abb94d8bca906427f83873dca85596bd4c8fc.tar.bz2 re3-923abb94d8bca906427f83873dca85596bd4c8fc.tar.lz re3-923abb94d8bca906427f83873dca85596bd4c8fc.tar.xz re3-923abb94d8bca906427f83873dca85596bd4c8fc.tar.zst re3-923abb94d8bca906427f83873dca85596bd4c8fc.zip |
Diffstat (limited to 'src/control/Script.cpp')
-rw-r--r-- | src/control/Script.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 1efcbc9d..c6c13c50 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -5246,23 +5246,19 @@ CTheScripts::SwitchToMission(int32 mission) CStats::LastMissionPassedName[0] = '\0'; #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[CTheScripts::MainScriptSize], CTheScripts::MainScriptSize); - CFileMgr::CloseFile(handle); + 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 |