. added AFADoomer's patch to set a text highlight color for the list menu.

SVN r4301 (trunk)
This commit is contained in:
Christoph Oelckers 2013-05-31 22:10:12 +00:00
parent 9e3c6a3cc7
commit 890dc71e0d
3 changed files with 12 additions and 10 deletions

View file

@ -495,12 +495,13 @@ bool FListMenuItemSelectable::MouseEvent(int type, int x, int y)
//
//=============================================================================
FListMenuItemText::FListMenuItemText(int x, int y, int height, int hotkey, const char *text, FFont *font, EColorRange color, FName child, int param)
FListMenuItemText::FListMenuItemText(int x, int y, int height, int hotkey, const char *text, FFont *font, EColorRange color, EColorRange color2, FName child, int param)
: FListMenuItemSelectable(x, y, height, child, param)
{
mText = ncopystring(text);
mFont = font;
mColor = color;
mColorSelected = color2;
mHotkey = hotkey;
}
@ -518,7 +519,7 @@ void FListMenuItemText::Drawer(bool selected)
if (text != NULL)
{
if (*text == '$') text = GStrings(text+1);
screen->DrawText(mFont, mColor, mXpos, mYpos, text, DTA_Clean, true, TAG_DONE);
screen->DrawText(mFont, selected ? mColorSelected : mColor, mXpos, mYpos, text, DTA_Clean, true, TAG_DONE);
}
}

View file

@ -393,8 +393,9 @@ class FListMenuItemText : public FListMenuItemSelectable
const char *mText;
FFont *mFont;
EColorRange mColor;
EColorRange mColorSelected;
public:
FListMenuItemText(int x, int y, int height, int hotkey, const char *text, FFont *font, EColorRange color, FName child, int param = 0);
FListMenuItemText(int x, int y, int height, int hotkey, const char *text, FFont *font, EColorRange color, EColorRange color2, FName child, int param = 0);
~FListMenuItemText();
void Drawer(bool selected);
int GetWidth();

View file

@ -324,7 +324,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
param = sc.Number;
}
FListMenuItem *it = new FListMenuItemText(desc->mXpos, desc->mYpos, desc->mLinespacing, hotkey, text, desc->mFont, desc->mFontColor, action, param);
FListMenuItem *it = new FListMenuItemText(desc->mXpos, desc->mYpos, desc->mLinespacing, hotkey, text, desc->mFont, desc->mFontColor, desc->mFontColor2, action, param);
desc->mItems.Push(it);
desc->mYpos += desc->mLinespacing;
if (desc->mSelectedItem == -1) desc->mSelectedItem = desc->mItems.Size()-1;
@ -976,7 +976,7 @@ static void BuildEpisodeMenu()
else
{
it = new FListMenuItemText(ld->mXpos, posy, ld->mLinespacing, AllEpisodes[i].mShortcut,
AllEpisodes[i].mEpisodeName, ld->mFont, ld->mFontColor, NAME_Skillmenu, i);
AllEpisodes[i].mEpisodeName, ld->mFont, ld->mFontColor, ld->mFontColor2, NAME_Skillmenu, i);
}
ld->mItems.Push(it);
posy += ld->mLinespacing;
@ -1065,7 +1065,7 @@ static void BuildPlayerclassMenu()
{
// 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->mFont,ld->mFontColor, ld->mFontColor2, NAME_Episodemenu, -1000);
ld->mAutoselect = ld->mItems.Push(it);
success = true;
}
@ -1091,7 +1091,7 @@ static void BuildPlayerclassMenu()
if (pname != NULL)
{
FListMenuItemText *it = new FListMenuItemText(ld->mXpos, ld->mYpos, ld->mLinespacing, *pname,
pname, ld->mFont,ld->mFontColor, NAME_Episodemenu, i);
pname, ld->mFont,ld->mFontColor,ld->mFontColor2, NAME_Episodemenu, i);
ld->mItems.Push(it);
ld->mYpos += ld->mLinespacing;
n++;
@ -1101,7 +1101,7 @@ static void BuildPlayerclassMenu()
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);
"$MNU_RANDOM", ld->mFont,ld->mFontColor,ld->mFontColor2, NAME_Episodemenu, -1);
ld->mItems.Push(it);
}
if (n == 0)
@ -1110,7 +1110,7 @@ static void BuildPlayerclassMenu()
if (pname != NULL)
{
FListMenuItemText *it = new FListMenuItemText(ld->mXpos, ld->mYpos, ld->mLinespacing, *pname,
pname, ld->mFont,ld->mFontColor, NAME_Episodemenu, 0);
pname, ld->mFont,ld->mFontColor,ld->mFontColor2, NAME_Episodemenu, 0);
ld->mItems.Push(it);
}
}
@ -1369,7 +1369,7 @@ void M_StartupSkillMenu(FGameStartup *gs)
EColorRange color = (EColorRange)skill.GetTextColor();
if (color == CR_UNTRANSLATED) color = ld->mFontColor;
li = new FListMenuItemText(x, y, ld->mLinespacing, skill.Shortcut,
pItemText? *pItemText : skill.MenuName, ld->mFont, color, action, i);
pItemText? *pItemText : skill.MenuName, ld->mFont, color,ld->mFontColor2, action, i);
}
ld->mItems.Push(li);
y += ld->mLinespacing;