diff --git a/src/common/engine/sc_man.cpp b/src/common/engine/sc_man.cpp index 41b5c7719..fa9a2f6c4 100644 --- a/src/common/engine/sc_man.cpp +++ b/src/common/engine/sc_man.cpp @@ -529,7 +529,7 @@ bool FScanner::ScanString (bool tokens) LastGotLine = Line; // In case the generated scanner does not use marker, avoid compiler warnings. - marker; + // marker; #include "sc_man_scanner.h" LastGotToken = tokens; return return_val; diff --git a/src/common/fonts/font.cpp b/src/common/fonts/font.cpp index d5d57790e..2a67aab37 100644 --- a/src/common/fonts/font.cpp +++ b/src/common/fonts/font.cpp @@ -579,7 +579,6 @@ void RecordTextureColors (FImageSource *pic, uint32_t *usedcolors) { usedcolors[pixels[x]]++; } - } //========================================================================== diff --git a/wadsrc/static/zscript/ui/menu/optionmenuitems.zs b/wadsrc/static/zscript/ui/menu/optionmenuitems.zs index 3a69f5bee..c56b4796d 100644 --- a/wadsrc/static/zscript/ui/menu/optionmenuitems.zs +++ b/wadsrc/static/zscript/ui/menu/optionmenuitems.zs @@ -1234,3 +1234,65 @@ class OptionMenuItemScaleSlider : OptionMenuItemSlider } +//============================================================================= +// +// Flag option by Accensus +// +//============================================================================= + +class OptionMenuItemFlagOption : OptionMenuItemOption +{ + int mBitShift; + + OptionMenuItemFlagOption Init(String label, Name command, Name values, int bitShift, CVar greycheck = null, int center = 0) + { + Super.Init(label, command, values, greycheck, center); + mBitShift = bitShift; + + return self; + } + + override int GetSelection() + { + int Selection = 0; + 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