- fixed: The menu should not override the user's player class if there is no player class menu.

SVN r2798 (trunk)
This commit is contained in:
Christoph Oelckers 2010-09-16 16:20:39 +00:00
parent 09da387689
commit 4da5ce74ca
3 changed files with 10 additions and 6 deletions

View file

@ -233,7 +233,7 @@ void G_DeferedInitNew (const char *mapname, int newskill)
void G_DeferedInitNew (FGameStartup *gs) void G_DeferedInitNew (FGameStartup *gs)
{ {
playerclass = gs->PlayerClass; if (gs->PlayerClass != NULL) playerclass = gs->PlayerClass;
d_mapname = AllEpisodes[gs->Episode].mEpisodeMap; d_mapname = AllEpisodes[gs->Episode].mEpisodeMap;
d_skill = gs->Skill; d_skill = gs->Skill;
CheckWarpTransMap (d_mapname, true); CheckWarpTransMap (d_mapname, true);

View file

@ -350,6 +350,7 @@ void M_SetMenu(FName menu, int param)
GameStartupInfo.Skill = -1; GameStartupInfo.Skill = -1;
GameStartupInfo.Episode = -1; GameStartupInfo.Episode = -1;
GameStartupInfo.PlayerClass = GameStartupInfo.PlayerClass =
param == -1000? NULL :
param == -1? "Random" : PlayerClasses[param].Type->Meta.GetMetaString (APMETA_DisplayName); param == -1? "Random" : PlayerClasses[param].Type->Meta.GetMetaString (APMETA_DisplayName);
break; break;

View file

@ -1006,7 +1006,14 @@ static void BuildPlayerclassMenu()
// center the menu on the screen if the top space is larger than the bottom space // center the menu on the screen if the top space is larger than the bottom space
int totalheight = posy + (numclassitems+1) * ld->mLinespacing - topy; int totalheight = posy + (numclassitems+1) * ld->mLinespacing - topy;
if (totalheight <= 190 || numclassitems == 1) if (numclassitems <= 1)
{
// create a dummy item that auto-chooses the default class.
FListMenuItemText *it = new FListMenuItemText(0, 0, 0, 'p', "player",
ld->mFont,ld->mFontColor, NAME_Episodemenu, -1000);
ld->mAutoselect = 0;
}
else if (totalheight <= 190)
{ {
int newtop = (200 - totalheight + topy) / 2; int newtop = (200 - totalheight + topy) / 2;
int topdelta = newtop - topy; int topdelta = newtop - topy;
@ -1051,10 +1058,6 @@ static void BuildPlayerclassMenu()
ld->mItems.Push(it); ld->mItems.Push(it);
} }
} }
if (n < 2)
{
ld->mAutoselect = ld->mSelectedItem;
}
success = true; success = true;
} }
} }