From 82706df34fee3707855f0eed15e0c0203180fc40 Mon Sep 17 00:00:00 2001 From: Petr Bartos Date: Fri, 31 Mar 2023 15:40:54 +0200 Subject: [PATCH] Allow to skip cinematics also by triggers --- Projects/Android/jni/JKXR/VrInputDefault.cpp | 32 ++++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/Projects/Android/jni/JKXR/VrInputDefault.cpp b/Projects/Android/jni/JKXR/VrInputDefault.cpp index 33afc92..efa0261 100644 --- a/Projects/Android/jni/JKXR/VrInputDefault.cpp +++ b/Projects/Android/jni/JKXR/VrInputDefault.cpp @@ -148,7 +148,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, static float menuYaw = 0; static bool switchedMenuControls = qfalse; - if (VR_UseScreenLayer() && !vr.misc_camera /*bit of a fiddle, but if we are in a misc camera, we are in the game and shouldn't be in here*/) + 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)) { @@ -168,14 +168,6 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, switchedMenuControls = !switchedMenuControls; } } - - //To skip flatscreen cinematic use thumb of any controller - if ((primaryButtonsNew & primaryThumb) != (primaryButtonsOld & primaryThumb)) { - sendButtonAction("+use", (primaryButtonsNew & primaryThumb)); - } - if ((secondaryButtonsNew & secondaryThumb) != (secondaryButtonsOld & secondaryThumb)) { - sendButtonAction("+use", (secondaryButtonsNew & secondaryThumb)); - } } else { @@ -270,7 +262,27 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, } } - if (vr.misc_camera) + if (vr.cin_camera) + { + //To skip cinematic use any thumb or trigger + if ((primaryButtonsNew & primaryThumb) != (primaryButtonsOld & primaryThumb)) { + sendButtonAction("+use", (primaryButtonsNew & primaryThumb)); + } + if ((secondaryButtonsNew & secondaryThumb) != (secondaryButtonsOld & secondaryThumb)) { + sendButtonAction("+use", (secondaryButtonsNew & secondaryThumb)); + } + if ((pDominantTrackedRemoteNew->Buttons & xrButton_Trigger) != (pDominantTrackedRemoteOld->Buttons & xrButton_Trigger)) { + sendButtonAction("+use", (pDominantTrackedRemoteNew->Buttons & xrButton_Trigger)); + // mark button as already pressed to prevent firing after entering the game + pDominantTrackedRemoteOld->Buttons |= xrButton_Trigger; + } + if ((pOffTrackedRemoteNew->Buttons & xrButton_Trigger) != (pOffTrackedRemoteOld->Buttons & xrButton_Trigger)) { + sendButtonAction("+use", (pOffTrackedRemoteNew->Buttons & xrButton_Trigger)); + // mark button as already pressed to prevent firing after entering the game + pOffTrackedRemoteOld->Buttons |= xrButton_Trigger; + } + } + else if (vr.misc_camera) { if (between(-0.2f, primaryJoystickX, 0.2f)) { sendButtonAction("+use", pPrimaryJoystick->y < -0.8f || pPrimaryJoystick->y > 0.8f);