This commit is contained in:
Nikolay Korolev
2021-08-08 13:38:21 +03:00
17 changed files with 292 additions and 91 deletions

View File

@ -98,7 +98,7 @@ int32 CCarCtrl::NumRandomCars;
int32 CCarCtrl::NumParkedCars;
int32 CCarCtrl::NumPermanentCars;
int8 CCarCtrl::CountDownToCarsAtStart;
int32 CCarCtrl::MaxNumberOfCarsInUse = 30;
int32 CCarCtrl::MaxNumberOfCarsInUse = DEFAULT_MAX_NUMBER_OF_CARS;
uint32 CCarCtrl::LastTimeLawEnforcerCreated;
uint32 CCarCtrl::LastTimeFireTruckCreated;
uint32 CCarCtrl::LastTimeAmbulanceCreated;

View File

@ -179,6 +179,65 @@ static const char* MissionScripts[] = {
"TOSH4"
};
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"
};
int AllowMissionReplay;
uint32 NextMissionDelay;
uint32 MissionStartTime;
@ -1195,6 +1254,10 @@ int8 CRunningScript::ProcessOneCommand()
retval = ProcessCommands1600To1699(command);
else
script_assert(false);
#ifdef USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT
if (!AlreadySavedGame)
#endif
{
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
LogAfterProcessingCommand(command);
#elif defined USE_BASIC_SCRIPT_DEBUG_OUTPUT
@ -1204,6 +1267,7 @@ int8 CRunningScript::ProcessOneCommand()
CDebug::DebugAddText(tmp);
}
#endif
}
return retval;
}

View File

@ -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;