diff --git a/graphics/HudPreview.png b/graphics/HudPreview.png new file mode 100644 index 0000000..30fc595 Binary files /dev/null and b/graphics/HudPreview.png differ diff --git a/graphics/HudPreviewBG.png b/graphics/HudPreviewBG.png new file mode 100644 index 0000000..836bf8b Binary files /dev/null and b/graphics/HudPreviewBG.png differ diff --git a/menudef.txt b/menudef.txt index c4e2500..6abd532 100644 --- a/menudef.txt +++ b/menudef.txt @@ -59,6 +59,11 @@ OptionMenu "UTOptionMenu" Slider "$FLAK_HSIZE", "flak_hudsize", 0.2, 1.0, 0.2, 1 Slider "$FLAK_WSIZE", "flak_weaponsize", 0.2, 1.0, 0.2, 1 Slider "$FLAK_DSIZE", "flak_statussize", 0.5, 1.5, 0.1, 1 + UTHudPreview " " + StaticText " " + StaticText " " + StaticText " " + StaticText " " Option "$FLAK_CCHOOSE", "flak_colorprefs", "ColorPrefs" ColorPicker "$FLAK_CCOLOR", "flak_colorcustom" Slider "$FLAK_HOPAC", "flak_opacity", 1, 16, 1, 0 diff --git a/zscript.txt b/zscript.txt index 84afea6..290e4d1 100644 --- a/zscript.txt +++ b/zscript.txt @@ -23,3 +23,4 @@ version "4.2" #include "zscript/powerups.zsc" #include "zscript/uthud.zsc" #include "zscript/compat.zsc" +#include "zscript/utmenu.zsc" diff --git a/zscript/utmenu.zsc b/zscript/utmenu.zsc new file mode 100644 index 0000000..9095e5c --- /dev/null +++ b/zscript/utmenu.zsc @@ -0,0 +1,49 @@ +// 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.DrawTexture(tex[0],false,xpos,ypos,DTA_CleanNoMove_1,true); + Color tintcolor = Color("White"); + switch ( mColorP.GetInt() ) + { + case 0: + tintcolor = Color(Teams[mPTeam.GetInt()].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; + } +} \ No newline at end of file