mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Duplicate levellist data for menu restoration
- More consistent and graceful recovery from gametype change
- Fix a potential bug with restoring the menu from Tutorial stages
- Store the calling menu in this struct
- Permits removing the Match Race restoreMenu hack
This commit is contained in:
parent
1d8999923c
commit
af01ae7bc5
3 changed files with 42 additions and 37 deletions
|
|
@ -824,7 +824,7 @@ typedef struct levelsearch_s {
|
|||
|
||||
#define M_LEVELLIST_SLIDETIME 4
|
||||
|
||||
extern struct levellist_s {
|
||||
typedef struct levellist_s {
|
||||
SINT8 cursor;
|
||||
menu_anim_t slide;
|
||||
UINT16 y;
|
||||
|
|
@ -834,7 +834,11 @@ extern struct levellist_s {
|
|||
UINT8 guessgt;
|
||||
levelsearch_t levelsearch;
|
||||
boolean netgame; // Start the game in an actual server
|
||||
} levellist;
|
||||
menu_t *backMenu;
|
||||
} levellist_t;
|
||||
|
||||
extern levellist_t levellist;
|
||||
extern levellist_t restorelevellist;
|
||||
|
||||
extern cupheader_t dummy_lostandfound;
|
||||
|
||||
|
|
|
|||
|
|
@ -533,26 +533,29 @@ menu_t *M_SpecificMenuRestore(menu_t *torestore)
|
|||
|| torestore == &PLAY_TimeAttackDef)
|
||||
{
|
||||
// Handle unlock restrictions
|
||||
|
||||
levellist = restorelevellist;
|
||||
|
||||
cupheader_t *currentcup = levellist.levelsearch.cup;
|
||||
|
||||
M_SetupGametypeMenu(-1);
|
||||
|
||||
if (levellist.newgametype == GT_RACE)
|
||||
if (levellist.levelsearch.tutorial)
|
||||
{
|
||||
M_SetupRaceMenu(-1);
|
||||
M_SetupDifficultyOptions((cupgrid.grandprix == false));
|
||||
M_InitExtras(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
M_SetupGametypeMenu(-1);
|
||||
|
||||
if (levellist.newgametype == GT_RACE)
|
||||
{
|
||||
M_SetupRaceMenu(-1);
|
||||
M_SetupDifficultyOptions((cupgrid.grandprix == false));
|
||||
}
|
||||
}
|
||||
|
||||
if (!M_LevelListFromGametype(-1))
|
||||
{
|
||||
if (PLAY_LevelSelectDef.prevMenu == &PLAY_CupSelectDef)
|
||||
{
|
||||
torestore = PLAY_CupSelectDef.prevMenu;
|
||||
}
|
||||
else
|
||||
{
|
||||
torestore = PLAY_LevelSelectDef.prevMenu;
|
||||
}
|
||||
torestore = levellist.backMenu;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -560,19 +563,12 @@ menu_t *M_SpecificMenuRestore(menu_t *torestore)
|
|||
{
|
||||
torestore = &PLAY_CupSelectDef;
|
||||
}
|
||||
else if (torestore == &PLAY_TimeAttackDef)
|
||||
else if (levellist.levelsearch.timeattack)
|
||||
{
|
||||
M_PrepareTimeAttack(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (torestore == &PLAY_RaceDifficultyDef)
|
||||
{
|
||||
// Handle a much smaller subset of unlock restrictions
|
||||
M_SetupGametypeMenu(-1);
|
||||
M_SetupRaceMenu(-1);
|
||||
M_SetupDifficultyOptions((cupgrid.grandprix == false));
|
||||
}
|
||||
else if (torestore == &PLAY_MP_OptSelectDef)
|
||||
{
|
||||
// Ticker init
|
||||
|
|
|
|||
|
|
@ -37,7 +37,8 @@ menu_t PLAY_LevelSelectDef = {
|
|||
NULL
|
||||
};
|
||||
|
||||
struct levellist_s levellist;
|
||||
levellist_t levellist;
|
||||
levellist_t restorelevellist;
|
||||
|
||||
//
|
||||
// M_CanShowLevelInList
|
||||
|
|
@ -278,6 +279,8 @@ boolean M_LevelListFromGametype(INT16 gt)
|
|||
CV_SetValue(&cv_dummyspbattack, 0);
|
||||
}
|
||||
|
||||
levellist.backMenu = currentMenu;
|
||||
|
||||
if (gamestate == GS_MENU)
|
||||
{
|
||||
const char *music;
|
||||
|
|
@ -290,8 +293,8 @@ boolean M_LevelListFromGametype(INT16 gt)
|
|||
}
|
||||
else
|
||||
{
|
||||
music = currentMenu->music;
|
||||
bgroutine = currentMenu->bgroutine;
|
||||
music = levellist.backMenu->music;
|
||||
bgroutine = levellist.backMenu->bgroutine;
|
||||
}
|
||||
|
||||
menu_t *remap_menus[] = {
|
||||
|
|
@ -548,10 +551,11 @@ boolean M_LevelListFromGametype(INT16 gt)
|
|||
cupgrid.pageno = 0;
|
||||
}
|
||||
|
||||
PLAY_CupSelectDef.prevMenu = levellist.backMenu;
|
||||
PLAY_LevelSelectDef.prevMenu = &PLAY_CupSelectDef;
|
||||
|
||||
if (gt != -1)
|
||||
{
|
||||
PLAY_CupSelectDef.prevMenu = currentMenu;
|
||||
PLAY_LevelSelectDef.prevMenu = &PLAY_CupSelectDef;
|
||||
M_SetupNextMenu(&PLAY_CupSelectDef, false);
|
||||
}
|
||||
|
||||
|
|
@ -597,6 +601,8 @@ boolean M_LevelListFromGametype(INT16 gt)
|
|||
M_LevelSelectScrollDest();
|
||||
levellist.slide.start = 0;
|
||||
|
||||
PLAY_LevelSelectDef.prevMenu = levellist.backMenu;
|
||||
|
||||
if (gt != -1)
|
||||
{
|
||||
if (levellist.levelsearch.tutorial && levellist.mapcount == 1)
|
||||
|
|
@ -605,7 +611,6 @@ boolean M_LevelListFromGametype(INT16 gt)
|
|||
}
|
||||
else
|
||||
{
|
||||
PLAY_LevelSelectDef.prevMenu = currentMenu;
|
||||
M_SetupNextMenu(&PLAY_LevelSelectDef, false);
|
||||
}
|
||||
}
|
||||
|
|
@ -687,6 +692,8 @@ void M_LevelSelected(INT16 add)
|
|||
{
|
||||
S_StartSound(NULL, sfx_s3k63);
|
||||
|
||||
restorelevellist = levellist;
|
||||
|
||||
M_PrepareTimeAttack(0);
|
||||
|
||||
PLAY_TimeAttackDef.lastOn = ta_start;
|
||||
|
|
@ -744,19 +751,17 @@ void M_LevelSelected(INT16 add)
|
|||
|
||||
D_MapChange(levellist.choosemap+1, levellist.newgametype, (cv_kartencore.value == 1), 1, 1, false, false);
|
||||
|
||||
if (!M_GameTrulyStarted() ||
|
||||
levellist.levelsearch.tutorial)
|
||||
{
|
||||
restoreMenu = currentMenu;
|
||||
}
|
||||
else if (levellist.netgame == true)
|
||||
if (levellist.netgame == true)
|
||||
{
|
||||
restoreMenu = &PLAY_MP_OptSelectDef;
|
||||
}
|
||||
else
|
||||
else /*if (!M_GameTrulyStarted() ||
|
||||
levellist.levelsearch.tutorial)*/
|
||||
{
|
||||
restoreMenu = &PLAY_RaceDifficultyDef;
|
||||
restoreMenu = currentMenu;
|
||||
}
|
||||
|
||||
restorelevellist = levellist;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue