summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/control/Script.cpp171
-rw-r--r--src/control/Script.h3
-rw-r--r--src/control/Script6.cpp2
-rw-r--r--src/control/ScriptDebug.cpp30
4 files changed, 76 insertions, 130 deletions
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 389d89cd..eae3ff08 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -112,112 +112,71 @@ base::cSList<script_corona> CTheScripts::mCoronas;
#ifdef MISSION_REPLAY
-static const char* nonMissionScripts[] = {
- "copcar",
- "ambulan",
- "taxi",
- "firetru",
- "rampage",
- "t4x4_1",
- "t4x4_2",
- "t4x4_3",
- "rc1",
- "rc2",
- "rc3",
- "rc4",
- "hj",
- "usj",
- "mayhem",
- "range",
- "race",
- "pizza",
- "rcheli",
- "rcplne1",
- "rcrace1",
- "cokerun",
- "buypro1",
- "carbuy1",
- "buypro2",
- "icecut",
- "icecre1",
- "buypro3",
- "buypro4",
- "buypro5",
- "buypro6",
- "buypro7",
- "buypro8",
- "buypro9",
- "buypro10",
- "buypro11",
- "ovalrng",
- "mm",
- "kickst",
- "heli1sc",
- "heli2sc",
- "heli3sc",
- "heli4sc",
- "carpark_1",
- "bmx_1",
- "bmx_2"
-};
-
static const char* MissionScripts[] = {
- "LAWYER1",
- "LAWYER2",
- "LAWYER3",
- "LAWYER4",
- "GENERL1",
- "COL2",
- "GENERL3",
- "COL_4",
- "COL_5",
- "baron1",
- "baron2",
- "baron3",
- "baron4",
- "kent1",
- "baron5",
- "serg1",
- "serg2",
- "serg3",
- "bankjo1",
- "bankjo2",
- "bankjo3",
- "bankjo4",
- "phil1",
- "phil2",
- "porno1",
- "porno2",
- "porno3",
- "porno4",
- "protec1",
- "protec2",
- "protec3",
- "count1",
- "count2",
- "CAP_1",
- "FIN_1",
- "bike1",
- "bike2",
- "bike3",
- "rockb1",
- "rockb2",
- "rockb3",
- "cuban1",
- "cuban2",
- "cuban3",
- "cuban4",
- "hait1",
- "hait2",
- "hait3",
- "assin1",
- "assin2",
- "assin3",
- "assin4",
- "assin5",
- "taxwar1",
- "taxwar2",
- "taxwar3"
+ "VIC2",
+ "VIC3",
+ "VIC4",
+ "VIC5",
+ "VIC6",
+ "VIC7",
+ "SAL1",
+ "SAL2",
+ "SAL3",
+ "SAL4",
+ "SAL5",
+ "SAL6",
+ "SAL7",
+ "SAL8",
+ "JDT1",
+ "JDT2",
+ "JDT3",
+ "JDT4",
+ "JDT5",
+ "JDT6",
+ "JDT7",
+ "JDT8",
+ "MAC1",
+ "MAC2",
+ "MAC3",
+ "MAC4",
+ "MAC5",
+ "SALS1",
+ "SALS2",
+ "SALS3",
+ "SALS4",
+ "SALS5",
+ "SALS6",
+ "RAYS1",
+ "RAYS2",
+ "RAYS3",
+ "RAYS4",
+ "RAYS5",
+ "DONS1",
+ "DONS2",
+ "DONS3",
+ "DONS4",
+ "DONS5",
+ "DONS6",
+ "DONS7",
+ "NEDS1",
+ "NEDS2",
+ "NEDS3",
+ "NEDS4",
+ "SALH1",
+ "SALH2",
+ "SALH3",
+ "SALH4",
+ "SALH5",
+ "DONH1",
+ "DONH2",
+ "DONH3",
+ "DONH4",
+ "DONH5",
+ "DONH6",
+ "TOSH1",
+ "TOSH2",
+ "TOSH3",
+ "TOSH4"
};
int AllowMissionReplay;
@@ -234,7 +193,6 @@ int IsInAmmunation;
int MissionSkipLevel;
#ifdef USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT
-bool UsingMobileScript;
bool AlreadySavedGame;
#endif
@@ -1003,7 +961,6 @@ bool CTheScripts::Init(bool loaddata)
LogAfterScriptInitializing();
#endif
#ifdef USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT
- UsingMobileScript = false;
AlreadySavedGame = false;
#endif
return retval;
diff --git a/src/control/Script.h b/src/control/Script.h
index 98db6c89..589127e5 100644
--- a/src/control/Script.h
+++ b/src/control/Script.h
@@ -668,7 +668,7 @@ public:
#ifdef USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT
static bool MissionSupportsMissionReplay(int index)
{
- return index >= 3 && index <= 35 || index >= 51 && index <= 65 || index >= 67 && index <= 74 || index >= 83 && index <= 87;
+ return (index >= 48 && index <= 61) || (index >= 63 && index <= 117);
}
#endif
static bool IsFortStauntonDestroyed() { return FSDestroyedFlag && *(int32*)&ScriptSpace[FSDestroyedFlag] == 1; }
@@ -700,7 +700,6 @@ extern int IsInAmmunation;
extern int MissionSkipLevel;
#ifdef USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT
-extern bool UsingMobileScript;
extern bool AlreadySavedGame;
#endif
diff --git a/src/control/Script6.cpp b/src/control/Script6.cpp
index 29487c62..bc3b4278 100644
--- a/src/control/Script6.cpp
+++ b/src/control/Script6.cpp
@@ -381,7 +381,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
#ifdef MISSION_REPLAY
missionRetryScriptIndex = GET_INTEGER_PARAM(0);
#ifdef USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT
- if (!UsingMobileScript && CTheScripts::MissionSupportsMissionReplay(missionRetryScriptIndex)){
+ if (CTheScripts::MissionSupportsMissionReplay(missionRetryScriptIndex)){
if (!AlreadySavedGame) {
m_nIp = oldIp - 2;
SaveGameForPause(4);
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