MAINT-4304 FIXED Avatar stuck running if releasing shift during double-tap strafe

master
andreykproductengine 2014-08-04 17:16:02 +03:00
parent 33178d5766
commit 6fe7dab044
1 changed files with 27 additions and 10 deletions

View File

@ -88,18 +88,25 @@ void agent_push_down( EKeystate s )
gAgent.moveUp(-1);
}
static void agent_check_temporary_run(LLAgent::EDoubleTapRunMode mode)
{
if (gAgent.mDoubleTapRunMode == mode &&
gAgent.getRunning() &&
!gAgent.getAlwaysRun())
{
// Turn off temporary running.
gAgent.clearRunning();
gAgent.sendWalkRun(gAgent.getRunning());
}
}
static void agent_handle_doubletap_run(EKeystate s, LLAgent::EDoubleTapRunMode mode)
{
if (KEYSTATE_UP == s)
{
if (gAgent.mDoubleTapRunMode == mode &&
gAgent.getRunning() &&
!gAgent.getAlwaysRun())
{
// Turn off temporary running.
gAgent.clearRunning();
gAgent.sendWalkRun(gAgent.getRunning());
}
// Note: in case shift is already released, slide left/right run
// will be released in agent_turn_left()/agent_turn_right()
agent_check_temporary_run(mode);
}
else if (gSavedSettings.getBOOL("AllowTapTapHoldRun") &&
KEYSTATE_DOWN == s &&
@ -218,7 +225,12 @@ void agent_turn_left( EKeystate s )
}
else
{
if (KEYSTATE_UP == s) return;
if (KEYSTATE_UP == s)
{
// Check temporary running. In case user released 'left' key with shift already released.
agent_check_temporary_run(LLAgent::DOUBLETAP_SLIDELEFT);
return;
}
F32 time = gKeyboard->getCurKeyElapsedTime();
gAgent.moveYaw( LLFloaterMove::getYawRate( time ) );
}
@ -241,7 +253,12 @@ void agent_turn_right( EKeystate s )
}
else
{
if (KEYSTATE_UP == s) return;
if (KEYSTATE_UP == s)
{
// Check temporary running. In case user released 'right' key with shift already released.
agent_check_temporary_run(LLAgent::DOUBLETAP_SLIDERIGHT);
return;
}
F32 time = gKeyboard->getCurKeyElapsedTime();
gAgent.moveYaw( -LLFloaterMove::getYawRate( time ) );
}