mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Battle cups
- The cups they're associated with for GP Bonus Round - Fixes the issue where when opening Ring Cup, Green Hills would be first in the listing because its header is defined before the rest of the cup's maps - One core set of functions that works between multiple modes Will merge conflict with Unlockables Undefeatable
This commit is contained in:
parent
5f9854e898
commit
6659e78c04
3 changed files with 175 additions and 71 deletions
15
src/k_menu.h
15
src/k_menu.h
|
|
@ -679,8 +679,10 @@ void M_SetupRaceMenu(INT32 choice);
|
||||||
|
|
||||||
extern struct cupgrid_s {
|
extern struct cupgrid_s {
|
||||||
SINT8 x, y;
|
SINT8 x, y;
|
||||||
SINT8 pageno;
|
size_t pageno;
|
||||||
UINT8 numpages;
|
cupheader_t **builtgrid;
|
||||||
|
size_t numpages;
|
||||||
|
size_t cappages;
|
||||||
tic_t previewanim;
|
tic_t previewanim;
|
||||||
boolean grandprix; // Setup grand prix server after picking
|
boolean grandprix; // Setup grand prix server after picking
|
||||||
boolean netgame; // Start the game in an actual server
|
boolean netgame; // Start the game in an actual server
|
||||||
|
|
@ -693,13 +695,16 @@ extern struct levellist_s {
|
||||||
cupheader_t *selectedcup;
|
cupheader_t *selectedcup;
|
||||||
INT16 choosemap;
|
INT16 choosemap;
|
||||||
UINT8 newgametype;
|
UINT8 newgametype;
|
||||||
|
UINT32 typeoflevel;
|
||||||
|
boolean cupmode;
|
||||||
boolean timeattack; // Setup time attack menu after picking
|
boolean timeattack; // Setup time attack menu after picking
|
||||||
boolean netgame; // Start the game in an actual server
|
boolean netgame; // Start the game in an actual server
|
||||||
} levellist;
|
} levellist;
|
||||||
|
|
||||||
boolean M_CanShowLevelInList(INT16 mapnum, UINT8 gt);
|
boolean M_CanShowLevelInList(INT16 mapnum, UINT32 tol);
|
||||||
INT16 M_CountLevelsToShowInList(UINT8 gt);
|
INT16 M_CountLevelsToShowInList(UINT32 tol, cupheader_t *cup);
|
||||||
INT16 M_GetFirstLevelInList(UINT8 gt);
|
INT16 M_GetFirstLevelInList(UINT8 *i, UINT32 tol, cupheader_t *cup);
|
||||||
|
INT16 M_GetNextLevelInList(INT16 map, UINT8 *i, UINT32 tol, cupheader_t *cup);
|
||||||
|
|
||||||
void M_LevelSelectInit(INT32 choice);
|
void M_LevelSelectInit(INT32 choice);
|
||||||
void M_CupSelectHandler(INT32 choice);
|
void M_CupSelectHandler(INT32 choice);
|
||||||
|
|
|
||||||
|
|
@ -1902,31 +1902,52 @@ void M_DrawRaceDifficulty(void)
|
||||||
|
|
||||||
static void M_DrawCupPreview(INT16 y, cupheader_t *cup)
|
static void M_DrawCupPreview(INT16 y, cupheader_t *cup)
|
||||||
{
|
{
|
||||||
UINT8 i;
|
UINT8 i = 0;
|
||||||
const INT16 pad = ((vid.width/vid.dupx) - BASEVIDWIDTH)/2;
|
INT16 maxlevels = M_CountLevelsToShowInList(levellist.typeoflevel, cup);
|
||||||
INT16 x = -(cupgrid.previewanim % 82) - pad;
|
INT16 x = -(cupgrid.previewanim % 82);
|
||||||
|
INT16 add;
|
||||||
|
INT16 map, start = M_GetFirstLevelInList(&i, levellist.typeoflevel, cup);
|
||||||
|
UINT8 starti = i;
|
||||||
|
|
||||||
V_DrawFill(0, y, BASEVIDWIDTH, 54, 31);
|
V_DrawFill(0, y, BASEVIDWIDTH, 54, 31);
|
||||||
|
|
||||||
if (cup && (cup->unlockrequired == -1 || unlockables[cup->unlockrequired].unlocked))
|
if (cup && (cup->unlockrequired == -1 || unlockables[cup->unlockrequired].unlocked))
|
||||||
{
|
{
|
||||||
i = (cupgrid.previewanim / 82) % cup->numlevels;
|
add = (cupgrid.previewanim / 82) % maxlevels;
|
||||||
while (x < BASEVIDWIDTH + pad)
|
map = start;
|
||||||
|
while (add > 0)
|
||||||
|
{
|
||||||
|
map = M_GetNextLevelInList(map, &i, levellist.typeoflevel, cup);
|
||||||
|
|
||||||
|
if (map >= nummapheaders)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
add--;
|
||||||
|
}
|
||||||
|
while (x < BASEVIDWIDTH)
|
||||||
{
|
{
|
||||||
INT32 cupLevelNum = cup->cachedlevels[i];
|
|
||||||
patch_t *PictureOfLevel = NULL;
|
patch_t *PictureOfLevel = NULL;
|
||||||
|
|
||||||
if (cupLevelNum < nummapheaders && mapheaderinfo[cupLevelNum])
|
if (map >= nummapheaders)
|
||||||
{
|
{
|
||||||
PictureOfLevel = mapheaderinfo[cupLevelNum]->thumbnailPic;
|
map = start;
|
||||||
|
i = starti;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (map < nummapheaders && mapheaderinfo[map])
|
||||||
|
{
|
||||||
|
PictureOfLevel = mapheaderinfo[map]->thumbnailPic;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PictureOfLevel)
|
if (!PictureOfLevel)
|
||||||
PictureOfLevel = blanklvl;
|
PictureOfLevel = blanklvl;
|
||||||
|
|
||||||
V_DrawSmallScaledPatch(x + 1, y+2, 0, PictureOfLevel);
|
V_DrawSmallScaledPatch(x + 1, y+2, 0, PictureOfLevel);
|
||||||
i = (i+1) % cup->numlevels;
|
|
||||||
x += 82;
|
x += 82;
|
||||||
|
|
||||||
|
map = M_GetNextLevelInList(map, &i, levellist.typeoflevel, cup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1983,19 +2004,12 @@ void M_DrawCupSelect(void)
|
||||||
{
|
{
|
||||||
for (j = 0; j < CUPMENU_ROWS; j++)
|
for (j = 0; j < CUPMENU_ROWS; j++)
|
||||||
{
|
{
|
||||||
UINT8 id = (i + (j * CUPMENU_COLUMNS)) + (cupgrid.pageno * (CUPMENU_COLUMNS * CUPMENU_ROWS));
|
size_t id = (i + (j * CUPMENU_COLUMNS)) + (cupgrid.pageno * (CUPMENU_COLUMNS * CUPMENU_ROWS));
|
||||||
cupheader_t *iconcup = kartcupheaders;
|
cupheader_t *iconcup = cupgrid.builtgrid[id];
|
||||||
patch_t *patch = NULL;
|
patch_t *patch = NULL;
|
||||||
INT16 x, y;
|
INT16 x, y;
|
||||||
INT16 icony = 7;
|
INT16 icony = 7;
|
||||||
|
|
||||||
while (iconcup)
|
|
||||||
{
|
|
||||||
if (iconcup->id == id)
|
|
||||||
break;
|
|
||||||
iconcup = iconcup->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!iconcup)
|
if (!iconcup)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -2167,9 +2181,9 @@ static void M_DrawLevelSelectBlock(INT16 x, INT16 y, INT16 map, boolean redblink
|
||||||
|
|
||||||
void M_DrawLevelSelect(void)
|
void M_DrawLevelSelect(void)
|
||||||
{
|
{
|
||||||
INT16 i;
|
INT16 i = 0;
|
||||||
INT16 start = M_GetFirstLevelInList(levellist.newgametype);
|
UINT8 j = 0;
|
||||||
INT16 map = start;
|
INT16 map = M_GetFirstLevelInList(&j, levellist.typeoflevel, levellist.selectedcup);
|
||||||
INT16 t = (64*menutransition.tics), tay = 0;
|
INT16 t = (64*menutransition.tics), tay = 0;
|
||||||
INT16 y = 80 - (12 * levellist.y);
|
INT16 y = 80 - (12 * levellist.y);
|
||||||
boolean tatransition = ((menutransition.startmenu == &PLAY_TimeAttackDef || menutransition.endmenu == &PLAY_TimeAttackDef) && menutransition.tics);
|
boolean tatransition = ((menutransition.startmenu == &PLAY_TimeAttackDef || menutransition.endmenu == &PLAY_TimeAttackDef) && menutransition.tics);
|
||||||
|
|
@ -2180,13 +2194,10 @@ void M_DrawLevelSelect(void)
|
||||||
tay = t/2;
|
tay = t/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < M_CountLevelsToShowInList(levellist.newgametype); i++)
|
while (true)
|
||||||
{
|
{
|
||||||
INT16 lvlx = t, lvly = y;
|
INT16 lvlx = t, lvly = y;
|
||||||
|
|
||||||
while (!M_CanShowLevelInList(map, levellist.newgametype) && map < nummapheaders)
|
|
||||||
map++;
|
|
||||||
|
|
||||||
if (map >= nummapheaders)
|
if (map >= nummapheaders)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -2202,7 +2213,8 @@ void M_DrawLevelSelect(void)
|
||||||
);
|
);
|
||||||
|
|
||||||
y += 72;
|
y += 72;
|
||||||
map++;
|
i++;
|
||||||
|
map = M_GetNextLevelInList(map, &j, levellist.typeoflevel, levellist.selectedcup);
|
||||||
}
|
}
|
||||||
|
|
||||||
M_DrawCupTitle(tay, levellist.selectedcup);
|
M_DrawCupTitle(tay, levellist.selectedcup);
|
||||||
|
|
|
||||||
167
src/k_menufunc.c
167
src/k_menufunc.c
|
|
@ -3339,9 +3339,10 @@ void M_SetupDifficultySelect(INT32 choice)
|
||||||
// Determines whether to show a given map in the various level-select lists.
|
// Determines whether to show a given map in the various level-select lists.
|
||||||
// Set gt = -1 to ignore gametype.
|
// Set gt = -1 to ignore gametype.
|
||||||
//
|
//
|
||||||
boolean M_CanShowLevelInList(INT16 mapnum, UINT8 gt)
|
boolean M_CanShowLevelInList(INT16 mapnum, UINT32 tol)
|
||||||
{
|
{
|
||||||
UINT32 tolflag = G_TOLFlag(gt);
|
if (mapnum >= nummapheaders)
|
||||||
|
return false;
|
||||||
|
|
||||||
// Does the map exist?
|
// Does the map exist?
|
||||||
if (!mapheaderinfo[mapnum])
|
if (!mapheaderinfo[mapnum])
|
||||||
|
|
@ -3359,7 +3360,7 @@ boolean M_CanShowLevelInList(INT16 mapnum, UINT8 gt)
|
||||||
return false; // not unlocked
|
return false; // not unlocked
|
||||||
|
|
||||||
// Check for TOL
|
// Check for TOL
|
||||||
if (!(mapheaderinfo[mapnum]->typeoflevel & tolflag))
|
if (!(mapheaderinfo[mapnum]->typeoflevel & tol))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Should the map be hidden?
|
// Should the map be hidden?
|
||||||
|
|
@ -3370,36 +3371,93 @@ boolean M_CanShowLevelInList(INT16 mapnum, UINT8 gt)
|
||||||
if (levellist.timeattack && (mapheaderinfo[mapnum]->menuflags & LF2_NOTIMEATTACK))
|
if (levellist.timeattack && (mapheaderinfo[mapnum]->menuflags & LF2_NOTIMEATTACK))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (gametypedefaultrules[gt] & GTR_CAMPAIGN && levellist.selectedcup)
|
if (gametypedefaultrules[gt] & GTR_CAMPAIGN && levellist.selectedcup)
|
||||||
{
|
{
|
||||||
if (mapheaderinfo[mapnum]->cup != levellist.selectedcup)
|
if (mapheaderinfo[mapnum]->cup != levellist.selectedcup)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
// Don't permit cups if not cupmode
|
||||||
|
if (!levellist.cupmode && (mapheaderinfo[mapnum]->cup != NULL))
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Survived our checks.
|
// Survived our checks.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT16 M_CountLevelsToShowInList(UINT8 gt)
|
INT16 M_CountLevelsToShowInList(UINT32 tol, cupheader_t *cup)
|
||||||
{
|
{
|
||||||
INT16 mapnum, count = 0;
|
INT16 i, count = 0;
|
||||||
|
|
||||||
for (mapnum = 0; mapnum < nummapheaders; mapnum++)
|
if (cup)
|
||||||
if (M_CanShowLevelInList(mapnum, gt))
|
{
|
||||||
|
for (i = 0; i < CUPCACHE_MAX; i++)
|
||||||
|
{
|
||||||
|
if (!M_CanShowLevelInList(cup->cachedlevels[i], tol))
|
||||||
|
continue;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < nummapheaders; i++)
|
||||||
|
if (M_CanShowLevelInList(i, tol))
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT16 M_GetFirstLevelInList(UINT8 gt)
|
INT16 M_GetFirstLevelInList(UINT8 *i, UINT32 tol, cupheader_t *cup)
|
||||||
{
|
{
|
||||||
INT16 mapnum;
|
INT16 mapnum = NEXTMAP_INVALID;
|
||||||
|
|
||||||
for (mapnum = 0; mapnum < nummapheaders; mapnum++)
|
if (cup)
|
||||||
if (M_CanShowLevelInList(mapnum, gt))
|
{
|
||||||
return mapnum;
|
*i = 0;
|
||||||
|
mapnum = NEXTMAP_INVALID;
|
||||||
|
for (; *i < CUPCACHE_MAX; (*i)++)
|
||||||
|
{
|
||||||
|
if (!M_CanShowLevelInList(cup->cachedlevels[*i], tol))
|
||||||
|
continue;
|
||||||
|
mapnum = cup->cachedlevels[*i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (mapnum = 0; mapnum < nummapheaders; mapnum++)
|
||||||
|
if (M_CanShowLevelInList(mapnum, tol))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return mapnum;
|
||||||
|
}
|
||||||
|
|
||||||
|
INT16 M_GetNextLevelInList(INT16 map, UINT8 *i, UINT32 tol, cupheader_t *cup)
|
||||||
|
{
|
||||||
|
if (cup)
|
||||||
|
{
|
||||||
|
map = NEXTMAP_INVALID;
|
||||||
|
(*i)++;
|
||||||
|
for (; *i < CUPCACHE_MAX; (*i)++)
|
||||||
|
{
|
||||||
|
if (!M_CanShowLevelInList(cup->cachedlevels[*i], tol))
|
||||||
|
continue;
|
||||||
|
map = cup->cachedlevels[*i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
map++;
|
||||||
|
while (!M_CanShowLevelInList(map, levellist.typeoflevel) && map < nummapheaders)
|
||||||
|
map++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct cupgrid_s cupgrid;
|
struct cupgrid_s cupgrid;
|
||||||
|
|
@ -3407,7 +3465,7 @@ struct levellist_s levellist;
|
||||||
|
|
||||||
static void M_LevelSelectScrollDest(void)
|
static void M_LevelSelectScrollDest(void)
|
||||||
{
|
{
|
||||||
UINT16 m = M_CountLevelsToShowInList(levellist.newgametype)-1;
|
UINT16 m = M_CountLevelsToShowInList(levellist.typeoflevel, levellist.selectedcup)-1;
|
||||||
|
|
||||||
levellist.dest = (6*levellist.cursor);
|
levellist.dest = (6*levellist.cursor);
|
||||||
|
|
||||||
|
|
@ -3421,26 +3479,61 @@ static void M_LevelSelectScrollDest(void)
|
||||||
// Builds the level list we'll be using from the gametype we're choosing and send us to the apropriate menu.
|
// Builds the level list we'll be using from the gametype we're choosing and send us to the apropriate menu.
|
||||||
static void M_LevelListFromGametype(INT16 gt)
|
static void M_LevelListFromGametype(INT16 gt)
|
||||||
{
|
{
|
||||||
levellist.newgametype = gt;
|
static boolean first = true;
|
||||||
|
if (first || gt != levellist.newgametype)
|
||||||
|
{
|
||||||
|
levellist.newgametype = gt;
|
||||||
|
levellist.typeoflevel = G_TOLFlag(gt);
|
||||||
|
levellist.cupmode = true; // todo some way to choose going direct to a long consecutive list..?
|
||||||
|
levellist.selectedcup = NULL;
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
|
||||||
PLAY_CupSelectDef.prevMenu = currentMenu;
|
PLAY_CupSelectDef.prevMenu = currentMenu;
|
||||||
|
|
||||||
// Obviously go to Cup Select in gametypes that have cups.
|
// Obviously go to Cup Select in gametypes that have cups.
|
||||||
// Use a really long level select in gametypes that don't use cups.
|
// Use a really long level select in gametypes that don't use cups.
|
||||||
|
|
||||||
if (levellist.newgametype == GT_RACE)
|
if (levellist.cupmode)
|
||||||
{
|
{
|
||||||
cupheader_t *cup = kartcupheaders;
|
cupheader_t *cup = kartcupheaders;
|
||||||
UINT8 highestid = 0;
|
size_t currentid = 0, highestunlockedid = 0;
|
||||||
|
|
||||||
// Make sure there's valid cups before going to this menu.
|
// Make sure there's valid cups before going to this menu.
|
||||||
if (cup == NULL)
|
if (cup == NULL)
|
||||||
I_Error("Can you really call this a racing game, I didn't recieve any Cups on my pillow or anything");
|
I_Error("Can you really call this a racing game, I didn't recieve any Cups on my pillow or anything");
|
||||||
|
|
||||||
|
if (!cupgrid.builtgrid)
|
||||||
|
{
|
||||||
|
cupgrid.cappages = 2;
|
||||||
|
cupgrid.builtgrid = Z_Calloc(
|
||||||
|
sizeof(cupheader_t*) * cupgrid.cappages * (CUPMENU_COLUMNS * CUPMENU_ROWS),
|
||||||
|
PU_STATIC, NULL);
|
||||||
|
}
|
||||||
|
memset(cupgrid.builtgrid, 0, sizeof(cupheader_t*) * cupgrid.cappages * (CUPMENU_COLUMNS * CUPMENU_ROWS));
|
||||||
|
|
||||||
while (cup)
|
while (cup)
|
||||||
{
|
{
|
||||||
|
if (!M_CountLevelsToShowInList(levellist.typeoflevel, cup))
|
||||||
|
{
|
||||||
|
// No valid maps, skip.
|
||||||
|
cup = cup->next;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (((currentid / (CUPMENU_COLUMNS * CUPMENU_ROWS)) + 1) >= cupgrid.cappages)
|
||||||
|
{
|
||||||
|
cupgrid.cappages *= 2;
|
||||||
|
cupgrid.builtgrid = Z_Realloc(cupgrid.builtgrid,
|
||||||
|
sizeof(cupheader_t*) * cupgrid.cappages * (CUPMENU_COLUMNS * CUPMENU_ROWS),
|
||||||
|
PU_STATIC, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
cupgrid.builtgrid[currentid] = cup;
|
||||||
|
|
||||||
if (cup->unlockrequired == -1 || unlockables[cup->unlockrequired].unlocked)
|
if (cup->unlockrequired == -1 || unlockables[cup->unlockrequired].unlocked)
|
||||||
{
|
{
|
||||||
highestid = cup->id;
|
highestunlockedid = currentid;
|
||||||
if (Playing() && mapheaderinfo[gamemap-1] && mapheaderinfo[gamemap-1]->cup == cup)
|
if (Playing() && mapheaderinfo[gamemap-1] && mapheaderinfo[gamemap-1]->cup == cup)
|
||||||
{
|
{
|
||||||
cupgrid.x = cup->id % CUPMENU_COLUMNS;
|
cupgrid.x = cup->id % CUPMENU_COLUMNS;
|
||||||
|
|
@ -3448,10 +3541,12 @@ static void M_LevelListFromGametype(INT16 gt)
|
||||||
cupgrid.pageno = cup->id / (CUPMENU_COLUMNS * CUPMENU_ROWS);
|
cupgrid.pageno = cup->id / (CUPMENU_COLUMNS * CUPMENU_ROWS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currentid++;
|
||||||
cup = cup->next;
|
cup = cup->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
cupgrid.numpages = (highestid / (CUPMENU_COLUMNS * CUPMENU_ROWS)) + 1;
|
cupgrid.numpages = (highestunlockedid / (CUPMENU_COLUMNS * CUPMENU_ROWS)) + 1;
|
||||||
|
|
||||||
PLAY_LevelSelectDef.prevMenu = &PLAY_CupSelectDef;
|
PLAY_LevelSelectDef.prevMenu = &PLAY_CupSelectDef;
|
||||||
M_SetupNextMenu(&PLAY_CupSelectDef, false);
|
M_SetupNextMenu(&PLAY_CupSelectDef, false);
|
||||||
|
|
@ -3504,25 +3599,15 @@ void M_LevelSelectInit(INT32 choice)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
levellist.newgametype = currentMenu->menuitems[itemOn].mvar2;
|
M_LevelListFromGametype(currentMenu->menuitems[itemOn].mvar2);
|
||||||
|
|
||||||
M_LevelListFromGametype(levellist.newgametype);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void M_CupSelectHandler(INT32 choice)
|
void M_CupSelectHandler(INT32 choice)
|
||||||
{
|
{
|
||||||
cupheader_t *newcup = kartcupheaders;
|
|
||||||
const UINT8 pid = 0;
|
const UINT8 pid = 0;
|
||||||
|
|
||||||
(void)choice;
|
(void)choice;
|
||||||
|
|
||||||
while (newcup)
|
|
||||||
{
|
|
||||||
if (newcup->id == CUPMENU_CURSORID)
|
|
||||||
break;
|
|
||||||
newcup = newcup->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (menucmd[pid].dpad_lr > 0)
|
if (menucmd[pid].dpad_lr > 0)
|
||||||
{
|
{
|
||||||
cupgrid.x++;
|
cupgrid.x++;
|
||||||
|
|
@ -3542,9 +3627,10 @@ void M_CupSelectHandler(INT32 choice)
|
||||||
if (cupgrid.x < 0)
|
if (cupgrid.x < 0)
|
||||||
{
|
{
|
||||||
cupgrid.x = CUPMENU_COLUMNS-1;
|
cupgrid.x = CUPMENU_COLUMNS-1;
|
||||||
cupgrid.pageno--;
|
if (cupgrid.pageno == 0)
|
||||||
if (cupgrid.pageno < 0)
|
|
||||||
cupgrid.pageno = cupgrid.numpages-1;
|
cupgrid.pageno = cupgrid.numpages-1;
|
||||||
|
else
|
||||||
|
cupgrid.pageno--;
|
||||||
}
|
}
|
||||||
S_StartSound(NULL, sfx_s3k5b);
|
S_StartSound(NULL, sfx_s3k5b);
|
||||||
M_SetMenuDelay(pid);
|
M_SetMenuDelay(pid);
|
||||||
|
|
@ -3569,6 +3655,8 @@ void M_CupSelectHandler(INT32 choice)
|
||||||
|
|
||||||
if (M_MenuConfirmPressed(pid) /*|| M_MenuButtonPressed(pid, MBT_START)*/)
|
if (M_MenuConfirmPressed(pid) /*|| M_MenuButtonPressed(pid, MBT_START)*/)
|
||||||
{
|
{
|
||||||
|
cupheader_t *newcup = cupgrid.builtgrid[CUPMENU_CURSORID];
|
||||||
|
|
||||||
M_SetMenuDelay(pid);
|
M_SetMenuDelay(pid);
|
||||||
|
|
||||||
if ((!newcup)
|
if ((!newcup)
|
||||||
|
|
@ -3640,7 +3728,7 @@ void M_CupSelectHandler(INT32 choice)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Keep cursor position if you select the same cup again, reset if it's a different cup
|
// Keep cursor position if you select the same cup again, reset if it's a different cup
|
||||||
if (!levellist.selectedcup || newcup->id != levellist.selectedcup->id)
|
if (levellist.selectedcup != newcup)
|
||||||
{
|
{
|
||||||
levellist.cursor = 0;
|
levellist.cursor = 0;
|
||||||
levellist.selectedcup = newcup;
|
levellist.selectedcup = newcup;
|
||||||
|
|
@ -3671,8 +3759,7 @@ void M_CupSelectTick(void)
|
||||||
|
|
||||||
void M_LevelSelectHandler(INT32 choice)
|
void M_LevelSelectHandler(INT32 choice)
|
||||||
{
|
{
|
||||||
INT16 start = M_GetFirstLevelInList(levellist.newgametype);
|
INT16 maxlevels = M_CountLevelsToShowInList(levellist.typeoflevel, levellist.selectedcup);
|
||||||
INT16 maxlevels = M_CountLevelsToShowInList(levellist.newgametype);
|
|
||||||
const UINT8 pid = 0;
|
const UINT8 pid = 0;
|
||||||
|
|
||||||
(void)choice;
|
(void)choice;
|
||||||
|
|
@ -3703,20 +3790,20 @@ void M_LevelSelectHandler(INT32 choice)
|
||||||
|
|
||||||
if (M_MenuConfirmPressed(pid) /*|| M_MenuButtonPressed(pid, MBT_START)*/)
|
if (M_MenuConfirmPressed(pid) /*|| M_MenuButtonPressed(pid, MBT_START)*/)
|
||||||
{
|
{
|
||||||
INT16 map = start;
|
UINT8 i = 0;
|
||||||
|
INT16 map = M_GetFirstLevelInList(&i, levellist.typeoflevel, levellist.selectedcup);
|
||||||
INT16 add = levellist.cursor;
|
INT16 add = levellist.cursor;
|
||||||
|
|
||||||
M_SetMenuDelay(pid);
|
M_SetMenuDelay(pid);
|
||||||
|
|
||||||
while (add > 0)
|
while (add > 0)
|
||||||
{
|
{
|
||||||
map++;
|
map = M_GetNextLevelInList(map, &i, levellist.typeoflevel, levellist.selectedcup);
|
||||||
|
|
||||||
while (!M_CanShowLevelInList(map, levellist.newgametype) && map < nummapheaders)
|
|
||||||
map++;
|
|
||||||
|
|
||||||
if (map >= nummapheaders)
|
if (map >= nummapheaders)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
add--;
|
add--;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue