mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-14 00:20:38 +00:00
- added flag option menu item by Accensus.
This commit is contained in:
parent
8872f863d4
commit
bc2b0a0252
3 changed files with 63 additions and 2 deletions
|
@ -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;
|
||||
|
|
|
@ -579,7 +579,6 @@ void RecordTextureColors (FImageSource *pic, uint32_t *usedcolors)
|
|||
{
|
||||
usedcolors[pixels[x]]++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue