From 8f7e96e2a5ed65fa4bab0cf710b5c20dafe67579 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Sat, 8 Feb 2014 18:26:18 -0500 Subject: [PATCH] Minimap enhancements!! Much of this patch comes from upstream and Kitty Barnett, or is inspired from their works This commit applies the World-Minimap patches from Catznip. Catznip stuffs: - Issue 1383: Parcel lines on mini map - Show parcels on the minimap - Minimap menu: "Show" submenu: "Property Lines" "Parcels for Sale" - Option to have world map textures on the minimap - Minimap menu: "World Map Textures" - Singular touch: Made this comply with hypergridding. The minimap will now scroll zoom based on where your mouse is if centering on camera is off. A lot of cruft was cleaned up in this merge, a lot of gSavedSettings lookups in draw were converted to LLCachedControls, some license updates were performed. Finally: By myself, but inspired by upstream and requested in the group before: - Option to show tracking circles around people selected on the radar while the radar is visible - Minimap menu: "Show" submenu: "Radar Tracking Circles" --- indra/newview/app_settings/settings.xml | 66 ++ indra/newview/llfloateravatarlist.cpp | 5 + indra/newview/llfloateravatarlist.h | 2 + indra/newview/llnetmap.cpp | 882 ++++++++++++------ indra/newview/llnetmap.h | 119 ++- indra/newview/llviewerparcelmgr.cpp | 99 +- indra/newview/llviewerparcelmgr.h | 54 +- indra/newview/llviewerparceloverlay.cpp | 57 +- indra/newview/llviewerparceloverlay.h | 48 +- indra/newview/llviewerregion.cpp | 41 +- indra/newview/llviewerregion.h | 14 +- .../skins/default/xui/en-us/menu_mini_map.xml | 97 +- 12 files changed, 1016 insertions(+), 468 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 9a0fef84f..09d60fc0f 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6063,6 +6063,17 @@ This should be as low as possible, but too low may break functionality Value 0 + DoubleClickShowWorldMap + + Comment + Enable double-click to show world map from mini map + Persist + 1 + Type + Boolean + Value + 1 + DragAndDropToolTipDelay Comment @@ -10181,6 +10192,28 @@ This should be as low as possible, but too low may break functionality Value 1 + MiniMapCollisionParcels + + Comment + Show collision parcels on the mini-map as they become available + Persist + 1 + Type + Boolean + Value + 0 + + MiniMapForSaleParcels + + Comment + Show for-sale parcels with a yellow highlight on the mini-map + Persist + 1 + Type + Boolean + Value + 0 + MiniMapPrimMaxAltitudeDelta Comment @@ -10214,6 +10247,28 @@ This should be as low as possible, but too low may break functionality Value 256.0 + MiniMapPropertyLines + + Comment + Show property boundaries on the mini-map + Persist + 1 + Type + Boolean + Value + 0 + + MiniMapRadarTrackingCircles + + Comment + Show tracking circles around the avatars you've selected on the radar in the minimap + Persist + 1 + Type + Boolean + Value + 0 + MiniMapCenter Comment @@ -10328,6 +10383,17 @@ This should be as low as possible, but too low may break functionality Value 128.0 + MiniMapWorldMapTextures + + Comment + Use the world map texture tile on the mini-map rather than the terrain texture + Persist + 1 + Type + Boolean + Value + 0 + MouseSensitivity Comment diff --git a/indra/newview/llfloateravatarlist.cpp b/indra/newview/llfloateravatarlist.cpp index 5f1a0f47c..dadab1ee1 100644 --- a/indra/newview/llfloateravatarlist.cpp +++ b/indra/newview/llfloateravatarlist.cpp @@ -1547,6 +1547,11 @@ LLUUID LLFloaterAvatarList::getSelectedID() return LLUUID::null; } +uuid_vec_t LLFloaterAvatarList::getSelectedIDs() +{ + return mAvatarList->getSelectedIDs(); +} + //static void LLFloaterAvatarList::callbackFreeze(const LLSD& notification, const LLSD& response) { diff --git a/indra/newview/llfloateravatarlist.h b/indra/newview/llfloateravatarlist.h index 33f02ce9b..57eb980dd 100644 --- a/indra/newview/llfloateravatarlist.h +++ b/indra/newview/llfloateravatarlist.h @@ -215,6 +215,7 @@ public: static void toggle(void*); static void showInstance(); + static bool instanceVisible() { return instanceExists() && instance().getVisible(); } // Decides which user-chosen columns to show and hide. void assessColumns(); @@ -241,6 +242,7 @@ public: std::string getSelectedNames(const std::string& separator = ", "); std::string getSelectedName(); LLUUID getSelectedID(); + uuid_vec_t getSelectedIDs(); static void lookAtAvatar(LLUUID &uuid); diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 162d036af..ce43bd8f8 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -1,7 +1,7 @@ /** * @file llnetmap.cpp * @author James Cook - * @brief Display of surrounding regions, objects, and agents. View contained by LLFloaterMap. + * @brief Display of surrounding regions, objects, and agents. * * $LicenseInfo:firstyear=2001&license=viewergpl$ * @@ -35,42 +35,49 @@ #include "llnetmap.h" -#include "llmath.h" // clampf() +#include "llmath.h" #include "llfocusmgr.h" #include "lllocalcliprect.h" +#include "llmenugl.h" #include "llrender.h" +#include "lltextbox.h" +#include "lluictrlfactory.h" -#include "lfsimfeaturehandler.h" -#include "llfloateravatarlist.h" +#include "llglheaders.h" +// Viewer includes #include "llagent.h" #include "llagentcamera.h" +#include "llappviewer.h" // for gDisconnected #include "llavataractions.h" #include "llavatarnamecache.h" #include "llcallingcard.h" #include "llcolorscheme.h" #include "llfloaterworldmap.h" #include "llframetimer.h" +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) +#include "llparcel.h" +// [/SL:KB] #include "lltracker.h" -#include "llmenugl.h" #include "llsurface.h" -#include "lltextbox.h" -#include "lluictrlfactory.h" #include "llviewercamera.h" #include "llviewertexturelist.h" #include "llviewermenu.h" #include "llviewerobjectlist.h" +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) +#include "llviewerparcelmgr.h" +#include "llviewerparceloverlay.h" +// [/SL:KB] #include "llviewerregion.h" #include "llviewerwindow.h" -#include "llvoavatar.h" #include "llworld.h" #include "llworldmapview.h" // shared draw code -#include "llappviewer.h" // Only for constants! - -#include "llglheaders.h" // +#include "lfsimfeaturehandler.h" +#include "llfloateravatarlist.h" #include "llmutelist.h" +#include "llvoavatar.h" // // [RLVa:KB] @@ -79,9 +86,10 @@ using namespace LLOldEvents; -const F32 MAP_SCALE_MIN = 32; -const F32 MAP_SCALE_MID = 256; -const F32 MAP_SCALE_MAX = 4096; +const F32 LLNetMap::MAP_SCALE_MIN = 32; +const F32 LLNetMap::MAP_SCALE_MID = 256; +const F32 LLNetMap::MAP_SCALE_MAX = 4096; + const F32 MAP_SCALE_INCREMENT = 16; const F32 MAP_SCALE_ZOOM_FACTOR = 1.1f; // Zoom in factor per click of the scroll wheel (10%) const F32 MAP_MINOR_DIR_THRESHOLD = 0.08f; @@ -90,26 +98,51 @@ const F32 DOT_SCALE = 0.75f; const F32 MIN_PICK_SCALE = 2.f; const S32 MOUSE_DRAG_SLOP = 2; // How far the mouse needs to move before we think it's a drag -const F32 WIDTH_PIXELS = 2.f; -const S32 CIRCLE_STEPS = 100; +const F32 WIDTH_PIXELS = 2.f; +const S32 CIRCLE_STEPS = 100; + +const F64 COARSEUPDATE_MAX_Z = 1020.0f; LLNetMap::LLNetMap(const std::string& name) : LLPanel(name), mScale(128.f), mObjectMapTPM(1.f), mObjectMapPixels(255.f), - mTargetPanX( 0.f ), - mTargetPanY( 0.f ), - mCurPanX( 0.f ), - mCurPanY( 0.f ), - mUpdateNow( FALSE ) + mTargetPan(0.f, 0.f), + mCurPan(0.f, 0.f), + mStartPan(0.f, 0.f), + mMouseDown(0, 0), + mPanning(false), +// mUpdateNow( false ), +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + mUpdateObjectImage(false), + mUpdateParcelImage(false), +// [/SL:KB] + mObjectImageCenterGlobal( gAgentCamera.getCameraPositionGlobal() ), + mObjectRawImagep(), + mObjectImagep(), +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + mParcelImageCenterGlobal( gAgentCamera.getCameraPositionGlobal() ), + mParcelRawImagep(), + mParcelImagep(), +// [/SL:KB] + mClosestAgentToCursor(), + mPopupMenu(NULL) { - mScale = gSavedSettings.getF32("MiniMapScale"); mPixelsPerMeter = mScale / REGION_WIDTH_METERS; mDotRadius = llmax(DOT_SCALE * mPixelsPerMeter, MIN_DOT_RADIUS); + setScale(gSavedSettings.getF32("MiniMapScale")); - mObjectImageCenterGlobal = gAgentCamera.getCameraPositionGlobal(); - + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_mini_map.xml"); +} + +LLNetMap::~LLNetMap() +{ + gSavedSettings.setF32("MiniMapScale", mScale); +} + +BOOL LLNetMap::postBuild() +{ // Register event listeners for popup menu (new LLScaleMap())->registerListener(this, "MiniMap.ZoomLevel"); (new LLCenterMap())->registerListener(this, "MiniMap.Center"); @@ -129,32 +162,26 @@ LLNetMap::LLNetMap(const std::string& name) : (new mmsetunmark())->registerListener(this, "MiniMap.setunmark"); (new mmenableunmark())->registerListener(this, "MiniMap.enableunmark"); (new LLToggleControl())->registerListener(this, "MiniMap.ToggleControl"); + (new OverlayToggle())->registerListener(this, "Minimap.ToggleOverlay"); - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_mini_map.xml"); +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + LLViewerParcelMgr::instance().setCollisionUpdateCallback(boost::bind(&LLNetMap::refreshParcelOverlay, this)); + LLViewerParcelOverlay::setUpdateCallback(boost::bind(&LLNetMap::refreshParcelOverlay, this)); +// [/SL:KB] updateMinorDirections(); - LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_mini_map.xml", this); - if (!menu) - { - menu = new LLMenuGL(LLStringUtil::null); - } - menu->setVisible(FALSE); - mPopupMenuHandle = menu->getHandle(); -} - -LLNetMap::~LLNetMap() -{ + mPopupMenu = LLUICtrlFactory::getInstance()->buildMenu("menu_mini_map.xml", this); + if (!mPopupMenu) mPopupMenu = new LLMenuGL(LLStringUtil::null); + mPopupMenu->setVisible(FALSE); + return TRUE; } void LLNetMap::setScale( F32 scale ) { + scale = llclamp(scale, MAP_SCALE_MIN, MAP_SCALE_MAX); + mCurPan *= scale / mScale; mScale = scale; - if (mScale == 0.f) - { - mScale = 0.1f; - } - gSavedSettings.setF32("MiniMapScale", mScale); if (mObjectImagep.notNull()) { @@ -174,20 +201,18 @@ void LLNetMap::setScale( F32 scale ) mPixelsPerMeter = mScale / REGION_WIDTH_METERS; mDotRadius = llmax(DOT_SCALE * mPixelsPerMeter, MIN_DOT_RADIUS); - mUpdateNow = TRUE; -} - -void LLNetMap::translatePan( F32 delta_x, F32 delta_y ) -{ - mTargetPanX += delta_x; - mTargetPanY += delta_y; +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + mUpdateObjectImage = true; + mUpdateParcelImage = true; +// [/SL:KB] +// mUpdateNow = true; } /////////////////////////////////////////////////////////////////////////////////// std::size_t hash_value(const LLUUID& uuid) { - return (std::size_t)uuid.getCRC32(); + return (std::size_t)uuid.getCRC32(); } boost::unordered_map mm_MarkerColors; @@ -198,7 +223,12 @@ void LLNetMap::mm_setcolor(LLUUID key,LLColor4 col) void LLNetMap::draw() { static LLFrameTimer map_timer; - + static LLUIColor map_track_color = gTrackColor; + static const LLCachedControl map_frustum_color(gColors, "NetMapFrustum", LLColor4::white); + static const LLCachedControl map_frustum_rotating_color(gColors, "NetMapFrustumRotating", LLColor4::white); +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-08-17 (Catznip-3.3.0) + static const LLCachedControl map_property_line("MiniMapPropertyLine", LLColor4::white); +// [/SL:KB] static const LLCachedControl map_whisper_ring_color("MiniMapWhisperRingColor", LLColor4(0.f,1.f,0.f,0.5f)); static const LLCachedControl map_chat_ring_color("MiniMapChatRingColor", LLColor4(0.f,0.f,1.f,0.5f)); static const LLCachedControl map_shout_ring_color("MiniMapShoutRingColor", LLColor4(1.f,0.f,0.f,0.5f)); @@ -208,15 +238,22 @@ void LLNetMap::draw() createObjectImage(); } - if (gSavedSettings.getS32( "MiniMapCenter") != MAP_CENTER_NONE) +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + if (mParcelImagep.isNull()) { - mCurPanX = lerp(mCurPanX, mTargetPanX, LLCriticalDamp::getInterpolant(0.1f)); - mCurPanY = lerp(mCurPanY, mTargetPanY, LLCriticalDamp::getInterpolant(0.1f)); + createParcelImage(); + } +// [/SL:KB] + + static LLUICachedControl center("MiniMapCenter"); + if (center != MAP_CENTER_NONE) + { + mCurPan = lerp(mCurPan, mTargetPan, LLCriticalDamp::getInterpolant(0.1f)); } + // Prepare a scissor region F32 rotation = 0; - gGL.pushMatrix(); gGL.pushUIMatrix(); @@ -229,13 +266,10 @@ void LLNetMap::draw() gGL.scalef(scale.mV[0], scale.mV[1], scale.mV[2]); gGL.translatef(offset.mV[0], offset.mV[1], offset.mV[2]); - // Prepare a scissor region { - LLGLEnable scissor(GL_SCISSOR_TEST); - + LLLocalClipRect clip(getLocalRect()); { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - LLLocalClipRect clip(getLocalRect()); gGL.matrixMode(LLRender::MM_MODELVIEW); @@ -249,13 +283,13 @@ void LLNetMap::draw() } // region 0,0 is in the middle - S32 center_sw_left = getRect().getWidth() / 2 + llfloor(mCurPanX); - S32 center_sw_bottom = getRect().getHeight() / 2 + llfloor(mCurPanY); + S32 center_sw_left = getRect().getWidth() / 2 + llfloor(mCurPan.mV[VX]); + S32 center_sw_bottom = getRect().getHeight() / 2 + llfloor(mCurPan.mV[VY]); gGL.pushMatrix(); gGL.translatef( (F32) center_sw_left, (F32) center_sw_bottom, 0.f); - + static LLCachedControl rotate_map("MiniMapRotate", true); if (rotate_map) { @@ -265,9 +299,9 @@ void LLNetMap::draw() } // figure out where agent is - LLColor4 this_region_color = gColors.getColor( "NetMapThisRegion" ); - LLColor4 live_region_color = gColors.getColor( "NetMapLiveRegion" ); - LLColor4 dead_region_color = gColors.getColor( "NetMapDeadRegion" ); + static const LLCachedControl this_region_color(gColors, "NetMapThisRegion"); + static const LLCachedControl live_region_color(gColors, "NetMapLiveRegion"); + static const LLCachedControl dead_region_color(gColors, "NetMapDeadRegion"); // Aurora Sim //S32 region_width = llround(LLWorld::getInstance()->getRegionWidthInMeters()); S32 region_width = REGION_WIDTH_UNITS; @@ -293,13 +327,51 @@ void LLNetMap::draw() F32 right = left + (regionp->getWidth() / REGION_WIDTH_METERS) * mScale ; // Aurora Sim - gGL.color4fv(regionp == gAgent.getRegion() ? this_region_color.mV : live_region_color.mV); - if (!regionp->isAlive()) + if (regionp == gAgent.getRegion()) { - gGL.color4fv(dead_region_color.mV); + gGL.color4fv(this_region_color().mV); + } + else + { + gGL.color4fv(live_region_color().mV); } + if (!regionp->isAlive()) + { + gGL.color4fv(dead_region_color().mV); + } +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-07-26 (Catznip-3.3) + static LLCachedControl s_fUseWorldMapTextures(gSavedSettings, "MiniMapWorldMapTextures"); + bool fRenderTerrain = true; + + if (s_fUseWorldMapTextures) + { + LLViewerTexture* pRegionImage = regionp->getWorldMapTile(); + if ( (pRegionImage) && (pRegionImage->hasGLTexture()) ) + { + gGL.getTexUnit(0)->bind(pRegionImage); + gGL.begin(LLRender::QUADS); + gGL.texCoord2f(0.f, 1.f); + gGL.vertex2f(left, top); + gGL.texCoord2f(0.f, 0.f); + gGL.vertex2f(left, bottom); + gGL.texCoord2f(1.f, 0.f); + gGL.vertex2f(right, bottom); + gGL.texCoord2f(1.f, 1.f); + gGL.vertex2f(right, top); + gGL.end(); + + pRegionImage->setBoostLevel(LLViewerTexture::BOOST_MAP_VISIBLE); + fRenderTerrain = false; + } + } +// [/SL:KB] + +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-07-26 (Catznip-3.3) + if (fRenderTerrain) + { +// [/SL:KB] // Draw using texture. gGL.getTexUnit(0)->bind(regionp->getLand().getSTexture()); gGL.begin(LLRender::QUADS); @@ -332,43 +404,92 @@ void LLNetMap::draw() } } gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-07-26 (Catznip-3.3) + } +// [/SL:KB] } // Redraw object layer periodically - if (mUpdateNow || (map_timer.getElapsedTimeF32() > 0.5f)) - { - mUpdateNow = false; +// if (mUpdateNow || (map_timer.getElapsedTimeF32() > 0.5f)) +// { +// mUpdateNow = false; +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + // Locate the center + LLVector3 posCenter = globalPosToView(gAgentCamera.getCameraPositionGlobal()); + posCenter.mV[VX] -= mCurPan.mV[VX]; + posCenter.mV[VY] -= mCurPan.mV[VY]; + posCenter.mV[VZ] = 0.f; + LLVector3d posCenterGlobal = viewPosToGlobal(llfloor(posCenter.mV[VX]), llfloor(posCenter.mV[VY])); - // Locate the centre of the object layer, accounting for panning - LLVector3 new_center = globalPosToView(gAgentCamera.getCameraPositionGlobal(), rotate_map); - new_center.mV[VX] -= mCurPanX; - new_center.mV[VY] -= mCurPanY; - new_center.mV[VZ] = 0.f; - mObjectImageCenterGlobal = viewPosToGlobal(llround(new_center.mV[VX]), llround(new_center.mV[VY]), rotate_map); + static LLCachedControl s_fShowObjects(gSavedSettings, "ShowMiniMapObjects") ; + if ( (s_fShowObjects) && ((mUpdateObjectImage) || ((map_timer.getElapsedTimeF32() > 0.5f))) ) + { + mUpdateObjectImage = false; +// [/SL:KB] + +// // Locate the centre of the object layer, accounting for panning +// LLVector3 new_center = globalPosToView(gAgentCamera.getCameraPositionGlobal()); +// new_center.mV[VX] -= mCurPan.mV[VX]; +// new_center.mV[VY] -= mCurPan.mV[VY]; +// new_center.mV[VZ] = 0.f; +// mObjectImageCenterGlobal = viewPosToGlobal(llfloor(new_center.mV[VX]), llfloor(new_center.mV[VY])); +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + mObjectImageCenterGlobal = posCenterGlobal; +// [/SL:KB] // Create the base texture. U8 *default_texture = mObjectRawImagep->getData(); memset( default_texture, 0, mObjectImagep->getWidth() * mObjectImagep->getHeight() * mObjectImagep->getComponents() ); - if (gSavedSettings.getBOOL("ShowMiniMapObjects")) - { - gObjectList.renderObjectsForMap(*this); // Draw buildings. - } + // Draw objects + gObjectList.renderObjectsForMap(*this); mObjectImagep->setSubImage(mObjectRawImagep, 0, 0, mObjectImagep->getWidth(), mObjectImagep->getHeight()); map_timer.reset(); } - LLVector3 map_center_agent = gAgent.getPosAgentFromGlobal(mObjectImageCenterGlobal); - map_center_agent -= gAgentCamera.getCameraPositionAgent(); - map_center_agent.mV[0] *= mScale/REGION_WIDTH_METERS; - map_center_agent.mV[1] *= mScale/REGION_WIDTH_METERS; +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + static LLCachedControl s_fShowPropertyLines(gSavedSettings, "MiniMapPropertyLines") ; + if ( (s_fShowPropertyLines) && ((mUpdateParcelImage) || (dist_vec_squared2D(mParcelImageCenterGlobal, posCenterGlobal) > 9.0f)) ) + { + mUpdateParcelImage = false; + mParcelImageCenterGlobal = posCenterGlobal; - gGL.getTexUnit(0)->bind(mObjectImagep); + U8* pTextureData = mParcelRawImagep->getData(); + memset(pTextureData, 0, mParcelImagep->getWidth() * mParcelImagep->getHeight() * mParcelImagep->getComponents()); + + // Process each region + for (LLWorld::region_list_t::const_iterator itRegion = LLWorld::getInstance()->getRegionList().begin(); + itRegion != LLWorld::getInstance()->getRegionList().end(); ++itRegion) + { + const LLViewerRegion* pRegion = *itRegion; LLColor4U clrOverlay; + if (pRegion->isAlive()) + clrOverlay = map_property_line.get(); + else + clrOverlay = LLColor4U(255, 128, 128, 255); + renderPropertyLinesForRegion(pRegion, clrOverlay); + } + + mParcelImagep->setSubImage(mParcelRawImagep, 0, 0, mParcelImagep->getWidth(), mParcelImagep->getHeight()); + } +// [/SL:KB] + + LLVector3 map_center_agent = gAgent.getPosAgentFromGlobal(mObjectImageCenterGlobal); + LLVector3 camera_position = gAgentCamera.getCameraPositionAgent(); + map_center_agent -= camera_position; + map_center_agent.mV[VX] *= mScale/region_width; + map_center_agent.mV[VY] *= mScale/region_width; + +// gGL.getTexUnit(0)->bind(mObjectImagep); F32 image_half_width = 0.5f*mObjectMapPixels; F32 image_half_height = 0.5f*mObjectMapPixels; +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-07-26 (Catznip-3.3) + if (s_fShowObjects) + { + gGL.getTexUnit(0)->bind(mObjectImagep); +// [/SL:KB] gGL.begin(LLRender::QUADS); gGL.texCoord2f(0.f, 1.f); gGL.vertex2f(map_center_agent.mV[VX] - image_half_width, image_half_height + map_center_agent.mV[VY]); @@ -379,134 +500,192 @@ void LLNetMap::draw() gGL.texCoord2f(1.f, 1.f); gGL.vertex2f(image_half_width + map_center_agent.mV[VX], image_half_height + map_center_agent.mV[VY]); gGL.end(); +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-07-26 (Catznip-3.3) + } +// [/SL:KB] + +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + if (s_fShowPropertyLines) + { + map_center_agent = gAgent.getPosAgentFromGlobal(mParcelImageCenterGlobal) - camera_position; + map_center_agent.mV[VX] *= mScale / region_width; + map_center_agent.mV[VY] *= mScale / region_width; + + gGL.getTexUnit(0)->bind(mParcelImagep); + gGL.begin(LLRender::QUADS); + gGL.texCoord2f(0.f, 1.f); + gGL.vertex2f(map_center_agent.mV[VX] - image_half_width, image_half_height + map_center_agent.mV[VY]); + gGL.texCoord2f(0.f, 0.f); + gGL.vertex2f(map_center_agent.mV[VX] - image_half_width, map_center_agent.mV[VY] - image_half_height); + gGL.texCoord2f(1.f, 0.f); + gGL.vertex2f(image_half_width + map_center_agent.mV[VX], map_center_agent.mV[VY] - image_half_height); + gGL.texCoord2f(1.f, 1.f); + gGL.vertex2f(image_half_width + map_center_agent.mV[VX], image_half_height + map_center_agent.mV[VY]); + gGL.end(); + } +// [/SL:KB] gGL.popMatrix(); - LLVector3d pos_global; - LLVector3 pos_map; - // Mouse pointer in local coordinates S32 local_mouse_x; S32 local_mouse_y; + //localMouse(&local_mouse_x, &local_mouse_y); LLUI::getMousePositionLocal(this, &local_mouse_x, &local_mouse_y); mClosestAgentToCursor.setNull(); - F32 closest_dist = F32_MAX; - F32 min_pick_dist = mDotRadius * MIN_PICK_SCALE; + F32 closest_dist_squared = F32_MAX; // value will be overridden in the loop + F32 min_pick_dist_squared = (mDotRadius * MIN_PICK_SCALE) * (mDotRadius * MIN_PICK_SCALE); - // Draw avatars -// LLColor4 mapcolor = gAvatarMapColor; - - static const LLCachedControl standard_color("MapAvatar",LLColor4(0.f,1.f,0.f,1.f)); - static const LLCachedControl friend_color_stored("AscentFriendColor",LLColor4(1.f,1.f,0.f,1.f)); - static const LLCachedControl em_color("AscentEstateOwnerColor",LLColor4(1.f,0.6f,1.f,1.f)); - static const LLCachedControl linden_color("AscentLindenColor",LLColor4(0.f,0.f,1.f,1.f)); - static const LLCachedControl muted_color("AscentMutedColor",LLColor4(0.7f,0.7f,0.7f,1.f)); - - // Draw avatars + LLVector3 pos_map; // [RLVa:KB] - Version: 1.23.4 | Alternate: Snowglobe-1.2.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b - LLColor4 friend_color = (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? friend_color_stored : standard_color; + bool show_friends = !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES); // [/RLVa:KB] - std::vector avatar_ids; + uuid_vec_t avatar_ids; std::vector positions; - LLWorld::getInstance()->getAvatars(&avatar_ids, &positions); + + LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, gAgentCamera.getCameraPositionGlobal()); + + // Get the selected ids from radar now, as they are loop invariant + uuid_vec_t gmSelected; + static const LLCachedControl radar_tracking_circle("MiniMapRadarTrackingCircles"); + if (radar_tracking_circle && LLFloaterAvatarList::instanceVisible()) + gmSelected = LLFloaterAvatarList::instance().getSelectedIDs(); + + // Draw avatars for(U32 i=0; i 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(pos, rotate_map); - if (pos.mdV[VZ] == 0.f) + pos_map = globalPosToView(positions[i]); + if (positions[i].mdV[VZ] == 0.f || positions[i].mdV[VZ] == COARSEUPDATE_MAX_Z) { pos_map.mV[VZ] = 16000.f; } - std::string avName; - - gCacheName->getFullName(id, avName); - if(LLMuteList::getInstance()->isMuted(id)) + if(LLMuteList::getInstance()->isMuted(uuid)) { - avColor = muted_color; + static const LLCachedControl muted_color("AscentMutedColor",LLColor4(0.7f,0.7f,0.7f,1.f)); + color = muted_color; } - LLViewerRegion* avatar_region = LLWorld::getInstance()->getRegionFromPosGlobal(pos); - LLUUID estate_owner = avatar_region? avatar_region->getOwner() : LLUUID::null; + LLViewerRegion* avatar_region = LLWorld::getInstance()->getRegionFromPosGlobal(positions[i]); + LLUUID estate_owner = avatar_region ? avatar_region->getOwner() : LLUUID::null; // MOYMOD Minimap custom av colors. - boost::unordered_map::const_iterator it = mm_MarkerColors.find(id); + boost::unordered_map::const_iterator it = mm_MarkerColors.find(uuid); if(it != mm_MarkerColors.end()) { - avColor = it->second; + color = it->second; } //Lindens are always more Linden than your friend, make that take precedence - else if(LLMuteList::getInstance()->isLinden(id)) + else if (LLMuteList::getInstance()->isLinden(uuid)) { - avColor = linden_color; + 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() && id == estate_owner) + else if (estate_owner.notNull() && uuid == estate_owner) { - avColor = em_color; + 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(LLAvatarActions::isFriend(id)) + else if (show_friends && LLAvatarActions::isFriend(uuid)) { - avColor = friend_color; + static const LLCachedControl friend_color("AscentFriendColor",LLColor4(1.f,1.f,0.f,1.f)); + color = friend_color; } LLWorldMapView::drawAvatar( - pos_map.mV[VX], pos_map.mV[VY], - avColor, - pos_map.mV[VZ], - mDotRadius); + pos_map.mV[VX], pos_map.mV[VY], + color, + pos_map.mV[VZ], mDotRadius); - F32 dist_to_cursor = dist_vec(LLVector2(pos_map.mV[VX], pos_map.mV[VY]), LLVector2(local_mouse_x,local_mouse_y)); - if(dist_to_cursor < min_pick_dist && dist_to_cursor < closest_dist) + F32 dist_to_cursor_squared = dist_vec_squared(LLVector2(pos_map.mV[VX], pos_map.mV[VY]), + LLVector2(local_mouse_x,local_mouse_y)); + if(dist_to_cursor_squared < min_pick_dist_squared) { - closest_dist = dist_to_cursor; - mClosestAgentToCursor = id; - mClosestAgentPosition = pos; + if (dist_to_cursor_squared < closest_dist_squared) + { + closest_dist_squared = dist_to_cursor_squared; + mClosestAgentToCursor = uuid; + mClosestAgentPosition = positions[i]; + } + } + + if (!gmSelected.empty()) + if (uuid.notNull()) + { + bool selected = false; + uuid_vec_t::iterator sel_iter = gmSelected.begin(); + for (; sel_iter != gmSelected.end(); sel_iter++) + { + if(*sel_iter == uuid) + { + selected = true; + break; + } + } + if (selected) + { + if( (pos_map.mV[VX] < 0) || + (pos_map.mV[VY] < 0) || + (pos_map.mV[VX] >= getRect().getWidth()) || + (pos_map.mV[VY] >= getRect().getHeight()) ) + { + S32 x = llround( pos_map.mV[VX] ); + S32 y = llround( pos_map.mV[VY] ); + LLWorldMapView::drawTrackingCircle( getRect(), x, y, color, 1, 10); + } else + { + LLWorldMapView::drawTrackingDot(pos_map.mV[VX],pos_map.mV[VY],color,0.f); + } + } } } // Draw dot for autopilot target if (gAgent.getAutoPilot()) { - drawTracking(gAgent.getAutoPilotTargetGlobal(), rotate_map, gTrackColor); + drawTracking( gAgent.getAutoPilotTargetGlobal(), map_track_color ); } else { LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus(); if ( LLTracker::TRACKING_AVATAR == tracking_status ) { - drawTracking(LLAvatarTracker::instance().getGlobalPos(), rotate_map, gTrackColor); + drawTracking( LLAvatarTracker::instance().getGlobalPos(), map_track_color ); } else if ( LLTracker::TRACKING_LANDMARK == tracking_status || LLTracker::TRACKING_LOCATION == tracking_status ) { - drawTracking(LLTracker::getTrackedPositionGlobal(), rotate_map, gTrackColor); + drawTracking( LLTracker::getTrackedPositionGlobal(), map_track_color ); } } // Draw dot for self avatar position - pos_global = gAgent.getPositionGlobal(); - pos_map = globalPosToView(pos_global, rotate_map); - LLUIImagePtr you = LLWorldMapView::sAvatarYouLargeImage; + LLVector3d pos_global = gAgent.getPositionGlobal(); + pos_map = globalPosToView(pos_global); S32 dot_width = llround(mDotRadius * 2.f); - you->draw( - llround(pos_map.mV[VX] - mDotRadius), - llround(pos_map.mV[VY] - mDotRadius), - dot_width, - dot_width); + LLUIImagePtr you = LLWorldMapView::sAvatarYouLargeImage; + if (you) + { + you->draw(llround(pos_map.mV[VX] - mDotRadius), + llround(pos_map.mV[VY] - mDotRadius), + dot_width, + dot_width); + } // Draw chat range ring(s) - static LLUICachedControl whisper_ring("MiniMapWhisperRing"); - static LLUICachedControl chat_ring("MiniMapChatRing"); - static LLUICachedControl shout_ring("MiniMapShoutRing"); + static LLCachedControl whisper_ring("MiniMapWhisperRing"); if(whisper_ring) drawRing(LFSimFeatureHandler::getInstance()->whisperRange(), pos_map, map_whisper_ring_color); + static LLCachedControl chat_ring("MiniMapChatRing"); if(chat_ring) drawRing(LFSimFeatureHandler::getInstance()->sayRange(), pos_map, map_chat_ring_color); + static LLCachedControl shout_ring("MiniMapShoutRing"); if(shout_ring) drawRing(LFSimFeatureHandler::getInstance()->shoutRange(), pos_map, map_shout_ring_color); @@ -531,7 +710,7 @@ void LLNetMap::draw() if (rotate_map) { - gGL.color4fv(gColors.getColor("NetMapFrustum").mV); + gGL.color4fv((map_frustum_color()).mV); gGL.begin( LLRender::TRIANGLES ); gGL.vertex2f( ctr_x, ctr_y ); @@ -541,7 +720,7 @@ void LLNetMap::draw() } else { - gGL.color4fv(gColors.getColor("NetMapFrustumRotating").mV); + gGL.color4fv((map_frustum_rotating_color()).mV); // If we don't rotate the map, we have to rotate the frustum. gGL.pushMatrix(); @@ -558,7 +737,7 @@ void LLNetMap::draw() gGL.popMatrix(); gGL.popUIMatrix(); - + // Rotation of 0 means that North is up setDirectionPos( getChild("e_label"), rotation); setDirectionPos( getChild("n_label"), rotation + F_PI_BY_TWO); @@ -570,19 +749,24 @@ void LLNetMap::draw() setDirectionPos( getChild("sw_label"), rotation + F_PI + F_PI_BY_TWO / 2); setDirectionPos( getChild("se_label"), rotation + F_PI + F_PI_BY_TWO + F_PI_BY_TWO / 2); - LLView::draw(); + LLUICtrl::draw(); } void LLNetMap::reshape(S32 width, S32 height, BOOL called_from_parent) { LLPanel::reshape(width, height, called_from_parent); createObjectImage(); +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-07-28 (Catznip-3.3) + createParcelImage(); +// [/SL:KB] updateMinorDirections(); } -LLVector3 LLNetMap::globalPosToView(const LLVector3d& global_pos, BOOL rotated) +LLVector3 LLNetMap::globalPosToView(const LLVector3d& global_pos) { - LLVector3d relative_pos_global = global_pos - gAgentCamera.getCameraPositionGlobal(); + LLVector3d camera_position = gAgentCamera.getCameraPositionGlobal(); + + LLVector3d relative_pos_global = global_pos - camera_position; LLVector3 pos_local; pos_local.setVec(relative_pos_global); // convert to floats from doubles @@ -593,39 +777,39 @@ LLVector3 LLNetMap::globalPosToView(const LLVector3d& global_pos, BOOL rotated) pos_local.mV[VY] *= mPixelsPerMeter; // leave Z component in meters - if( rotated ) + static LLUICachedControl rotate_map("MiniMapRotate", true); + if( rotate_map ) { F32 radians = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ); LLQuaternion rot(radians, LLVector3(0.f, 0.f, 1.f)); pos_local.rotVec( rot ); } - pos_local.mV[VX] += getRect().getWidth() / 2 + mCurPanX; - pos_local.mV[VY] += getRect().getHeight() / 2 + mCurPanY; + pos_local.mV[VX] += getRect().getWidth() / 2 + mCurPan.mV[VX]; + pos_local.mV[VY] += getRect().getHeight() / 2 + mCurPan.mV[VY]; return pos_local; } void LLNetMap::drawRing(const F32 radius, const LLVector3 pos_map, const LLColor4& color) - { // Aurora Sim - F32 meters_to_pixels = mScale / LLWorld::getInstance()->getRegionWidthInMeters(); - //F32 meters_to_pixels = mScale / REGION_WIDTH_METERS; + F32 meters_to_pixels = mScale / LLWorld::getInstance()->getRegionWidthInMeters(); + //F32 meters_to_pixels = mScale / REGION_WIDTH_METERS; // Aurora Sim - F32 radius_pixels = radius * meters_to_pixels; + F32 radius_pixels = radius * meters_to_pixels; - gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.pushMatrix(); - gGL.translatef((F32)pos_map.mV[VX], (F32)pos_map.mV[VY], 0.f); - gl_ring(radius_pixels, WIDTH_PIXELS, color, color, CIRCLE_STEPS, FALSE); - gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.pushMatrix(); + gGL.translatef((F32)pos_map.mV[VX], (F32)pos_map.mV[VY], 0.f); + gl_ring(radius_pixels, WIDTH_PIXELS, color, color, CIRCLE_STEPS, FALSE); + gGL.popMatrix(); } -void LLNetMap::drawTracking(const LLVector3d& pos_global, BOOL rotated, - const LLColor4& color, BOOL draw_arrow ) +void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color, + BOOL draw_arrow ) { - LLVector3 pos_local = globalPosToView( pos_global, rotated ); + LLVector3 pos_local = globalPosToView(pos_global); if( (pos_local.mV[VX] < 0) || (pos_local.mV[VY] < 0) || (pos_local.mV[VX] >= getRect().getWidth()) || @@ -648,16 +832,17 @@ void LLNetMap::drawTracking(const LLVector3d& pos_global, BOOL rotated, } } -LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y, BOOL rotated ) +LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y ) { - x -= llround(getRect().getWidth() / 2 + mCurPanX); - y -= llround(getRect().getHeight() / 2 + mCurPanY); + x -= llround(getRect().getWidth() / 2 + mCurPan.mV[VX]); + y -= llround(getRect().getHeight() / 2 + mCurPan.mV[VY]); - LLVector3 pos_local( (F32)x, (F32)y, 0.f ); + LLVector3 pos_local( (F32)x, (F32)y, 0 ); F32 radians = - atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ); - if( rotated ) + static LLUICachedControl rotate_map("MiniMapRotate", true); + if( rotate_map ) { LLQuaternion rot(radians, LLVector3(0.f, 0.f, 1.f)); pos_local.rotVec( rot ); @@ -678,24 +863,41 @@ LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y, BOOL rotated ) BOOL LLNetMap::handleScrollWheel(S32 x, S32 y, S32 clicks) { // note that clicks are reversed from what you'd think: i.e. > 0 means zoom out, < 0 means zoom in - F32 scale = mScale; - - scale *= pow(MAP_SCALE_ZOOM_FACTOR, -clicks); - setScale(llclamp(scale, MAP_SCALE_MIN, MAP_SCALE_MAX)); + F32 new_scale = mScale * pow(MAP_SCALE_ZOOM_FACTOR, -clicks); + F32 old_scale = mScale; + + setScale(new_scale); + + static LLUICachedControl center("MiniMapCenter"); + if (center == MAP_CENTER_NONE) + { + // Adjust pan to center the zoom on the mouse pointer + LLVector2 zoom_offset; + zoom_offset.mV[VX] = x - getRect().getWidth() / 2; + zoom_offset.mV[VY] = y - getRect().getHeight() / 2; + mCurPan -= zoom_offset * mScale / old_scale - zoom_offset; + } return TRUE; } BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen ) { - BOOL handled = FALSE; if (gDisconnected) { return FALSE; } - LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(viewPosToGlobal(x, y, gSavedSettings.getBOOL( "MiniMapRotate" ))); + + LLRect sticky_rect; + LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(viewPosToGlobal(x, y)); if( region ) { + // set sticky_rect + S32 SLOP = 4; + localPointToScreen(x - SLOP, y - SLOP, &(sticky_rect.mLeft), &(sticky_rect.mBottom)); + sticky_rect.mRight = sticky_rect.mLeft + 2 * SLOP; + sticky_rect.mTop = sticky_rect.mBottom + 2 * SLOP; + msg.assign(""); std::string fullname; if(mClosestAgentToCursor.notNull() && LLAvatarNameCache::getPNSName(mClosestAgentToCursor, fullname)) @@ -711,19 +913,12 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rec if ( LLFloaterAvatarList::instanceExists() ) { - LLAvatarListEntry *ent = LLFloaterAvatarList::getInstance()->getAvatarEntry(mClosestAgentToCursor); - if ( NULL != ent ) - { - //position = LLFloaterAvatarList::AvatarPosition(mClosestAgentToCursor); + if (LLAvatarListEntry *ent = LLFloaterAvatarList::getInstance()->getAvatarEntry(mClosestAgentToCursor)) position = ent->getPosition(); - } } LLVector3d delta = position - mypos; F32 distance = (F32)delta.magVec(); - - //llinfos << distance << " - " << position << llendl; - msg.append( llformat("\n(Distance: %.02fm)\n\n",distance) ); } // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-04 (RLVa-1.0.0a) | Modified: RLVa-0.2.0b @@ -731,31 +926,16 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rec // [/RLVa:KB] //msg.append( region->getName() ); -//#ifndef LL_RELEASE_FOR_DOWNLOAD - std::string buffer; - msg.append("\n"); - buffer = region->getHost().getHostName(); - msg.append(buffer); - msg.append("\n"); - buffer = region->getHost().getString(); - msg.append(buffer); -//#endif - msg.append("\n"); - msg.append(getToolTip()); - - S32 SLOP = 4; - localPointToScreen( - x - SLOP, y - SLOP, - &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) ); - sticky_rect_screen->mRight = sticky_rect_screen->mLeft + 2 * SLOP; - sticky_rect_screen->mTop = sticky_rect_screen->mBottom + 2 * SLOP; - handled = TRUE; + msg.append("\n" + region->getHost().getHostName()); + msg.append("\n" + region->getHost().getString()); + msg.append("\n" + getToolTip()); } - if(!handled) + else { return LLPanel::handleToolTip(x, y, msg, sticky_rect_screen); } - return handled; + *sticky_rect_screen = sticky_rect; + return TRUE; } @@ -800,7 +980,7 @@ void LLNetMap::renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U & // DEV-17370 - megaprims of size > 4096 cause lag. (go figger.) const F32 MAX_RADIUS = 256.0f; F32 radius_clamped = llmin(radius_meters, MAX_RADIUS); - + S32 diameter_pixels = llround(2 * radius_clamped * mObjectMapTPM); renderPoint( local_pos, color, diameter_pixels ); } @@ -891,36 +1071,159 @@ void LLNetMap::renderPoint(const LLVector3 &pos_local, const LLColor4U &color, } } -void LLNetMap::createObjectImage() +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) +void LLNetMap::renderPropertyLinesForRegion(const LLViewerRegion* pRegion, const LLColor4U& clrOverlay) +{ + const S32 imgWidth = (S32)mParcelImagep->getWidth(); + const S32 imgHeight = (S32)mParcelImagep->getHeight(); + + const LLVector3 originLocal(pRegion->getOriginGlobal() - mParcelImageCenterGlobal); + const S32 originX = llround(originLocal.mV[VX] * mObjectMapTPM + imgWidth / 2); + const S32 originY = llround(originLocal.mV[VY] * mObjectMapTPM + imgHeight / 2); + + U32* pTextureData = (U32*)mParcelRawImagep->getData(); + + // + // Draw the north and east region borders + // + const S32 borderY = originY + llround(REGION_WIDTH_METERS * mObjectMapTPM); + if ( (borderY >= 0) && (borderY < imgHeight) ) + { + S32 curX = llclamp(originX, 0, imgWidth), endX = llclamp(originX + llround(REGION_WIDTH_METERS * mObjectMapTPM), 0, imgWidth - 1); + for (; curX <= endX; curX++) + pTextureData[borderY * imgWidth + curX] = clrOverlay.mAll; + } + const S32 borderX = originX + llround(REGION_WIDTH_METERS * mObjectMapTPM); + if ( (borderX >= 0) && (borderX < imgWidth) ) + { + S32 curY = llclamp(originY, 0, imgHeight), endY = llclamp(originY + llround(REGION_WIDTH_METERS * mObjectMapTPM), 0, imgHeight - 1); + for (; curY <= endY; curY++) + pTextureData[curY * imgWidth + borderX] = clrOverlay.mAll; + } + + // + // Render parcel lines + // + static const F32 GRID_STEP = PARCEL_GRID_STEP_METERS; + static const S32 GRIDS_PER_EDGE = REGION_WIDTH_METERS / GRID_STEP; + + const U8* pOwnership = pRegion->getParcelOverlay()->getOwnership(); + const U8* pCollision = (pRegion->getHandle() == LLViewerParcelMgr::instance().getCollisionRegionHandle()) ? LLViewerParcelMgr::instance().getCollisionBitmap() : NULL; + for (S32 idxRow = 0; idxRow < GRIDS_PER_EDGE; idxRow++) + { + for (S32 idxCol = 0; idxCol < GRIDS_PER_EDGE; idxCol++) + { + S32 overlay = pOwnership[idxRow * GRIDS_PER_EDGE + idxCol]; + S32 idxCollision = idxRow * GRIDS_PER_EDGE + idxCol; + bool fForSale = ((overlay & PARCEL_COLOR_MASK) == PARCEL_FOR_SALE); + bool fCollision = (pCollision) && (pCollision[idxCollision / 8] & (1 << (idxCollision % 8))); + if ( (!fForSale) && (!fCollision) && (0 == (overlay & (PARCEL_SOUTH_LINE | PARCEL_WEST_LINE))) ) + continue; + + const S32 posX = originX + llround(idxCol * GRID_STEP * mObjectMapTPM); + const S32 posY = originY + llround(idxRow * GRID_STEP * mObjectMapTPM); + + static LLCachedControl s_fForSaleParcels(gSavedSettings, "MiniMapForSaleParcels"); + static LLCachedControl s_fShowCollisionParcels(gSavedSettings, "MiniMapCollisionParcels"); + if ( ((s_fForSaleParcels) && (fForSale)) || ((s_fShowCollisionParcels) && (fCollision)) ) + { + S32 curY = llclamp(posY, 0, imgHeight), endY = llclamp(posY + llround(GRID_STEP * mObjectMapTPM), 0, imgHeight - 1); + for (; curY <= endY; curY++) + { + S32 curX = llclamp(posX, 0, imgWidth) , endX = llclamp(posX + llround(GRID_STEP * mObjectMapTPM), 0, imgWidth - 1); + for (; curX <= endX; curX++) + { + pTextureData[curY * imgWidth + curX] = (fForSale) ? LLColor4U(255, 255, 128, 192).mAll + : LLColor4U(255, 128, 128, 192).mAll; + } + } + } + if (overlay & PARCEL_SOUTH_LINE) + { + if ( (posY >= 0) && (posY < imgHeight) ) + { + S32 curX = llclamp(posX, 0, imgWidth), endX = llclamp(posX + llround(GRID_STEP * mObjectMapTPM), 0, imgWidth - 1); + for (; curX <= endX; curX++) + pTextureData[posY * imgWidth + curX] = clrOverlay.mAll; + } + } + if (overlay & PARCEL_WEST_LINE) + { + if ( (posX >= 0) && (posX < imgWidth) ) + { + S32 curY = llclamp(posY, 0, imgHeight), endY = llclamp(posY + llround(GRID_STEP * mObjectMapTPM), 0, imgHeight - 1); + for (; curY <= endY; curY++) + pTextureData[curY * imgWidth + posX] = clrOverlay.mAll; + } + } + } + } +} +// [/SL:KB] + +//void LLNetMap::createObjectImage() +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) +bool LLNetMap::createImage(LLPointer& rawimagep) const +// [/SL:KB] { // Find the size of the side of a square that surrounds the circle that surrounds getRect(). // ... which is, the diagonal of the rect. - F32 width = getRect().getWidth(); - F32 height = getRect().getHeight(); + F32 width = (F32)getRect().getWidth(); + F32 height = (F32)getRect().getHeight(); S32 square_size = llround( sqrt(width*width + height*height) ); // Find the least power of two >= the minimum size. const S32 MIN_SIZE = 64; - const S32 MAX_SIZE = 256; +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-07-28 (Catznip-3.3) + const S32 MAX_SIZE = 512; +// [/SL:KB] +// const S32 MAX_SIZE = 256; S32 img_size = MIN_SIZE; while( (img_size*2 < square_size ) && (img_size < MAX_SIZE) ) { img_size <<= 1; } - if( mObjectImagep.isNull() || - (mObjectImagep->getWidth() != img_size) || - (mObjectImagep->getHeight() != img_size) ) +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + if( rawimagep.isNull() || (rawimagep->getWidth() != img_size) || (rawimagep->getHeight() != img_size) ) { - mObjectRawImagep = new LLImageRaw(img_size, img_size, 4); - U8* data = mObjectRawImagep->getData(); + rawimagep = new LLImageRaw(img_size, img_size, 4); + U8* data = rawimagep->getData(); memset( data, 0, img_size * img_size * 4 ); - mObjectImagep = LLViewerTextureManager::getLocalTexture( mObjectRawImagep.get(), FALSE); + return true; } - setScale(mScale); - mUpdateNow = TRUE; + return false; +// [/SL:KB] +// if( mObjectImagep.isNull() || +// (mObjectImagep->getWidth() != img_size) || +// (mObjectImagep->getHeight() != img_size) ) +// { +// mObjectRawImagep = new LLImageRaw(img_size, img_size, 4); +// U8* data = mObjectRawImagep->getData(); +// memset( data, 0, img_size * img_size * 4 ); +// mObjectImagep = LLViewerTextureManager::getLocalTexture( mObjectRawImagep.get(), FALSE); +// } +// setScale(mScale); +// mUpdateNow = true; } +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) +void LLNetMap::createObjectImage() +{ + if (createImage(mObjectRawImagep)) + mObjectImagep = LLViewerTextureManager::getLocalTexture( mObjectRawImagep.get(), FALSE); + setScale(mScale); + mUpdateObjectImage = true; +} + +void LLNetMap::createParcelImage() +{ + if (createImage(mParcelRawImagep)) + mParcelImagep = LLViewerTextureManager::getLocalTexture( mParcelRawImagep.get(), FALSE); + mUpdateParcelImage = true; +} +// [/SL:KB] + BOOL LLNetMap::handleMouseDown( S32 x, S32 y, MASK mask ) { if (!(mask & MASK_SHIFT)) return FALSE; @@ -928,10 +1231,9 @@ BOOL LLNetMap::handleMouseDown( S32 x, S32 y, MASK mask ) // Start panning gFocusMgr.setMouseCapture(this); - mMouseDownPanX = llround(mCurPanX); - mMouseDownPanY = llround(mCurPanY); - mMouseDownX = x; - mMouseDownY = y; + mStartPan = mCurPan; + mMouseDown.mX = x; + mMouseDown.mY = y; return TRUE; } @@ -943,22 +1245,20 @@ BOOL LLNetMap::handleMouseUp( S32 x, S32 y, MASK mask ) { // restore mouse cursor S32 local_x, local_y; - local_x = mMouseDownX + llfloor(mCurPanX - mMouseDownPanX); - local_y = mMouseDownY + llfloor(mCurPanY - mMouseDownPanY); + local_x = mMouseDown.mX + llfloor(mCurPan.mV[VX] - mStartPan.mV[VX]); + local_y = mMouseDown.mY + llfloor(mCurPan.mV[VY] - mStartPan.mV[VY]); LLRect clip_rect = getRect(); clip_rect.stretch(-8); - clip_rect.clipPointToRect(mMouseDownX, mMouseDownY, local_x, local_y); + clip_rect.clipPointToRect(mMouseDown.mX, mMouseDown.mY, local_x, local_y); LLUI::setMousePositionLocal(this, local_x, local_y); // finish the pan - mPanning = FALSE; + mPanning = false; - mMouseDownX = 0; - mMouseDownY = 0; + mMouseDown.set(0, 0); // auto centre - mTargetPanX = 0; - mTargetPanY = 0; + mTargetPan.setZero(); } gViewerWindow->showCursor(); gFocusMgr.setMouseCapture(NULL); @@ -967,8 +1267,68 @@ BOOL LLNetMap::handleMouseUp( S32 x, S32 y, MASK mask ) return FALSE; } +// [SL:KB] - Patch: World-MiniMap | Checked: 2012-07-08 (Catznip-3.3.0) +bool LLNetMap::OverlayToggle::handleEvent(LLPointer event, const LLSD& sdParam) +{ + // Toggle the setting + const std::string strControl = sdParam.asString(); + BOOL fCurValue = gSavedSettings.getBOOL(strControl); + gSavedSettings.setBOOL(strControl, !fCurValue); + + // Force an overlay update + mPtr->mUpdateParcelImage = true; + return true; +} +// [/SL:KB] + +BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask) +{ + mClosestAgentAtLastRightClick = mClosestAgentToCursor; + if (mPopupMenu) + { + mPopupMenu->buildDrawLabels(); + mPopupMenu->updateParent(LLMenuGL::sMenuContainer); + LLMenuGL::showPopup(this, mPopupMenu, x, y); + } + return TRUE; +} + +BOOL LLNetMap::handleDoubleClick( S32 x, S32 y, MASK mask ) +{ + LLVector3d pos_global = viewPosToGlobal(x, y); + + bool double_click_teleport = gSavedSettings.getBOOL("DoubleClickTeleport"); + bool double_click_show_world_map = gSavedSettings.getBOOL("DoubleClickShowWorldMap"); + + bool new_target = false; + if (double_click_teleport || double_click_show_world_map) + { + // If we're not tracking a beacon already, double-click will set one + if (!LLTracker::isTracking()) + { + LLFloaterWorldMap* world_map = gFloaterWorldMap; + if (world_map) + { + world_map->trackLocation(pos_global); + new_target = true; + } + } + } + + if (double_click_teleport) + { + // If DoubleClickTeleport is on, double clicking the minimap will teleport there + gAgent.teleportViaLocationLookAt(pos_global); + } + else if (double_click_show_world_map) + { + LLFloaterWorldMap::show(new_target); + } + return TRUE; +} + // static -BOOL LLNetMap::outsideSlop( S32 x, S32 y, S32 start_x, S32 start_y, S32 slop ) +bool LLNetMap::outsideSlop( S32 x, S32 y, S32 start_x, S32 start_y, S32 slop ) { S32 dx = x - start_x; S32 dy = y - start_y; @@ -980,23 +1340,21 @@ BOOL LLNetMap::handleHover( S32 x, S32 y, MASK mask ) { if (hasMouseCapture()) { - if (mPanning || outsideSlop(x, y, mMouseDownX, mMouseDownY, MOUSE_DRAG_SLOP)) + if (mPanning || outsideSlop(x, y, mMouseDown.mX, mMouseDown.mY, MOUSE_DRAG_SLOP)) { if (!mPanning) { // just started panning, so hide cursor - mPanning = TRUE; + mPanning = true; gViewerWindow->hideCursor(); } - F32 delta_x = (F32)(gViewerWindow->getCurrentMouseDX()); - F32 delta_y = (F32)(gViewerWindow->getCurrentMouseDY()); + LLVector2 delta(static_cast(gViewerWindow->getCurrentMouseDX()), + static_cast(gViewerWindow->getCurrentMouseDY())); // Set pan to value at start of drag + offset - mCurPanX += delta_x; - mCurPanY += delta_y; - mTargetPanX = mCurPanX; - mTargetPanY = mCurPanY; + mCurPan += delta; + mTargetPan = mCurPan; gViewerWindow->moveCursorToCenter(); } @@ -1020,41 +1378,6 @@ BOOL LLNetMap::handleHover( S32 x, S32 y, MASK mask ) return TRUE; } -BOOL LLNetMap::handleDoubleClick( S32 x, S32 y, MASK mask ) -{ - LLVector3d pos_global = viewPosToGlobal(x, y, gSavedSettings.getBOOL( "MiniMapRotate" )); - BOOL new_target = FALSE; - if (!LLTracker::isTracking()) - { - gFloaterWorldMap->trackLocation(pos_global); - new_target = TRUE; - } - - if (gSavedSettings.getBOOL("DoubleClickTeleport")) - { - gAgent.teleportViaLocationLookAt(pos_global); - } - else - { - LLFloaterWorldMap::show(new_target); - } - return TRUE; -} - -BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask) -{ - mClosestAgentAtLastRightClick = mClosestAgentToCursor; - LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); - if (menu) - { - menu->buildDrawLabels(); - menu->updateParent(LLMenuGL::sMenuContainer); - LLMenuGL::showPopup(this, menu, x, y); - } - return TRUE; -} - - // static bool LLNetMap::LLScaleMap::handleEvent(LLPointer event, const LLSD& userdata) { @@ -1165,11 +1488,11 @@ bool LLNetMap::LLChatRings::handleEvent(LLPointer event, const LLSD& us BOOL chat_enabled = gSavedSettings.getBOOL("MiniMapChatRing"); BOOL shout_enabled = gSavedSettings.getBOOL("MiniMapShoutRing"); BOOL all_enabled = whisper_enabled && chat_enabled && shout_enabled; - + gSavedSettings.setBOOL("MiniMapWhisperRing", !all_enabled); gSavedSettings.setBOOL("MiniMapChatRing", !all_enabled); gSavedSettings.setBOOL("MiniMapShoutRing", !all_enabled); - + return true; } @@ -1179,7 +1502,7 @@ bool LLNetMap::LLCheckChatRings::handleEvent(LLPointer event, const LLS BOOL chat_enabled = gSavedSettings.getBOOL("MiniMapChatRing"); BOOL shout_enabled = gSavedSettings.getBOOL("MiniMapShoutRing"); BOOL all_enabled = whisper_enabled && chat_enabled && shout_enabled; - + LLNetMap *self = mPtr; self->findControl(userdata["control"].asString())->setValue(all_enabled); return true; @@ -1237,4 +1560,3 @@ bool LLNetMap::LLToggleControl::handleEvent(LLPointer event, const LLSD gSavedSettings.setBOOL(control_name, !gSavedSettings.getBOOL(control_name)); return true; } - diff --git a/indra/newview/llnetmap.h b/indra/newview/llnetmap.h index 82f48bc9a..2a4db214d 100644 --- a/indra/newview/llnetmap.h +++ b/indra/newview/llnetmap.h @@ -33,21 +33,31 @@ #ifndef LL_LLNETMAP_H #define LL_LLNETMAP_H +#include "llmath.h" #include "llpanel.h" #include "llmemberlistener.h" #include "v3math.h" #include "v3dmath.h" #include "v4color.h" -#include "llimage.h" +#include "llpointer.h" +#include "llcoord.h" + class LLTextBox; +class LLImageRaw; class LLViewerTexture; +class LLFloaterMap; +class LLMenuGL; +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) +class LLViewerRegion; +class LLAvatarName; +// [/SL:KB] -typedef enum e_minimap_center +enum EMiniMapCenter { MAP_CENTER_NONE = 0, MAP_CENTER_CAMERA = 1 -} EMiniMapCenter; +}; class LLNetMap : public LLPanel { @@ -55,77 +65,93 @@ public: LLNetMap(const std::string& name); virtual ~LLNetMap(); - virtual void draw(); - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ); - virtual BOOL handleHover( S32 x, S32 y, MASK mask ); - virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); - virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - virtual BOOL handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen ); + static const F32 MAP_SCALE_MIN; + static const F32 MAP_SCALE_MID; + static const F32 MAP_SCALE_MAX; - void renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius ); + /*virtual*/ void draw(); + /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask ); + /*virtual*/ BOOL handleMouseUp( S32 x, S32 y, MASK mask ); + /*virtual*/ BOOL handleHover( S32 x, S32 y, MASK mask ); + /*virtual*/ BOOL handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen ); + /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + + /*virtual*/ BOOL postBuild(); + /*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); + /*virtual*/ BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); static void mm_setcolor(LLUUID key,LLColor4 col); //moymod -private: +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + void refreshParcelOverlay() { mUpdateParcelImage = true; } +// [/SL:KB] void setScale( F32 scale ); + void renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius ); - // Not used at present - void translatePan( F32 delta_x, F32 delta_y ); - void setPan( F32 x, F32 y ) { mTargetPanX = x; mTargetPanY = y; } - +private: + const LLVector3d& getObjectImageCenterGlobal() { return mObjectImageCenterGlobal; } void renderPoint(const LLVector3 &pos, const LLColor4U &color, S32 diameter, S32 relative_height = 0); - LLVector3 globalPosToView(const LLVector3d& global_pos, BOOL rotated); - LLVector3d viewPosToGlobal(S32 x,S32 y, BOOL rotated); + + LLVector3 globalPosToView(const LLVector3d& global_pos); + LLVector3d viewPosToGlobal(S32 x,S32 y); void drawRing(const F32 radius, LLVector3 pos_map, const LLColor4& color); void drawTracking( const LLVector3d& pos_global, - BOOL rotated, const LLColor4& color, BOOL draw_arrow = TRUE); void setDirectionPos( LLTextBox* text_box, F32 rotation ); void updateMinorDirections(); +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + bool createImage(LLPointer& rawimagep) const; void createObjectImage(); + void createParcelImage(); - LLHandle mPopupMenuHandle; + void renderPropertyLinesForRegion(const LLViewerRegion* pRegion, const LLColor4U& clrOverlay); +// [/SL:KB] +// void createObjectImage(); + + static bool outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y, S32 slop); + +private: +// bool mUpdateNow; +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + bool mUpdateObjectImage; +protected: + friend class OverlayToggle; + bool mUpdateParcelImage; +private: +// [/SL:KB] F32 mScale; // Size of a region in pixels F32 mPixelsPerMeter; // world meters to map pixels F32 mObjectMapTPM; // texels per meter on map F32 mObjectMapPixels; // Width of object map in pixels F32 mDotRadius; // Size of avatar markers - F32 mTargetPanX; - F32 mTargetPanY; - F32 mCurPanX; - F32 mCurPanY; - BOOL mPanning; // map has been dragged - S32 mMouseDownPanX; // value at start of drag - S32 mMouseDownPanY; // value at start of drag - S32 mMouseDownX; - S32 mMouseDownY; + bool mPanning; // map is being dragged + LLVector2 mTargetPan; + LLVector2 mCurPan; + LLVector2 mStartPan; // pan offset at start of drag + LLCoordGL mMouseDown; // pointer position at start of drag - BOOL mUpdateNow; LLVector3d mObjectImageCenterGlobal; LLPointer mObjectRawImagep; LLPointer mObjectImagep; +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + LLVector3d mParcelImageCenterGlobal; + LLPointer mParcelRawImagep; + LLPointer mParcelImagep; +// [/SL:KB] -private: LLUUID mClosestAgentToCursor; LLVector3d mClosestAgentPosition; LLUUID mClosestAgentAtLastRightClick; - static BOOL sRotateMap; - static LLNetMap* sInstance; - static BOOL isAgentUnderCursor(void*) { return sInstance && sInstance->mClosestAgentToCursor.notNull(); } - static BOOL outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y, S32 slop); - static void showAgentProfile(void*); BOOL isAgentUnderCursor() { return mClosestAgentToCursor.notNull(); } @@ -183,10 +209,7 @@ private: /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata); }; - - //moymod - Custom minimap markers :o - class mmsetred : public LLMemberListener //moymod { public: @@ -224,9 +247,6 @@ private: }; - - - class LLEnableProfile : public LLMemberListener { public: @@ -238,7 +258,16 @@ private: public: /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata); }; - + +// [SL:KB] - Patch: World-MiniMap | Checked: 2012-07-08 (Catznip-3.3.0) + class OverlayToggle : public LLMemberListener + { + public: + /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata); + }; +// [/SL:KB] + + LLMenuGL* mPopupMenu; }; diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index 57037a871..4fdca26c8 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -2,31 +2,25 @@ * @file llviewerparcelmgr.cpp * @brief Viewer-side representation of owned land * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -130,6 +124,10 @@ LLViewerParcelMgr::LLViewerParcelMgr() mRenderSelection(TRUE), mCollisionBanned(0), mCollisionTimer(), +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + mCollisionRegionHandle(0), + mCollisionUpdateSignal(NULL), +// [/SL:KB] mMediaParcelId(0), mMediaRegionId(0), mHighlightSegments(NULL), @@ -152,6 +150,11 @@ LLViewerParcelMgr::LLViewerParcelMgr() mHighlightSegments = new U8[(mParcelsPerEdge+1)*(mParcelsPerEdge+1)]; resetSegments(mHighlightSegments); +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + mCollisionBitmap = new U8[getCollisionBitmapSize()]; + memset(mCollisionBitmap, 0, getCollisionBitmapSize()); +// [/SL:KB] + mCollisionSegments = new U8[(mParcelsPerEdge+1)*(mParcelsPerEdge+1)]; resetSegments(mCollisionSegments); @@ -208,6 +211,11 @@ LLViewerParcelMgr::~LLViewerParcelMgr() delete[] mHighlightSegments; mHighlightSegments = NULL; +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + delete[] mCollisionBitmap; + mCollisionBitmap = NULL; +// [/SL:KB] + delete[] mCollisionSegments; mCollisionSegments = NULL; @@ -1741,18 +1749,31 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use } - S32 bitmap_size = parcel_mgr.mParcelsPerEdge - * parcel_mgr.mParcelsPerEdge - / 8; - U8* bitmap = new U8[ bitmap_size ]; - msg->getBinaryDataFast(_PREHASH_ParcelData, _PREHASH_Bitmap, bitmap, bitmap_size); +// S32 bitmap_size = parcel_mgr.mParcelsPerEdge +// * parcel_mgr.mParcelsPerEdge +// / 8; +// U8* bitmap = new U8[ bitmap_size ]; +// msg->getBinaryDataFast(_PREHASH_ParcelData, _PREHASH_Bitmap, bitmap, bitmap_size); +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + msg->getBinaryDataFast(_PREHASH_ParcelData, _PREHASH_Bitmap, parcel_mgr.mCollisionBitmap, parcel_mgr.getCollisionBitmapSize()); +// [/SL:KB] parcel_mgr.resetSegments(parcel_mgr.mCollisionSegments); - parcel_mgr.writeSegmentsFromBitmap( bitmap, parcel_mgr.mCollisionSegments ); +// parcel_mgr.writeSegmentsFromBitmap( bitmap, parcel_mgr.mCollisionSegments ); +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + parcel_mgr.writeSegmentsFromBitmap(parcel_mgr.mCollisionBitmap, parcel_mgr.mCollisionSegments); +// [/SL:KB] - delete[] bitmap; - bitmap = NULL; +// delete[] bitmap; +// bitmap = NULL; +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + LLViewerRegion* pRegion = LLWorld::getInstance()->getRegion(msg->getSender()); + parcel_mgr.mCollisionRegionHandle = (pRegion) ? pRegion->getHandle() : 0; + + if (parcel_mgr.mCollisionUpdateSignal) + (*parcel_mgr.mCollisionUpdateSignal)(pRegion); +// [/SL:KB] } else if (sequence_id == HOVERED_PARCEL_SEQ_ID) { @@ -1770,7 +1791,10 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use } else { - // look for music. + // Check for video + LLViewerParcelMedia::update(parcel); + + // Then check for music if (gAudiop) { if (parcel) @@ -1818,9 +1842,6 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use gAudiop->stopInternetStream(); } }//if gAudiop - - // now check for video - LLViewerParcelMedia::update( parcel ); }; } @@ -1828,9 +1849,6 @@ void optionally_start_music(LLParcel* parcel) { if (gSavedSettings.getBOOL("AudioStreamingMusic")) { - - - // Make the user click the start button on the overlay bar. JC // llinfos << "Starting parcel music " << parcel->getMusicURL() << llendl; @@ -2571,3 +2589,12 @@ void LLViewerParcelMgr::onTeleportFailed() { mTeleportFailedSignal(); } + +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) +boost::signals2::connection LLViewerParcelMgr::setCollisionUpdateCallback(const collision_update_signal_t::slot_type & cb) +{ + if (!mCollisionUpdateSignal) + mCollisionUpdateSignal = new collision_update_signal_t(); + return mCollisionUpdateSignal->connect(cb); +} +// [/SL:KB] diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h index 022465a97..1e0ea2c83 100644 --- a/indra/newview/llviewerparcelmgr.h +++ b/indra/newview/llviewerparcelmgr.h @@ -2,31 +2,25 @@ * @file llviewerparcelmgr.h * @brief Viewer-side representation of owned land * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -36,10 +30,13 @@ #include "v3dmath.h" #include "lldarray.h" #include "llframetimer.h" -#include "llmemory.h" +#include "llsingleton.h" #include "llparcelselection.h" #include "llui.h" +#include +#include + class LLUUID; class LLMessageSystem; class LLParcel; @@ -169,6 +166,14 @@ public: LLParcel* getHoverParcel() const; LLParcel* getCollisionParcel() const; +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + const U8* getCollisionBitmap() const { return mCollisionBitmap; } + size_t getCollisionBitmapSize() const { return mParcelsPerEdge * mParcelsPerEdge / 8; } + U64 getCollisionRegionHandle() const { return mCollisionRegionHandle; } + + typedef boost::signals2::signal collision_update_signal_t; + boost::signals2::connection setCollisionUpdateCallback(const collision_update_signal_t::slot_type & cb); +// [/SL:KB] // Can this agent build on the parcel he is on? // Used for parcel property icons in nav bar. @@ -361,6 +366,11 @@ private: // Watch for pending collisions with a parcel you can't access. // If it's coming, draw the parcel's boundaries. LLParcel* mCollisionParcel; +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + U8* mCollisionBitmap; + U64 mCollisionRegionHandle; + collision_update_signal_t* mCollisionUpdateSignal; +// [/SL:KB] U8* mCollisionSegments; BOOL mRenderCollision; BOOL mRenderSelection; diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index 6eb83a9f7..7bdc24f0a 100644 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -2,31 +2,25 @@ * @file llviewerparceloverlay.cpp * @brief LLViewerParcelOverlay class implementation * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -54,8 +48,13 @@ #include "llglheaders.h" #include "pipeline.h" + const U8 OVERLAY_IMG_COMPONENTS = 4; +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) +LLViewerParcelOverlay::update_signal_t* LLViewerParcelOverlay::mUpdateSignal = NULL; +// [/SL:KB] + LLViewerParcelOverlay::LLViewerParcelOverlay(LLViewerRegion* region, F32 region_width_meters) : mRegion( region ), mParcelGridsPerEdge( S32( region_width_meters / PARCEL_GRID_STEP_METERS ) ), @@ -858,6 +857,10 @@ void LLViewerParcelOverlay::idleUpdate(bool force_update) { updateOverlayTexture(); updatePropertyLines(); +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + if (mUpdateSignal) + (*mUpdateSignal)(mRegion); +// [/SL:KB] mTimeSinceLastUpdate.reset(); } } @@ -929,6 +932,7 @@ S32 LLViewerParcelOverlay::renderPropertyLines () S32 drawn = 0; F32* vertexp; U8* colorp; + bool render_hidden = LLSelectMgr::sRenderHiddenSelections && gFloaterTools && gFloaterTools->getVisible(); const F32 PROPERTY_LINE_CLIP_DIST_SQUARED = 256.f * 256.f; @@ -970,7 +974,7 @@ S32 LLViewerParcelOverlay::renderPropertyLines () gGL.end(); - if (LLSelectMgr::sRenderHiddenSelections && gFloaterTools && gFloaterTools->getVisible()) + if (render_hidden) { LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER); @@ -1005,3 +1009,12 @@ S32 LLViewerParcelOverlay::renderPropertyLines () return drawn; } + +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) +boost::signals2::connection LLViewerParcelOverlay::setUpdateCallback(const update_signal_t::slot_type & cb) +{ + if (!mUpdateSignal) + mUpdateSignal = new update_signal_t(); + return mUpdateSignal->connect(cb); +} +// [/SL:KB] diff --git a/indra/newview/llviewerparceloverlay.h b/indra/newview/llviewerparceloverlay.h index d53a4c15f..3f629fda9 100644 --- a/indra/newview/llviewerparceloverlay.h +++ b/indra/newview/llviewerparceloverlay.h @@ -2,31 +2,25 @@ * @file llviewerparceloverlay.h * @brief LLViewerParcelOverlay class header file * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -73,6 +67,9 @@ public: BOOL isBuildCameraAllowed(const LLVector3& pos) const; F32 getOwnedRatio() const; +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + const U8* getOwnership() const { return mOwnership; } +// [/SL:KB] // Returns the number of vertices drawn S32 renderPropertyLines(); @@ -88,6 +85,11 @@ public: void idleUpdate(bool update_now = false); void updateGL(); +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + typedef boost::signals2::signal update_signal_t; + static boost::signals2::connection setUpdateCallback(const update_signal_t::slot_type & cb); +// [/SL:KB] + private: // This is in parcel rows and columns, not grid rows and columns // Stored in bottom three bits. @@ -129,6 +131,10 @@ private: S32 mVertexCount; F32* mVertexArray; U8* mColorArray; + +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + static update_signal_t* mUpdateSignal; +// [/SL:KB] }; #endif diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index b68722e19..7103a7ede 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -48,6 +48,7 @@ #include "v3math.h" #include "v4math.h" +#include "lfsimfeaturehandler.h" #include "llagent.h" #include "llagentcamera.h" #include "llcallingcard.h" @@ -222,7 +223,7 @@ public: virtual ~BaseCapabilitiesComplete() { } - /*virtual*/ void error(U32 statusNum, const std::string& reason) + void error(U32 statusNum, const std::string& reason) { LL_WARNS2("AppInit", "Capabilities") << statusNum << ": " << reason << LL_ENDL; LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); @@ -232,7 +233,7 @@ public: } } - /*virtual*/ void result(const LLSD& content) + void result(const LLSD& content) { LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); if(!regionp) //region was removed @@ -422,6 +423,14 @@ LLViewerRegion::~LLViewerRegion() delete mImpl; mImpl = NULL; + +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-07-26 (Catznip-3.3) + if (mWorldMapTile) + { + mWorldMapTile->setBoostLevel(LLViewerTexture::BOOST_NONE); + mWorldMapTile = NULL; + } +// [/SL:KB] } LLEventPump& LLViewerRegion::getCapAPI() const @@ -1087,7 +1096,28 @@ F32 LLViewerRegion::getLandHeightRegion(const LLVector3& region_pos) return mImpl->mLandp->resolveHeightRegion( region_pos ); } -bool LLViewerRegion::isAlive() +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) +LLViewerTexture* LLViewerRegion::getWorldMapTile() const +{ + if (!mWorldMapTile) + { + U32 gridX, gridY; + grid_from_region_handle(mHandle, &gridX, &gridY); + // Singu Note: We must obey the override on certain grids! + std::string simOverrideMap = LFSimFeatureHandler::instance().mapServerURL(); + std::string strImgURL = (simOverrideMap.empty() ? gSavedSettings.getString("MapServerURL") : simOverrideMap) + llformat("map-1-%d-%d-objects.jpg", gridX, gridY); + + mWorldMapTile = LLViewerTextureManager::getFetchedTextureFromUrl(strImgURL, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mWorldMapTile->setBoostLevel(LLViewerTexture::BOOST_MAP); + } + return mWorldMapTile; +} +// [/SL:KB] + +//bool LLViewerRegion::isAlive() +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) +bool LLViewerRegion::isAlive() const +// [/SL:KB] { return mAlive; } @@ -1817,13 +1847,13 @@ public: { } - /*virtual*/ void error(U32 statusNum, const std::string& reason) + void error(U32 statusNum, const std::string& reason) { LL_WARNS2("AppInit", "SimulatorFeatures") << statusNum << ": " << reason << LL_ENDL; retry(); } - /*virtual*/ void result(const LLSD& content) + void result(const LLSD& content) { LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); if(!regionp) //region is removed or responder is not created. @@ -2044,6 +2074,7 @@ void LLViewerRegion::getNeighboringRegionsStatus( std::vector& regions ) { mImpl->mLandp->getNeighboringRegionsStatus( regions ); } + void LLViewerRegion::showReleaseNotes() { std::string url = this->getCapability("ServerReleaseNotes"); diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index f5d2d2eae..1b6eee985 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -75,6 +75,9 @@ class LLDataPacker; class LLDataPackerBinaryBuffer; class LLHost; class LLBBox; +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-07-26 (Catznip-3.3) +class LLViewerTexture; +// [/SL:KB] class LLViewerRegionImpl; @@ -143,7 +146,12 @@ public: inline BOOL getRestrictPushObject() const; inline BOOL getReleaseNotesRequested() const; - bool isAlive(); // can become false if circuit disconnects +// bool isAlive(); // can become false if circuit disconnects +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) + bool isAlive() const; // can become false if circuit disconnects + + LLViewerTexture* getWorldMapTile() const; +// [/SL:KB] void setWaterHeight(F32 water_level); F32 getWaterHeight() const; @@ -455,6 +463,10 @@ private: LLDynamicArray mCacheMissFull; LLDynamicArray mCacheMissCRC; +// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-07-26 (Catznip-3.3) + mutable LLPointer mWorldMapTile; +// [/SL:KB] + bool mAlive; // can become false if circuit disconnects bool mCapabilitiesReceived; bool mFeaturesReceived; diff --git a/indra/newview/skins/default/xui/en-us/menu_mini_map.xml b/indra/newview/skins/default/xui/en-us/menu_mini_map.xml index 86ba23de2..9e43a178a 100644 --- a/indra/newview/skins/default/xui/en-us/menu_mini_map.xml +++ b/indra/newview/skins/default/xui/en-us/menu_mini_map.xml @@ -1,36 +1,67 @@ - + - + - + - + - + - - - + + + + - + + + + + + + + + + + + + + + @@ -50,47 +81,41 @@ - + - + - + - - + + - + - + - + - + - + + + + +