mirror of
https://github.com/DrBeef/Quake2Quest.git
synced 2024-11-12 23:54:24 +00:00
Menu Options
This commit is contained in:
parent
ec228f855e
commit
5ce1078d61
2 changed files with 72 additions and 61 deletions
|
@ -33,6 +33,7 @@
|
|||
#include "../header/client.h"
|
||||
#include "../sound/header/local.h"
|
||||
#include "header/qmenu.h"
|
||||
#include "../../../../Quake2VR/VrCvars.h"
|
||||
|
||||
static int m_main_cursor;
|
||||
|
||||
|
@ -1053,10 +1054,10 @@ static menuframework_s s_options_menu;
|
|||
static menuaction_s s_options_defaults_action;
|
||||
static menuaction_s s_options_customize_options_action;
|
||||
static menuslider_s s_options_sensitivity_slider;
|
||||
static menulist_s s_options_freelook_box;
|
||||
static menuslider_s s_options_vr_height_adjust_box;
|
||||
static menulist_s s_options_alwaysrun_box;
|
||||
static menulist_s s_options_invertmouse_box;
|
||||
static menulist_s s_options_lookstrafe_box;
|
||||
static menulist_s s_options_handedness_box;
|
||||
static menulist_s s_options_vr_walkdirection_box;
|
||||
static menulist_s s_options_crosshair_box;
|
||||
static menuslider_s s_options_sfxvolume_slider;
|
||||
static menuslider_s s_options_haptic_slider;
|
||||
|
@ -1091,9 +1092,9 @@ AlwaysRunFunc(void *unused)
|
|||
}
|
||||
|
||||
static void
|
||||
FreeLookFunc(void *unused)
|
||||
HeightAdjustFunc(void *unused)
|
||||
{
|
||||
Cvar_SetValue("freelook", (float)s_options_freelook_box.curvalue);
|
||||
Cvar_SetValue("vr_height_adjust", (float)(s_options_vr_height_adjust_box.curvalue / 10.0f));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1128,9 +1129,9 @@ ControlsSetMenuItemValues(void)
|
|||
s_options_quality_list.curvalue = (Cvar_VariableValue("s_loadas8bit") == 0);
|
||||
s_options_sensitivity_slider.curvalue = sensitivity->value * 2;
|
||||
s_options_alwaysrun_box.curvalue = (cl_run->value != 0);
|
||||
s_options_invertmouse_box.curvalue = (m_pitch->value < 0);
|
||||
s_options_lookstrafe_box.curvalue = (lookstrafe->value != 0);
|
||||
s_options_freelook_box.curvalue = (freelook->value != 0);
|
||||
s_options_handedness_box.curvalue = (vr_control_scheme->value == 0) ? 0 : 1;
|
||||
s_options_vr_walkdirection_box.curvalue = (int)vr_walkdirection->value;
|
||||
s_options_vr_height_adjust_box.curvalue = vr_height_adjust->value * 10.0f;
|
||||
s_options_crosshair_box.curvalue = ClampCvar(0, 3, crosshair->value);
|
||||
s_options_haptic_slider.curvalue = Cvar_VariableValue("joy_haptic_magnitude") * 10.0F;
|
||||
}
|
||||
|
@ -1146,15 +1147,15 @@ ControlsResetDefaultsFunc(void *unused)
|
|||
}
|
||||
|
||||
static void
|
||||
InvertMouseFunc(void *unused)
|
||||
HandednessFunc(void *unused)
|
||||
{
|
||||
Cvar_SetValue("m_pitch", -m_pitch->value);
|
||||
Cvar_SetValue("vr_control_scheme", s_options_handedness_box.curvalue == 0 ? 0 : 10);
|
||||
}
|
||||
|
||||
static void
|
||||
LookstrafeFunc(void *unused)
|
||||
{
|
||||
Cvar_SetValue("lookstrafe", (float)!lookstrafe->value);
|
||||
Cvar_SetValue("vr_walkdirection", (float)(1.0f - vr_walkdirection->value));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1362,26 +1363,39 @@ Options_MenuInit(void)
|
|||
s_options_alwaysrun_box.generic.callback = AlwaysRunFunc;
|
||||
s_options_alwaysrun_box.itemnames = yesno_names;
|
||||
|
||||
s_options_invertmouse_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_options_invertmouse_box.generic.x = 0;
|
||||
s_options_invertmouse_box.generic.y = 80;
|
||||
s_options_invertmouse_box.generic.name = "invert mouse";
|
||||
s_options_invertmouse_box.generic.callback = InvertMouseFunc;
|
||||
s_options_invertmouse_box.itemnames = yesno_names;
|
||||
static const char *handedness[] = {
|
||||
"Right-Handed",
|
||||
"Left-Handed",
|
||||
0
|
||||
};
|
||||
|
||||
s_options_lookstrafe_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_options_lookstrafe_box.generic.x = 0;
|
||||
s_options_lookstrafe_box.generic.y = 90;
|
||||
s_options_lookstrafe_box.generic.name = "lookstrafe";
|
||||
s_options_lookstrafe_box.generic.callback = LookstrafeFunc;
|
||||
s_options_lookstrafe_box.itemnames = yesno_names;
|
||||
s_options_handedness_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_options_handedness_box.generic.x = 0;
|
||||
s_options_handedness_box.generic.y = 80;
|
||||
s_options_handedness_box.generic.name = "Handedness";
|
||||
s_options_handedness_box.generic.callback = HandednessFunc;
|
||||
s_options_handedness_box.itemnames = handedness;
|
||||
|
||||
s_options_freelook_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_options_freelook_box.generic.x = 0;
|
||||
s_options_freelook_box.generic.y = 100;
|
||||
s_options_freelook_box.generic.name = "free look";
|
||||
s_options_freelook_box.generic.callback = FreeLookFunc;
|
||||
s_options_freelook_box.itemnames = yesno_names;
|
||||
static const char *movedirections[] = {
|
||||
"Off-hand Controller",
|
||||
"Gaze Direction",
|
||||
0
|
||||
};
|
||||
|
||||
s_options_vr_walkdirection_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_options_vr_walkdirection_box.generic.x = 0;
|
||||
s_options_vr_walkdirection_box.generic.y = 90;
|
||||
s_options_vr_walkdirection_box.generic.name = "VR Move Direction";
|
||||
s_options_vr_walkdirection_box.generic.callback = LookstrafeFunc;
|
||||
s_options_vr_walkdirection_box.itemnames = movedirections;
|
||||
|
||||
s_options_vr_height_adjust_box.generic.type = MTYPE_SLIDER;
|
||||
s_options_vr_height_adjust_box.generic.x = 0;
|
||||
s_options_vr_height_adjust_box.generic.y = 100;
|
||||
s_options_vr_height_adjust_box.generic.name = "VR Height Adjust";
|
||||
s_options_vr_height_adjust_box.generic.callback = HeightAdjustFunc;
|
||||
s_options_vr_height_adjust_box.minvalue = 0;
|
||||
s_options_vr_height_adjust_box.maxvalue = 10;
|
||||
|
||||
s_options_crosshair_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_options_crosshair_box.generic.x = 0;
|
||||
|
@ -1424,17 +1438,17 @@ Options_MenuInit(void)
|
|||
Menu_AddItem(&s_options_menu, (void *)&s_options_oggenable_box);
|
||||
Menu_AddItem(&s_options_menu, (void *)&s_options_oggshuffle_box);
|
||||
Menu_AddItem(&s_options_menu, (void *)&s_options_quality_list);
|
||||
Menu_AddItem(&s_options_menu, (void *)&s_options_sensitivity_slider);
|
||||
// Menu_AddItem(&s_options_menu, (void *)&s_options_sensitivity_slider);
|
||||
Menu_AddItem(&s_options_menu, (void *)&s_options_alwaysrun_box);
|
||||
Menu_AddItem(&s_options_menu, (void *)&s_options_invertmouse_box);
|
||||
Menu_AddItem(&s_options_menu, (void *)&s_options_lookstrafe_box);
|
||||
Menu_AddItem(&s_options_menu, (void *)&s_options_freelook_box);
|
||||
Menu_AddItem(&s_options_menu, (void *)&s_options_crosshair_box);
|
||||
Menu_AddItem(&s_options_menu, (void *)&s_options_handedness_box);
|
||||
Menu_AddItem(&s_options_menu, (void *)&s_options_vr_walkdirection_box);
|
||||
Menu_AddItem(&s_options_menu, (void *)&s_options_vr_height_adjust_box);
|
||||
// Menu_AddItem(&s_options_menu, (void *)&s_options_crosshair_box);
|
||||
|
||||
// if (show_haptic)
|
||||
// Menu_AddItem(&s_options_menu, (void *)&s_options_haptic_slider);
|
||||
|
||||
Menu_AddItem(&s_options_menu, (void *)&s_options_customize_options_action);
|
||||
// Menu_AddItem(&s_options_menu, (void *)&s_options_customize_options_action);
|
||||
Menu_AddItem(&s_options_menu, (void *)&s_options_defaults_action);
|
||||
Menu_AddItem(&s_options_menu, (void *)&s_options_console_action);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "../../client/header/client.h"
|
||||
#include "../../client/menu/header/qmenu.h"
|
||||
#include "header/qmenu.h"
|
||||
#include "../../../../Quake2VR/VrCvars.h"
|
||||
|
||||
extern void M_ForceMenuOff(void);
|
||||
|
||||
|
@ -47,11 +48,11 @@ static cvar_t *gl_msaa_samples;
|
|||
|
||||
static menuframework_s s_opengl_menu;
|
||||
|
||||
static menulist_s s_renderer_list;
|
||||
static menulist_s s_mode_list;
|
||||
//static menulist_s s_renderer_list;
|
||||
//static menulist_s s_mode_list;
|
||||
static menulist_s s_uiscale_list;
|
||||
static menuslider_s s_brightness_slider;
|
||||
static menuslider_s s_fov_slider;
|
||||
static menuslider_s s_comfort_slider;
|
||||
static menulist_s s_fs_box;
|
||||
static menulist_s s_vsync_list;
|
||||
static menulist_s s_af_list;
|
||||
|
@ -127,9 +128,9 @@ BrightnessCallback(void *s)
|
|||
}
|
||||
|
||||
static void
|
||||
FOVCallback(void *s) {
|
||||
ComfortCallback(void *s) {
|
||||
menuslider_s *slider = (menuslider_s *)s;
|
||||
Cvar_SetValue("fov", slider->curvalue);
|
||||
Cvar_SetValue("vr_comfort_mask", slider->curvalue / 10.0f);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -161,12 +162,9 @@ ApplyChanges(void *unused)
|
|||
{
|
||||
qboolean restart = false;
|
||||
|
||||
/* Renderer */
|
||||
/*
|
||||
if (s_renderer_list.curvalue != GetRenderer())
|
||||
{
|
||||
/* First element in array is 'OpenGL 1.4' aka gl1.
|
||||
Second element in array is 'OpenGL 3.2' aka gl3.
|
||||
Third element in array is unknown renderer. */
|
||||
if (s_renderer_list.curvalue == 0)
|
||||
{
|
||||
Cvar_Set("vid_renderer", "gl1");
|
||||
|
@ -184,24 +182,21 @@ ApplyChanges(void *unused)
|
|||
}
|
||||
}
|
||||
|
||||
/* auto mode */
|
||||
if (!strcmp(s_mode_list.itemnames[s_mode_list.curvalue],
|
||||
AUTO_MODE_NAME))
|
||||
{
|
||||
/* Restarts automatically */
|
||||
Cvar_SetValue("r_mode", -2);
|
||||
}
|
||||
else if (!strcmp(s_mode_list.itemnames[s_mode_list.curvalue],
|
||||
CUSTOM_MODE_NAME))
|
||||
{
|
||||
/* Restarts automatically */
|
||||
Cvar_SetValue("r_mode", -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Restarts automatically */
|
||||
Cvar_SetValue("r_mode", s_mode_list.curvalue);
|
||||
}
|
||||
*/
|
||||
|
||||
/* UI scaling */
|
||||
if (s_uiscale_list.curvalue == 0)
|
||||
|
@ -399,7 +394,7 @@ VID_MenuInit(void)
|
|||
s_opengl_menu.x = viddef.width * 0.50;
|
||||
s_opengl_menu.nitems = 0;
|
||||
|
||||
s_renderer_list.generic.type = MTYPE_SPINCONTROL;
|
||||
/* s_renderer_list.generic.type = MTYPE_SPINCONTROL;
|
||||
s_renderer_list.generic.name = "renderer";
|
||||
s_renderer_list.generic.x = 0;
|
||||
s_renderer_list.generic.y = (y = 0);
|
||||
|
@ -412,6 +407,7 @@ VID_MenuInit(void)
|
|||
s_mode_list.generic.y = (y += 10);
|
||||
s_mode_list.itemnames = resolutions;
|
||||
|
||||
|
||||
if (r_mode->value >= 0)
|
||||
{
|
||||
s_mode_list.curvalue = r_mode->value;
|
||||
|
@ -426,11 +422,12 @@ VID_MenuInit(void)
|
|||
// 'custom'
|
||||
s_mode_list.curvalue = GetCustomValue(&s_mode_list);
|
||||
}
|
||||
*/
|
||||
|
||||
s_brightness_slider.generic.type = MTYPE_SLIDER;
|
||||
s_brightness_slider.generic.name = "brightness";
|
||||
s_brightness_slider.generic.x = 0;
|
||||
s_brightness_slider.generic.y = (y += 20);
|
||||
s_brightness_slider.generic.y = (y = 0);
|
||||
s_brightness_slider.generic.callback = BrightnessCallback;
|
||||
s_brightness_slider.minvalue = 1;
|
||||
s_brightness_slider.maxvalue = 20;
|
||||
|
@ -448,14 +445,14 @@ VID_MenuInit(void)
|
|||
s_brightness_slider.curvalue = vid_gamma->value * 10;
|
||||
#endif
|
||||
|
||||
s_fov_slider.generic.type = MTYPE_SLIDER;
|
||||
s_fov_slider.generic.x = 0;
|
||||
s_fov_slider.generic.y = (y += 10);
|
||||
s_fov_slider.generic.name = "field of view";
|
||||
s_fov_slider.generic.callback = FOVCallback;
|
||||
s_fov_slider.minvalue = 60;
|
||||
s_fov_slider.maxvalue = 120;
|
||||
s_fov_slider.curvalue = fov->value;
|
||||
s_comfort_slider.generic.type = MTYPE_SLIDER;
|
||||
s_comfort_slider.generic.x = 0;
|
||||
s_comfort_slider.generic.y = (y += 10);
|
||||
s_comfort_slider.generic.name = "Comfort Mask";
|
||||
s_comfort_slider.generic.callback = ComfortCallback;
|
||||
s_comfort_slider.minvalue = 0;
|
||||
s_comfort_slider.maxvalue = 9;
|
||||
s_comfort_slider.curvalue = vr_comfort_mask->value * 10.0f;
|
||||
|
||||
s_uiscale_list.generic.type = MTYPE_SPINCONTROL;
|
||||
s_uiscale_list.generic.name = "ui scale";
|
||||
|
@ -542,10 +539,10 @@ VID_MenuInit(void)
|
|||
s_apply_action.generic.y = (y += 10);
|
||||
s_apply_action.generic.callback = ApplyChanges;
|
||||
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_renderer_list);
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_mode_list);
|
||||
// Menu_AddItem(&s_opengl_menu, (void *)&s_renderer_list);
|
||||
// Menu_AddItem(&s_opengl_menu, (void *)&s_mode_list);
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_brightness_slider);
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_fov_slider);
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_comfort_slider);
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_uiscale_list);
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_fs_box);
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_vsync_list);
|
||||
|
|
Loading…
Reference in a new issue