Add a bunch of fixes to the world and minimap so that teleports inside a var work and the map looks semi-correct.
Conflicts: indra/newview/app_settings/message_template.msg
This commit is contained in:
@@ -43,6 +43,8 @@ F32 gPrehashVersionNumber = 2.000f;
|
||||
char* _PREHASH_X = LLMessageStringTable::getInstance()->getString("X");
|
||||
char* _PREHASH_Y = LLMessageStringTable::getInstance()->getString("Y");
|
||||
char* _PREHASH_Z = LLMessageStringTable::getInstance()->getString("Z");
|
||||
char* _PREHASH_SizeX = LLMessageStringTable::getInstance()->getString("SizeX");
|
||||
char* _PREHASH_SizeY = LLMessageStringTable::getInstance()->getString("SizeY");
|
||||
char* _PREHASH_AddFlags = LLMessageStringTable::getInstance()->getString("AddFlags");
|
||||
char* _PREHASH_FailureInfo = LLMessageStringTable::getInstance()->getString("FailureInfo");
|
||||
char* _PREHASH_MapData = LLMessageStringTable::getInstance()->getString("MapData");
|
||||
|
||||
@@ -43,6 +43,8 @@ extern F32 gPrehashVersionNumber;
|
||||
extern char * _PREHASH_X;
|
||||
extern char * _PREHASH_Y;
|
||||
extern char * _PREHASH_Z;
|
||||
extern char * _PREHASH_SizeX;
|
||||
extern char * _PREHASH_SizeY;
|
||||
extern char * _PREHASH_AddFlags;
|
||||
extern char * _PREHASH_FailureInfo;
|
||||
extern char * _PREHASH_MapData;
|
||||
|
||||
@@ -3582,7 +3582,7 @@ void LLAgent::teleportViaLocation(const LLVector3d& pos_global)
|
||||
(F32)(pos_global.mdV[VY] - region_origin.mdV[VY]),
|
||||
(F32)(pos_global.mdV[VZ]));
|
||||
pos_local += offset;
|
||||
teleportRequest(handle, pos_local);
|
||||
teleportRequest(info->getHandle(), pos_local);
|
||||
}
|
||||
else if(regionp &&
|
||||
teleportCore(regionp->getHandle() == to_region_handle_global((F32)pos_global.mdV[VX], (F32)pos_global.mdV[VY])))
|
||||
@@ -3631,6 +3631,10 @@ void LLAgent::teleportViaLocationLookAt(const LLVector3d& pos_global)
|
||||
mbTeleportKeepsLookAt = true;
|
||||
gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); // detach camera form avatar, so it keeps direction
|
||||
U64 region_handle = to_region_handle(pos_global);
|
||||
LLSimInfo* simInfo = LLWorldMap::instance().simInfoFromHandle(region_handle);
|
||||
if(simInfo)
|
||||
region_handle = simInfo->getHandle();
|
||||
|
||||
LLVector3 pos_local = (LLVector3)(pos_global - from_region_handle(region_handle));
|
||||
teleportRequest(region_handle, pos_local, getTeleportKeepsLookAt());
|
||||
}
|
||||
|
||||
@@ -651,10 +651,11 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global)
|
||||
return;
|
||||
}
|
||||
|
||||
std::string sim_name;
|
||||
LLWorldMap::getInstance()->simNameFromPosGlobal( pos_global, sim_name );
|
||||
F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS );
|
||||
F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS );
|
||||
std::string sim_name = sim_info->getName();
|
||||
U32 locX, locY;
|
||||
from_region_handle(sim_info->getHandle(), &locX, &locY);
|
||||
F32 region_x = pos_global.mdV[VX] - locX;
|
||||
F32 region_y = pos_global.mdV[VY] - locY;
|
||||
std::string full_name = llformat("%s (%d, %d, %d)",
|
||||
// sim_name.c_str(),
|
||||
// [RLVa:KB] - Alternate: Snowglobe-1.2.4 | Checked: 2009-07-04 (RLVa-1.0.0a)
|
||||
|
||||
@@ -120,6 +120,8 @@ void LLMapLayerResponder::result(const LLSD& result)
|
||||
|
||||
S32 x_regions = map_block["X"];
|
||||
S32 y_regions = map_block["Y"];
|
||||
S32 x_size = map_block["SizeX"];
|
||||
S32 y_size = map_block["SizeY"];
|
||||
std::string name = map_block["Name"];
|
||||
S32 access = map_block["Access"];
|
||||
S32 region_flags = map_block["RegionFlags"];
|
||||
@@ -165,6 +167,7 @@ void LLMapLayerResponder::result(const LLSD& result)
|
||||
siminfo->setRegionFlags( region_flags );
|
||||
siminfo->setWaterHeight( (F32) water_height );
|
||||
siminfo->setMapImageID( image_id, agent_flags );
|
||||
siminfo->setSize((U16)x_size, (U16)y_size);
|
||||
if (use_web_map_tiles)
|
||||
{
|
||||
siminfo->mCurrentImage = LLWorldMap::loadObjectsTile((U32)x_regions, (U32)y_regions);
|
||||
|
||||
@@ -293,12 +293,27 @@ LLSimInfo* LLWorldMap::simInfoFromPosGlobal(const LLVector3d& pos_global)
|
||||
return simInfoFromHandle(handle);
|
||||
}
|
||||
|
||||
LLSimInfo* LLWorldMap::simInfoFromHandle(const U64 handle)
|
||||
LLSimInfo* LLWorldMap::simInfoFromHandle(const U64 findhandle)
|
||||
{
|
||||
sim_info_map_t::iterator it = mSimInfoMap.find(handle);
|
||||
if (it != mSimInfoMap.end())
|
||||
{
|
||||
return it->second;
|
||||
std::map<U64, LLSimInfo*>::const_iterator it;
|
||||
for (it = LLWorldMap::getInstance()->mSimInfoMap.begin(); it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it)
|
||||
{
|
||||
const U64 handle = (*it).first;
|
||||
LLSimInfo* info = (*it).second;
|
||||
if(handle == findhandle)
|
||||
{
|
||||
return info;
|
||||
}
|
||||
U32 x = 0, y = 0;
|
||||
from_region_handle(findhandle, &x, &y);
|
||||
U32 checkRegionX, checkRegionY;
|
||||
from_region_handle(handle, &checkRegionX, &checkRegionY);
|
||||
|
||||
if(x >= checkRegionX && x < (checkRegionX + info->getSizeX()) &&
|
||||
y >= checkRegionY && y < (checkRegionY + info->getSizeY()))
|
||||
{
|
||||
return info;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -659,6 +674,8 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**)
|
||||
{
|
||||
U16 x_regions;
|
||||
U16 y_regions;
|
||||
U16 x_size;
|
||||
U16 y_size;
|
||||
std::string name;
|
||||
U8 accesscode;
|
||||
U32 region_flags;
|
||||
@@ -673,9 +690,16 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**)
|
||||
msg->getU8Fast(_PREHASH_Data, _PREHASH_WaterHeight, water_height, block);
|
||||
msg->getU8Fast(_PREHASH_Data, _PREHASH_Agents, agents, block);
|
||||
msg->getUUIDFast(_PREHASH_Data, _PREHASH_MapImageID, image_id, block);
|
||||
msg->getU16Fast(_PREHASH_Data, _PREHASH_SizeX, x_size, block);
|
||||
msg->getU16Fast(_PREHASH_Data, _PREHASH_SizeY, y_size, block);
|
||||
if(x_size == 0 || (x_size % 16) != 0|| (y_size % 16) != 0)
|
||||
{
|
||||
x_size = 256;
|
||||
y_size = 256;
|
||||
}
|
||||
|
||||
U32 x_meters = x_regions * REGION_WIDTH_UNITS;
|
||||
U32 y_meters = y_regions * REGION_WIDTH_UNITS;
|
||||
U32 y_meters = y_regions * REGION_WIDTH_UNITS;
|
||||
|
||||
U64 handle = to_region_handle(x_meters, y_meters);
|
||||
|
||||
@@ -714,6 +738,7 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**)
|
||||
siminfo->setRegionFlags( region_flags );
|
||||
siminfo->setWaterHeight((F32) water_height);
|
||||
siminfo->setMapImageID( image_id, agent_flags );
|
||||
siminfo->setSize( x_size, y_size );
|
||||
|
||||
#ifdef IMMEDIATE_IMAGE_LOAD
|
||||
if (use_web_map_tiles)
|
||||
|
||||
@@ -100,6 +100,7 @@ public:
|
||||
void updateAgentCount(F64 time); // Send an item request for agent count on that region if time's up
|
||||
// Setters
|
||||
void setName(std::string& name) { mName = name; }
|
||||
void setSize(U16 sizeX, U16 sizeY) { mSizeX = sizeX; mSizeY = sizeY; }
|
||||
void setAccess (U8 accesscode) { mAccess = accesscode; }
|
||||
void setRegionFlags (U32 region_flags) { mRegionFlags = region_flags; }
|
||||
void setWaterHeight (F32 water_height) { mWaterHeight = water_height; }
|
||||
@@ -117,6 +118,8 @@ public:
|
||||
const F32 getWaterHeight() const { return mWaterHeight; }
|
||||
const F32 getAlpha() const { return mAlpha; }
|
||||
const U64 getHandle() const { return mHandle; }
|
||||
const U16 getSizeX() const { return mSizeX; }
|
||||
const U16 getSizeY() const { return mSizeY; }
|
||||
bool isName(const std::string& name) const;
|
||||
bool isDown() { return (mAccess == SIM_ACCESS_DOWN); }
|
||||
bool isPG() { return (mAccess <= SIM_ACCESS_PG); }
|
||||
@@ -130,7 +133,9 @@ private:
|
||||
U8 mAccess;
|
||||
U32 mRegionFlags;
|
||||
F32 mWaterHeight;
|
||||
|
||||
U16 mSizeX;
|
||||
U16 mSizeY;
|
||||
|
||||
F32 mAlpha;
|
||||
|
||||
public:
|
||||
|
||||
@@ -644,7 +644,7 @@ void LLWorldMapView::drawTiles(S32 width, S32 height) {
|
||||
{
|
||||
continue; // better to draw nothing than the missing asset image
|
||||
}
|
||||
|
||||
|
||||
LLVector3d origin_global((F64)layer->LayerExtents.mLeft * REGION_WIDTH_METERS, (F64)layer->LayerExtents.mBottom * REGION_WIDTH_METERS, 0.f);
|
||||
|
||||
// Find x and y position relative to camera's center.
|
||||
@@ -674,7 +674,8 @@ void LLWorldMapView::drawTiles(S32 width, S32 height) {
|
||||
}
|
||||
|
||||
current_image->setBoostLevel(LLViewerTexture::BOOST_MAP_VISIBLE);
|
||||
current_image->setKnownDrawSize(llround(pix_width * LLUI::sGLScaleFactor.mV[VX]), llround(pix_height * LLUI::sGLScaleFactor.mV[VY]));
|
||||
current_image->setKnownDrawSize(llround(pix_width * LLUI::sGLScaleFactor.mV[VX]),
|
||||
llround(pix_height * LLUI::sGLScaleFactor.mV[VY]));
|
||||
|
||||
if (!current_image->hasGLTexture())
|
||||
{
|
||||
@@ -762,8 +763,8 @@ void LLWorldMapView::drawTiles(S32 width, S32 height) {
|
||||
// When the view isn't panned, 0,0 = center of rectangle
|
||||
F32 bottom = sPanY + half_height + relative_y;
|
||||
F32 left = sPanX + half_width + relative_x;
|
||||
F32 top = bottom + sMapScale ;
|
||||
F32 right = left + sMapScale ;
|
||||
F32 top = bottom + sMapScale * ((F32)info->getSizeY() / 256.f);
|
||||
F32 right = left + sMapScale * ((F32)info->getSizeX() / 256.f);
|
||||
|
||||
// Switch to world map texture (if available for this region) if either:
|
||||
// 1. Tiles are zoomed out small enough, or
|
||||
@@ -815,7 +816,8 @@ void LLWorldMapView::drawTiles(S32 width, S32 height) {
|
||||
(textures_requested_this_tick < MAX_REQUEST_PER_TICK)))
|
||||
{
|
||||
textures_requested_this_tick++;
|
||||
if (use_web_map_tiles)
|
||||
if (use_web_map_tiles && info->getSizeX() == REGION_WIDTH_UNITS &&
|
||||
info->getSizeY() == REGION_WIDTH_UNITS)
|
||||
{
|
||||
LLVector3d region_pos = info->getGlobalOrigin();
|
||||
info->mCurrentImage = LLWorldMap::loadObjectsTile((U32)(region_pos.mdV[VX] / REGION_WIDTH_UNITS), (U32)(region_pos.mdV[VY] / REGION_WIDTH_UNITS));
|
||||
@@ -852,13 +854,15 @@ void LLWorldMapView::drawTiles(S32 width, S32 height) {
|
||||
if (simimage != NULL)
|
||||
{
|
||||
simimage->setBoostLevel(LLViewerTexture::BOOST_MAP);
|
||||
simimage->setKnownDrawSize(llround(draw_size * LLUI::sGLScaleFactor.mV[VX]), llround(draw_size * LLUI::sGLScaleFactor.mV[VY]));
|
||||
simimage->setKnownDrawSize(llround(draw_size * LLUI::sGLScaleFactor.mV[VX] * ((F32)info->getSizeX() / REGION_WIDTH_UNITS)),
|
||||
llround(draw_size * LLUI::sGLScaleFactor.mV[VY] * ((F32)info->getSizeY() / REGION_WIDTH_UNITS)));
|
||||
}
|
||||
|
||||
if (overlayimage != NULL)
|
||||
{
|
||||
overlayimage->setBoostLevel(LLViewerTexture::BOOST_MAP);
|
||||
overlayimage->setKnownDrawSize(llround(draw_size * LLUI::sGLScaleFactor.mV[VX]), llround(draw_size * LLUI::sGLScaleFactor.mV[VY]));
|
||||
overlayimage->setKnownDrawSize(llround(draw_size * LLUI::sGLScaleFactor.mV[VX] * ((F32)info->getSizeX() / REGION_WIDTH_UNITS)),
|
||||
llround(draw_size * LLUI::sGLScaleFactor.mV[VY] * ((F32)info->getSizeY() / REGION_WIDTH_UNITS)));
|
||||
}
|
||||
|
||||
// LLTextureView::addDebugImage(simimage);
|
||||
@@ -1255,8 +1259,17 @@ bool LLWorldMapView::drawMipmapLevel(S32 width, S32 height, S32 level, bool load
|
||||
F32 left = pos_screen[VX];
|
||||
F32 bottom = pos_screen[VY];
|
||||
// Compute the NE corner coordinates of the tile now
|
||||
pos_global[VX] += tile_width;
|
||||
pos_global[VY] += tile_width;
|
||||
LLSimInfo* simInfo = LLWorldMap::instance().simInfoFromHandle(to_region_handle(grid_x, grid_y));
|
||||
if(simInfo != NULL)
|
||||
{
|
||||
pos_global[VX] += ((F32)tile_width * ((F32)simInfo->getSizeX() / REGION_WIDTH_METERS));
|
||||
pos_global[VY] += ((F32)tile_width * ((F32)simInfo->getSizeY() / REGION_WIDTH_METERS));
|
||||
}
|
||||
else
|
||||
{
|
||||
pos_global[VX] += tile_width;
|
||||
pos_global[VY] += tile_width;
|
||||
}
|
||||
pos_screen = globalPosToView (pos_global);
|
||||
F32 right = pos_screen[VX];
|
||||
F32 top = pos_screen[VY];
|
||||
@@ -1283,11 +1296,6 @@ bool LLWorldMapView::drawMipmapLevel(S32 width, S32 height, S32 level, bool load
|
||||
drawTileOutline(level, top, left, bottom, right);
|
||||
#endif // DEBUG_DRAW_TILE
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// Waiting for a tile -> the level is not complete
|
||||
// LL_INFOS("World Map") << "Unfetched tile. level = " << level << LL_ENDL;
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user