mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-10 06:41:58 +00:00
Allow to override smooth/snap turn with action; set default weapon mapping
This commit is contained in:
parent
bb164f3091
commit
81e0947c86
3 changed files with 119 additions and 61 deletions
|
@ -28,17 +28,21 @@ set vr_button_map_SECONDARYTHUMBSTICK_ALT ""
|
||||||
set vr_button_map_PRIMARYTHUMBSTICK ""
|
set vr_button_map_PRIMARYTHUMBSTICK ""
|
||||||
set vr_button_map_PRIMARYTHUMBSTICK_ALT ""
|
set vr_button_map_PRIMARYTHUMBSTICK_ALT ""
|
||||||
set vr_button_map_RTHUMBFORWARD "+weapon_select"
|
set vr_button_map_RTHUMBFORWARD "+weapon_select"
|
||||||
set vr_button_map_RTHUMBFORWARD_ALT ""
|
set vr_button_map_RTHUMBFORWARD_ALT "weapon 3"
|
||||||
set vr_button_map_RTHUMBFORWARDLEFT ""
|
|
||||||
set vr_button_map_RTHUMBFORWARDLEFT_ALT ""
|
|
||||||
set vr_button_map_RTHUMBFORWARDRIGHT ""
|
set vr_button_map_RTHUMBFORWARDRIGHT ""
|
||||||
set vr_button_map_RTHUMBFORWARDRIGHT_ALT ""
|
set vr_button_map_RTHUMBFORWARDRIGHT_ALT "weapon 2"
|
||||||
set vr_button_map_RTHUMBBACK ""
|
set vr_button_map_RTHUMBRIGHT ""
|
||||||
set vr_button_map_RTHUMBBACK_ALT ""
|
set vr_button_map_RTHUMBRIGHT_ALT "weapon 5"
|
||||||
set vr_button_map_RTHUMBBACKLEFT ""
|
|
||||||
set vr_button_map_RTHUMBBACKLEFT_ALT ""
|
|
||||||
set vr_button_map_RTHUMBBACKRIGHT ""
|
set vr_button_map_RTHUMBBACKRIGHT ""
|
||||||
set vr_button_map_RTHUMBBACKRIGHT_ALT ""
|
set vr_button_map_RTHUMBBACKRIGHT_ALT "weapon 4"
|
||||||
|
set vr_button_map_RTHUMBBACK ""
|
||||||
|
set vr_button_map_RTHUMBBACK_ALT "weapon 7"
|
||||||
|
set vr_button_map_RTHUMBBACKLEFT ""
|
||||||
|
set vr_button_map_RTHUMBBACKLEFT_ALT "weapon 8"
|
||||||
|
set vr_button_map_RTHUMBLEFT ""
|
||||||
|
set vr_button_map_RTHUMBLEFT_ALT "weapon 6"
|
||||||
|
set vr_button_map_RTHUMBFORWARDLEFT ""
|
||||||
|
set vr_button_map_RTHUMBFORWARDLEFT_ALT "weapon 9"
|
||||||
set vr_button_map_SECONDARYTRIGGER "+moveup"
|
set vr_button_map_SECONDARYTRIGGER "+moveup"
|
||||||
set vr_button_map_SECONDARYTRIGGER_ALT ""
|
set vr_button_map_SECONDARYTRIGGER_ALT ""
|
||||||
set vr_button_map_PRIMARYTRIGGER "+attack"
|
set vr_button_map_PRIMARYTRIGGER "+attack"
|
||||||
|
|
|
@ -100,18 +100,22 @@ void VR_InitCvars( void )
|
||||||
Cvar_Get ("vr_button_map_SECONDARYTHUMBSTICK_ALT", "", CVAR_ARCHIVE); // unmapped
|
Cvar_Get ("vr_button_map_SECONDARYTHUMBSTICK_ALT", "", CVAR_ARCHIVE); // unmapped
|
||||||
Cvar_Get ("vr_button_map_PRIMARYTHUMBSTICK", "", CVAR_ARCHIVE); // unmapped
|
Cvar_Get ("vr_button_map_PRIMARYTHUMBSTICK", "", CVAR_ARCHIVE); // unmapped
|
||||||
Cvar_Get ("vr_button_map_PRIMARYTHUMBSTICK_ALT", "weapon 1", CVAR_ARCHIVE); // Switch to gauntlet
|
Cvar_Get ("vr_button_map_PRIMARYTHUMBSTICK_ALT", "weapon 1", CVAR_ARCHIVE); // Switch to gauntlet
|
||||||
Cvar_Get ("vr_button_map_RTHUMBFORWARD", "weapnext", CVAR_ARCHIVE); //Next Weapon
|
Cvar_Get ("vr_button_map_RTHUMBFORWARD", "", CVAR_ARCHIVE); // unmapped
|
||||||
Cvar_Get ("vr_button_map_RTHUMBFORWARD_ALT", "", CVAR_ARCHIVE); // unmapped
|
Cvar_Get ("vr_button_map_RTHUMBFORWARD_ALT", "", CVAR_ARCHIVE); // unmapped
|
||||||
Cvar_Get ("vr_button_map_RTHUMBFORWARDLEFT", "", CVAR_ARCHIVE); // unmapped
|
Cvar_Get ("vr_button_map_RTHUMBFORWARDRIGHT", "", CVAR_ARCHIVE); // unmapped
|
||||||
Cvar_Get ("vr_button_map_RTHUMBFORWARDLEFT_ALT", "", CVAR_ARCHIVE); // unmapped
|
Cvar_Get ("vr_button_map_RTHUMBFORWARDRIGHT_ALT", "", CVAR_ARCHIVE); // unmapped
|
||||||
Cvar_Get ("vr_button_map_RTHUMBFORWARDRIGHT", "", CVAR_ARCHIVE); // unmapped
|
Cvar_Get ("vr_button_map_RTHUMBRIGHT", "", CVAR_ARCHIVE); // unmapped
|
||||||
Cvar_Get ("vr_button_map_RTHUMBFORWARDRIGHT_ALT", "", CVAR_ARCHIVE); // unmapped
|
Cvar_Get ("vr_button_map_RTHUMBRIGHT_ALT", "", CVAR_ARCHIVE); // unmapped
|
||||||
Cvar_Get ("vr_button_map_RTHUMBBACK", "weapprev", CVAR_ARCHIVE); // Previous Weapon
|
Cvar_Get ("vr_button_map_RTHUMBBACKRIGHT", "", CVAR_ARCHIVE); // unmapped
|
||||||
|
Cvar_Get ("vr_button_map_RTHUMBBACKRIGHT_ALT", "", CVAR_ARCHIVE); // unmapped
|
||||||
|
Cvar_Get ("vr_button_map_RTHUMBBACK", "", CVAR_ARCHIVE); // unmapped
|
||||||
Cvar_Get ("vr_button_map_RTHUMBBACK_ALT", "", CVAR_ARCHIVE); // unmapped
|
Cvar_Get ("vr_button_map_RTHUMBBACK_ALT", "", CVAR_ARCHIVE); // unmapped
|
||||||
Cvar_Get ("vr_button_map_RTHUMBBACKLEFT", "", CVAR_ARCHIVE); // unmapped
|
Cvar_Get ("vr_button_map_RTHUMBBACKLEFT", "", CVAR_ARCHIVE); // unmapped
|
||||||
Cvar_Get ("vr_button_map_RTHUMBBACKLEFT_ALT", "", CVAR_ARCHIVE); // unmapped
|
Cvar_Get ("vr_button_map_RTHUMBBACKLEFT_ALT", "", CVAR_ARCHIVE); // unmapped
|
||||||
Cvar_Get ("vr_button_map_RTHUMBBACKRIGHT", "", CVAR_ARCHIVE); // unmapped
|
Cvar_Get ("vr_button_map_RTHUMBLEFT", "", CVAR_ARCHIVE); // unmapped
|
||||||
Cvar_Get ("vr_button_map_RTHUMBBACKRIGHT_ALT", "", CVAR_ARCHIVE); // unmapped
|
Cvar_Get ("vr_button_map_RTHUMBLEFT_ALT", "", CVAR_ARCHIVE); // unmapped
|
||||||
|
Cvar_Get ("vr_button_map_RTHUMBFORWARDLEFT", "", CVAR_ARCHIVE); // unmapped
|
||||||
|
Cvar_Get ("vr_button_map_RTHUMBFORWARDLEFT_ALT", "", CVAR_ARCHIVE); // unmapped
|
||||||
Cvar_Get ("vr_button_map_SECONDARYTRIGGER", "+moveup", CVAR_ARCHIVE); // Also Jump
|
Cvar_Get ("vr_button_map_SECONDARYTRIGGER", "+moveup", CVAR_ARCHIVE); // Also Jump
|
||||||
Cvar_Get ("vr_button_map_SECONDARYTRIGGER_ALT", "", CVAR_ARCHIVE); // unmapped
|
Cvar_Get ("vr_button_map_SECONDARYTRIGGER_ALT", "", CVAR_ARCHIVE); // unmapped
|
||||||
Cvar_Get ("vr_button_map_PRIMARYTRIGGER", "+attack", CVAR_ARCHIVE); // Fire
|
Cvar_Get ("vr_button_map_PRIMARYTRIGGER", "+attack", CVAR_ARCHIVE); // Fire
|
||||||
|
|
|
@ -22,13 +22,13 @@
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
VR_TOUCH_AXIS_UP = 1 << 0,
|
VR_TOUCH_AXIS_UP = 1 << 0,
|
||||||
VR_TOUCH_AXIS_UPLEFT = 1 << 1,
|
VR_TOUCH_AXIS_UPRIGHT = 1 << 1,
|
||||||
VR_TOUCH_AXIS_UPRIGHT = 1 << 2,
|
VR_TOUCH_AXIS_RIGHT = 1 << 2,
|
||||||
VR_TOUCH_AXIS_DOWN = 1 << 3,
|
VR_TOUCH_AXIS_DOWNRIGHT = 1 << 3,
|
||||||
VR_TOUCH_AXIS_DOWNLEFT = 1 << 4,
|
VR_TOUCH_AXIS_DOWN = 1 << 4,
|
||||||
VR_TOUCH_AXIS_DOWNRIGHT = 1 << 5,
|
VR_TOUCH_AXIS_DOWNLEFT = 1 << 5,
|
||||||
VR_TOUCH_AXIS_LEFT = 1 << 6,
|
VR_TOUCH_AXIS_LEFT = 1 << 6,
|
||||||
VR_TOUCH_AXIS_RIGHT = 1 << 7,
|
VR_TOUCH_AXIS_UPLEFT = 1 << 7,
|
||||||
VR_TOUCH_AXIS_TRIGGER_INDEX = 1 << 8,
|
VR_TOUCH_AXIS_TRIGGER_INDEX = 1 << 8,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -506,7 +506,13 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
|
||||||
if (joystickY > releasedThreshold) {
|
if (joystickY > releasedThreshold) {
|
||||||
|
|
||||||
// stop left & right
|
// stop left & right
|
||||||
|
if ((controller->axisButtons & VR_TOUCH_AXIS_LEFT) && IN_GetButtonAction("RTHUMBLEFT", action)) {
|
||||||
|
IN_SendButtonAction(action, qfalse);
|
||||||
|
}
|
||||||
controller->axisButtons &= ~VR_TOUCH_AXIS_LEFT;
|
controller->axisButtons &= ~VR_TOUCH_AXIS_LEFT;
|
||||||
|
if ((controller->axisButtons & VR_TOUCH_AXIS_RIGHT) && IN_GetButtonAction("RTHUMBRIGHT", action)) {
|
||||||
|
IN_SendButtonAction(action, qfalse);
|
||||||
|
}
|
||||||
controller->axisButtons &= ~VR_TOUCH_AXIS_RIGHT;
|
controller->axisButtons &= ~VR_TOUCH_AXIS_RIGHT;
|
||||||
|
|
||||||
// up-left (use release threshold to be more sensitive)
|
// up-left (use release threshold to be more sensitive)
|
||||||
|
@ -530,8 +536,8 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
|
||||||
}
|
}
|
||||||
|
|
||||||
// up-right (use release threshold to be more sensitive)
|
// up-right (use release threshold to be more sensitive)
|
||||||
} else if (joystickX > releasedThreshold) {
|
} else if (joystickX > releasedThreshold) {
|
||||||
// stop up
|
// stop up
|
||||||
if ((controller->axisButtons & VR_TOUCH_AXIS_UP) && IN_GetButtonAction("RTHUMBFORWARD", action)) {
|
if ((controller->axisButtons & VR_TOUCH_AXIS_UP) && IN_GetButtonAction("RTHUMBFORWARD", action)) {
|
||||||
IN_SendButtonAction(action, qfalse);
|
IN_SendButtonAction(action, qfalse);
|
||||||
}
|
}
|
||||||
|
@ -550,7 +556,7 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
|
||||||
}
|
}
|
||||||
|
|
||||||
// direct-up
|
// direct-up
|
||||||
} else {
|
} else {
|
||||||
// stop up-left
|
// stop up-left
|
||||||
if ((controller->axisButtons & VR_TOUCH_AXIS_UPLEFT) && IN_GetButtonAction("RTHUMBFORWARDLEFT", action)) {
|
if ((controller->axisButtons & VR_TOUCH_AXIS_UPLEFT) && IN_GetButtonAction("RTHUMBFORWARDLEFT", action)) {
|
||||||
IN_SendButtonAction(action, qfalse);
|
IN_SendButtonAction(action, qfalse);
|
||||||
|
@ -568,13 +574,19 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
|
||||||
IN_SendButtonAction(action, qtrue);
|
IN_SendButtonAction(action, qtrue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// down, down-left, down-right (use release threshold to be more sensitive)
|
// down, down-left, down-right (use release threshold to be more sensitive)
|
||||||
} else if (joystickY < -releasedThreshold) {
|
} else if (joystickY < -releasedThreshold) {
|
||||||
|
|
||||||
// stop left & right
|
// stop left & right
|
||||||
|
if ((controller->axisButtons & VR_TOUCH_AXIS_LEFT) && IN_GetButtonAction("RTHUMBLEFT", action)) {
|
||||||
|
IN_SendButtonAction(action, qfalse);
|
||||||
|
}
|
||||||
controller->axisButtons &= ~VR_TOUCH_AXIS_LEFT;
|
controller->axisButtons &= ~VR_TOUCH_AXIS_LEFT;
|
||||||
|
if ((controller->axisButtons & VR_TOUCH_AXIS_RIGHT) && IN_GetButtonAction("RTHUMBRIGHT", action)) {
|
||||||
|
IN_SendButtonAction(action, qfalse);
|
||||||
|
}
|
||||||
controller->axisButtons &= ~VR_TOUCH_AXIS_RIGHT;
|
controller->axisButtons &= ~VR_TOUCH_AXIS_RIGHT;
|
||||||
|
|
||||||
// down-left (use release threshold to be more sensitive)
|
// down-left (use release threshold to be more sensitive)
|
||||||
|
@ -598,8 +610,8 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
|
||||||
}
|
}
|
||||||
|
|
||||||
// down-right (use release threshold to be more sensitive)
|
// down-right (use release threshold to be more sensitive)
|
||||||
} else if (joystickX > releasedThreshold) {
|
} else if (joystickX > releasedThreshold) {
|
||||||
// stop down
|
// stop down
|
||||||
if ((controller->axisButtons & VR_TOUCH_AXIS_DOWN) && IN_GetButtonAction("RTHUMBBACK", action)) {
|
if ((controller->axisButtons & VR_TOUCH_AXIS_DOWN) && IN_GetButtonAction("RTHUMBBACK", action)) {
|
||||||
IN_SendButtonAction(action, qfalse);
|
IN_SendButtonAction(action, qfalse);
|
||||||
}
|
}
|
||||||
|
@ -618,7 +630,7 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
|
||||||
}
|
}
|
||||||
|
|
||||||
// direct-down
|
// direct-down
|
||||||
} else {
|
} else {
|
||||||
// stop down-left
|
// stop down-left
|
||||||
if ((controller->axisButtons & VR_TOUCH_AXIS_DOWNLEFT) && IN_GetButtonAction("RTHUMBBACKLEFT", action)) {
|
if ((controller->axisButtons & VR_TOUCH_AXIS_DOWNLEFT) && IN_GetButtonAction("RTHUMBBACKLEFT", action)) {
|
||||||
IN_SendButtonAction(action, qfalse);
|
IN_SendButtonAction(action, qfalse);
|
||||||
|
@ -636,7 +648,7 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
|
||||||
IN_SendButtonAction(action, qtrue);
|
IN_SendButtonAction(action, qtrue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// left & right
|
// left & right
|
||||||
} else {
|
} else {
|
||||||
|
@ -672,37 +684,75 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
|
||||||
}
|
}
|
||||||
controller->axisButtons &= ~VR_TOUCH_AXIS_DOWNRIGHT;
|
controller->axisButtons &= ~VR_TOUCH_AXIS_DOWNRIGHT;
|
||||||
|
|
||||||
//yaw
|
// left
|
||||||
if (vr_snapturn->integer > 0)
|
if (joystickX < -pressedThreshold) {
|
||||||
{
|
|
||||||
int snap = 45;
|
|
||||||
if (vr_snapturn->integer > 1)
|
|
||||||
{
|
|
||||||
snap = vr_snapturn->integer;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(controller->axisButtons & VR_TOUCH_AXIS_RIGHT) && joystickX > pressedThreshold) {
|
// left action
|
||||||
controller->axisButtons |= VR_TOUCH_AXIS_RIGHT;
|
if (IN_GetButtonAction("RTHUMBLEFT", action)) {
|
||||||
CL_SnapTurn(snap);
|
if (!(controller->axisButtons & VR_TOUCH_AXIS_LEFT)) {
|
||||||
} else if ((controller->axisButtons & VR_TOUCH_AXIS_RIGHT) &&
|
IN_SendButtonAction(action, qtrue);
|
||||||
joystickX < releasedThreshold) {
|
}
|
||||||
controller->axisButtons &= ~VR_TOUCH_AXIS_RIGHT;
|
controller->axisButtons |= VR_TOUCH_AXIS_LEFT;
|
||||||
}
|
|
||||||
|
|
||||||
if (!(controller->axisButtons & VR_TOUCH_AXIS_LEFT) && joystickX < -pressedThreshold) {
|
// yaw (snap turn)
|
||||||
controller->axisButtons |= VR_TOUCH_AXIS_LEFT;
|
} else if (vr_snapturn->integer > 0) {
|
||||||
CL_SnapTurn(-snap);
|
int snap = 45;
|
||||||
} else if ((controller->axisButtons & VR_TOUCH_AXIS_LEFT) &&
|
if (vr_snapturn->integer > 1) {
|
||||||
joystickX > -releasedThreshold) {
|
snap = vr_snapturn->integer;
|
||||||
controller->axisButtons &= ~VR_TOUCH_AXIS_LEFT;
|
}
|
||||||
}
|
if (!(controller->axisButtons & VR_TOUCH_AXIS_LEFT)) {
|
||||||
}
|
CL_SnapTurn(-snap);
|
||||||
else
|
}
|
||||||
{
|
|
||||||
//smooth turn
|
// yaw (smooth turn)
|
||||||
const float x = joystickX * cl_sensitivity->value * m_yaw->value;
|
} else {
|
||||||
Com_QueueEvent(in_vrEventTime, SE_MOUSE, x, 0, 0, NULL);
|
const float x = joystickX * cl_sensitivity->value * m_yaw->value;
|
||||||
}
|
Com_QueueEvent(in_vrEventTime, SE_MOUSE, x, 0, 0, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
controller->axisButtons |= VR_TOUCH_AXIS_LEFT;
|
||||||
|
|
||||||
|
} else if (joystickX > -releasedThreshold) {
|
||||||
|
if ((controller->axisButtons & VR_TOUCH_AXIS_LEFT) && IN_GetButtonAction("RTHUMBLEFT", action)) {
|
||||||
|
IN_SendButtonAction(action, qfalse);
|
||||||
|
}
|
||||||
|
controller->axisButtons &= ~VR_TOUCH_AXIS_LEFT;
|
||||||
|
}
|
||||||
|
|
||||||
|
// right
|
||||||
|
if (joystickX > pressedThreshold) {
|
||||||
|
|
||||||
|
// right action
|
||||||
|
if (IN_GetButtonAction("RTHUMBRIGHT", action)) {
|
||||||
|
if (!(controller->axisButtons & VR_TOUCH_AXIS_RIGHT)) {
|
||||||
|
IN_SendButtonAction(action, qtrue);
|
||||||
|
}
|
||||||
|
controller->axisButtons |= VR_TOUCH_AXIS_RIGHT;
|
||||||
|
|
||||||
|
// yaw (snap turn)
|
||||||
|
} else if (vr_snapturn->integer > 0) {
|
||||||
|
int snap = 45;
|
||||||
|
if (vr_snapturn->integer > 1) {
|
||||||
|
snap = vr_snapturn->integer;
|
||||||
|
}
|
||||||
|
if (!(controller->axisButtons & VR_TOUCH_AXIS_RIGHT)) {
|
||||||
|
CL_SnapTurn(snap);
|
||||||
|
}
|
||||||
|
|
||||||
|
// yaw (smooth turn)
|
||||||
|
} else {
|
||||||
|
const float x = joystickX * cl_sensitivity->value * m_yaw->value;
|
||||||
|
Com_QueueEvent(in_vrEventTime, SE_MOUSE, x, 0, 0, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
controller->axisButtons |= VR_TOUCH_AXIS_RIGHT;
|
||||||
|
|
||||||
|
} else if (joystickX < releasedThreshold) {
|
||||||
|
if ((controller->axisButtons & VR_TOUCH_AXIS_RIGHT) && IN_GetButtonAction("RTHUMBRIGHT", action)) {
|
||||||
|
IN_SendButtonAction(action, qfalse);
|
||||||
|
}
|
||||||
|
controller->axisButtons &= ~VR_TOUCH_AXIS_RIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue