From be6ad2a919ffecb1ea69912b5e17d6d7c99d37d1 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Fri, 13 Mar 2015 22:16:07 -0400 Subject: [PATCH] Add Mouselook IFF from Alchemy! Also Assorted Code Cleanup and sync with Alchemy Debug Settings are AlchemyMouselookIFF and AlchemyMouselookIFFRange Look to see if an avatar is in a nearby region always when checking if they're an estate owner. --- .../newview/app_settings/settings_ascent.xml | 22 +++++ indra/newview/llfloateravatarlist.cpp | 47 ++------- indra/newview/llfloaterland.cpp | 3 +- indra/newview/llimview.cpp | 8 +- indra/newview/llinventorybridge.cpp | 58 ++++++----- indra/newview/llnetmap.cpp | 49 ++-------- indra/newview/llpanellogin.cpp | 18 ++-- indra/newview/llspeakers.cpp | 9 +- indra/newview/lltoolgun.cpp | 83 ++++++++++++---- indra/newview/lltoolgun.h | 3 + indra/newview/llvoavatar.cpp | 66 +++++++------ indra/newview/llworld.cpp | 96 ++++++++++++++----- indra/newview/llworld.h | 7 +- .../skins/default/xui/en-us/notifications.xml | 12 +++ 14 files changed, 282 insertions(+), 199 deletions(-) diff --git a/indra/newview/app_settings/settings_ascent.xml b/indra/newview/app_settings/settings_ascent.xml index 41207d047..457aeb477 100644 --- a/indra/newview/app_settings/settings_ascent.xml +++ b/indra/newview/app_settings/settings_ascent.xml @@ -135,6 +135,28 @@ Value 0 + AlchemyMouselookIFF + + Comment + Display user that is currently focused upon by crosshair in mouselook + Persist + 1 + Type + Boolean + Value + 1 + + AlchemyMouselookIFFRange + + Comment + Range of IFF display + Persist + 1 + Type + F32 + Value + 380.0 + AlchemyRainbowEffects Comment diff --git a/indra/newview/llfloateravatarlist.cpp b/indra/newview/llfloateravatarlist.cpp index 51f7728a7..5085aac4d 100644 --- a/indra/newview/llfloateravatarlist.cpp +++ b/indra/newview/llfloateravatarlist.cpp @@ -530,25 +530,22 @@ void LLFloaterAvatarList::updateAvatarList() } { - std::vector avatar_ids; - std::vector sorted_avatar_ids; - std::vector positions; - + LLWorld::pos_map_t avs; LLVector3d mypos = gAgent.getPositionGlobal(); static const LLCachedControl radar_range_radius("RadarRangeRadius", 0); - LLWorld::instance().getAvatars(&avatar_ids, &positions, mypos, radar_range_radius ? radar_range_radius : F32_MAX); + LLWorld::instance().getAvatars(&avs, mypos, radar_range_radius ? radar_range_radius : F32_MAX); static LLCachedControl announce(gSavedSettings, "RadarChatKeys"); std::queue announce_keys; - for (size_t i = 0, count = avatar_ids.size(); i < count; ++i) + for (LLWorld::pos_map_t::const_iterator i = avs.cbegin(), end = avs.cend(); i != end; ++i) { - const LLUUID& avid = avatar_ids[i]; + const LLUUID& avid = i->first; std::string name; static const LLCachedControl namesystem("RadarNameSystem"); if (!LLAvatarNameCache::getNSName(avid, name, namesystem)) continue; //prevent (Loading...) - LLVector3d position = positions[i]; + LLVector3d position = i->second; LLVOAvatar* avatarp = gObjectList.findAvatar(avid); if (avatarp) position = gAgent.getPosGlobalFromAgent(avatarp->getCharacterPosition()); @@ -653,7 +650,7 @@ void LLFloaterAvatarList::updateAvatarSorting() } } -bool mm_getMarkerColor(const LLUUID&, LLColor4&); +bool getCustomColor(const LLUUID& id, LLColor4& color, LLViewerRegion* parent_estate); /** * Redraws the avatar list @@ -740,37 +737,7 @@ void LLFloaterAvatarList::refreshAvatarList() } // custom colors for certain types of avatars! - //Changed a bit so people can modify them in settings. And since they're colors, again it's possibly account-based. Starting to think I need a function just to determine that. - HgB - //name.color = gColors.getColor( "MapAvatar" ); - LLUUID estate_owner = LLUUID::null; - if (LLViewerRegion* parent_estate = LLWorld::getInstance()->getRegionFromPosGlobal(entry->getPosition())) - if (parent_estate->isAlive()) - estate_owner = parent_estate->getOwner(); - - //Lindens are always more Linden than your friend, make that take precedence - if (mm_getMarkerColor(av_id, color)) {} - else if (LLMuteList::getInstance()->isLinden(av_id)) - { - static const LLCachedControl ascent_linden_color("AscentLindenColor", LLColor4(0.f,0.f,1.f,1.f)); - color = ascent_linden_color; - } - //check if they are an estate owner at their current position - else if (estate_owner.notNull() && av_id == estate_owner) - { - static const LLCachedControl ascent_estate_owner_color("AscentEstateOwnerColor", LLColor4(1.f,0.6f,1.f,1.f)); - color = ascent_estate_owner_color; - } - //without these dots, SL would suck. - else if (LLAvatarActions::isFriend(av_id)) - { - static const LLCachedControl ascent_friend_color("AscentFriendColor", LLColor4(1.f,1.f,0.f,1.f)); - color = ascent_friend_color; - } - //big fat jerkface who is probably a jerk, display them as such. - else if (LLMuteList::getInstance()->isMuted(av_id)) - { - color = ascent_muted_color; - } + getCustomColor(av_id, color, LLWorld::getInstance()->getRegionFromPosGlobal(entry->getPosition())); name.color = color*0.5f + unselected_color*0.5f; element.columns.add(name); } diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 57e4c0f20..b9db1820d 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -1574,8 +1574,7 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo LLVector3d mypos = gAgent.getPositionGlobal(); std::vector avatar_ids; - std::vector positions; - LLWorld::instance().getAvatars(&avatar_ids, &positions, mypos, F32_MAX); + LLWorld::instance().getAvatars(&avatar_ids, NULL, mypos, F32_MAX); for(S32 i = 0; i < rows; ++i) { diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 31b562e31..71f2221ec 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -53,6 +53,7 @@ #include "llmutelist.h" #include "llspeakers.h" #include "llvoavatar.h" // For mIdleTimer reset +#include "llviewerobjectlist.h" #include "llviewerregion.h" // [RLVa:KB] - Checked: 2013-05-10 (RLVa-1.4.9) @@ -97,9 +98,10 @@ LLColor4 agent_chat_color(const LLUUID& id, const std::string& name, bool local_ static const LLCachedControl color_eo_chat("ColorEstateOwnerChat"); if (color_eo_chat) { - const LLViewerRegion* parent_estate = gAgent.getRegion(); - if (parent_estate && id == parent_estate->getOwner()) - return gSavedSettings.getColor4("AscentEstateOwnerColor"); + const LLViewerObject* obj = gObjectList.findObject(id); // Nearby? + if (const LLViewerRegion* parent_estate = obj ? obj->getRegion() : gAgent.getRegion()) + if (id == parent_estate->getOwner()) + return gSavedSettings.getColor4("AscentEstateOwnerColor"); } return local_chat ? gSavedSettings.getColor4("AgentChatColor") : gSavedSettings.getColor("IMChatColor"); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index a5ababe30..2358bec4c 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1520,46 +1520,42 @@ void LLItemBridge::restoreItem() } } -void LLItemBridge::restoreToWorld() +void restore_to_world(LLViewerInventoryItem* itemp, bool no_copy, bool response = true) { - //Similar functionality to the drag and drop rez logic - bool remove_from_inventory = false; + if (!response) return; + LLMessageSystem* msg = gMessageSystem; + msg->newMessage("RezRestoreToWorld"); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgentID); + msg->addUUIDFast(_PREHASH_SessionID, gAgentSessionID); - LLViewerInventoryItem* itemp = static_cast(getItem()); - if (itemp) - { - LLMessageSystem* msg = gMessageSystem; - msg->newMessage("RezRestoreToWorld"); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_InventoryData); + itemp->packMessage(msg); + msg->sendReliable(gAgent.getRegion()->getHost()); - msg->nextBlockFast(_PREHASH_InventoryData); - itemp->packMessage(msg); - msg->sendReliable(gAgent.getRegion()->getHost()); - - //remove local inventory copy, sim will deal with permissions and removing the item - //from the actual inventory if its a no-copy etc - if(!itemp->getPermissions().allowCopyBy(gAgent.getID())) - { - remove_from_inventory = true; - } - - // Check if it's in the trash. (again similar to the normal rez logic) - const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - if(gInventory.isObjectDescendentOf(itemp->getUUID(), trash_id)) - { - remove_from_inventory = true; - } - } - - if(remove_from_inventory) + //remove local inventory copy, sim will deal with permissions and removing the item + //from the actual inventory if it's a no-copy etc + // Check if it's in the trash. (again similar to the normal rez logic) + if (no_copy || gInventory.isObjectDescendentOf(itemp->getUUID(), gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH))) { gInventory.deleteObject(itemp->getUUID()); gInventory.notifyObservers(); } } +void LLItemBridge::restoreToWorld() +{ + if (LLViewerInventoryItem* itemp = static_cast(getItem())) + { + //Similar functionality to the drag and drop rez logic + bool no_copy = !itemp->getPermissions().allowCopyBy(gAgentID); + if (no_copy && gHippoGridManager->getCurrentGrid()->isSecondLife()) + LLNotificationsUtil::add("RestoreToWorldConfirm", LLSD(), LLSD(), boost::bind(restore_to_world, itemp, true, !boost::bind(LLNotification::getSelectedOption, _1, _2))); + else + restore_to_world(itemp, no_copy); + } +} + void LLItemBridge::gotoItem() { LLInventoryObject *obj = getInventoryObject(); diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index adacb2a79..838417b4c 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -76,7 +76,6 @@ // #include "lfsimfeaturehandler.h" #include "llfloateravatarlist.h" -#include "llmutelist.h" #include "llvoavatar.h" // @@ -558,10 +557,9 @@ void LLNetMap::draw() // [RLVa:KB] - Version: 1.23.4 | Alternate: Snowglobe-1.2.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b bool show_friends = !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES); // [/RLVa:KB] - uuid_vec_t avatar_ids; - std::vector positions; + LLWorld::pos_map_t positions; - LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, gAgentCamera.getCameraPositionGlobal()); + LLWorld::getInstance()->getAvatars(&positions, gAgentCamera.getCameraPositionGlobal()); // Get the selected ids from radar now, as they are loop invariant uuid_vec_t gmSelected; @@ -570,57 +568,30 @@ void LLNetMap::draw() gmSelected = LLFloaterAvatarList::instance().getSelectedIDs(); // Draw avatars - for(U32 i=0; ifirst; static const LLCachedControl standard_color("MapAvatar",LLColor4(0.f,1.f,0.f,1.f)); LLColor4 color = standard_color; // TODO: it'd be very cool to draw these in sorted order from lowest Z to highest. // just be careful to sort the avatar IDs along with the positions. -MG - pos_map = globalPosToView(positions[i]); - if (positions[i].mdV[VZ] == 0.f || positions[i].mdV[VZ] == COARSEUPDATE_MAX_Z) + const LLVector3d& position = iter->second; + pos_map = globalPosToView(position); + if (position.mdV[VZ] == 0.f || position.mdV[VZ] == COARSEUPDATE_MAX_Z) { pos_map.mV[VZ] = 16000.f; } if (dist_vec(LLVector2(pos_map.mV[VX], pos_map.mV[VY]), LLVector2(local_mouse_x, local_mouse_y)) < min_pick_dist) { - mClosestAgentsToCursor[uuid] = positions[i]; + mClosestAgentsToCursor[uuid] = position; static const LLCachedControl map_avatar_rollover_color(gSavedSettings, "ExodusMapRolloverColor", LLColor4::cyan); color = map_avatar_rollover_color; } else { - - if(LLMuteList::getInstance()->isMuted(uuid)) - { - static const LLCachedControl muted_color("AscentMutedColor",LLColor4(0.7f,0.7f,0.7f,1.f)); - color = muted_color; - } - - LLViewerRegion* avatar_region = LLWorld::getInstance()->getRegionFromPosGlobal(positions[i]); - const LLUUID estate_owner = avatar_region ? avatar_region->getOwner() : LLUUID::null; - - // MOYMOD Minimap custom av colors. - if (mm_getMarkerColor(uuid, color)) {} - //Lindens are always more Linden than your friend, make that take precedence - else if (LLMuteList::getInstance()->isLinden(uuid)) - { - static const LLCachedControl linden_color("AscentLindenColor",LLColor4(0.f,0.f,1.f,1.f)); - color = linden_color; - } - //check if they are an estate owner at their current position - else if (estate_owner.notNull() && uuid == estate_owner) - { - static const LLCachedControl em_color("AscentEstateOwnerColor",LLColor4(1.f,0.6f,1.f,1.f)); - color = em_color; - } - //without these dots, SL would suck. - else if (show_friends && LLAvatarActions::isFriend(uuid)) - { - static const LLCachedControl friend_color("AscentFriendColor",LLColor4(1.f,1.f,0.f,1.f)); - color = friend_color; - } + bool getCustomColorRLV(const LLUUID&, LLColor4&, LLViewerRegion*, bool name_restricted); + getCustomColorRLV(uuid, color, LLWorld::getInstance()->getRegionFromPosGlobal(position), show_friends); } LLWorldMapView::drawAvatar( diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 572a35145..0756a4c1e 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -503,14 +503,14 @@ void LLPanelLogin::setFields(const std::string& firstname, // fill it with MAX_PASSWORD characters so we get a // nice row of asterixes. const std::string filler("123456789!123456"); - sInstance->childSetText("password_edit", filler); + sInstance->getChild("password_edit")->setValue(filler); sInstance->mIncomingPassword = filler; sInstance->mMungedPassword = password; } else { // this is a normal text password - sInstance->childSetText("password_edit", password); + sInstance->getChild("password_edit")->setValue(password); sInstance->mIncomingPassword = password; LLMD5 pass((unsigned char *)password.c_str()); char munged_password[MD5HEX_STR_SIZE]; @@ -533,7 +533,7 @@ void LLPanelLogin::setFields(const LLSavedLoginEntry& entry, bool takeFocus) LLComboBox* login_combo = sInstance->getChild("username_combo"); login_combo->setTextEntry(fullname); login_combo->resetTextDirty(); - //sInstance->childSetText("username_combo", fullname); + //sInstance->getChild("username_combo")->setValue(fullname); std::string grid = entry.getGrid(); //grid comes via LLSavedLoginEntry, which uses full grid names, not nicks @@ -544,13 +544,13 @@ void LLPanelLogin::setFields(const LLSavedLoginEntry& entry, bool takeFocus) if (entry.getPassword().empty()) { - sInstance->childSetText("password_edit", std::string("")); + sInstance->getChild("password_edit")->setValue(LLStringUtil::null); remember_pass_check->setValue(LLSD(false)); } else { const std::string filler("123456789!123456"); - sInstance->childSetText("password_edit", filler); + sInstance->getChild("password_edit")->setValue(filler); sInstance->mIncomingPassword = filler; sInstance->mMungedPassword = entry.getPassword(); remember_pass_check->setValue(LLSD(true)); @@ -902,10 +902,8 @@ void LLPanelLogin::refreshLoginPage() sInstance->updateGridCombo(); - sInstance->childSetVisible("create_new_account_text", - !gHippoGridManager->getCurrentGrid()->getRegisterUrl().empty()); - sInstance->childSetVisible("forgot_password_text", - !gHippoGridManager->getCurrentGrid()->getPasswordUrl().empty()); + sInstance->getChildView("create_new_account_text")->setVisible(!gHippoGridManager->getCurrentGrid()->getRegisterUrl().empty()); + sInstance->getChildView("forgot_password_text")->setVisible(!gHippoGridManager->getCurrentGrid()->getPasswordUrl().empty()); std::string login_page = gHippoGridManager->getCurrentGrid()->getLoginPage(); if (!login_page.empty()) @@ -996,7 +994,7 @@ void LLPanelLogin::onLoginComboLostFocus(LLComboBox* combo_box) { if (combo_box->isTextDirty()) { - childSetText("password_edit", mIncomingPassword = mMungedPassword = LLStringUtil::null); + getChild("password_edit")->setValue(mIncomingPassword = mMungedPassword = LLStringUtil::null); combo_box->resetTextDirty(); } } diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 58f801d73..c1b794500 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -42,6 +42,8 @@ #include "rlvhandler.h" +#include + extern AIHTTPTimeoutPolicy moderationResponder_timeout; const LLColor4 INACTIVE_COLOR(0.3f, 0.3f, 0.3f, 0.5f); @@ -1041,11 +1043,10 @@ void LLLocalSpeakerMgr::updateSpeakerList() // pick up non-voice speakers in chat range uuid_vec_t avatar_ids; - std::vector positions; - LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, gAgent.getPositionGlobal(), CHAT_NORMAL_RADIUS); - for(U32 i=0; igetAvatars(&avatar_ids, NULL, gAgent.getPositionGlobal(), CHAT_NORMAL_RADIUS); + BOOST_FOREACH(const LLUUID& id, avatar_ids) { - setSpeaker(avatar_ids[i]); + setSpeaker(id); } // check if text only speakers have moved out of chat range diff --git a/indra/newview/lltoolgun.cpp b/indra/newview/lltoolgun.cpp index 07629eefc..d4c5faba0 100644 --- a/indra/newview/lltoolgun.cpp +++ b/indra/newview/lltoolgun.cpp @@ -48,14 +48,19 @@ #include "llhudmanager.h" #include "lltoolmgr.h" #include "lltoolgrab.h" - +#include "lluiimage.h" // Linden library includes #include "llwindow.h" // setMouseClipping() +bool getCustomColor(const LLUUID& id, LLColor4& color, LLViewerRegion* parent_estate); +#include "llavatarnamecache.h" +#include "llworld.h" + LLToolGun::LLToolGun( LLToolComposite* composite ) : LLTool( std::string("gun"), composite ), mIsSelected(FALSE) { + mCrosshairp = LLUI::getUIImage("UIImgCrosshairsUUID"); // - UI Caching } void LLToolGun::handleSelect() @@ -95,8 +100,8 @@ BOOL LLToolGun::handleHover(S32 x, S32 y, MASK mask) { const F32 NOMINAL_MOUSE_SENSITIVITY = 0.0025f; - F32 mouse_sensitivity = gSavedSettings.getF32("MouseSensitivity"); - mouse_sensitivity = clamp_rescale(mouse_sensitivity, 0.f, 15.f, 0.5f, 2.75f) * NOMINAL_MOUSE_SENSITIVITY; + static LLCachedControl mouse_sensitivity_setting(gSavedSettings, "MouseSensitivity"); + F32 mouse_sensitivity = clamp_rescale(mouse_sensitivity_setting, 0.f, 15.f, 0.5f, 2.75f) * NOMINAL_MOUSE_SENSITIVITY; // ...move the view with the mouse @@ -107,18 +112,21 @@ BOOL LLToolGun::handleHover(S32 x, S32 y, MASK mask) if (dx != 0 || dy != 0) { // ...actually moved off center - if (gSavedSettings.getBOOL("InvertMouse")) + const F32 fov = LLViewerCamera::getInstance()->getView() / DEFAULT_FIELD_OF_VIEW; + static LLCachedControl invert_mouse(gSavedSettings, "InvertMouse"); + if (invert_mouse) { - gAgent.pitch(mouse_sensitivity * -dy); + gAgent.pitch(mouse_sensitivity * fov * -dy); } else { - gAgent.pitch(mouse_sensitivity * dy); + gAgent.pitch(mouse_sensitivity * fov * dy); } LLVector3 skyward = gAgent.getReferenceUpVector(); - gAgent.rotate(mouse_sensitivity * dx, skyward.mV[VX], skyward.mV[VY], skyward.mV[VZ]); + gAgent.rotate(mouse_sensitivity * fov * dx, skyward.mV[VX], skyward.mV[VY], skyward.mV[VZ]); - if (gSavedSettings.getBOOL("MouseSun")) + static LLCachedControl mouse_sun(gSavedSettings, "MouseSun"); + if (mouse_sun) { gSky.setSunDirection(LLViewerCamera::getInstance()->getAtAxis(), LLVector3(0.f, 0.f, 0.f)); gSky.setOverrideSun(TRUE); @@ -129,11 +137,11 @@ BOOL LLToolGun::handleHover(S32 x, S32 y, MASK mask) gViewerWindow->hideCursor(); } - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGun (mouselook)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolGun (mouselook)" << LL_ENDL; } else { - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGun (not mouselook)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolGun (not mouselook)" << LL_ENDL; } // HACK to avoid assert: error checking system makes sure that the cursor is set during every handleHover. This is actually a no-op since the cursor is hidden. @@ -144,14 +152,55 @@ BOOL LLToolGun::handleHover(S32 x, S32 y, MASK mask) void LLToolGun::draw() { - static const LLCachedControl show("ShowCrosshairs"); - if (show) + static LLCachedControl show_crosshairs(gSavedSettings, "ShowCrosshairs"); + static LLCachedControl show_iff(gSavedSettings, "AlchemyMouselookIFF", true); + static LLCachedControl iff_range(gSavedSettings, "AlchemyMouselookIFFRange", 380.f); + if (show_crosshairs) { - LLUIImagePtr crosshair = LLUI::getUIImage("UIImgCrosshairsUUID"); + const S32 windowWidth = gViewerWindow->getWorldViewRectScaled().getWidth(); + const S32 windowHeight = gViewerWindow->getWorldViewRectScaled().getHeight(); static const LLCachedControl color("LiruCrosshairColor"); - crosshair->draw( - ( gViewerWindow->getWorldViewRectScaled().getWidth() - crosshair->getWidth() ) / 2, - ( gViewerWindow->getWorldViewRectScaled().getHeight() - crosshair->getHeight() ) / 2, - color); + LLColor4 targetColor = color; + targetColor.mV[VALPHA] = 0.5f; + if (show_iff) + { + LLVector3d myPosition = gAgentCamera.getCameraPositionGlobal(); + LLQuaternion myRotation = LLViewerCamera::getInstance()->getQuaternion(); + myRotation.set(-myRotation.mQ[VX], -myRotation.mQ[VY], -myRotation.mQ[VZ], myRotation.mQ[VW]); + + LLWorld::pos_map_t positions; + LLWorld& world(LLWorld::instance()); + world.getAvatars(&positions, gAgent.getPositionGlobal(), iff_range); + for (LLWorld::pos_map_t::const_iterator iter = positions.cbegin(), iter_end = positions.cend(); iter != iter_end; ++iter) + { + const LLUUID& id = iter->first; + const LLVector3d& targetPosition = iter->second; + if (id == gAgentID || targetPosition.isNull()) + { + continue; + } + + LLVector3d magicVector = (targetPosition - myPosition) * myRotation; + magicVector.setVec(-magicVector.mdV[VY], magicVector.mdV[VZ], magicVector.mdV[VX]); + if (magicVector.mdV[VX] > -0.75 && magicVector.mdV[VX] < 0.75 && magicVector.mdV[VZ] > 0.0 && magicVector.mdV[VY] > -1.5 && magicVector.mdV[VY] < 1.5) // Do not fuck with these, cheater. :( + { + LLAvatarName avatarName; + LLAvatarNameCache::get(id, &avatarName); + getCustomColor(id, targetColor, world.getRegionFromPosGlobal(targetPosition)); + targetColor.mV[VALPHA] = 0.5f; + LLFontGL::getFontSansSerifBold()->renderUTF8( + llformat("%s : %.2fm", avatarName.getNSName().c_str(), (targetPosition - myPosition).magVec()), + 0, (windowWidth / 2.f), (windowHeight / 2.f) - 25.f, targetColor, + LLFontGL::HCENTER, LLFontGL::TOP, LLFontGL::BOLD, LLFontGL::NO_SHADOW + ); + + break; + } + } + } + + mCrosshairp->draw( + (windowWidth - mCrosshairp->getWidth() ) / 2, + (windowHeight - mCrosshairp->getHeight() ) / 2, targetColor); } } diff --git a/indra/newview/lltoolgun.h b/indra/newview/lltoolgun.h index 4644e686b..e15a88f47 100644 --- a/indra/newview/lltoolgun.h +++ b/indra/newview/lltoolgun.h @@ -54,6 +54,9 @@ public: virtual BOOL clipMouseWhenDown() { return FALSE; } private: BOOL mIsSelected; + + // - UI Caching + LLUIImagePtr mCrosshairp; }; #endif diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 41c12b68c..c01938d70 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -909,48 +909,54 @@ const LLUUID SHClientTagMgr::getClientID(const LLVOAvatar* pAvatar) const } return tag.asUUID(); } +bool getColorFor(const LLUUID& id, LLViewerRegion* parent_estate, LLColor4& color, bool name_restricted = false) +{ + static const LLCachedControl ascent_linden_color("AscentLindenColor"); + static const LLCachedControl ascent_estate_owner_color("AscentEstateOwnerColor" ); + static const LLCachedControl ascent_friend_color("AscentFriendColor"); + static const LLCachedControl ascent_muted_color("AscentMutedColor"); + //Lindens are always more Linden than your friend, make that take precedence + if (LLMuteList::getInstance()->isLinden(id)) + color = ascent_linden_color; + //check if they are an estate owner at their current position + else if (parent_estate && parent_estate->isAlive() && id.notNull() && id == parent_estate->getOwner()) + color = ascent_estate_owner_color; + //without these dots, SL would suck. + else if (!name_restricted && LLAvatarTracker::instance().isBuddy(id)) + color = ascent_friend_color; + //big fat jerkface who is probably a jerk, display them as such. + else if (LLMuteList::getInstance()->isMuted(id)) + color = ascent_muted_color; + else + return false; + return true; +} bool mm_getMarkerColor(const LLUUID&, LLColor4&); +bool getCustomColor(const LLUUID& id, LLColor4& color, LLViewerRegion* parent_estate) +{ + return mm_getMarkerColor(id, color) || getColorFor(id, parent_estate, color); +} +bool getCustomColorRLV(const LLUUID& id, LLColor4& color, LLViewerRegion* parent_estate, bool name_restricted) +{ + return mm_getMarkerColor(id, color) || getColorFor(id, parent_estate, color, name_restricted); +} bool SHClientTagMgr::getClientColor(const LLVOAvatar* pAvatar, bool check_status, LLColor4& color) const { - if (mm_getMarkerColor(pAvatar->getID(), color)) return true; + const LLUUID& id(pAvatar->getID()); + if (mm_getMarkerColor(id, color)) return true; static const LLCachedControl ascent_use_status_colors("AscentUseStatusColors",true); static const LLCachedControl ascent_show_self_tag_color("AscentShowSelfTagColor"); static const LLCachedControl ascent_show_others_tag_color("AscentShowOthersTagColor"); - if(check_status && ascent_use_status_colors && !pAvatar->isSelf()) + if (check_status && ascent_use_status_colors && !pAvatar->isSelf()) { - LLViewerRegion* parent_estate = LLWorld::getInstance()->getRegionFromPosGlobal(pAvatar->getPositionGlobal()); - if(LLMuteList::getInstance()->isLinden(pAvatar->getFullname())) - { - static const LLCachedControl ascent_linden_color( "AscentLindenColor" ); - color = ascent_linden_color.get(); - return true; - } - else if(pAvatar->getID().notNull() && parent_estate && parent_estate->isAlive() && pAvatar->getID() == parent_estate->getOwner()) - { - static const LLCachedControl ascent_estate_owner_color( "AscentEstateOwnerColor" ); - color = ascent_estate_owner_color.get(); - return true; - } - else if(LLAvatarTracker::instance().isBuddy(pAvatar->getID())) - { - static const LLCachedControl ascent_friend_color( "AscentFriendColor" ); - color = ascent_friend_color.get(); - return true; - } - else if(LLMuteList::getInstance()->isMuted(pAvatar->getID())) - { - static const LLCachedControl ascent_muted_color( "AscentMutedColor" ); - color = ascent_muted_color.get(); - return true; - } + getColorFor(id, pAvatar->getRegion(), color); } std::map::const_iterator it; LLSD tag; if( - ((pAvatar->isSelf() && ascent_show_self_tag_color) || - (!pAvatar->isSelf() && ascent_show_others_tag_color)) && - (it = mAvatarTags.find(pAvatar->getID()))!=mAvatarTags.end() && + (pAvatar->isSelf() ? ascent_show_self_tag_color : ascent_show_others_tag_color) && + (it = mAvatarTags.find(id))!=mAvatarTags.end() && (tag = it->second.get("color")).isDefined()) { color.setValue(tag); diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index d83f6013c..7a6924188 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -142,6 +142,7 @@ void LLWorld::destroyClass() LLViewerRegion* region_to_delete = *region_it++; removeRegion(region_to_delete->getHost()); } + if(LLVOCache::hasInstance()) { LLVOCache::getInstance()->destroyClass() ; @@ -181,7 +182,8 @@ LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host) if (host != old_host) { llwarns << "LLWorld::addRegion exists, but old host " << old_host - << " does not match new host " << host << llendl; + << " does not match new host " << host + << ", removing old region and creating new" << LL_ENDL; } if (!regionp->isAlive()) { @@ -207,7 +209,7 @@ LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host) S32 y = (S32)(jindex/256); //MegaRegion // Aurora Sim llinfos << "Adding new region (" << x << ":" << y << ")" - << " on host: " << host << llendl; + << " on host: " << host << LL_ENDL; LLVector3d origin_global; @@ -321,12 +323,12 @@ void LLWorld::removeRegion(const LLHost &host) llwarns << "RegionDump: " << reg->getName() << " " << reg->getHost() << " " << reg->getOriginGlobal() - << llendl; + << LL_ENDL; } llwarns << "Agent position global " << gAgent.getPositionGlobal() << " agent " << gAgent.getPositionAgent() - << llendl; + << LL_ENDL; llwarns << "Regions visited " << gAgent.getRegionsVisited() << llendl; @@ -349,13 +351,13 @@ void LLWorld::removeRegion(const LLHost &host) mRegionRemovedSignal(regionp); + updateWaterObjects(); + //double check all objects of this region are removed. gObjectList.clearAllMapObjectsInRegion(regionp) ; //llassert_always(!gObjectList.hasMapObjectInRegion(regionp)) ; - updateWaterObjects(); - - delete regionp; + delete regionp; // - Use after free fix? } @@ -698,7 +700,8 @@ void LLWorld::updateVisibilities() if (part) { LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0); - if (LLViewerCamera::getInstance()->AABBInFrustum(group->mBounds[0], group->mBounds[1])) + const LLVector4a* bounds = group->mBounds; + if (LLViewerCamera::getInstance()->AABBInFrustum(bounds[0], bounds[1])) { mCulledRegionList.erase(curiter); mVisibleRegionList.push_back(regionp); @@ -721,13 +724,11 @@ void LLWorld::updateVisibilities() if (part) { LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0); - if (LLViewerCamera::getInstance()->AABBInFrustum(group->mBounds[0], group->mBounds[1])) + const LLVector4a* bounds = group->mBounds; + if (LLViewerCamera::getInstance()->AABBInFrustum(bounds[0], bounds[1])) { regionp->calculateCameraDistance(); - if (!gNoRender) - { - regionp->getLand().updatePatchVisibilities(gAgent); - } + regionp->getLand().updatePatchVisibilities(gAgent); } else { @@ -910,7 +911,7 @@ void LLWorld::printPacketsLost() LLVector3d range = regionp->getCenterGlobal() - gAgent.getPositionGlobal(); llinfos << regionp->getHost() << ", range: " << range.length() - << " packets lost: " << cdp->getPacketsLost() << llendl; + << " packets lost: " << cdp->getPacketsLost() << LL_ENDL; } } } @@ -1358,8 +1359,9 @@ void process_enable_simulator(LLMessageSystem *msg, void **user_data) if (!gAgent.getRegion()) return; - static const LLCachedControl connectToNeighbors(gSavedSettings, "AlchemyConnectToNeighbors"); - if (!connectToNeighbors && ((gAgent.getTeleportState() == LLAgent::TELEPORT_LOCAL) || (gAgent.getTeleportState() == LLAgent::TELEPORT_NONE))) + static LLCachedControl connectToNeighbors(gSavedSettings, "AlchemyConnectToNeighbors"); + if ((!connectToNeighbors) && ((gAgent.getTeleportState() == LLAgent::TELEPORT_LOCAL) + || (gAgent.getTeleportState() == LLAgent::TELEPORT_NONE))) return; // enable the appropriate circuit for this simulator and @@ -1428,7 +1430,7 @@ public: if (!regionp) { llwarns << "Got EstablishAgentCommunication for unknown region " - << sim << llendl; + << sim << LL_ENDL; return; } regionp->setSeedCapability(input["body"]["seed-capability"]); @@ -1441,7 +1443,7 @@ void process_disable_simulator(LLMessageSystem *mesgsys, void **user_data) { LLHost host = mesgsys->getSender(); - //llinfos << "Disabling simulator with message from " << host << llendl; + //LL_INFOS() << "Disabling simulator with message from " << host << LL_ENDL; LLWorld::getInstance()->removeRegion(host); mesgsys->disableCircuit(host); @@ -1455,7 +1457,7 @@ void process_region_handshake(LLMessageSystem* msg, void** user_data) if (!regionp) { llwarns << "Got region handshake for unknown region " - << host << llendl; + << host << LL_ENDL; return; } @@ -1539,7 +1541,7 @@ static LLVector3d unpackLocalToGlobalPosition(U32 compact_local, const LLVector3 return region_origin + pos_local; } -void LLWorld::getAvatars(std::vector* avatar_ids, std::vector* positions, const LLVector3d& relative_to, F32 radius) const +void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector* positions, const LLVector3d& relative_to, F32 radius) const { F32 radius_squared = radius * radius; @@ -1578,8 +1580,8 @@ void LLWorld::getAvatars(std::vector* avatar_ids, std::vectorgetRegionList().begin(); - iter != LLWorld::getInstance()->getRegionList().end(); ++iter) + for (LLWorld::region_list_t::const_iterator iter = getRegionList().begin(); + iter != getRegionList().end(); ++iter) { LLViewerRegion* regionp = *iter; const LLVector3d& origin_global = regionp->getOriginGlobal(); @@ -1604,6 +1606,56 @@ void LLWorld::getAvatars(std::vector* avatar_ids, std::vectorempty()) + { + umap->clear(); + } + // get the list of avatars from the character list first, so distances are correct + // when agent is above 1020m and other avatars are nearby + for (std::vector::iterator iter = LLCharacter::sInstances.begin(); + iter != LLCharacter::sInstances.end(); ++iter) + { + LLVOAvatar* pVOAvatar = (LLVOAvatar*) *iter; + + if (!pVOAvatar->isDead() && !pVOAvatar->isSelf() && !pVOAvatar->mIsDummy) + { + LLVector3d pos_global = pVOAvatar->getPositionGlobal(); + LLUUID uuid = pVOAvatar->getID(); + + if (!uuid.isNull() + && dist_vec_squared(pos_global, relative_to) <= radius_squared) + { + umap->emplace(uuid, pos_global); + } + } + } + // region avatars added for situations where radius is greater than RenderFarClip + for (LLWorld::region_list_t::const_iterator iter = getRegionList().begin(); + iter != getRegionList().end(); ++iter) + { + LLViewerRegion* regionp = *iter; + const LLVector3d& origin_global = regionp->getOriginGlobal(); + S32 count = regionp->mMapAvatars.count(); + for (S32 i = 0; i < count; i++) + { + LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.get(i), origin_global); + if(dist_vec_squared(pos_global, relative_to) <= radius_squared) + { + LLUUID uuid = regionp->mMapAvatarIDs.get(i); + // if this avatar doesn't already exist in the list, add it + if(uuid.notNull()) + { + umap->emplace(uuid, pos_global); + } + } + } + } +} + bool LLWorld::isRegionListed(const LLViewerRegion* region) const { region_list_t::const_iterator it = find(mRegionList.begin(), mRegionList.end(), region); diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h index b363d0d67..fa65c364a 100644 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -167,10 +167,15 @@ public: // All arguments are optional. Given containers will be emptied and then filled. // Not supplying origin or radius input returns data on all avatars in the known regions. void getAvatars( - std::vector* avatar_ids = NULL, + uuid_vec_t* avatar_ids = NULL, std::vector* positions = NULL, const LLVector3d& relative_to = LLVector3d(), F32 radius = FLT_MAX) const; + typedef boost::unordered_map pos_map_t; + void getAvatars(pos_map_t* map, + const LLVector3d& relative_to = LLVector3d(), + F32 radius = FLT_MAX) const; + // Returns 'true' if the region is in mRegionList, // 'false' if the region has been removed due to region change // or if the circuit to this simulator had been lost. diff --git a/indra/newview/skins/default/xui/en-us/notifications.xml b/indra/newview/skins/default/xui/en-us/notifications.xml index 1af8cfc62..ba152b6c8 100644 --- a/indra/newview/skins/default/xui/en-us/notifications.xml +++ b/indra/newview/skins/default/xui/en-us/notifications.xml @@ -10418,6 +10418,18 @@ Would you like to enable announcing keys to objects in the sim? canceltext="No, don't ask again!"/> + +The object you're attempting to restore in world is no copy, if you do not have rez rights at <0, 0, 0>, you will lose this object!! + + +