From 31867a8bbf6c72b80b4b2798a5b81d7e377cd589 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Sat, 25 Jul 2015 13:09:10 -0400 Subject: [PATCH] Alchemy crouch toggle code sync. --- indra/newview/llagent.cpp | 5 +++-- indra/newview/llappviewer.cpp | 2 -- indra/newview/llviewerkeyboard.cpp | 10 +++++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index ae475e2c4..c962a66fb 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -650,7 +650,8 @@ void LLAgent::moveUp(S32 direction) setControlFlags(AGENT_CONTROL_UP_NEG | AGENT_CONTROL_FAST_UP); } - if (!mCrouch) camera_reset_on_motion(); + if (!mCrouch) + camera_reset_on_motion(); } //----------------------------------------------------------------------------- @@ -694,7 +695,7 @@ void LLAgent::movePitch(F32 mag) bool LLAgent::isCrouching() const { - return mCrouch && !getFlying(); // Never crouch when flying + return mCrouch && !getFlying(); } diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index aa5ce568e..1986802d1 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1255,9 +1255,7 @@ bool LLAppViewer::mainLoop() joystick->scanJoystick(); gKeyboard->scanKeyboard(); if (gAgent.isCrouching()) - { gAgent.moveUp(-1); - } } diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index 9b0649070..89b52d8b5 100644 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -70,13 +70,14 @@ LLViewerKeyboard gViewerKeyboard; void agent_jump( EKeystate s ) { if( KEYSTATE_UP == s ) return; + static LLCachedControl sAutomaticFly(gSavedSettings, "AutomaticFly"); F32 time = gKeyboard->getCurKeyElapsedTime(); S32 frame_count = ll_round(gKeyboard->getCurKeyElapsedFrameCount()); if( time < FLY_TIME || frame_count <= FLY_FRAMES || gAgent.upGrabbed() - || !gSavedSettings.getBOOL("AutomaticFly")) + || !sAutomaticFly()) { gAgent.moveUp(1); } @@ -91,7 +92,10 @@ void agent_toggle_down( EKeystate s ) { if (KEYSTATE_UP == s) return; - if (KEYSTATE_DOWN == s && !gAgent.getFlying() && gSavedSettings.getBOOL("SGShiftCrouchToggle")) + static LLCachedControl sCrouchToggle(gSavedSettings, "SGShiftCrouchToggle"); + if (KEYSTATE_DOWN == s + && !gAgent.getFlying() + && sCrouchToggle()) { gAgent.toggleCrouch(); } @@ -101,7 +105,7 @@ void agent_toggle_down( EKeystate s ) void agent_push_down( EKeystate s ) { - if( KEYSTATE_UP == s ) return; + if( KEYSTATE_UP == s ) return; gAgent.moveUp(-1); }