diff --git a/src/m_menu.c b/src/m_menu.c index 348610a2..fcfd8b16 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -578,34 +578,36 @@ menu_t EpiDef = // This is for customized episode menus boolean EpiCustom; -short EpiMenuMap[8] = { 1, 1, 1, 1, -1, -1, -1, -1 }, EpiMenuEpi[8] = { 1, 2, 3, 4, -1, -1, -1, -1 }; +static short EpiMenuMap[] = { 1, 1, 1, 1, -1, -1, -1, -1 }; +static short EpiMenuEpi[] = { 1, 2, 3, 4, -1, -1, -1, -1 }; // // M_Episode // -int epiChoice; +static int epiChoice; void M_ClearEpisodes(void) { - EpiDef.numitems = 0; - NewDef.prevMenu = &MainDef; + EpiDef.numitems = 0; + NewDef.prevMenu = &MainDef; } void M_AddEpisode(const char *map, const char *gfx, const char *txt, const char *alpha) { - if (!EpiCustom) - { - EpiCustom = true; - NewDef.prevMenu = &EpiDef; - - if (gamemode == commercial) - EpiDef.numitems = 0; - } - - { int epi, mapnum; + + if (!EpiCustom) + { + EpiCustom = true; + NewDef.prevMenu = &EpiDef; + + if (gamemode == commercial) + EpiDef.numitems = 0; + } + if (EpiDef.numitems >= 8) - return; + return; + G_ValidateMapName(map, &epi, &mapnum); EpiMenuEpi[EpiDef.numitems] = epi; EpiMenuMap[EpiDef.numitems] = mapnum; @@ -614,15 +616,15 @@ void M_AddEpisode(const char *map, const char *gfx, const char *txt, const char EpisodeMenu[EpiDef.numitems].alttext = txt ? strdup(txt) : NULL; EpisodeMenu[EpiDef.numitems].alphaKey = alpha ? *alpha : 0; EpiDef.numitems++; - } - if (EpiDef.numitems <= 4) - { - EpiDef.y = 63; - } - else - { - EpiDef.y = 63 - (EpiDef.numitems - 4) * (LINEHEIGHT / 2); - } + + if (EpiDef.numitems <= 4) + { + EpiDef.y = 63; + } + else + { + EpiDef.y = 63 - (EpiDef.numitems - 4) * (LINEHEIGHT / 2); + } } @@ -735,7 +737,11 @@ void M_VerifyNightmare(int ch) if (ch != 'y') return; - G_DeferedInitNew(nightmare,epiChoice+1,1); + if (!EpiCustom) + G_DeferedInitNew(nightmare, epiChoice + 1, 1); + else + G_DeferedInitNew(nightmare, EpiMenuEpi[epiChoice], EpiMenuMap[epiChoice]); + M_ClearMenus (); } @@ -748,9 +754,10 @@ void M_ChooseSkill(int choice) } if (!EpiCustom) - G_DeferedInitNew(choice,epiChoice+1,1); + G_DeferedInitNew(choice, epiChoice + 1, 1); else G_DeferedInitNew(choice, EpiMenuEpi[epiChoice], EpiMenuMap[epiChoice]); + M_ClearMenus (); }