2020-03-27 21:47:29 +01:00
|
|
|
#include "THISDUST.H"
|
|
|
|
#include "GLAUNCH.H"
|
|
|
|
|
2020-03-29 22:33:32 +02:00
|
|
|
|
|
|
|
#include "LIBETC.H"
|
|
|
|
|
2020-04-03 00:44:09 +02:00
|
|
|
#include "SYSTEM.H"
|
|
|
|
#include "MAIN.H"
|
2020-03-29 22:33:32 +02:00
|
|
|
#include "E3STUFF.H"
|
|
|
|
#include "PAD.H"
|
|
|
|
#include "SOUND.H"
|
|
|
|
#include "REPLAYS.H"
|
2020-04-05 00:53:41 +02:00
|
|
|
#include "MISSION.H"
|
2020-04-05 18:44:41 +02:00
|
|
|
#include "GAMESND.H"
|
|
|
|
#include "SYSTEM.H"
|
2020-04-09 15:55:21 +02:00
|
|
|
#include "CAMERA.H"
|
2020-04-05 18:44:41 +02:00
|
|
|
#include "../FRONTEND/FEMAIN.H"
|
2020-03-29 22:33:32 +02:00
|
|
|
|
2020-04-03 00:44:09 +02:00
|
|
|
#include <string.h>
|
|
|
|
|
2020-03-27 21:47:29 +01:00
|
|
|
MISSION_STEP MissionLadder[68] =
|
|
|
|
{
|
|
|
|
{ 1, 0, 1, 0 },
|
|
|
|
{ 1, 0, 2, 0 },
|
|
|
|
{ 2, 0, 1, 0 },
|
|
|
|
{ 2, 1, 2, 0 },
|
|
|
|
{ 2, 1, 3, 0 },
|
|
|
|
{ 1, 1, 3, 0 },
|
|
|
|
{ 1, 1, 4, 0 },
|
|
|
|
{ 2, 1, 4, 0 },
|
|
|
|
{ 1, 2, 5, 0 },
|
|
|
|
{ 2, 2, 5, 0 },
|
|
|
|
{ 1, 3, 6, 0 },
|
|
|
|
{ 2, 3, 6, 0 },
|
|
|
|
{ 1, 4, 7, 0 },
|
|
|
|
{ 2, 5, 7, 0 },
|
|
|
|
{ 6, 5, 0, 0 },
|
|
|
|
{ 2, 5, 9, 0 },
|
|
|
|
{ 1, 5, 8, 0 },
|
|
|
|
{ 1, 5, 9, 0 },
|
|
|
|
{ 2, 6, 10, 0 },
|
|
|
|
{ 1, 6, 10, 0 },
|
|
|
|
{ 1, 6, 11, 0 },
|
|
|
|
{ 2, 7, 11, 0 },
|
|
|
|
{ 6, 7, 0, 0 },
|
|
|
|
{ 2, 7, 13, 0 },
|
|
|
|
{ 2, 7, 14, 0 },
|
|
|
|
{ 1, 7, 12, 0 },
|
|
|
|
{ 2, 8, 15, 0 },
|
|
|
|
{ 2, 8, 16, 0 },
|
|
|
|
{ 1, 8, 13, 0 },
|
|
|
|
{ 2, 9, 17, 0 },
|
|
|
|
{ 2, 9, 18, 0 },
|
|
|
|
{ 1, 9, 14, 0 },
|
|
|
|
{ 2, 10, 19, 0 },
|
|
|
|
{ 1, 10, 15, 0 },
|
|
|
|
{ 2, 11, 20, 0 },
|
|
|
|
{ 1, 12, 16, 1 },
|
|
|
|
{ 1, 12, 17, 1 },
|
|
|
|
{ 2, 13, 21, 1 },
|
|
|
|
{ 2, 13, 22, 1 },
|
|
|
|
{ 2, 13, 23, 1 },
|
|
|
|
{ 2, 13, 24, 1 },
|
|
|
|
{ 1, 13, 18, 1 },
|
|
|
|
{ 2, 14, 25, 1 },
|
|
|
|
{ 2, 14, 26, 1 },
|
|
|
|
{ 1, 14, 19, 1 },
|
|
|
|
{ 2, 15, 27, 1 },
|
|
|
|
{ 2, 15, 28, 1 },
|
|
|
|
{ 2, 15, 29, 1 },
|
|
|
|
{ 2, 15, 30, 1 },
|
|
|
|
{ 1, 15, 20, 1 },
|
|
|
|
{ 1, 15, 21, 1 },
|
|
|
|
{ 2, 16, 31, 1 },
|
|
|
|
{ 2, 16, 32, 1 },
|
|
|
|
{ 2, 16, 33, 1 },
|
|
|
|
{ 2, 16, 34, 1 },
|
|
|
|
{ 1, 16, 22, 1 },
|
|
|
|
{ 2, 17, 35, 1 },
|
|
|
|
{ 6, 17, 0, 1 },
|
|
|
|
{ 2, 17, 37, 1 },
|
|
|
|
{ 1, 17, 23, 1 },
|
|
|
|
{ 2, 18, 38, 1 },
|
|
|
|
{ 2, 18, 39, 1 },
|
|
|
|
{ 1, 18, 24, 1 },
|
|
|
|
{ 2, 19, 40, 1 },
|
|
|
|
{ 1, 19, 25, 1 },
|
|
|
|
{ 1, 19, 26, 1 },
|
|
|
|
{ 1, 19, 27, 1 },
|
|
|
|
{ 4, 19, 28, 1 }
|
|
|
|
};
|
|
|
|
|
|
|
|
unsigned short RecapFrameLength[19] = {
|
|
|
|
0x203, 0x2FC, 0x3C2, 0x496, 0x56D, 0x616, 0x6D4, 0x70E, 0x800, 0x8CD, 0x99A, 0x430, 0x550, 0x5E3, 0x67B, 0x96D, 0xA17, 0xAC9, 0xBB6
|
|
|
|
};
|
|
|
|
|
2020-03-29 18:10:37 +02:00
|
|
|
ACTIVE_CHEATS AvailableCheats = { 0 };
|
2020-03-29 19:03:53 +02:00
|
|
|
ACTIVE_CHEATS ActiveCheats = { 0 };
|
2020-03-29 18:10:37 +02:00
|
|
|
|
2020-03-29 22:33:32 +02:00
|
|
|
int gInFrontend = 0;
|
|
|
|
int AttractMode = 0;
|
2020-03-29 01:56:49 +01:00
|
|
|
|
2020-03-27 21:47:29 +01:00
|
|
|
// decompiled code
|
|
|
|
// original method signature:
|
|
|
|
// void /*$ra*/ GameStart()
|
|
|
|
// line 834, offset 0x00052a28
|
|
|
|
/* begin block 1 */
|
|
|
|
// Start line: 836
|
|
|
|
// Start offset: 0x00052A28
|
|
|
|
// Variables:
|
|
|
|
// struct RECT rect; // stack offset -16
|
|
|
|
// int oldVMode; // $s0
|
|
|
|
// int SurvivalCopSettingsBackup; // $s0
|
|
|
|
/* end block 1 */
|
|
|
|
// End offset: 0x00052E98
|
|
|
|
// End Line: 1011
|
|
|
|
|
|
|
|
/* begin block 2 */
|
|
|
|
// Start line: 1668
|
|
|
|
/* end block 2 */
|
|
|
|
// End Line: 1669
|
|
|
|
|
|
|
|
/* begin block 3 */
|
|
|
|
// Start line: 1669
|
|
|
|
/* end block 3 */
|
|
|
|
// End Line: 1670
|
|
|
|
|
|
|
|
/* begin block 4 */
|
|
|
|
// Start line: 1674
|
|
|
|
/* end block 4 */
|
|
|
|
// End Line: 1675
|
|
|
|
|
|
|
|
/* WARNING: Unknown calling convention yet parameter storage is locked */
|
|
|
|
|
2020-03-29 22:33:32 +02:00
|
|
|
#ifndef PSX
|
|
|
|
extern void SsSetSerialVol(char param_1, short param_2, short param_3);
|
|
|
|
#endif // PSX
|
|
|
|
|
|
|
|
int gLoadedReplay = 0;
|
|
|
|
int gHaveStoredData = 0;
|
|
|
|
|
2020-04-11 00:12:50 +02:00
|
|
|
int gLastChase = 0;
|
|
|
|
int gChaseNumber = 0;
|
|
|
|
int gRandomChase = 0;
|
|
|
|
int gSubGameNumber = 0;
|
|
|
|
|
|
|
|
int gMissionLadderPos = 0;
|
2020-04-22 10:05:07 +02:00
|
|
|
int gFurthestMission = 0x28; //0; // [A] temporary access to all
|
2020-04-11 00:12:50 +02:00
|
|
|
|
|
|
|
int gWantNight = 0;
|
|
|
|
|
|
|
|
|
2020-03-29 22:33:32 +02:00
|
|
|
// [D]
|
2020-03-27 21:47:29 +01:00
|
|
|
void GameStart(void)
|
|
|
|
{
|
2020-04-20 07:57:35 +02:00
|
|
|
int iVar1;
|
|
|
|
int iVar2;
|
|
|
|
int SurvivalCopSettingsBackup;
|
|
|
|
|
|
|
|
if( GameType != GAME_CONTINUEMISSION &&
|
|
|
|
GameType != GAME_MISSION &&
|
|
|
|
GameType != GAME_REPLAYMISSION)
|
|
|
|
{
|
2020-03-29 22:33:32 +02:00
|
|
|
SetPleaseWait(NULL);
|
2020-03-27 21:47:29 +01:00
|
|
|
}
|
2020-04-11 00:12:50 +02:00
|
|
|
|
2020-03-27 21:47:29 +01:00
|
|
|
DrawSync(0);
|
|
|
|
VSync(0);
|
2020-04-11 00:12:50 +02:00
|
|
|
|
2020-03-27 21:47:29 +01:00
|
|
|
gInFrontend = 0;
|
|
|
|
AttractMode = 0;
|
2020-04-11 00:12:50 +02:00
|
|
|
|
2020-03-27 21:47:29 +01:00
|
|
|
FreeXM();
|
2020-04-03 00:44:09 +02:00
|
|
|
|
2020-04-20 07:57:35 +02:00
|
|
|
SsSetSerialVol(0, 0, 0);
|
2020-04-11 00:12:50 +02:00
|
|
|
|
2020-04-20 07:57:35 +02:00
|
|
|
SurvivalCopSettingsBackup = gCopDifficultyLevel;
|
2020-04-11 00:12:50 +02:00
|
|
|
NewLevel = 1;
|
2020-04-03 00:44:09 +02:00
|
|
|
|
2020-03-27 21:47:29 +01:00
|
|
|
switch (GameType) {
|
2020-04-03 00:44:09 +02:00
|
|
|
case GAME_MISSION:
|
|
|
|
RunMissionLadder(1);
|
|
|
|
break;
|
|
|
|
case GAME_TAKEADRIVE:
|
2020-04-20 07:57:35 +02:00
|
|
|
iVar1 = 0x3a;
|
|
|
|
if (NumPlayers == 1) {
|
|
|
|
iVar1 = 0x32;
|
|
|
|
}
|
|
|
|
gCurrentMissionNumber = iVar1 + GameLevel * 2 + gWantNight + gSubGameNumber * 0x1b8;
|
2020-03-27 21:47:29 +01:00
|
|
|
LaunchGame();
|
2020-04-03 00:44:09 +02:00
|
|
|
break;
|
|
|
|
case GAME_IDLEDEMO:
|
2020-04-20 07:57:35 +02:00
|
|
|
iVar2 = LoadAttractReplay(gCurrentMissionNumber);
|
|
|
|
iVar1 = gVibration;
|
|
|
|
gVibration = iVar1;
|
|
|
|
if (iVar2 != 0) {
|
2020-04-03 00:44:09 +02:00
|
|
|
gVibration = 0;
|
2020-04-05 00:53:41 +02:00
|
|
|
CurrentGameMode = GAMEMODE_DEMO;
|
2020-04-03 00:44:09 +02:00
|
|
|
gLoadedReplay = 1;
|
|
|
|
LaunchGame();
|
|
|
|
gLoadedReplay = 0;
|
2020-04-20 07:57:35 +02:00
|
|
|
gVibration = iVar1;
|
2020-04-03 00:44:09 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GAME_PURSUIT:
|
2020-04-20 07:57:35 +02:00
|
|
|
iVar2 = GameLevel * 8 + 0x46;
|
|
|
|
iVar1 = gWantNight << 2;
|
|
|
|
goto LAB_00052e1c;
|
2020-04-03 00:44:09 +02:00
|
|
|
case GAME_GETAWAY:
|
2020-04-20 07:57:35 +02:00
|
|
|
iVar2 = GameLevel * 8 + 0x66;
|
|
|
|
iVar1 = gWantNight << 2;
|
|
|
|
goto LAB_00052e1c;
|
2020-04-03 00:44:09 +02:00
|
|
|
case GAME_GATERACE:
|
2020-04-20 07:57:35 +02:00
|
|
|
if (NumPlayers == 1) {
|
|
|
|
iVar1 = 0x86;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
iVar1 = 0xa4;
|
|
|
|
}
|
|
|
|
gCurrentMissionNumber = iVar1 + GameLevel * 8 + gWantNight * 4 + gSubGameNumber;
|
|
|
|
goto LAB_00052e24;
|
2020-04-03 00:44:09 +02:00
|
|
|
case GAME_CHECKPOINT:
|
2020-04-20 07:57:35 +02:00
|
|
|
if (NumPlayers == 1) {
|
|
|
|
iVar1 = 0xc4;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
iVar1 = 0xe4;
|
|
|
|
}
|
|
|
|
gCurrentMissionNumber = iVar1 + GameLevel * 8 + gWantNight * 4 + gSubGameNumber;
|
|
|
|
goto LAB_00052e24;
|
2020-04-03 00:44:09 +02:00
|
|
|
case GAME_TRAILBLAZER:
|
2020-04-20 07:57:35 +02:00
|
|
|
iVar2 = GameLevel * 8 + 0x104;
|
|
|
|
iVar1 = gWantNight << 2;
|
|
|
|
goto LAB_00052e1c;
|
2020-04-03 00:44:09 +02:00
|
|
|
case GAME_SURVIVAL:
|
|
|
|
gCopDifficultyLevel = 2;
|
2020-04-20 07:57:35 +02:00
|
|
|
iVar2 = 0x144;
|
|
|
|
if (NumPlayers == 1) {
|
|
|
|
iVar2 = 0x124;
|
|
|
|
}
|
|
|
|
gCurrentMissionNumber = iVar2 + GameLevel * 8 + gWantNight * 4 + gSubGameNumber;
|
|
|
|
LaunchGame();
|
2020-04-11 00:12:50 +02:00
|
|
|
gCopDifficultyLevel = SurvivalCopSettingsBackup;
|
2020-04-03 00:44:09 +02:00
|
|
|
break;
|
|
|
|
case GAME_REPLAYMISSION:
|
|
|
|
GameType = GAME_MISSION;
|
2020-04-20 07:57:35 +02:00
|
|
|
iVar1 = FindMissionLadderPos(gCurrentMissionNumber);
|
|
|
|
if (iVar1 != 0) {
|
2020-04-03 00:44:09 +02:00
|
|
|
RunMissionLadder(0);
|
2020-04-20 07:57:35 +02:00
|
|
|
}
|
2020-04-03 00:44:09 +02:00
|
|
|
GameType = GAME_REPLAYMISSION;
|
|
|
|
break;
|
|
|
|
case GAME_COPSANDROBBERS:
|
2020-04-20 07:57:35 +02:00
|
|
|
iVar2 = GameLevel * 8 + 0x1a4;
|
|
|
|
iVar1 = gWantNight << 2;
|
|
|
|
goto LAB_00052e1c;
|
2020-04-03 00:44:09 +02:00
|
|
|
case GAME_CAPTURETHEFLAG:
|
2020-04-20 07:57:35 +02:00
|
|
|
gCurrentMissionNumber = GameLevel * 8 + 0x160 + gSubGameNumber;
|
|
|
|
LaunchGame();
|
2020-04-03 00:44:09 +02:00
|
|
|
break;
|
|
|
|
case GAME_SECRET:
|
2020-04-20 07:57:35 +02:00
|
|
|
iVar2 = 0x1e4;
|
|
|
|
iVar1 = gWantNight;
|
|
|
|
if (NumPlayers == 1) {
|
|
|
|
iVar2 = 0x1e0;
|
|
|
|
}
|
|
|
|
LAB_00052e1c:
|
|
|
|
gCurrentMissionNumber = iVar2 + iVar1 + gSubGameNumber;
|
|
|
|
LAB_00052e24:
|
|
|
|
LaunchGame();
|
2020-04-03 00:44:09 +02:00
|
|
|
break;
|
|
|
|
case GAME_CONTINUEMISSION:
|
|
|
|
GameType = GAME_MISSION;
|
2020-03-27 21:47:29 +01:00
|
|
|
RunMissionLadder(0);
|
2020-04-03 00:44:09 +02:00
|
|
|
break;
|
|
|
|
case GAME_LOADEDREPLAY:
|
2020-04-05 00:53:41 +02:00
|
|
|
CurrentGameMode = GAMEMODE_DIRECTOR;
|
2020-04-03 00:44:09 +02:00
|
|
|
gLoadedReplay = 1;
|
|
|
|
GameType = StoredGameType;
|
|
|
|
LaunchGame();
|
|
|
|
gLoadedReplay = 0;
|
2020-03-27 21:47:29 +01:00
|
|
|
}
|
2020-04-11 00:12:50 +02:00
|
|
|
|
2020-03-27 21:47:29 +01:00
|
|
|
wantedCar[1] = -1;
|
|
|
|
wantedCar[0] = -1;
|
2020-04-05 18:44:41 +02:00
|
|
|
|
2020-03-27 21:47:29 +01:00
|
|
|
gHaveStoredData = 0;
|
2020-04-05 18:44:41 +02:00
|
|
|
|
2020-03-27 21:47:29 +01:00
|
|
|
ReInitFrontend();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// decompiled code
|
|
|
|
// original method signature:
|
|
|
|
// void /*$ra*/ StartRender(int renderNum /*$a0*/)
|
|
|
|
// line 1018, offset 0x000536b0
|
|
|
|
/* begin block 1 */
|
|
|
|
// Start line: 2036
|
|
|
|
/* end block 1 */
|
|
|
|
// End Line: 2037
|
|
|
|
|
|
|
|
/* begin block 2 */
|
|
|
|
// Start line: 2537
|
|
|
|
/* end block 2 */
|
|
|
|
// End Line: 2538
|
|
|
|
|
|
|
|
void StartRender(int renderNum)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED();
|
|
|
|
/*
|
|
|
|
PlayFMV((uchar)renderNum);
|
|
|
|
ReInitFrontend();
|
|
|
|
return;*/
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// decompiled code
|
|
|
|
// original method signature:
|
|
|
|
// void /*$ra*/ ReInitFrontend()
|
|
|
|
// line 1030, offset 0x00052e98
|
|
|
|
/* begin block 1 */
|
|
|
|
// Start line: 1032
|
|
|
|
// Start offset: 0x00052E98
|
|
|
|
// Variables:
|
|
|
|
// struct RECT rect; // stack offset -24
|
|
|
|
/* end block 1 */
|
|
|
|
// End offset: 0x00052FE8
|
|
|
|
// End Line: 1103
|
|
|
|
|
|
|
|
/* begin block 2 */
|
|
|
|
// Start line: 2068
|
|
|
|
/* end block 2 */
|
|
|
|
// End Line: 2069
|
|
|
|
|
|
|
|
/* begin block 3 */
|
|
|
|
// Start line: 2088
|
|
|
|
/* end block 3 */
|
|
|
|
// End Line: 2089
|
|
|
|
|
|
|
|
/* begin block 4 */
|
|
|
|
// Start line: 2089
|
|
|
|
/* end block 4 */
|
|
|
|
// End Line: 2090
|
|
|
|
|
|
|
|
/* begin block 5 */
|
|
|
|
// Start line: 2091
|
|
|
|
/* end block 5 */
|
|
|
|
// End Line: 2092
|
|
|
|
|
|
|
|
/* WARNING: Unknown calling convention yet parameter storage is locked */
|
|
|
|
|
2020-04-05 18:44:41 +02:00
|
|
|
// [D]
|
2020-03-27 21:47:29 +01:00
|
|
|
void ReInitFrontend(void)
|
|
|
|
{
|
2020-04-05 18:44:41 +02:00
|
|
|
RECT16 rect;
|
2020-03-27 21:47:29 +01:00
|
|
|
|
2020-04-05 18:44:41 +02:00
|
|
|
old_camera_change = 0;
|
|
|
|
camera_change = 0;
|
2020-03-27 21:47:29 +01:00
|
|
|
|
|
|
|
EnableDisplay();
|
|
|
|
DrawSync(0);
|
|
|
|
VSync(0);
|
|
|
|
gInFrontend = 1;
|
|
|
|
SetDispMask(0);
|
|
|
|
StopDualShockMotors();
|
|
|
|
FreeXM();
|
|
|
|
SpuSetReverbVoice(0, 0xffffff);
|
|
|
|
UnPauseSound();
|
2020-04-05 18:44:41 +02:00
|
|
|
|
2020-03-27 21:47:29 +01:00
|
|
|
LoadSoundBankDynamic((char *)0x0, 0, 0);
|
|
|
|
LoadBankFromLump(1, 0);
|
2020-04-05 18:44:41 +02:00
|
|
|
|
|
|
|
#ifdef PSX
|
|
|
|
Loadfile("FRONTEND.BIN", &DAT_001c0000);
|
|
|
|
#endif // PSX
|
|
|
|
|
2020-03-27 21:47:29 +01:00
|
|
|
SetFEDrawMode();
|
|
|
|
DrawSync(0);
|
|
|
|
EnableDisplay();
|
|
|
|
rect.x = 0;
|
|
|
|
rect.y = 0;
|
|
|
|
rect.w = 0x140;
|
|
|
|
rect.h = 0x200;
|
|
|
|
ClearImage(&rect, 0, 0, 0);
|
|
|
|
DrawSync(0);
|
|
|
|
LoadFrontendScreens();
|
|
|
|
ReInitScreens();
|
|
|
|
DrawSync(0);
|
|
|
|
VSync(0);
|
2020-04-05 18:44:41 +02:00
|
|
|
ClearOTagR((u_long*)MPBuff[0][0].ot, 0x1080);
|
|
|
|
ClearOTagR((u_long*)MPBuff[0][1].ot, 0x1080);
|
2020-03-27 21:47:29 +01:00
|
|
|
SetDispMask(1);
|
2020-04-05 18:44:41 +02:00
|
|
|
//LoadedLevel = 0xff;
|
2020-03-27 21:47:29 +01:00
|
|
|
bRedrawFrontend = 1;
|
2020-04-05 18:44:41 +02:00
|
|
|
return;
|
2020-03-27 21:47:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// decompiled code
|
|
|
|
// original method signature:
|
|
|
|
// void /*$ra*/ RunMissionLadder(int newgame /*$a1*/)
|
|
|
|
// line 1105, offset 0x00052fe8
|
|
|
|
/* begin block 1 */
|
|
|
|
// Start line: 1106
|
|
|
|
// Start offset: 0x00052FE8
|
|
|
|
// Variables:
|
|
|
|
// struct MISSION_STEP *CurrentStep; // $s0
|
|
|
|
// struct RENDER_ARGS RenderArgs; // stack offset -48
|
|
|
|
// int quit; // $s3
|
|
|
|
|
|
|
|
/* begin block 1.1 */
|
|
|
|
// Start line: 1143
|
|
|
|
// Start offset: 0x000530A4
|
|
|
|
/* end block 1.1 */
|
|
|
|
// End offset: 0x000530A4
|
|
|
|
// End Line: 1143
|
|
|
|
|
|
|
|
/* begin block 1.2 */
|
|
|
|
// Start line: 1148
|
|
|
|
// Start offset: 0x000530B4
|
|
|
|
/* end block 1.2 */
|
|
|
|
// End offset: 0x000530BC
|
|
|
|
// End Line: 1149
|
|
|
|
|
|
|
|
/* begin block 1.3 */
|
|
|
|
// Start line: 1153
|
|
|
|
// Start offset: 0x000530CC
|
|
|
|
/* end block 1.3 */
|
|
|
|
// End offset: 0x000530E8
|
|
|
|
// End Line: 1157
|
|
|
|
|
|
|
|
/* begin block 1.4 */
|
|
|
|
// Start line: 1163
|
|
|
|
// Start offset: 0x00053134
|
|
|
|
|
|
|
|
/* begin block 1.4.1 */
|
|
|
|
// Start line: 1172
|
|
|
|
// Start offset: 0x00053198
|
|
|
|
/* end block 1.4.1 */
|
|
|
|
// End offset: 0x000531AC
|
|
|
|
// End Line: 1175
|
|
|
|
/* end block 1.4 */
|
|
|
|
// End offset: 0x0005328C
|
|
|
|
// End Line: 1212
|
|
|
|
/* end block 1 */
|
|
|
|
// End offset: 0x000532B8
|
|
|
|
// End Line: 1215
|
|
|
|
|
|
|
|
/* begin block 2 */
|
|
|
|
// Start line: 2243
|
|
|
|
/* end block 2 */
|
|
|
|
// End Line: 2244
|
|
|
|
|
|
|
|
/* begin block 3 */
|
|
|
|
// Start line: 2246
|
|
|
|
/* end block 3 */
|
|
|
|
// End Line: 2247
|
|
|
|
|
|
|
|
/* begin block 4 */
|
|
|
|
// Start line: 2249
|
|
|
|
/* end block 4 */
|
|
|
|
// End Line: 2250
|
|
|
|
|
|
|
|
void RunMissionLadder(int newgame)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED();
|
|
|
|
/*
|
|
|
|
|
|
|
|
bool bVar1;
|
|
|
|
byte bVar2;
|
|
|
|
byte *pbVar3;
|
|
|
|
RENDER_ARGS local_30;
|
|
|
|
|
|
|
|
bVar1 = false;
|
|
|
|
if (newgame != 0) {
|
|
|
|
gMissionLadderPos = 0;
|
|
|
|
}
|
|
|
|
local_30.nRenders = 0;
|
|
|
|
pbVar3 = &MissionLadder[0].flags + gMissionLadderPos * 2;
|
|
|
|
if ((newgame == 0) && ((*pbVar3 & 0xf8) != 0)) {
|
|
|
|
local_30.Args[0].render = 'a';
|
|
|
|
if (0xb < *pbVar3 >> 3) {
|
|
|
|
local_30.Args[0].render = 'b';
|
|
|
|
}
|
|
|
|
local_30.Args[0].credits = '\0';
|
|
|
|
local_30.Args[0].recap = RecapFrameLength[(uint)(*pbVar3 >> 3) - 1];
|
|
|
|
local_30.nRenders = 1;
|
|
|
|
}
|
|
|
|
do {
|
|
|
|
if ((pbVar3[1] & 0x80) == 0) {
|
|
|
|
CheckForCorrectDisc(0);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
CheckForCorrectDisc(1);
|
|
|
|
}
|
|
|
|
if (local_30.nRenders == 4) {
|
|
|
|
SetPleaseWait((char *)0x0);
|
|
|
|
PlayRender(&local_30);
|
|
|
|
local_30.nRenders = 0;
|
|
|
|
SetPleaseWait((char *)0x0);
|
|
|
|
}
|
|
|
|
gMissionLadderPos = (int)(pbVar3 + -0x9f01c) >> 1;
|
|
|
|
bVar2 = *pbVar3 & 7;
|
|
|
|
if (bVar2 == 2) {
|
|
|
|
if (local_30.nRenders != 0) {
|
|
|
|
SetPleaseWait((char *)0x0);
|
|
|
|
PlayRender(&local_30);
|
|
|
|
local_30.nRenders = 0;
|
|
|
|
}
|
|
|
|
SetPleaseWait((char *)0x0);
|
|
|
|
gCurrentMissionNumber = (uint)pbVar3[1] & 0x7f;
|
|
|
|
LaunchGame();
|
|
|
|
if (WantedGameMode == '\x05') {
|
|
|
|
if (gFurthestMission < gCurrentMissionNumber) {
|
|
|
|
gFurthestMission = gCurrentMissionNumber;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
bVar1 = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (bVar2 < 3) {
|
|
|
|
if (bVar2 == 1) {
|
|
|
|
local_30.Args[local_30.nRenders].render = pbVar3[1] & 0x7f;
|
|
|
|
local_30.Args[local_30.nRenders].recap = 0;
|
|
|
|
local_30.Args[local_30.nRenders].credits = '\0';
|
|
|
|
local_30.nRenders = local_30.nRenders + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (bVar2 == 4) {
|
|
|
|
SetPleaseWait((char *)0x0);
|
|
|
|
local_30.Args[local_30.nRenders].render = pbVar3[1] & 0x7f;
|
|
|
|
local_30.Args[local_30.nRenders].recap = 0;
|
|
|
|
local_30.Args[local_30.nRenders].credits = '\x01';
|
|
|
|
local_30.nRenders = local_30.nRenders + 1;
|
|
|
|
PlayRender(&local_30);
|
|
|
|
SetPleaseWait((char *)0x0);
|
|
|
|
bVar1 = true;
|
|
|
|
AvailableCheats._0_1_ = (byte)AvailableCheats | 0xf;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pbVar3 = pbVar3 + 2;
|
|
|
|
} while (!bVar1);
|
|
|
|
return;*/
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// decompiled code
|
|
|
|
// original method signature:
|
|
|
|
// void /*$ra*/ GetRandomChase()
|
|
|
|
// line 1222, offset 0x000535d8
|
|
|
|
/* begin block 1 */
|
|
|
|
// Start line: 1224
|
|
|
|
// Start offset: 0x000535D8
|
|
|
|
// Variables:
|
|
|
|
// int bump; // $s1
|
|
|
|
/* end block 1 */
|
|
|
|
// End offset: 0x0005369C
|
|
|
|
// End Line: 1250
|
|
|
|
|
|
|
|
/* begin block 2 */
|
|
|
|
// Start line: 2708
|
|
|
|
/* end block 2 */
|
|
|
|
// End Line: 2709
|
|
|
|
|
|
|
|
/* begin block 3 */
|
|
|
|
// Start line: 2444
|
|
|
|
/* end block 3 */
|
|
|
|
// End Line: 2445
|
|
|
|
|
|
|
|
/* begin block 4 */
|
|
|
|
// Start line: 2709
|
|
|
|
/* end block 4 */
|
|
|
|
// End Line: 2710
|
|
|
|
|
|
|
|
/* begin block 5 */
|
|
|
|
// Start line: 2711
|
|
|
|
/* end block 5 */
|
|
|
|
// End Line: 2712
|
|
|
|
|
|
|
|
/* WARNING: Unknown calling convention yet parameter storage is locked */
|
|
|
|
|
|
|
|
void GetRandomChase(void)
|
|
|
|
{
|
2020-04-11 00:12:50 +02:00
|
|
|
int bump = 0;
|
2020-03-27 21:47:29 +01:00
|
|
|
|
|
|
|
if (gLoadedReplay == 0) {
|
2020-04-11 00:12:50 +02:00
|
|
|
gRandomChase = VSync(-1) % 0xd + 2;
|
2020-03-27 21:47:29 +01:00
|
|
|
if (gRandomChase == gLastChase) {
|
|
|
|
do {
|
2020-04-11 00:12:50 +02:00
|
|
|
gRandomChase = (VSync(-1) + bump) % 0xd + 2;
|
|
|
|
bump++;
|
2020-03-27 21:47:29 +01:00
|
|
|
} while (gRandomChase == gLastChase);
|
|
|
|
}
|
|
|
|
gLastChase = gRandomChase;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// decompiled code
|
|
|
|
// original method signature:
|
|
|
|
// int /*$ra*/ FindPrevMissionFromLadderPos(int pos /*$a0*/)
|
|
|
|
// line 1252, offset 0x000536d8
|
|
|
|
/* begin block 1 */
|
|
|
|
// Start line: 1254
|
|
|
|
// Start offset: 0x000536D8
|
|
|
|
/* end block 1 */
|
|
|
|
// End offset: 0x00053740
|
|
|
|
// End Line: 1268
|
|
|
|
|
|
|
|
/* begin block 2 */
|
|
|
|
// Start line: 3004
|
|
|
|
/* end block 2 */
|
|
|
|
// End Line: 3005
|
|
|
|
|
|
|
|
/* begin block 3 */
|
|
|
|
// Start line: 3005
|
|
|
|
/* end block 3 */
|
|
|
|
// End Line: 3006
|
|
|
|
|
|
|
|
/* begin block 4 */
|
|
|
|
// Start line: 3007
|
|
|
|
/* end block 4 */
|
|
|
|
// End Line: 3008
|
|
|
|
|
|
|
|
int FindPrevMissionFromLadderPos(int pos)
|
|
|
|
{
|
2020-04-11 00:12:50 +02:00
|
|
|
if (pos-- > 0)
|
|
|
|
{
|
|
|
|
MISSION_STEP *step = &MissionLadder[pos];
|
|
|
|
do {
|
|
|
|
if (step->flags == 2) {
|
|
|
|
int mission = step->data;
|
2020-03-27 21:47:29 +01:00
|
|
|
|
2020-04-11 00:12:50 +02:00
|
|
|
if (gFurthestMission < mission)
|
|
|
|
gFurthestMission = mission;
|
2020-03-27 21:47:29 +01:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2020-04-11 00:12:50 +02:00
|
|
|
|
|
|
|
step--;
|
|
|
|
} while (pos-- > 0);
|
2020-03-27 21:47:29 +01:00
|
|
|
}
|
2020-04-11 00:12:50 +02:00
|
|
|
|
2020-03-27 21:47:29 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// decompiled code
|
|
|
|
// original method signature:
|
|
|
|
// void /*$ra*/ LaunchGame()
|
|
|
|
// line 1279, offset 0x000532b8
|
|
|
|
/* begin block 1 */
|
|
|
|
// Start line: 1281
|
|
|
|
// Start offset: 0x000532B8
|
|
|
|
// Variables:
|
|
|
|
// struct RECT rect; // stack offset -16
|
|
|
|
// int quit; // $s0
|
|
|
|
/* end block 1 */
|
|
|
|
// End offset: 0x000535D8
|
|
|
|
// End Line: 1415
|
|
|
|
|
|
|
|
/* begin block 2 */
|
|
|
|
// Start line: 2544
|
|
|
|
/* end block 2 */
|
|
|
|
// End Line: 2545
|
|
|
|
|
|
|
|
/* begin block 3 */
|
|
|
|
// Start line: 2609
|
|
|
|
/* end block 3 */
|
|
|
|
// End Line: 2610
|
|
|
|
|
|
|
|
/* begin block 4 */
|
|
|
|
// Start line: 2610
|
|
|
|
/* end block 4 */
|
|
|
|
// End Line: 2611
|
|
|
|
|
|
|
|
/* begin block 5 */
|
|
|
|
// Start line: 2617
|
|
|
|
/* end block 5 */
|
|
|
|
// End Line: 2618
|
|
|
|
|
|
|
|
/* WARNING: Unknown calling convention yet parameter storage is locked */
|
|
|
|
|
2020-04-03 00:44:09 +02:00
|
|
|
int fakeOtherPlayer = 0;
|
|
|
|
int gMissionCompletionState = 0;
|
|
|
|
char NoPlayerControl = 0;
|
|
|
|
|
|
|
|
// TODO: REPLAYS.C
|
|
|
|
int quick_replay = 0;
|
|
|
|
int AutoDirect = 0;
|
|
|
|
int lead_car = 0;
|
|
|
|
|
|
|
|
MISSION_DATA MissionStartData;
|
|
|
|
MISSION_DATA MissionEndData;
|
|
|
|
|
|
|
|
// [D]
|
2020-03-27 21:47:29 +01:00
|
|
|
void LaunchGame(void)
|
|
|
|
{
|
|
|
|
fakeOtherPlayer = 0;
|
2020-04-11 00:12:50 +02:00
|
|
|
|
2020-03-27 21:47:29 +01:00
|
|
|
ResetGraph(1);
|
2020-04-03 00:44:09 +02:00
|
|
|
SetVideoMode(1);
|
2020-04-11 00:12:50 +02:00
|
|
|
|
2020-03-27 21:47:29 +01:00
|
|
|
gMissionCompletionState = PAUSEMODE_GAMEOVER;
|
2020-04-11 00:12:50 +02:00
|
|
|
|
|
|
|
gInvincibleCar = ActiveCheats.cheat3;
|
|
|
|
gPlayerImmune = ActiveCheats.cheat4;
|
|
|
|
|
2020-04-05 15:53:08 +02:00
|
|
|
quick_replay = 0;
|
|
|
|
|
2020-04-11 00:12:50 +02:00
|
|
|
if (gLoadedReplay == 0)
|
2020-03-27 21:47:29 +01:00
|
|
|
GetRandomChase();
|
2020-04-11 00:12:50 +02:00
|
|
|
|
|
|
|
if (CurrentGameMode == GAMEMODE_DIRECTOR)
|
2020-04-05 15:53:08 +02:00
|
|
|
{
|
2020-03-27 21:47:29 +01:00
|
|
|
AttractMode = 0;
|
|
|
|
NoPlayerControl = 1;
|
|
|
|
}
|
2020-04-05 15:53:08 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
AttractMode = 0;
|
|
|
|
NoPlayerControl = 0;
|
|
|
|
|
|
|
|
if (CurrentGameMode < GAMEMODE_NEXTMISSION)
|
|
|
|
{
|
|
|
|
if (CurrentGameMode == GAMEMODE_REPLAY)
|
|
|
|
{
|
2020-03-27 21:47:29 +01:00
|
|
|
AttractMode = 0;
|
|
|
|
NoPlayerControl = 1;
|
|
|
|
quick_replay = 1;
|
|
|
|
}
|
|
|
|
}
|
2020-04-05 15:53:08 +02:00
|
|
|
else if (CurrentGameMode == GAMEMODE_DEMO)
|
|
|
|
{
|
|
|
|
AttractMode = 1;
|
|
|
|
NoPlayerControl = 1;
|
2020-03-27 21:47:29 +01:00
|
|
|
}
|
|
|
|
}
|
2020-04-05 15:53:08 +02:00
|
|
|
|
2020-03-27 21:47:29 +01:00
|
|
|
AutoDirect = 0;
|
|
|
|
NewLevel = 1;
|
2020-04-05 15:53:08 +02:00
|
|
|
|
2020-04-11 00:12:50 +02:00
|
|
|
bool quit = false;
|
2020-04-05 15:53:08 +02:00
|
|
|
|
2020-03-27 21:47:29 +01:00
|
|
|
do {
|
|
|
|
GameInit();
|
|
|
|
GameLoop();
|
2020-04-05 15:53:08 +02:00
|
|
|
|
2020-03-27 21:47:29 +01:00
|
|
|
switch (WantedGameMode) {
|
2020-04-05 15:53:08 +02:00
|
|
|
case GAMEMODE_NORMAL:
|
|
|
|
case GAMEMODE_QUIT:
|
|
|
|
case GAMEMODE_DEMO:
|
|
|
|
{
|
2020-03-27 21:47:29 +01:00
|
|
|
FadeScreen(0xff);
|
2020-04-11 00:12:50 +02:00
|
|
|
quit = true;
|
2020-04-05 15:53:08 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GAMEMODE_RESTART:
|
|
|
|
{
|
|
|
|
FadeScreen(0xff);
|
|
|
|
NoPlayerControl = 0;
|
|
|
|
quick_replay = 0;
|
|
|
|
AutoDirect = 0;
|
|
|
|
WantedGameMode = GAMEMODE_NORMAL;
|
|
|
|
NewLevel = 0;
|
|
|
|
GetRandomChase();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GAMEMODE_REPLAY:
|
|
|
|
case GAMEMODE_DIRECTOR:
|
|
|
|
{
|
2020-04-11 00:12:50 +02:00
|
|
|
if (CurrentGameMode < GAMEMODE_NEXTMISSION)
|
2020-04-05 15:53:08 +02:00
|
|
|
FadeScreen(0xff);
|
2020-04-11 00:12:50 +02:00
|
|
|
|
2020-04-05 15:53:08 +02:00
|
|
|
NoPlayerControl = 1;
|
|
|
|
AutoDirect = (WantedGameMode == GAMEMODE_REPLAY);
|
|
|
|
quick_replay = (WantedGameMode == GAMEMODE_REPLAY);
|
|
|
|
NewLevel = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GAMEMODE_NEXTMISSION:
|
|
|
|
{
|
2020-04-11 00:12:50 +02:00
|
|
|
MissionStartData = MissionEndData;
|
2020-04-05 15:53:08 +02:00
|
|
|
gHaveStoredData = 1;
|
|
|
|
FadeScreen(0xff);
|
2020-04-11 00:12:50 +02:00
|
|
|
quit = true;
|
2020-04-05 15:53:08 +02:00
|
|
|
NoPlayerControl = 0;
|
|
|
|
quick_replay = 0;
|
|
|
|
AutoDirect = 0;
|
2020-03-27 21:47:29 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
CurrentGameMode = WantedGameMode;
|
2020-04-11 00:12:50 +02:00
|
|
|
} while (!quit);
|
2020-04-05 15:53:08 +02:00
|
|
|
|
2020-03-27 21:47:29 +01:00
|
|
|
lead_car = 0;
|
|
|
|
NoPlayerControl = 0;
|
|
|
|
SetDispMask(0);
|
|
|
|
EnableDisplay();
|
2020-04-05 15:53:08 +02:00
|
|
|
|
2020-04-11 00:12:50 +02:00
|
|
|
RECT16 rect { 0, 0, 512, 512 };
|
2020-04-03 00:44:09 +02:00
|
|
|
ClearImage(&rect, 0, 0, 0);
|
2020-04-05 15:53:08 +02:00
|
|
|
|
2020-03-27 21:47:29 +01:00
|
|
|
DrawSync(0);
|
|
|
|
SetDispMask(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// decompiled code
|
|
|
|
// original method signature:
|
|
|
|
// int /*$ra*/ FindMissionLadderPos(int mission /*$a0*/)
|
|
|
|
// line 1417, offset 0x00053740
|
|
|
|
/* begin block 1 */
|
|
|
|
// Start line: 1418
|
|
|
|
// Start offset: 0x00053740
|
|
|
|
// Variables:
|
|
|
|
// struct MISSION_STEP *step; // $a1
|
|
|
|
// int pos; // $a2
|
|
|
|
/* end block 1 */
|
|
|
|
// End offset: 0x00053814
|
|
|
|
// End Line: 1457
|
|
|
|
|
|
|
|
/* begin block 2 */
|
|
|
|
// Start line: 3184
|
|
|
|
/* end block 2 */
|
|
|
|
// End Line: 3185
|
|
|
|
|
|
|
|
/* begin block 3 */
|
|
|
|
// Start line: 3334
|
|
|
|
/* end block 3 */
|
|
|
|
// End Line: 3335
|
|
|
|
|
|
|
|
/* begin block 4 */
|
|
|
|
// Start line: 3336
|
|
|
|
/* end block 4 */
|
|
|
|
// End Line: 3337
|
|
|
|
|
|
|
|
int FindMissionLadderPos(int mission)
|
|
|
|
{
|
2020-04-11 00:12:50 +02:00
|
|
|
MISSION_STEP *step = &MissionLadder[mission];
|
|
|
|
int pos = 0;
|
|
|
|
bool end = false;
|
2020-03-27 21:47:29 +01:00
|
|
|
|
|
|
|
do {
|
2020-04-11 00:12:50 +02:00
|
|
|
switch (step->flags) {
|
|
|
|
case 1:
|
|
|
|
case 6:
|
|
|
|
{
|
|
|
|
step++;
|
|
|
|
pos++;
|
|
|
|
} break;
|
|
|
|
case 2:
|
|
|
|
{
|
|
|
|
if (step->data == mission) {
|
|
|
|
if (pos > 0) {
|
|
|
|
step--;
|
|
|
|
if (step->flags != 2) {
|
|
|
|
do {
|
|
|
|
if (--pos <= 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
step--;
|
|
|
|
} while (step->flags != 2);
|
2020-03-27 21:47:29 +01:00
|
|
|
}
|
2020-04-11 00:12:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
gMissionLadderPos = pos;
|
2020-03-27 21:47:29 +01:00
|
|
|
return 1;
|
|
|
|
}
|
2020-04-11 00:12:50 +02:00
|
|
|
|
|
|
|
step++;
|
|
|
|
pos++;
|
|
|
|
} break;
|
|
|
|
case 4:
|
|
|
|
// end of ladder
|
|
|
|
end = true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
// unhandled
|
2020-03-27 21:47:29 +01:00
|
|
|
return 0;
|
|
|
|
}
|
2020-04-11 00:12:50 +02:00
|
|
|
} while (!end);
|
|
|
|
|
|
|
|
return 0;
|
2020-03-27 21:47:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|