diff options
Diffstat (limited to 'linden/indra/newview/llworldmapview.cpp')
-rw-r--r-- | linden/indra/newview/llworldmapview.cpp | 288 |
1 files changed, 208 insertions, 80 deletions
diff --git a/linden/indra/newview/llworldmapview.cpp b/linden/indra/newview/llworldmapview.cpp index 77833c3..cc94529 100644 --- a/linden/indra/newview/llworldmapview.cpp +++ b/linden/indra/newview/llworldmapview.cpp | |||
@@ -17,7 +17,8 @@ | |||
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 20 | * online at |
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | 22 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 23 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 24 | * that you have read and understood your obligations described above, |
@@ -61,6 +62,7 @@ | |||
61 | #include "llviewerregion.h" | 62 | #include "llviewerregion.h" |
62 | #include "llviewerwindow.h" | 63 | #include "llviewerwindow.h" |
63 | #include "llworldmap.h" | 64 | #include "llworldmap.h" |
65 | #include "lltexturefetch.h" | ||
64 | #include "llappviewer.h" // Only for constants! | 66 | #include "llappviewer.h" // Only for constants! |
65 | #include "lltrans.h" | 67 | #include "lltrans.h" |
66 | 68 | ||
@@ -82,12 +84,14 @@ LLUIImagePtr LLWorldMapView::sInfohubImage = NULL; | |||
82 | LLUIImagePtr LLWorldMapView::sHomeImage = NULL; | 84 | LLUIImagePtr LLWorldMapView::sHomeImage = NULL; |
83 | LLUIImagePtr LLWorldMapView::sEventImage = NULL; | 85 | LLUIImagePtr LLWorldMapView::sEventImage = NULL; |
84 | LLUIImagePtr LLWorldMapView::sEventMatureImage = NULL; | 86 | LLUIImagePtr LLWorldMapView::sEventMatureImage = NULL; |
87 | LLUIImagePtr LLWorldMapView::sEventAdultImage = NULL; | ||
85 | 88 | ||
86 | LLUIImagePtr LLWorldMapView::sTrackCircleImage = NULL; | 89 | LLUIImagePtr LLWorldMapView::sTrackCircleImage = NULL; |
87 | LLUIImagePtr LLWorldMapView::sTrackArrowImage = NULL; | 90 | LLUIImagePtr LLWorldMapView::sTrackArrowImage = NULL; |
88 | 91 | ||
89 | LLUIImagePtr LLWorldMapView::sClassifiedsImage = NULL; | 92 | LLUIImagePtr LLWorldMapView::sClassifiedsImage = NULL; |
90 | LLUIImagePtr LLWorldMapView::sForSaleImage = NULL; | 93 | LLUIImagePtr LLWorldMapView::sForSaleImage = NULL; |
94 | LLUIImagePtr LLWorldMapView::sForSaleAdultImage = NULL; | ||
91 | 95 | ||
92 | F32 LLWorldMapView::sThresholdA = 48.f; | 96 | F32 LLWorldMapView::sThresholdA = 48.f; |
93 | F32 LLWorldMapView::sThresholdB = 96.f; | 97 | F32 LLWorldMapView::sThresholdB = 96.f; |
@@ -124,11 +128,15 @@ void LLWorldMapView::initClass() | |||
124 | sInfohubImage = LLUI::getUIImage("map_infohub.tga"); | 128 | sInfohubImage = LLUI::getUIImage("map_infohub.tga"); |
125 | sEventImage = LLUI::getUIImage("map_event.tga"); | 129 | sEventImage = LLUI::getUIImage("map_event.tga"); |
126 | sEventMatureImage = LLUI::getUIImage("map_event_mature.tga"); | 130 | sEventMatureImage = LLUI::getUIImage("map_event_mature.tga"); |
131 | // To Do: update the image resource for adult events. | ||
132 | sEventAdultImage = LLUI::getUIImage("map_event_adult.tga"); | ||
127 | 133 | ||
128 | sTrackCircleImage = LLUI::getUIImage("map_track_16.tga"); | 134 | sTrackCircleImage = LLUI::getUIImage("map_track_16.tga"); |
129 | sTrackArrowImage = LLUI::getUIImage("direction_arrow.tga"); | 135 | sTrackArrowImage = LLUI::getUIImage("direction_arrow.tga"); |
130 | sClassifiedsImage = LLUI::getUIImage("icon_top_pick.tga"); | 136 | sClassifiedsImage = LLUI::getUIImage("icon_top_pick.tga"); |
131 | sForSaleImage = LLUI::getUIImage("icon_for_sale.tga"); | 137 | sForSaleImage = LLUI::getUIImage("icon_for_sale.tga"); |
138 | // To Do: update the image resource for adult lands on sale. | ||
139 | sForSaleAdultImage = LLUI::getUIImage("icon_for_sale_adult.tga"); | ||
132 | 140 | ||
133 | sStringsMap["loading"] = LLTrans::getString("texture_loading"); | 141 | sStringsMap["loading"] = LLTrans::getString("texture_loading"); |
134 | sStringsMap["offline"] = LLTrans::getString("worldmap_offline"); | 142 | sStringsMap["offline"] = LLTrans::getString("worldmap_offline"); |
@@ -148,11 +156,13 @@ void LLWorldMapView::cleanupClass() | |||
148 | sHomeImage = NULL; | 156 | sHomeImage = NULL; |
149 | sEventImage = NULL; | 157 | sEventImage = NULL; |
150 | sEventMatureImage = NULL; | 158 | sEventMatureImage = NULL; |
159 | sEventAdultImage = NULL; | ||
151 | 160 | ||
152 | sTrackCircleImage = NULL; | 161 | sTrackCircleImage = NULL; |
153 | sTrackArrowImage = NULL; | 162 | sTrackArrowImage = NULL; |
154 | sClassifiedsImage = NULL; | 163 | sClassifiedsImage = NULL; |
155 | sForSaleImage = NULL; | 164 | sForSaleImage = NULL; |
165 | sForSaleAdultImage = NULL; | ||
156 | } | 166 | } |
157 | 167 | ||
158 | LLWorldMapView::LLWorldMapView(const std::string& name, const LLRect& rect ) | 168 | LLWorldMapView::LLWorldMapView(const std::string& name, const LLRect& rect ) |
@@ -296,8 +306,8 @@ void LLWorldMapView::draw() | |||
296 | 306 | ||
297 | const S32 width = getRect().getWidth(); | 307 | const S32 width = getRect().getWidth(); |
298 | const S32 height = getRect().getHeight(); | 308 | const S32 height = getRect().getHeight(); |
299 | const S32 half_width = width / 2; | 309 | const F32 half_width = F32(width) / 2.0f; |
300 | const S32 half_height = height / 2; | 310 | const F32 half_height = F32(height) / 2.0f; |
301 | LLVector3d camera_global = gAgent.getCameraPositionGlobal(); | 311 | LLVector3d camera_global = gAgent.getCameraPositionGlobal(); |
302 | 312 | ||
303 | LLLocalClipRect clip(getLocalRect()); | 313 | LLLocalClipRect clip(getLocalRect()); |
@@ -331,19 +341,18 @@ void LLWorldMapView::draw() | |||
331 | } | 341 | } |
332 | LLWorldMapLayer *layer = &LLWorldMap::getInstance()->mMapLayers[LLWorldMap::getInstance()->mCurrentMap][layer_idx]; | 342 | LLWorldMapLayer *layer = &LLWorldMap::getInstance()->mMapLayers[LLWorldMap::getInstance()->mCurrentMap][layer_idx]; |
333 | LLViewerImage *current_image = layer->LayerImage; | 343 | LLViewerImage *current_image = layer->LayerImage; |
334 | #if 1 || LL_RELEASE_FOR_DOWNLOAD | 344 | |
335 | if (current_image->isMissingAsset()) | 345 | if (current_image->isMissingAsset()) |
336 | { | 346 | { |
337 | continue; // better to draw nothing than the missing asset image | 347 | continue; // better to draw nothing than the missing asset image |
338 | } | 348 | } |
339 | #endif | ||
340 | 349 | ||
341 | LLVector3d origin_global((F64)layer->LayerExtents.mLeft * REGION_WIDTH_METERS, (F64)layer->LayerExtents.mBottom * REGION_WIDTH_METERS, 0.f); | 350 | LLVector3d origin_global((F64)layer->LayerExtents.mLeft * REGION_WIDTH_METERS, (F64)layer->LayerExtents.mBottom * REGION_WIDTH_METERS, 0.f); |
342 | 351 | ||
343 | // Find x and y position relative to camera's center. | 352 | // Find x and y position relative to camera's center. |
344 | LLVector3d rel_region_pos = origin_global - camera_global; | 353 | LLVector3d rel_region_pos = origin_global - camera_global; |
345 | S32 relative_x = lltrunc((rel_region_pos.mdV[0] / REGION_WIDTH_METERS) * gMapScale); | 354 | F32 relative_x = (rel_region_pos.mdV[0] / REGION_WIDTH_METERS) * gMapScale; |
346 | S32 relative_y = lltrunc((rel_region_pos.mdV[1] / REGION_WIDTH_METERS) * gMapScale); | 355 | F32 relative_y = (rel_region_pos.mdV[1] / REGION_WIDTH_METERS) * gMapScale; |
347 | 356 | ||
348 | F32 pix_width = gMapScale*(layer->LayerExtents.getWidth() + 1); | 357 | F32 pix_width = gMapScale*(layer->LayerExtents.getWidth() + 1); |
349 | F32 pix_height = gMapScale*(layer->LayerExtents.getHeight() + 1); | 358 | F32 pix_height = gMapScale*(layer->LayerExtents.getHeight() + 1); |
@@ -418,34 +427,28 @@ void LLWorldMapView::draw() | |||
418 | gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); | 427 | gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); |
419 | gGL.setColorMask(true, true); | 428 | gGL.setColorMask(true, true); |
420 | 429 | ||
421 | #if 1 | 430 | // there used to be an #if 1 here, but it was uncommented; perhaps marking a block of code? |
422 | F32 sim_alpha = 1.f; | 431 | F32 sim_alpha = 1.f; |
423 | 432 | ||
424 | // Draw one image per region, centered on the camera position. | 433 | // Draw one image per region, centered on the camera position. |
434 | const S32 MAX_SIMULTANEOUS_TEX = 100; | ||
435 | const S32 MAX_REQUEST_PER_TICK = 5; | ||
436 | const S32 MIN_REQUEST_PER_TICK = 1; | ||
437 | S32 textures_requested_this_tick = 0; | ||
438 | |||
425 | for (LLWorldMap::sim_info_map_t::iterator it = LLWorldMap::getInstance()->mSimInfoMap.begin(); | 439 | for (LLWorldMap::sim_info_map_t::iterator it = LLWorldMap::getInstance()->mSimInfoMap.begin(); |
426 | it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it) | 440 | it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it) |
427 | { | 441 | { |
428 | U64 handle = (*it).first; | 442 | U64 handle = (*it).first; |
429 | LLSimInfo* info = (*it).second; | 443 | LLSimInfo* info = (*it).second; |
430 | 444 | ||
431 | if (info->mCurrentImage.isNull()) | ||
432 | { | ||
433 | info->mCurrentImage = gImageList.getImage(info->mMapImageID[LLWorldMap::getInstance()->mCurrentMap], MIPMAP_TRUE, FALSE); | ||
434 | } | ||
435 | if (info->mOverlayImage.isNull() && info->mMapImageID[2].notNull()) | ||
436 | { | ||
437 | info->mOverlayImage = gImageList.getImage(info->mMapImageID[2], MIPMAP_TRUE, FALSE); | ||
438 | gGL.getTexUnit(0)->bind(info->mOverlayImage.get()); | ||
439 | info->mOverlayImage->setClamp(TRUE, TRUE); | ||
440 | } | ||
441 | |||
442 | LLViewerImage* simimage = info->mCurrentImage; | 445 | LLViewerImage* simimage = info->mCurrentImage; |
443 | LLViewerImage* overlayimage = info->mOverlayImage; | 446 | LLViewerImage* overlayimage = info->mOverlayImage; |
444 | 447 | ||
445 | if (gMapScale < SIM_MAP_SCALE) | 448 | if (gMapScale < SIM_MAP_SCALE) |
446 | { | 449 | { |
447 | simimage->setBoostLevel(0); | 450 | if (simimage != NULL) simimage->setBoostLevel(0); |
448 | if (overlayimage) overlayimage->setBoostLevel(0); | 451 | if (overlayimage != NULL) overlayimage->setBoostLevel(0); |
449 | continue; | 452 | continue; |
450 | } | 453 | } |
451 | 454 | ||
@@ -454,8 +457,8 @@ void LLWorldMapView::draw() | |||
454 | 457 | ||
455 | // Find x and y position relative to camera's center. | 458 | // Find x and y position relative to camera's center. |
456 | LLVector3d rel_region_pos = origin_global - camera_global; | 459 | LLVector3d rel_region_pos = origin_global - camera_global; |
457 | S32 relative_x = lltrunc((rel_region_pos.mdV[0] / REGION_WIDTH_METERS) * gMapScale); | 460 | F32 relative_x = (rel_region_pos.mdV[0] / REGION_WIDTH_METERS) * gMapScale; |
458 | S32 relative_y = lltrunc((rel_region_pos.mdV[1] / REGION_WIDTH_METERS) * gMapScale); | 461 | F32 relative_y = (rel_region_pos.mdV[1] / REGION_WIDTH_METERS) * gMapScale; |
459 | 462 | ||
460 | // When the view isn't panned, 0,0 = center of rectangle | 463 | // When the view isn't panned, 0,0 = center of rectangle |
461 | F32 bottom = sPanY + half_height + relative_y; | 464 | F32 bottom = sPanY + half_height + relative_y; |
@@ -476,6 +479,7 @@ void LLWorldMapView::draw() | |||
476 | 479 | ||
477 | bool sim_visible = | 480 | bool sim_visible = |
478 | (gMapScale >= map_scale_cutoff) && | 481 | (gMapScale >= map_scale_cutoff) && |
482 | (simimage != NULL) && | ||
479 | (simimage->getHasGLTexture()); | 483 | (simimage->getHasGLTexture()); |
480 | 484 | ||
481 | if (sim_visible) | 485 | if (sim_visible) |
@@ -502,11 +506,38 @@ void LLWorldMapView::draw() | |||
502 | right < 0.f || | 506 | right < 0.f || |
503 | left > width ) | 507 | left > width ) |
504 | { | 508 | { |
505 | simimage->setBoostLevel(0); | 509 | if (simimage != NULL) simimage->setBoostLevel(0); |
506 | if (overlayimage) overlayimage->setBoostLevel(0); | 510 | if (overlayimage != NULL) overlayimage->setBoostLevel(0); |
507 | continue; | 511 | continue; |
508 | } | 512 | } |
509 | 513 | ||
514 | if (info->mCurrentImage.isNull()) | ||
515 | { | ||
516 | if ((textures_requested_this_tick < MIN_REQUEST_PER_TICK) || | ||
517 | ((LLAppViewer::getTextureFetch()->getNumRequests() < MAX_SIMULTANEOUS_TEX) && | ||
518 | (textures_requested_this_tick < MAX_REQUEST_PER_TICK))) | ||
519 | { | ||
520 | textures_requested_this_tick++; | ||
521 | info->mCurrentImage = gImageList.getImage(info->mMapImageID[LLWorldMap::getInstance()->mCurrentMap], MIPMAP_TRUE, FALSE); | ||
522 | info->mCurrentImage->setAddressMode(LLTexUnit::TAM_CLAMP); | ||
523 | simimage = info->mCurrentImage; | ||
524 | gGL.getTexUnit(0)->bind(simimage); | ||
525 | } | ||
526 | } | ||
527 | if (info->mOverlayImage.isNull() && info->mMapImageID[2].notNull()) | ||
528 | { | ||
529 | if ((textures_requested_this_tick < MIN_REQUEST_PER_TICK) || | ||
530 | ((LLAppViewer::getTextureFetch()->getNumRequests() < MAX_SIMULTANEOUS_TEX) && | ||
531 | (textures_requested_this_tick < MAX_REQUEST_PER_TICK))) | ||
532 | { | ||
533 | textures_requested_this_tick++; | ||
534 | info->mOverlayImage = gImageList.getImage(info->mMapImageID[2], MIPMAP_TRUE, FALSE); | ||
535 | info->mOverlayImage->setAddressMode(LLTexUnit::TAM_CLAMP); | ||
536 | overlayimage = info->mOverlayImage; | ||
537 | gGL.getTexUnit(0)->bind(overlayimage); | ||
538 | } | ||
539 | } | ||
540 | |||
510 | mVisibleRegions.push_back(handle); | 541 | mVisibleRegions.push_back(handle); |
511 | // See if the agents need updating | 542 | // See if the agents need updating |
512 | if (current_time - info->mAgentsUpdateTime > AGENTS_UPDATE_TIME) | 543 | if (current_time - info->mAgentsUpdateTime > AGENTS_UPDATE_TIME) |
@@ -521,10 +552,13 @@ void LLWorldMapView::draw() | |||
521 | center_global.mdV[VY] += 128.0; | 552 | center_global.mdV[VY] += 128.0; |
522 | 553 | ||
523 | S32 draw_size = llround(gMapScale); | 554 | S32 draw_size = llround(gMapScale); |
524 | simimage->setBoostLevel(LLViewerImage::BOOST_MAP); | 555 | if (simimage != NULL) |
525 | simimage->setKnownDrawSize(llround(draw_size * LLUI::sGLScaleFactor.mV[VX]), llround(draw_size * LLUI::sGLScaleFactor.mV[VY])); | 556 | { |
557 | simimage->setBoostLevel(LLViewerImage::BOOST_MAP); | ||
558 | simimage->setKnownDrawSize(llround(draw_size * LLUI::sGLScaleFactor.mV[VX]), llround(draw_size * LLUI::sGLScaleFactor.mV[VY])); | ||
559 | } | ||
526 | 560 | ||
527 | if (overlayimage) | 561 | if (overlayimage != NULL) |
528 | { | 562 | { |
529 | overlayimage->setBoostLevel(LLViewerImage::BOOST_MAP); | 563 | overlayimage->setBoostLevel(LLViewerImage::BOOST_MAP); |
530 | overlayimage->setKnownDrawSize(llround(draw_size * LLUI::sGLScaleFactor.mV[VX]), llround(draw_size * LLUI::sGLScaleFactor.mV[VY])); | 564 | overlayimage->setKnownDrawSize(llround(draw_size * LLUI::sGLScaleFactor.mV[VX]), llround(draw_size * LLUI::sGLScaleFactor.mV[VY])); |
@@ -537,7 +571,8 @@ void LLWorldMapView::draw() | |||
537 | // Draw using the texture. If we don't clamp we get artifact at | 571 | // Draw using the texture. If we don't clamp we get artifact at |
538 | // the edge. | 572 | // the edge. |
539 | LLGLSUIDefault gls_ui; | 573 | LLGLSUIDefault gls_ui; |
540 | gGL.getTexUnit(0)->bind(simimage); | 574 | if (simimage != NULL) |
575 | gGL.getTexUnit(0)->bind(simimage); | ||
541 | 576 | ||
542 | gGL.setSceneBlendType(LLRender::BT_ALPHA); | 577 | gGL.setSceneBlendType(LLRender::BT_ALPHA); |
543 | F32 alpha = sim_alpha * info->mAlpha; | 578 | F32 alpha = sim_alpha * info->mAlpha; |
@@ -606,7 +641,11 @@ void LLWorldMapView::draw() | |||
606 | gGL.end(); | 641 | gGL.end(); |
607 | } | 642 | } |
608 | 643 | ||
609 | // If this is mature, and you are not, draw a line across it | 644 | // As part of the AO project, we no longer want to draw access indicators; |
645 | // it's too complicated to get all the rules straight and will only | ||
646 | // cause confusion. | ||
647 | /********************** | ||
648 | // If this is mature, and you are not, draw a line across it | ||
610 | if (info->mAccess != SIM_ACCESS_DOWN | 649 | if (info->mAccess != SIM_ACCESS_DOWN |
611 | && info->mAccess > SIM_ACCESS_PG | 650 | && info->mAccess > SIM_ACCESS_PG |
612 | && gAgent.isTeen()) | 651 | && gAgent.isTeen()) |
@@ -622,9 +661,10 @@ void LLWorldMapView::draw() | |||
622 | gGL.vertex2f(right, top); | 661 | gGL.vertex2f(right, top); |
623 | gGL.end(); | 662 | gGL.end(); |
624 | } | 663 | } |
664 | **********************/ | ||
625 | 665 | ||
626 | // Draw the region name in the lower left corner | 666 | // Draw the region name in the lower left corner |
627 | LLFontGL* font = LLFontGL::sSansSerifSmall; | 667 | LLFontGL* font = LLFontGL::getFontSansSerifSmall(); |
628 | 668 | ||
629 | std::string mesg; | 669 | std::string mesg; |
630 | if (gMapScale < sThresholdA) | 670 | if (gMapScale < sThresholdA) |
@@ -663,7 +703,8 @@ void LLWorldMapView::draw() | |||
663 | 703 | ||
664 | // If map texture is still loading, | 704 | // If map texture is still loading, |
665 | // display "Loading" placeholder text. | 705 | // display "Loading" placeholder text. |
666 | if (simimage->getDiscardLevel() != 1 && | 706 | if ((simimage != NULL) && |
707 | simimage->getDiscardLevel() != 1 && | ||
667 | simimage->getDiscardLevel() != 0) | 708 | simimage->getDiscardLevel() != 0) |
668 | { | 709 | { |
669 | font->renderUTF8( | 710 | font->renderUTF8( |
@@ -677,10 +718,10 @@ void LLWorldMapView::draw() | |||
677 | } | 718 | } |
678 | } | 719 | } |
679 | } | 720 | } |
680 | #endif | 721 | // #endif used to be here |
681 | 722 | ||
682 | 723 | ||
683 | #if 1 | 724 | // there used to be an #if 1 here, but it was uncommented; perhaps marking a block of code? |
684 | // Draw background rectangle | 725 | // Draw background rectangle |
685 | LLGLSUIDefault gls_ui; | 726 | LLGLSUIDefault gls_ui; |
686 | { | 727 | { |
@@ -716,9 +757,18 @@ void LLWorldMapView::draw() | |||
716 | if (gSavedSettings.getBOOL("MapShowLandForSale")) | 757 | if (gSavedSettings.getBOOL("MapShowLandForSale")) |
717 | { | 758 | { |
718 | drawGenericItems(LLWorldMap::getInstance()->mLandForSale, sForSaleImage); | 759 | drawGenericItems(LLWorldMap::getInstance()->mLandForSale, sForSaleImage); |
760 | // for 1.23, we're showing normal land and adult land in the same UI; you don't | ||
761 | // get a choice about which ones you want. If you're currently asking for adult | ||
762 | // content and land you'll get the adult land. | ||
763 | if (gAgent.canAccessAdult()) | ||
764 | { | ||
765 | drawGenericItems(LLWorldMap::getInstance()->mLandForSaleAdult, sForSaleAdultImage); | ||
766 | } | ||
719 | } | 767 | } |
720 | 768 | ||
721 | if (gSavedSettings.getBOOL("MapShowEvents")) | 769 | if (gSavedSettings.getBOOL("MapShowEvents") || |
770 | gSavedSettings.getBOOL("ShowMatureEvents") || | ||
771 | gSavedSettings.getBOOL("ShowAdultEvents") ) | ||
722 | { | 772 | { |
723 | drawEvents(); | 773 | drawEvents(); |
724 | } | 774 | } |
@@ -735,7 +785,7 @@ void LLWorldMapView::draw() | |||
735 | TRUE, | 785 | TRUE, |
736 | "You are here", | 786 | "You are here", |
737 | "", | 787 | "", |
738 | llround(LLFontGL::sSansSerifSmall->getLineHeight())); // offset vertically by one line, to avoid overlap with target tracking | 788 | llround(LLFontGL::getFontSansSerifSmall()->getLineHeight())); // offset vertically by one line, to avoid overlap with target tracking |
739 | } | 789 | } |
740 | 790 | ||
741 | // Show your viewing angle | 791 | // Show your viewing angle |
@@ -781,7 +831,7 @@ void LLWorldMapView::draw() | |||
781 | drawTracking( LLWorldMap::getInstance()->mUnknownLocation, loading_color, TRUE, "Loading...", ""); | 831 | drawTracking( LLWorldMap::getInstance()->mUnknownLocation, loading_color, TRUE, "Loading...", ""); |
782 | } | 832 | } |
783 | } | 833 | } |
784 | #endif | 834 | // #endif used to be here |
785 | 835 | ||
786 | // turn off the scissor | 836 | // turn off the scissor |
787 | LLGLDisable no_scissor(GL_SCISSOR_TEST); | 837 | LLGLDisable no_scissor(GL_SCISSOR_TEST); |
@@ -928,17 +978,25 @@ void LLWorldMapView::drawAgents() | |||
928 | 978 | ||
929 | void LLWorldMapView::drawEvents() | 979 | void LLWorldMapView::drawEvents() |
930 | { | 980 | { |
931 | BOOL show_mature = gSavedSettings.getBOOL("ShowMatureEvents"); | 981 | bool mature_enabled = gAgent.canAccessMature(); |
982 | bool adult_enabled = gAgent.canAccessAdult(); | ||
983 | |||
984 | BOOL show_pg = gSavedSettings.getBOOL("MapShowEvents"); | ||
985 | BOOL show_mature = mature_enabled && gSavedSettings.getBOOL("ShowMatureEvents"); | ||
986 | BOOL show_adult = adult_enabled && gSavedSettings.getBOOL("ShowAdultEvents"); | ||
932 | 987 | ||
933 | // First the non-selected events | 988 | // First the non-selected events |
934 | LLWorldMap::item_info_list_t::const_iterator e; | 989 | LLWorldMap::item_info_list_t::const_iterator e; |
935 | for (e = LLWorldMap::getInstance()->mPGEvents.begin(); e != LLWorldMap::getInstance()->mPGEvents.end(); ++e) | 990 | if (show_pg) |
936 | { | 991 | { |
937 | if (!e->mSelected) | 992 | for (e = LLWorldMap::getInstance()->mPGEvents.begin(); e != LLWorldMap::getInstance()->mPGEvents.end(); ++e) |
938 | { | 993 | { |
939 | drawGenericItem(*e, sEventImage); | 994 | if (!e->mSelected) |
940 | } | 995 | { |
941 | } | 996 | drawGenericItem(*e, sEventImage); |
997 | } | ||
998 | } | ||
999 | } | ||
942 | if (show_mature) | 1000 | if (show_mature) |
943 | { | 1001 | { |
944 | for (e = LLWorldMap::getInstance()->mMatureEvents.begin(); e != LLWorldMap::getInstance()->mMatureEvents.end(); ++e) | 1002 | for (e = LLWorldMap::getInstance()->mMatureEvents.begin(); e != LLWorldMap::getInstance()->mMatureEvents.end(); ++e) |
@@ -949,15 +1007,27 @@ void LLWorldMapView::drawEvents() | |||
949 | } | 1007 | } |
950 | } | 1008 | } |
951 | } | 1009 | } |
952 | 1010 | if (show_adult) | |
953 | // Then the selected events | ||
954 | for (e = LLWorldMap::getInstance()->mPGEvents.begin(); e != LLWorldMap::getInstance()->mPGEvents.end(); ++e) | ||
955 | { | 1011 | { |
956 | if (e->mSelected) | 1012 | for (e = LLWorldMap::getInstance()->mAdultEvents.begin(); e != LLWorldMap::getInstance()->mAdultEvents.end(); ++e) |
957 | { | 1013 | { |
958 | drawGenericItem(*e, sEventImage); | 1014 | if (!e->mSelected) |
1015 | { | ||
1016 | drawGenericItem(*e, sEventAdultImage); | ||
1017 | } | ||
959 | } | 1018 | } |
960 | } | 1019 | } |
1020 | // Then the selected events | ||
1021 | if (show_pg) | ||
1022 | { | ||
1023 | for (e = LLWorldMap::getInstance()->mPGEvents.begin(); e != LLWorldMap::getInstance()->mPGEvents.end(); ++e) | ||
1024 | { | ||
1025 | if (e->mSelected) | ||
1026 | { | ||
1027 | drawGenericItem(*e, sEventImage); | ||
1028 | } | ||
1029 | } | ||
1030 | } | ||
961 | if (show_mature) | 1031 | if (show_mature) |
962 | { | 1032 | { |
963 | for (e = LLWorldMap::getInstance()->mMatureEvents.begin(); e != LLWorldMap::getInstance()->mMatureEvents.end(); ++e) | 1033 | for (e = LLWorldMap::getInstance()->mMatureEvents.begin(); e != LLWorldMap::getInstance()->mMatureEvents.end(); ++e) |
@@ -968,6 +1038,16 @@ void LLWorldMapView::drawEvents() | |||
968 | } | 1038 | } |
969 | } | 1039 | } |
970 | } | 1040 | } |
1041 | if (show_adult) | ||
1042 | { | ||
1043 | for (e = LLWorldMap::getInstance()->mAdultEvents.begin(); e != LLWorldMap::getInstance()->mAdultEvents.end(); ++e) | ||
1044 | { | ||
1045 | if (e->mSelected) | ||
1046 | { | ||
1047 | drawGenericItem(*e, sEventAdultImage); | ||
1048 | } | ||
1049 | } | ||
1050 | } | ||
971 | } | 1051 | } |
972 | 1052 | ||
973 | 1053 | ||
@@ -1033,7 +1113,7 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4& | |||
1033 | LLVector3 pos_local = globalPosToView( pos_global ); | 1113 | LLVector3 pos_local = globalPosToView( pos_global ); |
1034 | S32 x = llround( pos_local.mV[VX] ); | 1114 | S32 x = llround( pos_local.mV[VX] ); |
1035 | S32 y = llround( pos_local.mV[VY] ); | 1115 | S32 y = llround( pos_local.mV[VY] ); |
1036 | LLFontGL* font = LLFontGL::sSansSerifSmall; | 1116 | LLFontGL* font = LLFontGL::getFontSansSerifSmall(); |
1037 | S32 text_x = x; | 1117 | S32 text_x = x; |
1038 | S32 text_y = (S32)(y - sTrackCircleImage->getHeight()/2 - font->getLineHeight()); | 1118 | S32 text_y = (S32)(y - sTrackCircleImage->getHeight()/2 - font->getLineHeight()); |
1039 | 1119 | ||
@@ -1270,7 +1350,7 @@ void LLWorldMapView::drawIconName(F32 x_pixels, | |||
1270 | - VERT_PAD); | 1350 | - VERT_PAD); |
1271 | 1351 | ||
1272 | // render text | 1352 | // render text |
1273 | LLFontGL::sSansSerif->renderUTF8(first_line, 0, | 1353 | LLFontGL::getFontSansSerif()->renderUTF8(first_line, 0, |
1274 | text_x, | 1354 | text_x, |
1275 | text_y, | 1355 | text_y, |
1276 | color, | 1356 | color, |
@@ -1278,10 +1358,10 @@ void LLWorldMapView::drawIconName(F32 x_pixels, | |||
1278 | LLFontGL::TOP, | 1358 | LLFontGL::TOP, |
1279 | LLFontGL::DROP_SHADOW); | 1359 | LLFontGL::DROP_SHADOW); |
1280 | 1360 | ||
1281 | text_y -= llround(LLFontGL::sSansSerif->getLineHeight()); | 1361 | text_y -= llround(LLFontGL::getFontSansSerif()->getLineHeight()); |
1282 | 1362 | ||
1283 | // render text | 1363 | // render text |
1284 | LLFontGL::sSansSerif->renderUTF8(second_line, 0, | 1364 | LLFontGL::getFontSansSerif()->renderUTF8(second_line, 0, |
1285 | text_x, | 1365 | text_x, |
1286 | text_y, | 1366 | text_y, |
1287 | color, | 1367 | color, |
@@ -1561,6 +1641,10 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask, | |||
1561 | { | 1641 | { |
1562 | (*it).mSelected = FALSE; | 1642 | (*it).mSelected = FALSE; |
1563 | } | 1643 | } |
1644 | for (it = LLWorldMap::getInstance()->mAdultEvents.begin(); it != LLWorldMap::getInstance()->mAdultEvents.end(); ++it) | ||
1645 | { | ||
1646 | (*it).mSelected = FALSE; | ||
1647 | } | ||
1564 | for (it = LLWorldMap::getInstance()->mLandForSale.begin(); it != LLWorldMap::getInstance()->mLandForSale.end(); ++it) | 1648 | for (it = LLWorldMap::getInstance()->mLandForSale.begin(); it != LLWorldMap::getInstance()->mLandForSale.end(); ++it) |
1565 | { | 1649 | { |
1566 | (*it).mSelected = FALSE; | 1650 | (*it).mSelected = FALSE; |
@@ -1581,19 +1665,34 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask, | |||
1581 | return; | 1665 | return; |
1582 | } | 1666 | } |
1583 | } | 1667 | } |
1584 | if (gSavedSettings.getBOOL("ShowMatureEvents")) | 1668 | } |
1669 | if (gSavedSettings.getBOOL("ShowMatureEvents")) | ||
1670 | { | ||
1671 | for (it = LLWorldMap::getInstance()->mMatureEvents.begin(); it != LLWorldMap::getInstance()->mMatureEvents.end(); ++it) | ||
1585 | { | 1672 | { |
1586 | for (it = LLWorldMap::getInstance()->mMatureEvents.begin(); it != LLWorldMap::getInstance()->mMatureEvents.end(); ++it) | 1673 | LLItemInfo& event = *it; |
1674 | |||
1675 | if (checkItemHit(x, y, event, id, false)) | ||
1587 | { | 1676 | { |
1588 | LLItemInfo& event = *it; | 1677 | *hit_type = MAP_ITEM_MATURE_EVENT; |
1678 | mItemPicked = TRUE; | ||
1679 | gFloaterWorldMap->trackEvent(event); | ||
1680 | return; | ||
1681 | } | ||
1682 | } | ||
1683 | } | ||
1684 | if (gSavedSettings.getBOOL("ShowAdultEvents")) | ||
1685 | { | ||
1686 | for (it = LLWorldMap::getInstance()->mAdultEvents.begin(); it != LLWorldMap::getInstance()->mAdultEvents.end(); ++it) | ||
1687 | { | ||
1688 | LLItemInfo& event = *it; | ||
1589 | 1689 | ||
1590 | if (checkItemHit(x, y, event, id, false)) | 1690 | if (checkItemHit(x, y, event, id, false)) |
1591 | { | 1691 | { |
1592 | *hit_type = MAP_ITEM_MATURE_EVENT; | 1692 | *hit_type = MAP_ITEM_ADULT_EVENT; |
1593 | mItemPicked = TRUE; | 1693 | mItemPicked = TRUE; |
1594 | gFloaterWorldMap->trackEvent(event); | 1694 | gFloaterWorldMap->trackEvent(event); |
1595 | return; | 1695 | return; |
1596 | } | ||
1597 | } | 1696 | } |
1598 | } | 1697 | } |
1599 | } | 1698 | } |
@@ -1611,8 +1710,19 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask, | |||
1611 | return; | 1710 | return; |
1612 | } | 1711 | } |
1613 | } | 1712 | } |
1614 | } | 1713 | |
1714 | for (it = LLWorldMap::getInstance()->mLandForSaleAdult.begin(); it != LLWorldMap::getInstance()->mLandForSaleAdult.end(); ++it) | ||
1715 | { | ||
1716 | LLItemInfo& land = *it; | ||
1615 | 1717 | ||
1718 | if (checkItemHit(x, y, land, id, true)) | ||
1719 | { | ||
1720 | *hit_type = MAP_ITEM_LAND_FOR_SALE_ADULT; | ||
1721 | mItemPicked = TRUE; | ||
1722 | return; | ||
1723 | } | ||
1724 | } | ||
1725 | } | ||
1616 | // If we get here, we haven't clicked on an icon | 1726 | // If we get here, we haven't clicked on an icon |
1617 | 1727 | ||
1618 | gFloaterWorldMap->trackLocation(pos_global); | 1728 | gFloaterWorldMap->trackLocation(pos_global); |
@@ -1678,43 +1788,59 @@ BOOL LLWorldMapView::handleMouseUp( S32 x, S32 y, MASK mask ) | |||
1678 | return FALSE; | 1788 | return FALSE; |
1679 | } | 1789 | } |
1680 | 1790 | ||
1681 | void LLWorldMapView::updateBlock(S32 block_x, S32 block_y) | 1791 | U32 LLWorldMapView::updateBlock(S32 block_x, S32 block_y) |
1682 | { | 1792 | { |
1793 | U32 blocks_requested = 0; | ||
1683 | S32 offset = block_x | (block_y * MAP_BLOCK_RES); | 1794 | S32 offset = block_x | (block_y * MAP_BLOCK_RES); |
1684 | if (!LLWorldMap::getInstance()->mMapBlockLoaded[LLWorldMap::getInstance()->mCurrentMap][offset]) | 1795 | if (!LLWorldMap::getInstance()->mMapBlockLoaded[LLWorldMap::getInstance()->mCurrentMap][offset]) |
1685 | { | 1796 | { |
1686 | // llinfos << "Loading Block (" << block_x << "," << block_y << ")" << llendl; | 1797 | // llinfos << "Loading Block (" << block_x << "," << block_y << ")" << llendl; |
1687 | LLWorldMap::getInstance()->sendMapBlockRequest(block_x << 3, block_y << 3, (block_x << 3) + 7, (block_y << 3) + 7); | 1798 | LLWorldMap::getInstance()->sendMapBlockRequest(block_x << 3, block_y << 3, (block_x << 3) + 7, (block_y << 3) + 7); |
1688 | LLWorldMap::getInstance()->mMapBlockLoaded[LLWorldMap::getInstance()->mCurrentMap][offset] = TRUE; | 1799 | LLWorldMap::getInstance()->mMapBlockLoaded[LLWorldMap::getInstance()->mCurrentMap][offset] = TRUE; |
1800 | blocks_requested++; | ||
1689 | } | 1801 | } |
1802 | return blocks_requested; | ||
1690 | } | 1803 | } |
1691 | 1804 | ||
1692 | void LLWorldMapView::updateVisibleBlocks() | 1805 | U32 LLWorldMapView::updateVisibleBlocks() |
1693 | { | 1806 | { |
1694 | if (gMapScale < SIM_MAP_SCALE) | 1807 | if (gMapScale < SIM_MAP_SCALE) |
1695 | { | 1808 | { |
1696 | // We don't care what is loaded if we're zoomed out | 1809 | // We don't care what is loaded if we're zoomed out |
1697 | return; | 1810 | return 0; |
1698 | } | 1811 | } |
1699 | // check if we've loaded the 9 potentially visible zones | ||
1700 | LLVector3d camera_global = gAgent.getCameraPositionGlobal(); | ||
1701 | 1812 | ||
1813 | LLVector3d camera_global = gAgent.getCameraPositionGlobal(); | ||
1814 | |||
1815 | F32 pixels_per_region = gMapScale; | ||
1816 | const S32 width = getRect().getWidth(); | ||
1817 | const S32 height = getRect().getHeight(); | ||
1702 | // Convert pan to sim coordinates | 1818 | // Convert pan to sim coordinates |
1703 | S32 world_center_x = S32((-sPanX / gMapScale) + (camera_global.mdV[0] / REGION_WIDTH_METERS)); | 1819 | S32 world_center_x_lo = S32(((-sPanX - width/2) / pixels_per_region) + (camera_global.mdV[0] / REGION_WIDTH_METERS)); |
1704 | S32 world_center_y = S32((-sPanY / gMapScale) + (camera_global.mdV[1] / REGION_WIDTH_METERS)); | 1820 | S32 world_center_x_hi = S32(((-sPanX + width/2) / pixels_per_region) + (camera_global.mdV[0] / REGION_WIDTH_METERS)); |
1705 | 1821 | S32 world_center_y_lo = S32(((-sPanY - height/2) / pixels_per_region) + (camera_global.mdV[1] / REGION_WIDTH_METERS)); | |
1822 | S32 world_center_y_hi = S32(((-sPanY + height/2)/ pixels_per_region) + (camera_global.mdV[1] / REGION_WIDTH_METERS)); | ||
1823 | |||
1706 | // Find the corresponding 8x8 block | 1824 | // Find the corresponding 8x8 block |
1707 | S32 world_block_x = world_center_x >> 3; | 1825 | S32 world_block_x_lo = world_center_x_lo >> 3; |
1708 | S32 world_block_y = world_center_y >> 3; | 1826 | S32 world_block_x_hi = world_center_x_hi >> 3; |
1827 | S32 world_block_y_lo = world_center_y_lo >> 3; | ||
1828 | S32 world_block_y_hi = world_center_y_hi >> 3; | ||
1829 | |||
1830 | U32 blocks_requested = 0; | ||
1831 | const U32 max_blocks_requested = 9; | ||
1709 | 1832 | ||
1710 | for (S32 block_x = llmax(world_block_x-1, 0); block_x <= llmin(world_block_x+1, MAP_BLOCK_RES-1); ++block_x) | 1833 | for (S32 block_x = llmax(world_block_x_lo, 0); block_x <= llmin(world_block_x_hi, MAP_BLOCK_RES-1); ++block_x) |
1711 | { | 1834 | { |
1712 | for (S32 block_y = llmax(world_block_y-1, 0); block_y <= llmin(world_block_y+1, MAP_BLOCK_RES-1); ++block_y) | 1835 | for (S32 block_y = llmax(world_block_y_lo, 0); block_y <= llmin(world_block_y_hi, MAP_BLOCK_RES-1); ++block_y) |
1713 | { | 1836 | { |
1714 | updateBlock(block_x, block_y); | 1837 | blocks_requested += updateBlock(block_x, block_y); |
1838 | if (blocks_requested >= max_blocks_requested) | ||
1839 | return blocks_requested; | ||
1715 | } | 1840 | } |
1716 | } | 1841 | } |
1717 | } | 1842 | return blocks_requested; |
1843 | } | ||
1718 | 1844 | ||
1719 | BOOL LLWorldMapView::handleHover( S32 x, S32 y, MASK mask ) | 1845 | BOOL LLWorldMapView::handleHover( S32 x, S32 y, MASK mask ) |
1720 | { | 1846 | { |
@@ -1776,6 +1902,7 @@ BOOL LLWorldMapView::handleDoubleClick( S32 x, S32 y, MASK mask ) | |||
1776 | { | 1902 | { |
1777 | case MAP_ITEM_PG_EVENT: | 1903 | case MAP_ITEM_PG_EVENT: |
1778 | case MAP_ITEM_MATURE_EVENT: | 1904 | case MAP_ITEM_MATURE_EVENT: |
1905 | case MAP_ITEM_ADULT_EVENT: | ||
1779 | { | 1906 | { |
1780 | gFloaterWorldMap->close(); | 1907 | gFloaterWorldMap->close(); |
1781 | // This is an ungainly hack | 1908 | // This is an ungainly hack |
@@ -1788,6 +1915,7 @@ BOOL LLWorldMapView::handleDoubleClick( S32 x, S32 y, MASK mask ) | |||
1788 | break; | 1915 | break; |
1789 | } | 1916 | } |
1790 | case MAP_ITEM_LAND_FOR_SALE: | 1917 | case MAP_ITEM_LAND_FOR_SALE: |
1918 | case MAP_ITEM_LAND_FOR_SALE_ADULT: | ||
1791 | { | 1919 | { |
1792 | gFloaterWorldMap->close(); | 1920 | gFloaterWorldMap->close(); |
1793 | LLFloaterDirectory::showLandForSale(id); | 1921 | LLFloaterDirectory::showLandForSale(id); |