- SW: fixed episode menu display.

The subtitle needs to use the game specific drawer, not the generic one.
Fixes #162
This commit is contained in:
Christoph Oelckers 2020-11-08 10:12:12 +01:00
parent 8a4b2e792e
commit aed8a450fd
2 changed files with 11 additions and 6 deletions

View file

@ -398,7 +398,8 @@ static void BuildEpisodeMenu()
addedVolumes++; addedVolumes++;
if (gVolumeSubtitles[i].IsNotEmpty()) if (gVolumeSubtitles[i].IsNotEmpty())
{ {
auto it = CreateListMenuItemStaticText(ld->mXpos, y, gVolumeSubtitles[i], SmallFont, CR_GRAY, false); auto it = CreateCustomListMenuItemText(ld->mXpos, y, ld->mLinespacing * 6 / 10, 1,
gVolumeSubtitles[i], SmallFont, CR_GRAY, false, NAME_None, i);
y += ld->mLinespacing * 6 / 10; y += ld->mLinespacing * 6 / 10;
ld->mItems.Push(it); ld->mItems.Push(it);
} }

View file

@ -88,6 +88,11 @@ class ListMenuItemSWTextItem : ListMenuItemTextItem
if (child == 'none') mEnabled = -1; if (child == 'none') mEnabled = -1;
} }
override bool Selectable()
{
return super.Selectable() && mFont == BigFont;
}
void InitDirect(double x, double y, int height, String hotkey, String text, Font font, int color, int color2, Name child, int param = 0) void InitDirect(double x, double y, int height, String hotkey, String text, Font font, int color, int color2, Name child, int param = 0)
{ {
Super.InitDirect(x, y, height, hotkey, text, font, color, color2, child, param); Super.InitDirect(x, y, height, hotkey, text, font, color, color2, child, param);
@ -95,10 +100,9 @@ class ListMenuItemSWTextItem : ListMenuItemTextItem
override void Draw(bool selected, ListMenuDescriptor desc) override void Draw(bool selected, ListMenuDescriptor desc)
{ {
let gamefont = generic_ui ? NewSmallFont : BigFont; let gamefont = generic_ui ? NewSmallFont : mFont;
int cr = generic_ui? Font.CR_RED : Font.CR_UNDEFINED; int cr = mColor != Font.CR_UNDEFINED? mColor : generic_ui? Font.CR_RED : Font.CR_UNDEFINED;
double scalex = 1.; double scalex = generic_ui && mFont == SmallFont? 0.5 : 1.;
// The font here is very bulky and may cause problems with localized content. Account for that by squashing the text if needed. // The font here is very bulky and may cause problems with localized content. Account for that by squashing the text if needed.
int length = gamefont.StringWidth(mText); int length = gamefont.StringWidth(mText);
@ -107,7 +111,7 @@ class ListMenuItemSWTextItem : ListMenuItemTextItem
scalex = (315. - mXpos) / length; scalex = (315. - mXpos) / length;
} }
Screen.DrawText(BigFont, cr, mXpos, mYpos, mText, DTA_FullscreenScale, FSMode_Fit320x200, DTA_Color, !Selectable()? 0xff505050 : 0xffffffff, DTA_ScaleX, scalex); Screen.DrawText(gamefont, cr, mXpos, mYpos, mText, DTA_FullscreenScale, FSMode_Fit320x200, DTA_Color, !super.Selectable()? 0xff505050 : 0xffffffff, DTA_ScaleX, scalex);
} }
} }