summaryrefslogtreecommitdiffstats
path: root/src/control/ScriptDebug.cpp
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2021-08-08 12:38:21 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2021-08-08 12:38:21 +0200
commit9cc12018928b73acccd575970a6e4dbcb5b460ac (patch)
treea9ffaccca16aa71da94212e4810eee8fb15a1d19 /src/control/ScriptDebug.cpp
parentlcs bridge (diff)
parentMerge pull request #1266 from Nick007J/miami (diff)
downloadre3-9cc12018928b73acccd575970a6e4dbcb5b460ac.tar
re3-9cc12018928b73acccd575970a6e4dbcb5b460ac.tar.gz
re3-9cc12018928b73acccd575970a6e4dbcb5b460ac.tar.bz2
re3-9cc12018928b73acccd575970a6e4dbcb5b460ac.tar.lz
re3-9cc12018928b73acccd575970a6e4dbcb5b460ac.tar.xz
re3-9cc12018928b73acccd575970a6e4dbcb5b460ac.tar.zst
re3-9cc12018928b73acccd575970a6e4dbcb5b460ac.zip
Diffstat (limited to 'src/control/ScriptDebug.cpp')
-rw-r--r--src/control/ScriptDebug.cpp57
1 files changed, 31 insertions, 26 deletions
diff --git a/src/control/ScriptDebug.cpp b/src/control/ScriptDebug.cpp
index 2e6fe332..1c357f5a 100644
--- a/src/control/ScriptDebug.cpp
+++ b/src/control/ScriptDebug.cpp
@@ -1885,26 +1885,26 @@ void CRunningScript::LogBeforeProcessingCommand(int32 command)
strcat(commandInfo, "}");
}
else {
- for (int i = 0; commands[command].input[i] != ARGTYPE_NONE; i++) {
+ for (int i = 0; commands[command].input[i] != ARGTYPE_NONE; i++) {
char tmp[32];
- bool var = false;
- int value;
- switch (commands[command].input[i]) {
- case ARGTYPE_INT:
- case ARGTYPE_PED_HANDLE:
- case ARGTYPE_VEHICLE_HANDLE:
- case ARGTYPE_OBJECT_HANDLE: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%d)" : " %d", value); break;
- case ARGTYPE_FLOAT: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%.3f)" : " %.3f", *(float*)&value); break;
- case ARGTYPE_STRING: sprintf(tmp, " '%s'", (const char*)&CTheScripts::ScriptSpace[m_nIp]); m_nIp += KEY_LENGTH_IN_SCRIPT; break;
- case ARGTYPE_LABEL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s(%d))" : " %s(%d)", value >= 0 ? "G" : "L", abs(value)); break;
- case ARGTYPE_BOOL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s)" : " %s", value ? "TRUE" : "FALSE"); break;
+ bool var = false;
+ int value;
+ switch (commands[command].input[i]) {
+ case ARGTYPE_INT:
+ case ARGTYPE_PED_HANDLE:
+ case ARGTYPE_VEHICLE_HANDLE:
+ case ARGTYPE_OBJECT_HANDLE: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%d)" : " %d", value); break;
+ case ARGTYPE_FLOAT: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%.3f)" : " %.3f", *(float*)&value); break;
+ case ARGTYPE_STRING: sprintf(tmp, " '%s'", (const char*)&CTheScripts::ScriptSpace[m_nIp]); m_nIp += KEY_LENGTH_IN_SCRIPT; break;
+ case ARGTYPE_LABEL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s(%d))" : " %s(%d)", value >= 0 ? "G" : "L", abs(value)); break;
+ case ARGTYPE_BOOL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s)" : " %s", value ? "TRUE" : "FALSE"); break;
case ARGTYPE_ANDOR: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, " %d %ss", (value) % 10, value / 10 == 0 ? "AND" : "OR"); break;
- default: script_assert(0);
- }
- strcat(commandInfo, tmp);
- if (commands[command].position == i)
- strcat(commandInfo, commands[command].name_override);
+ default: script_assert(0);
}
+ strcat(commandInfo, tmp);
+ if (commands[command].position == i)
+ strcat(commandInfo, commands[command].name_override);
+ }
}
uint32 t = m_nIp;
m_nIp = storedIp;
@@ -1923,18 +1923,18 @@ void CRunningScript::LogAfterProcessingCommand(int32 command)
m_nIp = storedIp;
storedIp = t;
if (commands[command].input[0] != ARGTYPE_FUNCTION) {
- for (int i = 0; commands[command].output[i] != ARGTYPE_NONE; i++) {
+ for (int i = 0; commands[command].output[i] != ARGTYPE_NONE; i++) {
char tmp[32];
- switch (commands[command].output[i]) {
- case ARGTYPE_INT:
- case ARGTYPE_PED_HANDLE:
- case ARGTYPE_VEHICLE_HANDLE:
- case ARGTYPE_OBJECT_HANDLE: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%d)", ScriptParams[i]); strcat(commandInfo, tmp); break;
- case ARGTYPE_FLOAT: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%8.3f)", *(float*)&ScriptParams[i]); strcat(commandInfo, tmp); break;
- default: script_assert(0 && "Script only returns INTs and FLOATs");
- }
+ switch (commands[command].output[i]) {
+ case ARGTYPE_INT:
+ case ARGTYPE_PED_HANDLE:
+ case ARGTYPE_VEHICLE_HANDLE:
+ case ARGTYPE_OBJECT_HANDLE: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%d)", ScriptParams[i]); strcat(commandInfo, tmp); break;
+ case ARGTYPE_FLOAT: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%8.3f)", *(float*)&ScriptParams[i]); strcat(commandInfo, tmp); break;
+ default: script_assert(0 && "Script only returns INTs and FLOATs");
}
}
+ }
m_nIp = storedIp;
}
PrintToLog("%s\n", commandInfo);
@@ -1974,6 +1974,11 @@ 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] + 8;