diff options
author | leviathan <leviathan@lindenlab.com> | 2024-07-10 14:08:17 -0700 |
---|---|---|
committer | Andrew Meadows <andrew.l.meadows@gmail.com> | 2024-10-03 09:03:31 -0700 |
commit | e74ce9655ed9f1124887aa31aa2e2155ea62d3da (patch) | |
tree | 380255b5643254f174c74029cbf7079eab3c7c72 | |
parent | e90913c4a926a006467661bb0d2db0a4bdb7a4b9 (diff) |
more correct AgentUpdate transmission logic
-rw-r--r-- | indra/llui/llview.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llagent.cpp | 19 | ||||
-rw-r--r-- | indra/newview/llagent.h | 3 | ||||
-rw-r--r-- | indra/newview/llappviewer.cpp | 34 | ||||
-rw-r--r-- | indra/newview/llviewerinput.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 7 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_preferences.xml | 18 |
7 files changed, 29 insertions, 65 deletions
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 0206e46b57..190ba07ad6 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -642,10 +642,10 @@ void LLView::onVisibilityChange ( bool new_visibility ) if(log_visibility_change) { - if (old_visibility!=new_visibility) - { - LLViewerEventRecorder::instance().logVisibilityChange( viewp->getPathname(), viewp->getName(), new_visibility,"widget"); - } + if (old_visibility!=new_visibility) + { + LLViewerEventRecorder::instance().logVisibilityChange( viewp->getPathname(), viewp->getName(), new_visibility,"widget"); + } } if (old_visibility) diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 53929051da..b7257a6c50 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4982,28 +4982,15 @@ void LLAgent::renderAutoPilotTarget() } } -void LLAgent::setExternalActionFlags(U32 outer_flags) -{ - if (LLGameControl::willControlAvatar()) - { - // save these flags for later, for when we're ready - // to actually send an AgentUpdate packet - mExternalActionFlags = outer_flags; - mbFlagsDirty = TRUE; - } -} - static U64 g_lastUpdateTime { 0 }; static F32 g_deltaTime { 0.0f }; static S32 g_lastUpdateFrame { 0 }; static S32 g_deltaFrame { 0 }; -void LLAgent::applyExternalActionFlags() +void LLAgent::applyExternalActionFlags(U32 outer_flags) { - if (! LLGameControl::isEnabled() || ! LLGameControl::willControlAvatar()) - { - return; - } + assert(LLGameControl::isEnabled() && LLGameControl::willControlAvatar()); + mExternalActionFlags = outer_flags; // HACK: AGENT_CONTROL_NUDGE_AT_NEG is used to toggle Flycam if ((mExternalActionFlags & AGENT_CONTROL_NUDGE_AT_NEG) > 0) diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 80b7c588e3..a69a777e1e 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -511,8 +511,7 @@ public: // computed as a function of input and state, and are sent to the server // to steer its character controller for the avatar. // - void setExternalActionFlags(U32 flags); - void applyExternalActionFlags(); + void applyExternalActionFlags(U32 flags); void updateFlycam(); void pressGameControlButton(U8 button); diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index c99f7365ab..7eded9e174 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -4809,18 +4809,17 @@ void LLAppViewer::idle() gAgent.autoPilot(&yaw); } - send_agent_update(false); - - // Some GameControl stuff needs to be executed even when the feature is not enabled + // Some GameControl logic needs to run even when the feature is not enabled // Note: we process game_control before sending AgentUpdate // because it may translate to control flags that control avatar motion. LLGameControl::processEvents(gFocusMgr.getAppHasFocus()); - // trade flags between gAgent and LLGameControl + // get control flags from each side U32 control_flags = gAgent.getControlFlags(); - U32 action_flags = LLGameControl::computeInternalActionFlags(); - LLGameControl::setExternalInput(control_flags, gAgent.getGameControlButtonsFromKeys()); + U32 game_control_action_flags = LLGameControl::computeInternalActionFlags(); + // apply to GameControl + LLGameControl::setExternalInput(control_flags, gAgent.getGameControlButtonsFromKeys()); bool should_send_game_control = LLGameControl::computeFinalStateAndCheckForChanges(); if (LLPanelPreferenceGameControl::isWaitingForInputChannel()) { @@ -4833,28 +4832,13 @@ void LLAppViewer::idle() sendGameControlInput(); } - // This GameControl stuff should NOT be executed when it isn't enabled - if (LLGameControl::isEnabled()) + // apply to AvatarControl + if (LLGameControl::isEnabled() && LLGameControl::willControlAvatar()) { - gAgent.setExternalActionFlags(action_flags); + gAgent.applyExternalActionFlags(game_control_action_flags); } - // When appropriate, update agent location to the simulator. - F32 agent_update_time = agent_update_timer.getElapsedTimeF32(); - F32 agent_force_update_time = mLastAgentForceUpdate + agent_update_time; - bool force_update = gAgent.controlFlagsDirty() - || (mLastAgentControlFlags != gAgent.getControlFlags()) - || (agent_force_update_time > (1.0f / (F32) AGENT_FORCE_UPDATES_PER_SECOND)); - if (force_update || (agent_update_time > (1.0f / (F32) AGENT_UPDATES_PER_SECOND))) - { - gAgent.applyExternalActionFlags(); - LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; - // Send avatar and camera info - mLastAgentControlFlags = gAgent.getControlFlags(); - mLastAgentForceUpdate = force_update ? 0 : agent_force_update_time; - send_agent_update(force_update); - agent_update_timer.reset(); - } + send_agent_update(false); } ////////////////////////////////////// diff --git a/indra/newview/llviewerinput.cpp b/indra/newview/llviewerinput.cpp index 0bbf7a07b3..66042128f2 100644 --- a/indra/newview/llviewerinput.cpp +++ b/indra/newview/llviewerinput.cpp @@ -666,7 +666,6 @@ bool start_gesture( EKeystate s ) bool run_forward(EKeystate s) { - // HACK: we use AGENT_CONTROL_NUDGE_AT_POS to signify "run forward" if (KEYSTATE_UP != s) { if (gAgent.mDoubleTapRunMode != LLAgent::DOUBLETAP_FORWARD) @@ -692,7 +691,6 @@ bool run_forward(EKeystate s) bool run_backward(EKeystate s) { - // HACK: we use AGENT_CONTROL_NUDGE_AT_NEG to signify "run backward" if (KEYSTATE_UP != s) { if (gAgent.mDoubleTapRunMode != LLAgent::DOUBLETAP_BACKWARD) @@ -718,7 +716,6 @@ bool run_backward(EKeystate s) bool run_left(EKeystate s) { - // HACK: we use AGENT_CONTROL_NUDGE_LEFT_POS to signify "run left" if (KEYSTATE_UP != s) { if (gAgent.mDoubleTapRunMode != LLAgent::DOUBLETAP_SLIDELEFT) @@ -769,7 +766,6 @@ bool run_right(EKeystate s) bool toggle_run(EKeystate s) { - // HACK: we use AGENT_CONTROL_FAST_AT to signify "run button" if (KEYSTATE_DOWN != s) return true; bool run = gAgent.getAlwaysRun(); if (run) @@ -788,7 +784,6 @@ bool toggle_run(EKeystate s) bool toggle_sit(EKeystate s) { - // HACK: we use AGENT_CONTROL_SIT_ON_GROUND to signify "sit button" if (KEYSTATE_DOWN != s) return true; if (gAgent.isSitting()) { diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index a37e15f8da..da019d60d8 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3153,8 +3153,8 @@ void process_crossed_region(LLMessageSystem* msg, void**) } -// sends an AgentUpdate message to the server... or not: -// only when force_send is 'true' OR +// sends an AgentUpdate message to the server... or not +// e.g. only when force_send is 'true' OR // something changed AND the update is not being throttled void send_agent_update(bool force_send, bool send_reliable) { @@ -3220,8 +3220,6 @@ void send_agent_update(bool force_send, bool send_reliable) return; } - bool send_update = force_send || sec_since_last_send > MAX_AGENT_UPDATE_PERIOD; - LLVector3 camera_pos_agent = gAgentCamera.getCameraPositionAgent(); // local to avatar's region LLVector3 camera_at = LLViewerCamera::getInstance()->getAtAxis(); LLQuaternion body_rotation = gAgent.getFrameAgent().getQuaternion(); @@ -3238,6 +3236,7 @@ void send_agent_update(bool force_send, bool send_reliable) flags |= AU_FLAGS_CLIENT_AUTOPILOT; } + bool send_update = force_send || sec_since_last_send > MAX_AGENT_UPDATE_PERIOD; if (!send_update) { // check to see if anything changed diff --git a/indra/newview/skins/default/xui/en/floater_preferences.xml b/indra/newview/skins/default/xui/en/floater_preferences.xml index e0dc538af4..e7fa839001 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences.xml @@ -87,49 +87,49 @@ top="40" width="658"> <panel - class="panel_preference" + class="panel_preference" filename="panel_preferences_general.xml" label="General" layout="topleft" help_topic="preferences_general_tab" name="general" /> <panel - class="panel_preference_graphics" + class="panel_preference_graphics" filename="panel_preferences_graphics1.xml" label="Graphics" layout="topleft" help_topic="preferences_display_tab" name="display" /> <panel - class="panel_preference" + class="panel_preference" filename="panel_preferences_sound.xml" label="Sound & Media" layout="topleft" help_topic="preferences_audio_tab" name="audio" /> <panel - class="panel_preference" + class="panel_preference" filename="panel_preferences_chat.xml" label="Chat" layout="topleft" help_topic="preferences_chat_tab" name="chat" /> <panel - class="panel_preference" + class="panel_preference" filename="panel_preferences_move.xml" label="Move & View" layout="topleft" help_topic="preferences_move_tab" name="move" /> <panel - class="panel_preference" + class="panel_preference" filename="panel_preferences_alerts.xml" label="Notifications" layout="topleft" help_topic="preferences_msgs_tab" name="msgs" /> <panel - class="panel_preference" + class="panel_preference" filename="panel_preferences_colors.xml" label="Colors" layout="topleft" @@ -143,14 +143,14 @@ help_topic="preferences_im_tab" name="im" /> <panel - class="panel_preference" + class="panel_preference" filename="panel_preferences_setup.xml" label="Setup" layout="topleft" help_topic="preferences_input_tab" name="input" /> <panel - class="panel_preference" + class="panel_preference" filename="panel_preferences_advanced.xml" label="Advanced" layout="topleft" |