Add secondary menus (#1895)

* Support secondary menus

* Move gyro to secondary menu

* Add sfx to gyro calibration popup

* Move EQ to secondary menu
This commit is contained in:
ceski 2024-09-10 07:31:39 -07:00 committed by GitHub
parent 45dcc36258
commit 47e59972c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 509 additions and 254 deletions

View File

@ -197,6 +197,8 @@ typedef enum {
ss_enem, ss_enem,
ss_gen, // killough 10/98 ss_gen, // killough 10/98
ss_comp, // killough 10/98 ss_comp, // killough 10/98
ss_eq,
ss_gyro,
ss_max ss_max
} ss_types; } ss_types;

View File

@ -790,32 +790,38 @@ void I_RefreshGyroSettings(void)
motion.tightening = gyro_tightening / 10.0f * PI_F / 180.0f; motion.tightening = gyro_tightening / 10.0f * PI_F / 180.0f;
} }
#define BIND_NUM_GYRO(name, v, a, b, help) \
M_BindNum(#name, &name, NULL, (v), (a), (b), ss_gyro, wad_no, help)
#define BIND_BOOL_GYRO(name, v, help) \
M_BindBool(#name, &name, NULL, (v), ss_gyro, wad_no, help)
void I_BindGyroVaribales(void) void I_BindGyroVaribales(void)
{ {
BIND_BOOL_GENERAL(gyro_enable, false, BIND_BOOL_GYRO(gyro_enable, false,
"Enable gamepad gyro aiming"); "Enable gamepad gyro aiming");
BIND_NUM_GENERAL(gyro_space, BIND_NUM_GYRO(gyro_space,
SPACE_PLAYER_TURN, SPACE_LOCAL_TURN, SPACE_PLAYER_LEAN, SPACE_PLAYER_TURN, SPACE_LOCAL_TURN, SPACE_PLAYER_LEAN,
"Gyro space (0 = Local Turn; 1 = Local Lean; 2 = Player Turn; " "Gyro space (0 = Local Turn; 1 = Local Lean; 2 = Player Turn; "
"3 = Player Lean)"); "3 = Player Lean)");
BIND_NUM_GENERAL(gyro_button_action, BIND_NUM_GYRO(gyro_button_action,
ACTION_ENABLE, ACTION_NONE, ACTION_INVERT, ACTION_ENABLE, ACTION_NONE, ACTION_INVERT,
"Gyro button action (0 = None; 1 = Disable Gyro; 2 = Enable Gyro; " "Gyro button action (0 = None; 1 = Disable Gyro; 2 = Enable Gyro; "
"3 = Invert)"); "3 = Invert)");
BIND_NUM_GENERAL(gyro_stick_action, BIND_NUM_GYRO(gyro_stick_action,
ACTION_NONE, ACTION_NONE, ACTION_ENABLE, ACTION_NONE, ACTION_NONE, ACTION_ENABLE,
"Camera stick action (0 = None; 1 = Disable Gyro; 2 = Enable Gyro)"); "Camera stick action (0 = None; 1 = Disable Gyro; 2 = Enable Gyro)");
BIND_NUM_GENERAL(gyro_turn_speed, 10, 0, 100, BIND_NUM_GYRO(gyro_turn_speed, 10, 0, 100,
"Gyro turn speed (0 = 0.0x; 100 = 10.0x)"); "Gyro turn speed (0 = 0.0x; 100 = 10.0x)");
BIND_NUM_GENERAL(gyro_look_speed, 10, 0, 100, BIND_NUM_GYRO(gyro_look_speed, 10, 0, 100,
"Gyro look speed (0 = 0.0x; 100 = 10.0x)"); "Gyro look speed (0 = 0.0x; 100 = 10.0x)");
BIND_NUM_GENERAL(gyro_acceleration, 20, 10, 40, BIND_NUM_GYRO(gyro_acceleration, 20, 10, 40,
"Gyro acceleration multiplier (10 = 1.0x; 40 = 4.0x)"); "Gyro acceleration multiplier (10 = 1.0x; 40 = 4.0x)");
BIND_NUM(gyro_accel_min_threshold, 0, 0, 200, BIND_NUM(gyro_accel_min_threshold, 0, 0, 200,
"Lower threshold for applying gyro acceleration [degrees/second]"); "Lower threshold for applying gyro acceleration [degrees/second]");
BIND_NUM(gyro_accel_max_threshold, 75, 0, 200, BIND_NUM(gyro_accel_max_threshold, 75, 0, 200,
"Upper threshold for applying gyro acceleration [degrees/second]"); "Upper threshold for applying gyro acceleration [degrees/second]");
BIND_NUM_GENERAL(gyro_smooth_threshold, 30, 0, 100, BIND_NUM_GYRO(gyro_smooth_threshold, 30, 0, 100,
"Gyro steadying: smoothing threshold " "Gyro steadying: smoothing threshold "
"(0 = Off; 100 = 10.0 degrees/second)"); "(0 = Off; 100 = 10.0 degrees/second)");
BIND_NUM(gyro_smooth_time, 125, 0, 500, BIND_NUM(gyro_smooth_time, 125, 0, 500,

View File

@ -25,19 +25,39 @@
#include "i_oalcommon.h" #include "i_oalcommon.h"
#include "i_oalequalizer.h" #include "i_oalequalizer.h"
#include "i_sound.h" #include "i_sound.h"
#include "m_config.h"
#include "mn_menu.h"
eq_preset_t snd_equalizer; #define EQF(T, ptr) ((ALFUNC(T, ptr)) != NULL)
int snd_eq_preamp;
int snd_eq_low_gain; typedef enum
int snd_eq_low_cutoff; {
int snd_eq_mid1_gain; EQ_PRESET_OFF,
int snd_eq_mid1_center; EQ_PRESET_CLASSICAL,
int snd_eq_mid1_width; EQ_PRESET_ROCK,
int snd_eq_mid2_gain; EQ_PRESET_VOCAL,
int snd_eq_mid2_center; EQ_PRESET_CUSTOM,
int snd_eq_mid2_width; NUM_EQ_PRESETS
int snd_eq_high_gain; } eq_preset_t;
int snd_eq_high_cutoff;
static eq_preset_t snd_equalizer, default_equalizer;
static int snd_eq_preamp, default_preamp;
static int snd_eq_low_gain, default_low_gain;
static int snd_eq_low_cutoff, default_low_cutoff;
static int snd_eq_mid1_gain, default_mid1_gain;
static int snd_eq_mid1_center, default_mid1_center;
static int snd_eq_mid1_width, default_mid1_width;
static int snd_eq_mid2_gain, default_mid2_gain;
static int snd_eq_mid2_center, default_mid2_center;
static int snd_eq_mid2_width, default_mid2_width;
static int snd_eq_high_gain, default_high_gain;
static int snd_eq_high_cutoff, default_high_cutoff;
static boolean initialized;
static ALuint uiEffectSlot;
static ALuint uiEffect;
static ALuint uiFilter;
static LPALGENAUXILIARYEFFECTSLOTS alGenAuxiliaryEffectSlots; static LPALGENAUXILIARYEFFECTSLOTS alGenAuxiliaryEffectSlots;
static LPALDELETEAUXILIARYEFFECTSLOTS alDeleteAuxiliaryEffectSlots; static LPALDELETEAUXILIARYEFFECTSLOTS alDeleteAuxiliaryEffectSlots;
@ -54,66 +74,46 @@ static LPALISFILTER alIsFilter;
static LPALFILTERI alFilteri; static LPALFILTERI alFilteri;
static LPALFILTERF alFilterf; static LPALFILTERF alFilterf;
void I_OAL_InitEqualizer(void) static void BackupCustomPreset(void)
{ {
ALCint iSends = 0; snd_eq_preamp = default_preamp;
snd_eq_low_gain = default_low_gain;
if (!oal || !oal->EXT_EFX) snd_eq_low_cutoff = default_low_cutoff;
{ snd_eq_mid1_gain = default_mid1_gain;
return; snd_eq_mid1_center = default_mid1_center;
} snd_eq_mid1_width = default_mid1_width;
snd_eq_mid2_gain = default_mid2_gain;
// Check the actual number of Auxiliary Sends available on each Source. snd_eq_mid2_center = default_mid2_center;
snd_eq_mid2_width = default_mid2_width;
alcGetIntegerv(oal->device, ALC_MAX_AUXILIARY_SENDS, 1, &iSends); snd_eq_high_gain = default_high_gain;
snd_eq_high_cutoff = default_high_cutoff;
if (iSends < 1)
{
return;
}
ALFUNC(LPALGENAUXILIARYEFFECTSLOTS, alGenAuxiliaryEffectSlots);
ALFUNC(LPALDELETEAUXILIARYEFFECTSLOTS, alDeleteAuxiliaryEffectSlots);
ALFUNC(LPALISAUXILIARYEFFECTSLOT, alIsAuxiliaryEffectSlot);
ALFUNC(LPALGENEFFECTS, alGenEffects);
ALFUNC(LPALDELETEEFFECTS, alDeleteEffects);
ALFUNC(LPALISEFFECT, alIsEffect);
ALFUNC(LPALEFFECTI, alEffecti);
ALFUNC(LPALEFFECTF, alEffectf);
ALFUNC(LPALAUXILIARYEFFECTSLOTI, alAuxiliaryEffectSloti);
ALFUNC(LPALGENFILTERS, alGenFilters);
ALFUNC(LPALDELETEFILTERS, alDeleteFilters);
ALFUNC(LPALISFILTER, alIsFilter);
ALFUNC(LPALFILTERI, alFilteri);
ALFUNC(LPALFILTERF, alFilterf);
} }
void I_OAL_SetEqualizer(void) static void RestoreCustomPreset(void)
{ {
static ALuint uiEffectSlot = AL_INVALID; default_preamp = snd_eq_preamp;
static ALuint uiEffect = AL_INVALID; default_low_gain = snd_eq_low_gain;
static ALuint uiFilter = AL_INVALID; default_low_cutoff = snd_eq_low_cutoff;
default_mid1_gain = snd_eq_mid1_gain;
default_mid1_center = snd_eq_mid1_center;
default_mid1_width = snd_eq_mid1_width;
default_mid2_gain = snd_eq_mid2_gain;
default_mid2_center = snd_eq_mid2_center;
default_mid2_width = snd_eq_mid2_width;
default_high_gain = snd_eq_high_gain;
default_high_cutoff = snd_eq_high_cutoff;
}
if (!alGenAuxiliaryEffectSlots || static void StopEffects(void)
!alDeleteAuxiliaryEffectSlots || {
!alIsAuxiliaryEffectSlot || for (int i = 0; i < MAX_CHANNELS; i++)
!alGenEffects ||
!alDeleteEffects ||
!alIsEffect ||
!alEffecti ||
!alEffectf ||
!alAuxiliaryEffectSloti ||
!alGenFilters ||
!alDeleteFilters ||
!alIsFilter ||
!alFilteri ||
!alFilterf)
{ {
return; alSourceStop(oal->sources[i]);
} }
}
// Unload all effects first. static void UnloadEffects(void)
{
if (alIsAuxiliaryEffectSlot(uiEffectSlot)) if (alIsAuxiliaryEffectSlot(uiEffectSlot))
{ {
for (int i = 0; i < MAX_CHANNELS; i++) for (int i = 0; i < MAX_CHANNELS; i++)
@ -135,8 +135,85 @@ void I_OAL_SetEqualizer(void)
{ {
alDeleteFilters(1, &uiFilter); alDeleteFilters(1, &uiFilter);
} }
}
if (snd_equalizer == EQ_PRESET_OFF) void I_OAL_ShutdownEqualizer(void)
{
RestoreCustomPreset();
if (initialized)
{
UnloadEffects();
initialized = false;
}
}
boolean I_OAL_EqualizerInitialized(void)
{
return initialized;
}
boolean I_OAL_CustomEqualizer(void)
{
return (initialized && default_equalizer == EQ_PRESET_CUSTOM);
}
void I_OAL_InitEqualizer(void)
{
BackupCustomPreset();
snd_equalizer = default_equalizer;
if (!oal || !oal->EXT_EFX || !oal->device || !oal->sources)
{
return;
}
// Check the actual number of Auxiliary Sends available on each Source.
ALCint iSends = 0;
alcGetIntegerv(oal->device, ALC_MAX_AUXILIARY_SENDS, 1, &iSends);
if (iSends < 1)
{
return;
}
initialized = (
EQF(LPALGENAUXILIARYEFFECTSLOTS, alGenAuxiliaryEffectSlots)
&& EQF(LPALDELETEAUXILIARYEFFECTSLOTS, alDeleteAuxiliaryEffectSlots)
&& EQF(LPALISAUXILIARYEFFECTSLOT, alIsAuxiliaryEffectSlot)
&& EQF(LPALGENEFFECTS, alGenEffects)
&& EQF(LPALDELETEEFFECTS, alDeleteEffects)
&& EQF(LPALISEFFECT, alIsEffect)
&& EQF(LPALEFFECTI, alEffecti)
&& EQF(LPALEFFECTF, alEffectf)
&& EQF(LPALAUXILIARYEFFECTSLOTI, alAuxiliaryEffectSloti)
&& EQF(LPALGENFILTERS, alGenFilters)
&& EQF(LPALDELETEFILTERS, alDeleteFilters)
&& EQF(LPALISFILTER, alIsFilter)
&& EQF(LPALFILTERI, alFilteri)
&& EQF(LPALFILTERF, alFilterf)
);
if (initialized)
{
I_OAL_EqualizerPreset();
}
}
void I_OAL_SetEqualizer(void)
{
if (!initialized)
{
return;
}
// Unload all effects first.
StopEffects();
UnloadEffects();
if (default_equalizer == EQ_PRESET_OFF)
{ {
return; return;
} }
@ -162,22 +239,22 @@ void I_OAL_SetEqualizer(void)
#define OCTAVE(x) ((ALfloat)BETWEEN(0.01f, 1.0f, (x) / 100.0f)) #define OCTAVE(x) ((ALfloat)BETWEEN(0.01f, 1.0f, (x) / 100.0f))
// Low // Low
alEffectf(uiEffect, AL_EQUALIZER_LOW_GAIN, EQ_GAIN(snd_eq_low_gain)); alEffectf(uiEffect, AL_EQUALIZER_LOW_GAIN, EQ_GAIN(default_low_gain));
alEffectf(uiEffect, AL_EQUALIZER_LOW_CUTOFF, (ALfloat)snd_eq_low_cutoff); alEffectf(uiEffect, AL_EQUALIZER_LOW_CUTOFF, (ALfloat)default_low_cutoff);
// Mid 1 // Mid 1
alEffectf(uiEffect, AL_EQUALIZER_MID1_GAIN, EQ_GAIN(snd_eq_mid1_gain)); alEffectf(uiEffect, AL_EQUALIZER_MID1_GAIN, EQ_GAIN(default_mid1_gain));
alEffectf(uiEffect, AL_EQUALIZER_MID1_CENTER, (ALfloat)snd_eq_mid1_center); alEffectf(uiEffect, AL_EQUALIZER_MID1_CENTER, (ALfloat)default_mid1_center);
alEffectf(uiEffect, AL_EQUALIZER_MID1_WIDTH, OCTAVE(snd_eq_mid1_width)); alEffectf(uiEffect, AL_EQUALIZER_MID1_WIDTH, OCTAVE(default_mid1_width));
// Mid 2 // Mid 2
alEffectf(uiEffect, AL_EQUALIZER_MID2_GAIN, EQ_GAIN(snd_eq_mid2_gain)); alEffectf(uiEffect, AL_EQUALIZER_MID2_GAIN, EQ_GAIN(default_mid2_gain));
alEffectf(uiEffect, AL_EQUALIZER_MID2_CENTER, (ALfloat)snd_eq_mid2_center); alEffectf(uiEffect, AL_EQUALIZER_MID2_CENTER, (ALfloat)default_mid2_center);
alEffectf(uiEffect, AL_EQUALIZER_MID2_WIDTH, OCTAVE(snd_eq_mid2_width)); alEffectf(uiEffect, AL_EQUALIZER_MID2_WIDTH, OCTAVE(default_mid2_width));
// High // High
alEffectf(uiEffect, AL_EQUALIZER_HIGH_GAIN, EQ_GAIN(snd_eq_high_gain)); alEffectf(uiEffect, AL_EQUALIZER_HIGH_GAIN, EQ_GAIN(default_high_gain));
alEffectf(uiEffect, AL_EQUALIZER_HIGH_CUTOFF, (ALfloat)snd_eq_high_cutoff); alEffectf(uiEffect, AL_EQUALIZER_HIGH_CUTOFF, (ALfloat)default_high_cutoff);
alAuxiliaryEffectSloti(uiEffectSlot, AL_EFFECTSLOT_EFFECT, uiEffect); alAuxiliaryEffectSloti(uiEffectSlot, AL_EFFECTSLOT_EFFECT, uiEffect);
@ -188,7 +265,7 @@ void I_OAL_SetEqualizer(void)
alSourcei(oal->sources[i], AL_DIRECT_FILTER, uiFilter); alSourcei(oal->sources[i], AL_DIRECT_FILTER, uiFilter);
// Keep the wet path. // Keep the wet path.
alFilterf(uiFilter, AL_LOWPASS_GAIN, LP_GAIN(snd_eq_preamp)); alFilterf(uiFilter, AL_LOWPASS_GAIN, LP_GAIN(default_preamp));
alSource3i(oal->sources[i], AL_AUXILIARY_SEND_FILTER, uiEffectSlot, 0, alSource3i(oal->sources[i], AL_AUXILIARY_SEND_FILTER, uiEffectSlot, 0,
uiFilter); uiFilter);
} }
@ -196,38 +273,100 @@ void I_OAL_SetEqualizer(void)
void I_OAL_EqualizerPreset(void) void I_OAL_EqualizerPreset(void)
{ {
if (!initialized)
{
return;
}
struct struct
{ {
int *var; int *var;
int val[NUM_EQ_PRESETS]; int val[NUM_EQ_PRESETS - 1];
} eq_presets[] = } eq_presets[] =
{ // Preamp Off, Classical, Rock, Vocal { // Preamp Off, Classical, Rock, Vocal
{&snd_eq_preamp, { 0, -4, -5, -4}}, // -24 to 0 {&default_preamp, { 0, -4, -5, -4}}, // -24 to 0
// Low // Low
{&snd_eq_low_gain, { 0, 4, 0, -2}}, // -12 to 12 {&default_low_gain, { 0, 4, 0, -2}}, // -12 to 12
{&snd_eq_low_cutoff, { 200, 125, 200, 125}}, // 50 to 800 {&default_low_cutoff, { 200, 125, 200, 125}}, // 50 to 800
// Mid 1 // Mid 1
{&snd_eq_mid1_gain, { 0, 1, 3, 3}}, // -12 to 12 {&default_mid1_gain, { 0, 1, 3, 3}}, // -12 to 12
{&snd_eq_mid1_center, { 500, 200, 250, 650}}, // 200 to 3000 {&default_mid1_center, { 500, 200, 250, 650}}, // 200 to 3000
{&snd_eq_mid1_width, { 100, 100, 100, 100}}, // 1 to 100 {&default_mid1_width, { 100, 100, 100, 100}}, // 1 to 100
// Mid 2 // Mid 2
{&snd_eq_mid2_gain, { 0, 0, 1, 3}}, // -12 to 12 {&default_mid2_gain, { 0, 0, 1, 3}}, // -12 to 12
{&snd_eq_mid2_center, { 3000, 3000, 3000, 1550}}, // 1000 to 8000 {&default_mid2_center, { 3000, 3000, 3000, 1550}}, // 1000 to 8000
{&snd_eq_mid2_width, { 100, 100, 100, 100}}, // 1 to 100 {&default_mid2_width, { 100, 100, 100, 100}}, // 1 to 100
// High // High
{&snd_eq_high_gain, { 0, 2, 5, 1}}, // -12 to 12 {&default_high_gain, { 0, 2, 5, 1}}, // -12 to 12
{&snd_eq_high_cutoff, { 6000, 8000, 6000, 10000}}, // 4000 to 16000 {&default_high_cutoff, { 6000, 8000, 6000, 10000}}, // 4000 to 16000
}; };
for (int i = 0; i < arrlen(eq_presets); i++) if (default_equalizer == EQ_PRESET_CUSTOM
&& snd_equalizer != EQ_PRESET_CUSTOM)
{ {
*eq_presets[i].var = eq_presets[i].val[snd_equalizer]; RestoreCustomPreset();
}
else if (snd_equalizer == EQ_PRESET_CUSTOM)
{
BackupCustomPreset();
} }
if (default_equalizer < NUM_EQ_PRESETS - 1)
{
for (int i = 0; i < arrlen(eq_presets); i++)
{
*eq_presets[i].var = eq_presets[i].val[default_equalizer];
}
}
snd_equalizer = default_equalizer;
I_OAL_SetEqualizer(); I_OAL_SetEqualizer();
MN_UpdateEqualizerItems();
} }
#define BIND_NUM_EQ(name, default_name, v, a, b, help) \
M_BindNum(#name, &default_name, &name, (v), (a), (b), ss_eq, wad_no, help)
void I_BindEqualizerVariables(void)
{
BIND_NUM_EQ(snd_equalizer, default_equalizer,
EQ_PRESET_OFF, EQ_PRESET_OFF, EQ_PRESET_CUSTOM,
"Equalizer preset (0 = Off; 1 = Classical; 2 = Rock; 3 = Vocal; "
"4 = Custom)");
// Preamp
BIND_NUM_EQ(snd_eq_preamp, default_preamp, 0, -24, 0,
"Equalizer preamp gain [dB]");
// Low
BIND_NUM_EQ(snd_eq_low_gain, default_low_gain, 0, -12, 12,
"Equalizer low frequency range gain [dB]");
BIND_NUM_EQ(snd_eq_low_cutoff, default_low_cutoff, 200, 50, 800,
"Equalizer low cut-off frequency [Hz]");
// Mid 1
BIND_NUM_EQ(snd_eq_mid1_gain, default_mid1_gain, 0, -12, 12,
"Equalizer mid1 frequency range gain [dB]");
BIND_NUM_EQ(snd_eq_mid1_center, default_mid1_center, 500, 200, 3000,
"Equalizer mid1 center frequency [Hz]");
BIND_NUM_EQ(snd_eq_mid1_width, default_mid1_width, 100, 1, 100,
"Equalizer mid1 bandwidth [octave] (1 = 0.01; 100 = 1.0)");
// Mid 2
BIND_NUM_EQ(snd_eq_mid2_gain, default_mid2_gain, 0, -12, 12,
"Equalizer mid2 frequency range gain [dB]");
BIND_NUM_EQ(snd_eq_mid2_center, default_mid2_center, 3000, 1000, 8000,
"Equalizer mid2 center frequency [Hz]");
BIND_NUM_EQ(snd_eq_mid2_width, default_mid2_width, 100, 1, 100,
"Equalizer mid2 bandwidth [octave] (1 = 0.01; 100 = 1.0)");
// High
BIND_NUM_EQ(snd_eq_high_gain, default_high_gain, 0, -12, 12,
"Equalizer high frequency range gain [dB]");
BIND_NUM_EQ(snd_eq_high_cutoff, default_high_cutoff, 6000, 4000, 16000,
"Equalizer high cut-off frequency [Hz]");
}

View File

@ -19,31 +19,15 @@
#ifndef __I_OALEQUALIZER__ #ifndef __I_OALEQUALIZER__
#define __I_OALEQUALIZER__ #define __I_OALEQUALIZER__
typedef enum { #include "doomtype.h"
EQ_PRESET_OFF,
EQ_PRESET_CLASSICAL,
EQ_PRESET_ROCK,
EQ_PRESET_VOCAL,
NUM_EQ_PRESETS
} eq_preset_t;
extern eq_preset_t snd_equalizer;
extern int snd_eq_preamp;
extern int snd_eq_low_gain;
extern int snd_eq_low_cutoff;
extern int snd_eq_mid1_gain;
extern int snd_eq_mid1_center;
extern int snd_eq_mid1_width;
extern int snd_eq_mid2_gain;
extern int snd_eq_mid2_center;
extern int snd_eq_mid2_width;
extern int snd_eq_high_gain;
extern int snd_eq_high_cutoff;
boolean I_OAL_EqualizerInitialized(void);
boolean I_OAL_CustomEqualizer(void);
void I_OAL_ShutdownEqualizer(void);
void I_OAL_InitEqualizer(void); void I_OAL_InitEqualizer(void);
void I_OAL_SetEqualizer(void); void I_OAL_SetEqualizer(void);
void I_OAL_EqualizerPreset(void); void I_OAL_EqualizerPreset(void);
void I_BindEqualizerVariables(void);
#endif #endif

View File

@ -143,9 +143,9 @@ void I_OAL_ShutdownModule(void)
void I_OAL_ShutdownSound(void) void I_OAL_ShutdownSound(void)
{ {
int i; I_OAL_ShutdownEqualizer();
for (i = 0; i < MAX_CHANNELS; ++i) for (int i = 0; i < MAX_CHANNELS; ++i)
{ {
I_OAL_StopSound(i); I_OAL_StopSound(i);
} }
@ -448,39 +448,6 @@ void I_OAL_BindSoundVariables(void)
BIND_NUM(snd_doppler, 0, 0, 10, BIND_NUM(snd_doppler, 0, 0, 10,
"[OpenAL 3D] Doppler effect (0 = Off; 10 = Max)"); "[OpenAL 3D] Doppler effect (0 = Off; 10 = Max)");
BIND_BOOL(snd_limiter, false, "Use sound output limiter"); BIND_BOOL(snd_limiter, false, "Use sound output limiter");
BIND_NUM(snd_equalizer, EQ_PRESET_OFF, EQ_PRESET_OFF, EQ_PRESET_VOCAL,
"Equalizer preset (0 = Off; 1 = Classical; 2 = Rock; 3 = Vocal");
BIND_NUM(snd_eq_preamp, 0, -24, 0,
"Equalizer preamp gain [dB]");
// Low
BIND_NUM(snd_eq_low_gain, 0, -12, 12,
"Equalizer low frequency range gain [dB]");
BIND_NUM(snd_eq_low_cutoff, 200, 50, 800,
"Equalizer low cut-off frequency [Hz]");
// Mid 1
BIND_NUM(snd_eq_mid1_gain, 0, -12, 12,
"Equalizer mid1 frequency range gain [dB]");
BIND_NUM(snd_eq_mid1_center, 500, 200, 3000,
"Equalizer mid1 center frequency [Hz]");
BIND_NUM(snd_eq_mid1_width, 100, 1, 100,
"Equalizer mid1 bandwidth [octave] (1 = 0.01; 100 = 1.0)");
// Mid 2
BIND_NUM(snd_eq_mid2_gain, 0, -12, 12,
"Equalizer mid2 frequency range gain [dB]");
BIND_NUM(snd_eq_mid2_center, 3000, 1000, 8000,
"Equalizer mid2 center frequency [Hz]");
BIND_NUM(snd_eq_mid2_width, 100, 1, 100,
"Equalizer mid2 bandwidth [octave] (1 = 0.01; 100 = 1.0)");
// High
BIND_NUM(snd_eq_high_gain, 0, -12, 12,
"Equalizer high frequency range gain [dB]");
BIND_NUM(snd_eq_high_cutoff, 6000, 4000, 16000,
"Equalizer high cut-off frequency [Hz]");
} }
boolean I_OAL_InitSound(int snd_module) boolean I_OAL_InitSound(int snd_module)

View File

@ -38,6 +38,7 @@
#include "i_flickstick.h" #include "i_flickstick.h"
#include "i_gamepad.h" #include "i_gamepad.h"
#include "i_gyro.h" #include "i_gyro.h"
#include "i_oalequalizer.h"
#include "i_printf.h" #include "i_printf.h"
#include "i_rumble.h" #include "i_rumble.h"
#include "i_sound.h" #include "i_sound.h"
@ -113,6 +114,7 @@ void M_InitConfig(void)
R_BindRenderVariables(); R_BindRenderVariables();
I_BindSoundVariables(); I_BindSoundVariables();
I_BindEqualizerVariables();
MN_BindMenuVariables(); MN_BindMenuVariables();
D_BindMiscVariables(); D_BindMiscVariables();

View File

@ -70,6 +70,7 @@ void MN_SetNextMenuAlt(ss_types type);
boolean MN_PointInsideRect(mrect_t *rect, int x, int y); boolean MN_PointInsideRect(mrect_t *rect, int x, int y);
void MN_ClearMenus(void); void MN_ClearMenus(void);
void MN_Back(void); void MN_Back(void);
void MN_BackSecondary(void);
#define M_X_CENTER (-1) #define M_X_CENTER (-1)
@ -94,6 +95,8 @@ void MN_DrawStatusHUD(void);
void MN_DrawAutoMap(void); void MN_DrawAutoMap(void);
void MN_DrawWeapons(void); void MN_DrawWeapons(void);
void MN_DrawEnemy(void); void MN_DrawEnemy(void);
void MN_DrawGyro(void);
void MN_DrawEqualizer(void);
///////////////////////////// /////////////////////////////
// //

View File

@ -1781,7 +1781,7 @@ static menuitem_t Generic_Setup[] = {
// with the main Setup screen. // with the main Setup screen.
static menu_t SetupDef = { static menu_t SetupDef = {
ss_max, // number of Setup Menu items (Key Bindings, etc.) ss_comp + 1, // number of Setup Menu items (Key Bindings, etc.)
&MainDef, // menu to return to when BACKSPACE is hit on this menu &MainDef, // menu to return to when BACKSPACE is hit on this menu
SetupMenu, // definition of items to show on the Setup Screen SetupMenu, // definition of items to show on the Setup Screen
M_DrawSetup, // program that draws the Setup Screen M_DrawSetup, // program that draws the Setup Screen
@ -1867,11 +1867,27 @@ static menu_t CompatDef = // killough 10/98
0 0
}; };
static menu_t EqualizerDef = {
generic_setup_end, // numitems
&SetupDef, // prevMenu
Generic_Setup, // menuitems
MN_DrawEqualizer, // routine
34, 5, // x, y (skull drawn here)
};
static menu_t GyroDef = {
generic_setup_end, // numitems
&SetupDef, // prevMenu
Generic_Setup, // menuitems
MN_DrawGyro, // routine
34, 5, // x, y (skull drawn here)
};
void MN_SetNextMenuAlt(ss_types type) void MN_SetNextMenuAlt(ss_types type)
{ {
static menu_t *setup_defs[] = { static menu_t *setup_defs[] = {
&KeybndDef, &WeaponDef, &StatusHUDDef, &AutoMapDef, &KeybndDef, &WeaponDef, &StatusHUDDef, &AutoMapDef, &EnemyDef,
&EnemyDef, &GeneralDef, &CompatDef, &GeneralDef, &CompatDef, &EqualizerDef, &GyroDef,
}; };
SetNextMenu(setup_defs[type]); SetNextMenu(setup_defs[type]);
@ -1920,17 +1936,35 @@ void MN_ClearMenus(void)
G_ClearInput(); G_ClearInput();
} }
void MN_Back(void) static boolean MenuBack(void)
{ {
if (!currentMenu->prevMenu) if (!currentMenu->prevMenu)
{ {
return; return false;
} }
currentMenu = currentMenu->prevMenu; currentMenu = currentMenu->prevMenu;
itemOn = currentMenu->lastOn; itemOn = currentMenu->lastOn;
highlight_item = 0; highlight_item = 0;
M_StartSound(sfx_swtchn); M_StartSound(sfx_swtchn);
return true;
}
void MN_Back(void)
{
MenuBack();
}
void MN_BackSecondary(void)
{
if (MenuBack())
{
if (currentMenu->menuitems && currentMenu->numitems > itemOn
&& currentMenu->menuitems[itemOn].routine)
{
currentMenu->menuitems[itemOn].routine(0);
}
}
} }
// //

View File

@ -62,6 +62,7 @@ void MN_UpdateFreeLook(boolean condition);
void MN_UpdateMouseLook(void); void MN_UpdateMouseLook(void);
void MN_UpdatePadLook(void); void MN_UpdatePadLook(void);
void MN_UpdateAllGamepadItems(void); void MN_UpdateAllGamepadItems(void);
void MN_UpdateEqualizerItems(void);
void MN_UpdateAdvancedSoundItems(boolean toggle); void MN_UpdateAdvancedSoundItems(boolean toggle);
void MN_ResetTimeScale(void); void MN_ResetTimeScale(void);
void MN_SetHUFontKerning(void); void MN_SetHUFontKerning(void);

View File

@ -175,6 +175,7 @@ static boolean setup_select = false; // changing an item
static boolean setup_gather = false; // gathering keys for value static boolean setup_gather = false; // gathering keys for value
boolean default_verify = false; // verify reset defaults decision boolean default_verify = false; // verify reset defaults decision
static boolean block_input; static boolean block_input;
boolean setup_active_secondary;
///////////////////////////// /////////////////////////////
// //
@ -1094,11 +1095,19 @@ static void DrawGyroCalibration(void)
block_input = true; block_input = true;
DrawNotification("Starting calibration...", CR_GRAY, false); DrawNotification("Starting calibration...", CR_GRAY, false);
I_UpdateGyroCalibrationState(); I_UpdateGyroCalibrationState();
if (I_GetGyroCalibrationState() == GYRO_CALIBRATION_ACTIVE)
{
M_StartSound(sfx_pstop);
}
break; break;
case GYRO_CALIBRATION_ACTIVE: case GYRO_CALIBRATION_ACTIVE:
DrawNotification("Calibrating, please wait...", CR_GRAY, false); DrawNotification("Calibrating, please wait...", CR_GRAY, false);
I_UpdateGyroCalibrationState(); I_UpdateGyroCalibrationState();
if (I_GetGyroCalibrationState() == GYRO_CALIBRATION_COMPLETE)
{
M_StartSound(sfx_pstop);
}
break; break;
case GYRO_CALIBRATION_COMPLETE: case GYRO_CALIBRATION_COMPLETE:
@ -1106,6 +1115,7 @@ static void DrawGyroCalibration(void)
I_UpdateGyroCalibrationState(); I_UpdateGyroCalibrationState();
if (I_GetGyroCalibrationState() == GYRO_CALIBRATION_INACTIVE) if (I_GetGyroCalibrationState() == GYRO_CALIBRATION_INACTIVE)
{ {
M_StartSound(sfx_swtchx);
block_input = false; block_input = false;
} }
break; break;
@ -1293,6 +1303,12 @@ static void SetupMenu(void)
current_menu[--set_item_on].m_flags |= S_HILITE; current_menu[--set_item_on].m_flags |= S_HILITE;
} }
static void SetupMenuSecondary(void)
{
setup_active_secondary = true;
SetupMenu();
}
///////////////////////////// /////////////////////////////
// //
// The Key Binding Screen tables. // The Key Binding Screen tables.
@ -2085,8 +2101,7 @@ static setup_tab_t gen_tabs[] = {
{"video"}, {"video"},
{"audio"}, {"audio"},
{"mouse"}, {"mouse"},
{"pad"}, {"gamepad"},
{"gyro"},
{"display"}, {"display"},
{"misc"}, {"misc"},
{NULL} {NULL}
@ -2312,7 +2327,7 @@ static void SetMidiPlayer(void)
S_RestartMusic(); S_RestartMusic();
} }
static const char *equalizer_preset_strings[] = {"Off", "Classical", "Rock", "Vocal"}; static void MN_Equalizer(void);
static setup_menu_t gen_settings2[] = { static setup_menu_t gen_settings2[] = {
@ -2335,12 +2350,11 @@ static setup_menu_t gen_settings2[] = {
// [FG] play sounds in full length // [FG] play sounds in full length
{"Disable Cutoffs", S_ONOFF, CNTR_X, M_SPC, {"full_sounds"}}, {"Disable Cutoffs", S_ONOFF, CNTR_X, M_SPC, {"full_sounds"}},
{"Equalizer Preset", S_CHOICE, CNTR_X, M_SPC, {"snd_equalizer"},
.strings_id = str_equalizer_preset, .action = I_OAL_EqualizerPreset},
{"Resampler", S_CHOICE, CNTR_X, M_SPC, {"snd_resampler"}, {"Resampler", S_CHOICE, CNTR_X, M_SPC, {"snd_resampler"},
.strings_id = str_resampler, .action = I_OAL_SetResampler}, .strings_id = str_resampler, .action = I_OAL_SetResampler},
{"Equalizer Options", S_FUNC, CNTR_X, M_SPC, .action = MN_Equalizer},
MI_GAP, MI_GAP,
// [FG] music backend // [FG] music backend
@ -2351,47 +2365,6 @@ static setup_menu_t gen_settings2[] = {
MI_END MI_END
}; };
/*
static setup_menu_t gen_settings_eq[] = {
{"Preamp dB", S_THERMO | S_THRM_SIZE11, M_X_THRM11, M_THRM_SPC,
{"snd_eq_preamp"}, m_null, input_null, str_empty, I_OAL_SetEqualizer},
{"Low Gain dB", S_THERMO | S_THRM_SIZE11, M_X_THRM11, M_THRM_SPC,
{"snd_eq_low_gain"}, m_null, input_null, str_empty, I_OAL_SetEqualizer},
{"Mid 1 Gain dB", S_THERMO | S_THRM_SIZE11, M_X_THRM11, M_THRM_SPC,
{"snd_eq_mid1_gain"}, m_null, input_null, str_empty, I_OAL_SetEqualizer},
{"Mid 2 Gain dB", S_THERMO | S_THRM_SIZE11, M_X_THRM11, M_THRM_SPC,
{"snd_eq_mid2_gain"}, m_null, input_null, str_empty, I_OAL_SetEqualizer},
{"High Gain dB", S_THERMO | S_THRM_SIZE11, M_X_THRM11, M_THRM_SPC,
{"snd_eq_high_gain"}, m_null, input_null, str_empty, I_OAL_SetEqualizer},
{"Low Cutoff Hz", S_THERMO | S_THRM_SIZE11, M_X_THRM11, M_THRM_SPC,
{"snd_eq_low_cutoff"}, m_null, input_null, str_empty, I_OAL_SetEqualizer},
{"Mid 1 Center Hz", S_THERMO | S_THRM_SIZE11, M_X_THRM11, M_THRM_SPC,
{"snd_eq_mid1_center"}, m_null, input_null, str_empty, I_OAL_SetEqualizer},
{"Mid 2 Center Hz", S_THERMO | S_THRM_SIZE11, M_X_THRM11, M_THRM_SPC,
{"snd_eq_mid2_center"}, m_null, input_null, str_empty, I_OAL_SetEqualizer},
{"High Cutoff Hz", S_THERMO | S_THRM_SIZE11, M_X_THRM11, M_THRM_SPC,
{"snd_eq_high_cutoff"}, m_null, input_null, str_empty, I_OAL_SetEqualizer},
{"Mid 1 Width Oct", S_THERMO | S_THRM_SIZE11, M_X_THRM11, M_THRM_SPC,
{"snd_eq_mid1_width"}, m_null, input_null, str_empty, I_OAL_SetEqualizer},
{"Mid 2 Width Oct", S_THERMO | S_THRM_SIZE11, M_X_THRM11, M_THRM_SPC,
{"snd_eq_mid2_width"}, m_null, input_null, str_empty, I_OAL_SetEqualizer},
MI_END
};
*/
static const char **GetResamplerStrings(void) static const char **GetResamplerStrings(void)
{ {
const char **strings = I_OAL_GetResamplerStrings(); const char **strings = I_OAL_GetResamplerStrings();
@ -2399,6 +2372,99 @@ static const char **GetResamplerStrings(void)
return strings; return strings;
} }
static const char *equalizer_preset_strings[] = {
"Off", "Classical", "Rock", "Vocal", "Custom"
};
#define M_THRM_SPC_EQ (M_THRM_HEIGHT - 1)
#define M_SPC_EQ 8
#define MI_GAP_EQ {NULL, S_SKIP, 0, 4}
static setup_menu_t eq_settings1[] = {
{"Preset", S_CHOICE, CNTR_X, M_SPC_EQ, {"snd_equalizer"},
.strings_id = str_equalizer_preset, .action = I_OAL_EqualizerPreset},
MI_GAP_EQ,
{"Preamp dB", S_THERMO, CNTR_X, M_THRM_SPC_EQ,
{"snd_eq_preamp"}, .action = I_OAL_EqualizerPreset},
MI_GAP_EQ,
{"Low Gain dB", S_THERMO, CNTR_X, M_THRM_SPC_EQ,
{"snd_eq_low_gain"}, .action = I_OAL_EqualizerPreset},
{"Mid 1 Gain dB", S_THERMO, CNTR_X, M_THRM_SPC_EQ,
{"snd_eq_mid1_gain"}, .action = I_OAL_EqualizerPreset},
{"Mid 2 Gain dB", S_THERMO, CNTR_X, M_THRM_SPC_EQ,
{"snd_eq_mid2_gain"}, .action = I_OAL_EqualizerPreset},
{"High Gain dB", S_THERMO, CNTR_X, M_THRM_SPC_EQ,
{"snd_eq_high_gain"}, .action = I_OAL_EqualizerPreset},
MI_GAP_EQ,
{"Low Cutoff Hz", S_THERMO, CNTR_X, M_THRM_SPC_EQ,
{"snd_eq_low_cutoff"}, .action = I_OAL_EqualizerPreset},
{"Mid 1 Center Hz", S_THERMO, CNTR_X, M_THRM_SPC_EQ,
{"snd_eq_mid1_center"}, .action = I_OAL_EqualizerPreset},
{"Mid 2 Center Hz", S_THERMO, CNTR_X, M_THRM_SPC_EQ,
{"snd_eq_mid2_center"}, .action = I_OAL_EqualizerPreset},
{"High Cutoff Hz", S_THERMO, CNTR_X, M_THRM_SPC_EQ,
{"snd_eq_high_cutoff"}, .action = I_OAL_EqualizerPreset},
MI_END
};
static setup_menu_t *eq_settings[] = {eq_settings1, NULL};
void MN_UpdateEqualizerItems(void)
{
const boolean condition = !I_OAL_CustomEqualizer();
DisableItem(!I_OAL_EqualizerInitialized(), gen_settings2, "Equalizer Options");
DisableItem(!I_OAL_EqualizerInitialized(), eq_settings1, "snd_equalizer");
DisableItem(condition, eq_settings1, "snd_eq_preamp");
DisableItem(condition, eq_settings1, "snd_eq_low_gain");
DisableItem(condition, eq_settings1, "snd_eq_low_cutoff");
DisableItem(condition, eq_settings1, "snd_eq_mid1_gain");
DisableItem(condition, eq_settings1, "snd_eq_mid1_center");
DisableItem(condition, eq_settings1, "snd_eq_mid2_gain");
DisableItem(condition, eq_settings1, "snd_eq_mid2_center");
DisableItem(condition, eq_settings1, "snd_eq_high_gain");
DisableItem(condition, eq_settings1, "snd_eq_high_cutoff");
}
static setup_tab_t equalizer_tabs[] = {{"Equalizer"}, {NULL}};
static void MN_Equalizer(void)
{
SetItemOn(set_item_on);
SetPageIndex(current_page);
MN_SetNextMenuAlt(ss_eq);
setup_screen = ss_eq;
current_page = GetPageIndex(eq_settings);
current_menu = eq_settings[current_page];
current_tabs = equalizer_tabs;
SetupMenuSecondary();
}
void MN_DrawEqualizer(void)
{
inhelpscreens = true;
DrawBackground("FLOOR4_6");
MN_DrawTitle(M_X_CENTER, M_Y_TITLE, "M_GENERL", "General");
DrawTabs();
DrawInstructions();
DrawScreenItems(current_menu);
}
void MN_UpdateFreeLook(boolean condition) void MN_UpdateFreeLook(boolean condition)
{ {
P_UpdateDirectVerticalAiming(); P_UpdateDirectVerticalAiming();
@ -2512,8 +2578,12 @@ static const char *curve_strings[] = {
"2.4", "2.5", "2.6", "2.7", "2.8", "2.9", "Cubed" "2.4", "2.5", "2.6", "2.7", "2.8", "2.9", "Cubed"
}; };
static void MN_Gyro(void);
static setup_menu_t gen_settings4[] = { static setup_menu_t gen_settings4[] = {
{"Gyro Options", S_FUNC, CNTR_X, M_SPC, .action = MN_Gyro},
{"Stick Layout", S_CHOICE, CNTR_X, M_SPC, {"joy_stick_layout"}, {"Stick Layout", S_CHOICE, CNTR_X, M_SPC, {"joy_stick_layout"},
.strings_id = str_layout, .action = UpdateStickLayout}, .strings_id = str_layout, .action = UpdateStickLayout},
@ -2550,20 +2620,15 @@ static setup_menu_t gen_settings4[] = {
static void UpdateGamepadItems(void) static void UpdateGamepadItems(void)
{ {
boolean condition = const boolean gamepad = (I_UseGamepad() && I_GamepadEnabled());
(!I_UseGamepad() || !I_GamepadEnabled() || !I_RumbleSupported()); const boolean gyro = (I_GyroEnabled() && I_GyroSupported());
const boolean sticks = I_UseStickLayout();
const boolean condition = (!gamepad || !sticks);
DisableItem(condition, gen_settings4, "joy_rumble"); DisableItem(!gamepad || !I_GyroSupported(), gen_settings4, "Gyro Options");
DisableItem(!gamepad || !I_RumbleSupported(), gen_settings4, "joy_rumble");
// Allow padlook toggle when the gamepad is using gyro, even if the DisableItem(!gamepad || (!sticks && !gyro), gen_settings4, "padlook");
// stick layout is set to off. DisableItem(!gamepad, gen_settings4, "joy_stick_layout");
condition =
(!I_UseGamepad() || !I_GamepadEnabled()
|| (!I_UseStickLayout() && (!I_GyroEnabled() || !I_GyroSupported())));
DisableItem(condition, gen_settings4, "padlook");
condition = (!I_UseGamepad() || !I_GamepadEnabled() || !I_UseStickLayout());
DisableItem(condition, gen_settings4, "joy_invert_look"); DisableItem(condition, gen_settings4, "joy_invert_look");
DisableItem(condition, gen_settings4, "joy_movement_inner_deadzone"); DisableItem(condition, gen_settings4, "joy_movement_inner_deadzone");
DisableItem(condition, gen_settings4, "joy_camera_inner_deadzone"); DisableItem(condition, gen_settings4, "joy_camera_inner_deadzone");
@ -2576,7 +2641,7 @@ static void UpdateGyroItems(void);
static void UpdateGyroAiming(void) static void UpdateGyroAiming(void)
{ {
UpdateGamepadItems(); // Update padlook. UpdateGamepadItems(); // Update "Gyro Options" and padlook.
UpdateGyroItems(); UpdateGyroItems();
I_SetSensorsEnabled(I_GyroEnabled()); I_SetSensorsEnabled(I_GyroEnabled());
I_ResetGamepad(); I_ResetGamepad();
@ -2648,7 +2713,7 @@ static void UpdateGyroSteadying(void)
I_ResetGamepad(); I_ResetGamepad();
} }
static setup_menu_t gen_gyro[] = { static setup_menu_t gyro_settings1[] = {
{"Gyro Aiming", S_ONOFF, CNTR_X, M_SPC, {"gyro_enable"}, {"Gyro Aiming", S_ONOFF, CNTR_X, M_SPC, {"gyro_enable"},
.action = UpdateGyroAiming}, .action = UpdateGyroAiming},
@ -2685,32 +2750,68 @@ static setup_menu_t gen_gyro[] = {
MI_END MI_END
}; };
static setup_menu_t *gyro_settings[] = {gyro_settings1, NULL};
static void UpdateGyroItems(void) static void UpdateGyroItems(void)
{ {
const boolean condition = (!I_UseGamepad() || !I_GamepadEnabled() const boolean gamepad = (I_UseGamepad() && I_GamepadEnabled());
|| !I_GyroEnabled() || !I_GyroSupported()); const boolean gyro = (I_GyroEnabled() && I_GyroSupported());
const boolean condition = (!gamepad || !gyro);
DisableItem(condition, gen_gyro, "gyro_space"); DisableItem(!gamepad || !I_GyroSupported(), gyro_settings1, "gyro_enable");
DisableItem(condition, gen_gyro, "gyro_button_action"); DisableItem(condition, gyro_settings1, "gyro_space");
DisableItem(condition, gen_gyro, "gyro_stick_action"); DisableItem(condition, gyro_settings1, "gyro_button_action");
DisableItem(condition, gen_gyro, "gyro_turn_speed"); DisableItem(condition, gyro_settings1, "gyro_stick_action");
DisableItem(condition, gen_gyro, "gyro_look_speed"); DisableItem(condition, gyro_settings1, "gyro_turn_speed");
DisableItem(condition, gen_gyro, "gyro_acceleration"); DisableItem(condition, gyro_settings1, "gyro_look_speed");
DisableItem(condition, gen_gyro, "gyro_smooth_threshold"); DisableItem(condition, gyro_settings1, "gyro_acceleration");
DisableItem(condition, gen_gyro, "Calibrate"); DisableItem(condition, gyro_settings1, "gyro_smooth_threshold");
DisableItem(condition, gyro_settings1, "Calibrate");
} }
void MN_UpdateAllGamepadItems(void) void MN_UpdateAllGamepadItems(void)
{ {
const boolean condition = (!I_UseGamepad() || !I_GamepadEnabled());
DisableItem(condition, gen_settings4, "joy_stick_layout");
UpdateGamepadItems(); UpdateGamepadItems();
DisableItem(condition || !I_GyroSupported(), gen_gyro, "gyro_enable");
UpdateGyroItems(); UpdateGyroItems();
} }
static setup_tab_t gyro_tabs[] = {{"Gyro"}, {NULL}};
static void MN_Gyro(void)
{
SetItemOn(set_item_on);
SetPageIndex(current_page);
MN_SetNextMenuAlt(ss_gyro);
setup_screen = ss_gyro;
current_page = GetPageIndex(gyro_settings);
current_menu = gyro_settings[current_page];
current_tabs = gyro_tabs;
SetupMenuSecondary();
}
void MN_DrawGyro(void)
{
inhelpscreens = true;
DrawBackground("FLOOR4_6");
MN_DrawTitle(M_X_CENTER, M_Y_TITLE, "M_GENERL", "General");
DrawTabs();
DrawInstructions();
if (I_UseGamepad() && I_GyroEnabled())
{
DrawIndicator = DrawIndicator_Meter;
}
else
{
DrawIndicator = NULL;
}
DrawScreenItems(current_menu);
DrawGyroCalibration();
}
static void SmoothLight(void) static void SmoothLight(void)
{ {
setsmoothlight = true; setsmoothlight = true;
@ -2838,7 +2939,7 @@ static setup_menu_t gen_settings6[] = {
}; };
static setup_menu_t *gen_settings[] = { static setup_menu_t *gen_settings[] = {
gen_settings1, gen_settings2, gen_settings3, gen_settings4, gen_gyro, gen_settings1, gen_settings2, gen_settings3, gen_settings4,
gen_settings5, gen_settings6, NULL gen_settings5, gen_settings6, NULL
}; };
@ -2896,9 +2997,7 @@ void MN_DrawGeneral(void)
DrawTabs(); DrawTabs();
DrawInstructions(); DrawInstructions();
if (I_UseGamepad() if (I_UseGamepad() && current_menu == gen_settings4 && I_UseStickLayout())
&& ((current_menu == gen_settings4 && I_UseStickLayout())
|| (current_menu == gen_gyro && I_GyroEnabled())))
{ {
DrawIndicator = DrawIndicator_Meter; DrawIndicator = DrawIndicator_Meter;
} }
@ -2909,11 +3008,6 @@ void MN_DrawGeneral(void)
DrawScreenItems(current_menu); DrawScreenItems(current_menu);
if (current_menu == gen_gyro)
{
DrawGyroCalibration();
}
// If the Reset Button has been selected, an "Are you sure?" message // If the Reset Button has been selected, an "Are you sure?" message
// is overlayed across everything else. // is overlayed across everything else.
@ -2955,6 +3049,8 @@ static setup_menu_t **setup_screens[] = {
enem_settings, enem_settings,
gen_settings, // killough 10/98 gen_settings, // killough 10/98
comp_settings, comp_settings,
eq_settings,
gyro_settings,
}; };
// [FG] save the index of the current screen in the first page's S_END element's // [FG] save the index of the current screen in the first page's S_END element's
@ -2997,7 +3093,7 @@ static void SetPageIndex(const int y)
// //
// killough 10/98: rewritten to fix bugs and warn about pending changes // killough 10/98: rewritten to fix bugs and warn about pending changes
static void ResetDefaults() static void ResetDefaults(ss_types reset_screen)
{ {
default_t *dp; default_t *dp;
int warn = 0; int warn = 0;
@ -3013,12 +3109,12 @@ static void ResetDefaults()
for (dp = defaults; dp->name; dp++) for (dp = defaults; dp->name; dp++)
{ {
if (dp->setupscreen != setup_screen) if (dp->setupscreen != reset_screen)
{ {
continue; continue;
} }
setup_menu_t **screens = setup_screens[setup_screen]; setup_menu_t **screens = setup_screens[reset_screen];
for (; *screens; screens++) for (; *screens; screens++)
{ {
@ -3077,6 +3173,15 @@ static void ResetDefaults()
} }
} }
static void ResetDefaultsSecondary(void)
{
if (setup_screen == ss_gen)
{
ResetDefaults(ss_eq);
ResetDefaults(ss_gyro);
}
}
// //
// M_InitDefaults() // M_InitDefaults()
// //
@ -3760,7 +3865,7 @@ boolean MN_SetupResponder(menu_action_t action, int ch)
current_item->action(); current_item->action();
} }
M_StartSound(sfx_itemup); M_StartSound(sfx_pistol);
return true; return true;
} }
@ -3772,7 +3877,8 @@ boolean MN_SetupResponder(menu_action_t action, int ch)
{ {
if (M_ToUpper(ch) == 'Y' || action == MENU_ENTER) if (M_ToUpper(ch) == 'Y' || action == MENU_ENTER)
{ {
ResetDefaults(); ResetDefaults(setup_screen);
ResetDefaultsSecondary();
default_verify = false; default_verify = false;
SelectDone(current_item); SelectDone(current_item);
} }
@ -3946,14 +4052,24 @@ boolean MN_SetupResponder(menu_action_t action, int ch)
if (action == MENU_ESCAPE) // Clear all menus if (action == MENU_ESCAPE) // Clear all menus
{ {
MN_ClearMenus(); MN_ClearMenus();
setup_active = false;
setup_active_secondary = false;
} }
else if (action == MENU_BACKSPACE) else
{
if (setup_active_secondary)
{
MN_BackSecondary();
setup_active_secondary = false;
}
else
{ {
MN_Back(); MN_Back();
setup_active = false;
}
} }
current_item->m_flags &= ~(S_HILITE | S_SELECT); // phares 4/19/98 current_item->m_flags &= ~(S_HILITE | S_SELECT); // phares 4/19/98
setup_active = false;
set_keybnd_active = false; set_keybnd_active = false;
set_weapon_active = false; set_weapon_active = false;
default_verify = false; // phares 4/19/98 default_verify = false; // phares 4/19/98
@ -4341,6 +4457,7 @@ void MN_SetupResetMenu(void)
UpdateCrosshairItems(); UpdateCrosshairItems();
UpdateCenteredWeaponItem(); UpdateCenteredWeaponItem();
MN_UpdateAllGamepadItems(); MN_UpdateAllGamepadItems();
MN_UpdateEqualizerItems();
} }
void MN_BindMenuVariables(void) void MN_BindMenuVariables(void)