Missed some stuff.

This commit is contained in:
Mari the Deer 2022-04-05 13:07:32 +02:00
commit 69dbab6c19
2 changed files with 28 additions and 15 deletions

View file

@ -175,7 +175,15 @@ Class OptionMenuItemSWWMPlayTime : OptionMenuItem
// option menu /w tooltips
Class SWWMOptionMenu : OptionMenu
{
private String ttip;
private String ttip, olttip;
private Font mTipFont;
private BrokenLines ttlines;
override void Init( Menu parent, OptionMenuDescriptor desc )
{
Super.Init(parent,desc);
mTipFont = Font.GetFont('TewiFont');
}
override void Ticker()
{
@ -185,13 +193,16 @@ Class SWWMOptionMenu : OptionMenu
String mcvar = mDesc.mItems[mDesc.mSelectedItem].GetAction();
mcvar.Replace(" ","_"); // need to strip whitespace for command actions
String locstr = String.Format("TOOLTIP_%s",mcvar);
olttip = ttip;
ttip = StringTable.Localize(locstr,false);
if ( ttip == locstr ) ttip = "";
if ( (ttip != olttip) && ttlines ) ttlines.Destroy();
if ( !ttlines ) ttlines = mTipFont.BreakLines(ttip,CleanWidth_1-8);
}
override void Drawer()
{
Super.Drawer();
if ( ttip == "" ) return;
if ( (ttip == "") || !ttlines ) return;
// re-evaluate y to check where the cursor is
int cy = 0;
int y = mDesc.mPosition;
@ -220,22 +231,20 @@ Class SWWMOptionMenu : OptionMenu
break;
}
}
let lines = smallfont.BreakLines(ttip,CleanWidth_1-8);
int height = (4+smallfont.GetHeight()*lines.Count())*CleanYFac_1;
int height = (4+mTipFont.GetHeight()*ttlines.Count())*CleanYFac_1;
// draw at the bottom unless the selected option could be covered by the tooltip
int ypos = Screen.GetHeight()-height;
if ( cy > ypos ) ypos = 0;
Screen.Dim("Black",.75,0,ypos,Screen.GetWidth(),height);
ypos += 2*CleanYFac_1;
for ( int i=0; i<lines.Count(); i++ )
for ( int i=0; i<ttlines.Count(); i++ )
{
Screen.DrawText(smallfont,Font.CR_WHITE,4*CleanXFac_1,ypos,lines.StringAt(i),DTA_CleanNoMove_1,true);
ypos += smallfont.GetHeight()*CleanYFac_1;
Screen.DrawText(mTipFont,Font.CR_WHITE,4*CleanXFac_1,ypos,ttlines.StringAt(i),DTA_CleanNoMove_1,true);
ypos += mTipFont.GetHeight()*CleanYFac_1;
}
}
}
// main menu w/ version info
Class SWWMCleanMenu : ListMenu
{
override bool MouseEvent( int type, int x, int y )
@ -268,6 +277,7 @@ Class SWWMCleanMenu : ListMenu
}
}
// main menu w/ version info
Class SWWMMainMenu : SWWMCleanMenu
{
TextureID demotex, gradtex;
@ -383,9 +393,12 @@ Class SWWMBigMenuHack : SWWMCleanMenu
bool longlist; // more than 10 entries, scrolls
int ofs;
Font mSmallFont;
override void Init( Menu parent, ListMenuDescriptor desc )
{
Super.Init(parent,desc);
mSmallFont = Font.GetFont('TewiFont');
for ( int i=0; i<mDesc.mItems.Size(); i++ )
{
let itm = mDesc.mItems[i];
@ -475,19 +488,19 @@ Class SWWMBigMenuHack : SWWMCleanMenu
isclean = true;
}
String str = "⌃ ⌃ ⌃";
double x = (w-smallfont.StringWidth(str))/2;
double x = (w-mSmallFont.StringWidth(str))/2;
double y = (h-224)/2;
if ( isclean ) SWWMUtility.AdjustClean_1(x,y);
if ( ofs > 0 )
{
if ( isclean ) Screen.DrawText(smallfont,Font.CR_FIRE,x,y+16*CleanYFac_1,str,DTA_CleanNoMove_1,true);
else Screen.DrawText(smallfont,Font.CR_FIRE,x,y+16,str,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43);
if ( isclean ) Screen.DrawText(mSmallFont,Font.CR_FIRE,x,y+16*CleanYFac_1,str,DTA_CleanNoMove_1,true);
else Screen.DrawText(mSmallFont,Font.CR_FIRE,x,y+16,str,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43);
}
if ( ofs < (mDesc.mItems.Size()-8) )
{
str = "⌄ ⌄ ⌄";
if ( isclean ) Screen.DrawText(smallfont,Font.CR_FIRE,x,y+256*CleanYFac_1,str,DTA_CleanNoMove_1,true);
else Screen.DrawText(smallfont,Font.CR_FIRE,x,y+256,str,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43);
if ( isclean ) Screen.DrawText(mSmallFont,Font.CR_FIRE,x,y+256*CleanYFac_1,str,DTA_CleanNoMove_1,true);
else Screen.DrawText(mSmallFont,Font.CR_FIRE,x,y+256,str,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43);
}
for ( int i=0; i<mDesc.mItems.Size(); i++ )
{