summaryrefslogtreecommitdiff
path: root/indra/newview/llagent.cpp
diff options
context:
space:
mode:
authorleviathan <leviathan@lindenlab.com>2024-09-13 10:47:24 -0700
committerleviathan <leviathan@lindenlab.com>2024-09-13 10:47:24 -0700
commitda87e8bd370ea079576f8b412a4ddb80c0715bd1 (patch)
treebdc9e145b111a4e73c773c667315ea14bd1ca5f0 /indra/newview/llagent.cpp
parent74205607b7e106f3b7566ef4a4b9c2fcdfa2f83e (diff)
send AgentUpdate ASAP when control bits change
Diffstat (limited to 'indra/newview/llagent.cpp')
-rw-r--r--indra/newview/llagent.cpp54
1 files changed, 15 insertions, 39 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 7c37cc1c00..c8b0adbaf8 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -439,8 +439,6 @@ LLAgent::LLAgent() :
mIsDoNotDisturb(false),
mControlFlags(0x00000000),
- mbFlagsDirty(false),
- mbFlagsNeedReset(false),
mAutoPilot(false),
mAutoPilotFlyOnStop(false),
@@ -936,8 +934,6 @@ void LLAgent::setFlying(bool fly, bool fail_sound)
// Update Movement Controls according to Fly mode
LLFloaterMove::setFlyingMode(fly);
-
- mbFlagsDirty = true;
}
@@ -1068,7 +1064,6 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
{
regionp->setCapabilitiesReceivedCallback(LLAgent::capabilityReceivedCallback);
}
-
}
else
{
@@ -1556,7 +1551,6 @@ U32 LLAgent::getControlFlags()
void LLAgent::setControlFlags(U32 mask)
{
mControlFlags |= mask;
- mbFlagsDirty = true;
}
@@ -1565,28 +1559,7 @@ void LLAgent::setControlFlags(U32 mask)
//-----------------------------------------------------------------------------
void LLAgent::clearControlFlags(U32 mask)
{
- U32 old_flags = mControlFlags;
mControlFlags &= ~mask;
- if (old_flags != mControlFlags)
- {
- mbFlagsDirty = true;
- }
-}
-
-//-----------------------------------------------------------------------------
-// controlFlagsDirty()
-//-----------------------------------------------------------------------------
-bool LLAgent::controlFlagsDirty() const
-{
- return mbFlagsDirty;
-}
-
-//-----------------------------------------------------------------------------
-// enableControlFlagReset()
-//-----------------------------------------------------------------------------
-void LLAgent::enableControlFlagReset()
-{
- mbFlagsNeedReset = true;
}
//-----------------------------------------------------------------------------
@@ -1594,14 +1567,9 @@ void LLAgent::enableControlFlagReset()
//-----------------------------------------------------------------------------
void LLAgent::resetControlFlags()
{
- if (mbFlagsNeedReset)
- {
- mbFlagsNeedReset = false;
- mbFlagsDirty = false;
- // reset all of the ephemeral flags
- // some flags are managed elsewhere
- mControlFlags &= AGENT_CONTROL_AWAY | AGENT_CONTROL_FLY | AGENT_CONTROL_MOUSELOOK;
- }
+ // reset all of the ephemeral flags
+ // some flags are managed elsewhere
+ mControlFlags &= AGENT_CONTROL_AWAY | AGENT_CONTROL_FLY | AGENT_CONTROL_MOUSELOOK;
}
//-----------------------------------------------------------------------------
@@ -2085,11 +2053,19 @@ void LLAgent::propagate(const F32 dt)
}
// handle rotation based on keyboard levels
- const F32 YAW_RATE = 90.f * DEG_TO_RAD; // radians per second
- yaw(YAW_RATE * gAgentCamera.getYawKey() * dt);
+ constexpr F32 YAW_RATE = 90.f * DEG_TO_RAD; // radians per second
+ F32 angle = YAW_RATE * gAgentCamera.getYawKey() * dt;
+ if (fabs(angle) > 0.0f)
+ {
+ yaw(angle);
+ }
- const F32 PITCH_RATE = 90.f * DEG_TO_RAD; // radians per second
- pitch(PITCH_RATE * gAgentCamera.getPitchKey() * dt);
+ constexpr F32 PITCH_RATE = 90.f * DEG_TO_RAD; // radians per second
+ angle = PITCH_RATE * gAgentCamera.getPitchKey() * dt;
+ if (fabs(angle) > 0.0f)
+ {
+ pitch(angle);
+ }
// handle auto-land behavior
if (isAgentAvatarValid())