From 4bea59c543694593739b05eb8ae845c73a1a50e9 Mon Sep 17 00:00:00 2001 From: Petr Bartos Date: Tue, 18 Apr 2023 22:21:03 +0200 Subject: [PATCH] Add delay before allowing to skip cinematic --- Projects/Android/jni/JKXR/VrInputDefault.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Projects/Android/jni/JKXR/VrInputDefault.cpp b/Projects/Android/jni/JKXR/VrInputDefault.cpp index 045565e..3eec6d7 100644 --- a/Projects/Android/jni/JKXR/VrInputDefault.cpp +++ b/Projects/Android/jni/JKXR/VrInputDefault.cpp @@ -346,9 +346,16 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, } } - if (vr.cin_camera) + static int cinCameraTimestamp = -1; + if (vr.cin_camera && cinCameraTimestamp == -1) { + cinCameraTimestamp = Sys_Milliseconds(); + } else if (!vr.cin_camera) { + cinCameraTimestamp = -1; + } + if (vr.cin_camera && cinCameraTimestamp + 1000 < Sys_Milliseconds()) { - //To skip cinematic use any thumb or trigger + // To skip cinematic use any thumb or trigger (but wait a while + // to prevent skipping when cinematic is started during action) if ((primaryButtonsNew & primaryThumb) != (primaryButtonsOld & primaryThumb)) { sendButtonAction("+use", (primaryButtonsNew & primaryThumb)); }