mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-22 20:11:40 +00:00
Merge pull request #22 from petr666/feature/switchable-thumbsticks-and-menu-update
Switchable thumbsticks and menu update
This commit is contained in:
commit
b3beeeef00
13 changed files with 92 additions and 39 deletions
Binary file not shown.
|
@ -2095,10 +2095,13 @@ void CG_DrawWeaponSelector( void )
|
|||
VectorMA(holsterOrigin, ((DEPTH*2.0f)*((selectorMode == WS_CONTROLLER) ? frac : 1.0f)), holsterForward, holsterOrigin);
|
||||
VectorCopy(holsterOrigin, selectorOrigin);
|
||||
|
||||
const int switchThumbsticks = (int)trap_Cvar_VariableValue("vr_switchThumbsticks");
|
||||
const int thumb = switchThumbsticks !=0 ? THUMB_LEFT : THUMB_RIGHT;
|
||||
|
||||
float thumbstickAxisX = 0.0f;
|
||||
float thumbstickAxisY = 0.0f;
|
||||
float a = atan2(vr->thumbstick_location[THUMB_RIGHT][0], vr->thumbstick_location[THUMB_RIGHT][1]);
|
||||
if (length(vr->thumbstick_location[THUMB_RIGHT][0], vr->thumbstick_location[THUMB_RIGHT][1]) > 0.95f)
|
||||
float a = atan2(vr->thumbstick_location[thumb][0], vr->thumbstick_location[thumb][1]);
|
||||
if (length(vr->thumbstick_location[thumb][0], vr->thumbstick_location[thumb][1]) > 0.95f)
|
||||
{
|
||||
thumbstickAxisX = sinf(a) * 0.95f;
|
||||
thumbstickAxisY = cosf(a) * 0.95f;
|
||||
|
@ -2216,7 +2219,7 @@ void CG_DrawWeaponSelector( void )
|
|||
float high = ((iconAngles[w]+iconAngles[w+1])/2.0f);
|
||||
|
||||
if (((angle > low && angle <= high) || (angle360 > low && angle360 <= high)) &&
|
||||
(length(vr->thumbstick_location[THUMB_RIGHT][0], vr->thumbstick_location[THUMB_RIGHT][1]) > 0.5f) &&
|
||||
(length(vr->thumbstick_location[thumb][0], vr->thumbstick_location[thumb][1]) > 0.5f) &&
|
||||
selectable)
|
||||
{
|
||||
if (cg.weaponSelectorSelection != w)
|
||||
|
|
|
@ -37,7 +37,7 @@ CONTROLS OPTIONS MENU
|
|||
#define ART_BACK0 "menu/art/back_0"
|
||||
#define ART_BACK1 "menu/art/back_1"
|
||||
|
||||
#define VR_X_POS 260
|
||||
#define VR_X_POS 330
|
||||
|
||||
#define ID_AUTOSWITCH 127
|
||||
#define ID_SCOPE 128
|
||||
|
@ -49,8 +49,9 @@ CONTROLS OPTIONS MENU
|
|||
#define ID_WEAPONSELECTORMODE 134
|
||||
#define ID_UTURN 135
|
||||
#define ID_CONTROLSCHEMA 136
|
||||
#define ID_SWITCHTHUMBSTICKS 137
|
||||
|
||||
#define ID_BACK 137
|
||||
#define ID_BACK 138
|
||||
|
||||
#define NUM_DIRECTIONMODE 2
|
||||
|
||||
|
@ -72,6 +73,7 @@ typedef struct {
|
|||
menuslider_s weaponpitch;
|
||||
menulist_s weaponselectormode;
|
||||
menulist_s controlschema;
|
||||
menuradiobutton_s switchthumbsticks;
|
||||
|
||||
menubitmap_s back;
|
||||
} controls3_t;
|
||||
|
@ -90,6 +92,7 @@ static void Controls3_SetMenuItems( void ) {
|
|||
s_controls3.weaponpitch.curvalue = trap_Cvar_VariableValue( "vr_weaponPitch" ) + 25;
|
||||
s_controls3.weaponselectormode.curvalue = (int)trap_Cvar_VariableValue( "vr_weaponSelectorMode" ) % 2;
|
||||
s_controls3.controlschema.curvalue = (int)trap_Cvar_VariableValue( "vr_controlSchema" ) % 2;
|
||||
s_controls3.switchthumbsticks.curvalue = trap_Cvar_VariableValue( "vr_switchThumbsticks" ) != 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -208,6 +211,10 @@ static void Controls3_MenuEvent( void* ptr, int notification ) {
|
|||
trap_Cvar_SetValue( "vr_controlSchema", s_controls3.controlschema.curvalue );
|
||||
break;
|
||||
|
||||
case ID_SWITCHTHUMBSTICKS:
|
||||
trap_Cvar_SetValue( "vr_switchThumbsticks", s_controls3.switchthumbsticks.curvalue );
|
||||
break;
|
||||
|
||||
case ID_BACK:
|
||||
UI_PopMenu();
|
||||
break;
|
||||
|
@ -234,15 +241,15 @@ static void Controls3_MenuInit( void ) {
|
|||
|
||||
static const char *s_weaponselectormode[] =
|
||||
{
|
||||
"Controller Weapon Selector",
|
||||
"HMD Weapon Wheel",
|
||||
"Controller Based",
|
||||
"HMD/Thumbstick Based",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char *s_controlschema[] =
|
||||
{
|
||||
"Default (Weapon Selector on Right Grip)",
|
||||
"Alternative (Weapon Selector on Right Thumbstick)",
|
||||
"Weapon Wheel on Grip",
|
||||
"Weapon Wheel on Thumbstick",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -343,6 +350,15 @@ static void Controls3_MenuInit( void ) {
|
|||
s_controls3.righthanded.generic.x = VR_X_POS;
|
||||
s_controls3.righthanded.generic.y = y;
|
||||
|
||||
y += BIGCHAR_HEIGHT+2;
|
||||
s_controls3.switchthumbsticks.generic.type = MTYPE_RADIOBUTTON;
|
||||
s_controls3.switchthumbsticks.generic.name = "Switch Thumbsticks:";
|
||||
s_controls3.switchthumbsticks.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
|
||||
s_controls3.switchthumbsticks.generic.callback = Controls3_MenuEvent;
|
||||
s_controls3.switchthumbsticks.generic.id = ID_SWITCHTHUMBSTICKS;
|
||||
s_controls3.switchthumbsticks.generic.x = VR_X_POS;
|
||||
s_controls3.switchthumbsticks.generic.y = y;
|
||||
|
||||
y += BIGCHAR_HEIGHT+2;
|
||||
s_controls3.weaponpitch.generic.type = MTYPE_SLIDER;
|
||||
s_controls3.weaponpitch.generic.x = VR_X_POS;
|
||||
|
@ -359,7 +375,7 @@ static void Controls3_MenuInit( void ) {
|
|||
s_controls3.weaponselectormode.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
|
||||
s_controls3.weaponselectormode.generic.x = VR_X_POS;
|
||||
s_controls3.weaponselectormode.generic.y = y;
|
||||
s_controls3.weaponselectormode.generic.name = "Weapon Selector Mode:";
|
||||
s_controls3.weaponselectormode.generic.name = "Weapon Wheel Mode:";
|
||||
s_controls3.weaponselectormode.generic.callback = Controls3_MenuEvent;
|
||||
s_controls3.weaponselectormode.generic.id = ID_WEAPONSELECTORMODE;
|
||||
s_controls3.weaponselectormode.itemnames = s_weaponselectormode;
|
||||
|
@ -401,6 +417,7 @@ static void Controls3_MenuInit( void ) {
|
|||
Menu_AddItem( &s_controls3.menu, &s_controls3.weaponpitch );
|
||||
Menu_AddItem( &s_controls3.menu, &s_controls3.weaponselectormode );
|
||||
Menu_AddItem( &s_controls3.menu, &s_controls3.controlschema );
|
||||
Menu_AddItem( &s_controls3.menu, &s_controls3.switchthumbsticks );
|
||||
|
||||
Menu_AddItem( &s_controls3.menu, &s_controls3.back );
|
||||
|
||||
|
|
|
@ -363,7 +363,7 @@ static void Preferences_MenuInit( void ) {
|
|||
|
||||
y += BIGCHAR_HEIGHT+2;
|
||||
s_preferences.holster2d.generic.type = MTYPE_RADIOBUTTON;
|
||||
s_preferences.holster2d.generic.name = "Simple Items (Holster):";
|
||||
s_preferences.holster2d.generic.name = "Simple Items (Weapon Wheel):";
|
||||
s_preferences.holster2d.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
|
||||
s_preferences.holster2d.generic.callback = Preferences_Event;
|
||||
s_preferences.holster2d.generic.id = ID_HOLSTER2D;
|
||||
|
@ -463,7 +463,7 @@ static void Preferences_MenuInit( void ) {
|
|||
|
||||
y += BIGCHAR_HEIGHT+2;
|
||||
s_preferences.selectorwithhud.generic.type = MTYPE_RADIOBUTTON;
|
||||
s_preferences.selectorwithhud.generic.name = "Draw HUD On Weapon Selector:";
|
||||
s_preferences.selectorwithhud.generic.name = "Draw HUD On Weapon Wheel:";
|
||||
s_preferences.selectorwithhud.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
|
||||
s_preferences.selectorwithhud.generic.callback = Preferences_Event;
|
||||
s_preferences.selectorwithhud.generic.id = ID_SELECTORWITHHUD;
|
||||
|
|
|
@ -1090,7 +1090,7 @@ void GraphicsOptions_MenuInit( void )
|
|||
static const char *s_refreshrate[] =
|
||||
{
|
||||
"60",
|
||||
"72 (Default)",
|
||||
"72 (Recommended)",
|
||||
"80",
|
||||
"90",
|
||||
NULL
|
||||
|
|
|
@ -21,6 +21,7 @@ static engine_t vr_engine;
|
|||
cvar_t *vr_worldscale = NULL;
|
||||
cvar_t *vr_hudDepth = NULL;
|
||||
cvar_t *vr_righthanded = NULL;
|
||||
cvar_t *vr_switchThumbsticks = NULL;
|
||||
cvar_t *vr_snapturn = NULL;
|
||||
cvar_t *vr_heightAdjust = NULL;
|
||||
cvar_t *vr_extralatencymode = NULL;
|
||||
|
@ -61,6 +62,7 @@ void VR_InitCvars( void )
|
|||
vr_worldscale = Cvar_Get ("vr_worldscale", "32.0", CVAR_ARCHIVE);
|
||||
vr_hudDepth = Cvar_Get ("vr_hudDepth", "3", CVAR_ARCHIVE);
|
||||
vr_righthanded = Cvar_Get ("vr_righthanded", "1", CVAR_ARCHIVE);
|
||||
vr_switchThumbsticks = Cvar_Get ("vr_switchThumbsticks", "0", CVAR_ARCHIVE);
|
||||
vr_snapturn = Cvar_Get ("vr_snapturn", "45", CVAR_ARCHIVE);
|
||||
vr_extralatencymode = Cvar_Get ("vr_extralatencymode", "1", CVAR_ARCHIVE);
|
||||
vr_directionMode = Cvar_Get ("vr_directionMode", "0", CVAR_ARCHIVE); // 0 = HMD, 1 = Off-hand
|
||||
|
|
|
@ -67,6 +67,7 @@ float degrees(float rad) {
|
|||
#endif
|
||||
|
||||
extern cvar_t *vr_righthanded;
|
||||
extern cvar_t *vr_switchThumbsticks;
|
||||
extern cvar_t *vr_snapturn;
|
||||
extern cvar_t *vr_extralatencymode;
|
||||
extern cvar_t *vr_directionMode;
|
||||
|
@ -505,7 +506,7 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
|
|||
Com_QueueEvent(in_vrEventTime, SE_MOUSE, x, y, 0, NULL);
|
||||
} else
|
||||
{
|
||||
if (isRightController == qfalse) {
|
||||
if (isRightController == (vr_switchThumbsticks->integer != 0)) {
|
||||
vec3_t positional;
|
||||
VectorClear(positional);
|
||||
|
||||
|
|
|
@ -128,13 +128,28 @@ itemDef {
|
|||
visible 1
|
||||
}
|
||||
|
||||
itemDef {
|
||||
name controls3
|
||||
group grpControls3
|
||||
type ITEM_TYPE_YESNO
|
||||
text "Switch Thumbsticks:"
|
||||
cvar "vr_switchThumbsticks"
|
||||
rect 99 275 256 20
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 128
|
||||
textaligny 20
|
||||
textscale .333
|
||||
forecolor 1 1 1 1
|
||||
visible 1
|
||||
}
|
||||
|
||||
itemDef {
|
||||
name controls3
|
||||
group grpControls3
|
||||
type ITEM_TYPE_SLIDER
|
||||
text "Weapon Pitch:"
|
||||
cvarfloat "vr_weaponPitch" 5 -25 5
|
||||
rect 99 275 256 20
|
||||
rect 99 300 256 20
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 128
|
||||
textaligny 20
|
||||
|
@ -147,10 +162,10 @@ itemDef {
|
|||
name controls3
|
||||
group grpControls3
|
||||
type ITEM_TYPE_MULTI
|
||||
text "Weapon Selector Mode:"
|
||||
text "Weapon Wheel Mode:"
|
||||
cvar "vr_weaponSelectorMode"
|
||||
cvarFloatList { "Controller Weapon Selector" 0 "HMD Weapon Wheel" 1 }
|
||||
rect 99 300 256 20
|
||||
cvarFloatList { "Controller Based" 0 "HMD/Thumbstick Based" 1 }
|
||||
rect 99 325 256 20
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 128
|
||||
textaligny 20
|
||||
|
|
|
@ -249,13 +249,28 @@ itemDef {
|
|||
visible 1
|
||||
}
|
||||
|
||||
itemDef {
|
||||
name controls
|
||||
group grpControls
|
||||
type ITEM_TYPE_YESNO
|
||||
text "Switch Thumbsticks:"
|
||||
cvar "vr_switchThumbsticks"
|
||||
rect 30 140 200 20
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 143
|
||||
textaligny 17
|
||||
textscale .25
|
||||
forecolor 1 1 1 1
|
||||
visible 1
|
||||
}
|
||||
|
||||
itemDef {
|
||||
name controls
|
||||
group grpControls
|
||||
type ITEM_TYPE_SLIDER
|
||||
text "Weapon Pitch:"
|
||||
cvarfloat "vr_weaponPitch" 5 -25 5
|
||||
rect 30 140 200 20
|
||||
rect 30 160 200 20
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 143
|
||||
textaligny 17
|
||||
|
@ -268,10 +283,10 @@ itemDef {
|
|||
name controls
|
||||
group grpControls
|
||||
type ITEM_TYPE_MULTI
|
||||
text "Weapon Selector Mode:"
|
||||
text "Weapon Wheel Mode:"
|
||||
cvar "vr_weaponSelectorMode"
|
||||
cvarFloatList { "Controller Weapon Selector" 0 "HMD Weapon Wheel" 1 }
|
||||
rect 30 160 200 20
|
||||
cvarFloatList { "Controller Based" 0 "HMD/Thumbstick Based" 1 }
|
||||
rect 30 180 200 20
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 143
|
||||
textaligny 17
|
||||
|
@ -285,7 +300,7 @@ itemDef {
|
|||
group grpControls
|
||||
style 1
|
||||
text "Comfort Options"
|
||||
rect 100 195 100 20
|
||||
rect 100 215 100 20
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 143
|
||||
textaligny 17
|
||||
|
@ -300,7 +315,7 @@ itemDef {
|
|||
type ITEM_TYPE_SLIDER
|
||||
text "Comfort Vignette:"
|
||||
cvarfloat "vr_comfortVignette" 0.2 0 1
|
||||
rect 30 220 200 20
|
||||
rect 30 240 200 20
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 143
|
||||
textaligny 17
|
||||
|
@ -314,7 +329,7 @@ itemDef {
|
|||
type ITEM_TYPE_SLIDER
|
||||
text "Height Adjust:"
|
||||
cvarfloat "vr_heightAdjust" 0.2 0 1
|
||||
rect 30 240 200 20
|
||||
rect 30 260 200 20
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 143
|
||||
textaligny 17
|
||||
|
@ -328,7 +343,7 @@ itemDef {
|
|||
type ITEM_TYPE_YESNO
|
||||
text "Roll When Hit:"
|
||||
cvar "vr_rollWhenHit"
|
||||
rect 30 260 200 20
|
||||
rect 30 280 200 20
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 143
|
||||
textaligny 17
|
||||
|
@ -342,7 +357,7 @@ itemDef {
|
|||
type ITEM_TYPE_SLIDER
|
||||
text "Haptic Intensity:"
|
||||
cvarfloat "vr_hapticIntensity" 0.2 0 1
|
||||
rect 30 280 200 20
|
||||
rect 30 300 200 20
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 143
|
||||
textaligny 17
|
||||
|
@ -357,7 +372,7 @@ itemDef {
|
|||
text "HUD Depth:"
|
||||
cvar "vr_hudDepth"
|
||||
cvarFloatList { "Very Close" 0 "Close" 1 "Middle" 2 "Further" 3 "Far" 4 "Distant" 5 }
|
||||
rect 30 300 200 20
|
||||
rect 30 320 200 20
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 143
|
||||
textaligny 17
|
||||
|
@ -371,7 +386,7 @@ itemDef {
|
|||
type ITEM_TYPE_SLIDER
|
||||
text "HUD Y Offset:"
|
||||
cvarfloat "vr_hudYOffset" 20 -200 200
|
||||
rect 30 320 200 20
|
||||
rect 30 340 200 20
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 143
|
||||
textaligny 17
|
||||
|
|
|
@ -36,7 +36,7 @@ itemDef {
|
|||
}
|
||||
itemDef {
|
||||
name window
|
||||
rect 34 10 102 8
|
||||
rect 34 10 122 8
|
||||
style 3
|
||||
background "ui/assets/ingametop.tga"
|
||||
visible 1
|
||||
|
@ -44,7 +44,7 @@ itemDef {
|
|||
}
|
||||
itemDef {
|
||||
name window
|
||||
rect 218 10 82 8
|
||||
rect 208 10 92 8
|
||||
style 3
|
||||
background "ui/assets/ingametop.tga"
|
||||
visible 1
|
||||
|
@ -150,7 +150,7 @@ itemDef {
|
|||
}
|
||||
itemDef {
|
||||
name window
|
||||
rect 198 370 134 8
|
||||
rect 158 370 174 8
|
||||
style 3
|
||||
background "ui/assets/ingamebottom.tga"
|
||||
visible 1
|
||||
|
@ -206,7 +206,7 @@ itemDef {
|
|||
name options
|
||||
group grpOptions
|
||||
type ITEM_TYPE_YESNO
|
||||
text "Simple Items (Holster):"
|
||||
text "Simple Items (Weapon Wheel):"
|
||||
cvar "cg_weaponSelectorSimple2DIcons"
|
||||
rect 50 71 200 20
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
|
@ -398,7 +398,7 @@ itemDef {
|
|||
name options
|
||||
group grpOptions
|
||||
type ITEM_TYPE_YESNO
|
||||
text "Statusbar On Weapon Selector:"
|
||||
text "Statusbar On Weapon Wheel:"
|
||||
cvar "vr_weaponSelectorWithHud"
|
||||
rect 50 292 200 20
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
|
|
|
@ -201,8 +201,8 @@ itemDef {
|
|||
type ITEM_TYPE_MULTI
|
||||
text "Refresh Rate:"
|
||||
cvar "vr_refreshrate"
|
||||
cvarFloatList { "60" 60 "72 (Default)" 72 "80" 80 "90" 90 }
|
||||
rect 0 70 256 20
|
||||
cvarFloatList { "60" 60 "72 (Recommended)" 72 "80" 80 "90" 90 }
|
||||
rect 0 70 306 20
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 133
|
||||
textaligny 17
|
||||
|
|
|
@ -82,7 +82,7 @@ itemDef {
|
|||
name options
|
||||
group grpOptions
|
||||
type ITEM_TYPE_YESNO
|
||||
text "Simple Items (Holster):"
|
||||
text "Simple Items (Weapon Wheel):"
|
||||
cvar "cg_weaponSelectorSimple2DIcons"
|
||||
rect 99 75 256 20
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
|
@ -279,7 +279,7 @@ itemDef {
|
|||
name options
|
||||
group grpOptions
|
||||
type ITEM_TYPE_YESNO
|
||||
text "Statusbar On Weapon Selector:"
|
||||
text "Statusbar On Weapon Wheel:"
|
||||
cvar "vr_weaponSelectorWithHud"
|
||||
rect 99 335 256 20
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
|
|
|
@ -105,7 +105,7 @@ itemDef {
|
|||
type ITEM_TYPE_MULTI
|
||||
text "Refresh Rate:"
|
||||
cvar "vr_refreshrate"
|
||||
cvarFloatList { "60" 60 "72 (Default)" 72 "80" 80 "90" 90 }
|
||||
cvarFloatList { "60" 60 "72 (Recommended)" 72 "80" 80 "90" 90 }
|
||||
rect 99 67 256 20
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 128
|
||||
|
|
Loading…
Reference in a new issue