mirror of
https://github.com/nzp-team/quakec.git
synced 2025-04-04 17:05:54 +00:00
Add menu option & finally get it saving/displaying correctly
This commit is contained in:
parent
bfa3df22ca
commit
a61c23b5c7
1 changed files with 25 additions and 3 deletions
|
@ -1,9 +1,10 @@
|
|||
string menu_ctrl_buttons[7] = {"cm_adsm", "cm_sens", "cm_invs", "cm_gpad", "cm_bind", "cm_apply", "cm_back"};
|
||||
string menu_ctrl_buttons[8] = {"cm_adsm", "cm_sens", "cm_invs", "cm_togsp", "cm_gpad", "cm_bind", "cm_apply", "cm_back"};
|
||||
|
||||
float menu_ctrl_init;
|
||||
|
||||
float current_adsmode;
|
||||
float current_invert;
|
||||
float current_sprintoggle;
|
||||
|
||||
void() Menu_Control_StoreCurrentSettings =
|
||||
{
|
||||
|
@ -17,6 +18,7 @@ void() Menu_Control_StoreCurrentSettings =
|
|||
}
|
||||
|
||||
current_invert = (cvar("m_pitch") == 0.022);
|
||||
current_sprintoggle = (cvar("togglesprint") == 1);
|
||||
};
|
||||
|
||||
void() Menu_Control_Init =
|
||||
|
@ -53,6 +55,17 @@ void() Menu_Control_InvertLook =
|
|||
localcmd("m_pitch -0.022\n");
|
||||
};
|
||||
|
||||
void() Menu_Control_ToggleSprint =
|
||||
{
|
||||
Menu_PlaySound(MENU_SND_ENTER);
|
||||
current_sprintoggle = !current_sprintoggle;
|
||||
|
||||
if (current_sprintoggle)
|
||||
localcmd("togglesprint 1\n");
|
||||
else
|
||||
localcmd("togglesprint 0\n");
|
||||
};
|
||||
|
||||
void() Menu_Control_ApplySettings =
|
||||
{
|
||||
localcmd("vid_reload\nsaveconfig user_settings.cfg\n");
|
||||
|
@ -129,8 +142,17 @@ void() Menu_Control =
|
|||
}
|
||||
Menu_DrawOptionValue(3, invert_string);
|
||||
|
||||
Menu_Button(4, "cm_gpad", "GAMEPAD", "Gamepad specific options.") ? current_menu = MENU_GAMEPAD : 0;
|
||||
Menu_Button(5, "cm_bind", "BINDINGS", "Change Input Bindings.") ? current_menu = MENU_BINDINGS : 0;
|
||||
Menu_Button(4, "cm_togsp", "TOGGLE SPRINT", "Toggle sprinting on press, or hold to sprint.") ? Menu_Control_ToggleSprint() : 0;
|
||||
string sprintoggle_string = "";
|
||||
switch(current_sprintoggle) {
|
||||
case 0: sprintoggle_string = "HOLD"; break;
|
||||
case 1: sprintoggle_string = "TOGGLE"; break;
|
||||
default: break;
|
||||
}
|
||||
Menu_DrawOptionValue(4, sprintoggle_string);
|
||||
|
||||
Menu_Button(5, "cm_gpad", "GAMEPAD", "Gamepad specific options.") ? current_menu = MENU_GAMEPAD : 0;
|
||||
Menu_Button(6, "cm_bind", "BINDINGS", "Change Input Bindings.") ? current_menu = MENU_BINDINGS : 0;
|
||||
|
||||
Menu_DrawDivider(12.25);
|
||||
Menu_Button(-2, "cm_apply", "APPLY", "Save & Apply Settings.") ? Menu_Control_ApplySettings() : 0;
|
||||
|
|
Loading…
Reference in a new issue