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:
@@ -420,6 +420,7 @@ LLAgent::LLAgent() :
|
||||
|
||||
mNextFidgetTime(0.f),
|
||||
mCurrentFidget(0),
|
||||
mCrouch(false),
|
||||
mFirstLogin(FALSE),
|
||||
mGenderChosen(FALSE),
|
||||
mAppearanceSerialNum(0),
|
||||
@@ -639,13 +640,14 @@ void LLAgent::moveUp(S32 direction)
|
||||
if (direction > 0)
|
||||
{
|
||||
setControlFlags(AGENT_CONTROL_UP_POS | AGENT_CONTROL_FAST_UP);
|
||||
mCrouch = false;
|
||||
}
|
||||
else if (direction < 0)
|
||||
{
|
||||
setControlFlags(AGENT_CONTROL_UP_NEG | AGENT_CONTROL_FAST_UP);
|
||||
}
|
||||
|
||||
if (!isCrouch) camera_reset_on_motion();
|
||||
if (!mCrouch) camera_reset_on_motion();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -687,6 +689,11 @@ void LLAgent::movePitch(F32 mag)
|
||||
}
|
||||
}
|
||||
|
||||
bool LLAgent::isCrouching() const
|
||||
{
|
||||
return mCrouch && !getFlying(); // Never crouch when flying
|
||||
}
|
||||
|
||||
|
||||
// Does this parcel allow you to fly?
|
||||
BOOL LLAgent::canFly()
|
||||
@@ -770,6 +777,7 @@ void LLAgent::setFlying(BOOL fly)
|
||||
{
|
||||
LLViewerStats::getInstance()->incStat(LLViewerStats::ST_FLY_COUNT);
|
||||
}
|
||||
mCrouch = false;
|
||||
setControlFlags(AGENT_CONTROL_FLY);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user