From 7216d02b43873ecb259a4da05105ebf7a37c8472 Mon Sep 17 00:00:00 2001 From: Grant Bagwell Date: Tue, 27 Apr 2021 17:30:59 +0200 Subject: [PATCH] Fixed Two Handed Weapon Scales --- .../jni/d3es-multithread-master/neo/game/Player.cpp | 12 +++++++++++- .../jni/d3es-multithread-master/neo/game/Vr.cpp | 2 +- .../jni/d3es-multithread-master/neo/game/Vr.h | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Projects/Android/jni/d3es-multithread-master/neo/game/Player.cpp b/Projects/Android/jni/d3es-multithread-master/neo/game/Player.cpp index ec3c09d..8edd735 100644 --- a/Projects/Android/jni/d3es-multithread-master/neo/game/Player.cpp +++ b/Projects/Android/jni/d3es-multithread-master/neo/game/Player.cpp @@ -1758,6 +1758,7 @@ void idPlayer::Init( void ) { InitPlayerBones(); commonVr->currentFlashlightMode = vr_flashlightMode.GetInteger(); + commonVr->restoreFlashlightMode = false; commonVr->thirdPersonMovement = false; commonVr->thirdPersonDelta = 0.0f; @@ -13764,7 +13765,16 @@ void idPlayer::CalculateViewFlashlightPos( idVec3 &origin, idMat3 &axis, idVec3 int flashlightMode = commonVr->GetCurrentFlashlightMode(); if (commonVr->GetWeaponStabilised() && flashlightMode == FLASHLIGHT_HAND ) { - flashlightMode = FLASHLIGHT_GUN; + //GB Changed as previous wasn't persistent across functions + commonVr->restoreFlashlightMode = true; + vr_flashlightMode.SetInteger( FLASHLIGHT_GUN ); + vr_flashlightMode.SetModified(); + } + else if (!commonVr->GetWeaponStabilised() && commonVr->restoreFlashlightMode) + { + commonVr->restoreFlashlightMode = false; + vr_flashlightMode.SetInteger( FLASHLIGHT_HAND ); + vr_flashlightMode.SetModified(); } setLeftHand = false; diff --git a/Projects/Android/jni/d3es-multithread-master/neo/game/Vr.cpp b/Projects/Android/jni/d3es-multithread-master/neo/game/Vr.cpp index 64ce7e5..35cda00 100644 --- a/Projects/Android/jni/d3es-multithread-master/neo/game/Vr.cpp +++ b/Projects/Android/jni/d3es-multithread-master/neo/game/Vr.cpp @@ -279,7 +279,7 @@ iVr::iVr() wasSaved = false; wasLoaded = false; shouldRecenter = false; - + restoreFlashlightMode = false; PDAclipModelSet = false; useFBO = false; diff --git a/Projects/Android/jni/d3es-multithread-master/neo/game/Vr.h b/Projects/Android/jni/d3es-multithread-master/neo/game/Vr.h index 3161c84..cbd993e 100644 --- a/Projects/Android/jni/d3es-multithread-master/neo/game/Vr.h +++ b/Projects/Android/jni/d3es-multithread-master/neo/game/Vr.h @@ -181,6 +181,7 @@ public: //------------------ int lastComfortTime; int currentFlashlightMode; + bool restoreFlashlightMode; bool VR_GAME_PAUSED;