Fix Issue 870: Crouch toggle not reset when pressing "Fly" button, causes avatar to run/fly downhill.

Reimplements crouch toggle such that crouch is now tracked by the agent object
Fixes crouch being reset when restoring focus to the viewer window, as well.
This commit is contained in:
Inusaito Sayori
2014-01-24 22:57:19 -05:00
parent 2450b435a7
commit 236fa2a284
5 changed files with 21 additions and 10 deletions

View File

@@ -61,14 +61,11 @@ const F32 YAW_NUDGE_RATE = 0.05f; // fraction of normal speed
LLViewerKeyboard gViewerKeyboard;
bool isCrouch = false; //Shouldn't start crouched.
void agent_jump( EKeystate s )
{
if( KEYSTATE_UP == s ) return;
F32 time = gKeyboard->getCurKeyElapsedTime();
S32 frame_count = llround(gKeyboard->getCurKeyElapsedFrameCount());
isCrouch = false;
if( time < FLY_TIME
|| frame_count <= FLY_FRAMES
|| gAgent.upGrabbed()
@@ -86,18 +83,17 @@ void agent_toggle_down( EKeystate s )
{
if(KEYSTATE_UP == s) return;
gAgent.moveUp(-1);
if(KEYSTATE_DOWN == s && !gAgent.getFlying() && gSavedSettings.getBOOL("SGShiftCrouchToggle"))
{
isCrouch = !isCrouch;
gAgent.toggleCrouch();
}
gAgent.moveUp(-1);
}
void agent_push_down( EKeystate s )
{
if( KEYSTATE_UP == s ) return;
gAgent.moveUp(-1);
isCrouch = false;
}
static void agent_handle_doubletap_run(EKeystate s, LLAgent::EDoubleTapRunMode mode)
@@ -247,7 +243,6 @@ void agent_toggle_fly( EKeystate s )
if (KEYSTATE_DOWN == s )
{
gAgent.toggleFlying();
isCrouch = false;
}
}