aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewermessage.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:42 -0500
committerJacek Antonelli2008-08-15 23:45:42 -0500
commitce28e056c20bf2723f565bbf464b87781ec248a2 (patch)
treeef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/llviewermessage.cpp
parentSecond Life viewer sources 1.19.1.4b (diff)
downloadmeta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz
Second Life viewer sources 1.20.2
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewermessage.cpp226
1 files changed, 117 insertions, 109 deletions
diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp
index 37bd350..592ef39 100644
--- a/linden/indra/newview/llviewermessage.cpp
+++ b/linden/indra/newview/llviewermessage.cpp
@@ -36,7 +36,6 @@
36#include <deque> 36#include <deque>
37 37
38#include "audioengine.h" 38#include "audioengine.h"
39#include "audiosettings.h"
40#include "indra_constants.h" 39#include "indra_constants.h"
41#include "lscript_byteformat.h" 40#include "lscript_byteformat.h"
42#include "mean_collision_data.h" 41#include "mean_collision_data.h"
@@ -68,6 +67,7 @@
68#include "llagent.h" 67#include "llagent.h"
69#include "llcallingcard.h" 68#include "llcallingcard.h"
70#include "llconsole.h" 69#include "llconsole.h"
70#include "llvieweraudio.h"
71#include "llviewercontrol.h" 71#include "llviewercontrol.h"
72#include "lldrawpool.h" 72#include "lldrawpool.h"
73#include "llfirstuse.h" 73#include "llfirstuse.h"
@@ -81,6 +81,7 @@
81#include "llfloaterregioninfo.h" 81#include "llfloaterregioninfo.h"
82#include "llfloaterlandholdings.h" 82#include "llfloaterlandholdings.h"
83#include "llfloatermap.h" 83#include "llfloatermap.h"
84#include "llurldispatcher.h"
84#include "llfloatermute.h" 85#include "llfloatermute.h"
85#include "llfloaterpostcard.h" 86#include "llfloaterpostcard.h"
86#include "llfloaterpreference.h" 87#include "llfloaterpreference.h"
@@ -284,8 +285,7 @@ void process_logout_reply(LLMessageSystem* msg, void**)
284 285
285void process_layer_data(LLMessageSystem *mesgsys, void **user_data) 286void process_layer_data(LLMessageSystem *mesgsys, void **user_data)
286{ 287{
287 if(!gWorldp) return; 288 LLViewerRegion *regionp = LLWorld::getInstance()->getRegion(mesgsys->getSender());
288 LLViewerRegion *regionp = gWorldp->getRegion(mesgsys->getSender());
289 289
290 if (!regionp || gNoRender) 290 if (!regionp || gNoRender)
291 { 291 {
@@ -912,10 +912,10 @@ void inventory_offer_mute_callback(const LLUUID& blocked_id,
912 } 912 }
913 913
914 LLMute mute(blocked_id, from_name, type); 914 LLMute mute(blocked_id, from_name, type);
915 if (gMuteListp->add(mute)) 915 if (LLMuteList::getInstance()->add(mute))
916 { 916 {
917 LLFloaterMute::showInstance(); 917 LLFloaterMute::showInstance();
918 gFloaterMute->selectMute(blocked_id); 918 LLFloaterMute::getInstance()->selectMute(blocked_id);
919 } 919 }
920 920
921 // purge the message queue of any previously queued inventory offers from the same source. 921 // purge the message queue of any previously queued inventory offers from the same source.
@@ -1100,7 +1100,7 @@ void inventory_offer_callback(S32 button, void* user_data)
1100 1100
1101 log_message = "You decline " + info->mDesc + " from " + info->mFromName + "."; 1101 log_message = "You decline " + info->mDesc + " from " + info->mFromName + ".";
1102 chat.mText = log_message; 1102 chat.mText = log_message;
1103 if( gMuteListp->isMuted(info->mFromID ) && ! gMuteListp->isLinden(info->mFromName) ) // muting for SL-42269 1103 if( LLMuteList::getInstance()->isMuted(info->mFromID ) && ! LLMuteList::getInstance()->isLinden(info->mFromName) ) // muting for SL-42269
1104 { 1104 {
1105 chat.mMuted = TRUE; 1105 chat.mMuted = TRUE;
1106 } 1106 }
@@ -1159,7 +1159,7 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task)
1159 } 1159 }
1160 1160
1161 //If muted, don't even go through the messaging stuff. Just curtail the offer here. 1161 //If muted, don't even go through the messaging stuff. Just curtail the offer here.
1162 if (gMuteListp->isMuted(info->mFromID, info->mFromName)) 1162 if (LLMuteList::getInstance()->isMuted(info->mFromID, info->mFromName))
1163 { 1163 {
1164 inventory_offer_callback(IOR_MUTE, info); 1164 inventory_offer_callback(IOR_MUTE, info);
1165 return; 1165 return;
@@ -1351,13 +1351,14 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
1351 time_t timestamp = (time_t)t; 1351 time_t timestamp = (time_t)t;
1352 1352
1353 BOOL is_busy = gAgent.getBusy(); 1353 BOOL is_busy = gAgent.getBusy();
1354 BOOL is_muted = gMuteListp->isMuted(from_id, name, LLMute::flagTextChat); 1354 BOOL is_muted = LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat);
1355 BOOL is_linden = gMuteListp->isLinden(name); 1355 BOOL is_linden = LLMuteList::getInstance()->isLinden(name);
1356 BOOL is_owned_by_me = FALSE; 1356 BOOL is_owned_by_me = FALSE;
1357 1357
1358 chat.mMuted = is_muted && !is_linden; 1358 chat.mMuted = is_muted && !is_linden;
1359 chat.mFromID = from_id; 1359 chat.mFromID = from_id;
1360 chat.mFromName = name; 1360 chat.mFromName = name;
1361 chat.mSourceType = (from_id.isNull() || !strcmp(name, SYSTEM_FROM)) ? CHAT_SOURCE_SYSTEM : CHAT_SOURCE_AGENT;
1361 1362
1362 LLViewerObject *source = gObjectList.findObject(session_id); //Session ID is probably the wrong thing. 1363 LLViewerObject *source = gObjectList.findObject(session_id); //Session ID is probably the wrong thing.
1363 if (source) 1364 if (source)
@@ -1448,7 +1449,8 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
1448 } 1449 }
1449 else if (from_id.isNull()) 1450 else if (from_id.isNull())
1450 { 1451 {
1451 // Messages from "Second Life" don't go to IM history 1452 // Messages from "Second Life" ID don't go to IM history
1453 // messages which should be routed to IM window come from a user ID with name=SYSTEM_NAME
1452 snprintf(buffer, sizeof(buffer), "%s: %s", name, message); /* Flawfinder: ignore */ 1454 snprintf(buffer, sizeof(buffer), "%s: %s", name, message); /* Flawfinder: ignore */
1453 chat.mText = buffer; 1455 chat.mText = buffer;
1454 LLFloaterChat::addChat(chat, FALSE, FALSE); 1456 LLFloaterChat::addChat(chat, FALSE, FALSE);
@@ -2099,7 +2101,7 @@ void process_offer_callingcard(LLMessageSystem* msg, void**)
2099 if(!source_name.empty()) 2101 if(!source_name.empty())
2100 { 2102 {
2101 if (gAgent.getBusy() 2103 if (gAgent.getBusy()
2102 || gMuteListp->isMuted(source_id, source_name, LLMute::flagTextChat)) 2104 || LLMuteList::getInstance()->isMuted(source_id, source_name, LLMute::flagTextChat))
2103 { 2105 {
2104 // automatically decline offer 2106 // automatically decline offer
2105 callingcard_offer_callback(1, (void*)offerdata); 2107 callingcard_offer_callback(1, (void*)offerdata);
@@ -2169,20 +2171,15 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
2169 BOOL is_self = (from_id == gAgent.getID()); 2171 BOOL is_self = (from_id == gAgent.getID());
2170 BOOL is_busy = gAgent.getBusy(); 2172 BOOL is_busy = gAgent.getBusy();
2171 2173
2172 // Apparently you can receive chat before app is fully initialized, hence
2173 // gMuteListp can be null. JC
2174 BOOL is_muted = FALSE; 2174 BOOL is_muted = FALSE;
2175 BOOL is_linden = FALSE; 2175 BOOL is_linden = FALSE;
2176 if (gMuteListp) 2176 is_muted = LLMuteList::getInstance()->isMuted(
2177 { 2177 from_id,
2178 is_muted = gMuteListp->isMuted( 2178 from_name,
2179 from_id, 2179 LLMute::flagTextChat)
2180 from_name, 2180 || LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagTextChat);
2181 LLMute::flagTextChat) 2181 is_linden = chat.mSourceType != CHAT_SOURCE_OBJECT &&
2182 || gMuteListp->isMuted(owner_id, LLMute::flagTextChat); 2182 LLMuteList::getInstance()->isLinden(from_name);
2183 is_linden = chat.mSourceType != CHAT_SOURCE_OBJECT &&
2184 gMuteListp->isLinden(from_name);
2185 }
2186 2183
2187 BOOL is_audible = (CHAT_AUDIBLE_FULLY == chat.mAudible); 2184 BOOL is_audible = (CHAT_AUDIBLE_FULLY == chat.mAudible);
2188 chatter = gObjectList.findObject(from_id); 2185 chatter = gObjectList.findObject(from_id);
@@ -2200,7 +2197,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
2200 //We set the particles to be owned by the object's owner, 2197 //We set the particles to be owned by the object's owner,
2201 //just in case they should be muted by the mute list 2198 //just in case they should be muted by the mute list
2202 psc->setOwnerUUID(owner_id); 2199 psc->setOwnerUUID(owner_id);
2203 gWorldPointer->mPartSim.addPartSource(psc); 2200 LLViewerPartSim::getInstance()->addPartSource(psc);
2204 } 2201 }
2205 2202
2206 // record last audible utterance 2203 // record last audible utterance
@@ -2242,7 +2239,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
2242 // Look for the start of typing so we can put "..." in the bubbles. 2239 // Look for the start of typing so we can put "..." in the bubbles.
2243 if (CHAT_TYPE_START == chat.mChatType) 2240 if (CHAT_TYPE_START == chat.mChatType)
2244 { 2241 {
2245 gLocalSpeakerMgr->setSpeakerTyping(from_id, TRUE); 2242 LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, TRUE);
2246 2243
2247 // Might not have the avatar constructed yet, eg on login. 2244 // Might not have the avatar constructed yet, eg on login.
2248 if (chatter && chatter->isAvatar()) 2245 if (chatter && chatter->isAvatar())
@@ -2253,7 +2250,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
2253 } 2250 }
2254 else if (CHAT_TYPE_STOP == chat.mChatType) 2251 else if (CHAT_TYPE_STOP == chat.mChatType)
2255 { 2252 {
2256 gLocalSpeakerMgr->setSpeakerTyping(from_id, FALSE); 2253 LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, FALSE);
2257 2254
2258 // Might not have the avatar constructed yet, eg on login. 2255 // Might not have the avatar constructed yet, eg on login.
2259 if (chatter && chatter->isAvatar()) 2256 if (chatter && chatter->isAvatar())
@@ -2266,7 +2263,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
2266 // We have a real utterance now, so can stop showing "..." and proceed. 2263 // We have a real utterance now, so can stop showing "..." and proceed.
2267 if (chatter && chatter->isAvatar()) 2264 if (chatter && chatter->isAvatar())
2268 { 2265 {
2269 gLocalSpeakerMgr->setSpeakerTyping(from_id, FALSE); 2266 LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, FALSE);
2270 ((LLVOAvatar*)chatter)->stopTyping(); 2267 ((LLVOAvatar*)chatter)->stopTyping();
2271 2268
2272 if (!is_muted && !is_busy) 2269 if (!is_muted && !is_busy)
@@ -2558,10 +2555,10 @@ void process_teleport_finish(LLMessageSystem* msg, void**)
2558 2555
2559 // Do teleport effect for where you're leaving 2556 // Do teleport effect for where you're leaving
2560 // VEFFECT: TeleportStart 2557 // VEFFECT: TeleportStart
2561 LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); 2558 LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE);
2562 effectp->setPositionGlobal(gAgent.getPositionGlobal()); 2559 effectp->setPositionGlobal(gAgent.getPositionGlobal());
2563 effectp->setColor(LLColor4U(gAgent.getEffectColor())); 2560 effectp->setColor(LLColor4U(gAgent.getEffectColor()));
2564 gHUDManager->sendEffects(); 2561 LLHUDManager::getInstance()->sendEffects();
2565 2562
2566 U32 location_id; 2563 U32 location_id;
2567 U32 sim_ip; 2564 U32 sim_ip;
@@ -2597,8 +2594,7 @@ void process_teleport_finish(LLMessageSystem* msg, void**)
2597 2594
2598 // Viewer trusts the simulator. 2595 // Viewer trusts the simulator.
2599 gMessageSystem->enableCircuit(sim_host, TRUE); 2596 gMessageSystem->enableCircuit(sim_host, TRUE);
2600 if(!gWorldp) return; 2597 LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host);
2601 LLViewerRegion* regionp = gWorldp->addRegion(region_handle, sim_host);
2602 2598
2603/* 2599/*
2604 // send camera update to new region 2600 // send camera update to new region
@@ -2642,11 +2638,11 @@ void process_teleport_finish(LLMessageSystem* msg, void**)
2642 2638
2643 // Now do teleport effect for where you're going. 2639 // Now do teleport effect for where you're going.
2644 // VEFFECT: TeleportEnd 2640 // VEFFECT: TeleportEnd
2645 effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); 2641 effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE);
2646 effectp->setPositionGlobal(gAgent.getPositionGlobal()); 2642 effectp->setPositionGlobal(gAgent.getPositionGlobal());
2647 2643
2648 effectp->setColor(LLColor4U(gAgent.getEffectColor())); 2644 effectp->setColor(LLColor4U(gAgent.getEffectColor()));
2649 gHUDManager->sendEffects(); 2645 LLHUDManager::getInstance()->sendEffects();
2650 2646
2651// gTeleportDisplay = TRUE; 2647// gTeleportDisplay = TRUE;
2652// gTeleportDisplayTimer.reset(); 2648// gTeleportDisplayTimer.reset();
@@ -2712,8 +2708,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
2712 2708
2713 F32 x, y; 2709 F32 x, y;
2714 from_region_handle(region_handle, &x, &y); 2710 from_region_handle(region_handle, &x, &y);
2715 if(!gWorldp) return; 2711 LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromHandle(region_handle);
2716 LLViewerRegion* regionp = gWorldp->getRegionFromHandle(region_handle);
2717 if (!regionp) 2712 if (!regionp)
2718 { 2713 {
2719 if (gAgent.getRegion()) 2714 if (gAgent.getRegion())
@@ -2833,13 +2828,8 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
2833 avatarp->mFootPlane.clearVec(); 2828 avatarp->mFootPlane.clearVec();
2834 } 2829 }
2835 2830
2836 // reset always run status 2831 // send walk-vs-run status
2837 msg->newMessageFast(_PREHASH_SetAlwaysRun); 2832 gAgent.sendWalkRun(gAgent.getRunning() || gAgent.getAlwaysRun());
2838 msg->nextBlockFast(_PREHASH_AgentData);
2839 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
2840 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
2841 msg->addBOOLFast(_PREHASH_AlwaysRun, gAgent.getAlwaysRun());
2842 gAgent.sendReliableMessage();
2843 2833
2844 if (LLFloaterReleaseMsg::checkVersion(version_channel_char)) 2834 if (LLFloaterReleaseMsg::checkVersion(version_channel_char))
2845 { 2835 {
@@ -2874,8 +2864,7 @@ void process_crossed_region(LLMessageSystem* msg, void**)
2874 2864
2875 send_complete_agent_movement(sim_host); 2865 send_complete_agent_movement(sim_host);
2876 2866
2877 if(!gWorldp) return; 2867 LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host);
2878 LLViewerRegion* regionp = gWorldp->addRegion(region_handle, sim_host);
2879 regionp->setSeedCapability(std::string(seedCap)); 2868 regionp->setSeedCapability(std::string(seedCap));
2880} 2869}
2881 2870
@@ -2904,6 +2893,12 @@ void send_agent_update(BOOL force_send, BOOL send_reliable)
2904 return; 2893 return;
2905 } 2894 }
2906 2895
2896 // no region to send update to
2897 if(gAgent.getRegion() == NULL)
2898 {
2899 return;
2900 }
2901
2907 const F32 TRANSLATE_THRESHOLD = 0.01f; 2902 const F32 TRANSLATE_THRESHOLD = 0.01f;
2908 2903
2909 // NOTA BENE: This is (intentionally?) using the small angle sine approximation to test for rotation 2904 // NOTA BENE: This is (intentionally?) using the small angle sine approximation to test for rotation
@@ -2944,7 +2939,7 @@ void send_agent_update(BOOL force_send, BOOL send_reliable)
2944 U8 flag_change = 0; 2939 U8 flag_change = 0;
2945 2940
2946 cam_center_chg = last_camera_pos_agent - camera_pos_agent; 2941 cam_center_chg = last_camera_pos_agent - camera_pos_agent;
2947 cam_rot_chg = last_camera_at - gCamera->getAtAxis(); 2942 cam_rot_chg = last_camera_at - LLViewerCamera::getInstance()->getAtAxis();
2948 2943
2949 // If a modifier key is held down, turn off 2944 // If a modifier key is held down, turn off
2950 // LBUTTON and ML_LBUTTON so that using the camera (alt-key) doesn't 2945 // LBUTTON and ML_LBUTTON so that using the camera (alt-key) doesn't
@@ -3052,9 +3047,9 @@ void send_agent_update(BOOL force_send, BOOL send_reliable)
3052// } 3047// }
3053 3048
3054 msg->addVector3Fast(_PREHASH_CameraCenter, camera_pos_agent); 3049 msg->addVector3Fast(_PREHASH_CameraCenter, camera_pos_agent);
3055 msg->addVector3Fast(_PREHASH_CameraAtAxis, gCamera->getAtAxis()); 3050 msg->addVector3Fast(_PREHASH_CameraAtAxis, LLViewerCamera::getInstance()->getAtAxis());
3056 msg->addVector3Fast(_PREHASH_CameraLeftAxis, gCamera->getLeftAxis()); 3051 msg->addVector3Fast(_PREHASH_CameraLeftAxis, LLViewerCamera::getInstance()->getLeftAxis());
3057 msg->addVector3Fast(_PREHASH_CameraUpAxis, gCamera->getUpAxis()); 3052 msg->addVector3Fast(_PREHASH_CameraUpAxis, LLViewerCamera::getInstance()->getUpAxis());
3058 msg->addF32Fast(_PREHASH_Far, gAgent.mDrawDistance); 3053 msg->addF32Fast(_PREHASH_Far, gAgent.mDrawDistance);
3059 3054
3060 msg->addU32Fast(_PREHASH_ControlFlags, control_flags); 3055 msg->addU32Fast(_PREHASH_ControlFlags, control_flags);
@@ -3089,9 +3084,9 @@ void send_agent_update(BOOL force_send, BOOL send_reliable)
3089 last_head_rot = head_rotation; 3084 last_head_rot = head_rotation;
3090 last_render_state = render_state; 3085 last_render_state = render_state;
3091 last_camera_pos_agent = camera_pos_agent; 3086 last_camera_pos_agent = camera_pos_agent;
3092 last_camera_at = gCamera->getAtAxis(); 3087 last_camera_at = LLViewerCamera::getInstance()->getAtAxis();
3093 last_camera_left = gCamera->getLeftAxis(); 3088 last_camera_left = LLViewerCamera::getInstance()->getLeftAxis();
3094 last_camera_up = gCamera->getUpAxis(); 3089 last_camera_up = LLViewerCamera::getInstance()->getUpAxis();
3095 last_control_flags = control_flags; 3090 last_control_flags = control_flags;
3096 last_flags = flags; 3091 last_flags = flags;
3097 } 3092 }
@@ -3205,7 +3200,7 @@ void process_kill_object(LLMessageSystem *mesgsys, void **user_data)
3205 //llinfos << "Kill message for local " << local_id << llendl; 3200 //llinfos << "Kill message for local " << local_id << llendl;
3206 } 3201 }
3207 3202
3208 gSelectMgr->removeObjectFromSelections(id); 3203 LLSelectMgr::getInstance()->removeObjectFromSelections(id);
3209 3204
3210 // ...don't kill the avatar 3205 // ...don't kill the avatar
3211 if (!(id == gAgentID)) 3206 if (!(id == gAgentID))
@@ -3259,8 +3254,7 @@ void process_time_synch(LLMessageSystem *mesgsys, void **user_data)
3259 mesgsys->getVector3Fast(_PREHASH_TimeInfo, _PREHASH_SunDirection, sun_direction); 3254 mesgsys->getVector3Fast(_PREHASH_TimeInfo, _PREHASH_SunDirection, sun_direction);
3260 mesgsys->getVector3Fast(_PREHASH_TimeInfo, _PREHASH_SunAngVelocity, sun_ang_velocity); 3255 mesgsys->getVector3Fast(_PREHASH_TimeInfo, _PREHASH_SunAngVelocity, sun_ang_velocity);
3261 3256
3262 if(!gWorldp) return; 3257 LLWorld::getInstance()->setSpaceTimeUSec(space_time_usec);
3263 gWorldp->setSpaceTimeUSec(space_time_usec);
3264 3258
3265 //lldebugs << "time_synch() - " << sun_direction << ", " << sun_ang_velocity 3259 //lldebugs << "time_synch() - " << sun_direction << ", " << sun_ang_velocity
3266 // << ", " << phase << llendl; 3260 // << ", " << phase << llendl;
@@ -3276,8 +3270,6 @@ void process_time_synch(LLMessageSystem *mesgsys, void **user_data)
3276void process_sound_trigger(LLMessageSystem *msg, void **) 3270void process_sound_trigger(LLMessageSystem *msg, void **)
3277{ 3271{
3278 if (!gAudiop) return; 3272 if (!gAudiop) return;
3279 if (!gParcelMgr) return;
3280 if (!gMuteListp) return;
3281 3273
3282 U64 region_handle = 0; 3274 U64 region_handle = 0;
3283 F32 gain = 0; 3275 F32 gain = 0;
@@ -3303,17 +3295,17 @@ void process_sound_trigger(LLMessageSystem *msg, void **)
3303 3295
3304 // Don't play a trigger sound if you can't hear it due 3296 // Don't play a trigger sound if you can't hear it due
3305 // to parcel "local audio only" settings. 3297 // to parcel "local audio only" settings.
3306 if (!gParcelMgr->canHearSound(pos_global)) return; 3298 if (!LLViewerParcelMgr::getInstance()->canHearSound(pos_global)) return;
3307 3299
3308 // Don't play sounds triggered by someone you muted. 3300 // Don't play sounds triggered by someone you muted.
3309 if (gMuteListp->isMuted(owner_id, LLMute::flagObjectSounds)) return; 3301 if (LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagObjectSounds)) return;
3310 3302
3311 // Don't play sounds from an object you muted 3303 // Don't play sounds from an object you muted
3312 if (gMuteListp->isMuted(object_id)) return; 3304 if (LLMuteList::getInstance()->isMuted(object_id)) return;
3313 3305
3314 // Don't play sounds from an object whose parent you muted 3306 // Don't play sounds from an object whose parent you muted
3315 if (parent_id.notNull() 3307 if (parent_id.notNull()
3316 && gMuteListp->isMuted(parent_id)) 3308 && LLMuteList::getInstance()->isMuted(parent_id))
3317 { 3309 {
3318 return; 3310 return;
3319 } 3311 }
@@ -3340,8 +3332,8 @@ void process_preload_sound(LLMessageSystem *msg, void **user_data)
3340 LLViewerObject *objectp = gObjectList.findObject(object_id); 3332 LLViewerObject *objectp = gObjectList.findObject(object_id);
3341 if (!objectp) return; 3333 if (!objectp) return;
3342 3334
3343 if (gMuteListp->isMuted(object_id)) return; 3335 if (LLMuteList::getInstance()->isMuted(object_id)) return;
3344 if (gMuteListp->isMuted(owner_id, LLMute::flagObjectSounds)) return; 3336 if (LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagObjectSounds)) return;
3345 3337
3346 LLAudioSource *sourcep = objectp->getAudioSource(owner_id); 3338 LLAudioSource *sourcep = objectp->getAudioSource(owner_id);
3347 if (!sourcep) return; 3339 if (!sourcep) return;
@@ -3377,9 +3369,9 @@ void process_attached_sound(LLMessageSystem *msg, void **user_data)
3377 return; 3369 return;
3378 } 3370 }
3379 3371
3380 if (gMuteListp->isMuted(object_id)) return; 3372 if (LLMuteList::getInstance()->isMuted(object_id)) return;
3381 3373
3382 if (gMuteListp->isMuted(owner_id, LLMute::flagObjectSounds)) return; 3374 if (LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagObjectSounds)) return;
3383 3375
3384 objectp->setAttachedSound(sound_id, owner_id, gain, flags); 3376 objectp->setAttachedSound(sound_id, owner_id, gain, flags);
3385} 3377}
@@ -3430,73 +3422,91 @@ void process_sim_stats(LLMessageSystem *msg, void **user_data)
3430 switch (stat_id) 3422 switch (stat_id)
3431 { 3423 {
3432 case LL_SIM_STAT_TIME_DILATION: 3424 case LL_SIM_STAT_TIME_DILATION:
3433 gViewerStats->mSimTimeDilation.addValue(stat_value); 3425 LLViewerStats::getInstance()->mSimTimeDilation.addValue(stat_value);
3434 break; 3426 break;
3435 case LL_SIM_STAT_FPS: 3427 case LL_SIM_STAT_FPS:
3436 gViewerStats->mSimFPS.addValue(stat_value); 3428 LLViewerStats::getInstance()->mSimFPS.addValue(stat_value);
3437 break; 3429 break;
3438 case LL_SIM_STAT_PHYSFPS: 3430 case LL_SIM_STAT_PHYSFPS:
3439 gViewerStats->mSimPhysicsFPS.addValue(stat_value); 3431 LLViewerStats::getInstance()->mSimPhysicsFPS.addValue(stat_value);
3440 break; 3432 break;
3441 case LL_SIM_STAT_AGENTUPS: 3433 case LL_SIM_STAT_AGENTUPS:
3442 gViewerStats->mSimAgentUPS.addValue(stat_value); 3434 LLViewerStats::getInstance()->mSimAgentUPS.addValue(stat_value);
3443 break; 3435 break;
3444 case LL_SIM_STAT_FRAMEMS: 3436 case LL_SIM_STAT_FRAMEMS:
3445 gViewerStats->mSimFrameMsec.addValue(stat_value); 3437 LLViewerStats::getInstance()->mSimFrameMsec.addValue(stat_value);
3446 break; 3438 break;
3447 case LL_SIM_STAT_NETMS: 3439 case LL_SIM_STAT_NETMS:
3448 gViewerStats->mSimNetMsec.addValue(stat_value); 3440 LLViewerStats::getInstance()->mSimNetMsec.addValue(stat_value);
3449 break; 3441 break;
3450 case LL_SIM_STAT_SIMOTHERMS: 3442 case LL_SIM_STAT_SIMOTHERMS:
3451 gViewerStats->mSimSimOtherMsec.addValue(stat_value); 3443 LLViewerStats::getInstance()->mSimSimOtherMsec.addValue(stat_value);
3452 break; 3444 break;
3453 case LL_SIM_STAT_SIMPHYSICSMS: 3445 case LL_SIM_STAT_SIMPHYSICSMS:
3454 gViewerStats->mSimSimPhysicsMsec.addValue(stat_value); 3446 LLViewerStats::getInstance()->mSimSimPhysicsMsec.addValue(stat_value);
3455 break; 3447 break;
3456 case LL_SIM_STAT_AGENTMS: 3448 case LL_SIM_STAT_AGENTMS:
3457 gViewerStats->mSimAgentMsec.addValue(stat_value); 3449 LLViewerStats::getInstance()->mSimAgentMsec.addValue(stat_value);
3458 break; 3450 break;
3459 case LL_SIM_STAT_IMAGESMS: 3451 case LL_SIM_STAT_IMAGESMS:
3460 gViewerStats->mSimImagesMsec.addValue(stat_value); 3452 LLViewerStats::getInstance()->mSimImagesMsec.addValue(stat_value);
3461 break; 3453 break;
3462 case LL_SIM_STAT_SCRIPTMS: 3454 case LL_SIM_STAT_SCRIPTMS:
3463 gViewerStats->mSimScriptMsec.addValue(stat_value); 3455 LLViewerStats::getInstance()->mSimScriptMsec.addValue(stat_value);
3464 break; 3456 break;
3465 case LL_SIM_STAT_NUMTASKS: 3457 case LL_SIM_STAT_NUMTASKS:
3466 gViewerStats->mSimObjects.addValue(stat_value); 3458 LLViewerStats::getInstance()->mSimObjects.addValue(stat_value);
3467 break; 3459 break;
3468 case LL_SIM_STAT_NUMTASKSACTIVE: 3460 case LL_SIM_STAT_NUMTASKSACTIVE:
3469 gViewerStats->mSimActiveObjects.addValue(stat_value); 3461 LLViewerStats::getInstance()->mSimActiveObjects.addValue(stat_value);
3470 break; 3462 break;
3471 case LL_SIM_STAT_NUMAGENTMAIN: 3463 case LL_SIM_STAT_NUMAGENTMAIN:
3472 gViewerStats->mSimMainAgents.addValue(stat_value); 3464 LLViewerStats::getInstance()->mSimMainAgents.addValue(stat_value);
3473 break; 3465 break;
3474 case LL_SIM_STAT_NUMAGENTCHILD: 3466 case LL_SIM_STAT_NUMAGENTCHILD:
3475 gViewerStats->mSimChildAgents.addValue(stat_value); 3467 LLViewerStats::getInstance()->mSimChildAgents.addValue(stat_value);
3476 break; 3468 break;
3477 case LL_SIM_STAT_NUMSCRIPTSACTIVE: 3469 case LL_SIM_STAT_NUMSCRIPTSACTIVE:
3478 gViewerStats->mSimActiveScripts.addValue(stat_value); 3470 LLViewerStats::getInstance()->mSimActiveScripts.addValue(stat_value);
3479 break; 3471 break;
3480 case LL_SIM_STAT_LSLIPS: 3472 case LL_SIM_STAT_LSLIPS:
3481 gViewerStats->mSimLSLIPS.addValue(stat_value); 3473 LLViewerStats::getInstance()->mSimLSLIPS.addValue(stat_value);
3482 break; 3474 break;
3483 case LL_SIM_STAT_INPPS: 3475 case LL_SIM_STAT_INPPS:
3484 gViewerStats->mSimInPPS.addValue(stat_value); 3476 LLViewerStats::getInstance()->mSimInPPS.addValue(stat_value);
3485 break; 3477 break;
3486 case LL_SIM_STAT_OUTPPS: 3478 case LL_SIM_STAT_OUTPPS:
3487 gViewerStats->mSimOutPPS.addValue(stat_value); 3479 LLViewerStats::getInstance()->mSimOutPPS.addValue(stat_value);
3488 break; 3480 break;
3489 case LL_SIM_STAT_PENDING_DOWNLOADS: 3481 case LL_SIM_STAT_PENDING_DOWNLOADS:
3490 gViewerStats->mSimPendingDownloads.addValue(stat_value); 3482 LLViewerStats::getInstance()->mSimPendingDownloads.addValue(stat_value);
3491 break; 3483 break;
3492 case LL_SIM_STAT_PENDING_UPLOADS: 3484 case LL_SIM_STAT_PENDING_UPLOADS:
3493 gViewerStats->mSimPendingUploads.addValue(stat_value); 3485 LLViewerStats::getInstance()->mSimPendingUploads.addValue(stat_value);
3494 break; 3486 break;
3495 case LL_SIM_STAT_PENDING_LOCAL_UPLOADS: 3487 case LL_SIM_STAT_PENDING_LOCAL_UPLOADS:
3496 gViewerStats->mSimPendingLocalUploads.addValue(stat_value); 3488 LLViewerStats::getInstance()->mSimPendingLocalUploads.addValue(stat_value);
3497 break; 3489 break;
3498 case LL_SIM_STAT_TOTAL_UNACKED_BYTES: 3490 case LL_SIM_STAT_TOTAL_UNACKED_BYTES:
3499 gViewerStats->mSimTotalUnackedBytes.addValue(stat_value / 1024.f); 3491 LLViewerStats::getInstance()->mSimTotalUnackedBytes.addValue(stat_value / 1024.f);
3492 break;
3493 case LL_SIM_STAT_PHYSICS_PINNED_TASKS:
3494 LLViewerStats::getInstance()->mPhysicsPinnedTasks.addValue(stat_value);
3495 break;
3496 case LL_SIM_STAT_PHYSICS_LOD_TASKS:
3497 LLViewerStats::getInstance()->mPhysicsLODTasks.addValue(stat_value);
3498 break;
3499 case LL_SIM_STAT_SIMPHYSICSSTEPMS:
3500 LLViewerStats::getInstance()->mSimSimPhysicsStepMsec.addValue(stat_value);
3501 break;
3502 case LL_SIM_STAT_SIMPHYSICSSHAPEMS:
3503 LLViewerStats::getInstance()->mSimSimPhysicsShapeUpdateMsec.addValue(stat_value);
3504 break;
3505 case LL_SIM_STAT_SIMPHYSICSOTHERMS:
3506 LLViewerStats::getInstance()->mSimSimPhysicsOtherMsec.addValue(stat_value);
3507 break;
3508 case LL_SIM_STAT_SIMPHYSICSMEMORY:
3509 LLViewerStats::getInstance()->mPhysicsMemoryAllocated.addValue(stat_value);
3500 break; 3510 break;
3501 default: 3511 default:
3502// llwarns << "Unknown stat id" << stat_id << llendl; 3512// llwarns << "Unknown stat id" << stat_id << llendl;
@@ -3506,7 +3516,7 @@ void process_sim_stats(LLMessageSystem *msg, void **user_data)
3506 3516
3507 /* 3517 /*
3508 msg->getF32Fast(_PREHASH_Statistics, _PREHASH_PhysicsTimeDilation, time_dilation); 3518 msg->getF32Fast(_PREHASH_Statistics, _PREHASH_PhysicsTimeDilation, time_dilation);
3509 gViewerStats->mSimTDStat.addValue(time_dilation); 3519 LLViewerStats::getInstance()->mSimTDStat.addValue(time_dilation);
3510 3520
3511 // Process information 3521 // Process information
3512 // { CpuUsage F32 } 3522 // { CpuUsage F32 }
@@ -3521,9 +3531,9 @@ void process_sim_stats(LLMessageSystem *msg, void **user_data)
3521 msg->getF32Fast(_PREHASH_Statistics, _PREHASH_SimMemTotal, sim_mem_total); 3531 msg->getF32Fast(_PREHASH_Statistics, _PREHASH_SimMemTotal, sim_mem_total);
3522 msg->getF32Fast(_PREHASH_Statistics, _PREHASH_SimMemRSS, sim_mem_rss); 3532 msg->getF32Fast(_PREHASH_Statistics, _PREHASH_SimMemRSS, sim_mem_rss);
3523 msg->getF32Fast(_PREHASH_Statistics, _PREHASH_ProcessUptime, process_uptime); 3533 msg->getF32Fast(_PREHASH_Statistics, _PREHASH_ProcessUptime, process_uptime);
3524 gViewerStats->mSimCPUUsageStat.addValue(cpu_usage); 3534 LLViewerStats::getInstance()->mSimCPUUsageStat.addValue(cpu_usage);
3525 gViewerStats->mSimMemTotalStat.addValue(sim_mem_total); 3535 LLViewerStats::getInstance()->mSimMemTotalStat.addValue(sim_mem_total);
3526 gViewerStats->mSimMemRSSStat.addValue(sim_mem_rss); 3536 LLViewerStats::getInstance()->mSimMemRSSStat.addValue(sim_mem_rss);
3527 */ 3537 */
3528 3538
3529 // 3539 //
@@ -3951,7 +3961,7 @@ void process_time_dilation(LLMessageSystem *msg, void **user_data)
3951 // get the pointer to the right region 3961 // get the pointer to the right region
3952 U32 ip = msg->getSenderIP(); 3962 U32 ip = msg->getSenderIP();
3953 U32 port = msg->getSenderPort(); 3963 U32 port = msg->getSenderPort();
3954 LLViewerRegion *regionp = gWorldp->getRegion(ip, port); 3964 LLViewerRegion *regionp = LLWorld::getInstance()->getRegion(ip, port);
3955 if (regionp) 3965 if (regionp)
3956 { 3966 {
3957 regionp->setTimeDilation(time_dilation); 3967 regionp->setTimeDilation(time_dilation);
@@ -4051,7 +4061,7 @@ void process_alert_core(const std::string& message, BOOL modal)
4051 // HACK -- handle callbacks for specific alerts 4061 // HACK -- handle callbacks for specific alerts
4052 if ( message == "You died and have been teleported to your home location") 4062 if ( message == "You died and have been teleported to your home location")
4053 { 4063 {
4054 gViewerStats->incStat(LLViewerStats::ST_KILLED_COUNT); 4064 LLViewerStats::getInstance()->incStat(LLViewerStats::ST_KILLED_COUNT);
4055 } 4065 }
4056 else if( message == "Home position set." ) 4066 else if( message == "Home position set." )
4057 { 4067 {
@@ -4059,7 +4069,7 @@ void process_alert_core(const std::string& message, BOOL modal)
4059 LLString snap_filename = gDirUtilp->getLindenUserDir(); 4069 LLString snap_filename = gDirUtilp->getLindenUserDir();
4060 snap_filename += gDirUtilp->getDirDelimiter(); 4070 snap_filename += gDirUtilp->getDirDelimiter();
4061 snap_filename += SCREEN_HOME_FILENAME; 4071 snap_filename += SCREEN_HOME_FILENAME;
4062 gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidth(), gViewerWindow->getWindowHeight(), FALSE, FALSE); 4072 gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight(), FALSE, FALSE);
4063 } 4073 }
4064 4074
4065 const std::string ALERT_PREFIX("ALERT: "); 4075 const std::string ALERT_PREFIX("ALERT: ");
@@ -4239,9 +4249,9 @@ void process_frozen_message(LLMessageSystem *msgsystem, void **user_data)
4239// do some extra stuff once we get our economy data 4249// do some extra stuff once we get our economy data
4240void process_economy_data(LLMessageSystem *msg, void** /*user_data*/) 4250void process_economy_data(LLMessageSystem *msg, void** /*user_data*/)
4241{ 4251{
4242 LLGlobalEconomy::processEconomyData(msg, (void**)gGlobalEconomy); 4252 LLGlobalEconomy::processEconomyData(msg, LLGlobalEconomy::Singleton::getInstance());
4243 4253
4244 S32 upload_cost = gGlobalEconomy->getPriceUpload(); 4254 S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
4245 LLFloaterImagePreview::setUploadAmount(upload_cost); 4255 LLFloaterImagePreview::setUploadAmount(upload_cost);
4246 4256
4247 gMenuHolder->childSetLabelArg("Upload Image", "[COST]", llformat("%d", upload_cost)); 4257 gMenuHolder->childSetLabelArg("Upload Image", "[COST]", llformat("%d", upload_cost));
@@ -4415,7 +4425,7 @@ void script_question_cb(S32 option, void* user_data)
4415 4425
4416 if ( option == 2 ) // mute 4426 if ( option == 2 ) // mute
4417 { 4427 {
4418 gMuteListp->add(LLMute(cbdata->mItemID, cbdata->mObjectName, LLMute::OBJECT)); 4428 LLMuteList::getInstance()->add(LLMute(cbdata->mItemID, cbdata->mObjectName, LLMute::OBJECT));
4419 4429
4420 // purge the message queue of any previously queued requests from the same source. DEV-4879 4430 // purge the message queue of any previously queued requests from the same source. DEV-4879
4421 class OfferMatcher : public LLNotifyBoxView::Matcher 4431 class OfferMatcher : public LLNotifyBoxView::Matcher
@@ -4455,7 +4465,7 @@ void process_script_question(LLMessageSystem *msg, void **user_data)
4455 msg->getS32Fast(_PREHASH_Data, _PREHASH_Questions, questions ); 4465 msg->getS32Fast(_PREHASH_Data, _PREHASH_Questions, questions );
4456 4466
4457 // don't display permission requests if this object is muted - JS. 4467 // don't display permission requests if this object is muted - JS.
4458 if (gMuteListp->isMuted(taskid)) return; 4468 if (LLMuteList::getInstance()->isMuted(taskid)) return;
4459 4469
4460 // throttle excessive requests from any specific user's scripts 4470 // throttle excessive requests from any specific user's scripts
4461 LLString throttle_owner_name = owner_name; 4471 LLString throttle_owner_name = owner_name;
@@ -5085,7 +5095,7 @@ void callback_load_url_name(const LLUUID& id, const char* first, const char* las
5085 } 5095 }
5086 5096
5087 // For legacy name-only mutes. 5097 // For legacy name-only mutes.
5088 if (gMuteListp->isMuted(LLUUID::null, owner_name)) 5098 if (LLMuteList::getInstance()->isMuted(LLUUID::null, owner_name))
5089 { 5099 {
5090 delete infop; 5100 delete infop;
5091 infop = NULL; 5101 infop = NULL;
@@ -5119,10 +5129,8 @@ void process_load_url(LLMessageSystem* msg, void**)
5119 // URL is safety checked in load_url above 5129 // URL is safety checked in load_url above
5120 5130
5121 // Check if object or owner is muted 5131 // Check if object or owner is muted
5122 if (gMuteListp && 5132 if (LLMuteList::getInstance()->isMuted(infop->mObjectID, infop->mObjectName) ||
5123 (gMuteListp->isMuted(infop->mObjectID, infop->mObjectName) || 5133 LLMuteList::getInstance()->isMuted(infop->mOwnerID))
5124 gMuteListp->isMuted(infop->mOwnerID))
5125 )
5126 { 5134 {
5127 llinfos<<"Ignoring load_url from muted object/owner."<<llendl; 5135 llinfos<<"Ignoring load_url from muted object/owner."<<llendl;
5128 delete infop; 5136 delete infop;
@@ -5184,8 +5192,11 @@ void process_script_teleport_request(LLMessageSystem* msg, void**)
5184 msg->getVector3("Data", "SimPosition", pos); 5192 msg->getVector3("Data", "SimPosition", pos);
5185 msg->getVector3("Data", "LookAt", look_at); 5193 msg->getVector3("Data", "LookAt", look_at);
5186 5194
5187 gFloaterWorldMap->trackURL(sim_name, (U32)pos.mV[VX], (U32)pos.mV[VY], (U32)pos.mV[VZ]); 5195 // gFloaterWorldMap->trackURL(sim_name, (S32)pos.mV[VX], (S32)pos.mV[VY], (S32)pos.mV[VZ]);
5188 LLFloaterWorldMap::show(NULL, TRUE); 5196 // LLFloaterWorldMap::show(NULL, TRUE);
5197
5198 LLURLDispatcher::dispatch(LLURLDispatcher::buildSLURL(sim_name, (S32)pos.mV[VX], (S32)pos.mV[VY], (S32)pos.mV[VZ]), FALSE);
5199
5189} 5200}
5190 5201
5191void process_covenant_reply(LLMessageSystem* msg, void**) 5202void process_covenant_reply(LLMessageSystem* msg, void**)
@@ -5323,10 +5334,7 @@ void onCovenantLoadComplete(LLVFS *vfs,
5323 } 5334 }
5324 else 5335 else
5325 { 5336 {
5326 if( gViewerStats ) 5337 LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED );
5327 {
5328 gViewerStats->incStat( LLViewerStats::ST_DOWNLOAD_FAILED );
5329 }
5330 5338
5331 if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || 5339 if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
5332 LL_ERR_FILE_EMPTY == status) 5340 LL_ERR_FILE_EMPTY == status)