mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Inuyasha: You were right.
* Changed the order of Record/Nights Attack and its level select menu option so that you go from the main menu to the map page to level select, rather than main menu to level select to map page. * Cleaned up a lot of code.
This commit is contained in:
parent
d670189c89
commit
9fc757f388
2 changed files with 61 additions and 135 deletions
|
@ -1551,34 +1551,27 @@ void CV_AddValue(consvar_t *var, INT32 increment)
|
|||
if (var == &cv_chooseskin)
|
||||
{
|
||||
// Special case for the chooseskin variable, used only directly from the menu
|
||||
if (increment > 0) // Going up!
|
||||
newvalue = var->value - 1;
|
||||
do
|
||||
{
|
||||
newvalue = var->value - 1;
|
||||
do
|
||||
if (increment > 0) // Going up!
|
||||
{
|
||||
newvalue++;
|
||||
if (newvalue == MAXSKINS)
|
||||
newvalue = 0;
|
||||
} while (var->PossibleValue[newvalue].strvalue == NULL);
|
||||
var->value = newvalue + 1;
|
||||
var->string = var->PossibleValue[newvalue].strvalue;
|
||||
var->func();
|
||||
return;
|
||||
}
|
||||
else if (increment < 0) // Going down!
|
||||
{
|
||||
newvalue = var->value - 1;
|
||||
do
|
||||
}
|
||||
else if (increment < 0) // Going down!
|
||||
{
|
||||
newvalue--;
|
||||
if (newvalue == -1)
|
||||
newvalue = MAXSKINS-1;
|
||||
} while (var->PossibleValue[newvalue].strvalue == NULL);
|
||||
var->value = newvalue + 1;
|
||||
var->string = var->PossibleValue[newvalue].strvalue;
|
||||
var->func();
|
||||
return;
|
||||
}
|
||||
}
|
||||
} while (var->PossibleValue[newvalue].strvalue == NULL);
|
||||
|
||||
var->value = newvalue + 1;
|
||||
var->string = var->PossibleValue[newvalue].strvalue;
|
||||
var->func();
|
||||
return;
|
||||
}
|
||||
#ifdef PARANOIA
|
||||
if (currentindice == -1)
|
||||
|
|
165
src/m_menu.c
165
src/m_menu.c
|
@ -703,8 +703,8 @@ static menuitem_t SR_EmblemHintMenu[] =
|
|||
static menuitem_t SP_MainMenu[] =
|
||||
{
|
||||
{IT_CALL | IT_STRING, NULL, "Start Game", M_LoadGame, 92},
|
||||
{IT_SECRET, NULL, "Record Attack", M_TimeAttackLevelSelect, 100},
|
||||
{IT_SECRET, NULL, "NiGHTS Mode", M_NightsAttackLevelSelect, 108},
|
||||
{IT_SECRET, NULL, "Record Attack", M_TimeAttack, 100},
|
||||
{IT_SECRET, NULL, "NiGHTS Mode", M_NightsAttack, 108},
|
||||
{IT_CALL | IT_STRING | IT_CALL_NOTMODIFIED, NULL, "Statistics", M_Statistics, 116},
|
||||
};
|
||||
|
||||
|
@ -737,8 +737,8 @@ static menuitem_t SP_TimeAttackLevelSelectMenu[] =
|
|||
// Single Player Time Attack
|
||||
static menuitem_t SP_TimeAttackMenu[] =
|
||||
{
|
||||
{IT_STRING|IT_CALL, NULL, "Back to Level Select...", &M_GoBack, 52},
|
||||
{IT_STRING|IT_CVAR, NULL, "Character", &cv_chooseskin, 62},
|
||||
{IT_STRING|IT_CALL, NULL, "Level Select...", &M_TimeAttackLevelSelect, 52},
|
||||
{IT_STRING|IT_CVAR, NULL, "Character", &cv_chooseskin, 62},
|
||||
|
||||
{IT_DISABLED, NULL, "Guest Option...", &SP_GuestReplayDef, 100},
|
||||
{IT_DISABLED, NULL, "Replay...", &SP_ReplayDef, 110},
|
||||
|
@ -835,12 +835,12 @@ static menuitem_t SP_NightsAttackLevelSelectMenu[] =
|
|||
// Single Player Nights Attack
|
||||
static menuitem_t SP_NightsAttackMenu[] =
|
||||
{
|
||||
{IT_STRING|IT_CALL, NULL, "Back to Level Select...", &M_GoBack, 52},
|
||||
{IT_STRING|IT_CVAR, NULL, "Show Records For", &cv_dummymares, 62},
|
||||
{IT_STRING|IT_CALL, NULL, "Level Select...", &M_NightsAttackLevelSelect, 52},
|
||||
{IT_STRING|IT_CVAR, NULL, "Show Records For", &cv_dummymares, 62},
|
||||
|
||||
{IT_DISABLED, NULL, "Guest Option...", &SP_NightsGuestReplayDef, 100},
|
||||
{IT_DISABLED, NULL, "Replay...", &SP_NightsReplayDef, 110},
|
||||
{IT_DISABLED, NULL, "Ghosts...", &SP_NightsGhostDef, 120},
|
||||
{IT_DISABLED, NULL, "Guest Option...", &SP_NightsGuestReplayDef, 100},
|
||||
{IT_DISABLED, NULL, "Replay...", &SP_NightsReplayDef, 110},
|
||||
{IT_DISABLED, NULL, "Ghosts...", &SP_NightsGhostDef, 120},
|
||||
{IT_WHITESTRING|IT_CALL|IT_CALL_NOTMODIFIED, NULL, "Start", M_ChooseNightsAttack, 130},
|
||||
};
|
||||
|
||||
|
@ -1848,6 +1848,7 @@ menu_t OP_EraseDataDef = DEFAULTMENUSTYLE("M_DATA", OP_EraseDataMenu, &OP_DataOp
|
|||
|
||||
// Prototypes
|
||||
static INT32 M_GetFirstLevelInList(INT32 gt);
|
||||
static boolean M_CanShowLevelOnPlatter(INT32 mapnum, INT32 gt);
|
||||
|
||||
// Nextmap. Used for Level select.
|
||||
void Nextmap_OnChange(void)
|
||||
|
@ -1994,12 +1995,7 @@ static void Newgametype_OnChange(void)
|
|||
if(!mapheaderinfo[cv_nextmap.value-1])
|
||||
P_AllocMapHeader((INT16)(cv_nextmap.value-1));
|
||||
|
||||
if ((cv_newgametype.value == GT_COOP && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_COOP)) ||
|
||||
(cv_newgametype.value == GT_COMPETITION && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_COMPETITION)) ||
|
||||
(cv_newgametype.value == GT_RACE && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_RACE)) ||
|
||||
((cv_newgametype.value == GT_MATCH || cv_newgametype.value == GT_TEAMMATCH) && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_MATCH)) ||
|
||||
((cv_newgametype.value == GT_TAG || cv_newgametype.value == GT_HIDEANDSEEK) && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_TAG)) ||
|
||||
(cv_newgametype.value == GT_CTF && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_CTF)))
|
||||
if (!M_CanShowLevelOnPlatter(cv_nextmap.value-1, cv_newgametype.value))
|
||||
{
|
||||
INT32 value = 0;
|
||||
|
||||
|
@ -3533,11 +3529,8 @@ static void M_PatchSkinNameTable(void)
|
|||
}
|
||||
}
|
||||
|
||||
CV_SetValue(&cv_chooseskin, cv_chooseskin.value); // This causes crash sometimes?!
|
||||
|
||||
CV_SetValue(&cv_chooseskin, 1);
|
||||
CV_AddValue(&cv_chooseskin, -1);
|
||||
CV_AddValue(&cv_chooseskin, 1);
|
||||
Nextmap_OnChange();
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -3919,12 +3912,7 @@ static void M_HandleLevelPlatter(INT32 choice)
|
|||
lsoffs[0] = lsoffs[1] = 0;
|
||||
S_StartSound(NULL,sfx_menu1);
|
||||
if (gamestate == GS_TIMEATTACK)
|
||||
{
|
||||
if (currentMenu == &SP_TimeAttackLevelSelectDef)
|
||||
M_TimeAttack(-1);
|
||||
else
|
||||
M_NightsAttack(-1);
|
||||
}
|
||||
M_SetupNextMenu(currentMenu->prevMenu);
|
||||
else if (currentMenu == &MISC_ChangeLevelDef)
|
||||
{
|
||||
if (currentMenu->prevMenu && currentMenu->prevMenu->prevMenu != &MPauseDef)
|
||||
|
@ -3934,6 +3922,7 @@ static void M_HandleLevelPlatter(INT32 choice)
|
|||
}
|
||||
else
|
||||
M_LevelSelectWarp(0);
|
||||
Nextmap_OnChange();
|
||||
}
|
||||
else if (!lsoffs[0]) // prevent sound spam
|
||||
{
|
||||
|
@ -3954,14 +3943,8 @@ static void M_HandleLevelPlatter(INT32 choice)
|
|||
{
|
||||
if (currentMenu->prevMenu)
|
||||
{
|
||||
if (gamestate == GS_TIMEATTACK)
|
||||
{
|
||||
// D_StartTitle does its own wipe, since GS_TIMEATTACK is now a complete gamestate.
|
||||
menuactive = false;
|
||||
D_StartTitle();
|
||||
}
|
||||
else
|
||||
M_SetupNextMenu(currentMenu->prevMenu);
|
||||
M_SetupNextMenu(currentMenu->prevMenu);
|
||||
Nextmap_OnChange();
|
||||
}
|
||||
else
|
||||
M_ClearMenus(true);
|
||||
|
@ -4103,17 +4086,6 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt)
|
|||
return (M_CanShowLevelOnPlatter(mapnum, gt) && M_LevelAvailableOnPlatter(mapnum));
|
||||
}
|
||||
|
||||
static INT32 M_CountLevelsToShowInList(void)
|
||||
{
|
||||
INT32 mapnum, count = 0;
|
||||
|
||||
for (mapnum = 0; mapnum < NUMMAPS; mapnum++)
|
||||
if (M_CanShowLevelInList(mapnum, -1))
|
||||
count++;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static INT32 M_GetFirstLevelInList(INT32 gt)
|
||||
{
|
||||
INT32 mapnum;
|
||||
|
@ -5948,7 +5920,17 @@ void M_DrawTimeAttackMenu(void)
|
|||
static void M_TimeAttackLevelSelect(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
levellistmode = LLM_RECORDATTACK;
|
||||
SP_TimeAttackLevelSelectDef.prevMenu = currentMenu;
|
||||
M_SetupNextMenu(&SP_TimeAttackLevelSelectDef);
|
||||
}
|
||||
|
||||
// Going to Time Attack menu...
|
||||
static void M_TimeAttack(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
|
||||
SP_TimeAttackDef.prevMenu = &MainDef;
|
||||
levellistmode = LLM_RECORDATTACK; // Don't be dependent on cv_newgametype
|
||||
|
||||
if (!M_PrepareLevelPlatter(-1))
|
||||
{
|
||||
|
@ -5958,43 +5940,14 @@ static void M_TimeAttackLevelSelect(INT32 choice)
|
|||
|
||||
M_PatchSkinNameTable();
|
||||
|
||||
M_SetupNextMenu(&SP_TimeAttackLevelSelectDef);
|
||||
M_SetupNextMenu(&SP_TimeAttackDef);
|
||||
if (!M_CanShowLevelInList(cv_nextmap.value-1, -1) && levelselect.rows[0].maplist[0])
|
||||
CV_SetValue(&cv_nextmap, levelselect.rows[0].maplist[0]);
|
||||
else
|
||||
Nextmap_OnChange();
|
||||
|
||||
G_SetGamestate(GS_TIMEATTACK);
|
||||
S_ChangeMusicInternal("_inter", true);
|
||||
}
|
||||
|
||||
// Going to Time Attack menu...
|
||||
static void M_TimeAttack(INT32 choice)
|
||||
{
|
||||
const boolean direct = (choice != -1); // Are we coming from SP_TimeAtttackLevelSelect?
|
||||
|
||||
if (direct)
|
||||
{
|
||||
SP_TimeAttackDef.prevMenu = &MainDef;
|
||||
levellistmode = LLM_RECORDATTACK; // Don't be dependent on cv_newgametype
|
||||
|
||||
if (M_CountLevelsToShowInList() == 0)
|
||||
{
|
||||
M_StartMessage(M_GetText("No record-attackable levels found.\n"),NULL,MM_NOTHING);
|
||||
return;
|
||||
}
|
||||
|
||||
M_PatchSkinNameTable();
|
||||
|
||||
Newgametype_OnChange();
|
||||
}
|
||||
else
|
||||
SP_TimeAttackDef.prevMenu = currentMenu;
|
||||
|
||||
M_SetupNextMenu(&SP_TimeAttackDef);
|
||||
Nextmap_OnChange();
|
||||
|
||||
if (direct)
|
||||
{
|
||||
G_SetGamestate(GS_TIMEATTACK);
|
||||
S_ChangeMusicInternal("_inter", true);
|
||||
}
|
||||
|
||||
itemOn = tastart; // "Start" is selected.
|
||||
}
|
||||
|
@ -6137,54 +6090,34 @@ void M_DrawNightsAttackMenu(void)
|
|||
static void M_NightsAttackLevelSelect(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
levellistmode = LLM_NIGHTSATTACK;
|
||||
SP_NightsAttackLevelSelectDef.prevMenu = currentMenu;
|
||||
M_SetupNextMenu(&SP_NightsAttackLevelSelectDef);
|
||||
}
|
||||
|
||||
// Going to Nights Attack menu...
|
||||
static void M_NightsAttack(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
|
||||
SP_NightsAttackDef.prevMenu = &MainDef;
|
||||
levellistmode = LLM_NIGHTSATTACK; // Don't be dependent on cv_newgametype
|
||||
|
||||
if (!M_PrepareLevelPlatter(-1))
|
||||
{
|
||||
M_StartMessage(M_GetText("No NiGHTS-attackable levels found.\n"),NULL,MM_NOTHING);
|
||||
return;
|
||||
}
|
||||
|
||||
// This is really just to make sure Sonic is the played character, just in case
|
||||
M_PatchSkinNameTable();
|
||||
|
||||
M_SetupNextMenu(&SP_NightsAttackLevelSelectDef);
|
||||
M_SetupNextMenu(&SP_NightsAttackDef);
|
||||
if (!M_CanShowLevelInList(cv_nextmap.value-1, -1) && levelselect.rows[0].maplist[0])
|
||||
CV_SetValue(&cv_nextmap, levelselect.rows[0].maplist[0]);
|
||||
else
|
||||
Nextmap_OnChange();
|
||||
|
||||
G_SetGamestate(GS_TIMEATTACK);
|
||||
S_ChangeMusicInternal("_inter", true);
|
||||
}
|
||||
|
||||
// Going to Nights Attack menu...
|
||||
static void M_NightsAttack(INT32 choice)
|
||||
{
|
||||
const boolean direct = (choice != -1); // Are we coming from SP_TimeAtttackLevelSelect?
|
||||
|
||||
if (direct)
|
||||
{
|
||||
SP_NightsAttackDef.prevMenu = &MainDef;
|
||||
levellistmode = LLM_NIGHTSATTACK; // Don't be dependent on cv_newgametype
|
||||
|
||||
if (M_CountLevelsToShowInList() == 0)
|
||||
{
|
||||
M_StartMessage(M_GetText("No NiGHTS-attackable levels found.\n"),NULL,MM_NOTHING);
|
||||
return;
|
||||
}
|
||||
|
||||
// This is really just to make sure Sonic is the played character, just in case
|
||||
M_PatchSkinNameTable();
|
||||
|
||||
Newgametype_OnChange();
|
||||
}
|
||||
else
|
||||
SP_NightsAttackDef.prevMenu = currentMenu;
|
||||
|
||||
M_SetupNextMenu(&SP_NightsAttackDef);
|
||||
Nextmap_OnChange();
|
||||
|
||||
if (direct)
|
||||
{
|
||||
G_SetGamestate(GS_TIMEATTACK);
|
||||
S_ChangeMusicInternal("_inter", true);
|
||||
}
|
||||
|
||||
itemOn = nastart; // "Start" is selected.
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue