summaryrefslogtreecommitdiffstats
path: root/src/control/Script6.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/control/Script6.cpp30
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: