diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2021-01-09 15:35:57 +0100 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2021-01-09 15:35:57 +0100 |
commit | a38d0a0fbd4801f04330d093d3ee9d699cb63aba (patch) | |
tree | ec23fc2bbabdade809b228ebbb388e378c0896e6 /src/control/Script6.cpp | |
parent | Merge remote-tracking branch 'upstream/lcs' into lcs (diff) | |
parent | more script (diff) | |
download | re3-a38d0a0fbd4801f04330d093d3ee9d699cb63aba.tar re3-a38d0a0fbd4801f04330d093d3ee9d699cb63aba.tar.gz re3-a38d0a0fbd4801f04330d093d3ee9d699cb63aba.tar.bz2 re3-a38d0a0fbd4801f04330d093d3ee9d699cb63aba.tar.lz re3-a38d0a0fbd4801f04330d093d3ee9d699cb63aba.tar.xz re3-a38d0a0fbd4801f04330d093d3ee9d699cb63aba.tar.zst re3-a38d0a0fbd4801f04330d093d3ee9d699cb63aba.zip |
Diffstat (limited to 'src/control/Script6.cpp')
-rw-r--r-- | src/control/Script6.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/control/Script6.cpp b/src/control/Script6.cpp index 76780941..8915a089 100644 --- a/src/control/Script6.cpp +++ b/src/control/Script6.cpp @@ -374,32 +374,30 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 1); - if (CTheScripts::NumberOfExclusiveMissionScripts > 0 && ScriptParams[0] <= UINT16_MAX - 2) - return 0; + if (CTheScripts::NumberOfExclusiveMissionScripts > 0) { + if (ScriptParams[0] < UINT16_MAX - 1) + return 0; + ScriptParams[0] = UINT16_MAX - ScriptParams[0]; + } #ifdef MISSION_REPLAY missionRetryScriptIndex = ScriptParams[0]; if (missionRetryScriptIndex == 19) CStats::LastMissionPassedName[0] = '\0'; #endif CTimer::Suspend(); - int offset = CTheScripts::MultiScriptArray[ScriptParams[0]]; -#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[ScriptParams[0]] + 8; + int size = CTheScripts::MultiScriptArray[ScriptParams[0] + 1] - CTheScripts::MultiScriptArray[ScriptParams[0]]; + if (size <= 0) + size = CTheScripts::LargestMissionScriptSize; + CFileMgr::Seek(gScriptsFile, offset, 0); + CFileMgr::Read(gScriptsFile, (const char*)&CTheScripts::ScriptSpace[CTheScripts::MainScriptSize], size); // TODO + CRunningScript* pMissionScript = CTheScripts::StartNewScript(CTheScripts::MainScriptSize); CTimer::Resume(); pMissionScript->m_bIsMissionScript = true; pMissionScript->m_bMissionFlag = true; CTheScripts::bAlreadyRunningAMissionScript = true; - CGameLogic::ClearShortCut(); + memset(&CTheScripts::ScriptSpace[CTheScripts::NumTrueGlobals * 4 + 8], 0, CTheScripts::MostGlobals * 4); + pMissionScript->Process(); return 0; } case COMMAND_SET_OBJECT_DRAW_LAST: |