Solve Issue 624: minimap multiple selection tool

Adds a circle when you mouse over the minimap, beneath your cursor
-This circle is the effect range of your right click+mark
-Shift+scroll to change the size of this circle (ExodusMinimapAreaEffect)
-- Set the debug to 1 to have basically the same range as before (unless dots are stacked)
-This circle is also how many avatars are shown in the tooltip
-When this circle is over avatar dots, they change color (ExodusMapRolloverColor)
The menu functions still only work on the closest dot to your cursor on right click...
Thanks to Exodus for the majority of this code, the rest is my work and updates to be closer to LL in places.
This commit is contained in:
Inusaito Sayori
2014-04-25 04:11:35 -04:00
parent 4a630b1780
commit b0e44ad1bd
3 changed files with 221 additions and 149 deletions

View File

@@ -752,6 +752,34 @@
<key>Value</key> <key>Value</key>
<boolean>0</boolean> <boolean>0</boolean>
</map> </map>
<key>ExodusMapRolloverColor</key>
<map>
<key>Comment</key>
<string>Color setting for rollovers on the minimap.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Color4</string>
<key>Value</key>
<key>Value</key>
<array>
<real>0.0</real>
<real>1.0</real>
<real>1.0</real>
<real>1.0</real>
</array>
</map>
<key>ExodusMinimapAreaEffect</key>
<map>
<key>Comment</key>
<string>Radius of the area of affect for the minimap, adjusted by shift scrolling over the minimap.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>3.5</real>
</map>
<key>OBJExportNotifyFailed</key> <key>OBJExportNotifyFailed</key>
<map> <map>
<key>Comment</key> <key>Comment</key>

View File

