From a2b8ad79ed9ee01b717e481c2fb6d44e4014203b Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Tue, 17 Nov 2020 11:29:39 -0500 Subject: [PATCH] - implement slider background color change - https://forum.zdoom.org/viewtopic.php?f=15&t=70616 --- src/gamedata/gi.cpp | 2 ++ src/gamedata/gi.h | 1 + wadsrc/static/mapinfo/chex.txt | 1 + wadsrc/static/mapinfo/doomcommon.txt | 1 + wadsrc/static/mapinfo/heretic.txt | 1 + wadsrc/static/mapinfo/hexen.txt | 1 + wadsrc/static/mapinfo/mindefaults.txt | 1 + wadsrc/static/mapinfo/strife.txt | 1 + wadsrc/static/zscript/engine/base.zs | 1 + wadsrc/static/zscript/engine/ui/menu/optionmenuitems.zs | 4 ++-- wadsrc/static/zscript/ui/menu/playercontrols.zs | 2 +- 11 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/gamedata/gi.cpp b/src/gamedata/gi.cpp index 0795bc64b..9a764755f 100644 --- a/src/gamedata/gi.cpp +++ b/src/gamedata/gi.cpp @@ -67,6 +67,7 @@ DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, statusscreen_single) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, statusscreen_coop) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, statusscreen_dm) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mSliderColor) +DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mSliderBackColor) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, defaultbloodcolor) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, telefogheight) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, defKickback) @@ -409,6 +410,7 @@ void FMapInfoParser::ParseGameInfo() GAMEINFOKEY_FLOAT(dimamount, "dimamount") GAMEINFOKEY_FLOAT(bluramount, "bluramount") GAMEINFOKEY_STRING(mSliderColor, "menuslidercolor") + GAMEINFOKEY_STRING(mSliderBackColor, "menusliderbackcolor") GAMEINFOKEY_INT(definventorymaxamount, "definventorymaxamount") GAMEINFOKEY_INT(defaultrespawntime, "defaultrespawntime") GAMEINFOKEY_INT(defaultdropstyle, "defaultdropstyle") diff --git a/src/gamedata/gi.h b/src/gamedata/gi.h index ff5fa4832..e59a2afaf 100644 --- a/src/gamedata/gi.h +++ b/src/gamedata/gi.h @@ -182,6 +182,7 @@ struct gameinfo_t FName mFontColorHighlight; FName mFontColorSelection; FName mSliderColor; + FName mSliderBackColor; FString mBackButton; double gibfactor; int TextScreenX; diff --git a/wadsrc/static/mapinfo/chex.txt b/wadsrc/static/mapinfo/chex.txt index f5971d241..002fbc190 100644 --- a/wadsrc/static/mapinfo/chex.txt +++ b/wadsrc/static/mapinfo/chex.txt @@ -40,6 +40,7 @@ gameinfo dimamount = 0.5 bluramount = 0.0 menuslidercolor = "Orange" + menusliderbackcolor = "White" definventorymaxamount = 25 defaultrespawntime = 12 defaultdropstyle = 1 diff --git a/wadsrc/static/mapinfo/doomcommon.txt b/wadsrc/static/mapinfo/doomcommon.txt index ca9722b56..41ec76cf7 100644 --- a/wadsrc/static/mapinfo/doomcommon.txt +++ b/wadsrc/static/mapinfo/doomcommon.txt @@ -40,6 +40,7 @@ gameinfo dimamount = 0.5 bluramount = 0.0 menuslidercolor = "Orange" + menusliderbackcolor = "White" definventorymaxamount = 25 defaultrespawntime = 12 defaultdropstyle = 1 diff --git a/wadsrc/static/mapinfo/heretic.txt b/wadsrc/static/mapinfo/heretic.txt index 41c378ee1..211011d82 100644 --- a/wadsrc/static/mapinfo/heretic.txt +++ b/wadsrc/static/mapinfo/heretic.txt @@ -40,6 +40,7 @@ gameinfo dimamount = 0.5 bluramount = 0 menuslidercolor = "Orange" + menusliderbackcolor = "White" definventorymaxamount = 16 defaultrespawntime = 12 defaultdropstyle = 1 diff --git a/wadsrc/static/mapinfo/hexen.txt b/wadsrc/static/mapinfo/hexen.txt index 2e9196075..3f70968c3 100644 --- a/wadsrc/static/mapinfo/hexen.txt +++ b/wadsrc/static/mapinfo/hexen.txt @@ -39,6 +39,7 @@ gameinfo dimamount = 0.5 bluramount = 0.0 menuslidercolor = "Orange" + menusliderbackcolor = "White" definventorymaxamount = 25 defaultrespawntime = 12 defaultdropstyle = 1 diff --git a/wadsrc/static/mapinfo/mindefaults.txt b/wadsrc/static/mapinfo/mindefaults.txt index bfe370540..b61b3e195 100644 --- a/wadsrc/static/mapinfo/mindefaults.txt +++ b/wadsrc/static/mapinfo/mindefaults.txt @@ -29,6 +29,7 @@ gameinfo dimamount = 0.8 bluramount = 0.0 menuslidercolor = "Orange" + menusliderbackcolor = "White" definventorymaxamount = 25 defaultrespawntime = 12 defaultdropstyle = 1 diff --git a/wadsrc/static/mapinfo/strife.txt b/wadsrc/static/mapinfo/strife.txt index 75b7120fd..0d3381fe3 100644 --- a/wadsrc/static/mapinfo/strife.txt +++ b/wadsrc/static/mapinfo/strife.txt @@ -40,6 +40,7 @@ gameinfo dimamount = 0.5 bluramount = 0 menuslidercolor = "Orange" + menusliderbackcolor = "White" definventorymaxamount = 25 defaultrespawntime = 16 defaultdropstyle = 2 diff --git a/wadsrc/static/zscript/engine/base.zs b/wadsrc/static/zscript/engine/base.zs index a62ea5f1a..a0b2a0c83 100644 --- a/wadsrc/static/zscript/engine/base.zs +++ b/wadsrc/static/zscript/engine/base.zs @@ -531,6 +531,7 @@ struct GameInfoStruct native native int gametype; native String mBackButton; native Name mSliderColor; + native Name mSliderBackColor; } struct SystemTime diff --git a/wadsrc/static/zscript/engine/ui/menu/optionmenuitems.zs b/wadsrc/static/zscript/engine/ui/menu/optionmenuitems.zs index c56b4796d..bde6114d1 100644 --- a/wadsrc/static/zscript/engine/ui/menu/optionmenuitems.zs +++ b/wadsrc/static/zscript/engine/ui/menu/optionmenuitems.zs @@ -766,13 +766,13 @@ class OptionMenuSliderBase : OptionMenuItem if (!mSliderShort) { - DrawSliderElement(Font.CR_WHITE, x, cy, "\x10\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x12", grayed); + DrawSliderElement(Font.FindFontColor(gameinfo.mSliderBackColor), x, cy, "\x10\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x12", grayed); DrawSliderElement(Font.FindFontColor(gameinfo.mSliderColor), x + int((5 + ((ccur * 78) / range)) * 2 * CleanXfac_1), cy, "\x13", grayed); } else { // On 320x200 we need a shorter slider - DrawSliderElement(Font.CR_WHITE, x, cy, "\x10\x11\x11\x11\x11\x11\x12", grayed); + DrawSliderElement(Font.FindFontColor(gameinfo.mSliderBackColor), x, cy, "\x10\x11\x11\x11\x11\x11\x12", grayed); DrawSliderElement(Font.FindFontColor(gameinfo.mSliderColor), x + int((5 + ((ccur * 38) / range)) * 2 * CleanXfac_1), cy, "\x13", grayed); right -= 5*8*CleanXfac; } diff --git a/wadsrc/static/zscript/ui/menu/playercontrols.zs b/wadsrc/static/zscript/ui/menu/playercontrols.zs index 51a591017..5e96733e0 100644 --- a/wadsrc/static/zscript/ui/menu/playercontrols.zs +++ b/wadsrc/static/zscript/ui/menu/playercontrols.zs @@ -505,7 +505,7 @@ class ListMenuItemSlider : ListMenuItemSelectable x = (x - 160) * CleanXfac + screen.GetWidth() / 2; y = (y - 100) * CleanYfac + screen.GetHeight() / 2; - screen.DrawText (ConFont, Font.CR_WHITE, x, y, "\x10\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x12", DTA_CellX, 8 * CleanXfac, DTA_CellY, 8 * CleanYfac); + screen.DrawText (ConFont, Font.FindFontColor(gameinfo.mSliderBackColor), x, y, "\x10\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x12", DTA_CellX, 8 * CleanXfac, DTA_CellY, 8 * CleanYfac); screen.DrawText (ConFont, Font.FindFontColor(gameinfo.mSliderColor), x + (5 + (int)((cur * 78) / range)) * CleanXfac, y, "\x13", DTA_CellX, 8 * CleanXfac, DTA_CellY, 8 * CleanYfac); }