mirror of
https://github.com/mrxenginner/reVC.git
synced 2026-10-11 09:48:15 +08:00
Fix debug script loader crashing missions
* open_script is now exposed in Script.h, perhaps it should be namespaced as a static method on CTheScripts? I'm unsure what is preferred. * I've moved the joypad code out of open_script to prevent buttons held down at mission load time from changing the scriptToLoad.
This commit is contained in:
1 parent
71f28c8cf5
commit
33c45e4ae0
3 files changed
+16
-13
No files matched your search
+11
-13
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user