cherrypick fixes

This commit is contained in:
Nikolay Korolev 2021-08-03 22:14:58 +03:00
parent 5a22896197
commit 6fbb7da82d
2 changed files with 17 additions and 14 deletions

View File

@ -47,6 +47,10 @@ void FlushLog();
#define KEY_LENGTH_IN_SCRIPT (8) #define KEY_LENGTH_IN_SCRIPT (8)
#ifdef USE_DEBUG_SCRIPT_LOADER
extern const char* scriptfile;
#endif
//#define GTA_SCRIPT_COLLECTIVE //#define GTA_SCRIPT_COLLECTIVE
struct intro_script_rectangle struct intro_script_rectangle

View File

@ -4,6 +4,9 @@
#include "ScriptCommands.h" #include "ScriptCommands.h"
#include "Debug.h" #include "Debug.h"
#ifdef MISSION_REPLAY
#include "GenericGameStorage.h"
#endif
#include "FileMgr.h" #include "FileMgr.h"
#include "Messages.h" #include "Messages.h"
#include "Timer.h" #include "Timer.h"
@ -1531,6 +1534,7 @@ void FlushLog()
#endif #endif
} }
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
int CRunningScript::CollectParameterForDebug(char* buf, bool& var) int CRunningScript::CollectParameterForDebug(char* buf, bool& var)
{ {
uint16 varIndex; uint16 varIndex;
@ -1703,17 +1707,6 @@ void CRunningScript::LogAfterProcessingCommand(int32 command)
#endif #endif
void FlushLog()
{
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
#if SCRIPT_LOG_FILE_LEVEL == 1 || SCRIPT_LOG_FILE_LEVEL == 2
if (dbg_log)
fflush(dbg_log);
#endif
#endif
}
#ifdef MISSION_SWITCHER #ifdef MISSION_SWITCHER
void void
CTheScripts::SwitchToMission(int32 mission) CTheScripts::SwitchToMission(int32 mission)
@ -1737,15 +1730,21 @@ CTheScripts::SwitchToMission(int32 mission)
#ifdef MISSION_REPLAY #ifdef MISSION_REPLAY
missionRetryScriptIndex = mission; missionRetryScriptIndex = mission;
if (missionRetryScriptIndex == 19) #ifdef USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT
CStats::LastMissionPassedName[0] = '\0'; if (CTheScripts::MissionSupportsMissionReplay(missionRetryScriptIndex)) {
SaveGameForPause(4);
}
#endif
#endif #endif
CTimer::Suspend(); CTimer::Suspend();
int offset = CTheScripts::MultiScriptArray[mission]; int offset = CTheScripts::MultiScriptArray[mission];
CFileMgr::ChangeDir("\\"); CFileMgr::ChangeDir("\\");
#ifdef USE_DEBUG_SCRIPT_LOADER #ifdef USE_DEBUG_SCRIPT_LOADER
int handle = open_script(); CFileMgr::ChangeDir("\\data\\");
int handle = CFileMgr::OpenFile(scriptfile, "rb");
CFileMgr::ChangeDir("\\");
#else #else
CFileMgr::ChangeDir("\\");
int handle = CFileMgr::OpenFile("data\\main.scm", "rb"); int handle = CFileMgr::OpenFile("data\\main.scm", "rb");
#endif #endif
CFileMgr::Seek(handle, offset, 0); CFileMgr::Seek(handle, offset, 0);