From f9fa5cc2b68664e1dbc44c92c2b78dcc520ae0c8 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 20 Mar 2022 09:44:39 +0000 Subject: [PATCH] Two handed weapons only triggered when < 40cm between controllers --- android/app/src/main/cpp/code/cgame/cg_weapons.c | 4 ++-- android/app/src/main/cpp/code/q3_ui/ui_video.c | 8 ++++---- android/app/src/main/cpp/code/vr/vr_input.c | 12 +++++++++++- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/android/app/src/main/cpp/code/cgame/cg_weapons.c b/android/app/src/main/cpp/code/cgame/cg_weapons.c index 463c56d7..d356d7dc 100644 --- a/android/app/src/main/cpp/code/cgame/cg_weapons.c +++ b/android/app/src/main/cpp/code/cgame/cg_weapons.c @@ -1724,7 +1724,7 @@ void CG_AddViewWeapon( playerState_t *ps ) { if (trap_Cvar_VariableValue("vr_lasersight") != 0.0f && !vr->no_crosshair) { - vec3_t forward, end, dir; + vec3_t forward, end; AngleVectors(angles, forward, NULL, NULL); VectorMA(hand.origin, 4096, forward, end); trace_t trace; @@ -2195,7 +2195,7 @@ void CG_DrawWeaponSelector( void ) vec3_t diff; VectorSubtract(selectorOrigin, iconOrigin, diff); float length = VectorLength(diff); - if (length <= 1.5f && + if (length <= 1.4f && frac == 1.0f && selectable) { diff --git a/android/app/src/main/cpp/code/q3_ui/ui_video.c b/android/app/src/main/cpp/code/q3_ui/ui_video.c index 01ada37c..5091782e 100644 --- a/android/app/src/main/cpp/code/q3_ui/ui_video.c +++ b/android/app/src/main/cpp/code/q3_ui/ui_video.c @@ -1027,13 +1027,13 @@ GraphicsOptions_MenuInit */ void GraphicsOptions_MenuInit( void ) { - static const char *s_driver_names[] = +/* static const char *s_driver_names[] = { "Default", "Voodoo", NULL }; - +*/ static const char *tq_names[] = { "Default", @@ -1081,13 +1081,13 @@ void GraphicsOptions_MenuInit( void ) "High", NULL }; - static const char *enabled_names[] = +/* static const char *enabled_names[] = { "Off", "On", NULL }; - static const char *s_refreshrate[] = +*/ static const char *s_refreshrate[] = { "60", "72 (Recommended)", diff --git a/android/app/src/main/cpp/code/vr/vr_input.c b/android/app/src/main/cpp/code/vr/vr_input.c index 7af1a657..b6ea2faa 100644 --- a/android/app/src/main/cpp/code/vr/vr_input.c +++ b/android/app/src/main/cpp/code/vr/vr_input.c @@ -259,7 +259,17 @@ static qboolean IN_SendButtonAction(const char* action, qboolean pressed, qboole } else if (strcmp(action, "+weapon_stabilise") == 0) { - vr.weapon_stabilised = pressed; + //stabilised weapon only triggered when controllers close enough (40cm) to each other + if (pressed) + { + vec3_t l; + VectorSubtract(vr.weaponposition, vr.offhandposition, l); + vr.weapon_stabilised = VectorLength(l) < 0.4f; + } + else + { + vr.weapon_stabilised = qfalse; + } } //Special case for moveup as we can send a space key instead allowing us to skip //server search in the server menu