Beginning to pull LLVOAvatarSelf out from LLVOAvatar.

This commit is contained in:
Shyotl
2011-10-02 02:51:10 -05:00
parent 21f39471f1
commit 74dc875a27
68 changed files with 1624 additions and 1248 deletions

View File

@@ -76,7 +76,7 @@
#include "llviewerparcelmgr.h"
#include "llviewerstats.h"
#include "llviewerwindow.h"
#include "llvoavatar.h"
#include "llvoavatarself.h"
#include "llworld.h"
#include "llworldmap.h"
@@ -141,18 +141,12 @@ BOOL LLAgent::mForceTPose = 0;
LLVector3 LLAgent::exlStartMeasurePoint = LLVector3::zero;
LLVector3 LLAgent::exlEndMeasurePoint = LLVector3::zero;
const F32 LLAgent::TYPING_TIMEOUT_SECS = 5.f;
std::map<std::string, std::string> LLAgent::sTeleportErrorMessages;
std::map<std::string, std::string> LLAgent::sTeleportProgressMessages;
BOOL isAgentAvatarValid()
{
return (gAgent.getAvatarObject() &&
(gAgent.getAvatarObject()->getRegion() != NULL) &&
(!gAgent.getAvatarObject()->isDead()));
}
class LLAgentFriendObserver : public LLFriendObserver
{
public:
@@ -209,8 +203,6 @@ LLAgent::LLAgent() :
mDistanceTraveled(0.F),
mLastPositionGlobal(LLVector3d::zero),
mAvatarObject(NULL),
mRenderState(0),
mTypingTimer(),
@@ -283,7 +275,6 @@ void LLAgent::init()
//-----------------------------------------------------------------------------
void LLAgent::cleanup()
{
mAvatarObject = NULL;
mRegionp = NULL;
if(mPendingLure)
delete mPendingLure;
@@ -329,13 +320,12 @@ void LLAgent::ageChat()
if (isAgentAvatarValid())
{
// get amount of time since I last chatted
F64 elapsed_time = (F64)mAvatarObject->mChatTimer.getElapsedTimeF32();
F64 elapsed_time = (F64)gAgentAvatarp->mChatTimer.getElapsedTimeF32();
// add in frame time * 3 (so it ages 4x)
mAvatarObject->mChatTimer.setAge(elapsed_time + (F64)gFrameDTClamped * (CHAT_AGE_FAST_RATE - 1.0));
gAgentAvatarp->mChatTimer.setAge(elapsed_time + (F64)gFrameDTClamped * (CHAT_AGE_FAST_RATE - 1.0));
}
}
//-----------------------------------------------------------------------------
// moveAt()
//-----------------------------------------------------------------------------
@@ -536,10 +526,10 @@ BOOL LLAgent::getPhantom()
void LLAgent::resetClientTag()
{
if (!mAvatarObject.isNull())
if (gAgentAvatarp)
{
llinfos << "Resetting mClientTag." << llendl;
mAvatarObject->mClientTag = "";
gAgentAvatarp->mClientTag = "";
}
}
//
@@ -551,13 +541,18 @@ void LLAgent::setFlying(BOOL fly)
{
if (isAgentAvatarValid())
{
if(fly && mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_STANDUP) != mAvatarObject->mSignaledAnimations.end())
// *HACK: Don't allow to start the flying mode if we got ANIM_AGENT_STANDUP signal
// because in this case we won't get a signal to start avatar flying animation and
// it will be walking with flying mode "ON" indication. However we allow to switch
// the flying mode off if we get ANIM_AGENT_STANDUP signal. See process_avatar_animation().
// See EXT-2781.
if(fly && gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_STANDUP) != gAgentAvatarp->mSignaledAnimations.end())
{
return;
}
// don't allow taking off while sitting
if (fly && mAvatarObject->isSitting())
if (fly && gAgentAvatarp->isSitting())
{
return;
}
@@ -617,7 +612,7 @@ bool LLAgent::enableFlying()
BOOL sitting = FALSE;
if (isAgentAvatarValid())
{
sitting = gAgent.getAvatarObject()->isSitting();
sitting = gAgentAvatarp->isSitting();
}
return !sitting;
}
@@ -820,7 +815,7 @@ LLVector3 LLAgent::getVelocity() const
{
if (isAgentAvatarValid())
{
return mAvatarObject->getVelocity();
return gAgentAvatarp->getVelocity();
}
else
{
@@ -839,13 +834,13 @@ void LLAgent::setPositionAgent(const LLVector3 &pos_agent)
llerrs << "setPositionAgent is not a number" << llendl;
}
if (isAgentAvatarValid() && mAvatarObject->getParent())
if (isAgentAvatarValid() && gAgentAvatarp->getParent())
{
LLVector3 pos_agent_sitting;
LLVector3d pos_agent_d;
LLViewerObject *parent = (LLViewerObject*)mAvatarObject->getParent();
LLViewerObject *parent = (LLViewerObject*)gAgentAvatarp->getParent();
pos_agent_sitting = mAvatarObject->getPosition() * parent->getRotation() + parent->getPositionAgent();
pos_agent_sitting = gAgentAvatarp->getPosition() * parent->getRotation() + parent->getPositionAgent();
pos_agent_d.setVec(pos_agent_sitting);
mFrameAgent.setOrigin(pos_agent_sitting);
@@ -861,15 +856,14 @@ void LLAgent::setPositionAgent(const LLVector3 &pos_agent)
}
}
//-----------------------------------------------------------------------------
// getPositionGlobal()
//-----------------------------------------------------------------------------
const LLVector3d &LLAgent::getPositionGlobal() const
{
if (isAgentAvatarValid() && !mAvatarObject->mDrawable.isNull())
if (isAgentAvatarValid() && !gAgentAvatarp->mDrawable.isNull())
{
mPositionGlobal = getPosGlobalFromAgent(mAvatarObject->getRenderPosition());
mPositionGlobal = getPosGlobalFromAgent(gAgentAvatarp->getRenderPosition());
}
else
{
@@ -884,9 +878,9 @@ const LLVector3d &LLAgent::getPositionGlobal() const
//-----------------------------------------------------------------------------
const LLVector3 &LLAgent::getPositionAgent()
{
if(mAvatarObject.notNull() && !mAvatarObject->mDrawable.isNull())
if (isAgentAvatarValid() && !gAgentAvatarp->mDrawable.isNull())
{
mFrameAgent.setOrigin(mAvatarObject->getRenderPosition());
mFrameAgent.setOrigin(gAgentAvatarp->getRenderPosition());
}
return mFrameAgent.getOrigin();
@@ -1018,20 +1012,20 @@ LLVector3 LLAgent::getReferenceUpVector()
// this vector is in the coordinate frame of the avatar's parent object, or the world if none
LLVector3 up_vector = LLVector3::z_axis;
if (isAgentAvatarValid() &&
mAvatarObject->getParent() &&
mAvatarObject->mDrawable.notNull())
gAgentAvatarp->getParent() &&
gAgentAvatarp->mDrawable.notNull())
{
U32 camera_mode = gAgentCamera.getCameraAnimating() ? gAgentCamera.getLastCameraMode() : gAgentCamera.getCameraMode();
// and in third person...
if (camera_mode == CAMERA_MODE_THIRD_PERSON)
{
// make the up vector point to the absolute +z axis
up_vector = up_vector * ~((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation();
up_vector = up_vector * ~((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation();
}
else if (camera_mode == CAMERA_MODE_MOUSELOOK)
{
// make the up vector point to the avatar's +z axis
up_vector = up_vector * mAvatarObject->mDrawable->getRotation();
up_vector = up_vector * gAgentAvatarp->mDrawable->getRotation();
}
}
@@ -1067,7 +1061,7 @@ F32 LLAgent::clampPitchToLimits(F32 angle)
F32 angle_from_skyward = acos( mFrameAgent.getAtAxis() * skyward );
if (isAgentAvatarValid() && mAvatarObject->isSitting())
if (isAgentAvatarValid() && gAgentAvatarp->isSitting())
{
look_down_limit = 130.f * DEG_TO_RAD;
}
@@ -1215,6 +1209,7 @@ void LLAgent::setAFK()
{
sendAnimationRequest(ANIM_AGENT_AWAY, ANIM_REQUEST_START);
setControlFlags(AGENT_CONTROL_AWAY | AGENT_CONTROL_STOP);
LL_INFOS("AFK") << "Setting Away" << LL_ENDL;
gAwayTimer.start();
if (gAFKMenu)
{
@@ -1237,10 +1232,11 @@ void LLAgent::clearAFK()
// without setting the appropriate control flag. JC
if (mControlFlags & AGENT_CONTROL_AWAY
|| (isAgentAvatarValid()
&& (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_AWAY) != mAvatarObject->mSignaledAnimations.end())))
&& (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AWAY) != gAgentAvatarp->mSignaledAnimations.end())))
{
sendAnimationRequest(ANIM_AGENT_AWAY, ANIM_REQUEST_STOP);
clearControlFlags(AGENT_CONTROL_AWAY);
LL_INFOS("AFK") << "Clearing Away" << LL_ENDL;
if (gAFKMenu)
{
//*TODO:Translate
@@ -1305,7 +1301,8 @@ void LLAgent::startAutoPilotGlobal(
const LLQuaternion *target_rotation,
void (*finish_callback)(BOOL, void *),
void *callback_data,
F32 stop_distance, F32 rot_threshold)
F32 stop_distance,
F32 rot_threshold)
{
if (!isAgentAvatarValid())
{
@@ -1360,22 +1357,8 @@ void LLAgent::startAutoPilotGlobal(
}
mAutoPilot = TRUE;
mAutoPilotTargetGlobal = target_global;
setAutoPilotTargetGlobal(target_global);
// trace ray down to find height of destination from ground
LLVector3d traceEndPt = target_global;
traceEndPt.mdV[VZ] -= 20.f;
LLVector3d targetOnGround;
LLVector3 groundNorm;
LLViewerObject *obj;
LLWorld::getInstance()->resolveStepHeightGlobal(NULL, target_global, traceEndPt, targetOnGround, groundNorm, &obj);
F64 target_height = llmax((F64)gAgent.getAvatarObject()->getPelvisToFoot(), target_global.mdV[VZ] - targetOnGround.mdV[VZ]);
// clamp z value of target to minimum height above ground
mAutoPilotTargetGlobal.mdV[VZ] = targetOnGround.mdV[VZ] + target_height;
mAutoPilotTargetDist = (F32)dist_vec(gAgent.getPositionGlobal(), mAutoPilotTargetGlobal);
if (target_rotation)
{
mAutoPilotUseRotation = TRUE;
@@ -1392,6 +1375,32 @@ void LLAgent::startAutoPilotGlobal(
}
//-----------------------------------------------------------------------------
// setAutoPilotTargetGlobal
//-----------------------------------------------------------------------------
void LLAgent::setAutoPilotTargetGlobal(const LLVector3d &target_global)
{
if (mAutoPilot)
{
mAutoPilotTargetGlobal = target_global;
// trace ray down to find height of destination from ground
LLVector3d traceEndPt = target_global;
traceEndPt.mdV[VZ] -= 20.f;
LLVector3d targetOnGround;
LLVector3 groundNorm;
LLViewerObject *obj;
LLWorld::getInstance()->resolveStepHeightGlobal(NULL, target_global, traceEndPt, targetOnGround, groundNorm, &obj);
F64 target_height = llmax((F64)gAgentAvatarp->getPelvisToFoot(), target_global.mdV[VZ] - targetOnGround.mdV[VZ]);
// clamp z value of target to minimum height above ground
mAutoPilotTargetGlobal.mdV[VZ] = targetOnGround.mdV[VZ] + target_height;
mAutoPilotTargetDist = (F32)dist_vec(gAgent.getPositionGlobal(), mAutoPilotTargetGlobal);
}
}
//-----------------------------------------------------------------------------
// startFollowPilot()
//-----------------------------------------------------------------------------
@@ -1476,7 +1485,7 @@ void LLAgent::autoPilot(F32 *delta_yaw)
if (!isAgentAvatarValid()) return;
if (mAvatarObject->mInAir)
if (gAgentAvatarp->mInAir)
{
setFlying(TRUE);
}
@@ -1554,7 +1563,7 @@ void LLAgent::autoPilot(F32 *delta_yaw)
{
if (isAgentAvatarValid())
{
F64 current_height = mAvatarObject->getPositionGlobal().mdV[VZ];
F64 current_height = gAgentAvatarp->getPositionGlobal().mdV[VZ];
F32 delta_z = (F32)(mAutoPilotTargetGlobal.mdV[VZ] - current_height);
F32 slope = delta_z / xy_distance;
if (slope > 0.45f && delta_z > 6.f)
@@ -1637,9 +1646,9 @@ void LLAgent::propagate(const F32 dt)
pitch(PITCH_RATE * gAgentCamera.getPitchKey() * dt);
// handle auto-land behavior
if (mAvatarObject.notNull())
if (isAgentAvatarValid())
{
BOOL in_air = mAvatarObject->mInAir;
BOOL in_air = gAgentAvatarp->mInAir;
LLVector3 land_vel = getVelocity();
land_vel.mV[VZ] = 0.f;
@@ -1693,21 +1702,6 @@ std::ostream& operator<<(std::ostream &s, const LLAgent &agent)
// it is no longer needed. Some legacy code must exist in
// non-legacy functions, and is labeled with "// legacy" comments.
//-----------------------------------------------------------------------------
// setAvatarObject()
//-----------------------------------------------------------------------------
void LLAgent::setAvatarObject(LLVOAvatar *avatar)
{
mAvatarObject = avatar;
if (!avatar)
{
llinfos << "Setting LLAgent::mAvatarObject to NULL" << llendl;
return;
}
gAgentCamera.setAvatarObject(avatar);
}
// TRUE if your own avatar needs to be rendered. Usually only
// in third person and build.
//-----------------------------------------------------------------------------
@@ -1874,24 +1868,24 @@ void LLAgent::endAnimationUpdateUI()
// Disable mouselook-specific animations
if (isAgentAvatarValid())
{
if( mAvatarObject->isAnyAnimationSignaled(AGENT_GUN_AIM_ANIMS, NUM_AGENT_GUN_AIM_ANIMS) )
if( gAgentAvatarp->isAnyAnimationSignaled(AGENT_GUN_AIM_ANIMS, NUM_AGENT_GUN_AIM_ANIMS) )
{
if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_AIM_RIFLE_R) != mAvatarObject->mSignaledAnimations.end())
if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AIM_RIFLE_R) != gAgentAvatarp->mSignaledAnimations.end())
{
sendAnimationRequest(ANIM_AGENT_AIM_RIFLE_R, ANIM_REQUEST_STOP);
sendAnimationRequest(ANIM_AGENT_HOLD_RIFLE_R, ANIM_REQUEST_START);
}
if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_AIM_HANDGUN_R) != mAvatarObject->mSignaledAnimations.end())
if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AIM_HANDGUN_R) != gAgentAvatarp->mSignaledAnimations.end())
{
sendAnimationRequest(ANIM_AGENT_AIM_HANDGUN_R, ANIM_REQUEST_STOP);
sendAnimationRequest(ANIM_AGENT_HOLD_HANDGUN_R, ANIM_REQUEST_START);
}
if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_AIM_BAZOOKA_R) != mAvatarObject->mSignaledAnimations.end())
if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AIM_BAZOOKA_R) != gAgentAvatarp->mSignaledAnimations.end())
{
sendAnimationRequest(ANIM_AGENT_AIM_BAZOOKA_R, ANIM_REQUEST_STOP);
sendAnimationRequest(ANIM_AGENT_HOLD_BAZOOKA_R, ANIM_REQUEST_START);
}
if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_AIM_BOW_L) != mAvatarObject->mSignaledAnimations.end())
if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AIM_BOW_L) != gAgentAvatarp->mSignaledAnimations.end())
{
sendAnimationRequest(ANIM_AGENT_AIM_BOW_L, ANIM_REQUEST_STOP);
sendAnimationRequest(ANIM_AGENT_HOLD_BOW_L, ANIM_REQUEST_START);
@@ -1966,44 +1960,43 @@ void LLAgent::endAnimationUpdateUI()
if (isAgentAvatarValid())
{
// Trigger mouselook-specific animations
if( mAvatarObject->isAnyAnimationSignaled(AGENT_GUN_HOLD_ANIMS, NUM_AGENT_GUN_HOLD_ANIMS) )
if( gAgentAvatarp->isAnyAnimationSignaled(AGENT_GUN_HOLD_ANIMS, NUM_AGENT_GUN_HOLD_ANIMS) )
{
if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_HOLD_RIFLE_R) != mAvatarObject->mSignaledAnimations.end())
if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_HOLD_RIFLE_R) != gAgentAvatarp->mSignaledAnimations.end())
{
sendAnimationRequest(ANIM_AGENT_HOLD_RIFLE_R, ANIM_REQUEST_STOP);
sendAnimationRequest(ANIM_AGENT_AIM_RIFLE_R, ANIM_REQUEST_START);
}
if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_HOLD_HANDGUN_R) != mAvatarObject->mSignaledAnimations.end())
if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_HOLD_HANDGUN_R) != gAgentAvatarp->mSignaledAnimations.end())
{
sendAnimationRequest(ANIM_AGENT_HOLD_HANDGUN_R, ANIM_REQUEST_STOP);
sendAnimationRequest(ANIM_AGENT_AIM_HANDGUN_R, ANIM_REQUEST_START);
}
if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_HOLD_BAZOOKA_R) != mAvatarObject->mSignaledAnimations.end())
if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_HOLD_BAZOOKA_R) != gAgentAvatarp->mSignaledAnimations.end())
{
sendAnimationRequest(ANIM_AGENT_HOLD_BAZOOKA_R, ANIM_REQUEST_STOP);
sendAnimationRequest(ANIM_AGENT_AIM_BAZOOKA_R, ANIM_REQUEST_START);
}
if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_HOLD_BOW_L) != mAvatarObject->mSignaledAnimations.end())
if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_HOLD_BOW_L) != gAgentAvatarp->mSignaledAnimations.end())
{
sendAnimationRequest(ANIM_AGENT_HOLD_BOW_L, ANIM_REQUEST_STOP);
sendAnimationRequest(ANIM_AGENT_AIM_BOW_L, ANIM_REQUEST_START);
}
}
if (mAvatarObject->getParent())
if (gAgentAvatarp->getParent())
{
LLVector3 at_axis = LLViewerCamera::getInstance()->getAtAxis();
LLViewerObject* root_object = (LLViewerObject*)mAvatarObject->getRoot();
LLViewerObject* root_object = (LLViewerObject*)gAgentAvatarp->getRoot();
if (root_object->flagCameraDecoupled())
{
resetAxes(at_axis);
}
else
{
resetAxes(at_axis * ~((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation());
resetAxes(at_axis * ~((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation());
}
}
}
}
else if (gAgentCamera.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR)
{
@@ -2027,14 +2020,14 @@ void LLAgent::endAnimationUpdateUI()
if (isAgentAvatarValid())
{
// <edit>
//mPauseRequest = mAvatarObject->requestPause();
//mPauseRequest = gAgentAvatarp->requestPause();
// </edit>
}
}
if (isAgentAvatarValid())
{
gAgent.getAvatarObject()->updateAttachmentVisibility(gAgentCamera.getCameraMode());
gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode());
}
gFloaterTools->dirty();
@@ -2121,7 +2114,7 @@ void LLAgent::setStartPosition( U32 location_id )
if (isAgentAvatarValid())
{
// the z height is at the agent's feet
agent_pos.mV[VZ] -= 0.5f * mAvatarObject->mBodySize.mV[VZ];
agent_pos.mV[VZ] -= 0.5f * gAgentAvatarp->mBodySize.mV[VZ];
}
agent_pos.mV[VX] = llclamp( agent_pos.mV[VX], INSET, REGION_WIDTH - INSET );
@@ -2211,7 +2204,7 @@ void LLAgent::onAnimStop(const LLUUID& id)
setControlFlags(AGENT_CONTROL_FINISH_ANIM);
// now trigger dusting self off animation
if (isAgentAvatarValid() && !mAvatarObject->mBelowWater && rand() % 3 == 0)
if (isAgentAvatarValid() && !gAgentAvatarp->mBelowWater && rand() % 3 == 0)
sendAnimationRequest( ANIM_AGENT_BRUSH, ANIM_REQUEST_START );
}
else if (id == ANIM_AGENT_PRE_JUMP || id == ANIM_AGENT_LAND || id == ANIM_AGENT_MEDIUM_LAND)
@@ -2390,7 +2383,7 @@ void LLAgent::buildFullname(std::string& name) const
{
if (isAgentAvatarValid())
{
name = mAvatarObject->getFullname();
name = gAgentAvatarp->getFullname();
}
}
@@ -2408,7 +2401,7 @@ void LLAgent::buildFullnameAndTitle(std::string& name) const
if (isAgentAvatarValid())
{
name += mAvatarObject->getFullname();
name += gAgentAvatarp->getFullname();
}
}
@@ -2554,14 +2547,14 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO
LLQuaternion LLAgent::getHeadRotation()
{
if (!isAgentAvatarValid() || !mAvatarObject->mPelvisp || !mAvatarObject->mHeadp)
if (!isAgentAvatarValid() || !gAgentAvatarp->mPelvisp || !gAgentAvatarp->mHeadp)
{
return LLQuaternion::DEFAULT;
}
if (!gAgentCamera.cameraMouselook())
{
return mAvatarObject->getRotation();
return gAgentAvatarp->getRotation();
}
// We must be in mouselook
@@ -2570,9 +2563,9 @@ LLQuaternion LLAgent::getHeadRotation()
LLVector3 left = up % look_dir;
LLQuaternion rot(look_dir, left, up);
if (mAvatarObject->getParent())
if (gAgentAvatarp->getParent())
{
rot = rot * ~mAvatarObject->getParent()->getRotation();
rot = rot * ~gAgentAvatarp->getParent()->getRotation();
}
return rot;
@@ -2718,10 +2711,10 @@ void LLAgent::getName(std::string& name)
{
name.clear();
if (mAvatarObject.notNull())
if (gAgentAvatarp)
{
LLNameValue *first_nv = mAvatarObject->getNVPair("FirstName");
LLNameValue *last_nv = mAvatarObject->getNVPair("LastName");
LLNameValue *first_nv = gAgentAvatarp->getNVPair("FirstName");
LLNameValue *last_nv = gAgentAvatarp->getNVPair("LastName");
if (first_nv && last_nv)
{
name = first_nv->printData() + " " + last_nv->printData();
@@ -3234,13 +3227,13 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void *
{
gAgentQueryManager.mNumPendingQueries--;
if (!isAgentAvatarValid() || gAgent.getAvatarObject()->isDead())
if (!isAgentAvatarValid() || gAgentAvatarp->isDead())
{
llwarns << "No avatar for user in cached texture update!" << llendl;
return;
}
if (gAgentCamera.cameraCustomizeAvatar())
if (isAgentAvatarValid() && gAgentCamera.cameraCustomizeAvatar())
{
// ignore baked textures when in customize mode
return;
@@ -3266,7 +3259,7 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void *
&& gAgentQueryManager.mActiveCacheQueries[ texture_index ] == query_id)
{
//llinfos << "Received cached texture " << (U32)texture_index << ": " << texture_id << llendl;
gAgent.getAvatarObject()->setCachedBakedTexture(getTextureIndex((EBakedTextureIndex)texture_index), texture_id);
gAgentAvatarp->setCachedBakedTexture(getTextureIndex((EBakedTextureIndex)texture_index), texture_id);
//avatarp->setTETexture( LLVOAvatar::sBakedTextureIndices[texture_index], texture_id );
gAgentQueryManager.mActiveCacheQueries[ texture_index ] = 0;
num_results++;
@@ -3275,12 +3268,12 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void *
llinfos << "Received cached texture response for " << num_results << " textures." << llendl;
gAgent.getAvatarObject()->updateMeshTextures();
gAgentAvatarp->updateMeshTextures();
if (gAgentQueryManager.mNumPendingQueries == 0)
{
// RN: not sure why composites are disabled at this point
gAgent.getAvatarObject()->setCompositeUpdatesEnabled(TRUE);
gAgentAvatarp->setCompositeUpdatesEnabled(TRUE);
gAgent.sendAgentSetAppearance();
}
}
@@ -3335,8 +3328,8 @@ void LLAgent::clearVisualParams(void *data)
{
if (isAgentAvatarValid())
{
gAgent.getAvatarObject()->clearVisualParamWeights();
gAgent.getAvatarObject()->updateVisualParams();
gAgentAvatarp->clearVisualParamWeights();
gAgentAvatarp->updateVisualParams();
}
}
@@ -3365,14 +3358,13 @@ bool LLAgent::teleportCore(bool is_local)
// Stop all animation before actual teleporting
if (isAgentAvatarValid())
{
LLVOAvatar* avatarp = gAgent.getAvatarObject();
for ( LLVOAvatar::AnimIterator anim_it= avatarp->mPlayingAnimations.begin();
anim_it != avatarp->mPlayingAnimations.end();
for ( LLVOAvatar::AnimIterator anim_it= gAgentAvatarp->mPlayingAnimations.begin();
anim_it != gAgentAvatarp->mPlayingAnimations.end();
++anim_it)
{
avatarp->stopMotion(anim_it->first);
gAgentAvatarp->stopMotion(anim_it->first);
}
avatarp->processAnimationStateChanges();
gAgentAvatarp->processAnimationStateChanges();
}
#endif
@@ -3441,8 +3433,8 @@ void LLAgent::teleportRequest(
bool is_local = (region_handle == to_region_handle(getPositionGlobal()));
if(regionp && teleportCore(is_local))
{
llinfos << "TeleportLocationRequest: '" << region_handle << "':" << pos_local
<< llendl;
LL_INFOS("") << "TeleportLocationRequest: '" << region_handle << "':"
<< pos_local << LL_ENDL;
LLMessageSystem* msg = gMessageSystem;
msg->newMessage("TeleportLocationRequest");
msg->nextBlockFast(_PREHASH_AgentData);
@@ -3470,7 +3462,7 @@ void LLAgent::teleportViaLandmark(const LLUUID& landmark_asset_id)
// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d)
if ( (rlv_handler_t::isEnabled()) &&
( (gRlvHandler.hasBehaviour(RLV_BHVR_TPLM)) ||
((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (mAvatarObject.notNull()) && (mAvatarObject->isSitting())) ))
((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (gAgentAvatarp) && (gAgentAvatarp->isSitting())) ))
{
RlvNotifications::notifyBlockedTeleport();
return;
@@ -3546,7 +3538,7 @@ void LLAgent::teleportViaLocation(const LLVector3d& pos_global)
{
// If we're getting teleported due to @tpto we should disregard any @tploc=n or @unsit=n restrictions from the same object
if ( (gRlvHandler.hasBehaviourExcept(RLV_BHVR_TPLOC, gRlvHandler.getCurrentObject())) ||
( (mAvatarObject.notNull()) && (mAvatarObject->isSitting()) &&
( (gAgentAvatarp) && (gAgentAvatarp->isSitting()) &&
(gRlvHandler.hasBehaviourExcept(RLV_BHVR_UNSIT, gRlvHandler.getCurrentObject()))) )
{
RlvNotifications::notifyBlockedTeleport();
@@ -3566,7 +3558,7 @@ void LLAgent::teleportViaLocation(const LLVector3d& pos_global)
bool calc = gSavedSettings.getBOOL("OptionOffsetTPByAgentHeight");
LLVector3 offset = LLVector3(0.f,0.f,0.f);
if(calc)
offset += LLVector3(0.f,0.f,gAgent.getAvatarObject()->getScale().mV[2] / 2.0);
offset += LLVector3(0.f,0.f,gAgentAvatarp->getScale().mV[2] / 2.0);
if(regionp && info)
{
LLVector3d region_origin = info->getGlobalOrigin();
@@ -3674,10 +3666,9 @@ void LLAgent::stopCurrentAnimations()
// avatar, propagating this change back to the server.
if (isAgentAvatarValid())
{
LLVOAvatar* avatarp = gAgent.getAvatarObject();
for ( LLVOAvatar::AnimIterator anim_it =
avatarp->mPlayingAnimations.begin();
anim_it != avatarp->mPlayingAnimations.end();
gAgentAvatarp->mPlayingAnimations.begin();
anim_it != gAgentAvatarp->mPlayingAnimations.end();
anim_it++)
{
if (anim_it->first ==
@@ -3690,7 +3681,7 @@ void LLAgent::stopCurrentAnimations()
else
{
// stop this animation locally
avatarp->stopMotion(anim_it->first, TRUE);
gAgentAvatarp->stopMotion(anim_it->first, TRUE);
// ...and tell the server to tell everyone.
sendAnimationRequest(anim_it->first, ANIM_REQUEST_STOP);
}
@@ -3803,13 +3794,13 @@ void LLAgent::sendAgentSetAppearance()
{
if (!isAgentAvatarValid()) return;
if (gAgentQueryManager.mNumPendingQueries > 0 && !gAgentCamera.cameraCustomizeAvatar())
if (gAgentQueryManager.mNumPendingQueries > 0 && (isAgentAvatarValid() && !gAgentCamera.cameraCustomizeAvatar()))
{
return;
}
llinfos << "TAT: Sent AgentSetAppearance: " << mAvatarObject->getBakedStatusForPrintout() << llendl;
llinfos << "TAT: Sent AgentSetAppearance: " << gAgentAvatarp->getBakedStatusForPrintout() << llendl;
//dumpAvatarTEs( "sendAgentSetAppearance()" );
LLMessageSystem* msg = gMessageSystem;
@@ -3823,7 +3814,7 @@ void LLAgent::sendAgentSetAppearance()
// NOTE -- when we start correcting all of the other Havok geometry
// to compensate for the COLLISION_TOLERANCE ugliness we will have
// to tweak this number again
LLVector3 body_size = mAvatarObject->mBodySize;
LLVector3 body_size = gAgentAvatarp->mBodySize;
body_size.mV[VX] = body_size.mV[VX] + gSavedSettings.getF32("AscentAvatarXModifier");
body_size.mV[VY] = body_size.mV[VY] + gSavedSettings.getF32("AscentAvatarYModifier");
@@ -3838,20 +3829,20 @@ void LLAgent::sendAgentSetAppearance()
// is texture data current relative to wearables?
// KLW - TAT this will probably need to check the local queue.
BOOL textures_current = !mAvatarObject->hasPendingBakedUploads() && gAgentWearables.areWearablesLoaded();
BOOL textures_current = !gAgentAvatarp->hasPendingBakedUploads() && gAgentWearables.areWearablesLoaded();
for(U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++ )
{
const ETextureIndex texture_index = getTextureIndex((EBakedTextureIndex)baked_index);
// if we're not wearing a skirt, we don't need the texture to be baked
if (texture_index == TEX_SKIRT_BAKED && !mAvatarObject->isWearingWearableType(WT_SKIRT))
if (texture_index == TEX_SKIRT_BAKED && !gAgentAvatarp->isWearingWearableType(WT_SKIRT))
{
continue;
}
// IMG_DEFAULT_AVATAR means not baked
if (!mAvatarObject->isTextureDefined(texture_index))
if (!gAgentAvatarp->isTextureDefined(texture_index))
{
textures_current = FALSE;
break;
@@ -3903,7 +3894,7 @@ void LLAgent::sendAgentSetAppearance()
LLUUID old_teid;
U8 client_buffer[UUID_BYTES];
memset(&client_buffer, 0, UUID_BYTES);
LLTextureEntry* entry = (LLTextureEntry*)mAvatarObject->getTE(0);
LLTextureEntry* entry = (LLTextureEntry*)gAgentAvatarp->getTE(0);
old_teid = entry->getID();
//You edit this to change the tag in your client. Yes.
const char* tag_client = "Ascent";
@@ -3914,16 +3905,16 @@ void LLAgent::sendAgentSetAppearance()
//This glow is used to tell if the tag color and name is set or not.
entry->setGlow(0.1f);
entry->setID(part_a);
mAvatarObject->packTEMessage( gMessageSystem, 1, gSavedSettings.getString("AscentReportClientUUID") );
gAgentAvatarp->packTEMessage( gMessageSystem, 1, gSavedSettings.getString("AscentReportClientUUID") );
entry->setID(old_teid);
}
else
{*/
if (gSavedSettings.getBOOL("AscentUseTag"))
mAvatarObject->packTEMessage( gMessageSystem, 1, gSavedSettings.getString("AscentReportClientUUID"));
gAgentAvatarp->packTEMessage( gMessageSystem, 1, gSavedSettings.getString("AscentReportClientUUID"));
else
mAvatarObject->packTEMessage( gMessageSystem, 1, "c228d1cf-4b5d-4ba8-84f4-899a0796aa97");
gAgentAvatarp->packTEMessage( gMessageSystem, 1, "c228d1cf-4b5d-4ba8-84f4-899a0796aa97");
//}
resetClientTag();
@@ -3941,9 +3932,9 @@ void LLAgent::sendAgentSetAppearance()
static bool send_physics_params = false;
send_physics_params |= !!gAgentWearables.getWearable(WT_PHYSICS);
S32 transmitted_params = 0;
for (LLViewerVisualParam* param = (LLViewerVisualParam*)mAvatarObject->getFirstVisualParam();
for (LLViewerVisualParam* param = (LLViewerVisualParam*)gAgentAvatarp->getFirstVisualParam();
param;
param = (LLViewerVisualParam*)mAvatarObject->getNextVisualParam())
param = (LLViewerVisualParam*)gAgentAvatarp->getNextVisualParam())
{
if (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) // do not transmit params of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT
{