aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llworldmapview.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:42 -0500
committerJacek Antonelli2008-08-15 23:45:42 -0500
commitce28e056c20bf2723f565bbf464b87781ec248a2 (patch)
treeef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/llworldmapview.cpp
parentSecond Life viewer sources 1.19.1.4b (diff)
downloadmeta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/newview/llworldmapview.cpp')
-rw-r--r--linden/indra/newview/llworldmapview.cpp253
1 files changed, 106 insertions, 147 deletions
diff --git a/linden/indra/newview/llworldmapview.cpp b/linden/indra/newview/llworldmapview.cpp
index 2fac51a..ccf5903 100644
--- a/linden/indra/newview/llworldmapview.cpp
+++ b/linden/indra/newview/llworldmapview.cpp
@@ -59,7 +59,6 @@
59#include "llviewerparceloverlay.h" 59#include "llviewerparceloverlay.h"
60#include "llviewerregion.h" 60#include "llviewerregion.h"
61#include "llviewerwindow.h" 61#include "llviewerwindow.h"
62#include "llworld.h"
63#include "llworldmap.h" 62#include "llworldmap.h"
64#include "llappviewer.h" // Only for constants! 63#include "llappviewer.h" // Only for constants!
65 64
@@ -70,24 +69,24 @@ const S32 SCROLL_HINT_WIDTH = 65;
70const F32 BIG_DOT_RADIUS = 5.f; 69const F32 BIG_DOT_RADIUS = 5.f;
71BOOL LLWorldMapView::sHandledLastClick = FALSE; 70BOOL LLWorldMapView::sHandledLastClick = FALSE;
72 71
73LLPointer<LLViewerImage> LLWorldMapView::sAvatarYouSmallImage = NULL; 72LLUIImagePtr LLWorldMapView::sAvatarYouSmallImage = NULL;
74LLPointer<LLViewerImage> LLWorldMapView::sAvatarSmallImage = NULL; 73LLUIImagePtr LLWorldMapView::sAvatarSmallImage = NULL;
75LLPointer<LLViewerImage> LLWorldMapView::sAvatarLargeImage = NULL; 74LLUIImagePtr LLWorldMapView::sAvatarLargeImage = NULL;
76LLPointer<LLViewerImage> LLWorldMapView::sAvatarAboveImage = NULL; 75LLUIImagePtr LLWorldMapView::sAvatarAboveImage = NULL;
77LLPointer<LLViewerImage> LLWorldMapView::sAvatarBelowImage = NULL; 76LLUIImagePtr LLWorldMapView::sAvatarBelowImage = NULL;
78 77
79LLPointer<LLViewerImage> LLWorldMapView::sTelehubImage = NULL; 78LLUIImagePtr LLWorldMapView::sTelehubImage = NULL;
80LLPointer<LLViewerImage> LLWorldMapView::sInfohubImage = NULL; 79LLUIImagePtr LLWorldMapView::sInfohubImage = NULL;
81LLPointer<LLViewerImage> LLWorldMapView::sHomeImage = NULL; 80LLUIImagePtr LLWorldMapView::sHomeImage = NULL;
82LLPointer<LLViewerImage> LLWorldMapView::sEventImage = NULL; 81LLUIImagePtr LLWorldMapView::sEventImage = NULL;
83LLPointer<LLViewerImage> LLWorldMapView::sEventMatureImage = NULL; 82LLUIImagePtr LLWorldMapView::sEventMatureImage = NULL;
84 83
85LLPointer<LLViewerImage> LLWorldMapView::sTrackCircleImage = NULL; 84LLUIImagePtr LLWorldMapView::sTrackCircleImage = NULL;
86LLPointer<LLViewerImage> LLWorldMapView::sTrackArrowImage = NULL; 85LLUIImagePtr LLWorldMapView::sTrackArrowImage = NULL;
87 86
88LLPointer<LLViewerImage> LLWorldMapView::sClassifiedsImage = NULL; 87LLUIImagePtr LLWorldMapView::sClassifiedsImage = NULL;
89LLPointer<LLViewerImage> LLWorldMapView::sPopularImage = NULL; 88LLUIImagePtr LLWorldMapView::sPopularImage = NULL;
90LLPointer<LLViewerImage> LLWorldMapView::sForSaleImage = NULL; 89LLUIImagePtr LLWorldMapView::sForSaleImage = NULL;
91 90
92F32 LLWorldMapView::sThresholdA = 48.f; 91F32 LLWorldMapView::sThresholdA = 48.f;
93F32 LLWorldMapView::sThresholdB = 96.f; 92F32 LLWorldMapView::sThresholdB = 96.f;
@@ -114,53 +113,21 @@ void LLWorldMapView::initClass()
114{ 113{
115 LLUUID image_id; 114 LLUUID image_id;
116 115
117 image_id.set( gViewerArt.getString("map_avatar_you_8.tga") ); 116 sAvatarYouSmallImage = LLUI::getUIImage("map_avatar_you_8.tga");
118 sAvatarYouSmallImage = gImageList.getImage( image_id, MIPMAP_FALSE, TRUE); 117 sAvatarSmallImage = LLUI::getUIImage("map_avatar_8.tga");
119 118 sAvatarLargeImage = LLUI::getUIImage("map_avatar_16.tga");
120 image_id.set( gViewerArt.getString("map_avatar_8.tga") ); 119 sAvatarAboveImage = LLUI::getUIImage("map_avatar_above_8.tga");
121 sAvatarSmallImage = gImageList.getImage( image_id, MIPMAP_FALSE, TRUE); 120 sAvatarBelowImage = LLUI::getUIImage("map_avatar_below_8.tga");
122 121 sHomeImage = LLUI::getUIImage("map_home.tga");
123 image_id.set( gViewerArt.getString("map_avatar_16.tga") ); 122 sTelehubImage = LLUI::getUIImage("map_telehub.tga");
124 sAvatarLargeImage = gImageList.getImage( image_id, MIPMAP_FALSE, TRUE); 123 sInfohubImage = LLUI::getUIImage("map_infohub.tga");
125 124 sEventImage = LLUI::getUIImage("map_event.tga");
126 image_id.set( gViewerArt.getString("map_avatar_above_8.tga") ); 125 sEventMatureImage = LLUI::getUIImage("map_event_mature.tga");
127 sAvatarAboveImage = gImageList.getImage( image_id, MIPMAP_FALSE, TRUE); 126 sTrackCircleImage = LLUI::getUIImage("map_track_16.tga");
128 127 sTrackArrowImage = LLUI::getUIImage("direction_arrow.tga");
129 image_id.set( gViewerArt.getString("map_avatar_below_8.tga") ); 128 sClassifiedsImage = LLUI::getUIImage("icon_top_pick.tga");
130 sAvatarBelowImage = gImageList.getImage( image_id, MIPMAP_FALSE, TRUE); 129 sPopularImage = LLUI::getUIImage("icon_popular.tga");
131 130 sForSaleImage = LLUI::getUIImage("icon_for_sale.tga");
132 image_id.set( gViewerArt.getString("map_home.tga") );
133 sHomeImage = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE);
134
135 image_id.set( gViewerArt.getString("map_telehub.tga") );
136 sTelehubImage = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE);
137
138 image_id.set( gViewerArt.getString("map_infohub.tga") );
139 sInfohubImage = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE);
140
141 image_id.set( gViewerArt.getString("map_event.tga") );
142 sEventImage = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE);
143
144 image_id.set( gViewerArt.getString("map_event_mature.tga") );
145 sEventMatureImage = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE);
146
147 image_id.set( gViewerArt.getString("map_track_16.tga") );
148 sTrackCircleImage = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE);
149
150 image_id.set( gViewerArt.getString("direction_arrow.tga") );
151 sTrackArrowImage = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE);
152 // Make sure tracker arrow doesn't wrap
153 sTrackArrowImage->bindTexture(0);
154 sTrackArrowImage->setClamp(TRUE, TRUE);
155
156 image_id.set( gViewerArt.getString("icon_top_pick.tga") );
157 sClassifiedsImage = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE);
158
159 image_id.set( gViewerArt.getString("icon_popular.tga") );
160 sPopularImage = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE);
161
162 image_id.set( gViewerArt.getString("icon_for_sale.tga") );
163 sForSaleImage = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE);
164} 131}
165 132
166// static 133// static
@@ -312,11 +279,6 @@ BOOL is_agent_in_region(LLViewerRegion* region, LLSimInfo* info)
312 279
313void LLWorldMapView::draw() 280void LLWorldMapView::draw()
314{ 281{
315 if (!getVisible() || !gWorldPointer)
316 {
317 return;
318 }
319
320 LLTextureView::clearDebugImages(); 282 LLTextureView::clearDebugImages();
321 283
322 F64 current_time = LLTimer::getElapsedSeconds(); 284 F64 current_time = LLTimer::getElapsedSeconds();
@@ -356,13 +318,13 @@ void LLWorldMapView::draw()
356 F32 layer_alpha = 1.f; 318 F32 layer_alpha = 1.f;
357 319
358 // Draw one image per layer 320 // Draw one image per layer
359 for (U32 layer_idx=0; layer_idx<gWorldMap->mMapLayers[gWorldMap->mCurrentMap].size(); ++layer_idx) 321 for (U32 layer_idx=0; layer_idx<LLWorldMap::getInstance()->mMapLayers[LLWorldMap::getInstance()->mCurrentMap].size(); ++layer_idx)
360 { 322 {
361 if (!gWorldMap->mMapLayers[gWorldMap->mCurrentMap][layer_idx].LayerDefined) 323 if (!LLWorldMap::getInstance()->mMapLayers[LLWorldMap::getInstance()->mCurrentMap][layer_idx].LayerDefined)
362 { 324 {
363 continue; 325 continue;
364 } 326 }
365 LLWorldMapLayer *layer = &gWorldMap->mMapLayers[gWorldMap->mCurrentMap][layer_idx]; 327 LLWorldMapLayer *layer = &LLWorldMap::getInstance()->mMapLayers[LLWorldMap::getInstance()->mCurrentMap][layer_idx];
366 LLViewerImage *current_image = layer->LayerImage; 328 LLViewerImage *current_image = layer->LayerImage;
367#if 1 || LL_RELEASE_FOR_DOWNLOAD 329#if 1 || LL_RELEASE_FOR_DOWNLOAD
368 if (current_image->isMissingAsset()) 330 if (current_image->isMissingAsset())
@@ -400,7 +362,7 @@ void LLWorldMapView::draw()
400 } 362 }
401 363
402 current_image->setBoostLevel(LLViewerImage::BOOST_MAP_LAYER); 364 current_image->setBoostLevel(LLViewerImage::BOOST_MAP_LAYER);
403 current_image->setKnownDrawSize(llround(pix_width), llround(pix_height)); 365 current_image->setKnownDrawSize(llround(pix_width * LLUI::sGLScaleFactor.mV[VX]), llround(pix_height * LLUI::sGLScaleFactor.mV[VY]));
404 366
405 if (!current_image->getHasGLTexture()) 367 if (!current_image->getHasGLTexture())
406 { 368 {
@@ -455,15 +417,15 @@ void LLWorldMapView::draw()
455 F32 sim_alpha = 1.f; 417 F32 sim_alpha = 1.f;
456 418
457 // Draw one image per region, centered on the camera position. 419 // Draw one image per region, centered on the camera position.
458 for (LLWorldMap::sim_info_map_t::iterator it = gWorldMap->mSimInfoMap.begin(); 420 for (LLWorldMap::sim_info_map_t::iterator it = LLWorldMap::getInstance()->mSimInfoMap.begin();
459 it != gWorldMap->mSimInfoMap.end(); ++it) 421 it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it)
460 { 422 {
461 U64 handle = (*it).first; 423 U64 handle = (*it).first;
462 LLSimInfo* info = (*it).second; 424 LLSimInfo* info = (*it).second;
463 425
464 if (info->mCurrentImage.isNull()) 426 if (info->mCurrentImage.isNull())
465 { 427 {
466 info->mCurrentImage = gImageList.getImage(info->mMapImageID[gWorldMap->mCurrentMap], MIPMAP_TRUE, FALSE); 428 info->mCurrentImage = gImageList.getImage(info->mMapImageID[LLWorldMap::getInstance()->mCurrentMap], MIPMAP_TRUE, FALSE);
467 } 429 }
468 if (info->mOverlayImage.isNull() && info->mMapImageID[2].notNull()) 430 if (info->mOverlayImage.isNull() && info->mMapImageID[2].notNull())
469 { 431 {
@@ -544,7 +506,7 @@ void LLWorldMapView::draw()
544 // See if the agents need updating 506 // See if the agents need updating
545 if (current_time - info->mAgentsUpdateTime > AGENTS_UPDATE_TIME) 507 if (current_time - info->mAgentsUpdateTime > AGENTS_UPDATE_TIME)
546 { 508 {
547 gWorldMap->sendItemRequest(MAP_ITEM_AGENT_LOCATIONS, info->mHandle); 509 LLWorldMap::getInstance()->sendItemRequest(MAP_ITEM_AGENT_LOCATIONS, info->mHandle);
548 info->mAgentsUpdateTime = current_time; 510 info->mAgentsUpdateTime = current_time;
549 } 511 }
550 512
@@ -555,12 +517,12 @@ void LLWorldMapView::draw()
555 517
556 S32 draw_size = llround(gMapScale); 518 S32 draw_size = llround(gMapScale);
557 simimage->setBoostLevel(LLViewerImage::BOOST_MAP); 519 simimage->setBoostLevel(LLViewerImage::BOOST_MAP);
558 simimage->setKnownDrawSize(draw_size, draw_size); 520 simimage->setKnownDrawSize(llround(draw_size * LLUI::sGLScaleFactor.mV[VX]), llround(draw_size * LLUI::sGLScaleFactor.mV[VY]));
559 521
560 if (overlayimage) 522 if (overlayimage)
561 { 523 {
562 overlayimage->setBoostLevel(LLViewerImage::BOOST_MAP); 524 overlayimage->setBoostLevel(LLViewerImage::BOOST_MAP);
563 overlayimage->setKnownDrawSize(draw_size, draw_size); 525 overlayimage->setKnownDrawSize(llround(draw_size * LLUI::sGLScaleFactor.mV[VX]), llround(draw_size * LLUI::sGLScaleFactor.mV[VY]));
564 } 526 }
565 527
566// LLTextureView::addDebugImage(simimage); 528// LLTextureView::addDebugImage(simimage);
@@ -717,13 +679,13 @@ void LLWorldMapView::draw()
717 // Infohubs 679 // Infohubs
718 if (gSavedSettings.getBOOL("MapShowInfohubs")) //(gMapScale >= sThresholdB) 680 if (gSavedSettings.getBOOL("MapShowInfohubs")) //(gMapScale >= sThresholdB)
719 { 681 {
720 drawGenericItems(gWorldMap->mInfohubs, sInfohubImage); 682 drawGenericItems(LLWorldMap::getInstance()->mInfohubs, sInfohubImage);
721 } 683 }
722 684
723 // Telehubs 685 // Telehubs
724 if (gSavedSettings.getBOOL("MapShowTelehubs")) //(gMapScale >= sThresholdB) 686 if (gSavedSettings.getBOOL("MapShowTelehubs")) //(gMapScale >= sThresholdB)
725 { 687 {
726 drawGenericItems(gWorldMap->mTelehubs, sTelehubImage); 688 drawGenericItems(LLWorldMap::getInstance()->mTelehubs, sTelehubImage);
727 } 689 }
728 690
729 // Home Sweet Home 691 // Home Sweet Home
@@ -735,17 +697,17 @@ void LLWorldMapView::draw()
735 697
736 if (gSavedSettings.getBOOL("MapShowLandForSale")) 698 if (gSavedSettings.getBOOL("MapShowLandForSale"))
737 { 699 {
738 drawGenericItems(gWorldMap->mLandForSale, sForSaleImage); 700 drawGenericItems(LLWorldMap::getInstance()->mLandForSale, sForSaleImage);
739 } 701 }
740 702
741 if (gSavedSettings.getBOOL("MapShowClassifieds")) 703 if (gSavedSettings.getBOOL("MapShowClassifieds"))
742 { 704 {
743 drawGenericItems(gWorldMap->mClassifieds, sClassifiedsImage); 705 drawGenericItems(LLWorldMap::getInstance()->mClassifieds, sClassifiedsImage);
744 } 706 }
745 707
746 if (gSavedSettings.getBOOL("MapShowPopular")) 708 if (gSavedSettings.getBOOL("MapShowPopular"))
747 { 709 {
748 drawGenericItems(gWorldMap->mPopular, sPopularImage); 710 drawGenericItems(LLWorldMap::getInstance()->mPopular, sPopularImage);
749 } 711 }
750 712
751 if (gSavedSettings.getBOOL("MapShowEvents")) 713 if (gSavedSettings.getBOOL("MapShowEvents"))
@@ -795,20 +757,20 @@ void LLWorldMapView::draw()
795 drawTracking( pos_global, gTrackColor, TRUE, LLTracker::getLabel(), LLTracker::getToolTip() ); 757 drawTracking( pos_global, gTrackColor, TRUE, LLTracker::getLabel(), LLTracker::getToolTip() );
796 } 758 }
797 } 759 }
798 else if (gWorldMap->mIsTrackingUnknownLocation) 760 else if (LLWorldMap::getInstance()->mIsTrackingUnknownLocation)
799 { 761 {
800 if (gWorldMap->mInvalidLocation) 762 if (LLWorldMap::getInstance()->mInvalidLocation)
801 { 763 {
802 // We know this location to be invalid 764 // We know this location to be invalid
803 LLColor4 loading_color(0.0, 0.5, 1.0, 1.0); 765 LLColor4 loading_color(0.0, 0.5, 1.0, 1.0);
804 drawTracking( gWorldMap->mUnknownLocation, loading_color, TRUE, "Invalid Location", ""); 766 drawTracking( LLWorldMap::getInstance()->mUnknownLocation, loading_color, TRUE, "Invalid Location", "");
805 } 767 }
806 else 768 else
807 { 769 {
808 double value = fmod(current_time, 2); 770 double value = fmod(current_time, 2);
809 value = 0.5 + 0.5*cos(value * 3.14159f); 771 value = 0.5 + 0.5*cos(value * 3.14159f);
810 LLColor4 loading_color(0.0, F32(value/2), F32(value), 1.0); 772 LLColor4 loading_color(0.0, F32(value/2), F32(value), 1.0);
811 drawTracking( gWorldMap->mUnknownLocation, loading_color, TRUE, "Loading...", ""); 773 drawTracking( LLWorldMap::getInstance()->mUnknownLocation, loading_color, TRUE, "Loading...", "");
812 } 774 }
813 } 775 }
814#endif 776#endif
@@ -828,21 +790,21 @@ void LLWorldMapView::draw()
828void LLWorldMapView::setVisible(BOOL visible) 790void LLWorldMapView::setVisible(BOOL visible)
829{ 791{
830 LLPanel::setVisible(visible); 792 LLPanel::setVisible(visible);
831 if (!visible && gWorldMap) 793 if (!visible)
832 { 794 {
833 for (S32 map = 0; map < MAP_SIM_IMAGE_TYPES; map++) 795 for (S32 map = 0; map < MAP_SIM_IMAGE_TYPES; map++)
834 { 796 {
835 for (U32 layer_idx=0; layer_idx<gWorldMap->mMapLayers[map].size(); ++layer_idx) 797 for (U32 layer_idx=0; layer_idx<LLWorldMap::getInstance()->mMapLayers[map].size(); ++layer_idx)
836 { 798 {
837 if (gWorldMap->mMapLayers[map][layer_idx].LayerDefined) 799 if (LLWorldMap::getInstance()->mMapLayers[map][layer_idx].LayerDefined)
838 { 800 {
839 LLWorldMapLayer *layer = &gWorldMap->mMapLayers[map][layer_idx]; 801 LLWorldMapLayer *layer = &LLWorldMap::getInstance()->mMapLayers[map][layer_idx];
840 layer->LayerImage->setBoostLevel(0); 802 layer->LayerImage->setBoostLevel(0);
841 } 803 }
842 } 804 }
843 } 805 }
844 for (LLWorldMap::sim_info_map_t::iterator it = gWorldMap->mSimInfoMap.begin(); 806 for (LLWorldMap::sim_info_map_t::iterator it = LLWorldMap::getInstance()->mSimInfoMap.begin();
845 it != gWorldMap->mSimInfoMap.end(); ++it) 807 it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it)
846 { 808 {
847 LLSimInfo* info = (*it).second; 809 LLSimInfo* info = (*it).second;
848 if (info->mCurrentImage.notNull()) 810 if (info->mCurrentImage.notNull())
@@ -857,7 +819,7 @@ void LLWorldMapView::setVisible(BOOL visible)
857 } 819 }
858} 820}
859 821
860void LLWorldMapView::drawGenericItems(const LLWorldMap::item_info_list_t& items, LLPointer<LLViewerImage> image) 822void LLWorldMapView::drawGenericItems(const LLWorldMap::item_info_list_t& items, LLUIImagePtr image)
861{ 823{
862 LLWorldMap::item_info_list_t::const_iterator e; 824 LLWorldMap::item_info_list_t::const_iterator e;
863 for (e = items.begin(); e != items.end(); ++e) 825 for (e = items.begin(); e != items.end(); ++e)
@@ -866,30 +828,28 @@ void LLWorldMapView::drawGenericItems(const LLWorldMap::item_info_list_t& items,
866 } 828 }
867} 829}
868 830
869void LLWorldMapView::drawGenericItem(const LLItemInfo& item, LLPointer<LLViewerImage> image) 831void LLWorldMapView::drawGenericItem(const LLItemInfo& item, LLUIImagePtr image)
870{ 832{
871 drawImage(item.mPosGlobal, image); 833 drawImage(item.mPosGlobal, image);
872} 834}
873 835
874 836
875void LLWorldMapView::drawImage(const LLVector3d& global_pos, LLPointer<LLViewerImage> image, const LLColor4& color) 837void LLWorldMapView::drawImage(const LLVector3d& global_pos, LLUIImagePtr image, const LLColor4& color)
876{ 838{
877 LLVector3 pos_map = globalPosToView( global_pos ); 839 LLVector3 pos_map = globalPosToView( global_pos );
878 gl_draw_image(llround(pos_map.mV[VX] - image->getWidth() /2.f), 840 image->draw(llround(pos_map.mV[VX] - image->getWidth() /2.f),
879 llround(pos_map.mV[VY] - image->getHeight()/2.f), 841 llround(pos_map.mV[VY] - image->getHeight()/2.f),
880 image, 842 color);
881 color);
882} 843}
883 844
884void LLWorldMapView::drawImageStack(const LLVector3d& global_pos, LLPointer<LLViewerImage> image, U32 count, F32 offset, const LLColor4& color) 845void LLWorldMapView::drawImageStack(const LLVector3d& global_pos, LLUIImagePtr image, U32 count, F32 offset, const LLColor4& color)
885{ 846{
886 LLVector3 pos_map = globalPosToView( global_pos ); 847 LLVector3 pos_map = globalPosToView( global_pos );
887 for(U32 i=0; i<count; i++) 848 for(U32 i=0; i<count; i++)
888 { 849 {
889 gl_draw_image(llround(pos_map.mV[VX] - image->getWidth() /2.f), 850 image->draw(llround(pos_map.mV[VX] - image->getWidth() /2.f),
890 llround(pos_map.mV[VY] - image->getHeight()/2.f + i*offset), 851 llround(pos_map.mV[VY] - image->getHeight()/2.f + i*offset),
891 image, 852 color);
892 color);
893 } 853 }
894} 854}
895 855
@@ -901,13 +861,13 @@ void LLWorldMapView::drawAgents()
901 for (handle_list_t::iterator iter = mVisibleRegions.begin(); iter != mVisibleRegions.end(); ++iter) 861 for (handle_list_t::iterator iter = mVisibleRegions.begin(); iter != mVisibleRegions.end(); ++iter)
902 { 862 {
903 U64 handle = *iter; 863 U64 handle = *iter;
904 LLSimInfo* siminfo = gWorldMap->simInfoFromHandle(handle); 864 LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle);
905 if (siminfo && (siminfo->mAccess == SIM_ACCESS_DOWN)) 865 if (siminfo && (siminfo->mAccess == SIM_ACCESS_DOWN))
906 { 866 {
907 continue; 867 continue;
908 } 868 }
909 LLWorldMap::agent_list_map_t::iterator counts_iter = gWorldMap->mAgentLocationsMap.find(handle); 869 LLWorldMap::agent_list_map_t::iterator counts_iter = LLWorldMap::getInstance()->mAgentLocationsMap.find(handle);
910 if (siminfo && siminfo->mShowAgentLocations && counts_iter != gWorldMap->mAgentLocationsMap.end()) 870 if (siminfo && siminfo->mShowAgentLocations && counts_iter != LLWorldMap::getInstance()->mAgentLocationsMap.end())
911 { 871 {
912 // Show Individual agents (or little stacks where real agents are) 872 // Show Individual agents (or little stacks where real agents are)
913 LLWorldMap::item_info_list_t& agentcounts = counts_iter->second; 873 LLWorldMap::item_info_list_t& agentcounts = counts_iter->second;
@@ -922,12 +882,12 @@ void LLWorldMapView::drawAgents()
922 //LLColor4 color = (agent_count == 1 && is_agent_friend(info.mID)) ? gFriendMapColor : gAvatarMapColor; 882 //LLColor4 color = (agent_count == 1 && is_agent_friend(info.mID)) ? gFriendMapColor : gAvatarMapColor;
923 drawImageStack(info.mPosGlobal, sAvatarSmallImage, agent_count, 3.f, gAvatarMapColor); 883 drawImageStack(info.mPosGlobal, sAvatarSmallImage, agent_count, 3.f, gAvatarMapColor);
924 } 884 }
925 gWorldMap->mNumAgents[handle] = sim_agent_count; // override mNumAgents for this sim 885 LLWorldMap::getInstance()->mNumAgents[handle] = sim_agent_count; // override mNumAgents for this sim
926 } 886 }
927 else 887 else
928 { 888 {
929 // Show agent 'stack' at center of sim 889 // Show agent 'stack' at center of sim
930 S32 num_agents = gWorldMap->mNumAgents[handle]; 890 S32 num_agents = LLWorldMap::getInstance()->mNumAgents[handle];
931 if (num_agents > 0) 891 if (num_agents > 0)
932 { 892 {
933 LLVector3d region_center = from_region_handle(handle); 893 LLVector3d region_center = from_region_handle(handle);
@@ -948,7 +908,7 @@ void LLWorldMapView::drawEvents()
948 908
949 // First the non-selected events 909 // First the non-selected events
950 LLWorldMap::item_info_list_t::const_iterator e; 910 LLWorldMap::item_info_list_t::const_iterator e;
951 for (e = gWorldMap->mPGEvents.begin(); e != gWorldMap->mPGEvents.end(); ++e) 911 for (e = LLWorldMap::getInstance()->mPGEvents.begin(); e != LLWorldMap::getInstance()->mPGEvents.end(); ++e)
952 { 912 {
953 if (!e->mSelected) 913 if (!e->mSelected)
954 { 914 {
@@ -957,7 +917,7 @@ void LLWorldMapView::drawEvents()
957 } 917 }
958 if (show_mature) 918 if (show_mature)
959 { 919 {
960 for (e = gWorldMap->mMatureEvents.begin(); e != gWorldMap->mMatureEvents.end(); ++e) 920 for (e = LLWorldMap::getInstance()->mMatureEvents.begin(); e != LLWorldMap::getInstance()->mMatureEvents.end(); ++e)
961 { 921 {
962 if (!e->mSelected) 922 if (!e->mSelected)
963 { 923 {
@@ -967,7 +927,7 @@ void LLWorldMapView::drawEvents()
967 } 927 }
968 928
969 // Then the selected events 929 // Then the selected events
970 for (e = gWorldMap->mPGEvents.begin(); e != gWorldMap->mPGEvents.end(); ++e) 930 for (e = LLWorldMap::getInstance()->mPGEvents.begin(); e != LLWorldMap::getInstance()->mPGEvents.end(); ++e)
971 { 931 {
972 if (e->mSelected) 932 if (e->mSelected)
973 { 933 {
@@ -976,7 +936,7 @@ void LLWorldMapView::drawEvents()
976 } 936 }
977 if (show_mature) 937 if (show_mature)
978 { 938 {
979 for (e = gWorldMap->mMatureEvents.begin(); e != gWorldMap->mMatureEvents.end(); ++e) 939 for (e = LLWorldMap::getInstance()->mMatureEvents.begin(); e != LLWorldMap::getInstance()->mMatureEvents.end(); ++e)
980 { 940 {
981 if (e->mSelected) 941 if (e->mSelected)
982 { 942 {
@@ -992,8 +952,8 @@ void LLWorldMapView::drawFrustum()
992 // Draw frustum 952 // Draw frustum
993 F32 meters_to_pixels = gMapScale/ REGION_WIDTH_METERS; 953 F32 meters_to_pixels = gMapScale/ REGION_WIDTH_METERS;
994 954
995 F32 horiz_fov = gCamera->getView() * gCamera->getAspect(); 955 F32 horiz_fov = LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect();
996 F32 far_clip_meters = gCamera->getFar(); 956 F32 far_clip_meters = LLViewerCamera::getInstance()->getFar();
997 F32 far_clip_pixels = far_clip_meters * meters_to_pixels; 957 F32 far_clip_pixels = far_clip_meters * meters_to_pixels;
998 958
999 F32 half_width_meters = far_clip_meters * tan( horiz_fov / 2 ); 959 F32 half_width_meters = far_clip_meters * tan( horiz_fov / 2 );
@@ -1007,7 +967,7 @@ void LLWorldMapView::drawFrustum()
1007 // Since we don't rotate the map, we have to rotate the frustum. 967 // Since we don't rotate the map, we have to rotate the frustum.
1008 gGL.pushMatrix(); 968 gGL.pushMatrix();
1009 gGL.translatef( ctr_x, ctr_y, 0 ); 969 gGL.translatef( ctr_x, ctr_y, 0 );
1010 glRotatef( atan2( gCamera->getAtAxis().mV[VX], gCamera->getAtAxis().mV[VY] ) * RAD_TO_DEG, 0.f, 0.f, -1.f); 970 glRotatef( atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ) * RAD_TO_DEG, 0.f, 0.f, -1.f);
1011 971
1012 // Draw triangle with more alpha in far pixels to make it 972 // Draw triangle with more alpha in far pixels to make it
1013 // fade out in distance. 973 // fade out in distance.
@@ -1138,7 +1098,7 @@ BOOL LLWorldMapView::handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_
1138{ 1098{
1139 LLVector3d pos_global = viewPosToGlobal(x, y); 1099 LLVector3d pos_global = viewPosToGlobal(x, y);
1140 1100
1141 LLSimInfo* info = gWorldMap->simInfoFromPosGlobal(pos_global); 1101 LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global);
1142 if (info) 1102 if (info)
1143 { 1103 {
1144 LLViewerRegion *region = gAgent.getRegion(); 1104 LLViewerRegion *region = gAgent.getRegion();
@@ -1150,7 +1110,7 @@ BOOL LLWorldMapView::handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_
1150 1110
1151 if (info->mAccess != SIM_ACCESS_DOWN) 1111 if (info->mAccess != SIM_ACCESS_DOWN)
1152 { 1112 {
1153 S32 agent_count = gWorldMap->mNumAgents[info->mHandle]; 1113 S32 agent_count = LLWorldMap::getInstance()->mNumAgents[info->mHandle];
1154 if (region && region->getHandle() == info->mHandle) 1114 if (region && region->getHandle() == info->mHandle)
1155 { 1115 {
1156 ++agent_count; // Bump by 1 if we're here 1116 ++agent_count; // Bump by 1 if we're here
@@ -1199,15 +1159,14 @@ static void drawDot(F32 x_pixels, F32 y_pixels,
1199 const LLColor4& color, 1159 const LLColor4& color,
1200 F32 relative_z, 1160 F32 relative_z,
1201 F32 dot_radius, 1161 F32 dot_radius,
1202 LLPointer<LLViewerImage> dot_image) 1162 LLUIImagePtr dot_image)
1203{ 1163{
1204 const F32 HEIGHT_THRESHOLD = 7.f; 1164 const F32 HEIGHT_THRESHOLD = 7.f;
1205 1165
1206 if(-HEIGHT_THRESHOLD <= relative_z && relative_z <= HEIGHT_THRESHOLD) 1166 if(-HEIGHT_THRESHOLD <= relative_z && relative_z <= HEIGHT_THRESHOLD)
1207 { 1167 {
1208 gl_draw_image( llround(x_pixels) - dot_image->getWidth()/2, 1168 dot_image->draw(llround(x_pixels) - dot_image->getWidth()/2,
1209 llround(y_pixels) - dot_image->getHeight()/2, 1169 llround(y_pixels) - dot_image->getHeight()/2,
1210 dot_image,
1211 color); 1170 color);
1212 } 1171 }
1213 else 1172 else
@@ -1241,7 +1200,7 @@ void LLWorldMapView::drawAvatar(F32 x_pixels,
1241 F32 dot_radius) 1200 F32 dot_radius)
1242{ 1201{
1243 const F32 HEIGHT_THRESHOLD = 7.f; 1202 const F32 HEIGHT_THRESHOLD = 7.f;
1244 LLViewerImage* dot_image = sAvatarSmallImage; 1203 LLUIImagePtr dot_image = sAvatarSmallImage;
1245 if(relative_z < -HEIGHT_THRESHOLD) 1204 if(relative_z < -HEIGHT_THRESHOLD)
1246 { 1205 {
1247 dot_image = sAvatarBelowImage; 1206 dot_image = sAvatarBelowImage;
@@ -1250,10 +1209,10 @@ void LLWorldMapView::drawAvatar(F32 x_pixels,
1250 { 1209 {
1251 dot_image = sAvatarAboveImage; 1210 dot_image = sAvatarAboveImage;
1252 } 1211 }
1253 gl_draw_image( 1212 dot_image->draw(
1254 llround(x_pixels) - dot_image->getWidth()/2, 1213 llround(x_pixels) - dot_image->getWidth()/2,
1255 llround(y_pixels) - dot_image->getHeight()/2, 1214 llround(y_pixels) - dot_image->getHeight()/2,
1256 dot_image, color); 1215 color);
1257} 1216}
1258 1217
1259// Pass relative Z of 0 to draw at same level. 1218// Pass relative Z of 0 to draw at same level.
@@ -1447,7 +1406,7 @@ void LLWorldMapView::drawTrackingArrow(const LLRect& rect, S32 x, S32 y,
1447 sTrackingArrowY, 1406 sTrackingArrowY,
1448 arrow_size, arrow_size, 1407 arrow_size, arrow_size,
1449 RAD_TO_DEG * angle, 1408 RAD_TO_DEG * angle,
1450 sTrackArrowImage, 1409 sTrackArrowImage->getImage(),
1451 color); 1410 color);
1452} 1411}
1453 1412
@@ -1521,7 +1480,7 @@ bool LLWorldMapView::checkItemHit(S32 x, S32 y, LLItemInfo& item, LLUUID* id, bo
1521 if (y < item_y - BIG_DOT_RADIUS) return false; 1480 if (y < item_y - BIG_DOT_RADIUS) return false;
1522 if (y > item_y + BIG_DOT_RADIUS) return false; 1481 if (y > item_y + BIG_DOT_RADIUS) return false;
1523 1482
1524 LLSimInfo* sim_info = gWorldMap->simInfoFromHandle(item.mRegionHandle); 1483 LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromHandle(item.mRegionHandle);
1525 if (sim_info) 1484 if (sim_info)
1526 { 1485 {
1527 if (track) 1486 if (track)
@@ -1551,7 +1510,7 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask,
1551 // *HACK: Adjust Z values automatically for liaisons & gods so 1510 // *HACK: Adjust Z values automatically for liaisons & gods so
1552 // we swoop down when they click on the map. Sadly, the P2P 1511 // we swoop down when they click on the map. Sadly, the P2P
1553 // branch does not pay attention to this value; however, the 1512 // branch does not pay attention to this value; however, the
1554 // Distributed Messaging branch honors kt. 1513 // Distributed Messaging branch honors it.
1555 if(gAgent.isGodlike()) 1514 if(gAgent.isGodlike())
1556 { 1515 {
1557 pos_global.mdV[VZ] = 200.0; 1516 pos_global.mdV[VZ] = 200.0;
@@ -1559,30 +1518,30 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask,
1559 1518
1560 *hit_type = 0; // hit nothing 1519 *hit_type = 0; // hit nothing
1561 1520
1562 gWorldMap->mIsTrackingUnknownLocation = FALSE; 1521 LLWorldMap::getInstance()->mIsTrackingUnknownLocation = FALSE;
1563 gWorldMap->mIsTrackingDoubleClick = FALSE; 1522 LLWorldMap::getInstance()->mIsTrackingDoubleClick = FALSE;
1564 gWorldMap->mIsTrackingCommit = FALSE; 1523 LLWorldMap::getInstance()->mIsTrackingCommit = FALSE;
1565 1524
1566 LLWorldMap::item_info_list_t::iterator it; 1525 LLWorldMap::item_info_list_t::iterator it;
1567 1526
1568 // clear old selected stuff 1527 // clear old selected stuff
1569 for (it = gWorldMap->mPGEvents.begin(); it != gWorldMap->mPGEvents.end(); ++it) 1528 for (it = LLWorldMap::getInstance()->mPGEvents.begin(); it != LLWorldMap::getInstance()->mPGEvents.end(); ++it)
1570 { 1529 {
1571 (*it).mSelected = FALSE; 1530 (*it).mSelected = FALSE;
1572 } 1531 }
1573 for (it = gWorldMap->mMatureEvents.begin(); it != gWorldMap->mMatureEvents.end(); ++it) 1532 for (it = LLWorldMap::getInstance()->mMatureEvents.begin(); it != LLWorldMap::getInstance()->mMatureEvents.end(); ++it)
1574 { 1533 {
1575 (*it).mSelected = FALSE; 1534 (*it).mSelected = FALSE;
1576 } 1535 }
1577 for (it = gWorldMap->mPopular.begin(); it != gWorldMap->mPopular.end(); ++it) 1536 for (it = LLWorldMap::getInstance()->mPopular.begin(); it != LLWorldMap::getInstance()->mPopular.end(); ++it)
1578 { 1537 {
1579 (*it).mSelected = FALSE; 1538 (*it).mSelected = FALSE;
1580 } 1539 }
1581 for (it = gWorldMap->mLandForSale.begin(); it != gWorldMap->mLandForSale.end(); ++it) 1540 for (it = LLWorldMap::getInstance()->mLandForSale.begin(); it != LLWorldMap::getInstance()->mLandForSale.end(); ++it)
1582 { 1541 {
1583 (*it).mSelected = FALSE; 1542 (*it).mSelected = FALSE;
1584 } 1543 }
1585 for (it = gWorldMap->mClassifieds.begin(); it != gWorldMap->mClassifieds.end(); ++it) 1544 for (it = LLWorldMap::getInstance()->mClassifieds.begin(); it != LLWorldMap::getInstance()->mClassifieds.end(); ++it)
1586 { 1545 {
1587 (*it).mSelected = FALSE; 1546 (*it).mSelected = FALSE;
1588 } 1547 }
@@ -1590,7 +1549,7 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask,
1590 // Select event you clicked on 1549 // Select event you clicked on
1591 if (gSavedSettings.getBOOL("MapShowEvents")) 1550 if (gSavedSettings.getBOOL("MapShowEvents"))
1592 { 1551 {
1593 for (it = gWorldMap->mPGEvents.begin(); it != gWorldMap->mPGEvents.end(); ++it) 1552 for (it = LLWorldMap::getInstance()->mPGEvents.begin(); it != LLWorldMap::getInstance()->mPGEvents.end(); ++it)
1594 { 1553 {
1595 LLItemInfo& event = *it; 1554 LLItemInfo& event = *it;
1596 1555
@@ -1604,7 +1563,7 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask,
1604 } 1563 }
1605 if (gSavedSettings.getBOOL("ShowMatureEvents")) 1564 if (gSavedSettings.getBOOL("ShowMatureEvents"))
1606 { 1565 {
1607 for (it = gWorldMap->mMatureEvents.begin(); it != gWorldMap->mMatureEvents.end(); ++it) 1566 for (it = LLWorldMap::getInstance()->mMatureEvents.begin(); it != LLWorldMap::getInstance()->mMatureEvents.end(); ++it)
1608 { 1567 {
1609 LLItemInfo& event = *it; 1568 LLItemInfo& event = *it;
1610 1569
@@ -1621,7 +1580,7 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask,
1621 1580
1622 if (gSavedSettings.getBOOL("MapShowPopular")) 1581 if (gSavedSettings.getBOOL("MapShowPopular"))
1623 { 1582 {
1624 for (it = gWorldMap->mPopular.begin(); it != gWorldMap->mPopular.end(); ++it) 1583 for (it = LLWorldMap::getInstance()->mPopular.begin(); it != LLWorldMap::getInstance()->mPopular.end(); ++it)
1625 { 1584 {
1626 LLItemInfo& popular = *it; 1585 LLItemInfo& popular = *it;
1627 1586
@@ -1636,7 +1595,7 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask,
1636 1595
1637 if (gSavedSettings.getBOOL("MapShowLandForSale")) 1596 if (gSavedSettings.getBOOL("MapShowLandForSale"))
1638 { 1597 {
1639 for (it = gWorldMap->mLandForSale.begin(); it != gWorldMap->mLandForSale.end(); ++it) 1598 for (it = LLWorldMap::getInstance()->mLandForSale.begin(); it != LLWorldMap::getInstance()->mLandForSale.end(); ++it)
1640 { 1599 {
1641 LLItemInfo& land = *it; 1600 LLItemInfo& land = *it;
1642 1601
@@ -1651,7 +1610,7 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask,
1651 1610
1652 if (gSavedSettings.getBOOL("MapShowClassifieds")) 1611 if (gSavedSettings.getBOOL("MapShowClassifieds"))
1653 { 1612 {
1654 for (it = gWorldMap->mClassifieds.begin(); it != gWorldMap->mClassifieds.end(); ++it) 1613 for (it = LLWorldMap::getInstance()->mClassifieds.begin(); it != LLWorldMap::getInstance()->mClassifieds.end(); ++it)
1655 { 1614 {
1656 LLItemInfo& classified = *it; 1615 LLItemInfo& classified = *it;
1657 1616
@@ -1732,11 +1691,11 @@ BOOL LLWorldMapView::handleMouseUp( S32 x, S32 y, MASK mask )
1732void LLWorldMapView::updateBlock(S32 block_x, S32 block_y) 1691void LLWorldMapView::updateBlock(S32 block_x, S32 block_y)
1733{ 1692{
1734 S32 offset = block_x | (block_y * MAP_BLOCK_RES); 1693 S32 offset = block_x | (block_y * MAP_BLOCK_RES);
1735 if (!gWorldMap->mMapBlockLoaded[gWorldMap->mCurrentMap][offset]) 1694 if (!LLWorldMap::getInstance()->mMapBlockLoaded[LLWorldMap::getInstance()->mCurrentMap][offset])
1736 { 1695 {
1737// llinfos << "Loading Block (" << block_x << "," << block_y << ")" << llendl; 1696// llinfos << "Loading Block (" << block_x << "," << block_y << ")" << llendl;
1738 gWorldMap->sendMapBlockRequest(block_x << 3, block_y << 3, (block_x << 3) + 7, (block_y << 3) + 7); 1697 LLWorldMap::getInstance()->sendMapBlockRequest(block_x << 3, block_y << 3, (block_x << 3) + 7, (block_y << 3) + 7);
1739 gWorldMap->mMapBlockLoaded[gWorldMap->mCurrentMap][offset] = TRUE; 1698 LLWorldMap::getInstance()->mMapBlockLoaded[LLWorldMap::getInstance()->mCurrentMap][offset] = TRUE;
1740 } 1699 }
1741} 1700}
1742 1701
@@ -1857,15 +1816,15 @@ BOOL LLWorldMapView::handleDoubleClick( S32 x, S32 y, MASK mask )
1857 } 1816 }
1858 default: 1817 default:
1859 { 1818 {
1860 if (gWorldMap->mIsTrackingUnknownLocation) 1819 if (LLWorldMap::getInstance()->mIsTrackingUnknownLocation)
1861 { 1820 {
1862 gWorldMap->mIsTrackingDoubleClick = TRUE; 1821 LLWorldMap::getInstance()->mIsTrackingDoubleClick = TRUE;
1863 } 1822 }
1864 else 1823 else
1865 { 1824 {
1866 // Teleport if we got a valid location 1825 // Teleport if we got a valid location
1867 LLVector3d pos_global = viewPosToGlobal(x,y); 1826 LLVector3d pos_global = viewPosToGlobal(x,y);
1868 LLSimInfo* sim_info = gWorldMap->simInfoFromPosGlobal(pos_global); 1827 LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global);
1869 if (sim_info && sim_info->mAccess != SIM_ACCESS_DOWN) 1828 if (sim_info && sim_info->mAccess != SIM_ACCESS_DOWN)
1870 { 1829 {
1871 gAgent.teleportViaLocation( pos_global ); 1830 gAgent.teleportViaLocation( pos_global );