This commit is contained in:
Rachael Alexanderson 2017-06-12 00:56:25 -04:00
commit 96df3aed01
3 changed files with 21 additions and 6 deletions

View file

@ -537,6 +537,7 @@ static bool FindMatchingItem(DMenuItemBase *desc)
if (grp == 5) return true; // static texts always match if (grp == 5) return true; // static texts always match
FName name = desc->mAction; FName name = desc->mAction;
if (grp == 1) if (grp == 1)
{ {
// Check for presence of menu // Check for presence of menu
@ -545,9 +546,17 @@ static bool FindMatchingItem(DMenuItemBase *desc)
} }
else if (grp == 4) else if (grp == 4)
{ {
static const FName CVarBlacklist[] = {
NAME_snd_waterlp, NAME_snd_output, NAME_snd_output_format, NAME_snd_speakermode, NAME_snd_resampler, NAME_AlwaysRun };
// Check for presence of CVAR and blacklist // Check for presence of CVAR and blacklist
auto cv = GetCVar(nullptr, name.GetChars()); auto cv = FindCVar(name.GetChars(), nullptr);
if (cv == nullptr) return true; if (cv == nullptr) return true;
for (auto bname : CVarBlacklist)
{
if (name == bname) return true;
}
} }
MenuDescriptorList::Iterator it(MenuDescriptors); MenuDescriptorList::Iterator it(MenuDescriptors);
@ -585,15 +594,16 @@ static bool ReplaceMenu(FScanner &sc, DMenuDescriptor *desc)
} }
if (desc->mItems.Size() > 0) if (desc->mItems.Size() > 0)
{ {
auto sep = CreateOptionMenuItemStaticText("---------------", CR_YELLOW); auto sep = CreateOptionMenuItemStaticText(" ");
(*pOld)->mItems.Push(sep);
sep = CreateOptionMenuItemStaticText("---------------", 1);
(*pOld)->mItems.Push(sep); (*pOld)->mItems.Push(sep);
for (auto it : desc->mItems) for (auto it : desc->mItems)
{ {
(*pOld)->mItems.Push(it); (*pOld)->mItems.Push(it);
} }
desc->mItems.Clear(); desc->mItems.Clear();
//sc.ScriptMessage("Merged %d items into %s", desc->mItems.Size(), desc->mMenuName.GetChars());
sc.ScriptMessage("Merged %d items into %s", desc->mItems.Size(), desc->mMenuName.GetChars());
} }
return true; return true;
} }

View file

@ -937,4 +937,10 @@ xx(OptionMenuFieldBase)
xx(OptionMenuItemColorPicker) xx(OptionMenuItemColorPicker)
xx(OptionMenuItemStaticText) xx(OptionMenuItemStaticText)
xx(OptionMenuItemStaticTextSwitchable) xx(OptionMenuItemStaticTextSwitchable)
xx(mAction)
// blacklisted former CVARs
xx(snd_waterlp)
xx(snd_output)
xx(snd_output_format)
xx(snd_speakermode)
xx(snd_resampler)

View file

@ -65,7 +65,6 @@
EXTERN_CVAR (Float, snd_sfxvolume) EXTERN_CVAR (Float, snd_sfxvolume)
CVAR (Int, snd_samplerate, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (Int, snd_samplerate, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (Int, snd_buffersize, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (Int, snd_buffersize, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (String, snd_output, "default", CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (Int, snd_hrtf, -1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (Int, snd_hrtf, -1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
#if !defined(NO_OPENAL) #if !defined(NO_OPENAL)