Fix menu haptics

This commit is contained in:
Petr Bartos 2023-04-01 12:07:13 +02:00 committed by Simon
parent 52fcc8a49e
commit 05fc4d5ab4
3 changed files with 5 additions and 5 deletions

View file

@ -31,6 +31,7 @@ typedef struct {
bool immersive_cinematics;
bool weapon_stabilised;
bool right_handed;
bool menu_right_handed;
bool player_moving;
int move_speed; // 0 (default) = Comfortable (75%) , 1 = Full (100%), 2 = Walk (50%)
bool crouched;

View file

@ -147,17 +147,16 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
handleTrackedControllerButton(&rightTrackedRemoteState_new, &rightTrackedRemoteState_old, xrButton_Enter, A_ESCAPE);
static float menuYaw = 0;
static bool switchedMenuControls = qfalse;
if (VR_UseScreenLayer() && !vr.misc_camera && !vr.cin_camera /*bit of a fiddle, but if we are in a misc camera or cin camera, we are in the game and shouldn't be in here*/)
{
bool controlsLeftHanded = vr_control_scheme->integer >= 10;
if ((controlsLeftHanded && !switchedMenuControls) || (!controlsLeftHanded && switchedMenuControls)) {
if (controlsLeftHanded == vr.menu_right_handed) {
interactWithTouchScreen(menuYaw, vr.offhandangles[ANGLES_DEFAULT]);
handleTrackedControllerButton(pOffTrackedRemoteNew, pOffTrackedRemoteOld, offButton1, A_MOUSE1);
handleTrackedControllerButton(pOffTrackedRemoteNew, pOffTrackedRemoteOld, xrButton_Trigger, A_MOUSE1);
handleTrackedControllerButton(pOffTrackedRemoteNew, pOffTrackedRemoteOld, offButton2, A_ESCAPE);
if ((pDominantTrackedRemoteNew->Buttons & xrButton_Trigger) != (pDominantTrackedRemoteOld->Buttons & xrButton_Trigger) && (pDominantTrackedRemoteNew->Buttons & xrButton_Trigger)) {
switchedMenuControls = !switchedMenuControls;
vr.menu_right_handed = !vr.menu_right_handed;
}
} else {
interactWithTouchScreen(menuYaw, vr.weaponangles[ANGLES_DEFAULT]);
@ -165,7 +164,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
handleTrackedControllerButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, xrButton_Trigger, A_MOUSE1);
handleTrackedControllerButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, domButton2, A_ESCAPE);
if ((pOffTrackedRemoteNew->Buttons & xrButton_Trigger) != (pOffTrackedRemoteOld->Buttons & xrButton_Trigger) && (pOffTrackedRemoteNew->Buttons & xrButton_Trigger)) {
switchedMenuControls = !switchedMenuControls;
vr.menu_right_handed = !vr.menu_right_handed;
}
}
}

View file

@ -9250,7 +9250,7 @@ qboolean Item_SetFocus(itemDef_t *item, float x, float y)
if (playSound && sfx)
{
DC->startLocalSound( *sfx, CHAN_LOCAL_SOUND );
VR_HapticEvent("selector_icon", 0, vr.right_handed ? 1 : 2, 60, 0, 0);
VR_HapticEvent("selector_icon", 0, vr.menu_right_handed ? 1 : 2, 60, 0, 0);
}
for (i = 0; i < parent->itemCount; i++)