Commit 1505886e authored by Accensus's avatar Accensus
Browse files

- Replace VisibilityOption to FlagOption. This locks the mod to require GZDoom 4.5.0 and above.

parent a22417ec
......@@ -73,18 +73,18 @@ OptionMenu "WT_LiteHudMenu"
Slider "Opacity", "wt_lite_alpha", 0.1, 1.0, 0.05, 2
StaticText ""
StaticText "----- Visibility Options -----", "Teal"
VisibilityOption "Player Name", "wt_lite_adv_visibility", "OnOff", 0
VisibilityOption "Total Kills", "wt_lite_adv_visibility", "OnOff", 1
VisibilityOption "Genocide Rank", "wt_lite_adv_visibility", "OnOff", 2
VisibilityOption "Genocide Medal", "wt_lite_adv_visibility", "OnOff", 3
VisibilityOption "Player Rank", "wt_lite_adv_visibility", "OnOff", 4
VisibilityOption "Player Experience", "wt_lite_adv_visibility", "OnOff", 5
VisibilityOption "Player Medal", "wt_lite_adv_visibility", "OnOff", 6
FlagOption "Player Name", "wt_lite_adv_visibility", "OnOff", 0
FlagOption "Total Kills", "wt_lite_adv_visibility", "OnOff", 1
FlagOption "Genocide Rank", "wt_lite_adv_visibility", "OnOff", 2
FlagOption "Genocide Medal", "wt_lite_adv_visibility", "OnOff", 3
FlagOption "Player Rank", "wt_lite_adv_visibility", "OnOff", 4
FlagOption "Player Experience", "wt_lite_adv_visibility", "OnOff", 5
FlagOption "Player Medal", "wt_lite_adv_visibility", "OnOff", 6
StaticText ""
VisibilityOption "Weapon Name", "wt_lite_adv_visibility", "OnOff", 7
VisibilityOption "Weapon Rank", "wt_lite_adv_visibility", "OnOff", 8
VisibilityOption "Weapon Kills", "wt_lite_adv_visibility", "OnOff", 9
VisibilityOption "Weapon Medals", "wt_lite_adv_visibility", "OnOff", 10
FlagOption "Weapon Name", "wt_lite_adv_visibility", "OnOff", 7
FlagOption "Weapon Rank", "wt_lite_adv_visibility", "OnOff", 8
FlagOption "Weapon Kills", "wt_lite_adv_visibility", "OnOff", 9
FlagOption "Weapon Medals", "wt_lite_adv_visibility", "OnOff", 10
}
OptionMenu "WT_LiteHudFoldersMenu"
......
version 4.3
version 4.5
#include "ZScript/WT_Menu.zsc"
#include "ZScript/WT_MainHandler.zsc"
......
......@@ -47,61 +47,4 @@ class OptionMenuItemHudColorOption : OptionMenuItemOption
CustomDrawValue(indent, y, OptionMenuSettings.mFontColorValue, text, isGrayed());
return indent;
}
}
class OptionMenuItemVisibilityOption : OptionMenuItemOption
{
int mBitShift;
OptionMenuItemVisibilityOption Init(String label, Name command, Name values, int bitShift)
{
Super.Init(label, command, values);
mBitShift = bitShift;
return self;
}
override int GetSelection()
{
int Selection = 0; // [Ace] Normally -1, but this is guaranteed to have only 2 states. Unless someone got the genius idea of using anything other than "OnOff" for the OptionValue.
int cnt = OptionValues.GetCount(mValues);
if (cnt > 0 && mCVar != null)
{
if (OptionValues.GetTextValue(mValues, 0).Length() == 0)
{
int CurrentFlags = mCVar.GetInt();
for (int i = 0; i < cnt; i++)
{
int OptionValue = int(OptionValues.GetValue(mValues, i));
if (CurrentFlags & OptionValue << mBitShift)
{
Selection = i;
break;
}
}
}
}
return Selection;
}
override void SetSelection(int Selection)
{
int cnt = OptionValues.GetCount(mValues);
if (cnt > 0 && mCVar != null)
{
if (OptionValues.GetTextValue(mValues, 0).Length() == 0)
{
int OptionValue = int(OptionValues.GetValue(mValues, Selection));
int CurrentFlags = mCVar.GetInt();
switch (OptionValue)
{
case 0: CurrentFlags &= ~(1 << mBitShift); break;
case 1: CurrentFlags |= (1 << mBitShift); break;
}
mCVar.SetInt(CurrentFlags);
}
}
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment