// for hud config Class OptionMenuItemUTHudPreview : OptionMenuItem { TextureID tex[2]; CVar mColorP, mColorC, mOpacity, mPTeam, mPColor; OptionMenuItemUTHudPreview Init( String label ) { Super.Init(label,"",true); mColorP = CVar.FindCVar("flak_colorprefs"); mColorC = CVar.FindCVar("flak_colorcustom"); mOpacity = CVar.FindCVar("flak_opacity"); mPTeam = CVar.FindCVar("team"); mPColor = CVar.FindCVar("color"); tex[0] = TexMan.CheckForTexture("graphics/HudPreviewBG.png",TexMan.Type_Any); tex[1] = TexMan.CheckForTexture("graphics/HudPreview.png",TexMan.Type_Any); return self; } override bool Selectable() { return false; } override int Draw( OptionMenuDescriptor desc, int y, int indent, bool selected ) { int xpos = indent + CursorSpace(); int ypos = y+OptionMenuSettings.mLinespacing*CleanYfac_1; Screen.DrawFrame(xpos,ypos,64*CleanXFac_1,64*CleanYFac_1); Screen.DrawTexture(tex[0],false,xpos,ypos,DTA_CleanNoMove_1,true); Color tintcolor = Color("White"); switch ( mColorP.GetInt() ) { case 0: int t = mPTeam.GetInt(); if ( t < Teams.Size() ) tintcolor = Color(Teams[t].mName); break; case 1: tintcolor = Color(mPColor.GetString()); break; case 2: tintcolor = Color(mColorC.GetString()); break; } int opacity = mOpacity.GetInt(); if ( opacity >= 16 ) Screen.DrawTexture(tex[1],false,xpos,ypos,DTA_CleanNoMove_1,true,DTA_FillColor,Color("Black")); double alpha = clamp(opacity/15.,0.,1.); Screen.DrawTexture(tex[1],false,xpos,ypos,DTA_CleanNoMove_1,true,DTA_FillColor,tintcolor,DTA_Alpha,alpha,DTA_LegacyRenderStyle,STYLE_AddShaded); return -1; } } Class OptionMenuItemUTFacePreview : OptionMenuItem { String texpath[4]; TextureID talkface[4]; CVar mCVar[8]; OptionMenuItemUTFacePreview Init( String dummy ) { Super.Init(dummy,'None',true); mCVar[0] = CVar.FindCVar('flak_cmdoskin'); mCVar[1] = CVar.FindCVar('flak_fcmdskin'); mCVar[2] = CVar.FindCVar('flak_sldrskin'); mCVar[3] = CVar.FindCVar('flak_armyskin'); mCVar[4] = CVar.FindCVar('flak_cmdoface'); mCVar[5] = CVar.FindCVar('flak_fcmdface'); mCVar[6] = CVar.FindCVar('flak_sldrface'); mCVar[7] = CVar.FindCVar('flak_armyface'); return self; } override int Draw( OptionMenuDescriptor desc, int y, int indent, bool selected ) { int x = Screen.GetWidth()/2-140*CleanXFac_1; for ( int i=0; i<4; i++ ) { String path; switch ( i ) { default: case 0: path = "models/Commando/"..mCVar[0].GetString().."5"..mCVar[4].GetString()..".png"; break; case 1: path = "models/FCommando/"..mCVar[1].GetString().."5"..mCVar[5].GetString()..".png"; break; case 2: path = "models/Soldier/"..mCVar[2].GetString().."5"..mCVar[6].GetString()..".png"; break; case 3: path = "models/SGirl/"..mCVar[3].GetString().."5"..mCVar[7].GetString()..".png"; break; } if ( (texpath[i] != path) || talkface[i].IsNull() ) { texpath[i] = path; talkface[i] = TexMan.CheckForTexture(path,TexMan.Type_Any); } Screen.DrawTexture(talkface[i],false,x,y-8*CleanYFac_1,DTA_CleanNoMove_1,true); x += 72*CleanXFac_1; } return -1; } override bool Selectable() { return false; } } Class OptionMenuItemUTFaceOption : OptionMenuItemOptionBase { CVar mCVar, mCVar2; int type; Array faces; void InitFaces() { faces.Clear(); String path; switch ( type ) { default: case 0: path = "models/Commando/"..mCVar2.GetString().."2"; break; case 1: path = "models/FCommando/"..mCVar2.GetString().."4"; break; case 2: path = "models/Soldier/"..mCVar2.GetString().."4"; break; case 3: path = "models/SGirl/"..mCVar2.GetString().."4"; break; } for ( int l=0; l= 0 ) { mValues = newtext; int s = GetSelection(); if ( (s >= cnt) || (s < 0) ) s = 0; SetSelection(s); return true; } } return false; } override int GetSelection() { int Selection = -1; int cnt = faces.Size(); if ( (cnt > 0) && mCVar ) { String cv = mCVar.GetString(); for( int i=0; i 0) && mCVar ) mCVar.SetString(faces[Selection]); } override int Draw( OptionMenuDescriptor desc, int y, int indent, bool selected ) { if ( mCenter ) indent = (screen.GetWidth()/2); drawLabel(indent,y,selected?OptionMenuSettings.mFontColorSelection:OptionMenuSettings.mFontColor,isGrayed()); int Selection = GetSelection(); String text = (Selection!=-1)?faces[Selection]:"unknown"; // capitalize first letter text = text.Left(1).MakeUpper()..text.Mid(1); drawValue(indent,y,OptionMenuSettings.mFontColorValue,text,isGrayed()); return indent; } override bool MenuEvent( int mkey, bool fromcontroller ) { int cnt = faces.Size(); if ( cnt > 0 ) { int Selection = GetSelection(); if ( mkey == Menu.MKEY_Left ) { if ( Selection == -1 ) Selection = 0; else if ( --Selection < 0 ) Selection = cnt-1; } else if ( (mkey == Menu.MKEY_Right) || (mkey == Menu.MKEY_Enter) ) { if ( ++Selection >= cnt ) Selection = 0; } else return OptionMenuItem.MenuEvent(mkey,fromcontroller); SetSelection(Selection); Menu.MenuSound("menu/change"); } else return OptionMenuItem.MenuEvent(mkey,fromcontroller); return true; } } Class OptionMenuItemUTSkinOption : OptionMenuItemOption { OptionMenuItemUTFaceOption linked; override void SetSelection( int Selection ) { int oldsel = GetSelection(); Super.SetSelection(Selection); int newsel = GetSelection(); if ( oldsel == newsel ) return; // force face to update linked.InitFaces(); } } // changes to Tahoma Class UTMessageBox : MessageBoxMenu { override void Init( Menu parent, String message, int messagemode, bool playsound, Name cmd, voidptr native_handler ) { Super.Init(parent,message,messagemode,playsound,cmd,native_handler); Font NFont = Font.GetFont('Tahoma10'); if ( !generic_ui ) { if ( NFont && NFont.CanPrint(message) && NFont.CanPrint("$TXT_YES") && NFont.CanPrint("$TXT_NO") ) textFont = NFont; else if ( OriginalSmallFont && OriginalSmallFont.CanPrint(message) && OriginalSmallFont.CanPrint("$TXT_YES") && OriginalSmallFont.CanPrint("$TXT_NO") ) textFont = OriginalSmallFont; } if ( !textFont ) { arrowFont = textFont = NewSmallFont; int factor = (CleanXfac+1)/2; destWidth = screen.GetWidth()/factor; destHeight = screen.GetHeight()/factor; selector = "▶"; } else { arrowFont = ConFont; destWidth = CleanWidth; destHeight = CleanHeight; selector = "\xd"; } int mr1 = destWidth/2+10+textFont.StringWidth(Stringtable.Localize("$TXT_YES")); int mr2 = destWidth/2+10+textFont.StringWidth(Stringtable.Localize("$TXT_NO")); mMouseRight = MAX(mr1,mr2); mMessage = textFont.BreakLines(Stringtable.Localize(message),generic_ui?600:300); } } // Option Menu with tooltips at bottom Class UTOptionMenu : OptionMenu { private String ttip; override void Init( Menu parent, OptionMenuDescriptor desc ) { Super.Init(parent,desc); // link skins and faces for ( int i=0; i 0) ) y = -y+font.GetHeight(); else y = -y; } int fontheight = OptionMenuSettings.mLinespacing*CleanYfac_1; y *= CleanYfac_1; int lastrow = Screen.GetHeight()-OptionHeight()*CleanYfac_1; for ( int i=0; ((i < mDesc.mItems.Size()) && (y <= lastrow)); i++ ) { // Don't scroll the uppermost items if ( i == mDesc.mScrollTop ) { i += mDesc.mScrollPos; if ( i >= mDesc.mItems.Size() ) break; // skipped beyond end of menu } y += fontheight; if ( mDesc.mSelectedItem == i ) { cy = y; break; } } let fnt = Font.GetFont('UTFont12'); let lines = fnt.BreakLines(ttip,CleanWidth_1-8); int height = (8+fnt.GetHeight()*lines.Count())*CleanYFac_1; // draw at the bottom unless the selected option could is covered by the tooltip int ypos = Screen.GetHeight()-height; if ( cy >= ypos ) ypos = 0; Screen.Dim("Black",.75,0,ypos,Screen.GetWidth(),height); ypos += 4*CleanYFac_1; for ( int i=0; i