summaryrefslogtreecommitdiff
path: root/indra/newview/llagent.cpp
diff options
context:
space:
mode:
authorbrad kittenbrink <brad@lindenlab.com>2009-08-04 15:34:34 -0700
committerbrad kittenbrink <brad@lindenlab.com>2009-08-04 15:34:34 -0700
commit33cc363a6813bf6c1268fa85747d1d403e00f8e5 (patch)
treed30696b245c4b5eb70575582d0dd9ddc4b20e5c7 /indra/newview/llagent.cpp
parentdc62495da6e5c153c0df57fdbce6b0f40c0208f2 (diff)
parent89434ef6e64462041368ab26e049011fc84ae1e3 (diff)
Merged in latest viewer-2.0.0-3 up through svn r129410. LLFloaterTOS needs some post-merge cleanup.
Diffstat (limited to 'indra/newview/llagent.cpp')
-rw-r--r--indra/newview/llagent.cpp100
1 files changed, 56 insertions, 44 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index e4db98faf2..e3d3d66d87 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -43,7 +43,6 @@
#include "llfirstuse.h"
#include "llfloaterreg.h"
#include "llfloateractivespeakers.h"
-#include "llfloateravatarinfo.h"
#include "llfloatercamera.h"
#include "llfloatercustomize.h"
#include "llfloaterdirectory.h"
@@ -503,12 +502,16 @@ void LLAgent::resetView(BOOL reset_camera, BOOL change_camera)
LLViewerJoystick::getInstance()->moveAvatar(true);
}
- LLFloaterReg::hideInstance("build");
+ //Camera Tool is needed for Free Camera Control Mode
+ if (!LLFloaterCamera::inFreeCameraMode())
+ {
+ LLFloaterReg::hideInstance("build");
+
+ // Switch back to basic toolset
+ LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
+ }
gViewerWindow->showCursor();
-
- // Switch back to basic toolset
- LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
}
@@ -759,7 +762,7 @@ void LLAgent::setFlying(BOOL fly)
}
// don't allow taking off while sitting
- if (fly && mAvatarObject->mIsSitting)
+ if (fly && mAvatarObject->isSitting())
{
return;
}
@@ -788,6 +791,11 @@ void LLAgent::setFlying(BOOL fly)
clearControlFlags(AGENT_CONTROL_FLY);
gSavedSettings.setBOOL("FlyBtnState", FALSE);
}
+
+
+ // Update Movement Controls according to Fly mode
+ LLFloaterMove::setFlyingMode(fly);
+
mbFlagsDirty = TRUE;
}
@@ -811,11 +819,16 @@ bool LLAgent::enableFlying()
BOOL sitting = FALSE;
if (gAgent.getAvatarObject())
{
- sitting = gAgent.getAvatarObject()->mIsSitting;
+ sitting = gAgent.getAvatarObject()->isSitting();
}
return !sitting;
}
+void LLAgent::standUp()
+{
+ setControlFlags(AGENT_CONTROL_STAND_UP);
+}
+
//-----------------------------------------------------------------------------
// setRegion()
@@ -1246,7 +1259,7 @@ F32 LLAgent::clampPitchToLimits(F32 angle)
F32 angle_from_skyward = acos( mFrameAgent.getAtAxis() * skyward );
- if (mAvatarObject.notNull() && mAvatarObject->mIsSitting)
+ if (mAvatarObject.notNull() && mAvatarObject->isSitting())
{
look_down_limit = 130.f * DEG_TO_RAD;
}
@@ -2492,13 +2505,11 @@ void LLAgent::autoPilot(F32 *delta_yaw)
void LLAgent::propagate(const F32 dt)
{
// Update UI based on agent motion
- LLFloaterMove *floater_move = LLFloaterReg::getTypedInstance<LLFloaterMove>("moveview");
+ LLFloaterMove *floater_move = LLFloaterReg::findTypedInstance<LLFloaterMove>("moveview");
if (floater_move)
{
floater_move->mForwardButton ->setToggleState( mAtKey > 0 || mWalkKey > 0 );
floater_move->mBackwardButton ->setToggleState( mAtKey < 0 || mWalkKey < 0 );
- floater_move->mSlideLeftButton ->setToggleState( mLeftKey > 0 );
- floater_move->mSlideRightButton->setToggleState( mLeftKey < 0 );
floater_move->mTurnLeftButton ->setToggleState( mYawKey > 0.f );
floater_move->mTurnRightButton ->setToggleState( mYawKey < 0.f );
floater_move->mMoveUpButton ->setToggleState( mUpKey > 0 );
@@ -2583,7 +2594,7 @@ void LLAgent::updateLookAt(const S32 mouse_x, const S32 mouse_y)
else
{
// *FIX: rotate mframeagent by sit object's rotation?
- LLQuaternion look_rotation = mAvatarObject->mIsSitting ? mAvatarObject->getRenderRotation() : mFrameAgent.getQuaternion(); // use camera's current rotation
+ LLQuaternion look_rotation = mAvatarObject->isSitting() ? mAvatarObject->getRenderRotation() : mFrameAgent.getQuaternion(); // use camera's current rotation
LLVector3 look_offset = LLVector3(2.f, 0.f, 0.f) * look_rotation * av_inv_rot;
setLookAt(LOOKAT_TARGET_IDLE, mAvatarObject, look_offset);
}
@@ -2819,6 +2830,8 @@ void LLAgent::endAnimationUpdateUI()
LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
+ LLFloaterCamera::toPrevModeIfInAvatarViewMode();
+
// Only pop if we have pushed...
if (TRUE == mViewsPushed)
{
@@ -2913,6 +2926,10 @@ void LLAgent::endAnimationUpdateUI()
// JC - Added for always chat in third person option
gFocusMgr.setKeyboardFocus(NULL);
+ //Making sure Camera Controls floater is in the right state
+ //when entering Mouse Look using wheel scrolling
+ LLFloaterCamera::updateIfNotInAvatarViewMode();
+
LLToolMgr::getInstance()->setCurrentToolset(gMouselookToolset);
mViewsPushed = TRUE;
@@ -3023,7 +3040,7 @@ void LLAgent::updateCamera()
validateFocusObject();
if (mAvatarObject.notNull() &&
- mAvatarObject->mIsSitting &&
+ mAvatarObject->isSitting() &&
camera_mode == CAMERA_MODE_MOUSELOOK)
{
//Ventrella
@@ -3054,24 +3071,24 @@ void LLAgent::updateCamera()
}
// Update UI with our camera inputs
- LLFloaterCamera* camera_instance = LLFloaterReg::getTypedInstance<LLFloaterCamera>("camera");
- if(camera_instance)
+ LLFloaterCamera* camera_floater = LLFloaterReg::findTypedInstance<LLFloaterCamera>("camera");
+ if (camera_floater)
{
- camera_instance->mRotate->setToggleState(
- mOrbitRightKey > 0.f, // left
- mOrbitUpKey > 0.f, // top
- mOrbitLeftKey > 0.f, // right
- mOrbitDownKey > 0.f); // bottom
+ camera_floater->mRotate->setToggleState(
+ mOrbitRightKey > 0.f, // left
+ mOrbitUpKey > 0.f, // top
+ mOrbitLeftKey > 0.f, // right
+ mOrbitDownKey > 0.f); // bottom
- camera_instance->mZoom->setToggleState(
- mOrbitInKey > 0.f, // top
- mOrbitOutKey > 0.f); // bottom
+ camera_floater->mZoom->setToggleState(
+ mOrbitInKey > 0.f, // top
+ mOrbitOutKey > 0.f); // bottom
- camera_instance->mTrack->setToggleState(
- mPanLeftKey > 0.f, // left
- mPanUpKey > 0.f, // top
- mPanRightKey > 0.f, // right
- mPanDownKey > 0.f); // bottom
+ camera_floater->mTrack->setToggleState(
+ mPanLeftKey > 0.f, // left
+ mPanUpKey > 0.f, // top
+ mPanRightKey > 0.f, // right
+ mPanDownKey > 0.f); // bottom
}
// Handle camera movement based on keyboard.
@@ -3148,7 +3165,7 @@ void LLAgent::updateCamera()
// (2) focus, and (3) upvector. They can then be queried elsewhere in llAgent.
//--------------------------------------------------------------------------------
// *TODO: use combined rotation of frameagent and sit object
- LLQuaternion avatarRotationForFollowCam = mAvatarObject->mIsSitting ? mAvatarObject->getRenderRotation() : mFrameAgent.getQuaternion();
+ LLQuaternion avatarRotationForFollowCam = mAvatarObject->isSitting() ? mAvatarObject->getRenderRotation() : mFrameAgent.getQuaternion();
LLFollowCamParams* current_cam = LLFollowCamMgr::getActiveFollowCamParams();
if (current_cam)
@@ -3328,7 +3345,7 @@ void LLAgent::updateCamera()
}
mLastPositionGlobal = global_pos;
- if (LLVOAvatar::sVisibleInFirstPerson && mAvatarObject.notNull() && !mAvatarObject->mIsSitting && cameraMouselook())
+ if (LLVOAvatar::sVisibleInFirstPerson && mAvatarObject.notNull() && !mAvatarObject->isSitting() && cameraMouselook())
{
LLVector3 head_pos = mAvatarObject->mHeadp->getWorldPosition() +
LLVector3(0.08f, 0.f, 0.05f) * mAvatarObject->mHeadp->getWorldRotation() +
@@ -3508,7 +3525,7 @@ LLVector3d LLAgent::calcFocusPositionTargetGlobal()
}
return mFocusTargetGlobal;
}
- else if (mSitCameraEnabled && mAvatarObject.notNull() && mAvatarObject->mIsSitting && mSitCameraReferenceObject.notNull())
+ else if (mSitCameraEnabled && mAvatarObject.notNull() && mAvatarObject->isSitting() && mSitCameraReferenceObject.notNull())
{
// sit camera
LLVector3 object_pos = mSitCameraReferenceObject->getRenderPosition();
@@ -3632,7 +3649,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit)
return LLVector3d::zero;
}
head_offset.clearVec();
- if (mAvatarObject->mIsSitting && mAvatarObject->getParent())
+ if (mAvatarObject->isSitting() && mAvatarObject->getParent())
{
mAvatarObject->updateHeadOffset();
head_offset.mdV[VX] = mAvatarObject->mHeadOffset.mV[VX];
@@ -3646,7 +3663,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit)
else
{
head_offset.mdV[VZ] = mAvatarObject->mHeadOffset.mV[VZ];
- if (mAvatarObject->mIsSitting)
+ if (mAvatarObject->isSitting())
{
head_offset.mdV[VZ] += 0.1;
}
@@ -3662,7 +3679,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit)
if (mSitCameraEnabled
&& mAvatarObject.notNull()
- && mAvatarObject->mIsSitting
+ && mAvatarObject->isSitting()
&& mSitCameraReferenceObject.notNull())
{
// sit camera
@@ -3694,7 +3711,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit)
local_camera_offset = mFrameAgent.rotateToAbsolute( local_camera_offset );
}
- if (!mCameraCollidePlane.isExactlyZero() && (mAvatarObject.isNull() || !mAvatarObject->mIsSitting))
+ if (!mCameraCollidePlane.isExactlyZero() && (mAvatarObject.isNull() || !mAvatarObject->isSitting()))
{
LLVector3 plane_normal;
plane_normal.setVec(mCameraCollidePlane.mV);
@@ -4120,7 +4137,7 @@ void LLAgent::changeCameraToThirdPerson(BOOL animate)
if (mAvatarObject.notNull())
{
- if (!mAvatarObject->mIsSitting)
+ if (!mAvatarObject->isSitting())
{
mAvatarObject->mPelvisp->setPosition(LLVector3::zero);
}
@@ -4202,7 +4219,7 @@ void LLAgent::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL camera_ani
return;
}
- setControlFlags(AGENT_CONTROL_STAND_UP); // force stand up
+ standUp(); // force stand up
gViewerWindow->getWindow()->resetBusyCount();
if (gFaceEditToolset)
@@ -5482,13 +5499,8 @@ void update_group_floaters(const LLUUID& group_id)
{
LLFloaterGroupInfo::refreshGroup(group_id);
- //*TODO Implement group update for Profile View
- // update avatar info
-// LLFloaterAvatarInfo* fa = LLFloaterReg::findTypedInstance<LLFloaterAvatarInfo>("preview_avatar", LLSD(gAgent.getID()));
-// if(fa)
-// {
-// fa->resetGroupList();
-// }
+ //*TODO Implement group update for Profile View
+ // still actual as of July 31, 2009 (DZ)
if (gIMMgr)
{