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); }