mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-22 20:51:31 +00:00
Gamepad Sticks submenu
Sticks layout and expo options moved there Includes deadzone sliders
This commit is contained in:
parent
57db0df752
commit
b11937980b
1 changed files with 182 additions and 93 deletions
|
@ -1597,6 +1597,170 @@ M_Menu_ControllerAltButtons_f(void)
|
|||
M_PushMenu(ControllerAltButtons_MenuDraw, ControllerAltButtons_MenuKey);
|
||||
}
|
||||
|
||||
/*
|
||||
* STICKS CONFIGURATION MENU
|
||||
*/
|
||||
|
||||
static menuframework_s s_sticks_config_menu;
|
||||
|
||||
static menulist_s s_stk_layout_box;
|
||||
static menuseparator_s s_stk_title_text[2];
|
||||
static menuslider_s s_stk_expo_slider[2];
|
||||
static menuslider_s s_stk_snap_slider[2];
|
||||
static menuslider_s s_stk_dz_slider[2];
|
||||
|
||||
extern qboolean gyro_hardware;
|
||||
|
||||
static void
|
||||
StickLayoutFunc(void *unused)
|
||||
{
|
||||
Cvar_SetValue("joy_layout", (int)s_stk_layout_box.curvalue);
|
||||
}
|
||||
|
||||
static void
|
||||
Stick_MenuInit(void)
|
||||
{
|
||||
static const char *stick_layouts[] =
|
||||
{
|
||||
"default",
|
||||
"southpaw",
|
||||
"legacy",
|
||||
"legacy southpaw",
|
||||
0
|
||||
};
|
||||
|
||||
static const char *stick_layouts_fs[] =
|
||||
{
|
||||
"default",
|
||||
"southpaw",
|
||||
"legacy",
|
||||
"legacy southpaw",
|
||||
"flick stick",
|
||||
"flick stick spaw",
|
||||
0
|
||||
};
|
||||
|
||||
int y = 0;
|
||||
float scale = SCR_GetMenuScale();
|
||||
|
||||
s_sticks_config_menu.x = (int)(viddef.width * 0.50f);
|
||||
s_sticks_config_menu.nitems = 0;
|
||||
|
||||
s_stk_layout_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_stk_layout_box.generic.x = 0;
|
||||
s_stk_layout_box.generic.y = y;
|
||||
s_stk_layout_box.generic.name = "layout";
|
||||
s_stk_layout_box.generic.callback = StickLayoutFunc;
|
||||
if (gyro_hardware || joy_layout->value > 3)
|
||||
{
|
||||
s_stk_layout_box.itemnames = stick_layouts_fs;
|
||||
s_stk_layout_box.curvalue = ClampCvar(0, 5, joy_layout->value);
|
||||
}
|
||||
else
|
||||
{
|
||||
s_stk_layout_box.itemnames = stick_layouts;
|
||||
s_stk_layout_box.curvalue = ClampCvar(0, 3, joy_layout->value);
|
||||
}
|
||||
Menu_AddItem(&s_sticks_config_menu, (void *)&s_stk_layout_box);
|
||||
|
||||
s_stk_title_text[0].generic.type = MTYPE_SEPARATOR;
|
||||
s_stk_title_text[0].generic.x = 48 * scale + 30;
|
||||
s_stk_title_text[0].generic.y = (y += 20);
|
||||
s_stk_title_text[0].generic.name = "left stick";
|
||||
Menu_AddItem(&s_sticks_config_menu, (void *)&s_stk_title_text[0]);
|
||||
|
||||
s_stk_expo_slider[0].generic.type = MTYPE_SLIDER;
|
||||
s_stk_expo_slider[0].generic.x = 0;
|
||||
s_stk_expo_slider[0].generic.y = (y += 20);
|
||||
s_stk_expo_slider[0].generic.name = "expo";
|
||||
s_stk_expo_slider[0].cvar = "joy_left_expo";
|
||||
s_stk_expo_slider[0].minvalue = 1;
|
||||
s_stk_expo_slider[0].maxvalue = 5;
|
||||
Menu_AddItem(&s_sticks_config_menu, (void *)&s_stk_expo_slider[0]);
|
||||
|
||||
s_stk_snap_slider[0].generic.type = MTYPE_SLIDER;
|
||||
s_stk_snap_slider[0].generic.x = 0;
|
||||
s_stk_snap_slider[0].generic.y = (y += 10);
|
||||
s_stk_snap_slider[0].generic.name = "snap to axis";
|
||||
s_stk_snap_slider[0].cvar = "joy_left_snapaxis";
|
||||
s_stk_snap_slider[0].minvalue = 0.0f;
|
||||
s_stk_snap_slider[0].maxvalue = 0.24f;
|
||||
s_stk_snap_slider[0].slidestep = 0.01f;
|
||||
s_stk_snap_slider[0].printformat = "%.2f";
|
||||
Menu_AddItem(&s_sticks_config_menu, (void *)&s_stk_snap_slider[0]);
|
||||
|
||||
s_stk_dz_slider[0].generic.type = MTYPE_SLIDER;
|
||||
s_stk_dz_slider[0].generic.x = 0;
|
||||
s_stk_dz_slider[0].generic.y = (y += 10);
|
||||
s_stk_dz_slider[0].generic.name = "deadzone";
|
||||
s_stk_dz_slider[0].cvar = "joy_left_deadzone";
|
||||
s_stk_dz_slider[0].minvalue = 0.0f;
|
||||
s_stk_dz_slider[0].maxvalue = 0.24f;
|
||||
s_stk_dz_slider[0].slidestep = 0.01f;
|
||||
s_stk_dz_slider[0].printformat = "%.2f";
|
||||
Menu_AddItem(&s_sticks_config_menu, (void *)&s_stk_dz_slider[0]);
|
||||
|
||||
s_stk_title_text[1].generic.type = MTYPE_SEPARATOR;
|
||||
s_stk_title_text[1].generic.x = 48 * scale + 30;
|
||||
s_stk_title_text[1].generic.y = (y += 20);
|
||||
s_stk_title_text[1].generic.name = "right stick";
|
||||
Menu_AddItem(&s_sticks_config_menu, (void *)&s_stk_title_text[1]);
|
||||
|
||||
s_stk_expo_slider[1].generic.type = MTYPE_SLIDER;
|
||||
s_stk_expo_slider[1].generic.x = 0;
|
||||
s_stk_expo_slider[1].generic.y = (y += 20);
|
||||
s_stk_expo_slider[1].generic.name = "expo";
|
||||
s_stk_expo_slider[1].cvar = "joy_right_expo";
|
||||
s_stk_expo_slider[1].minvalue = 1;
|
||||
s_stk_expo_slider[1].maxvalue = 5;
|
||||
Menu_AddItem(&s_sticks_config_menu, (void *)&s_stk_expo_slider[1]);
|
||||
|
||||
s_stk_snap_slider[1].generic.type = MTYPE_SLIDER;
|
||||
s_stk_snap_slider[1].generic.x = 0;
|
||||
s_stk_snap_slider[1].generic.y = (y += 10);
|
||||
s_stk_snap_slider[1].generic.name = "snap to axis";
|
||||
s_stk_snap_slider[1].cvar = "joy_right_snapaxis";
|
||||
s_stk_snap_slider[1].minvalue = 0.0f;
|
||||
s_stk_snap_slider[1].maxvalue = 0.24f;
|
||||
s_stk_snap_slider[1].slidestep = 0.01f;
|
||||
s_stk_snap_slider[1].printformat = "%.2f";
|
||||
Menu_AddItem(&s_sticks_config_menu, (void *)&s_stk_snap_slider[1]);
|
||||
|
||||
s_stk_dz_slider[1].generic.type = MTYPE_SLIDER;
|
||||
s_stk_dz_slider[1].generic.x = 0;
|
||||
s_stk_dz_slider[1].generic.y = (y += 10);
|
||||
s_stk_dz_slider[1].generic.name = "deadzone";
|
||||
s_stk_dz_slider[1].cvar = "joy_right_deadzone";
|
||||
s_stk_dz_slider[1].minvalue = 0.0f;
|
||||
s_stk_dz_slider[1].maxvalue = 0.24f;
|
||||
s_stk_dz_slider[1].slidestep = 0.01f;
|
||||
s_stk_dz_slider[1].printformat = "%.2f";
|
||||
Menu_AddItem(&s_sticks_config_menu, (void *)&s_stk_dz_slider[1]);
|
||||
|
||||
Menu_Center(&s_sticks_config_menu);
|
||||
}
|
||||
|
||||
static void
|
||||
Stick_MenuDraw(void)
|
||||
{
|
||||
Menu_AdjustCursor(&s_sticks_config_menu, 1);
|
||||
Menu_Draw(&s_sticks_config_menu);
|
||||
M_Popup();
|
||||
}
|
||||
|
||||
static const char *
|
||||
Stick_MenuKey(int key)
|
||||
{
|
||||
return Default_MenuKey(&s_sticks_config_menu, key);
|
||||
}
|
||||
|
||||
static void
|
||||
M_Menu_Stick_f(void)
|
||||
{
|
||||
Stick_MenuInit();
|
||||
M_PushMenu(Stick_MenuDraw, Stick_MenuKey);
|
||||
}
|
||||
|
||||
/*
|
||||
* GYRO OPTIONS MENU
|
||||
*/
|
||||
|
@ -1612,7 +1776,6 @@ static menulist_s s_gyro_invertpitch_box;
|
|||
static menuseparator_s s_calibrating_text[2];
|
||||
static menuaction_s s_calibrate_gyro;
|
||||
|
||||
extern qboolean gyro_hardware;
|
||||
extern void StartCalibration(void);
|
||||
extern qboolean IsCalibrationZero(void);
|
||||
|
||||
|
@ -1805,14 +1968,12 @@ M_Menu_Gyro_f(void)
|
|||
/*
|
||||
* JOY MENU
|
||||
*/
|
||||
static menulist_s s_joy_layout_box;
|
||||
static menuslider_s s_joy_yawsensitivity_slider;
|
||||
static menuslider_s s_joy_pitchsensitivity_slider;
|
||||
static menuslider_s s_joy_forwardsensitivity_slider;
|
||||
static menuslider_s s_joy_sidesensitivity_slider;
|
||||
static menuslider_s s_joy_left_expo_slider;
|
||||
static menuslider_s s_joy_right_expo_slider;
|
||||
static menuslider_s s_joy_haptic_slider;
|
||||
static menuaction_s s_joy_stickcfg_action;
|
||||
static menuaction_s s_joy_gyro_action;
|
||||
static menuaction_s s_joy_customize_buttons_action;
|
||||
static menuaction_s s_joy_customize_alt_buttons_action;
|
||||
|
@ -1830,42 +1991,21 @@ CustomizeControllerAltButtonsFunc(void *unused)
|
|||
}
|
||||
|
||||
static void
|
||||
ConfigGyroFunc(void *unused)
|
||||
ConfigStickFunc(void *unused)
|
||||
{
|
||||
M_Menu_Gyro_f();
|
||||
M_Menu_Stick_f();
|
||||
}
|
||||
|
||||
static void
|
||||
StickLayoutFunc(void *unused)
|
||||
ConfigGyroFunc(void *unused)
|
||||
{
|
||||
Cvar_SetValue("joy_layout", (int)s_joy_layout_box.curvalue);
|
||||
M_Menu_Gyro_f();
|
||||
}
|
||||
|
||||
static void
|
||||
Joy_MenuInit(void)
|
||||
{
|
||||
extern qboolean show_haptic;
|
||||
|
||||
static const char *stick_layouts[] =
|
||||
{
|
||||
"default",
|
||||
"southpaw",
|
||||
"legacy",
|
||||
"legacy southpaw",
|
||||
0
|
||||
};
|
||||
|
||||
static const char *stick_layouts_fs[] =
|
||||
{
|
||||
"default",
|
||||
"southpaw",
|
||||
"legacy",
|
||||
"legacy southpaw",
|
||||
"flick stick",
|
||||
"flick stick spaw",
|
||||
0
|
||||
};
|
||||
|
||||
int y = 0;
|
||||
|
||||
s_joy_menu.x = (int)(viddef.width * 0.50f);
|
||||
|
@ -1874,7 +2014,6 @@ Joy_MenuInit(void)
|
|||
s_joy_yawsensitivity_slider.generic.type = MTYPE_SLIDER;
|
||||
s_joy_yawsensitivity_slider.generic.x = 0;
|
||||
s_joy_yawsensitivity_slider.generic.y = y;
|
||||
y += 10;
|
||||
s_joy_yawsensitivity_slider.generic.name = "yaw sensitivity";
|
||||
s_joy_yawsensitivity_slider.cvar = "joy_yawsensitivity";
|
||||
s_joy_yawsensitivity_slider.minvalue = 0.0f;
|
||||
|
@ -1883,20 +2022,16 @@ Joy_MenuInit(void)
|
|||
|
||||
s_joy_pitchsensitivity_slider.generic.type = MTYPE_SLIDER;
|
||||
s_joy_pitchsensitivity_slider.generic.x = 0;
|
||||
s_joy_pitchsensitivity_slider.generic.y = y;
|
||||
y += 10;
|
||||
s_joy_pitchsensitivity_slider.generic.y = (y += 10);
|
||||
s_joy_pitchsensitivity_slider.generic.name = "pitch sensitivity";
|
||||
s_joy_pitchsensitivity_slider.cvar = "joy_pitchsensitivity";
|
||||
s_joy_pitchsensitivity_slider.minvalue = 0.0f;
|
||||
s_joy_pitchsensitivity_slider.maxvalue = 7.0f;
|
||||
Menu_AddItem(&s_joy_menu, (void *)&s_joy_pitchsensitivity_slider);
|
||||
|
||||
y += 10;
|
||||
|
||||
s_joy_forwardsensitivity_slider.generic.type = MTYPE_SLIDER;
|
||||
s_joy_forwardsensitivity_slider.generic.x = 0;
|
||||
s_joy_forwardsensitivity_slider.generic.y = y;
|
||||
y += 10;
|
||||
s_joy_forwardsensitivity_slider.generic.y = (y += 20);
|
||||
s_joy_forwardsensitivity_slider.generic.name = "forward sensitivity";
|
||||
s_joy_forwardsensitivity_slider.cvar = "joy_forwardsensitivity";
|
||||
s_joy_forwardsensitivity_slider.minvalue = 0.0f;
|
||||
|
@ -1905,43 +2040,17 @@ Joy_MenuInit(void)
|
|||
|
||||
s_joy_sidesensitivity_slider.generic.type = MTYPE_SLIDER;
|
||||
s_joy_sidesensitivity_slider.generic.x = 0;
|
||||
s_joy_sidesensitivity_slider.generic.y = y;
|
||||
y += 10;
|
||||
s_joy_sidesensitivity_slider.generic.y = (y += 10);
|
||||
s_joy_sidesensitivity_slider.generic.name = "side sensitivity";
|
||||
s_joy_sidesensitivity_slider.cvar = "joy_sidesensitivity";
|
||||
s_joy_sidesensitivity_slider.minvalue = 0.0f;
|
||||
s_joy_sidesensitivity_slider.maxvalue = 2.0f;
|
||||
Menu_AddItem(&s_joy_menu, (void *)&s_joy_sidesensitivity_slider);
|
||||
|
||||
y += 10;
|
||||
|
||||
s_joy_left_expo_slider.generic.type = MTYPE_SLIDER;
|
||||
s_joy_left_expo_slider.generic.x = 0;
|
||||
s_joy_left_expo_slider.generic.y = y;
|
||||
y += 10;
|
||||
s_joy_left_expo_slider.generic.name = "left expo";
|
||||
s_joy_left_expo_slider.cvar = "joy_left_expo";
|
||||
s_joy_left_expo_slider.minvalue = 1;
|
||||
s_joy_left_expo_slider.maxvalue = 5;
|
||||
Menu_AddItem(&s_joy_menu, (void *)&s_joy_left_expo_slider);
|
||||
|
||||
s_joy_right_expo_slider.generic.type = MTYPE_SLIDER;
|
||||
s_joy_right_expo_slider.generic.x = 0;
|
||||
s_joy_right_expo_slider.generic.y = y;
|
||||
y += 10;
|
||||
s_joy_right_expo_slider.generic.name = "right expo";
|
||||
s_joy_right_expo_slider.cvar = "joy_right_expo";
|
||||
s_joy_right_expo_slider.minvalue = 1;
|
||||
s_joy_right_expo_slider.maxvalue = 5;
|
||||
Menu_AddItem(&s_joy_menu, (void *)&s_joy_right_expo_slider);
|
||||
|
||||
if (show_haptic) {
|
||||
y += 10;
|
||||
|
||||
s_joy_haptic_slider.generic.type = MTYPE_SLIDER;
|
||||
s_joy_haptic_slider.generic.x = 0;
|
||||
s_joy_haptic_slider.generic.y = y;
|
||||
y += 10;
|
||||
s_joy_haptic_slider.generic.y = (y += 20);
|
||||
s_joy_haptic_slider.generic.name = "rumble intensity";
|
||||
s_joy_haptic_slider.cvar = "joy_haptic_magnitude";
|
||||
s_joy_haptic_slider.minvalue = 0.0f;
|
||||
|
@ -1949,53 +2058,33 @@ Joy_MenuInit(void)
|
|||
Menu_AddItem(&s_joy_menu, (void *)&s_joy_haptic_slider);
|
||||
}
|
||||
|
||||
y += 10;
|
||||
|
||||
s_joy_layout_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_joy_layout_box.generic.x = 0;
|
||||
s_joy_layout_box.generic.y = y;
|
||||
y += 10;
|
||||
s_joy_layout_box.generic.name = "stick layout";
|
||||
s_joy_layout_box.generic.callback = StickLayoutFunc;
|
||||
if (gyro_hardware || joy_layout->value > 3)
|
||||
{
|
||||
s_joy_layout_box.itemnames = stick_layouts_fs;
|
||||
s_joy_layout_box.curvalue = ClampCvar(0, 5, joy_layout->value);
|
||||
}
|
||||
else
|
||||
{
|
||||
s_joy_layout_box.itemnames = stick_layouts;
|
||||
s_joy_layout_box.curvalue = ClampCvar(0, 3, joy_layout->value);
|
||||
}
|
||||
Menu_AddItem(&s_joy_menu, (void *)&s_joy_layout_box);
|
||||
s_joy_stickcfg_action.generic.type = MTYPE_ACTION;
|
||||
s_joy_stickcfg_action.generic.x = 0;
|
||||
s_joy_stickcfg_action.generic.y = (y += 20);
|
||||
s_joy_stickcfg_action.generic.name = "sticks config";
|
||||
s_joy_stickcfg_action.generic.callback = ConfigStickFunc;
|
||||
Menu_AddItem(&s_joy_menu, (void *)&s_joy_stickcfg_action);
|
||||
|
||||
if (gyro_hardware)
|
||||
{
|
||||
y += 10;
|
||||
|
||||
s_joy_gyro_action.generic.type = MTYPE_ACTION;
|
||||
s_joy_gyro_action.generic.x = 0;
|
||||
s_joy_gyro_action.generic.y = y;
|
||||
y += 10;
|
||||
s_joy_gyro_action.generic.y = (y += 10);
|
||||
s_joy_gyro_action.generic.name = "gyro options";
|
||||
s_joy_gyro_action.generic.callback = ConfigGyroFunc;
|
||||
Menu_AddItem(&s_joy_menu, (void *)&s_joy_gyro_action);
|
||||
}
|
||||
|
||||
y += 10;
|
||||
|
||||
s_joy_customize_buttons_action.generic.type = MTYPE_ACTION;
|
||||
s_joy_customize_buttons_action.generic.x = 0;
|
||||
s_joy_customize_buttons_action.generic.y = y;
|
||||
y += 10;
|
||||
s_joy_customize_buttons_action.generic.y = (y += 20);
|
||||
s_joy_customize_buttons_action.generic.name = "customize buttons";
|
||||
s_joy_customize_buttons_action.generic.callback = CustomizeControllerButtonsFunc;
|
||||
Menu_AddItem(&s_joy_menu, (void *)&s_joy_customize_buttons_action);
|
||||
|
||||
s_joy_customize_alt_buttons_action.generic.type = MTYPE_ACTION;
|
||||
s_joy_customize_alt_buttons_action.generic.x = 0;
|
||||
s_joy_customize_alt_buttons_action.generic.y = y;
|
||||
y += 10;
|
||||
s_joy_customize_alt_buttons_action.generic.y = (y += 10);
|
||||
s_joy_customize_alt_buttons_action.generic.name = "custom. alt buttons";
|
||||
s_joy_customize_alt_buttons_action.generic.callback = CustomizeControllerAltButtonsFunc;
|
||||
Menu_AddItem(&s_joy_menu, (void *)&s_joy_customize_alt_buttons_action);
|
||||
|
|
Loading…
Reference in a new issue