- connected reverb menu with its backing data

- added an entry to the main options menu to open the reverb editor.
This commit is contained in:
Christoph Oelckers 2017-11-26 20:11:14 +01:00
parent 57058ef727
commit a069949482
4 changed files with 47 additions and 7 deletions

View file

@ -894,7 +894,25 @@ DEFINE_ACTION_FUNCTION(DReverbEdit, GetValue)
{
PARAM_PROLOGUE;
PARAM_INT(index);
ACTION_RETURN_FLOAT(0);
float v;
if (index >= 0 && index < countof(ReverbFields))
{
auto rev = &ReverbFields[index];
if (rev->Int != nullptr)
{
v = float(CurrentEnv->Properties.*(rev->Int));
}
else if (rev->Float != nullptr)
{
v = CurrentEnv->Properties.*(rev->Float);
}
else
{
v = !!(CurrentEnv->Properties.Flags & (1 << int(rev->Flag)));
}
}
ACTION_RETURN_FLOAT(v);
return 1;
}
@ -902,8 +920,27 @@ DEFINE_ACTION_FUNCTION(DReverbEdit, SetValue)
{
PARAM_PROLOGUE;
PARAM_INT(index);
PARAM_FLOAT(value);
ACTION_RETURN_FLOAT(value);
PARAM_FLOAT(v);
if (index >= 0 && index < countof(ReverbFields))
{
auto rev = &ReverbFields[index];
if (rev->Int != nullptr)
{
v = CurrentEnv->Properties.*(rev->Int) = clamp<int>(int(v), rev->Min, rev->Max);
}
else if (rev->Float != nullptr)
{
v = CurrentEnv->Properties.*(rev->Float) = clamp<float>(float(v), rev->Min / 1000.f, rev->Max / 1000.f);
}
else
{
if (v == 0) CurrentEnv->Properties.Flags &= ~(1 << int(rev->Flag));
else CurrentEnv->Properties.Flags |= (1 << int(rev->Flag));
}
}
ACTION_RETURN_FLOAT(v);
return 1;
}
@ -1017,7 +1054,7 @@ CCMD(createenvironment)
M_StartMessage(FStringf("An environment with the name '%s' already exists", *reverbedit_name), 1);
return;
}
int id = (reverbedit_id1 * 255) + reverbedit_id2;
int id = (reverbedit_id1 << 8) + reverbedit_id2;
if (S_FindEnvironment(id))
{
M_StartMessage(FStringf("An environment with the ID (%d, %d) already exists", *reverbedit_id1, *reverbedit_id2), 1);

View file

@ -1682,6 +1682,7 @@ OPTMNU_CHANGERENDER = "Change Rendering Output";
OPTMNU_DEFAULTS = "Reset to defaults";
OPTMNU_RESETTOSAVED = "Reset to last saved";
OPTMNU_CONSOLE = "Go to console";
OPTMNU_REVERB = "Reverb environment editor";
// Controls Menu

View file

@ -354,6 +354,8 @@ OptionMenu "OptionsMenu" protected
Submenu "$OPTMNU_VIDEO", "VideoModeMenu"
Submenu "$OPTMNU_CHANGERENDER", "RendererMenu"
StaticText " "
Submenu "$OPTMNU_REVERB", "ReverbEdit"
StaticText " "
SafeCommand "$OPTMNU_DEFAULTS", "reset2defaults"
SafeCommand "$OPTMNU_RESETTOSAVED", "reset2saved"
Command "$OPTMNU_CONSOLE", "menuconsole"
@ -2207,7 +2209,7 @@ OptionMenu "OpenGLOptions" protected
OptionMenu "ReverbEdit" protected
{
Class "ReverbEdit"
Title "Reverb Environment Editor"
Title "$OPTMNU_REVERB"
StaticTextSwitchable "", "", "EvironmentName", 1
StaticTextSwitchable "", "", "EvironmentID"
StaticText " "
@ -2232,7 +2234,7 @@ OptionMenu "ReverbSettings" protected
SafeCommand "Revert settings", "revertenvironment"
StaticText " "
SliderReverbEditOption "Environment Size", 1, 100, 0.01, 3, 1
SliderReverbEditOption "Environment Diffusion", 0, 10, 0.01, 3, 2
SliderReverbEditOption "Environment Diffusion", 0, 1, 0.01, 3, 2
SliderReverbEditOption "Room", -10000, 0, 1, 0, 3
SliderReverbEditOption "Room HF", -10000, 0, 1, 0, 4
SliderReverbEditOption "Room LF", -10000, 0, 1, 0, 5

View file

@ -168,7 +168,7 @@ class OptionMenuItemSliderReverbEditOption : OptionMenuSliderBase
//=============================================================================
override int Draw(OptionMenuDescriptor desc, int y, int indent, bool selected)
{
drawLabel(indent, y, selected ? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, Selectable());
drawLabel(indent, y, selected ? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, ReverbEdit.GrayCheck());
int DrawX = indent + CursorSpace();
if (mEnter)