- Add NoRandomPlayerclass flag for MAPINFO.

SVN r4147 (trunk)
This commit is contained in:
Randy Heit 2013-02-19 02:50:47 +00:00
parent bd601a1bc8
commit 602209d4a4
4 changed files with 11 additions and 6 deletions

View file

@ -338,6 +338,7 @@ void FMapInfoParser::ParseGameInfo()
GAMEINFOKEY_FONT(mStatscreenEnteringFont, "statscreen_enteringfont")
GAMEINFOKEY_PATCH(mStatscreenFinishedFont, "statscreen_finishedpatch")
GAMEINFOKEY_PATCH(mStatscreenEnteringFont, "statscreen_enteringpatch")
GAMEINFOKEY_BOOL(norandomplayerclass, "norandomplayerclass")
else
{

View file

@ -139,6 +139,7 @@ struct gameinfo_t
FGIFont mStatscreenMapNameFont;
FGIFont mStatscreenFinishedFont;
FGIFont mStatscreenEnteringFont;
bool norandomplayerclass;
const char *GetFinalePage(unsigned int num) const;
};

View file

@ -1098,7 +1098,7 @@ static void BuildPlayerclassMenu()
}
}
}
if (n > 1)
if (n > 1 && !gameinfo.norandomplayerclass)
{
FListMenuItemText *it = new FListMenuItemText(ld->mXpos, ld->mYpos, ld->mLinespacing, 'r',
"$MNU_RANDOM", ld->mFont,ld->mFontColor, NAME_Episodemenu, -1);

View file

@ -606,13 +606,16 @@ void DPlayerMenu::Init(DMenu *parent, FListMenuDescriptor *desc)
}
else
{
li->SetString(0, "Random");
// [XA] Remove the "Random" option if the relevant gameinfo flag is set.
if(!gameinfo.norandomplayerclass)
li->SetString(0, "Random");
for(unsigned i=0; i< PlayerClasses.Size(); i++)
{
const char *cls = GetPrintableDisplayName(PlayerClasses[i].Type);
li->SetString(i+1, cls);
li->SetString(gameinfo.norandomplayerclass ? i : i+1, cls);
}
li->SetValue(0, players[consoleplayer].userinfo.PlayerClass + 1);
int pclass = players[consoleplayer].userinfo.PlayerClass;
li->SetValue(0, gameinfo.norandomplayerclass && pclass >= 0 ? pclass : pclass + 1);
}
}
@ -907,10 +910,10 @@ void DPlayerMenu::ClassChanged (FListMenuItem *li)
if (li->GetValue(0, &sel))
{
players[consoleplayer].userinfo.PlayerClass = sel-1;
players[consoleplayer].userinfo.PlayerClass = gameinfo.norandomplayerclass ? sel : sel-1;
PickPlayerClass();
cvar_set ("playerclass", sel == 0 ? "Random" : PlayerClass->Type->Meta.GetMetaString (APMETA_DisplayName));
cvar_set ("playerclass", sel == 0 && !gameinfo.norandomplayerclass ? "Random" : PlayerClass->Type->Meta.GetMetaString (APMETA_DisplayName));
UpdateSkins();
UpdateColorsets();