Added LLAgentUI. Includes improved buildLocationString.

This commit is contained in:
Shyotl
2011-07-31 19:05:53 -05:00
parent 40d644e432
commit 17bb0799e0
9 changed files with 262 additions and 69 deletions

View File

@@ -39,6 +39,7 @@
#include "llagentaccess.h"
#include "llagentcamera.h"
#include "llagentwearables.h"
#include "llagentui.h"
#include "llanimationstates.h"
#include "llcallingcard.h"
#include "llconsole.h"
@@ -2518,61 +2519,6 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO
return FALSE;
}
// utility to build a location string
void LLAgent::buildLocationString(std::string& str)
{
// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a)
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
{
str = RlvStrings::getString(RLV_STRING_HIDDEN);
return;
}
// [/RLVa:KB]
const LLVector3& agent_pos_region = getPositionAgent();
S32 pos_x = S32(agent_pos_region.mV[VX]);
S32 pos_y = S32(agent_pos_region.mV[VY]);
S32 pos_z = S32(agent_pos_region.mV[VZ]);
// Round the numbers based on the velocity
LLVector3 agent_velocity = getVelocity();
F32 velocity_mag_sq = agent_velocity.magVecSquared();
const F32 FLY_CUTOFF = 6.f; // meters/sec
const F32 FLY_CUTOFF_SQ = FLY_CUTOFF * FLY_CUTOFF;
const F32 WALK_CUTOFF = 1.5f; // meters/sec
const F32 WALK_CUTOFF_SQ = WALK_CUTOFF * WALK_CUTOFF;
if (velocity_mag_sq > FLY_CUTOFF_SQ)
{
pos_x -= pos_x % 4;
pos_y -= pos_y % 4;
}
else if (velocity_mag_sq > WALK_CUTOFF_SQ)
{
pos_x -= pos_x % 2;
pos_y -= pos_y % 2;
}
// create a defult name and description for the landmark
std::string buffer;
if( LLViewerParcelMgr::getInstance()->getAgentParcelName().empty() )
{
// the parcel doesn't have a name
buffer = llformat("%.32s (%d, %d, %d)",
getRegion()->getName().c_str(),
pos_x, pos_y, pos_z);
}
else
{
// the parcel has a name, so include it in the landmark name
buffer = llformat("%.32s, %.32s (%d, %d, %d)",
LLViewerParcelMgr::getInstance()->getAgentParcelName().c_str(),
getRegion()->getName().c_str(),
pos_x, pos_y, pos_z);
}
str = buffer;
}
LLQuaternion LLAgent::getHeadRotation()
{