summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwithmorten <morten.with@gmail.com>2021-07-15 23:09:28 +0200
committerGitHub <noreply@github.com>2021-07-15 23:09:28 +0200
commit8018e40ebf2e7033e1929b4ed638afb3de7da692 (patch)
tree8d6aad5743586ae82da644338f332ec34c179aa7
parentMake PS2 VB files work together with PC audio files (diff)
parentFix Cheat menu debug script loader (diff)
downloadre3-8018e40ebf2e7033e1929b4ed638afb3de7da692.tar
re3-8018e40ebf2e7033e1929b4ed638afb3de7da692.tar.gz
re3-8018e40ebf2e7033e1929b4ed638afb3de7da692.tar.bz2
re3-8018e40ebf2e7033e1929b4ed638afb3de7da692.tar.lz
re3-8018e40ebf2e7033e1929b4ed638afb3de7da692.tar.xz
re3-8018e40ebf2e7033e1929b4ed638afb3de7da692.tar.zst
re3-8018e40ebf2e7033e1929b4ed638afb3de7da692.zip
Diffstat (limited to '')
-rw-r--r--src/control/Script.cpp28
-rw-r--r--src/control/Script.h1
-rw-r--r--src/control/Script6.cpp4
3 files changed, 20 insertions, 13 deletions
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index e06acdc3..b07c0701 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -1771,20 +1771,12 @@ int scriptToLoad = 0;
int open_script()
{
- // glfwGetKey doesn't work because of CGame::Initialise is blocking
- CPad::UpdatePads();
- if (CPad::GetPad(0)->GetChar('G'))
- scriptToLoad = 0;
- if (CPad::GetPad(0)->GetChar('R'))
- scriptToLoad = 1;
- if (CPad::GetPad(0)->GetChar('D'))
- scriptToLoad = 2;
switch (scriptToLoad) {
- case 0: return CFileMgr::OpenFile("main.scm", "rb");
- case 1: return CFileMgr::OpenFile("main_freeroam.scm", "rb");
- case 2: return CFileMgr::OpenFile("main_d.scm", "rb");
+ case 0: return CFileMgr::OpenFile("data\\main.scm", "rb");
+ case 1: return CFileMgr::OpenFile("data\\main_freeroam.scm", "rb");
+ case 2: return CFileMgr::OpenFile("data\\main_d.scm", "rb");
}
- return CFileMgr::OpenFile("main.scm", "rb");
+ return CFileMgr::OpenFile("data\\main.scm", "rb");
}
#endif
@@ -1800,10 +1792,16 @@ void CTheScripts::Init()
MissionCleanUp.Init();
UpsideDownCars.Init();
StuckCars.Init();
- CFileMgr::SetDir("data");
#ifdef USE_DEBUG_SCRIPT_LOADER
+ // glfwGetKey doesn't work because of CGame::Initialise is blocking
+ CPad::UpdatePads();
+ if(CPad::GetPad(0)->GetChar('G')) scriptToLoad = 0;
+ if(CPad::GetPad(0)->GetChar('R')) scriptToLoad = 1;
+ if(CPad::GetPad(0)->GetChar('D')) scriptToLoad = 2;
+
int mainf = open_script();
#else
+ CFileMgr::SetDir("data");
int mainf = CFileMgr::OpenFile("main.scm", "rb");
#endif
CFileMgr::Read(mainf, (char*)ScriptSpace, SIZE_MAIN_SCRIPT);
@@ -4392,7 +4390,11 @@ CTheScripts::SwitchToMission(int32 mission)
CTimer::Suspend();
int offset = CTheScripts::MultiScriptArray[mission];
CFileMgr::ChangeDir("\\");
+#ifdef USE_DEBUG_SCRIPT_LOADER
+ int handle = open_script();
+#else
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);
diff --git a/src/control/Script.h b/src/control/Script.h
index 5682024b..cefd6747 100644
--- a/src/control/Script.h
+++ b/src/control/Script.h
@@ -591,5 +591,6 @@ void RetryMission(int, int);
#endif
#ifdef USE_DEBUG_SCRIPT_LOADER
+int open_script();
extern int scriptToLoad;
#endif \ No newline at end of file
diff --git a/src/control/Script6.cpp b/src/control/Script6.cpp
index 31be6987..c9b2b070 100644
--- a/src/control/Script6.cpp
+++ b/src/control/Script6.cpp
@@ -305,7 +305,11 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
CTimer::Suspend();
int offset = CTheScripts::MultiScriptArray[ScriptParams[0]];
CFileMgr::ChangeDir("\\");
+#ifdef USE_DEBUG_SCRIPT_LOADER
+ int handle = open_script();
+#else
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);