Skip to content

Commit

Permalink
- implement slider background color change - https://forum.zdoom.org/…
Browse files Browse the repository at this point in the history
  • Loading branch information
madame-rachelle committed Nov 17, 2020
1 parent 7ff7954 commit a2b8ad7
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/gamedata/gi.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions src/gamedata/gi.h
Expand Up @@ -182,6 +182,7 @@ struct gameinfo_t
FName mFontColorHighlight;
FName mFontColorSelection;
FName mSliderColor;
FName mSliderBackColor;
FString mBackButton;
double gibfactor;
int TextScreenX;
Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/mapinfo/chex.txt
Expand Up @@ -40,6 +40,7 @@ gameinfo
dimamount = 0.5
bluramount = 0.0
menuslidercolor = "Orange"
menusliderbackcolor = "White"
definventorymaxamount = 25
defaultrespawntime = 12
defaultdropstyle = 1
Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/mapinfo/doomcommon.txt
Expand Up @@ -40,6 +40,7 @@ gameinfo
dimamount = 0.5
bluramount = 0.0
menuslidercolor = "Orange"
menusliderbackcolor = "White"
definventorymaxamount = 25
defaultrespawntime = 12
defaultdropstyle = 1
Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/mapinfo/heretic.txt
Expand Up @@ -40,6 +40,7 @@ gameinfo
dimamount = 0.5
bluramount = 0
menuslidercolor = "Orange"
menusliderbackcolor = "White"
definventorymaxamount = 16
defaultrespawntime = 12
defaultdropstyle = 1
Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/mapinfo/hexen.txt
Expand Up @@ -39,6 +39,7 @@ gameinfo
dimamount = 0.5
bluramount = 0.0
menuslidercolor = "Orange"
menusliderbackcolor = "White"
definventorymaxamount = 25
defaultrespawntime = 12
defaultdropstyle = 1
Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/mapinfo/mindefaults.txt
Expand Up @@ -29,6 +29,7 @@ gameinfo
dimamount = 0.8
bluramount = 0.0
menuslidercolor = "Orange"
menusliderbackcolor = "White"
definventorymaxamount = 25
defaultrespawntime = 12
defaultdropstyle = 1
Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/mapinfo/strife.txt
Expand Up @@ -40,6 +40,7 @@ gameinfo
dimamount = 0.5
bluramount = 0
menuslidercolor = "Orange"
menusliderbackcolor = "White"
definventorymaxamount = 25
defaultrespawntime = 16
defaultdropstyle = 2
Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/zscript/engine/base.zs
Expand Up @@ -531,6 +531,7 @@ struct GameInfoStruct native
native int gametype;
native String mBackButton;
native Name mSliderColor;
native Name mSliderBackColor;
}

struct SystemTime
Expand Down
4 changes: 2 additions & 2 deletions wadsrc/static/zscript/engine/ui/menu/optionmenuitems.zs
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion wadsrc/static/zscript/ui/menu/playercontrols.zs
Expand Up @@ -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);
}

Expand Down

0 comments on commit a2b8ad7

Please sign in to comment.