Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions source/menu/defs/menu_defs.qc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ enum {
#define MENU_SND_BEEP 2
void(float type) Menu_PlaySound;

void() Menu_LeftArrowPressed;
void() Menu_RightArrowPressed;

#ifdef MENU

void() Menu_Main;
Expand Down
38 changes: 36 additions & 2 deletions source/menu/m_menu.qc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ vector MENU_TEXT_SMALL = '12 12 0';
vector MENU_TEXT_MEDIUM = '14 14 0';
vector MENU_TEXT_LARGE = '28 28 0';

float menu_leftarrow_pressed;
float menu_rightarrow_pressed;

void() input_tester =
{
float char = 0;
Expand Down Expand Up @@ -561,11 +564,11 @@ void(vector pos, vector size, vector minmaxsteps, string cvar_s, string name, st
};

//
// Menu_CvarSlider(order, minmaxsteps, cvar_s, is_int, no_text, zero_is_one)
// Menu_CvarSlider(order, button_id, minmaxsteps, cvar_s, is_int, no_text, zero_is_one)
// Draws a Slider at the given order position
// that controls a cvar.
//
void(float order, vector minmaxsteps, string cvar_s, float is_int, float no_text, float zero_is_one) Menu_CvarSlider =
void(float order, string button_id, vector minmaxsteps, string cvar_s, float is_int, float no_text, float zero_is_one) Menu_CvarSlider =
{
float current = cvar(cvar_s);
float old = current;
Expand All @@ -575,6 +578,24 @@ void(float order, vector minmaxsteps, string cvar_s, float is_int, float no_text

my_slider(strcat(cvar_s, "sldr"), [position_x, (position_y - 17) + size_y * 0.5], [size_x, size_y * 0.5], minmaxsteps, current);

// For keyboard/gamepad navigation -- we need to check if the button associated
// with this slider is active and then do input checks to test if we should
// adjust the related cvar.
if (sui_is_hovered(button_id)) {
float interval = ((minmaxsteps[1] - minmaxsteps[0]) / minmaxsteps[2]);
if (menu_leftarrow_pressed) {
current -= interval;
} else if (menu_rightarrow_pressed) {
current += interval;
}

if (current < minmaxsteps[0])
current = minmaxsteps[0];

if (current > minmaxsteps[1])
current = minmaxsteps[1];
}

if (current != old) {
if (is_int)
cvar_set(cvar_s, ftos(rint(current)));
Expand Down Expand Up @@ -881,6 +902,16 @@ void(float type) Menu_PlaySound =
localsound(sound, 0, cvar("nzp_uivolume"));
};

void() Menu_LeftArrowPressed =
{
menu_leftarrow_pressed = TRUE;
};

void() Menu_RightArrowPressed =
{
menu_rightarrow_pressed = TRUE;
};

float last_menu;
void(vector size) root_menu =
{
Expand Down Expand Up @@ -922,6 +953,9 @@ void(vector size) root_menu =
default: break;
}

menu_leftarrow_pressed = false;
menu_rightarrow_pressed = false;

// Menu enter sound
if (last_menu != current_menu) {
Menu_PlaySound(MENU_SND_ENTER);
Expand Down
2 changes: 1 addition & 1 deletion source/menu/menu_aces.qc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void() Menu_Accessibility =

// Text Backdrop
Menu_Button(2, "ac_text", "TEXT BACKDROP", "Opacity of backdrop for text elements on HUD.") ? 0 : 0;
Menu_CvarSlider(2, [0, 1, 20], "cl_textopacity", false, false, false);
Menu_CvarSlider(2, "ac_text", [0, 1, 20], "cl_textopacity", false, false, false);

// Accessible Colors
Menu_Button(3, "ac_color", "ACCESSIBLE COLORS", "Uses enhanced Player colors to improve visibilty.") ? Menu_Accessibility_UpdateColorblindFilter() : 0;
Expand Down
6 changes: 3 additions & 3 deletions source/menu/menu_audi.qc
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ void() Menu_Audio =
Menu_DrawMapPanel();

Menu_Button(1, "am_maste", "MASTER VOLUME", "Volume for all Audio.") ? 0 : 0;
Menu_CvarSlider(1, [0, 1, 10], "volume", false, true, false);
Menu_CvarSlider(1, "am_maste", [0, 1, 10], "volume", false, true, false);

Menu_Button(2, "am_menu", "INTERFACE VOLUME", "Volume for UI/Menus.") ? 0 : 0;
Menu_CvarSlider(2, [0, 1, 10], "nzp_uivolume", false, true, false);
Menu_CvarSlider(2, "am_menu", [0, 1, 10], "nzp_uivolume", false, true, false);

Menu_Button(3, "am_bgm", "MUSIC VOLUME", "Volume for Background Music.") ? 0 : 0;
Menu_CvarSlider(3, [0, 1, 10], "nzp_bgmvolume", false, true, false);
Menu_CvarSlider(3, "am_bgm", [0, 1, 10], "nzp_bgmvolume", false, true, false);

Menu_DrawDivider(12.25);
Menu_Button(-2, "am_apply", "APPLY", "Save & Apply Settings.") ? Menu_Audio_ApplySettings() : 0;
Expand Down
2 changes: 1 addition & 1 deletion source/menu/menu_coop.qc
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ void() Menu_Coop_Create =

// Max players
Menu_Button(4, "ccm_maxplayers", "MAX PLAYERS", "Change the maximum number of players who can join your server.") ? 0 : 0;
Menu_CvarSlider(4, [1, 8, 7], "maxplayers", true, false, false);
Menu_CvarSlider(4, "ccm_maxplayers", [1, 8, 7], "maxplayers", true, false, false);

Menu_DrawDivider(5);
Menu_Button(5.25, "ccm_choosemap", "CHOOSE MAP", "Select a Map to start the Game.") ? Menu_StartCoop() : 0;
Expand Down
2 changes: 1 addition & 1 deletion source/menu/menu_ctrl.qc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void() Menu_Control =
Menu_DrawOptionValue(1, ads_string);

Menu_Button(2, "cm_sens", "SENSITIVITY", "Alter Look Sensitivity.") ? 0 : 0;
Menu_CvarSlider(2, [1, 10, 10], "sensitivity", false, false, false);
Menu_CvarSlider(2, "cm_sens", [1, 10, 10], "sensitivity", false, false, false);

Menu_Button(3, "cm_invs", "INVERT LOOK", "Invert Y-Axis Camera Input.") ? Menu_Control_InvertLook() : 0;
string invert_string = "";
Expand Down
4 changes: 2 additions & 2 deletions source/menu/menu_gpad.qc
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ void() Menu_Gamepad =
Menu_DrawOptionValue(3, aa_string);

Menu_Button(4, "gp_senx", "X AXIS SENSITIVITY", "Alter X-Axis Look Sensitivity.") ? 0 : 0;
Menu_CvarSlider(4, [0, 4, 16], "joypitchsensitivity", false, false, false);
Menu_CvarSlider(4, "gp_senx", [0, 4, 16], "joypitchsensitivity", false, false, false);

Menu_Button(5, "gp_seny", "Y AXIS SENSITIVITY", "Alter Y-Axis Look Sensitivity.") ? 0 : 0;
Menu_CvarSlider(5, [0, 4, 16], "joyyawsensitivity", false, false, false);
Menu_CvarSlider(5, "gp_seny", [0, 4, 16], "joyyawsensitivity", false, false, false);

Menu_DrawDivider(12.25);
Menu_Button(-2, "gp_apply", "APPLY", "Save & Apply Settings.") ? Menu_Gamepad_ApplySettings() : 0;
Expand Down
4 changes: 2 additions & 2 deletions source/menu/menu_gset.qc
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void() Menu_GameSettings =

// Start Round
Menu_Button(3, "ge_rond", "START ROUND", "Round to begin the Game on.") ? 0 : 0;
Menu_CvarSlider(3, [0, 50, 10], "sv_startround", true, false, true);
Menu_CvarSlider(3, "ge_rond", [0, 50, 10], "sv_startround", true, false, true);

// Magic
string magic_string = "";
Expand All @@ -159,7 +159,7 @@ void() Menu_GameSettings =

// Horde Size
Menu_Button(6, "ge_hord", "HORDE SIZE", "Maximum Zombies that can Active at once.") ? 0 : 0;
Menu_CvarSlider(6, [2, 64, 31], "sv_maxai", true, false, false);
Menu_CvarSlider(6, "ge_hord", [2, 64, 31], "sv_maxai", true, false, false);

// Fast Rounds
string fast_string = "";
Expand Down
6 changes: 3 additions & 3 deletions source/menu/menu_vide.qc
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ void() Menu_Video =
// Max FPS
if (cvar("vid_vsync") == 0) {
Menu_Button(4, "vm_maxps", "MAX FPS", "Configure Maximum FPS Value.") ? 0 : 0;
Menu_CvarSlider(4, [10, 500, 490], "cl_maxfps", true, false, false);
Menu_CvarSlider(4, "vm_maxps", [10, 500, 490], "cl_maxfps", true, false, false);
} else {
Menu_GreyButton(4, "[VSYNC ON] MAX FPS");
}
Expand All @@ -260,11 +260,11 @@ void() Menu_Video =

// Field of View
Menu_Button(6, "vm_fov", "FIELD OF VIEW", "Change Camera Field of View.") ? 0 : 0;
Menu_CvarSlider(6, [10, 150, 140], "fov", true, false, false);
Menu_CvarSlider(6, "vm_fov", [10, 150, 140], "fov", true, false, false);

// Gamma
Menu_Button(7, "vm_gamma", "GAMMA", "Adjust game Black Level.") ? 0 : 0;
Menu_CvarSlider(7, [0.3, 2, 17], "gamma", false, true, false);
Menu_CvarSlider(7, "vm_gamma", [0.3, 2, 17], "gamma", false, true, false);

// Ultrawide Mode
Menu_Button(8, "vm_uwide", "ULTRAWIDE MODE", "Condenses HUD closer to center of Display.") ? Menu_Video_UpdateUltrawide() : 0;
Expand Down
45 changes: 45 additions & 0 deletions source/menu/sui_sys.qc
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ void() sui_reset_frame =
// solution but in this highly imperative world of QuakeC we can live with it

float _holding_click;
float _holding_leftarrow;
float _holding_rightarrow;
vector _cursor_click;
vector _cursor_position;
vector _cursor_relative_click;
Expand Down Expand Up @@ -241,6 +243,8 @@ void() sui_reset_actions =
_release_action_count = 0;
_last_clicked_action_count = 0;
_holding_click = FALSE;
_holding_leftarrow = FALSE;
_holding_rightarrow = FALSE;
};

// Per frame reset?
Expand Down Expand Up @@ -389,6 +393,26 @@ void(vector pos) _sui_mouse_move =
last_hovered_id = "";
};

void() _sui_menukey_leftarrow =
{
if (_holding_leftarrow == FALSE)
{
// Send a signal for the button press
Menu_LeftArrowPressed();
}
_holding_leftarrow = TRUE;
}

void() _sui_menukey_rightarrow =
{
if (_holding_rightarrow == FALSE)
{
// Send a signal for the button press
Menu_RightArrowPressed();
}
_holding_rightarrow = TRUE;
}

void() _sui_menukey_downarrow =
{
string current_hovered_option = _hover_actions[0];
Expand Down Expand Up @@ -599,6 +623,8 @@ void() _sui_mouse1_up =
_release_action_count = _hold_action_count;
_hold_action_count = 0;
_holding_click = FALSE;
_holding_leftarrow = FALSE;
_holding_rightarrow = FALSE;
};

// HACK!
Expand Down Expand Up @@ -854,6 +880,16 @@ float(float evtype, float scanx, float chary, float devid) sui_input_event =
_sui_menukey_enter();
return TRUE;
}
else if (scanx == K_LEFTARROW || scanx == K_GP_DPAD_LEFT)
{
_sui_menukey_leftarrow();
return TRUE;
}
else if (scanx == K_RIGHTARROW || scanx == K_GP_DPAD_RIGHT)
{
_sui_menukey_rightarrow();
return TRUE;
}
else
{
if ((scanx == K_ESCAPE || scanx == K_BACKSPACE) && _sui_binding_command != "")
Expand All @@ -873,6 +909,15 @@ float(float evtype, float scanx, float chary, float devid) sui_input_event =
_sui_mouse1_up();
return TRUE;
}
else
{
_holding_leftarrow = FALSE;
_holding_rightarrow = FALSE;

// Let the engine still handle it's own
// input events on normal key releases.
return FALSE;
}
default:
return FALSE;
}
Expand Down