diff options
Diffstat (limited to 'indra/newview/llviewermessage.cpp')
| -rw-r--r-- | indra/newview/llviewermessage.cpp | 132 | 
1 files changed, 122 insertions, 10 deletions
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 1d4828fd33..cd6cf869ae 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -118,6 +118,8 @@  #include "llpanelplaceprofile.h"  #include "llviewerregion.h"  #include "llfloaterregionrestarting.h" +#include "rlvactions.h" +#include "rlvhandler.h"  #include "llnotificationmanager.h" //  #include "llexperiencecache.h" @@ -2137,6 +2139,21 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)      EInstantMessage dialog = (EInstantMessage)d;      LLHost sender = msg->getSender(); +    LLSD metadata; +    if (msg->getNumberOfBlocksFast(_PREHASH_MetaData) > 0) +    { +        S32 metadata_size = msg->getSizeFast(_PREHASH_MetaData, 0, _PREHASH_Data); +        std::string metadata_buffer; +        metadata_buffer.resize(metadata_size, 0); + +        msg->getBinaryDataFast(_PREHASH_MetaData, _PREHASH_Data, &metadata_buffer[0], metadata_size, 0, metadata_size ); +        std::stringstream metadata_stream(metadata_buffer); +        if (LLSDSerialize::fromBinary(metadata, metadata_stream, metadata_size) == LLSDParser::PARSE_FAILURE) +        { +            metadata.clear(); +        } +    } +      LLIMProcessing::processNewMessage(from_id,          from_group,          to_id, @@ -2151,7 +2168,8 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)          position,          binary_bucket,          binary_bucket_size, -        sender); +        sender, +        metadata);  }  void send_do_not_disturb_message (LLMessageSystem* msg, const LLUUID& from_id, const LLUUID& session_id) @@ -2382,15 +2400,16 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)      }      bool is_audible = (CHAT_AUDIBLE_FULLY == chat.mAudible); +    bool show_script_chat_particles = chat.mSourceType == CHAT_SOURCE_OBJECT +        && chat.mChatType != CHAT_TYPE_DEBUG_MSG +        && gSavedSettings.getBOOL("EffectScriptChatParticles");      chatter = gObjectList.findObject(from_id);      if (chatter)      {          chat.mPosAgent = chatter->getPositionAgent();          // Make swirly things only for talking objects. (not script debug messages, though) -        if (chat.mSourceType == CHAT_SOURCE_OBJECT -            && chat.mChatType != CHAT_TYPE_DEBUG_MSG -            && gSavedSettings.getBOOL("EffectScriptChatParticles") ) +        if (show_script_chat_particles && (!RlvActions::isRlvEnabled() || CHAT_TYPE_OWNER != chat.mChatType) )          {              LLPointer<LLViewerPartSourceChat> psc = new LLViewerPartSourceChat(chatter->getPositionAgent());              psc->setSourceObject(chatter); @@ -2470,8 +2489,25 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)              case CHAT_TYPE_WHISPER:                  chat.mText = LLTrans::getString("whisper") + " ";                  break; -            case CHAT_TYPE_DEBUG_MSG:              case CHAT_TYPE_OWNER: +                if (RlvActions::isRlvEnabled()) +                { +                    if (RlvHandler::instance().handleSimulatorChat(mesg, chat, chatter)) +                    { +                        break; +                    } +                    else if (show_script_chat_particles) +                    { +                        LLPointer<LLViewerPartSourceChat> psc = new LLViewerPartSourceChat(chatter->getPositionAgent()); +                        psc->setSourceObject(chatter); +                        psc->setColor(color); +                        //We set the particles to be owned by the object's owner, +                        //just in case they should be muted by the mute list +                        psc->setOwnerUUID(owner_id); +                        LLViewerPartSim::getInstance()->addPartSource(psc); +                    } +                } +            case CHAT_TYPE_DEBUG_MSG:              case CHAT_TYPE_NORMAL:              case CHAT_TYPE_DIRECT:                  break; @@ -2567,6 +2603,8 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)              msg_notify["session_id"] = LLUUID();              msg_notify["from_id"] = chat.mFromID;              msg_notify["source_type"] = chat.mSourceType; +            // used to check if there is agent mention in the message +            msg_notify["message"] = mesg;              on_new_message(msg_notify);          } @@ -3034,6 +3072,11 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)          }      } +#ifdef LL_DISCORD +    if (gSavedSettings.getBOOL("EnableDiscord")) +        LLAppViewer::updateDiscordActivity(); +#endif +      if ( LLTracker::isTracking(NULL) )      {          // Check distance to beacon, if < 5m, remove beacon @@ -3147,7 +3190,9 @@ void send_agent_update(bool force_send, bool send_reliable)      LL_PROFILE_ZONE_SCOPED;      llassert(!gCubeSnapshot); -    if (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE) +    LLAgent::ETeleportState tp_state = gAgent.getTeleportState(); +    if (tp_state != LLAgent::TELEPORT_NONE +        && tp_state != LLAgent::TELEPORT_ARRIVING)      {          // We don't care if they want to send an agent update, they're not allowed          // until the target simulator is ready to receive them @@ -3169,6 +3214,7 @@ void send_agent_update(bool force_send, bool send_reliable)      static F64          last_send_time = 0.0;      static U32          last_control_flags = 0; +    static bool         control_flags_follow_up = false;      static U8           last_render_state = 0;      static U8           last_flags = AU_FLAGS_NONE;      static LLQuaternion last_body_rot, @@ -3246,6 +3292,20 @@ void send_agent_update(bool force_send, bool send_reliable)                  break;              } +            // example: +            // user taps crouch (control_flags 4128), viewer sends 4128 then immediately 0 +            // server starts crouching motion but does not stop it, only once viewer sends 0 +            // second time will server stop the motion. follow_up exists to make sure all +            // states like 'crouch' motion are properly cleared server side. +            // +            // P.S. Server probably shouldn't require a reminder to stop a motion, +            // but at the moment it does. +            if (control_flags_follow_up) +            { +                send_update = true; +                break; +            } +              // check translation              constexpr F32 TRANSLATE_THRESHOLD = 0.01f;              if ((last_camera_pos_agent - camera_pos_agent).magVec() > TRANSLATE_THRESHOLD) @@ -3322,7 +3382,44 @@ void send_agent_update(bool force_send, bool send_reliable)      msg->addVector3Fast(_PREHASH_CameraAtAxis, camera_at);      msg->addVector3Fast(_PREHASH_CameraLeftAxis, LLViewerCamera::getInstance()->getLeftAxis());      msg->addVector3Fast(_PREHASH_CameraUpAxis, LLViewerCamera::getInstance()->getUpAxis()); -    msg->addF32Fast(_PREHASH_Far, gAgentCamera.mDrawDistance); + +    static F32 last_draw_disatance_step = 1024; +    F32 memory_limited_draw_distance = gAgentCamera.mDrawDistance; + +    if (LLViewerTexture::isSystemMemoryCritical()) +    { +        // If we are low on memory, reduce requested draw distance +        memory_limited_draw_distance = llmax(gAgentCamera.mDrawDistance / LLViewerTexture::getSystemMemoryBudgetFactor(), gAgentCamera.mDrawDistance / 2.f); +    } + +    if (tp_state == LLAgent::TELEPORT_ARRIVING || LLStartUp::getStartupState() < STATE_MISC) +    { +        // Inform interest list, prioritize closer area. +        // Reason: currently server doesn't distance sort attachments, by restricting range +        // we reduce the number of attachments sent to the viewer, thus prioritizing +        // closer ones. +        // Todo: revise and remove once server gets distance sorting. +        last_draw_disatance_step = llmax((F32)(gAgentCamera.mDrawDistance / 2.f), 50.f); +        last_draw_disatance_step = llmin(last_draw_disatance_step, memory_limited_draw_distance); +        msg->addF32Fast(_PREHASH_Far, last_draw_disatance_step); +    } +    else if (last_draw_disatance_step < memory_limited_draw_distance) +    { +        static LLFrameTimer last_step_time; +        if (last_step_time.getElapsedTimeF32() > 1.f) +        { +            // gradually increase draw distance +            last_step_time.reset(); +            F32 step = memory_limited_draw_distance * 0.1f; +            last_draw_disatance_step = llmin(last_draw_disatance_step + step, memory_limited_draw_distance); +        } +        msg->addF32Fast(_PREHASH_Far, last_draw_disatance_step); +    } +    else +    { +        last_draw_disatance_step = memory_limited_draw_distance; +        msg->addF32Fast(_PREHASH_Far, memory_limited_draw_distance); +    }      msg->addU32Fast(_PREHASH_ControlFlags, control_flags); @@ -3350,6 +3447,7 @@ void send_agent_update(bool force_send, bool send_reliable)      // remember last update data      last_send_time = now; +    control_flags_follow_up = last_control_flags != control_flags;      last_control_flags = control_flags;      last_render_state = render_state;      last_flags = flags; @@ -3599,7 +3697,7 @@ void process_kill_object(LLMessageSystem *mesgsys, void **user_data)              gObjectList.killObject(objectp);          } -        if(delete_object) +        if(delete_object && regionp)          {              regionp->killCacheEntry(local_id);          } @@ -4143,6 +4241,8 @@ void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data)      {          LL_WARNS("Messaging") << "Received sit approval for unknown object " << sitObjectID << LL_ENDL;      } + +    gAgent.setSitObjectID(sitObjectID);  }  void process_clear_follow_cam_properties(LLMessageSystem *mesgsys, void **user_data) @@ -5008,6 +5108,7 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem)                                          false, //UI                                          gSavedSettings.getBOOL("RenderHUDInSnapshot"),                                          false, +                                        false,                                          LLSnapshotModel::SNAPSHOT_TYPE_COLOR,                                          LLSnapshotModel::SNAPSHOT_FORMAT_PNG);          } @@ -5113,6 +5214,7 @@ static void process_special_alert_messages(const std::string & message)                                      false,                                      gSavedSettings.getBOOL("RenderHUDInSnapshot"),                                      false, +                                    false,                                      LLSnapshotModel::SNAPSHOT_TYPE_COLOR,                                      LLSnapshotModel::SNAPSHOT_FORMAT_PNG);      } @@ -6610,7 +6712,6 @@ void process_initiate_download(LLMessageSystem* msg, void**)          (void**)new std::string(viewer_filename));  } -  void process_script_teleport_request(LLMessageSystem* msg, void**)  {      if (!gSavedSettings.getBOOL("ScriptsCanShowUI")) return; @@ -6624,6 +6725,11 @@ void process_script_teleport_request(LLMessageSystem* msg, void**)      msg->getString("Data", "SimName", sim_name);      msg->getVector3("Data", "SimPosition", pos);      msg->getVector3("Data", "LookAt", look_at); +    U32 flags = (BEACON_SHOW_MAP | BEACON_FOCUS_MAP); +    if (msg->has("Options")) +    { +        msg->getU32("Options", "Flags", flags); +    }      LLFloaterWorldMap* instance = LLFloaterWorldMap::getInstance();      if(instance) @@ -6634,7 +6740,13 @@ void process_script_teleport_request(LLMessageSystem* msg, void**)              << LL_ENDL;          instance->trackURL(sim_name, (S32)pos.mV[VX], (S32)pos.mV[VY], (S32)pos.mV[VZ]); -        LLFloaterReg::showInstance("world_map", "center"); +        if (flags & BEACON_SHOW_MAP) +        { +            bool old_auto_focus = instance->getAutoFocus(); +            instance->setAutoFocus(flags & BEACON_FOCUS_MAP); +            instance->openFloater("center"); +            instance->setAutoFocus(old_auto_focus); +        }      }      // remove above two lines and replace with below line  | 
