2020-12-28 09:51:40 +01:00
|
|
|
#include "driver2.h"
|
|
|
|
#include "pause.h"
|
|
|
|
#include "system.h"
|
|
|
|
#include "mission.h"
|
|
|
|
#include "overlay.h"
|
|
|
|
#include "pres.h"
|
|
|
|
#include "pad.h"
|
|
|
|
#include "main.h"
|
|
|
|
#include "glaunch.h"
|
|
|
|
#include "scores.h"
|
|
|
|
#include "sound.h"
|
|
|
|
#include "cutscene.h"
|
|
|
|
#include "overmap.h"
|
|
|
|
#include "handling.h"
|
2021-02-14 22:45:19 +01:00
|
|
|
#include "platform.h"
|
2021-02-25 09:45:26 +01:00
|
|
|
#include "loadsave.h"
|
2021-05-17 10:52:44 +02:00
|
|
|
#include "cutrecorder.h"
|
2020-08-28 21:42:42 +02:00
|
|
|
|
2021-02-25 21:16:45 +01:00
|
|
|
#define REPLAY_NAME_LEN 16
|
|
|
|
#define SCORE_NAME_LEN 5
|
|
|
|
|
|
|
|
#define PAUSE_MENU_LEVELS 3
|
|
|
|
|
2020-04-26 12:17:24 +02:00
|
|
|
static int gScoreEntered = 0;
|
2021-02-25 21:16:45 +01:00
|
|
|
static char EnterNameText[32] = { 0 }; // translated text
|
|
|
|
|
2020-04-26 12:17:24 +02:00
|
|
|
static int PauseReturnValue;
|
2021-02-25 21:16:45 +01:00
|
|
|
|
2020-04-26 12:17:24 +02:00
|
|
|
int pauseflag = 0;
|
|
|
|
int gShowMap = 0;
|
|
|
|
int gDrawPauseMenus = 0;
|
|
|
|
int gEnteringScore = 0;
|
|
|
|
static int gScorePosition = 0;
|
|
|
|
static int allownameentry = 0;
|
|
|
|
|
2021-02-25 21:16:45 +01:00
|
|
|
int playerwithcontrol[3] = { 0 };
|
|
|
|
|
|
|
|
// message box
|
|
|
|
struct MENU_MESSAGE
|
|
|
|
{
|
|
|
|
char* header;
|
|
|
|
char* text;
|
|
|
|
int show;
|
|
|
|
} gDisplayedMessage = { NULL, NULL, 0 };
|
2020-11-18 19:21:16 +01:00
|
|
|
|
2022-01-25 20:58:58 +01:00
|
|
|
typedef void(*pauseFunc)(int dir);
|
|
|
|
|
|
|
|
struct MENU_ITEM;
|
|
|
|
struct MENU_HEADER;
|
|
|
|
|
|
|
|
struct MENU_ITEM
|
|
|
|
{
|
|
|
|
char* Text;
|
|
|
|
u_char Type;
|
|
|
|
u_char Justify;
|
|
|
|
pauseFunc func;
|
|
|
|
EXIT_VALUE ExitValue;
|
|
|
|
MENU_HEADER* SubMenu;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct MENU_HEADER
|
|
|
|
{
|
|
|
|
char* Title;
|
|
|
|
XYWH Bound;
|
|
|
|
u_char NumItems;
|
|
|
|
MENU_ITEM* MenuItems;
|
|
|
|
};
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
static MENU_ITEM* ActiveItem[PAUSE_MENU_LEVELS];
|
|
|
|
static MENU_HEADER* VisibleMenus[PAUSE_MENU_LEVELS];
|
2020-10-31 01:11:58 +01:00
|
|
|
static MENU_HEADER* ActiveMenu;
|
2020-04-26 12:17:24 +02:00
|
|
|
static int ActiveMenuItem;
|
|
|
|
static int VisibleMenu;
|
2020-11-18 19:21:16 +01:00
|
|
|
|
2020-04-26 12:17:24 +02:00
|
|
|
static char SfxVolumeText[8];
|
|
|
|
static char MusicVolumeText[8];
|
|
|
|
|
2020-08-28 21:42:42 +02:00
|
|
|
static char ScoreTime[5][16];
|
|
|
|
static char ScoreItems[5][16];
|
|
|
|
static char ScoreName[5][7];
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
static char validchars[] = " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+!\xFF\xFE";
|
2020-08-28 21:42:42 +02:00
|
|
|
|
2020-03-27 21:47:29 +01:00
|
|
|
void PauseMap(int direction);
|
|
|
|
void SfxVolume(int direction);
|
|
|
|
void MusicVolume(int direction);
|
|
|
|
void SaveReplay(int direction);
|
|
|
|
void SaveGame(int direction);
|
2020-12-22 12:46:42 +01:00
|
|
|
void SkipCutscene(int direction);
|
2020-12-09 09:33:57 +01:00
|
|
|
|
|
|
|
void EnterScoreName();
|
2021-02-25 21:16:45 +01:00
|
|
|
|
2020-12-09 09:33:57 +01:00
|
|
|
void CreateScoreNames(SCORE_ENTRY *table, PLAYER_SCORE *score, int position);
|
|
|
|
void DrawHighScoreMenu(int selection);
|
2020-03-27 21:47:29 +01:00
|
|
|
|
|
|
|
char EnterScoreText[32] = { 0 };
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
enum MenuItemType
|
|
|
|
{
|
|
|
|
//PAUSE_TYPE_ACTIVE = (1 << 0), // suggested - USUSED flag
|
|
|
|
PAUSE_TYPE_FUNC = (1 << 1), // simple function calling when pressing Cross
|
|
|
|
PAUSE_TYPE_DIRFUNC = (1 << 2), // function calling with direction (left/right)
|
|
|
|
PAUSE_TYPE_SFXVOLUME = (1 << 3),
|
|
|
|
PAUSE_TYPE_MUSICVOLUME = (1 << 4),
|
|
|
|
PAUSE_TYPE_SUBMENU = (1 << 6),
|
|
|
|
PAUSE_TYPE_ENDITEMS = (1 << 7),
|
|
|
|
};
|
|
|
|
|
2020-04-26 14:20:35 +02:00
|
|
|
#if defined(_DEBUG) || defined(DEBUG_OPTIONS)
|
2020-04-26 12:07:37 +02:00
|
|
|
|
2020-04-26 12:17:24 +02:00
|
|
|
void SetRightWayUp(int direction)
|
2020-04-26 12:07:37 +02:00
|
|
|
{
|
|
|
|
extern char gRightWayUp;
|
2020-04-26 12:17:24 +02:00
|
|
|
gRightWayUp = 1;
|
|
|
|
PauseReturnValue = MENU_QUIT_CONTINUE;
|
2020-04-26 12:07:37 +02:00
|
|
|
}
|
|
|
|
|
2020-11-07 19:49:16 +01:00
|
|
|
void SetDisplayPosition(int direction)
|
|
|
|
{
|
|
|
|
extern int gDisplayPosition;
|
|
|
|
gDisplayPosition ^= 1;
|
|
|
|
}
|
|
|
|
|
2020-09-26 18:37:50 +02:00
|
|
|
void ToggleInvincibility(int direction)
|
2020-04-26 12:07:37 +02:00
|
|
|
{
|
|
|
|
extern int gInvincibleCar;
|
2020-04-26 12:23:42 +02:00
|
|
|
gInvincibleCar ^= 1;
|
2020-04-26 12:07:37 +02:00
|
|
|
}
|
|
|
|
|
2020-09-26 18:37:50 +02:00
|
|
|
void ToggleImmunity(int direction)
|
2020-04-26 12:07:37 +02:00
|
|
|
{
|
|
|
|
extern int gPlayerImmune;
|
2020-04-26 12:23:42 +02:00
|
|
|
gPlayerImmune ^= 1;
|
2020-04-26 12:07:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void TogglePlayerGhost(int direction)
|
|
|
|
{
|
|
|
|
extern int playerghost;
|
2020-04-26 12:23:42 +02:00
|
|
|
playerghost ^= 1;
|
2020-04-26 12:07:37 +02:00
|
|
|
}
|
|
|
|
|
2020-09-26 18:37:50 +02:00
|
|
|
void ToggleOverlays(int direction)
|
|
|
|
{
|
|
|
|
gDoOverlays ^= 1;
|
|
|
|
}
|
|
|
|
|
2020-08-22 09:29:17 +02:00
|
|
|
int lastCar = -1;
|
|
|
|
|
2020-08-22 08:46:41 +02:00
|
|
|
void ToggleSecretCarFun(int direction)
|
|
|
|
{
|
|
|
|
extern CAR_COSMETICS car_cosmetics[5];
|
2020-08-22 09:29:17 +02:00
|
|
|
extern int wantedCar[2];
|
|
|
|
|
|
|
|
int active = (ActiveCheats.cheat10 ^= 1);
|
|
|
|
|
|
|
|
if (active)
|
|
|
|
{
|
|
|
|
if (lastCar == -1)
|
|
|
|
lastCar = wantedCar[0];
|
|
|
|
|
|
|
|
// make our current car the secret car
|
|
|
|
wantedCar[0] = 12;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (lastCar != -1)
|
|
|
|
{
|
|
|
|
// restore our initial car
|
|
|
|
wantedCar[0] = lastCar;
|
|
|
|
lastCar = -1;
|
|
|
|
}
|
|
|
|
}
|
2020-08-22 08:46:41 +02:00
|
|
|
|
|
|
|
FixCarCos(&car_cosmetics[4], 12);
|
|
|
|
}
|
|
|
|
|
2020-09-04 21:08:51 +02:00
|
|
|
void ToggleJerichoMode(int direction)
|
|
|
|
{
|
|
|
|
ActiveCheats.cheat12 ^= 1;
|
|
|
|
}
|
|
|
|
|
2020-09-26 18:37:50 +02:00
|
|
|
void TogglePuppyDogCops(int direction)
|
|
|
|
{
|
|
|
|
gPuppyDogCop ^= 1;
|
|
|
|
}
|
|
|
|
|
2020-04-26 12:07:37 +02:00
|
|
|
extern void LoadSky(void);
|
|
|
|
|
|
|
|
void DebugTimeOfDayDay(int direction)
|
|
|
|
{
|
2020-11-14 22:05:05 +01:00
|
|
|
wantedTimeOfDay = 1;
|
2020-04-26 12:07:37 +02:00
|
|
|
gTimeOfDay = 1;
|
2020-05-06 06:42:10 +02:00
|
|
|
gWantNight = 0;
|
2020-04-26 12:07:37 +02:00
|
|
|
LoadSky();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DebugTimeOfDayNight(int direction)
|
|
|
|
{
|
2020-11-14 22:05:05 +01:00
|
|
|
wantedTimeOfDay = 3;
|
2020-04-26 12:07:37 +02:00
|
|
|
gTimeOfDay = 3;
|
2020-05-06 06:42:10 +02:00
|
|
|
gWantNight = 1;
|
2020-04-26 12:07:37 +02:00
|
|
|
LoadSky();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DebugTimeOfDayDusk(int direction)
|
|
|
|
{
|
2020-11-14 22:05:05 +01:00
|
|
|
wantedTimeOfDay = 0;
|
2020-04-26 12:07:37 +02:00
|
|
|
gTimeOfDay = 0;
|
2020-05-06 06:42:10 +02:00
|
|
|
gWantNight = 0;
|
2020-04-26 12:07:37 +02:00
|
|
|
LoadSky();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DebugTimeOfDayDawn(int direction)
|
|
|
|
{
|
2020-11-14 22:05:05 +01:00
|
|
|
wantedTimeOfDay = 2;
|
2020-04-26 12:07:37 +02:00
|
|
|
gTimeOfDay = 2;
|
2020-05-06 06:42:10 +02:00
|
|
|
gWantNight = 0;
|
2020-04-26 12:07:37 +02:00
|
|
|
LoadSky();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DebugTimeOfDayRain(int direction)
|
|
|
|
{
|
|
|
|
//extern int weather;
|
|
|
|
//weather ^= weather;
|
2020-04-26 12:23:42 +02:00
|
|
|
gWeather ^= 1;
|
2020-11-14 22:05:05 +01:00
|
|
|
wantedWeather = gWeather;
|
2020-04-26 12:23:42 +02:00
|
|
|
|
|
|
|
if (gWeather == 1)
|
|
|
|
wetness = 7000;
|
|
|
|
else
|
|
|
|
wetness = 0;
|
|
|
|
|
2020-04-26 12:07:37 +02:00
|
|
|
LoadSky();
|
|
|
|
}
|
|
|
|
|
|
|
|
MENU_ITEM DebugTimeOfDayItems[] =
|
|
|
|
{
|
2020-11-18 19:21:16 +01:00
|
|
|
{ "Day", PAUSE_TYPE_FUNC, 2, DebugTimeOfDayDay, MENU_QUIT_NONE, NULL },
|
|
|
|
{ "Night", PAUSE_TYPE_FUNC, 2, DebugTimeOfDayNight,MENU_QUIT_NONE, NULL },
|
|
|
|
{ "Dusk", PAUSE_TYPE_FUNC, 2, DebugTimeOfDayDusk, MENU_QUIT_NONE, NULL },
|
|
|
|
{ "Dawn", PAUSE_TYPE_FUNC, 2, DebugTimeOfDayDawn, MENU_QUIT_NONE, NULL },
|
|
|
|
{ "Rain", PAUSE_TYPE_FUNC, 2, DebugTimeOfDayRain, MENU_QUIT_NONE, NULL },
|
|
|
|
{ NULL, PAUSE_TYPE_ENDITEMS, 0u, NULL, MENU_QUIT_NONE, NULL }
|
2020-04-26 12:07:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
MENU_HEADER DebugTimeOfDayHeader =
|
|
|
|
{ "Time Of Day", { 0, 0, 0, 0 }, 0u, DebugTimeOfDayItems };
|
|
|
|
|
2020-09-26 18:37:50 +02:00
|
|
|
MENU_ITEM DebugJustForFunItems[] =
|
|
|
|
{
|
2020-11-18 19:21:16 +01:00
|
|
|
{ "Secret Car Fun", PAUSE_TYPE_FUNC, 2, ToggleSecretCarFun, MENU_QUIT_RESTART, NULL },
|
|
|
|
{ "Jericho Mode", PAUSE_TYPE_FUNC, 2, ToggleJerichoMode, MENU_QUIT_NONE, NULL },
|
|
|
|
{ NULL, PAUSE_TYPE_ENDITEMS, 0u, NULL, MENU_QUIT_NONE, NULL }
|
2020-09-26 18:37:50 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
MENU_HEADER DebugJustForFunHeader =
|
|
|
|
{ "Just for fun", { 0, 0, 0, 0 }, 0u, DebugJustForFunItems };
|
|
|
|
|
2020-04-26 12:07:37 +02:00
|
|
|
MENU_ITEM DebugOptionsItems[] =
|
|
|
|
{
|
2020-10-09 22:13:49 +02:00
|
|
|
#ifdef CUTSCENE_RECORDER
|
|
|
|
//{ gCutsceneRecorderPauseText, 5u, 2u, (pauseFunc)&NextCutsceneRecorderPlayer, MENU_QUIT_NONE, NULL },
|
2021-05-17 10:52:44 +02:00
|
|
|
{ gCurrentChasePauseText, 5u, 2u, (pauseFunc)&CutRec_NextChase, MENU_QUIT_NONE, NULL },
|
2020-10-04 20:19:53 +02:00
|
|
|
#endif
|
2020-11-18 19:21:16 +01:00
|
|
|
{ "Display position", PAUSE_TYPE_FUNC, 2, SetDisplayPosition, MENU_QUIT_NONE, NULL},
|
|
|
|
{ "Back on Wheels", PAUSE_TYPE_FUNC, 2, SetRightWayUp, MENU_QUIT_NONE, NULL},
|
|
|
|
{ "Time of Day", PAUSE_TYPE_SUBMENU, 2, NULL, MENU_QUIT_NONE, &DebugTimeOfDayHeader },
|
|
|
|
{ "Fun Cheats", PAUSE_TYPE_SUBMENU, 2, NULL, MENU_QUIT_NONE, &DebugJustForFunHeader },
|
|
|
|
{ "Invincibility", PAUSE_TYPE_FUNC, 2, ToggleInvincibility,MENU_QUIT_NONE, NULL},
|
|
|
|
{ "Immunity", PAUSE_TYPE_FUNC, 2, ToggleImmunity, MENU_QUIT_NONE, NULL},
|
|
|
|
{ "Puppy Dog Cops", PAUSE_TYPE_FUNC, 2, TogglePuppyDogCops, MENU_QUIT_NONE, NULL },
|
|
|
|
{ "Toggle Overlay", PAUSE_TYPE_FUNC, 2, ToggleOverlays, MENU_QUIT_NONE, NULL },
|
|
|
|
{ "Player Ghost", PAUSE_TYPE_FUNC, 2, TogglePlayerGhost, MENU_QUIT_NONE, NULL },
|
2020-11-20 21:10:17 +01:00
|
|
|
{ "Next Mission", 0, 2, NULL, MENU_QUIT_NEXTMISSION, NULL },
|
2020-11-18 19:21:16 +01:00
|
|
|
{ NULL, PAUSE_TYPE_ENDITEMS, 0u, NULL, MENU_QUIT_NONE, NULL }
|
2020-04-26 12:07:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
MENU_HEADER DebugOptionsHeader =
|
|
|
|
{ "Debug Options", { 0, 0, 0, 0 }, 0u, DebugOptionsItems };
|
|
|
|
#endif
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
MENU_ITEM YesNoRestartItems[] =
|
2020-04-05 22:04:37 +02:00
|
|
|
{
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_NO), 1u, 2u, NULL, MENU_QUIT_BACKMENU, NULL },
|
|
|
|
{ G_LTXT_ID(GTXT_YES), 1u, 2u, NULL, MENU_QUIT_RESTART, NULL },
|
2020-11-18 19:21:16 +01:00
|
|
|
{ NULL, PAUSE_TYPE_ENDITEMS, 0u, NULL, MENU_QUIT_NONE, NULL }
|
2020-04-05 22:04:37 +02:00
|
|
|
};
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
MENU_ITEM YesNoQuitItems[] =
|
2020-04-05 22:04:37 +02:00
|
|
|
{
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_NO), 1u, 2u, NULL, MENU_QUIT_BACKMENU, NULL },
|
|
|
|
{ G_LTXT_ID(GTXT_YES), 1u, 2u, NULL, MENU_QUIT_QUIT, NULL },
|
2020-11-18 19:21:16 +01:00
|
|
|
{ NULL, PAUSE_TYPE_ENDITEMS, 0u, NULL, MENU_QUIT_NONE, NULL }
|
2020-04-05 22:04:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
MENU_HEADER YesNoRestartHeader =
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_AreYouSure), { 0, 0, 0, 0 }, 0u, YesNoRestartItems };
|
2020-04-05 22:04:37 +02:00
|
|
|
|
|
|
|
MENU_HEADER YesNoQuitHeader =
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_AreYouSure), { 0, 0, 0, 0 }, 0u, YesNoQuitItems };
|
2020-04-05 22:04:37 +02:00
|
|
|
|
2020-04-26 12:07:37 +02:00
|
|
|
MENU_ITEM MainPauseItems[] =
|
2020-03-27 21:47:29 +01:00
|
|
|
{
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_Continue), 1u, 2u, NULL, MENU_QUIT_CONTINUE, NULL },
|
|
|
|
{ G_LTXT_ID(GTXT_ShowMap), PAUSE_TYPE_FUNC, 2u, (pauseFunc)&PauseMap, MENU_QUIT_NONE, NULL },
|
|
|
|
{ G_LTXT_ID(GTXT_Restart), PAUSE_TYPE_SUBMENU, 2u, NULL, MENU_QUIT_NONE, &YesNoRestartHeader },
|
|
|
|
{ G_LTXT_ID(GTXT_SfxVolume), PAUSE_TYPE_SFXVOLUME | PAUSE_TYPE_DIRFUNC, 2u, (pauseFunc)&SfxVolume, MENU_QUIT_NONE, NULL },
|
|
|
|
{ G_LTXT_ID(GTXT_MusicVolume), PAUSE_TYPE_MUSICVOLUME | PAUSE_TYPE_DIRFUNC, 2u, (pauseFunc)&MusicVolume, MENU_QUIT_NONE, NULL },
|
|
|
|
{ G_LTXT_ID(GTXT_FilmDirector), 1u, 2u, NULL, MENU_QUIT_DIRECTOR, NULL},
|
|
|
|
{ G_LTXT_ID(GTXT_QuickReplay),1u,2u,NULL,MENU_QUIT_QUICKREPLAY,NULL},
|
2020-09-26 18:37:50 +02:00
|
|
|
#if defined(_DEBUG) || defined(DEBUG_OPTIONS)
|
2020-11-18 19:21:16 +01:00
|
|
|
{ "Debug Options", PAUSE_TYPE_SUBMENU, 2u, NULL, MENU_QUIT_NONE, &DebugOptionsHeader },
|
2020-09-26 18:37:50 +02:00
|
|
|
#endif
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_Exit), PAUSE_TYPE_SUBMENU, 2u, NULL, MENU_QUIT_NONE, &YesNoQuitHeader },
|
2020-11-18 19:21:16 +01:00
|
|
|
{ NULL, PAUSE_TYPE_ENDITEMS, 0u, NULL, MENU_QUIT_NONE, NULL }
|
2020-03-27 21:47:29 +01:00
|
|
|
};
|
|
|
|
|
2020-11-16 18:15:28 +01:00
|
|
|
MENU_ITEM MultiplayerPauseItems[] =
|
2020-03-27 21:47:29 +01:00
|
|
|
{
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_Continue), 1u, 2u, NULL, MENU_QUIT_CONTINUE, NULL },
|
|
|
|
{ G_LTXT_ID(GTXT_Restart), PAUSE_TYPE_SUBMENU, 2u, NULL, MENU_QUIT_NONE, &YesNoRestartHeader },
|
|
|
|
{ G_LTXT_ID(GTXT_SfxVolume), PAUSE_TYPE_SFXVOLUME | PAUSE_TYPE_DIRFUNC, 2u, (pauseFunc)&SfxVolume, MENU_QUIT_NONE, NULL },
|
|
|
|
{ G_LTXT_ID(GTXT_MusicVolume), PAUSE_TYPE_MUSICVOLUME | PAUSE_TYPE_DIRFUNC, 2u, (pauseFunc)&MusicVolume, MENU_QUIT_NONE, NULL },
|
|
|
|
{ G_LTXT_ID(GTXT_QuickReplay),1u,2u,NULL,MENU_QUIT_QUICKREPLAY,NULL},
|
|
|
|
{ G_LTXT_ID(GTXT_Exit), PAUSE_TYPE_SUBMENU, 2u, NULL, MENU_QUIT_NONE, &YesNoQuitHeader },
|
2020-11-18 19:21:16 +01:00
|
|
|
{ NULL, PAUSE_TYPE_ENDITEMS, 0u, NULL, MENU_QUIT_NONE, NULL }
|
2020-03-27 21:47:29 +01:00
|
|
|
};
|
|
|
|
|
2020-04-26 12:07:37 +02:00
|
|
|
MENU_ITEM CutscenePauseItems[] =
|
2020-03-27 21:47:29 +01:00
|
|
|
{
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_Continue), 1u, 2u, NULL, MENU_QUIT_CONTINUE, NULL },
|
|
|
|
{ G_LTXT_ID(GTXT_SkipCutscene), PAUSE_TYPE_FUNC, 2u, (pauseFunc)&SkipCutscene, MENU_QUIT_CONTINUE, NULL },
|
|
|
|
{ G_LTXT_ID(GTXT_Restart), PAUSE_TYPE_SUBMENU, 2u, NULL, MENU_QUIT_NONE, &YesNoRestartHeader },
|
|
|
|
{ G_LTXT_ID(GTXT_SfxVolume), PAUSE_TYPE_SFXVOLUME | PAUSE_TYPE_DIRFUNC, 2u, (pauseFunc)&SfxVolume, MENU_QUIT_NONE, NULL },
|
|
|
|
{ G_LTXT_ID(GTXT_MusicVolume), PAUSE_TYPE_MUSICVOLUME | PAUSE_TYPE_DIRFUNC, 2u, (pauseFunc)&MusicVolume, MENU_QUIT_NONE, NULL },
|
2020-09-26 20:20:22 +02:00
|
|
|
#if defined(_DEBUG) || defined(DEBUG_OPTIONS)
|
2020-12-01 11:47:40 +01:00
|
|
|
{ "Debug Options", PAUSE_TYPE_SUBMENU, 2u, NULL, MENU_QUIT_NONE, &DebugOptionsHeader },
|
2020-09-26 18:37:50 +02:00
|
|
|
#endif
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_Exit), PAUSE_TYPE_SUBMENU, 2u, NULL, MENU_QUIT_NONE, &YesNoQuitHeader },
|
2020-11-18 19:21:16 +01:00
|
|
|
{ NULL, PAUSE_TYPE_ENDITEMS, 0u, NULL, MENU_QUIT_NONE, NULL }
|
2020-03-27 21:47:29 +01:00
|
|
|
};
|
|
|
|
|
2020-08-31 13:15:40 +02:00
|
|
|
MENU_ITEM MissionCompleteItems[] =
|
2020-03-27 21:47:29 +01:00
|
|
|
{
|
2020-08-31 13:15:40 +02:00
|
|
|
#ifdef PSX
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_SaveGame), 3u, 2u, (pauseFunc)&SaveGame, MENU_QUIT_NONE, NULL },
|
2020-08-31 13:15:40 +02:00
|
|
|
#endif
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_Continue), 1u, 2u, NULL, MENU_QUIT_NEXTMISSION, NULL },
|
|
|
|
{ G_LTXT_ID(GTXT_FilmDirector),1u,2u,NULL,MENU_QUIT_DIRECTOR,NULL},
|
|
|
|
{ G_LTXT_ID(GTXT_QuickReplay),1u,2u,NULL,MENU_QUIT_QUICKREPLAY,NULL},
|
|
|
|
{ G_LTXT_ID(GTXT_SaveReplay), PAUSE_TYPE_FUNC, 2u, (pauseFunc)&SaveReplay, MENU_QUIT_NONE, NULL },
|
|
|
|
{ G_LTXT_ID(GTXT_Restart), PAUSE_TYPE_SUBMENU, 2u, NULL, MENU_QUIT_NONE, &YesNoRestartHeader },
|
|
|
|
{ G_LTXT_ID(GTXT_Exit), PAUSE_TYPE_SUBMENU, 2u, NULL, MENU_QUIT_NONE, &YesNoQuitHeader },
|
2020-12-01 11:47:40 +01:00
|
|
|
{ NULL, PAUSE_TYPE_ENDITEMS, 0u, NULL, MENU_QUIT_NONE, NULL }
|
2020-03-27 21:47:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
MENU_ITEM MissionFailedItems[6] =
|
|
|
|
{
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_FilmDirector),1u,2u,NULL,MENU_QUIT_DIRECTOR,NULL},
|
|
|
|
{ G_LTXT_ID(GTXT_QuickReplay),1u,2u,NULL,MENU_QUIT_QUICKREPLAY,NULL},
|
|
|
|
{ G_LTXT_ID(GTXT_Exit), 3u, 2u, (pauseFunc)&SaveReplay, MENU_QUIT_NONE, NULL },
|
|
|
|
{ G_LTXT_ID(GTXT_RetryMission),PAUSE_TYPE_SUBMENU,2u,NULL,MENU_QUIT_NONE,&YesNoRestartHeader },
|
|
|
|
{ G_LTXT_ID(GTXT_Exit), PAUSE_TYPE_SUBMENU, 2u, NULL, MENU_QUIT_NONE, &YesNoQuitHeader },
|
2020-11-18 19:21:16 +01:00
|
|
|
{ NULL, PAUSE_TYPE_ENDITEMS, 0u, NULL, MENU_QUIT_NONE, NULL }
|
2020-03-27 21:47:29 +01:00
|
|
|
};
|
|
|
|
|
2020-05-20 23:33:21 +02:00
|
|
|
MENU_ITEM TakeARideFinishedItems[] =
|
2020-03-27 21:47:29 +01:00
|
|
|
{
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_Restart), PAUSE_TYPE_SUBMENU, 2u, NULL, MENU_QUIT_NONE, &YesNoRestartHeader },
|
|
|
|
{ G_LTXT_ID(GTXT_FilmDirector),1u,2u,NULL,MENU_QUIT_DIRECTOR,NULL},
|
|
|
|
{ G_LTXT_ID(GTXT_QuickReplay),1u,2u,NULL,MENU_QUIT_QUICKREPLAY,NULL},
|
|
|
|
{ G_LTXT_ID(GTXT_SaveReplay), PAUSE_TYPE_FUNC, 2u, (pauseFunc)&SaveReplay, MENU_QUIT_NONE, NULL },
|
|
|
|
{ G_LTXT_ID(GTXT_Exit), PAUSE_TYPE_SUBMENU, 2u, NULL, MENU_QUIT_NONE, &YesNoQuitHeader },
|
2020-11-18 19:21:16 +01:00
|
|
|
{ NULL, PAUSE_TYPE_ENDITEMS, 0u, NULL, MENU_QUIT_NONE, NULL }
|
2020-03-27 21:47:29 +01:00
|
|
|
};
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
MENU_ITEM DrivingGameFinishedItems[] =
|
2020-03-27 21:47:29 +01:00
|
|
|
{
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_PlayAgain), PAUSE_TYPE_SUBMENU, 2u, NULL, MENU_QUIT_NONE, &YesNoRestartHeader },
|
2021-02-25 21:16:45 +01:00
|
|
|
{ EnterScoreText, 3u, 2u, (pauseFunc)&EnterScoreName, MENU_QUIT_NONE, NULL },
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_FilmDirector),1u,2u,NULL,MENU_QUIT_DIRECTOR,NULL},
|
|
|
|
{ G_LTXT_ID(GTXT_QuickReplay),1u,2u,NULL,MENU_QUIT_QUICKREPLAY,NULL},
|
|
|
|
{ G_LTXT_ID(GTXT_SaveReplay), PAUSE_TYPE_FUNC, 2u, (pauseFunc)&SaveReplay, MENU_QUIT_NONE, NULL },
|
|
|
|
{ G_LTXT_ID(GTXT_Exit), PAUSE_TYPE_SUBMENU, 2u, NULL, MENU_QUIT_NONE, &YesNoQuitHeader },
|
2020-11-18 19:21:16 +01:00
|
|
|
{ NULL, PAUSE_TYPE_ENDITEMS, 0u, NULL, MENU_QUIT_NONE, NULL }
|
2020-03-27 21:47:29 +01:00
|
|
|
};
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
MENU_ITEM MultiplayerFinishedItems[] =
|
2020-03-27 21:47:29 +01:00
|
|
|
{
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_PlayAgain), PAUSE_TYPE_SUBMENU, 2u, NULL, MENU_QUIT_NONE, &YesNoRestartHeader },
|
|
|
|
{ G_LTXT_ID(GTXT_QuickReplay),1u,2u,NULL,MENU_QUIT_QUICKREPLAY,NULL},
|
|
|
|
{ G_LTXT_ID(GTXT_SaveReplay), PAUSE_TYPE_FUNC, 2u, (pauseFunc)&SaveReplay, MENU_QUIT_NONE, NULL },
|
|
|
|
{ G_LTXT_ID(GTXT_Exit), PAUSE_TYPE_SUBMENU, 2u, NULL, MENU_QUIT_NONE, &YesNoQuitHeader },
|
2020-11-18 19:21:16 +01:00
|
|
|
{ NULL, PAUSE_TYPE_ENDITEMS, 0u, NULL, MENU_QUIT_NONE, NULL }
|
2020-03-27 21:47:29 +01:00
|
|
|
};
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
MENU_ITEM ChaseGameFinishedItems[] =
|
2020-03-27 21:47:29 +01:00
|
|
|
{
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_PlayAgain), PAUSE_TYPE_SUBMENU, 2u, NULL, MENU_QUIT_NONE, &YesNoRestartHeader },
|
|
|
|
{ G_LTXT_ID(GTXT_FilmDirector),1u,2u,NULL,MENU_QUIT_DIRECTOR,NULL},
|
|
|
|
{ G_LTXT_ID(GTXT_QuickReplay),1u,2u,NULL,MENU_QUIT_QUICKREPLAY,NULL},
|
|
|
|
{ G_LTXT_ID(GTXT_SaveReplay), PAUSE_TYPE_FUNC, 2u, (pauseFunc)&SaveReplay, MENU_QUIT_NONE, NULL },
|
|
|
|
{ G_LTXT_ID(GTXT_Exit), PAUSE_TYPE_SUBMENU, 2u, NULL, MENU_QUIT_NONE, &YesNoQuitHeader },
|
2020-11-18 19:21:16 +01:00
|
|
|
{ NULL, PAUSE_TYPE_ENDITEMS, 0u, NULL, MENU_QUIT_NONE, NULL }
|
2020-03-27 21:47:29 +01:00
|
|
|
};
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
MENU_ITEM NoPadItems[] =
|
2020-03-27 21:47:29 +01:00
|
|
|
{
|
2020-12-01 11:47:40 +01:00
|
|
|
{ NULL, PAUSE_TYPE_ENDITEMS, 0u, NULL, MENU_QUIT_NONE, NULL}
|
2020-03-27 21:47:29 +01:00
|
|
|
};
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
MENU_ITEM NoMultiPadItems[] =
|
2020-03-27 21:47:29 +01:00
|
|
|
{
|
|
|
|
{ "Exit", 1u, 2u, NULL, MENU_QUIT_QUIT, NULL },
|
2020-11-18 19:21:16 +01:00
|
|
|
{ NULL, PAUSE_TYPE_ENDITEMS, 0u, NULL, MENU_QUIT_NONE, NULL }
|
2020-03-27 21:47:29 +01:00
|
|
|
};
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
MENU_ITEM InvalidPadItems[] =
|
2020-03-27 21:47:29 +01:00
|
|
|
{
|
2020-11-18 19:21:16 +01:00
|
|
|
{ NULL, PAUSE_TYPE_ENDITEMS, 0u, NULL, MENU_QUIT_NONE, NULL}
|
2020-03-27 21:47:29 +01:00
|
|
|
};
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
MENU_ITEM InvalidMultiPadItems[] =
|
2020-03-27 21:47:29 +01:00
|
|
|
{
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_Exit), 1u, 2u, NULL, MENU_QUIT_QUIT, NULL },
|
2020-11-18 19:21:16 +01:00
|
|
|
{ NULL, PAUSE_TYPE_ENDITEMS, 0u, NULL, MENU_QUIT_NONE, NULL }
|
2020-03-27 21:47:29 +01:00
|
|
|
};
|
|
|
|
|
2020-04-26 12:07:37 +02:00
|
|
|
|
2020-03-27 21:47:29 +01:00
|
|
|
MENU_HEADER PauseMenuHeader =
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_Paused), { 0, 0, 0, 0 }, 0u, MainPauseItems };
|
2020-03-27 21:47:29 +01:00
|
|
|
|
|
|
|
MENU_HEADER MultiplayerPauseHeader =
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_Paused), { 0, 0, 0, 0 }, 0u, MultiplayerPauseItems };
|
2020-03-27 21:47:29 +01:00
|
|
|
|
|
|
|
MENU_HEADER CutscenePauseMenuHeader =
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_Paused), { 0, 0, 0, 0 }, 0u, CutscenePauseItems };
|
2020-03-27 21:47:29 +01:00
|
|
|
|
|
|
|
MENU_HEADER MissionCompleteHeader =
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_MissionSuccessful), { 0, 0, 0, 0 }, 0u, MissionCompleteItems };
|
2020-03-27 21:47:29 +01:00
|
|
|
|
|
|
|
MENU_HEADER MissionFailedHeader =
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_MissionFailed), { 0, 0, 0, 0 }, 0u, MissionFailedItems };
|
2020-03-27 21:47:29 +01:00
|
|
|
|
|
|
|
MENU_HEADER TakeARideFinishedHeader =
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_GameOver), { 0, 0, 0, 0 }, 0u, TakeARideFinishedItems };
|
2020-03-27 21:47:29 +01:00
|
|
|
|
|
|
|
MENU_HEADER DrivingGameFinishedHeader =
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_GameOver), { 0, 0, 0, 0 }, 0u, DrivingGameFinishedItems };
|
2020-03-27 21:47:29 +01:00
|
|
|
|
|
|
|
MENU_HEADER MultiplayerFinishedHeader =
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_GameOver), { 0, 0, 0, 0 }, 0u, MultiplayerFinishedItems };
|
2020-03-27 21:47:29 +01:00
|
|
|
|
|
|
|
MENU_HEADER ChaseGameFinishedHeader =
|
2020-12-22 12:46:42 +01:00
|
|
|
{ G_LTXT_ID(GTXT_GameOver), { 0, 0, 0, 0 }, 0u, ChaseGameFinishedItems };
|
2020-03-27 21:47:29 +01:00
|
|
|
|
|
|
|
MENU_HEADER NoPadHeader =
|
|
|
|
{
|
2020-12-22 12:46:42 +01:00
|
|
|
G_LTXT_ID(GTXT_InsertController1),
|
2020-03-27 21:47:29 +01:00
|
|
|
{ 0, 0, 0, 0 },
|
|
|
|
0u,
|
|
|
|
NoPadItems
|
|
|
|
};
|
|
|
|
|
|
|
|
MENU_HEADER NoMultiPadHeader =
|
|
|
|
{
|
2020-12-22 12:46:42 +01:00
|
|
|
G_LTXT_ID(GTXT_InsertController2),
|
2020-03-27 21:47:29 +01:00
|
|
|
{ 0, 0, 0, 0 },
|
|
|
|
0u,
|
|
|
|
NoMultiPadItems
|
|
|
|
};
|
|
|
|
|
|
|
|
MENU_HEADER InvalidPadHeader =
|
|
|
|
{
|
2020-12-22 12:46:42 +01:00
|
|
|
G_LTXT_ID(GTXT_IncorrectController1),
|
2020-03-27 21:47:29 +01:00
|
|
|
{ 0, 0, 0, 0 },
|
|
|
|
0u,
|
|
|
|
InvalidPadItems
|
|
|
|
};
|
|
|
|
|
|
|
|
MENU_HEADER InvalidMultiPadHeader =
|
|
|
|
{
|
2020-12-22 12:46:42 +01:00
|
|
|
G_LTXT_ID(GTXT_IncorrectController2),
|
2020-03-27 21:47:29 +01:00
|
|
|
{ 0, 0, 0, 0 },
|
|
|
|
0u,
|
|
|
|
InvalidMultiPadItems
|
|
|
|
};
|
|
|
|
|
2021-02-25 21:16:45 +01:00
|
|
|
|
|
|
|
u_char gCurrentTextChar = 0;
|
|
|
|
typedef void(*OnEntryComplete)(void* data, char* text);
|
|
|
|
|
|
|
|
void ScoreNameInputHandler(const char* input)
|
|
|
|
{
|
|
|
|
if (!input)
|
|
|
|
{
|
|
|
|
gCurrentTextChar = 255;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gCurrentTextChar = *input;
|
|
|
|
}
|
|
|
|
|
2021-04-15 07:49:48 +02:00
|
|
|
#define USE_PAD_INPUT defined(PSX)
|
|
|
|
|
2021-02-25 21:16:45 +01:00
|
|
|
// [A] Enter the replay name to save
|
|
|
|
char* WaitForTextEntry(char* textBufPtr, int maxLength)
|
|
|
|
{
|
|
|
|
u_char chr;
|
|
|
|
int so, co;
|
|
|
|
int delay, toggle;
|
|
|
|
char* username;
|
|
|
|
unsigned short npad, dpad;
|
|
|
|
|
2021-04-04 11:24:16 +02:00
|
|
|
username = textBufPtr ? textBufPtr : (char*)_overlay_buffer;
|
2021-02-25 21:16:45 +01:00
|
|
|
delay = 0;
|
|
|
|
toggle = 0;
|
|
|
|
co = 1;
|
|
|
|
so = strlen(username);
|
|
|
|
|
2021-04-15 07:49:48 +02:00
|
|
|
#if !USE_PAD_INPUT
|
|
|
|
// PsyX input handler
|
2022-01-23 11:12:02 +01:00
|
|
|
g_cfg_gameOnTextInput = ScoreNameInputHandler;
|
2021-02-25 21:16:45 +01:00
|
|
|
gCurrentTextChar = 0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
do {
|
2021-04-15 07:49:48 +02:00
|
|
|
|
|
|
|
if (!FilterFrameTime())
|
|
|
|
continue;
|
|
|
|
|
2021-02-25 21:16:45 +01:00
|
|
|
ReadControllers();
|
|
|
|
|
|
|
|
npad = Pads[0].dirnew;
|
|
|
|
dpad = Pads[0].direct;
|
|
|
|
|
|
|
|
// cancel
|
|
|
|
if (npad & 0x10)
|
|
|
|
return NULL;
|
|
|
|
|
2021-04-15 07:49:48 +02:00
|
|
|
#if USE_PAD_INPUT
|
2021-02-25 21:16:45 +01:00
|
|
|
if (dpad & 0x20)
|
|
|
|
{
|
|
|
|
// switch to end
|
|
|
|
delay = 1;
|
|
|
|
toggle = 0;
|
|
|
|
co = 67;
|
|
|
|
}
|
|
|
|
else if (dpad & 0x8000)
|
|
|
|
{
|
|
|
|
// move left/right to switch chars
|
|
|
|
if (delay-- == 0)
|
|
|
|
{
|
|
|
|
delay = 20;
|
|
|
|
toggle = 0;
|
|
|
|
co--;
|
|
|
|
}
|
|
|
|
else if (delay < 1)
|
|
|
|
{
|
|
|
|
delay = 2;
|
|
|
|
toggle = 0;
|
|
|
|
co--;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (co < 0)
|
|
|
|
co = 67;
|
|
|
|
}
|
|
|
|
else if (dpad & 0x2000)
|
|
|
|
{
|
|
|
|
if (delay-- == 0)
|
|
|
|
{
|
|
|
|
delay = 20;
|
|
|
|
toggle = 0;
|
|
|
|
co++;
|
|
|
|
}
|
|
|
|
else if (delay < 1)
|
|
|
|
{
|
|
|
|
delay = 2;
|
|
|
|
toggle = 0;
|
|
|
|
co++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (co > 67)
|
|
|
|
co = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
delay = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (so == maxLength)
|
|
|
|
chr = 254;
|
|
|
|
else
|
|
|
|
chr = validchars[co];
|
|
|
|
#else
|
|
|
|
if (gCurrentTextChar > 0)
|
|
|
|
{
|
|
|
|
if (gCurrentTextChar == 255)
|
|
|
|
{
|
|
|
|
// do backspace
|
|
|
|
chr = 255;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Find a valid character
|
|
|
|
for (co = 0; co < 69; co++)
|
|
|
|
{
|
|
|
|
if (validchars[co] == gCurrentTextChar)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (so == maxLength)
|
|
|
|
{
|
|
|
|
chr = 254;
|
|
|
|
gCurrentTextChar = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
chr = validchars[co];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (so == maxLength)
|
|
|
|
chr = 254;
|
|
|
|
else
|
|
|
|
chr = 'I';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (npad & 0x40)
|
|
|
|
{
|
|
|
|
gCurrentTextChar = 254;
|
|
|
|
chr = 254;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
toggle++;
|
|
|
|
|
|
|
|
if (toggle & 4)
|
|
|
|
username[so] = ' ';
|
|
|
|
else if (chr == ' ')
|
|
|
|
username[so] = '.';
|
|
|
|
else
|
|
|
|
username[so] = chr;
|
|
|
|
|
2021-04-15 07:49:48 +02:00
|
|
|
#if USE_PAD_INPUT
|
2021-02-25 21:16:45 +01:00
|
|
|
if (npad & 0x80)
|
|
|
|
{
|
|
|
|
if (so > 0)
|
|
|
|
so--;
|
|
|
|
|
|
|
|
username[so] = 0;
|
|
|
|
username[so + 1] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (npad & 0x40)
|
|
|
|
{
|
|
|
|
#else
|
|
|
|
if (gCurrentTextChar > 0)
|
|
|
|
{
|
|
|
|
gCurrentTextChar = 0;
|
|
|
|
#endif
|
|
|
|
// complete
|
|
|
|
if (chr == 254)
|
|
|
|
{
|
|
|
|
username[so] = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// delete chars
|
|
|
|
if (chr == 255)
|
|
|
|
{
|
|
|
|
if (so > 0)
|
|
|
|
so--;
|
|
|
|
|
|
|
|
username[so] = 0;
|
|
|
|
username[so + 1] = 0;
|
|
|
|
}
|
|
|
|
else if (so < maxLength)
|
|
|
|
{
|
|
|
|
username[so] = chr;
|
|
|
|
username[so + 1] = 0;
|
|
|
|
so++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DrawGame();
|
2021-07-09 17:18:12 +02:00
|
|
|
|
|
|
|
#ifdef __EMSCRIPTEN__
|
|
|
|
emscripten_sleep(0);
|
|
|
|
#endif
|
2021-02-25 21:16:45 +01:00
|
|
|
} while (true);
|
|
|
|
|
2021-04-15 07:49:48 +02:00
|
|
|
#if !USE_PAD_INPUT
|
2022-01-23 11:12:02 +01:00
|
|
|
g_cfg_gameOnTextInput = NULL;
|
2021-02-25 21:16:45 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return username;
|
|
|
|
}
|
2020-03-27 21:47:29 +01:00
|
|
|
|
2020-12-22 12:46:42 +01:00
|
|
|
void SkipCutscene(int direction)
|
|
|
|
{
|
|
|
|
gSkipInGameCutscene = 1;
|
|
|
|
}
|
2020-03-27 21:47:29 +01:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
// [D] [T]
|
2020-03-27 21:47:29 +01:00
|
|
|
void SaveReplay(int direction)
|
|
|
|
{
|
2021-02-25 21:16:45 +01:00
|
|
|
char* result;
|
2020-11-11 19:37:19 +01:00
|
|
|
char filename[64];
|
2021-02-25 21:16:45 +01:00
|
|
|
|
2020-05-27 18:02:16 +02:00
|
|
|
#ifdef PSX
|
2021-04-18 21:52:27 +02:00
|
|
|
UNIMPLEMENTED();
|
|
|
|
// CallMemoryCard(0x10, 1);
|
2020-05-27 18:02:16 +02:00
|
|
|
#else
|
2020-11-11 19:37:19 +01:00
|
|
|
|
|
|
|
#ifdef CUTSCENE_RECORDER
|
2021-05-17 10:52:44 +02:00
|
|
|
if(_CutRec_IsOn())
|
2020-11-12 11:02:45 +01:00
|
|
|
{
|
2021-06-22 10:27:49 +02:00
|
|
|
if (CutRec_SaveChase())
|
2021-02-25 21:16:45 +01:00
|
|
|
{
|
2021-02-26 18:37:08 +01:00
|
|
|
gDisplayedMessage.header = G_LTXT(GTXT_SaveReplay);
|
|
|
|
gDisplayedMessage.text = G_LTXT(GTXT_OK);
|
|
|
|
gDisplayedMessage.show = 25;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gDisplayedMessage.header = G_LTXT(GTXT_SaveReplay);
|
|
|
|
gDisplayedMessage.text = G_LTXT(GTXT_SavingError);
|
|
|
|
gDisplayedMessage.show = 15;
|
2021-02-25 21:16:45 +01:00
|
|
|
}
|
2020-11-12 11:02:45 +01:00
|
|
|
}
|
2021-02-26 18:37:08 +01:00
|
|
|
else
|
2021-02-25 21:16:45 +01:00
|
|
|
#endif // CUTSCENE_RECORDER
|
2021-02-26 18:37:08 +01:00
|
|
|
{
|
|
|
|
int cnt;
|
|
|
|
FILE* temp;
|
|
|
|
_mkdir("Replays");
|
2021-02-25 21:16:45 +01:00
|
|
|
|
2021-02-26 18:37:08 +01:00
|
|
|
ClearMem(EnterNameText, REPLAY_NAME_LEN);
|
|
|
|
|
|
|
|
// detect the best file name
|
|
|
|
// TODO: if replay is loaded - set the loaded replay filename
|
|
|
|
if (gLoadedReplay)
|
|
|
|
{
|
|
|
|
strcpy(EnterNameText, gCurrentReplayFilename);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cnt = 1;
|
|
|
|
while (cnt < 1000)
|
|
|
|
{
|
|
|
|
sprintf(EnterNameText, "Chase%d", cnt);
|
|
|
|
sprintf(filename, "Replays/%s.D2RP", EnterNameText);
|
2021-02-25 21:16:45 +01:00
|
|
|
|
2021-02-26 18:37:08 +01:00
|
|
|
if ((temp = fopen(filename, "r")) != NULL)
|
|
|
|
{
|
|
|
|
fclose(temp);
|
|
|
|
cnt++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2021-02-25 21:16:45 +01:00
|
|
|
|
2021-02-26 18:37:08 +01:00
|
|
|
gDisplayedMessage.header = G_LTXT(GTXT_EnterName);
|
|
|
|
gDisplayedMessage.text = EnterNameText;
|
|
|
|
gDisplayedMessage.show = -1;
|
2021-02-25 21:16:45 +01:00
|
|
|
|
2021-02-26 18:37:08 +01:00
|
|
|
// wait for user input the replay name
|
|
|
|
result = WaitForTextEntry(EnterNameText, REPLAY_NAME_LEN);
|
2021-02-25 21:16:45 +01:00
|
|
|
|
2021-02-26 18:37:08 +01:00
|
|
|
gDisplayedMessage.show = 0;
|
2021-02-25 21:16:45 +01:00
|
|
|
|
2021-02-26 18:37:08 +01:00
|
|
|
if (result)
|
2021-02-25 21:16:45 +01:00
|
|
|
{
|
2021-02-26 18:37:08 +01:00
|
|
|
sprintf(filename, "Replays/%s.D2RP", result);
|
2021-02-25 21:16:45 +01:00
|
|
|
|
2021-02-26 18:37:08 +01:00
|
|
|
if (SaveReplayToFile(filename))
|
|
|
|
{
|
|
|
|
gDisplayedMessage.header = G_LTXT(GTXT_SaveReplay);
|
|
|
|
gDisplayedMessage.text = G_LTXT(GTXT_OK);
|
|
|
|
gDisplayedMessage.show = 15;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gDisplayedMessage.header = G_LTXT(GTXT_SaveReplay);
|
|
|
|
gDisplayedMessage.text = G_LTXT(GTXT_SavingError);
|
|
|
|
gDisplayedMessage.show = 15;
|
|
|
|
}
|
2021-02-25 21:16:45 +01:00
|
|
|
}
|
2020-05-27 18:02:16 +02:00
|
|
|
}
|
2021-02-25 21:16:45 +01:00
|
|
|
#endif // PSX
|
2020-03-27 21:47:29 +01:00
|
|
|
}
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
// [D] [T]
|
2020-03-27 21:47:29 +01:00
|
|
|
void SaveGame(int direction)
|
|
|
|
{
|
2021-04-18 21:52:27 +02:00
|
|
|
#ifndef PSX
|
2021-02-25 09:45:26 +01:00
|
|
|
SaveCurrentGame();
|
2021-04-18 21:52:27 +02:00
|
|
|
#endif
|
2020-03-27 21:47:29 +01:00
|
|
|
}
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
// [D] [T]
|
2020-03-27 21:47:29 +01:00
|
|
|
int MaxMenuStringLength(MENU_HEADER *pMenu)
|
|
|
|
{
|
2020-05-12 06:00:32 +02:00
|
|
|
int max;
|
|
|
|
int temp;
|
|
|
|
MENU_ITEM *pItems;
|
2020-04-05 22:04:37 +02:00
|
|
|
|
2020-05-12 06:00:32 +02:00
|
|
|
pItems = pMenu->MenuItems;
|
2020-12-22 12:46:42 +01:00
|
|
|
max = StringWidth(GET_GAME_TXT(pMenu->Title));
|
2020-04-11 23:57:32 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
while ((pItems->Type & PAUSE_TYPE_ENDITEMS) == 0)
|
2020-04-11 23:57:32 +02:00
|
|
|
{
|
2020-12-22 12:46:42 +01:00
|
|
|
temp = StringWidth(GET_GAME_TXT(pItems->Text));
|
2020-04-11 23:57:32 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
if (pItems->Type & (PAUSE_TYPE_SFXVOLUME | PAUSE_TYPE_MUSICVOLUME))
|
2020-05-12 06:00:32 +02:00
|
|
|
temp = temp + StringWidth(" 100");
|
2020-04-11 23:57:32 +02:00
|
|
|
|
2021-02-23 07:26:36 +01:00
|
|
|
if (temp > max)
|
2020-05-12 06:00:32 +02:00
|
|
|
max = temp;
|
2020-04-11 23:57:32 +02:00
|
|
|
|
2020-05-12 06:00:32 +02:00
|
|
|
pItems++;
|
2020-04-05 22:04:37 +02:00
|
|
|
}
|
2020-05-12 06:00:32 +02:00
|
|
|
|
|
|
|
return max;
|
2020-03-27 21:47:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-09 09:33:57 +01:00
|
|
|
// [D] [T]
|
|
|
|
void SetupMenu(MENU_HEADER *menu, int back)
|
|
|
|
{
|
|
|
|
int len;
|
|
|
|
MENU_ITEM *pItem;
|
|
|
|
int numItems;
|
|
|
|
|
|
|
|
numItems = 0;
|
|
|
|
|
|
|
|
ActiveMenuItem = 0;
|
|
|
|
|
|
|
|
pItem = menu->MenuItems;
|
|
|
|
while (pItem->Type != PAUSE_TYPE_ENDITEMS)
|
|
|
|
{
|
|
|
|
if (back && pItem == ActiveItem[VisibleMenu])
|
|
|
|
ActiveMenuItem = numItems;
|
|
|
|
|
|
|
|
numItems++;
|
|
|
|
pItem++;
|
|
|
|
}
|
|
|
|
|
|
|
|
ActiveMenu = menu;
|
|
|
|
ActiveMenu->NumItems = numItems;
|
2020-03-27 21:47:29 +01:00
|
|
|
|
2020-12-09 09:33:57 +01:00
|
|
|
len = MaxMenuStringLength(ActiveMenu);
|
2020-03-27 21:47:29 +01:00
|
|
|
|
2020-12-09 09:33:57 +01:00
|
|
|
ActiveMenu->Bound.x = ((304 - len) / 2) - 4;
|
|
|
|
ActiveMenu->Bound.w = len + 24;
|
2022-01-31 06:59:57 +01:00
|
|
|
ActiveMenu->Bound.y = MAX(48, (SCREEN_H - (numItems + 1) * 15) / 2);
|
2020-12-09 09:33:57 +01:00
|
|
|
ActiveMenu->Bound.h = (numItems + 1) * 15 + 10;
|
2020-03-27 21:47:29 +01:00
|
|
|
|
2020-12-09 09:33:57 +01:00
|
|
|
ActiveItem[VisibleMenu] = &ActiveMenu->MenuItems[ActiveMenuItem];
|
|
|
|
}
|
2020-03-27 21:47:29 +01:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
// [D] [T]
|
2020-03-27 21:47:29 +01:00
|
|
|
void InitaliseMenu(PAUSEMODE mode)
|
|
|
|
{
|
2020-11-18 19:21:16 +01:00
|
|
|
MENU_HEADER* pNewMenu;
|
|
|
|
int i;
|
2020-05-12 06:00:32 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
for (i = 0; i < PAUSE_MENU_LEVELS; i++)
|
|
|
|
{
|
|
|
|
ActiveItem[i] = NULL;
|
|
|
|
VisibleMenus[i] = NULL;
|
|
|
|
}
|
2020-05-12 06:00:32 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
pNewMenu = NULL;
|
2020-05-12 06:00:32 +02:00
|
|
|
|
2020-04-05 22:04:37 +02:00
|
|
|
allownameentry = 0;
|
2020-05-12 06:00:32 +02:00
|
|
|
|
|
|
|
switch (mode)
|
|
|
|
{
|
2020-08-28 21:42:42 +02:00
|
|
|
case PAUSEMODE_PAUSE:
|
|
|
|
case PAUSEMODE_PAUSEP1:
|
|
|
|
case PAUSEMODE_PAUSEP2:
|
|
|
|
if (NumPlayers == 1 && gMultiplayerLevels == 0)
|
2020-05-12 06:00:32 +02:00
|
|
|
{
|
2020-08-28 21:42:42 +02:00
|
|
|
if (gInGameCutsceneActive == 0)
|
2020-11-18 19:21:16 +01:00
|
|
|
pNewMenu = &PauseMenuHeader;
|
2020-08-28 21:42:42 +02:00
|
|
|
else
|
2020-11-18 19:21:16 +01:00
|
|
|
pNewMenu = &CutscenePauseMenuHeader;
|
2020-04-05 22:04:37 +02:00
|
|
|
}
|
2020-05-12 06:00:32 +02:00
|
|
|
else
|
2020-11-18 19:21:16 +01:00
|
|
|
pNewMenu = &MultiplayerPauseHeader;
|
|
|
|
|
2020-08-28 21:42:42 +02:00
|
|
|
break;
|
|
|
|
case PAUSEMODE_GAMEOVER:
|
2020-05-12 06:00:32 +02:00
|
|
|
switch (GameType)
|
|
|
|
{
|
2020-08-28 21:42:42 +02:00
|
|
|
case GAME_PURSUIT:
|
2020-11-18 19:21:16 +01:00
|
|
|
pNewMenu = &ChaseGameFinishedHeader;
|
2020-05-12 06:00:32 +02:00
|
|
|
gMissionCompletionState = mode;
|
2020-11-18 19:21:16 +01:00
|
|
|
break;
|
2020-05-12 06:00:32 +02:00
|
|
|
case GAME_GETAWAY:
|
|
|
|
case GAME_CHECKPOINT:
|
2020-08-28 21:42:42 +02:00
|
|
|
if (NumPlayers == 1)
|
|
|
|
{
|
2020-11-18 19:21:16 +01:00
|
|
|
pNewMenu = &DrivingGameFinishedHeader;
|
2020-12-06 22:28:58 +01:00
|
|
|
gMissionCompletionState = mode;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pNewMenu = &MultiplayerFinishedHeader;
|
2020-08-28 21:42:42 +02:00
|
|
|
gMissionCompletionState = mode;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GAME_GATERACE:
|
2020-05-12 06:00:32 +02:00
|
|
|
case GAME_TRAILBLAZER:
|
|
|
|
case GAME_SURVIVAL:
|
2020-08-28 21:42:42 +02:00
|
|
|
if (NumPlayers == 1)
|
|
|
|
{
|
2020-11-18 19:21:16 +01:00
|
|
|
pNewMenu = &DrivingGameFinishedHeader;
|
2020-05-12 06:00:32 +02:00
|
|
|
gMissionCompletionState = mode;
|
2020-12-06 22:28:58 +01:00
|
|
|
allownameentry = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pNewMenu = &MultiplayerFinishedHeader;
|
|
|
|
gMissionCompletionState = mode;
|
2020-05-12 06:00:32 +02:00
|
|
|
}
|
2020-08-28 21:42:42 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (NumPlayers == 1)
|
2020-11-18 19:21:16 +01:00
|
|
|
{
|
|
|
|
pNewMenu = &TakeARideFinishedHeader;
|
|
|
|
gMissionCompletionState = mode;
|
|
|
|
}
|
2020-12-06 22:28:58 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
pNewMenu = &MultiplayerFinishedHeader;
|
|
|
|
gMissionCompletionState = mode;
|
|
|
|
}
|
2020-11-18 19:21:16 +01:00
|
|
|
break;
|
2020-04-05 22:04:37 +02:00
|
|
|
}
|
2020-08-28 21:42:42 +02:00
|
|
|
break;
|
|
|
|
case PAUSEMODE_COMPLETE:
|
2020-11-18 19:21:16 +01:00
|
|
|
|
|
|
|
switch (GameType)
|
2020-08-28 21:42:42 +02:00
|
|
|
{
|
2020-11-18 19:21:16 +01:00
|
|
|
case GAME_MISSION:
|
|
|
|
pNewMenu = &MissionCompleteHeader;
|
|
|
|
gMissionCompletionState = mode;
|
|
|
|
break;
|
|
|
|
case GAME_GETAWAY:
|
|
|
|
case GAME_GATERACE:
|
|
|
|
case GAME_CHECKPOINT:
|
|
|
|
case GAME_TRAILBLAZER:
|
|
|
|
case GAME_SURVIVAL:
|
|
|
|
case GAME_COPSANDROBBERS:
|
|
|
|
case GAME_CAPTURETHEFLAG:
|
|
|
|
if (NumPlayers == 1)
|
|
|
|
{
|
|
|
|
pNewMenu = &DrivingGameFinishedHeader;
|
2020-08-28 21:42:42 +02:00
|
|
|
gMissionCompletionState = mode;
|
2020-12-06 22:28:58 +01:00
|
|
|
allownameentry = 1;
|
2020-11-18 19:21:16 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pNewMenu = &MultiplayerFinishedHeader;
|
|
|
|
gMissionCompletionState = mode;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GAME_PURSUIT:
|
|
|
|
pNewMenu = &ChaseGameFinishedHeader;
|
|
|
|
gMissionCompletionState = mode;
|
|
|
|
break;
|
2020-12-06 22:28:58 +01:00
|
|
|
default:
|
|
|
|
if (NumPlayers == 1)
|
|
|
|
{
|
|
|
|
pNewMenu = &TakeARideFinishedHeader;
|
|
|
|
gMissionCompletionState = mode;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pNewMenu = &MultiplayerFinishedHeader;
|
|
|
|
gMissionCompletionState = mode;
|
|
|
|
}
|
|
|
|
break;
|
2020-04-05 22:04:37 +02:00
|
|
|
}
|
2020-08-28 21:42:42 +02:00
|
|
|
break;
|
|
|
|
case PAUSEMODE_PADERROR:
|
|
|
|
if (pad_connected < 0)
|
|
|
|
{
|
|
|
|
if (NumPlayers == 1)
|
2020-11-18 19:21:16 +01:00
|
|
|
pNewMenu = &InvalidPadHeader;
|
2020-08-28 21:42:42 +02:00
|
|
|
else
|
2020-11-18 19:21:16 +01:00
|
|
|
pNewMenu = &InvalidMultiPadHeader;
|
|
|
|
|
|
|
|
if (Pads[0].type == 1)
|
2020-12-22 12:46:42 +01:00
|
|
|
pNewMenu->Title = G_LTXT(GTXT_IncorrectController1);
|
2020-11-18 19:21:16 +01:00
|
|
|
else
|
2020-12-22 12:46:42 +01:00
|
|
|
pNewMenu->Title = G_LTXT(GTXT_IncorrectController2);
|
2020-04-05 22:04:37 +02:00
|
|
|
}
|
2020-08-28 21:42:42 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (NumPlayers == 1)
|
2020-11-18 19:21:16 +01:00
|
|
|
pNewMenu = &NoPadHeader;
|
2020-08-28 21:42:42 +02:00
|
|
|
else
|
2020-11-18 19:21:16 +01:00
|
|
|
pNewMenu = &NoMultiPadHeader;
|
|
|
|
|
|
|
|
if (Pads[0].type == 0)
|
2020-12-22 12:46:42 +01:00
|
|
|
pNewMenu->Title = G_LTXT(GTXT_InsertController1);
|
2020-11-18 19:21:16 +01:00
|
|
|
else
|
2020-12-22 12:46:42 +01:00
|
|
|
pNewMenu->Title = G_LTXT(GTXT_InsertController2);
|
2020-04-05 22:04:37 +02:00
|
|
|
}
|
2020-11-18 19:21:16 +01:00
|
|
|
break;
|
2020-04-05 22:04:37 +02:00
|
|
|
}
|
2020-04-11 23:02:26 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
// [A]
|
|
|
|
if(pNewMenu)
|
2020-04-11 23:02:26 +02:00
|
|
|
{
|
2020-11-18 19:21:16 +01:00
|
|
|
VisibleMenu = 0;
|
2020-12-06 22:28:58 +01:00
|
|
|
VisibleMenus[VisibleMenu] = pNewMenu;
|
|
|
|
|
2021-02-23 07:26:36 +01:00
|
|
|
if (NoPlayerControl == 0 && OnScoreTable(NULL) != -1 && allownameentry)
|
|
|
|
{
|
|
|
|
gScoreEntered = 0;
|
|
|
|
|
|
|
|
sprintf(EnterScoreText, G_LTXT(GTXT_EnterScore));
|
|
|
|
sprintf(EnterNameText, G_LTXT(GTXT_EnterName));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gScoreEntered = 1;
|
|
|
|
|
|
|
|
sprintf(EnterScoreText, G_LTXT(GTXT_ViewTable));
|
|
|
|
sprintf(EnterNameText, G_LTXT(GTXT_HighScores));
|
|
|
|
}
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
SetupMenu(pNewMenu, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
printError("pNewMenu is NULL!\n");
|
2020-04-05 22:04:37 +02:00
|
|
|
}
|
2020-03-27 21:47:29 +01:00
|
|
|
}
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
// [D] [T]
|
2020-03-27 21:47:29 +01:00
|
|
|
void DrawVisibleMenus(void)
|
|
|
|
{
|
2020-11-18 19:21:16 +01:00
|
|
|
int width;
|
|
|
|
int itemXpos;
|
2020-04-11 23:02:26 +02:00
|
|
|
POLY_FT3 *null;
|
|
|
|
POLY_F4 *poly;
|
2020-11-18 19:21:16 +01:00
|
|
|
MENU_ITEM *pItem;
|
|
|
|
MENU_HEADER *pActive;
|
|
|
|
int r, b;
|
2020-04-11 23:02:26 +02:00
|
|
|
int i;
|
2020-11-18 19:21:16 +01:00
|
|
|
int xpos, ypos;
|
|
|
|
int menuWidth;
|
|
|
|
|
|
|
|
int x1, x2, y1, y2;
|
|
|
|
static int maxPercentageWidth = StringWidth(" 100");
|
2020-04-05 22:04:37 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
if (NumPlayers > 1)
|
|
|
|
{
|
2020-04-05 22:04:37 +02:00
|
|
|
SetFullscreenDrawing();
|
|
|
|
}
|
2020-11-18 19:21:16 +01:00
|
|
|
|
|
|
|
pActive = VisibleMenus[VisibleMenu];
|
|
|
|
|
|
|
|
xpos = pActive->Bound.x;
|
|
|
|
ypos = pActive->Bound.y;
|
|
|
|
menuWidth = pActive->Bound.w;
|
|
|
|
|
|
|
|
if (pActive->Title)
|
|
|
|
{
|
2020-12-22 12:46:42 +01:00
|
|
|
OutputString(GET_GAME_TXT(pActive->Title), 2, xpos, ypos, menuWidth, 128, 32, 32);
|
2020-11-18 19:21:16 +01:00
|
|
|
|
|
|
|
ypos += 15;
|
2020-04-05 22:04:37 +02:00
|
|
|
}
|
2020-04-11 23:02:26 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
// show all menu items
|
|
|
|
for (i = 0; i < pActive->NumItems; i++)
|
|
|
|
{
|
|
|
|
pItem = &pActive->MenuItems[i];
|
2020-04-11 23:02:26 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
if (!pItem->Text)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (pItem == ActiveItem[VisibleMenu])
|
|
|
|
{
|
|
|
|
r = 0;
|
|
|
|
b = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
b = 128;
|
|
|
|
r = 128;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(pItem->Type & (PAUSE_TYPE_SFXVOLUME | PAUSE_TYPE_MUSICVOLUME))
|
|
|
|
{
|
2020-12-22 12:46:42 +01:00
|
|
|
width = StringWidth(GET_GAME_TXT(pItem->Text));
|
2020-11-18 19:21:16 +01:00
|
|
|
|
|
|
|
itemXpos = xpos + ((menuWidth - width) - maxPercentageWidth) / 2;
|
|
|
|
|
2020-12-22 12:46:42 +01:00
|
|
|
OutputString(GET_GAME_TXT(pItem->Text), 1, itemXpos, ypos, menuWidth, r, 128, b);
|
2020-11-18 19:21:16 +01:00
|
|
|
|
|
|
|
if (pItem->Type & PAUSE_TYPE_SFXVOLUME)
|
|
|
|
OutputString(SfxVolumeText, 1, itemXpos + width + 10, ypos, menuWidth, r, 128, b);
|
|
|
|
else if (pItem->Type & PAUSE_TYPE_MUSICVOLUME)
|
|
|
|
OutputString(MusicVolumeText, 1, itemXpos + width + 10, ypos, menuWidth, r, 128, b);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-12-22 12:46:42 +01:00
|
|
|
OutputString(GET_GAME_TXT(pItem->Text), pItem->Justify, xpos, ypos, menuWidth, r, 128, b);
|
2020-11-18 19:21:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ypos += 15;
|
2020-04-11 23:02:26 +02:00
|
|
|
}
|
2020-11-18 19:21:16 +01:00
|
|
|
|
|
|
|
poly = (POLY_F4*)current->primptr;
|
|
|
|
|
|
|
|
ypos = pActive->Bound.y;
|
2020-04-11 23:24:54 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
setPolyF4(poly);
|
|
|
|
x1 = xpos - 5;
|
|
|
|
x2 = xpos + menuWidth + 5;
|
|
|
|
|
|
|
|
y1 = ypos - 5;
|
|
|
|
y2 = ypos + pActive->Bound.h;
|
|
|
|
|
|
|
|
poly->x0 = x1;
|
|
|
|
poly->x1 = x2;
|
|
|
|
poly->y0 = y1;
|
|
|
|
poly->x2 = x1;
|
|
|
|
|
|
|
|
poly->y1 = y1;
|
|
|
|
poly->y2 = y2;
|
|
|
|
|
|
|
|
poly->x3 = x2;
|
|
|
|
poly->y3 = y2;
|
|
|
|
|
|
|
|
poly->r0 = 16;
|
|
|
|
poly->g0 = 16;
|
|
|
|
poly->b0 = 16;
|
|
|
|
|
|
|
|
setSemiTrans(poly, 1);
|
|
|
|
|
|
|
|
addPrim(current->ot, poly);
|
|
|
|
current->primptr += sizeof(POLY_F4);
|
|
|
|
|
2020-04-11 23:02:26 +02:00
|
|
|
null = (POLY_FT3 *)current->primptr;
|
|
|
|
setPolyFT3(null);
|
|
|
|
null->x0 = -1;
|
|
|
|
null->y0 = -1;
|
|
|
|
null->x1 = -1;
|
|
|
|
null->y1 = -1;
|
|
|
|
null->x2 = -1;
|
|
|
|
null->y2 = -1;
|
|
|
|
null->tpage = 0;
|
|
|
|
|
|
|
|
addPrim(current->ot, null);
|
|
|
|
|
|
|
|
current->primptr += sizeof(POLY_FT3);
|
2020-03-27 21:47:29 +01:00
|
|
|
}
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
// [D] [T]
|
2020-03-27 21:47:29 +01:00
|
|
|
void ControlMenu(void)
|
|
|
|
{
|
2020-11-18 19:21:16 +01:00
|
|
|
static int controlmenu_debounce = 0;
|
|
|
|
MENU_ITEM* pItem;
|
|
|
|
int i;
|
|
|
|
ushort paddata;
|
|
|
|
MENU_HEADER* menu;
|
|
|
|
ushort paddirect;
|
|
|
|
int doit;
|
|
|
|
|
|
|
|
if (playerwithcontrol[2] == 0)
|
2020-07-05 18:32:12 +02:00
|
|
|
{
|
2020-11-18 19:21:16 +01:00
|
|
|
paddata = Pads[1].dirnew;
|
|
|
|
paddirect = Pads[1].direct;
|
2020-07-05 18:32:12 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
if (playerwithcontrol[0])
|
2020-07-05 18:32:12 +02:00
|
|
|
{
|
2020-11-18 19:21:16 +01:00
|
|
|
paddata = Pads[0].dirnew;
|
|
|
|
paddirect = Pads[0].direct;
|
2020-04-05 22:04:37 +02:00
|
|
|
}
|
|
|
|
}
|
2020-11-18 19:21:16 +01:00
|
|
|
else
|
2020-07-05 18:32:12 +02:00
|
|
|
{
|
2020-11-18 19:21:16 +01:00
|
|
|
paddata = Pads[0].dirnew;
|
|
|
|
paddirect = Pads[0].direct;
|
|
|
|
|
|
|
|
if (NumPlayers == 2)
|
2020-07-05 18:32:12 +02:00
|
|
|
{
|
2020-11-18 19:21:16 +01:00
|
|
|
paddata = Pads[1].dirnew | Pads[0].dirnew;
|
|
|
|
paddirect = Pads[1].direct | Pads[0].direct;
|
2020-04-05 22:04:37 +02:00
|
|
|
}
|
|
|
|
}
|
2020-07-05 18:32:12 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
// toggle map off
|
|
|
|
if (gShowMap)
|
2020-07-05 18:32:12 +02:00
|
|
|
{
|
2022-01-03 10:59:26 +01:00
|
|
|
if (paddata & (MPAD_CROSS | MPAD_TRIANGLE))
|
2020-11-18 19:21:16 +01:00
|
|
|
PauseMap(0);
|
2020-07-05 18:32:12 +02:00
|
|
|
|
2020-04-05 22:04:37 +02:00
|
|
|
return;
|
|
|
|
}
|
2020-04-12 15:04:54 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
pItem = ActiveItem[VisibleMenu];
|
2020-04-12 15:04:54 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
if ((paddirect & 0xA000) && (pItem->Type & PAUSE_TYPE_DIRFUNC))
|
2020-04-12 15:04:54 +02:00
|
|
|
{
|
2020-11-18 19:21:16 +01:00
|
|
|
doit = 0;
|
2020-07-05 18:32:12 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
if (controlmenu_debounce == 0)
|
2020-04-12 15:04:54 +02:00
|
|
|
{
|
2020-11-18 19:21:16 +01:00
|
|
|
doit = 1;
|
|
|
|
controlmenu_debounce = 10;
|
2020-04-05 22:04:37 +02:00
|
|
|
}
|
2020-11-18 19:21:16 +01:00
|
|
|
else
|
2020-07-05 18:32:12 +02:00
|
|
|
{
|
2020-11-18 19:21:16 +01:00
|
|
|
controlmenu_debounce--;
|
2020-07-05 18:32:12 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
if (controlmenu_debounce == 0)
|
2020-04-12 15:04:54 +02:00
|
|
|
{
|
2020-11-18 19:21:16 +01:00
|
|
|
doit = 1;
|
|
|
|
controlmenu_debounce = 2;
|
2020-04-05 22:04:37 +02:00
|
|
|
}
|
|
|
|
}
|
2020-07-05 18:32:12 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
if (doit)
|
|
|
|
{
|
|
|
|
// left/right
|
|
|
|
(*pItem->func)((paddirect & 0x8000) ? -1 : 1);
|
2020-04-05 22:04:37 +02:00
|
|
|
}
|
2020-11-18 19:21:16 +01:00
|
|
|
|
2020-04-05 22:04:37 +02:00
|
|
|
return;
|
|
|
|
}
|
2020-04-12 15:04:54 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
controlmenu_debounce = 0;
|
|
|
|
|
2020-11-24 10:14:48 +01:00
|
|
|
#ifndef PSX
|
|
|
|
// Pause fix for PC mapping
|
2022-01-03 10:59:26 +01:00
|
|
|
if ((paddata & MPAD_TRIANGLE) && paddata & (MPAD_D_UP | MPAD_D_DOWN))
|
2020-11-24 10:14:48 +01:00
|
|
|
{
|
|
|
|
paddata = 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2022-01-03 10:59:26 +01:00
|
|
|
if (paddata & MPAD_D_UP)
|
2020-04-12 15:04:54 +02:00
|
|
|
{
|
2020-11-18 19:21:16 +01:00
|
|
|
// go up
|
|
|
|
ActiveMenuItem--;
|
|
|
|
|
|
|
|
if (ActiveMenuItem < 0)
|
|
|
|
ActiveMenuItem = ActiveMenu->NumItems - 1;
|
|
|
|
|
|
|
|
ActiveItem[VisibleMenu] = &ActiveMenu->MenuItems[ActiveMenuItem];
|
2020-04-05 22:04:37 +02:00
|
|
|
}
|
2022-01-03 10:59:26 +01:00
|
|
|
else if (paddata & MPAD_D_DOWN)
|
2020-04-12 15:04:54 +02:00
|
|
|
{
|
2020-11-18 19:21:16 +01:00
|
|
|
// go down
|
|
|
|
ActiveMenuItem++;
|
|
|
|
|
|
|
|
if (ActiveMenuItem > ActiveMenu->NumItems - 1)
|
|
|
|
ActiveMenuItem = 0;
|
2020-07-05 18:32:12 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
ActiveItem[VisibleMenu] = &ActiveMenu->MenuItems[ActiveMenuItem];
|
2020-04-05 22:04:37 +02:00
|
|
|
}
|
2022-01-03 10:59:26 +01:00
|
|
|
else if (paddata & MPAD_CROSS)
|
2020-11-18 19:21:16 +01:00
|
|
|
{
|
|
|
|
// Enter submenu
|
|
|
|
if (pItem->Type & PAUSE_TYPE_SUBMENU)
|
|
|
|
{
|
|
|
|
menu = pItem->SubMenu;
|
|
|
|
|
|
|
|
VisibleMenu++;
|
|
|
|
VisibleMenus[VisibleMenu] = menu;
|
|
|
|
|
|
|
|
SetupMenu(menu, 0);
|
|
|
|
return;
|
|
|
|
}
|
2020-04-12 15:04:54 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
// function flag
|
|
|
|
if (pItem->Type & PAUSE_TYPE_FUNC)
|
|
|
|
(*pItem->func)(0);
|
|
|
|
|
|
|
|
if (pItem->ExitValue == MENU_QUIT_NONE)
|
|
|
|
return;
|
2020-04-12 15:04:54 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
if (pItem->ExitValue == MENU_QUIT_BACKMENU)
|
|
|
|
{
|
|
|
|
VisibleMenu--; // go back in menu stack
|
|
|
|
SetupMenu(VisibleMenus[VisibleMenu], 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
PauseReturnValue = pItem->ExitValue;
|
|
|
|
}
|
2022-01-03 10:59:26 +01:00
|
|
|
else if ((paddata & MPAD_TRIANGLE) || (paddata & MPAD_START)) // Triangle or Start
|
2020-04-12 15:04:54 +02:00
|
|
|
{
|
2020-11-18 19:21:16 +01:00
|
|
|
// continue game if needed
|
2020-11-24 10:14:48 +01:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
if (VisibleMenu == 0)
|
2020-04-12 15:04:54 +02:00
|
|
|
{
|
2020-11-24 10:14:48 +01:00
|
|
|
#ifndef PSX
|
|
|
|
// hack for keyboard swap
|
2022-01-03 10:59:26 +01:00
|
|
|
if(!(paddata & MPAD_START))
|
2020-11-24 10:14:48 +01:00
|
|
|
return;
|
|
|
|
#endif
|
2020-11-18 19:21:16 +01:00
|
|
|
for (i = 0; i < ActiveMenu->NumItems; i++)
|
|
|
|
{
|
|
|
|
pItem = &ActiveMenu->MenuItems[i];
|
|
|
|
|
|
|
|
if (pItem->ExitValue == MENU_QUIT_CONTINUE)
|
|
|
|
{
|
|
|
|
PauseReturnValue = pItem->ExitValue;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2020-04-05 22:04:37 +02:00
|
|
|
}
|
2020-11-18 19:21:16 +01:00
|
|
|
else
|
2020-04-12 15:04:54 +02:00
|
|
|
{
|
2020-11-18 19:21:16 +01:00
|
|
|
// only triangle
|
|
|
|
if(paddata & 0x10)
|
|
|
|
{
|
|
|
|
VisibleMenu--;
|
|
|
|
SetupMenu(VisibleMenus[VisibleMenu], 1);
|
|
|
|
}
|
2020-04-05 22:04:37 +02:00
|
|
|
}
|
|
|
|
}
|
2020-03-27 21:47:29 +01:00
|
|
|
}
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
// [D] [T]
|
2020-03-27 21:47:29 +01:00
|
|
|
void PauseMap(int direction)
|
|
|
|
{
|
2020-05-30 11:53:05 +02:00
|
|
|
gShowMap ^= 1;
|
|
|
|
|
2020-04-05 22:04:37 +02:00
|
|
|
ReadControllers();
|
2020-05-30 11:53:05 +02:00
|
|
|
|
2020-04-05 22:04:37 +02:00
|
|
|
map_x_shift = 0;
|
|
|
|
map_z_shift = 0;
|
2020-05-30 11:53:05 +02:00
|
|
|
|
|
|
|
if (gShowMap == 0)
|
2020-04-05 22:04:37 +02:00
|
|
|
InitOverheadMap();
|
2020-03-27 21:47:29 +01:00
|
|
|
}
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
// [D] [T]
|
2020-03-27 21:47:29 +01:00
|
|
|
void SfxVolume(int direction)
|
|
|
|
{
|
2020-04-12 15:26:17 +02:00
|
|
|
if (direction < 0)
|
2020-04-05 22:04:37 +02:00
|
|
|
gMasterVolume = gMasterVolume + -100;
|
2020-04-12 15:26:17 +02:00
|
|
|
else if (0 < direction)
|
|
|
|
gMasterVolume = gMasterVolume + 100;
|
|
|
|
|
|
|
|
if (gMasterVolume < -10000)
|
2020-04-05 22:04:37 +02:00
|
|
|
gMasterVolume = -10000;
|
2020-04-12 15:26:17 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
if (gMasterVolume > 0)
|
2020-04-05 22:04:37 +02:00
|
|
|
gMasterVolume = 0;
|
2020-04-12 15:26:17 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
sprintf(SfxVolumeText, "%d", (10000 + gMasterVolume) / 100);
|
2020-04-12 15:26:17 +02:00
|
|
|
|
2020-04-05 22:04:37 +02:00
|
|
|
SetMasterVolume(gMasterVolume);
|
2020-03-27 21:47:29 +01:00
|
|
|
}
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
// [D] [T]
|
2020-03-27 21:47:29 +01:00
|
|
|
void MusicVolume(int direction)
|
|
|
|
{
|
2020-04-12 15:26:17 +02:00
|
|
|
if (direction < 0)
|
2020-04-05 22:04:37 +02:00
|
|
|
gMusicVolume = gMusicVolume + -100;
|
2020-04-12 15:26:17 +02:00
|
|
|
else if (0 < direction)
|
|
|
|
gMusicVolume = gMusicVolume + 100;
|
|
|
|
|
|
|
|
if (gMusicVolume < -10000)
|
2020-04-05 22:04:37 +02:00
|
|
|
gMusicVolume = -10000;
|
2020-04-12 15:26:17 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
if (gMusicVolume > 0)
|
2020-04-05 22:04:37 +02:00
|
|
|
gMusicVolume = 0;
|
2020-04-12 15:26:17 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
sprintf(MusicVolumeText, "%d", (10000 + gMusicVolume) / 100);
|
2020-04-12 15:26:17 +02:00
|
|
|
|
2020-04-05 22:04:37 +02:00
|
|
|
SetXMVolume(gMusicVolume);
|
2020-03-27 21:47:29 +01:00
|
|
|
}
|
|
|
|
|
2021-02-25 20:35:18 +01:00
|
|
|
// [D] [T]
|
|
|
|
void EnterScoreName(void)
|
|
|
|
{
|
|
|
|
u_char chr;
|
|
|
|
char* username;
|
|
|
|
char* enteredName;
|
|
|
|
|
|
|
|
SCORE_ENTRY* table;
|
|
|
|
unsigned short npad, dpad;
|
|
|
|
|
|
|
|
username = NULL;
|
|
|
|
|
|
|
|
if (!gScoreEntered)
|
|
|
|
{
|
|
|
|
gScorePosition = OnScoreTable(&table);
|
|
|
|
|
|
|
|
if (gScorePosition != -1)
|
|
|
|
username = ScoreName[gScorePosition];
|
|
|
|
|
|
|
|
CreateScoreNames(table, &gPlayerScore, gScorePosition);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gScorePosition = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
gEnteringScore = 1;
|
|
|
|
|
|
|
|
enteredName = WaitForTextEntry(username, SCORE_NAME_LEN);
|
|
|
|
|
|
|
|
if (enteredName && username)
|
|
|
|
{
|
|
|
|
strcpy(gPlayerScore.name, enteredName);
|
|
|
|
|
|
|
|
AddScoreToTable(table, gScorePosition);
|
|
|
|
|
|
|
|
sprintf(EnterScoreText, G_LTXT(GTXT_ViewTable));
|
|
|
|
sprintf(EnterNameText, G_LTXT(GTXT_HighScores));
|
|
|
|
|
|
|
|
gScoreEntered = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
gEnteringScore = 0;
|
2020-03-27 21:47:29 +01:00
|
|
|
}
|
|
|
|
|
2021-02-25 21:16:45 +01:00
|
|
|
void DisplayMenuMessage(char* header, char* text)
|
|
|
|
{
|
|
|
|
POLY_FT3* null;
|
|
|
|
POLY_F4* prim;
|
|
|
|
int i;
|
|
|
|
int ypos;
|
|
|
|
|
|
|
|
OutputString(header, 2, 160, 105, 0, 128, 32, 32);
|
|
|
|
ypos = 125;
|
|
|
|
OutputString(text, 2, 160, ypos, 0, 128, 128, 128);
|
|
|
|
|
|
|
|
// TODO: Multiline support
|
|
|
|
/*
|
|
|
|
i = 0;
|
|
|
|
do {
|
|
|
|
OutputString(text, 2, 160, ypos, 0, 128, 128, 128);
|
|
|
|
|
|
|
|
ypos += 15;
|
|
|
|
|
|
|
|
i++;
|
|
|
|
} while (i < 5);
|
|
|
|
*/
|
|
|
|
prim = (POLY_F4*)current->primptr;
|
|
|
|
setPolyF4(prim);
|
|
|
|
setSemiTrans(prim, 1);
|
|
|
|
setShadeTex(prim, 1);
|
|
|
|
|
|
|
|
prim->y0 = 100;
|
|
|
|
prim->y1 = 100;
|
|
|
|
prim->y2 = 160;
|
|
|
|
prim->y3 = 160;
|
|
|
|
prim->x0 = 80;
|
|
|
|
prim->x1 = 240;
|
|
|
|
prim->x2 = 80;
|
|
|
|
prim->x3 = 240;
|
|
|
|
|
|
|
|
prim->r0 = 16;
|
|
|
|
prim->g0 = 16;
|
|
|
|
prim->b0 = 16;
|
|
|
|
|
|
|
|
addPrim(current->ot, prim);
|
|
|
|
current->primptr += sizeof(POLY_F4);
|
|
|
|
|
|
|
|
null = (POLY_FT3*)current->primptr;
|
|
|
|
setPolyFT3(null);
|
|
|
|
|
|
|
|
null->x0 = -1;
|
|
|
|
null->y0 = -1;
|
|
|
|
null->x1 = -1;
|
|
|
|
null->y1 = -1;
|
|
|
|
null->x2 = -1;
|
|
|
|
null->y2 = -1;
|
|
|
|
null->tpage = 0;
|
|
|
|
|
|
|
|
addPrim(current->ot, null);
|
|
|
|
current->primptr += sizeof(POLY_FT3);
|
|
|
|
}
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
// [D] [T]
|
2020-03-27 21:47:29 +01:00
|
|
|
void DrawHighScoreMenu(int selection)
|
|
|
|
{
|
2020-08-28 21:42:42 +02:00
|
|
|
POLY_FT3* null;
|
|
|
|
POLY_F4* prim;
|
2020-11-18 19:21:16 +01:00
|
|
|
int i;
|
2021-02-25 21:16:45 +01:00
|
|
|
int r,b;
|
2020-11-18 19:21:16 +01:00
|
|
|
int ypos;
|
2020-08-28 21:42:42 +02:00
|
|
|
char text[8];
|
2020-04-05 22:04:37 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
OutputString(EnterNameText, 2, 160, 70, 0, 128, 32, 32);
|
2020-12-22 12:46:42 +01:00
|
|
|
OutputString(G_LTXT(GTXT_Name), 1, 40, 90, 0, 128, 128, 32);
|
|
|
|
OutputString(G_LTXT(GTXT_Time), 4, 280, 90, 0, 128, 128, 32);
|
2020-11-18 19:21:16 +01:00
|
|
|
|
|
|
|
ypos = 110;
|
|
|
|
|
|
|
|
i = 0;
|
2020-04-05 22:04:37 +02:00
|
|
|
do {
|
2020-11-18 19:21:16 +01:00
|
|
|
|
|
|
|
if (i == selection)
|
2020-08-28 21:42:42 +02:00
|
|
|
{
|
2020-04-05 22:04:37 +02:00
|
|
|
r = 0;
|
|
|
|
b = 0;
|
|
|
|
}
|
2020-08-28 21:42:42 +02:00
|
|
|
else
|
|
|
|
{
|
2020-11-18 19:21:16 +01:00
|
|
|
r = 128;
|
|
|
|
b = 128;
|
2020-04-05 22:04:37 +02:00
|
|
|
}
|
2020-08-28 21:42:42 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
sprintf(text, "%d", i+1);
|
2020-08-28 21:42:42 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
OutputString(text, 1, 40, ypos, 0, r, 128, b);
|
2020-08-28 21:42:42 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
OutputString(ScoreName[i], 1, 60, ypos, 0, r, 128, b);
|
|
|
|
OutputString(ScoreItems[i], 4, 220, ypos, 0, r, 128, b);
|
|
|
|
OutputString(ScoreTime[i], 4, 280, ypos, 0, r, 128, b);
|
2020-08-28 21:42:42 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
ypos += 15;
|
2020-08-28 21:42:42 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
i++;
|
|
|
|
} while (i < 5);
|
2020-08-28 21:42:42 +02:00
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
prim = (POLY_F4*)current->primptr;
|
|
|
|
setPolyF4(prim);
|
|
|
|
setSemiTrans(prim, 1);
|
|
|
|
setShadeTex(prim, 1);
|
|
|
|
|
|
|
|
prim->y0 = 65;
|
|
|
|
prim->y1 = 65;
|
|
|
|
prim->y2 = 197;
|
|
|
|
prim->y3 = 197;
|
|
|
|
prim->x0 = 26;
|
|
|
|
prim->x1 = 294;
|
|
|
|
prim->x2 = 26;
|
|
|
|
prim->x3 = 294;
|
|
|
|
|
|
|
|
prim->r0 = 16;
|
|
|
|
prim->g0 = 16;
|
|
|
|
prim->b0 = 16;
|
|
|
|
|
|
|
|
addPrim(current->ot, prim);
|
|
|
|
current->primptr += sizeof(POLY_F4);
|
|
|
|
|
|
|
|
null = (POLY_FT3*)current->primptr;
|
2020-08-28 21:42:42 +02:00
|
|
|
setPolyFT3(null);
|
|
|
|
|
|
|
|
null->x0 = -1;
|
|
|
|
null->y0 = -1;
|
|
|
|
null->x1 = -1;
|
|
|
|
null->y1 = -1;
|
|
|
|
null->x2 = -1;
|
|
|
|
null->y2 = -1;
|
|
|
|
null->tpage = 0;
|
|
|
|
|
|
|
|
addPrim(current->ot, null);
|
|
|
|
current->primptr += sizeof(POLY_FT3);
|
2020-03-27 21:47:29 +01:00
|
|
|
}
|
|
|
|
|
2021-04-18 21:52:27 +02:00
|
|
|
int mytolower(int ch)
|
|
|
|
{
|
|
|
|
if (ch >= 'A' && ch <= 'Z')
|
|
|
|
return ('a' + ch - 'A');
|
|
|
|
else
|
|
|
|
return ch;
|
|
|
|
}
|
|
|
|
|
2021-01-20 18:50:52 +01:00
|
|
|
void strlower(char* str)
|
|
|
|
{
|
|
|
|
while (*str != '\0')
|
|
|
|
{
|
2021-04-18 21:52:27 +02:00
|
|
|
*str = mytolower(*str);
|
2021-01-20 18:50:52 +01:00
|
|
|
str++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
// [D] [T]
|
2020-08-28 21:42:42 +02:00
|
|
|
void CreateScoreNames(SCORE_ENTRY* table, PLAYER_SCORE* score, int position)
|
|
|
|
{
|
|
|
|
int time;
|
|
|
|
char* text;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
switch (GameType)
|
|
|
|
{
|
|
|
|
case GAME_PURSUIT:
|
|
|
|
case GAME_GETAWAY:
|
|
|
|
case GAME_CHECKPOINT:
|
|
|
|
case GAME_SURVIVAL:
|
|
|
|
text = NULL;
|
|
|
|
break;
|
|
|
|
case GAME_GATERACE:
|
2021-01-20 18:50:52 +01:00
|
|
|
text = G_LTXT(GTXT_Gates);
|
2020-08-28 21:42:42 +02:00
|
|
|
break;
|
|
|
|
case GAME_TRAILBLAZER:
|
2021-01-20 18:50:52 +01:00
|
|
|
text = G_LTXT(GTXT_Cones);
|
2020-08-28 21:42:42 +02:00
|
|
|
break;
|
|
|
|
default:
|
2020-12-12 08:39:44 +01:00
|
|
|
printError("CreateScoreNames: Invalid game type\n");
|
2020-08-28 21:42:42 +02:00
|
|
|
return;
|
|
|
|
}
|
2020-03-27 21:47:29 +01:00
|
|
|
|
2020-08-28 21:42:42 +02:00
|
|
|
i = 0;
|
|
|
|
do {
|
|
|
|
if (i == position)
|
|
|
|
{
|
|
|
|
time = score->time;
|
|
|
|
if (time == -1)
|
|
|
|
sprintf(ScoreTime[i], "-:--.--");
|
|
|
|
else
|
|
|
|
sprintf(ScoreTime[i], "%d:%02d.%02d", time / 180000, time / 3000 + (time / 180000) * -0x3c, (time % 3000) / 0x1e);
|
|
|
|
|
|
|
|
ScoreItems[i][0] = '\0';
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
if (text != NULL && score->items != -1)
|
2021-01-20 18:50:52 +01:00
|
|
|
{
|
2020-08-28 21:42:42 +02:00
|
|
|
sprintf(ScoreItems[i], "%d %s", score->items, text);
|
2021-01-20 18:50:52 +01:00
|
|
|
strlower(ScoreItems[i]);
|
|
|
|
}
|
2020-08-28 21:42:42 +02:00
|
|
|
|
|
|
|
ClearMem(ScoreName[i], 7);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
time = table->time;
|
|
|
|
|
|
|
|
if (time == -1)
|
|
|
|
sprintf(ScoreTime[i], "-:--.--");
|
|
|
|
else
|
|
|
|
sprintf(ScoreTime[i], "%d:%02d.%02d", time / 180000, time / 3000 + (time / 180000) * -0x3c, (time % 3000) / 0x1e);
|
|
|
|
|
|
|
|
ScoreItems[i][0] = '\0';
|
|
|
|
|
2020-11-18 19:21:16 +01:00
|
|
|
if (text != NULL && table->items != -1)
|
2021-01-20 18:50:52 +01:00
|
|
|
{
|
2020-08-28 21:42:42 +02:00
|
|
|
sprintf(ScoreItems[i], "%d %s", table->items, text);
|
2021-01-20 18:50:52 +01:00
|
|
|
strlower(ScoreItems[i]);
|
|
|
|
}
|
2020-08-28 21:42:42 +02:00
|
|
|
|
2021-01-20 18:50:52 +01:00
|
|
|
sprintf(ScoreName[i], "%s", table->name);
|
|
|
|
table++;
|
2020-08-28 21:42:42 +02:00
|
|
|
}
|
2020-03-27 21:47:29 +01:00
|
|
|
|
2020-08-28 21:42:42 +02:00
|
|
|
i++;
|
|
|
|
} while (i < 5);
|
2020-03-27 21:47:29 +01:00
|
|
|
|
2020-12-09 09:33:57 +01:00
|
|
|
}
|
|
|
|
|
2021-04-14 21:02:24 +02:00
|
|
|
// [A]
|
|
|
|
int UpdatePauseMenu(PAUSEMODE mode)
|
2020-12-09 09:33:57 +01:00
|
|
|
{
|
|
|
|
PAUSEMODE passed_mode;
|
2021-04-14 21:02:24 +02:00
|
|
|
passed_mode = mode;
|
|
|
|
|
|
|
|
if (mode == PAUSEMODE_PADERROR)
|
|
|
|
mode = PAUSEMODE_PAUSE;
|
2021-05-15 21:58:40 +02:00
|
|
|
|
2021-04-14 21:02:24 +02:00
|
|
|
if (passed_mode == PAUSEMODE_PADERROR)
|
|
|
|
{
|
|
|
|
if (pad_connected == 1)
|
|
|
|
InitaliseMenu(mode);
|
|
|
|
else
|
|
|
|
InitaliseMenu(PAUSEMODE_PADERROR);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (pad_connected != 1)
|
|
|
|
InitaliseMenu(PAUSEMODE_PADERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pad_connected < 1)
|
|
|
|
playerwithcontrol[2] = 1;
|
2020-12-09 09:33:57 +01:00
|
|
|
|
2021-04-14 21:02:24 +02:00
|
|
|
ControlMenu();
|
|
|
|
|
|
|
|
if (PauseReturnValue != 0)
|
|
|
|
gDrawPauseMenus = 0;
|
|
|
|
|
|
|
|
return PauseReturnValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// [D] [T]
|
|
|
|
void ShowPauseMenu(PAUSEMODE mode)
|
|
|
|
{
|
2020-12-09 09:33:57 +01:00
|
|
|
ReadControllers();
|
|
|
|
|
|
|
|
if (mode == PAUSEMODE_PAUSEP1)
|
|
|
|
{
|
|
|
|
playerwithcontrol[0] = 1;
|
|
|
|
playerwithcontrol[1] = 0;
|
|
|
|
playerwithcontrol[2] = 0;
|
|
|
|
}
|
|
|
|
else if (mode == PAUSEMODE_PAUSEP2)
|
|
|
|
{
|
|
|
|
playerwithcontrol[0] = 0;
|
|
|
|
playerwithcontrol[1] = 1;
|
|
|
|
playerwithcontrol[2] = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
playerwithcontrol[0] = 0;
|
|
|
|
playerwithcontrol[1] = 0;
|
|
|
|
playerwithcontrol[2] = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetDispMask(1);
|
|
|
|
|
|
|
|
SfxVolume(0);
|
|
|
|
MusicVolume(0);
|
|
|
|
|
|
|
|
StopPadVibration(0);
|
|
|
|
StopPadVibration(1);
|
|
|
|
|
|
|
|
InitaliseMenu(mode);
|
|
|
|
gDrawPauseMenus = 1;
|
2021-04-14 21:02:24 +02:00
|
|
|
|
2020-12-09 09:33:57 +01:00
|
|
|
PauseReturnValue = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// [D] [T]
|
|
|
|
void DrawPauseMenus(void)
|
|
|
|
{
|
2021-02-25 21:16:45 +01:00
|
|
|
int displayMessage;
|
|
|
|
|
2020-12-09 09:33:57 +01:00
|
|
|
#if !defined(PSX) && defined(DEBUG_OPTIONS)
|
|
|
|
extern int g_FreeCameraEnabled;
|
|
|
|
|
|
|
|
if (g_FreeCameraEnabled)
|
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
|
2021-02-25 21:16:45 +01:00
|
|
|
displayMessage = gDisplayedMessage.show == -1 || gDisplayedMessage.show > 0;
|
|
|
|
|
|
|
|
if ((gDrawPauseMenus || displayMessage) && gShowMap == 0)
|
2020-12-09 09:33:57 +01:00
|
|
|
{
|
2021-02-25 21:16:45 +01:00
|
|
|
if (displayMessage)
|
|
|
|
{
|
|
|
|
DisplayMenuMessage(gDisplayedMessage.header, gDisplayedMessage.text);
|
|
|
|
|
|
|
|
if(gDisplayedMessage.show > 0)
|
|
|
|
gDisplayedMessage.show--;
|
|
|
|
}
|
|
|
|
else if (gEnteringScore)
|
2020-12-09 09:33:57 +01:00
|
|
|
DrawHighScoreMenu(gScorePosition);
|
2021-02-25 20:35:18 +01:00
|
|
|
else
|
|
|
|
DrawVisibleMenus();
|
2020-12-09 09:33:57 +01:00
|
|
|
}
|
2020-08-28 21:42:42 +02:00
|
|
|
}
|