quakec/source/menu/menu_gpad.qc

128 lines
3.5 KiB
C++
Raw Normal View History

2024-10-16 04:38:47 +00:00
string menu_gpad_buttons[5] = {"gp_glyp", "gp_rumb", "gp_aima", "gp_apply", "gp_back"};
2024-09-14 02:59:18 +00:00
void() Menu_Gamepad_ApplyGlpyh =
2024-09-13 02:35:09 +00:00
{
2024-09-14 02:59:18 +00:00
Menu_PlaySound(MENU_SND_ENTER);
string current_glyph_brand = cvar_string("cl_controllerglyphs");
string new_glyph_brand = "";
switch(current_glyph_brand) {
case "xbox":
new_glyph_brand = "sony";
break;
case "sony":
new_glyph_brand = "nintendo";
break;
case "nintendo":
new_glyph_brand = "generic";
break;
default:
new_glyph_brand = "xbox";
break;
}
cvar_set("cl_controllerglyphs", new_glyph_brand);
2024-09-13 02:35:09 +00:00
};
2024-09-14 02:59:18 +00:00
void() Menu_Gamepad_ApplyRumble =
{
Menu_PlaySound(MENU_SND_ENTER);
float rumble = cvar("in_rumbleenabled");
cvar_set("in_rumbleenabled", ftos(!rumble));
};
2024-09-13 02:35:09 +00:00
2024-09-14 02:59:18 +00:00
void() Menu_Gamepad_ApplyAimAssist =
{
Menu_PlaySound(MENU_SND_ENTER);
float rumble = cvar("in_aimassist");
cvar_set("in_aimassist", ftos(!rumble));
};
2024-09-13 02:35:09 +00:00
void() Menu_Gamepad_ApplySettings =
{
localcmd("vid_reload\nsaveconfig user_settings.cfg\n");
music_duration_time = 0;
};
2024-10-16 04:38:47 +00:00
string(string prev_id) Menu_Gamepad_GetNextButton =
{
if (prev_id == "")
return menu_gpad_buttons[0];
string ret = menu_gpad_buttons[0];
for(float i = 0; i < menu_gpad_buttons.length; i++) {
if (menu_gpad_buttons[i] == prev_id) {
if (i + 1 >= menu_gpad_buttons.length)
break;
ret = menu_gpad_buttons[i + 1];
break;
}
}
return ret;
};
string(string next_id) Menu_Gamepad_GetPreviousButton =
{
if (next_id == "")
return menu_gpad_buttons[menu_gpad_buttons.length - 1];
string ret = menu_gpad_buttons[menu_gpad_buttons.length - 1];
for(float i = menu_gpad_buttons.length - 1; i > 0; i--) {
if (menu_gpad_buttons[i] == next_id) {
if (i - 1 < 0)
break;
ret = menu_gpad_buttons[i - 1];
break;
}
}
return ret;
};
2024-09-13 02:35:09 +00:00
void() Menu_Gamepad =
{
Menu_DrawBackground();
Menu_DrawTitle("GAMEPAD OPTIONS");
Menu_DrawMapPanel();
2024-09-14 02:59:18 +00:00
Menu_Button(1, "gp_glyp", "GLYPH TYPE", "Change the Style/Branding for Gamepad Glyphs.") ? Menu_Gamepad_ApplyGlpyh() : 0;
string glyph_string = "";
switch(cvar_string("cl_controllerglyphs")) {
case "xbox": glyph_string = "MICROSOFT"; break;
case "sony": glyph_string = "SONY"; break;
case "nintendo": glyph_string = "NINTENDO"; break;
case "generic": glyph_string = "LIBRE"; break;
default: glyph_string = sprintf("USER (\"%s\")", cvar_string("cl_controllerglyphs")); break;
}
Menu_DrawOptionValue(1, glyph_string);
2024-10-20 17:56:33 +00:00
Menu_DrawControllerGlyphDemo(1);
2024-09-14 02:59:18 +00:00
Menu_Button(2, "gp_rumb", "RUMBLE", "Toggle Rumble during Gameplay Actions.") ? Menu_Gamepad_ApplyRumble() : 0;
string rumble_string = "";
switch(cvar("in_rumbleenabled")) {
case 0: rumble_string = "DISABLED"; break;
case 1: rumble_string = "ENABLED"; break;
default: break;
}
Menu_DrawOptionValue(2, rumble_string);
Menu_Button(3, "gp_aima", "AIM ASSIST", "Toggle Camera Aim Assist.") ? Menu_Gamepad_ApplyAimAssist() : 0;
string aa_string = "";
switch(cvar("in_aimassist")) {
case 0: aa_string = "DISABLED"; break;
case 1: aa_string = "ENABLED"; break;
default: break;
}
Menu_DrawOptionValue(3, aa_string);
2024-09-13 02:35:09 +00:00
Menu_DrawDivider(12.25);
Menu_Button(-2, "gp_apply", "APPLY", "Save & Apply Settings.") ? Menu_Gamepad_ApplySettings() : 0;
2024-09-14 02:59:18 +00:00
Menu_Button(-1, "gp_back", "BACK", "Return to Control Options.") ? current_menu = MENU_CONTROL : 0;
2024-09-13 02:35:09 +00:00
sui_pop_frame();
};