Add optional chat ranges rings on MiniMap
Ability to show Whisper, Chat and Shout range circles on the MiniMap. Range values are at the moment hardcoded as [10, 20, 100]. Each ring is binded to the following Debug Settings: Whisper ring: MiniMapWhisperRing Chat Ring: MiniMapChatRing Shout Ring: MiniMapShoutRing Each ring colour can be customised through the following Debug Settings: Whisper ring: MiniMapWhisperRingColor Chat Ring: MiniMapChatRingColor Shout Ring: MiniMapShoutRingColor The following Debug Setting is used to enable/disable all the rings at once: MiniMapChatRings
This commit is contained in:
@@ -89,6 +89,9 @@ 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;
|
||||
|
||||
LLNetMap::LLNetMap(const std::string& name) :
|
||||
LLPanel(name),
|
||||
mScale(128.f),
|
||||
@@ -112,6 +115,10 @@ LLNetMap::LLNetMap(const std::string& name) :
|
||||
(new LLCheckCenterMap())->registerListener(this, "MiniMap.CheckCenter");
|
||||
(new LLRotateMap())->registerListener(this, "MiniMap.Rotate");
|
||||
(new LLCheckRotateMap())->registerListener(this, "MiniMap.CheckRotate");
|
||||
(new LLChatRings())->registerListener(this, "MiniMap.ChatRings");
|
||||
(new LLWhisperRing())->registerListener(this, "MiniMap.WhisperRing");
|
||||
(new LLChatRing())->registerListener(this, "MiniMap.ChatRing");
|
||||
(new LLShoutRing())->registerListener(this, "MiniMap.ShoutRing");
|
||||
(new LLStopTracking())->registerListener(this, "MiniMap.StopTracking");
|
||||
(new LLEnableTracking())->registerListener(this, "MiniMap.EnableTracking");
|
||||
(new LLShowAgentProfile())->registerListener(this, "MiniMap.ShowProfile");
|
||||
@@ -194,6 +201,10 @@ void LLNetMap::draw()
|
||||
{
|
||||
static LLFrameTimer map_timer;
|
||||
|
||||
static const LLCachedControl<LLColor4> map_whisper_ring_color("MiniMapWhisperRingColor", LLColor4(0.f,1.f,0.f,0.5f));
|
||||
static const LLCachedControl<LLColor4> map_chat_ring_color("MiniMapChatRingColor", LLColor4(0.f,0.f,1.f,0.5f));
|
||||
static const LLCachedControl<LLColor4> map_shout_ring_color("MiniMapShoutRingColor", LLColor4(1.f,0.f,0.f,0.5f));
|
||||
|
||||
if (mObjectImagep.isNull())
|
||||
{
|
||||
createObjectImage();
|
||||
@@ -488,6 +499,18 @@ void LLNetMap::draw()
|
||||
dot_width,
|
||||
dot_width);
|
||||
|
||||
// Draw chat range ring(s)
|
||||
//static LLUICachedControl<bool> chat_rings("MiniMapChatRings");
|
||||
static LLUICachedControl<bool> whisper_ring("MiniMapWhisperRing");
|
||||
static LLUICachedControl<bool> chat_ring("MiniMapChatRing");
|
||||
static LLUICachedControl<bool> shout_ring("MiniMapShoutRing");
|
||||
if(whisper_ring)
|
||||
drawRing(LLWorld::getInstance()->getWhisperDistance(), pos_map, map_whisper_ring_color);
|
||||
if(chat_ring)
|
||||
drawRing(LLWorld::getInstance()->getSayDistance(), pos_map, map_chat_ring_color);
|
||||
if(shout_ring)
|
||||
drawRing(LLWorld::getInstance()->getShoutDistance(), pos_map, map_shout_ring_color);
|
||||
|
||||
// Draw frustum
|
||||
// <FS:CR> Aurora Sim
|
||||
//F32 meters_to_pixels = mScale/ LLWorld::getInstance()->getRegionWidthInMeters();
|
||||
@@ -584,6 +607,22 @@ LLVector3 LLNetMap::globalPosToView(const LLVector3d& global_pos, BOOL rotated)
|
||||
return pos_local;
|
||||
}
|
||||
|
||||
void LLNetMap::drawRing(const F32 radius, const LLVector3 pos_map, const LLColor4& color)
|
||||
|
||||
{
|
||||
// <FS:CR> Aurora Sim
|
||||
F32 meters_to_pixels = mScale / LLWorld::getInstance()->getRegionWidthInMeters();
|
||||
//F32 meters_to_pixels = mScale / REGION_WIDTH_METERS;
|
||||
// </FS:CR> Aurora Sim
|
||||
F32 radius_pixels = radius * meters_to_pixels;
|
||||
|
||||
glMatrixMode(GL_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 )
|
||||
{
|
||||
@@ -1137,6 +1176,67 @@ bool LLNetMap::LLCheckRotateMap::handleEvent(LLPointer<LLEvent> event, const LLS
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LLNetMap::LLChatRings::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
BOOL all_enabled = gSavedSettings.getBOOL("MiniMapChatRings");
|
||||
gSavedSettings.setBOOL("MiniMapChatRings", !all_enabled);
|
||||
gSavedSettings.setBOOL("MiniMapWhisperRing", !all_enabled);
|
||||
gSavedSettings.setBOOL("MiniMapChatRing", !all_enabled);
|
||||
gSavedSettings.setBOOL("MiniMapShoutRing", !all_enabled);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LLNetMap::LLWhisperRing::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
BOOL all_enabled = gSavedSettings.getBOOL("MiniMapChatRings");
|
||||
BOOL whisper_enabled = gSavedSettings.getBOOL("MiniMapWhisperRing");
|
||||
BOOL chat_enabled = gSavedSettings.getBOOL("MiniMapChatRing");
|
||||
BOOL shout_enabled = gSavedSettings.getBOOL("MiniMapShoutRing");
|
||||
|
||||
gSavedSettings.setBOOL("MiniMapWhisperRing", !whisper_enabled);
|
||||
|
||||
if(all_enabled)
|
||||
gSavedSettings.setBOOL("MiniMapChatRings", !all_enabled);
|
||||
else if(!whisper_enabled && chat_enabled && shout_enabled)
|
||||
gSavedSettings.setBOOL("MiniMapChatRings", TRUE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LLNetMap::LLChatRing::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
BOOL all_enabled = gSavedSettings.getBOOL("MiniMapChatRings");
|
||||
BOOL whisper_enabled = gSavedSettings.getBOOL("MiniMapWhisperRing");
|
||||
BOOL chat_enabled = gSavedSettings.getBOOL("MiniMapChatRing");
|
||||
BOOL shout_enabled = gSavedSettings.getBOOL("MiniMapShoutRing");
|
||||
|
||||
gSavedSettings.setBOOL("MiniMapChatRing", !chat_enabled);
|
||||
|
||||
if(all_enabled)
|
||||
gSavedSettings.setBOOL("MiniMapChatRings", !all_enabled);
|
||||
else if(whisper_enabled && !chat_enabled && shout_enabled)
|
||||
gSavedSettings.setBOOL("MiniMapChatRings", TRUE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LLNetMap::LLShoutRing::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
BOOL all_enabled = gSavedSettings.getBOOL("MiniMapChatRings");
|
||||
BOOL whisper_enabled = gSavedSettings.getBOOL("MiniMapWhisperRing");
|
||||
BOOL chat_enabled = gSavedSettings.getBOOL("MiniMapChatRing");
|
||||
BOOL shout_enabled = gSavedSettings.getBOOL("MiniMapShoutRing");
|
||||
|
||||
gSavedSettings.setBOOL("MiniMapShoutRing", !shout_enabled);
|
||||
|
||||
if(all_enabled)
|
||||
gSavedSettings.setBOOL("MiniMapChatRings", !all_enabled);
|
||||
else if(whisper_enabled && chat_enabled && !shout_enabled)
|
||||
gSavedSettings.setBOOL("MiniMapChatRings", TRUE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LLNetMap::LLStopTracking::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLTracker::stopTracking(false);
|
||||
|
||||
Reference in New Issue
Block a user