@@ -103,11 +103,15 @@ const S32 CIRCLE_STEPS = 100;
const F64 COARSEUPDATE_MAX_Z = 1020.0f; const F64 COARSEUPDATE_MAX_Z = 1020.0f;
std::map<LLUUID, LLVector3d> LLNetMap::mClosestAgentsToCursor; // <exodus/>
static std::map<LLUUID, LLVector3d> mClosestAgentsAtLastClick; // <exodus/>
LLNetMap::LLNetMap(const std::string& name) : LLNetMap::LLNetMap(const std::string& name) :
LLPanel(name), LLPanel(name),
mScale(128.f), mScale(128.f),
mObjectMapTPM(1.f), mObjectMapTPM(1.f),
mObjectMapPixels(255.f), mObjectMapPixels(255.f),
mPickRadius(gSavedSettings, "ExodusMinimapAreaEffect"), // <exodus/>
mTargetPan(0.f, 0.f), mTargetPan(0.f, 0.f),
mCurPan(0.f, 0.f), mCurPan(0.f, 0.f),
mStartPan(0.f, 0.f), mStartPan(0.f, 0.f),
@@ -229,6 +233,10 @@ void LLNetMap::mm_setcolor(LLUUID key,LLColor4 col)
} }
void LLNetMap::draw() void LLNetMap::draw()
{ {
LLViewerRegion* region = gAgent.getRegion();
if (region == NULL) return;
static LLFrameTimer map_timer; static LLFrameTimer map_timer;
static LLUIColor map_track_color = gTrackColor; static LLUIColor map_track_color = gTrackColor;
static const LLCachedControl<LLColor4> map_frustum_color(gColors, "NetMapFrustum", LLColor4::white); static const LLCachedControl<LLColor4> map_frustum_color(gColors, "NetMapFrustum", LLColor4::white);
@@ -269,18 +277,15 @@ void LLNetMap::draw()
gGL.loadIdentity(); gGL.loadIdentity();
gGL.loadUIIdentity(); gGL.loadUIIdentity();
gGL.scalef(scale.mV[0], scale.mV[1], scale.mV[2]); gGL.scalef(scale.mV[0], scale.mV[1], scale.mV[2]);
gGL.translatef(offset.mV[0], offset.mV[1], offset.mV[2]); gGL.translatef(offset.mV[0], offset.mV[1], offset.mV[2]);
{ {
LLLocalClipRect clip(getLocalRect()); LLLocalClipRect clip(getLocalRect());
{ {
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.matrixMode(LLRender::MM_MODELVIEW);
// Draw background rectangle // Draw background rectangle.
if(isBackgroundVisible()) if(isBackgroundVisible())
{ {
LLColor4 background_color = isBackgroundOpaque() ? getBackgroundColor().mV : getTransparentColor().mV; LLColor4 background_color = isBackgroundOpaque() ? getBackgroundColor().mV : getTransparentColor().mV;
@@ -289,23 +294,22 @@ void LLNetMap::draw()
} }
} }
// region 0,0 is in the middle // Region 0,0 is in the middle.
S32 center_sw_left = getRect().getWidth() / 2 + llfloor(mCurPan.mV[VX]); S32 center_sw_left = getRect().getWidth() / 2 + llfloor(mCurPan.mV[VX]);
S32 center_sw_bottom = getRect().getHeight() / 2 + llfloor(mCurPan.mV[VY]); S32 center_sw_bottom = getRect().getHeight() / 2 + llfloor(mCurPan.mV[VY]);
gGL.pushMatrix(); gGL.pushMatrix();
gGL.translatef( (F32) center_sw_left, (F32) center_sw_bottom, 0.f); gGL.translatef( (F32) center_sw_left, (F32) center_sw_bottom, 0.f);
static LLCachedControl<bool> rotate_map("MiniMapRotate", true); static LLCachedControl<bool> rotate_map("MiniMapRotate", true);
if (rotate_map) if (rotate_map)
{ {
// rotate subsequent draws to agent rotation // Rotate subsequent draws to agent rotation.
rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ); rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );
gGL.rotatef( rotation * RAD_TO_DEG, 0.f, 0.f, 1.f); gGL.rotatef( rotation * RAD_TO_DEG, 0.f, 0.f, 1.f);
} }
// figure out where agent is // Figure out where agent is.
static const LLCachedControl<LLColor4> this_region_color(gColors, "NetMapThisRegion"); static const LLCachedControl<LLColor4> this_region_color(gColors, "NetMapThisRegion");
static const LLCachedControl<LLColor4> live_region_color(gColors, "NetMapLiveRegion"); static const LLCachedControl<LLColor4> live_region_color(gColors, "NetMapLiveRegion");
static const LLCachedControl<LLColor4> dead_region_color(gColors, "NetMapDeadRegion"); static const LLCachedControl<LLColor4> dead_region_color(gColors, "NetMapDeadRegion");
@@ -318,13 +322,14 @@ void LLNetMap::draw()
iter != LLWorld::getInstance()->getRegionList().end(); ++iter) iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
{ {
LLViewerRegion* regionp = *iter; LLViewerRegion* regionp = *iter;
// Find x and y position relative to camera's center. // Find x and y position relative to camera's center.
LLVector3 origin_agent = regionp->getOriginAgent(); LLVector3 origin_agent = regionp->getOriginAgent();
LLVector3 rel_region_pos = origin_agent - gAgentCamera.getCameraPositionAgent(); LLVector3 rel_region_pos = origin_agent - gAgentCamera.getCameraPositionAgent();
F32 relative_x = (rel_region_pos.mV[0] / region_width) * mScale; F32 relative_x = (rel_region_pos.mV[0] / region_width) * mScale;
F32 relative_y = (rel_region_pos.mV[1] / region_width) * mScale; F32 relative_y = (rel_region_pos.mV[1] / region_width) * mScale;
// background region rectangle // Background region rectangle.
F32 bottom = relative_y; F32 bottom = relative_y;
F32 left = relative_x; F32 left = relative_x;
// <FS:CR> Aurora Sim // <FS:CR> Aurora Sim
@@ -334,19 +339,9 @@ void LLNetMap::draw()
F32 right = left + (regionp->getWidth() / REGION_WIDTH_METERS) * mScale ; F32 right = left + (regionp->getWidth() / REGION_WIDTH_METERS) * mScale ;
// </FS:CR> Aurora Sim // </FS:CR> Aurora Sim
if (regionp == gAgent.getRegion()) if (regionp == region) gGL.color4fv(this_region_color().mV);
{ else if (!regionp->isAlive()) gGL.color4fv(dead_region_color().mV);
gGL.color4fv(this_region_color().mV); else gGL.color4fv(live_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) // [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-07-26 (Catznip-3.3)
static LLCachedControl<bool> s_fUseWorldMapTextures(gSavedSettings, "MiniMapWorldMapTextures"); static LLCachedControl<bool> s_fUseWorldMapTextures(gSavedSettings, "MiniMapWorldMapTextures");
@@ -452,7 +447,6 @@ void LLNetMap::draw()
gObjectList.renderObjectsForMap(*this); gObjectList.renderObjectsForMap(*this);
mObjectImagep->setSubImage(mObjectRawImagep, 0, 0, mObjectImagep->getWidth(), mObjectImagep->getHeight()); mObjectImagep->setSubImage(mObjectRawImagep, 0, 0, mObjectImagep->getWidth(), mObjectImagep->getHeight());
map_timer.reset(); map_timer.reset();
} }
@@ -537,10 +531,15 @@ void LLNetMap::draw()
// Mouse pointer in local coordinates // Mouse pointer in local coordinates
S32 local_mouse_x; S32 local_mouse_x;
S32 local_mouse_y; S32 local_mouse_y;
//localMouse(&local_mouse_x, &local_mouse_y);
LLUI::getMousePositionLocal(this, &local_mouse_x, &local_mouse_y); LLUI::getMousePositionLocal(this, &local_mouse_x, &local_mouse_y);
F32 min_pick_dist = mDotRadius * mPickRadius;
mClosestAgentToCursor.setNull(); mClosestAgentToCursor.setNull();
F32 closest_dist_squared = F32_MAX; // value will be overridden in the loop mClosestAgentsToCursor.clear();
F32 closest_dist_squared = F32_MAX;
F32 min_pick_dist_squared = (mDotRadius * MIN_PICK_SCALE) * (mDotRadius * MIN_PICK_SCALE); F32 min_pick_dist_squared = (mDotRadius * MIN_PICK_SCALE) * (mDotRadius * MIN_PICK_SCALE);
LLVector3 pos_map; LLVector3 pos_map;
@@ -571,34 +570,45 @@ void LLNetMap::draw()
{ {
pos_map.mV[VZ] = 16000.f; pos_map.mV[VZ] = 16000.f;
} }
if(LLMuteList::getInstance()->isMuted(uuid))
{
static const LLCachedControl<LLColor4> muted_color("AscentMutedColor",LLColor4(0.7f,0.7f,0.7f,1.f));
color = muted_color;
}
LLViewerRegion* avatar_region = LLWorld::getInstance()->getRegionFromPosGlobal(positions[i]); if (dist_vec(LLVector2(pos_map.mV[VX], pos_map.mV[VY]), LLVector2(local_mouse_x, local_mouse_y)) < min_pick_dist)
LLUUID estate_owner = avatar_region ? avatar_region->getOwner() : LLUUID::null; {
mClosestAgentsToCursor[uuid] = positions[i];
static const LLCachedControl<LLColor4> map_avatar_rollover_color(gSavedSettings, "ExodusMapRolloverColor", LLColor4::cyan);
color = map_avatar_rollover_color;
}
else
{
// MOYMOD Minimap custom av colors. if(LLMuteList::getInstance()->isMuted(uuid))
if (mm_getMarkerColor(uuid, color)) {} {
//Lindens are always more Linden than your friend, make that take precedence static const LLCachedControl<LLColor4> muted_color("AscentMutedColor",LLColor4(0.7f,0.7f,0.7f,1.f));
else if (LLMuteList::getInstance()->isLinden(uuid)) color = muted_color;
{ }
static const LLCachedControl<LLColor4> linden_color("AscentLindenColor",LLColor4(0.f,0.f,1.f,1.f));
color = linden_color; LLViewerRegion* avatar_region = LLWorld::getInstance()->getRegionFromPosGlobal(positions[i]);
} const LLUUID estate_owner = avatar_region ? avatar_region->getOwner() : LLUUID::null;
//check if they are an estate owner at their current position
else if (estate_owner.notNull() && uuid == estate_owner) // MOYMOD Minimap custom av colors.
{ if (mm_getMarkerColor(uuid, color)) {}
static const LLCachedControl<LLColor4> em_color("AscentEstateOwnerColor",LLColor4(1.f,0.6f,1.f,1.f)); //Lindens are always more Linden than your friend, make that take precedence
color = em_color; else if (LLMuteList::getInstance()->isLinden(uuid))
} {
//without these dots, SL would suck. static const LLCachedControl<LLColor4> linden_color("AscentLindenColor",LLColor4(0.f,0.f,1.f,1.f));
else if (show_friends && LLAvatarActions::isFriend(uuid)) color = linden_color;
{ }
static const LLCachedControl<LLColor4> friend_color("AscentFriendColor",LLColor4(1.f,1.f,0.f,1.f)); //check if they are an estate owner at their current position
color = friend_color; else if (estate_owner.notNull() && uuid == estate_owner)
{
static const LLCachedControl<LLColor4> 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<LLColor4> friend_color("AscentFriendColor",LLColor4(1.f,1.f,0.f,1.f));
color = friend_color;
}
} }
LLWorldMapView::drawAvatar( LLWorldMapView::drawAvatar(
@@ -606,23 +616,12 @@ void LLNetMap::draw()
color, color,
pos_map.mV[VZ], mDotRadius); pos_map.mV[VZ], mDotRadius);
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)
{
if (dist_to_cursor_squared < closest_dist_squared)
{
closest_dist_squared = dist_to_cursor_squared;
mClosestAgentToCursor = uuid;
mClosestAgentPosition = positions[i];
}
}
if (!gmSelected.empty()) if (!gmSelected.empty())
if (uuid.notNull()) if (uuid.notNull())
{ {
bool selected = false; bool selected = false;
uuid_vec_t::iterator sel_iter = gmSelected.begin(); uuid_vec_t::iterator sel_iter = gmSelected.begin();
for (; sel_iter != gmSelected.end(); sel_iter++) for (; sel_iter != gmSelected.end(); sel_iter++)
{ {
if(*sel_iter == uuid) if(*sel_iter == uuid)
@@ -631,6 +630,7 @@ void LLNetMap::draw()
break; break;
} }
} }
if (selected) if (selected)
{ {
if( (pos_map.mV[VX] < 0) || if( (pos_map.mV[VX] < 0) ||
@@ -640,12 +640,17 @@ void LLNetMap::draw()
{ {
S32 x = llround( pos_map.mV[VX] ); S32 x = llround( pos_map.mV[VX] );
S32 y = llround( pos_map.mV[VY] ); S32 y = llround( pos_map.mV[VY] );
LLWorldMapView::drawTrackingCircle( getRect(), x, y, color, 1, 10); LLWorldMapView::drawTrackingCircle( getRect(), x, y, color, 1, 10);
} else
{
LLWorldMapView::drawTrackingDot(pos_map.mV[VX],pos_map.mV[VY],color,0.f);
} }
else LLWorldMapView::drawTrackingDot(pos_map.mV[VX],pos_map.mV[VY],color,0.f);
} }
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 && dist_to_cursor_squared < closest_dist_squared)
{
closest_dist_squared = dist_to_cursor_squared;
mClosestAgentToCursor = uuid;
} }
} }
@@ -661,24 +666,31 @@ void LLNetMap::draw()
{ {
drawTracking( LLAvatarTracker::instance().getGlobalPos(), map_track_color ); drawTracking( LLAvatarTracker::instance().getGlobalPos(), map_track_color );
} }
else if ( LLTracker::TRACKING_LANDMARK == tracking_status else if ( LLTracker::TRACKING_LANDMARK == tracking_status ||
|| LLTracker::TRACKING_LOCATION == tracking_status ) LLTracker::TRACKING_LOCATION == tracking_status )
{ {
drawTracking( LLTracker::getTrackedPositionGlobal(), map_track_color ); drawTracking( LLTracker::getTrackedPositionGlobal(), map_track_color );
} }
} }
// Draw dot for self avatar position pos_map = globalPosToView(gAgent.getPositionGlobal());
LLVector3d pos_global = gAgent.getPositionGlobal();
pos_map = globalPosToView(pos_global);
S32 dot_width = llround(mDotRadius * 2.f); S32 dot_width = llround(mDotRadius * 2.f);
LLUIImagePtr you = LLWorldMapView::sAvatarYouLargeImage; LLUIImagePtr you = LLWorldMapView::sAvatarYouLargeImage;
if (you) if (you)
{ {
you->draw(llround(pos_map.mV[VX] - mDotRadius), you->draw(llround(pos_map.mV[VX] - mDotRadius),
llround(pos_map.mV[VY] - mDotRadius), llround(pos_map.mV[VY] - mDotRadius),
dot_width, dot_width,
dot_width); dot_width);
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 && dist_to_cursor_squared < closest_dist_squared)
{
mClosestAgentToCursor = gAgent.getID();
}
} }
// Draw chat range ring(s) // Draw chat range ring(s)
@@ -724,18 +736,23 @@ void LLNetMap::draw()
else else
{ {
gGL.color4fv((map_frustum_rotating_color()).mV); gGL.color4fv((map_frustum_rotating_color()).mV);
// If we don't rotate the map, we have to rotate the frustum. // If we don't rotate the map, we have to rotate the frustum.
gGL.pushMatrix(); gGL.pushMatrix();
gGL.translatef( ctr_x, ctr_y, 0 ); gGL.translatef( ctr_x, ctr_y, 0 );
gGL.rotatef( atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ) * RAD_TO_DEG, 0.f, 0.f, -1.f); gGL.rotatef( atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ) * RAD_TO_DEG, 0.f, 0.f, -1.f);
gGL.begin( LLRender::TRIANGLES ); gGL.begin( LLRender::TRIANGLES );
gGL.vertex2f( 0, 0 ); gGL.vertex2f( 0.f, 0.f );
gGL.vertex2f( -half_width_pixels, far_clip_pixels ); gGL.vertex2f( -half_width_pixels, far_clip_pixels );
gGL.vertex2f( half_width_pixels, far_clip_pixels ); gGL.vertex2f( half_width_pixels, far_clip_pixels );
gGL.end(); gGL.end();
gGL.popMatrix(); gGL.popMatrix();
} }
// <exodus> Draw mouse radius
// Todo: Detect if over the window and don't render a circle?
gl_circle_2d(local_mouse_x, local_mouse_y, min_pick_dist, 32, true);
// </exodus>
} }
gGL.popMatrix(); gGL.popMatrix();
@@ -754,6 +771,7 @@ void LLNetMap::draw()
LLUICtrl::draw(); LLUICtrl::draw();
} }
}
void LLNetMap::reshape(S32 width, S32 height, BOOL called_from_parent) void LLNetMap::reshape(S32 width, S32 height, BOOL called_from_parent)
{ {
@@ -767,9 +785,7 @@ void LLNetMap::reshape(S32 width, S32 height, BOOL called_from_parent)
LLVector3 LLNetMap::globalPosToView(const LLVector3d& global_pos) LLVector3 LLNetMap::globalPosToView(const LLVector3d& global_pos)
{ {
LLVector3d camera_position = gAgentCamera.getCameraPositionGlobal(); LLVector3d relative_pos_global = global_pos - gAgentCamera.getCameraPositionGlobal();
LLVector3d relative_pos_global = global_pos - camera_position;
LLVector3 pos_local; LLVector3 pos_local;
pos_local.setVec(relative_pos_global); // convert to floats from doubles pos_local.setVec(relative_pos_global); // convert to floats from doubles
@@ -865,6 +881,13 @@ LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y )
BOOL LLNetMap::handleScrollWheel(S32 x, S32 y, S32 clicks) BOOL LLNetMap::handleScrollWheel(S32 x, S32 y, S32 clicks)
{ {
// <exodus>
if (gKeyboard->currentMask(TRUE) & MASK_SHIFT)
{
mPickRadius = llclamp(mPickRadius + (2.5f * clicks), 1.f, 64.f);
return true;
}
// </exodus>
// note that clicks are reversed from what you'd think: i.e. > 0 means zoom out, < 0 means zoom in // note that clicks are reversed from what you'd think: i.e. > 0 means zoom out, < 0 means zoom in
F32 new_scale = mScale * pow(MAP_SCALE_ZOOM_FACTOR, -clicks); F32 new_scale = mScale * pow(MAP_SCALE_ZOOM_FACTOR, -clicks);
F32 old_scale = mScale; F32 old_scale = mScale;
@@ -884,7 +907,7 @@ BOOL LLNetMap::handleScrollWheel(S32 x, S32 y, S32 clicks)
return TRUE; return TRUE;
} }
BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen ) BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& tool_tip, LLRect* sticky_rect_screen )
{ {
if (gDisconnected) if (gDisconnected)
{ {
@@ -901,41 +924,64 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rec
sticky_rect.mRight = sticky_rect.mLeft + 2 * SLOP; sticky_rect.mRight = sticky_rect.mLeft + 2 * SLOP;
sticky_rect.mTop = sticky_rect.mBottom + 2 * SLOP; sticky_rect.mTop = sticky_rect.mBottom + 2 * SLOP;
msg.assign(""); tool_tip.assign("");
std::string fullname;
if(mClosestAgentToCursor.notNull() && LLAvatarNameCache::getPNSName(mClosestAgentToCursor, fullname)) if (region->mMapAvatarIDs.count())
{ {
//msg.append(fullname); if (mClosestAgentsToCursor.size())
// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b
msg.append( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? fullname : RlvStrings::getAnonym(fullname) );
// [/RLVa:KB]
msg.append("\n");
LLVector3d mypos = gAgent.getPositionGlobal();
LLVector3d position = mClosestAgentPosition;
if ( LLFloaterAvatarList::instanceExists() )
{ {
if (LLAvatarListEntry *ent = LLFloaterAvatarList::getInstance()->getAvatarEntry(mClosestAgentToCursor)) bool single_agent(mClosestAgentsToCursor.size() == 1); // Singu note: For old look, only add the count if we have more than one
position = ent->getPosition(); if (!single_agent)
} tool_tip.append(llformat("Agents under cursor (%d/%d)\n", mClosestAgentsToCursor.size(), region->mMapAvatarIDs.count() + 1));
LLVector3d delta = position - mypos;
F32 distance = (F32)delta.magVec();
msg.append( llformat("\n(Distance: %.02fm)\n\n",distance) ); LLVector3d myPosition = gAgent.getPositionGlobal();
std::map<LLUUID, LLVector3d>::iterator current = mClosestAgentsToCursor.begin();
std::map<LLUUID, LLVector3d>::iterator end = mClosestAgentsToCursor.end();
for (; current != end; ++current)
{
LLUUID targetUUID = (*current).first;
LLVector3d targetPosition = (*current).second;
std::string fullName;
if (targetUUID.notNull() && LLAvatarNameCache::getPNSName(targetUUID, fullName))
{
//tool_tip.append(fullName);
// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b
tool_tip.append( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? fullName : RlvStrings::getAnonym(fullName) );
// [/RLVa:KB]
// <singu> Use the radar for positioning, when possible.
if (LLFloaterAvatarList::instanceExists())
{
if (LLAvatarListEntry* ent = LLFloaterAvatarList::getInstance()->getAvatarEntry(targetUUID))
targetPosition = ent->getPosition();
}
// </singu>
LLVector3d delta = targetPosition - myPosition;
F32 distance = (F32)delta.magVec();
if (single_agent)
tool_tip.append( llformat("\n\n(Distance: %.02fm)\n",distance) );
else
tool_tip.append(llformat(" (%.02fm)\n", distance));
}
}
tool_tip.append("\n");
}
} }
// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-04 (RLVa-1.0.0a) | Modified: RLVa-0.2.0b // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-04 (RLVa-1.0.0a) | Modified: RLVa-0.2.0b
msg.append( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? region->getName() : RlvStrings::getString(RLV_STRING_HIDDEN) ); tool_tip.append((!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC) ? region->getName() : RlvStrings::getString(RLV_STRING_HIDDEN)));
// [/RLVa:KB] // [/RLVa:KB]
//msg.append( region->getName() ); //tool_tip.append("\n\n" + region->getName());
msg.append("\n" + region->getHost().getHostName()); tool_tip.append("\n" + region->getHost().getHostName());
msg.append("\n" + region->getHost().getString()); tool_tip.append("\n" + region->getHost().getString());
msg.append("\n" + getToolTip()); tool_tip.append("\n" + getToolTip());
} }
else else
{ {
return LLPanel::handleToolTip(x, y, msg, sticky_rect_screen); return LLPanel::handleToolTip(x, y, tool_tip, sticky_rect_screen);
} }
*sticky_rect_screen = sticky_rect; *sticky_rect_screen = sticky_rect;
return TRUE; return TRUE;
@@ -1286,9 +1332,11 @@ bool LLNetMap::OverlayToggle::handleEvent(LLPointer<LLEvent> event, const LLSD&
BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask) BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask)
{ {
mClosestAgentsAtLastClick = mClosestAgentsToCursor;
mClosestAgentAtLastRightClick = mClosestAgentToCursor; mClosestAgentAtLastRightClick = mClosestAgentToCursor;
if (mPopupMenu) if (mPopupMenu)
{ {
// Singu TODO: It'd be spectacular to address multiple avatars from here.
mPopupMenu->buildDrawLabels(); mPopupMenu->buildDrawLabels();
mPopupMenu->updateParent(LLMenuGL::sMenuContainer); mPopupMenu->updateParent(LLMenuGL::sMenuContainer);
LLMenuGL::showPopup(this, mPopupMenu, x, y); LLMenuGL::showPopup(this, mPopupMenu, x, y);
@@ -1407,58 +1455,50 @@ bool LLNetMap::LLScaleMap::handleEvent(LLPointer<LLEvent> event, const LLSD& use
} }
//moymod - minimap color shit //moymod - minimap color shit
bool LLNetMap::mmsetred::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) void markMassAgents(const LLColor4& color)
{ {
LLNetMap *self = mPtr; std::map<LLUUID, LLVector3d>::iterator current = mClosestAgentsAtLastClick.begin();
//if(self->mClosestAgentAtLastRightClick){ std::map<LLUUID, LLVector3d>::iterator end = mClosestAgentsAtLastClick.end();
mm_setcolor(self->mClosestAgentAtLastRightClick,LLColor4(1.0,0.0,0.0,1.0)); for(; current != end; ++current) LLNetMap::mm_setcolor((*current).first, color);
//} }
bool LLNetMap::mmsetred::handleEvent(LLPointer<LLEvent>, const LLSD&)
{
markMassAgents(LLColor4::red); return true;
}
bool LLNetMap::mmsetgreen::handleEvent(LLPointer<LLEvent>, const LLSD&)
{
markMassAgents(LLColor4::green); return true;
}
bool LLNetMap::mmsetblue::handleEvent(LLPointer<LLEvent>, const LLSD&)
{
markMassAgents(LLColor4::blue); return true;
}
bool LLNetMap::mmsetyellow::handleEvent(LLPointer<LLEvent>, const LLSD&)
{
markMassAgents(LLColor4::yellow); return true;
}
bool LLNetMap::mmsetcustom::handleEvent(LLPointer<LLEvent>, const LLSD&)
{
markMassAgents(gSavedSettings.getColor4("MoyMiniMapCustomColor")); return true;
}
bool LLNetMap::mmsetunmark::handleEvent(LLPointer<LLEvent>, const LLSD&)
{
std::map<LLUUID, LLVector3d>::iterator it = mClosestAgentsAtLastClick.begin();
std::map<LLUUID, LLVector3d>::iterator end = mClosestAgentsAtLastClick.end();
for(; it!= end; ++it) mm_MarkerColors.erase((*it).first);
return true; return true;
} }
bool LLNetMap::mmsetgreen::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) bool LLNetMap::mmenableunmark::handleEvent(LLPointer<LLEvent>, const LLSD& userdata)
{ {
LLNetMap *self = mPtr; bool enabled(false);
//if(self->mClosestAgentAtLastRightClick){ std::map<LLUUID, LLVector3d>::iterator it = mClosestAgentsAtLastClick.begin();
mm_setcolor(self->mClosestAgentAtLastRightClick,LLColor4(0.0,1.0,0.0,1.0)); std::map<LLUUID, LLVector3d>::iterator end = mClosestAgentsAtLastClick.end();
//} for(; it != end && !enabled; ++it) enabled = mm_MarkerColors.find((*it).first) != mm_MarkerColors.end();
return true; mPtr->findControl(userdata["control"].asString())->setValue(enabled);
}
bool LLNetMap::mmsetblue::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLNetMap *self = mPtr;
//if(self->mClosestAgentAtLastRightClick){
mm_setcolor(self->mClosestAgentAtLastRightClick,LLColor4(0.0,0.0,1.0,1.0));
//}
return true;
}
bool LLNetMap::mmsetyellow::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLNetMap *self = mPtr;
//if(self->mClosestAgentAtLastRightClick){
mm_setcolor(self->mClosestAgentAtLastRightClick,LLColor4(1.0,1.0,0.0,1.0));
//}
return true;
}
bool LLNetMap::mmsetcustom::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLNetMap *self = mPtr;
//if(self->mClosestAgentAtLastRightClick){
mm_setcolor(self->mClosestAgentAtLastRightClick,gSavedSettings.getColor4("MoyMiniMapCustomColor"));
//}
return true;
}
bool LLNetMap::mmsetunmark::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
mm_MarkerColors.erase(mPtr->mClosestAgentAtLastRightClick);
return true;
}
bool LLNetMap::mmenableunmark::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLNetMap *self = mPtr;
BOOL enabled = mPtr->mClosestAgentAtLastRightClick.notNull() && mm_MarkerColors.find(mPtr->mClosestAgentAtLastRightClick) != mm_MarkerColors.end();
self->findControl(userdata["control"].asString())->setValue(enabled);
return true; return true;
} }
bool LLNetMap::LLCenterMap::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) bool LLNetMap::LLCenterMap::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{ {
EMiniMapCenter center = (EMiniMapCenter)userdata.asInteger(); EMiniMapCenter center = (EMiniMapCenter)userdata.asInteger();

View File

@@ -132,6 +132,9 @@ private:
F32 mObjectMapTPM; // texels per meter on map F32 mObjectMapTPM; // texels per meter on map
F32 mObjectMapPixels; // Width of object map in pixels F32 mObjectMapPixels; // Width of object map in pixels
F32 mDotRadius; // Size of avatar markers F32 mDotRadius; // Size of avatar markers
// <exodus>
LLCachedControl<F32> mPickRadius; // Size of the rightclick area of affect
// </exodus>
bool mPanning; // map is being dragged bool mPanning; // map is being dragged
LLVector2 mTargetPan; LLVector2 mTargetPan;
@@ -148,8 +151,9 @@ private:
LLPointer<LLViewerTexture> mParcelImagep; LLPointer<LLViewerTexture> mParcelImagep;
// [/SL:KB] // [/SL:KB]
static std::map<LLUUID, LLVector3d> mClosestAgentsToCursor; // <exodus/>
LLUUID mClosestAgentToCursor; LLUUID mClosestAgentToCursor;
LLVector3d mClosestAgentPosition;
LLUUID mClosestAgentAtLastRightClick; LLUUID mClosestAgentAtLastRightClick;
static void showAgentProfile(void*); static void showAgentProfile(void*);