diff options
Diffstat (limited to 'linden/indra/newview/llagent.cpp')
-rw-r--r-- | linden/indra/newview/llagent.cpp | 191 |
1 files changed, 164 insertions, 27 deletions
diff --git a/linden/indra/newview/llagent.cpp b/linden/indra/newview/llagent.cpp index 94cbddc..77e743d 100644 --- a/linden/indra/newview/llagent.cpp +++ b/linden/indra/newview/llagent.cpp | |||
@@ -12,12 +12,12 @@ | |||
12 | * ("GPL"), unless you have obtained a separate licensing agreement | 12 | * ("GPL"), unless you have obtained a separate licensing agreement |
13 | * ("Other License"), formally executed by you and Linden Lab. Terms of | 13 | * ("Other License"), formally executed by you and Linden Lab. Terms of |
14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | 14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or |
15 | * online at http://secondlife.com/developers/opensource/gplv2 | 15 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 |
16 | * | 16 | * |
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://secondlife.com/developers/opensource/flossexception | 20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception |
21 | * | 21 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 22 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 23 | * that you have read and understood your obligations described above, |
@@ -102,6 +102,7 @@ | |||
102 | #include "lltoolpie.h" | 102 | #include "lltoolpie.h" |
103 | #include "lltoolview.h" | 103 | #include "lltoolview.h" |
104 | #include "llui.h" // for make_ui_sound | 104 | #include "llui.h" // for make_ui_sound |
105 | #include "llurldispatcher.h" | ||
105 | #include "llviewercamera.h" | 106 | #include "llviewercamera.h" |
106 | #include "llviewerinventory.h" | 107 | #include "llviewerinventory.h" |
107 | #include "llviewermenu.h" | 108 | #include "llviewermenu.h" |
@@ -304,7 +305,7 @@ LLAgent::LLAgent() | |||
304 | 305 | ||
305 | mbAlwaysRun(FALSE), | 306 | mbAlwaysRun(FALSE), |
306 | mShowAvatar(TRUE), | 307 | mShowAvatar(TRUE), |
307 | 308 | ||
308 | mCameraAnimating( FALSE ), | 309 | mCameraAnimating( FALSE ), |
309 | mAnimationCameraStartGlobal(), | 310 | mAnimationCameraStartGlobal(), |
310 | mAnimationFocusStartGlobal(), | 311 | mAnimationFocusStartGlobal(), |
@@ -409,6 +410,8 @@ LLAgent::LLAgent() | |||
409 | mCameraUpVector = LLVector3::z_axis;// default is straight up | 410 | mCameraUpVector = LLVector3::z_axis;// default is straight up |
410 | mFollowCam.setMaxCameraDistantFromSubject( MAX_CAMERA_DISTANCE_FROM_AGENT ); | 411 | mFollowCam.setMaxCameraDistantFromSubject( MAX_CAMERA_DISTANCE_FROM_AGENT ); |
411 | //end ventrella | 412 | //end ventrella |
413 | |||
414 | mCustomAnim = FALSE ; | ||
412 | } | 415 | } |
413 | 416 | ||
414 | // Requires gSavedSettings to be initialized. | 417 | // Requires gSavedSettings to be initialized. |
@@ -904,6 +907,24 @@ const LLHost& LLAgent::getRegionHost() const | |||
904 | } | 907 | } |
905 | } | 908 | } |
906 | 909 | ||
910 | //----------------------------------------------------------------------------- | ||
911 | // getSLURL() | ||
912 | // returns empty() if getRegion() == NULL | ||
913 | //----------------------------------------------------------------------------- | ||
914 | std::string LLAgent::getSLURL() const | ||
915 | { | ||
916 | std::string slurl; | ||
917 | LLViewerRegion *regionp = getRegion(); | ||
918 | if (regionp) | ||
919 | { | ||
920 | LLVector3d agentPos = getPositionGlobal(); | ||
921 | S32 x = llround( (F32)fmod( agentPos.mdV[VX], (F64)REGION_WIDTH_METERS ) ); | ||
922 | S32 y = llround( (F32)fmod( agentPos.mdV[VY], (F64)REGION_WIDTH_METERS ) ); | ||
923 | S32 z = llround( (F32)agentPos.mdV[VZ] ); | ||
924 | slurl = LLURLDispatcher::buildSLURL(regionp->getName(), x, y, z); | ||
925 | } | ||
926 | return slurl; | ||
927 | } | ||
907 | 928 | ||
908 | //----------------------------------------------------------------------------- | 929 | //----------------------------------------------------------------------------- |
909 | // inPrelude() | 930 | // inPrelude() |
@@ -1021,7 +1042,7 @@ void LLAgent::slamLookAt(const LLVector3 &look_at) | |||
1021 | //----------------------------------------------------------------------------- | 1042 | //----------------------------------------------------------------------------- |
1022 | // getPositionGlobal() | 1043 | // getPositionGlobal() |
1023 | //----------------------------------------------------------------------------- | 1044 | //----------------------------------------------------------------------------- |
1024 | const LLVector3d &LLAgent::getPositionGlobal() | 1045 | const LLVector3d &LLAgent::getPositionGlobal() const |
1025 | { | 1046 | { |
1026 | if (!mAvatarObject.isNull() && !mAvatarObject->mDrawable.isNull()) | 1047 | if (!mAvatarObject.isNull() && !mAvatarObject->mDrawable.isNull()) |
1027 | { | 1048 | { |
@@ -2842,8 +2863,14 @@ void LLAgent::endAnimationUpdateUI() | |||
2842 | 2863 | ||
2843 | if (mAvatarObject) | 2864 | if (mAvatarObject) |
2844 | { | 2865 | { |
2845 | sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_STOP); | 2866 | if(mCustomAnim) |
2846 | sendAnimationRequest(ANIM_AGENT_CUSTOMIZE_DONE, ANIM_REQUEST_START); | 2867 | { |
2868 | sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_STOP); | ||
2869 | sendAnimationRequest(ANIM_AGENT_CUSTOMIZE_DONE, ANIM_REQUEST_START); | ||
2870 | |||
2871 | mCustomAnim = FALSE ; | ||
2872 | } | ||
2873 | |||
2847 | } | 2874 | } |
2848 | setLookAt(LOOKAT_TARGET_CLEAR); | 2875 | setLookAt(LOOKAT_TARGET_CLEAR); |
2849 | } | 2876 | } |
@@ -2861,7 +2888,7 @@ void LLAgent::endAnimationUpdateUI() | |||
2861 | mCameraLag.clearVec(); | 2888 | mCameraLag.clearVec(); |
2862 | 2889 | ||
2863 | // JC - Added for always chat in third person option | 2890 | // JC - Added for always chat in third person option |
2864 | gFocusMgr.setKeyboardFocus(NULL, NULL); | 2891 | gFocusMgr.setKeyboardFocus(NULL); |
2865 | 2892 | ||
2866 | gToolMgr->setCurrentToolset(gMouselookToolset); | 2893 | gToolMgr->setCurrentToolset(gMouselookToolset); |
2867 | 2894 | ||
@@ -3985,7 +4012,7 @@ void LLAgent::changeCameraToMouselook(BOOL animate) | |||
3985 | 4012 | ||
3986 | if( mCameraMode != CAMERA_MODE_MOUSELOOK ) | 4013 | if( mCameraMode != CAMERA_MODE_MOUSELOOK ) |
3987 | { | 4014 | { |
3988 | gViewerWindow->setKeyboardFocus( NULL, NULL ); | 4015 | gViewerWindow->setKeyboardFocus( NULL ); |
3989 | 4016 | ||
3990 | mLastCameraMode = mCameraMode; | 4017 | mLastCameraMode = mCameraMode; |
3991 | mCameraMode = CAMERA_MODE_MOUSELOOK; | 4018 | mCameraMode = CAMERA_MODE_MOUSELOOK; |
@@ -4169,7 +4196,7 @@ void LLAgent::changeCameraToThirdPerson(BOOL animate) | |||
4169 | //----------------------------------------------------------------------------- | 4196 | //----------------------------------------------------------------------------- |
4170 | // changeCameraToCustomizeAvatar() | 4197 | // changeCameraToCustomizeAvatar() |
4171 | //----------------------------------------------------------------------------- | 4198 | //----------------------------------------------------------------------------- |
4172 | void LLAgent::changeCameraToCustomizeAvatar(BOOL animate) | 4199 | void LLAgent::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL camera_animate) |
4173 | { | 4200 | { |
4174 | setControlFlags(AGENT_CONTROL_STAND_UP); // force stand up | 4201 | setControlFlags(AGENT_CONTROL_STAND_UP); // force stand up |
4175 | gViewerWindow->getWindow()->resetBusyCount(); | 4202 | gViewerWindow->getWindow()->resetBusyCount(); |
@@ -4184,16 +4211,16 @@ void LLAgent::changeCameraToCustomizeAvatar(BOOL animate) | |||
4184 | gSavedSettings.setBOOL("ThirdPersonBtnState", FALSE); | 4211 | gSavedSettings.setBOOL("ThirdPersonBtnState", FALSE); |
4185 | gSavedSettings.setBOOL("BuildBtnState", FALSE); | 4212 | gSavedSettings.setBOOL("BuildBtnState", FALSE); |
4186 | 4213 | ||
4187 | if (animate) | 4214 | if (camera_animate) |
4188 | { | 4215 | { |
4189 | startCameraAnimation(); | 4216 | startCameraAnimation(); |
4190 | } | 4217 | } |
4191 | 4218 | ||
4192 | // Remove any pitch from the avatar | 4219 | // Remove any pitch from the avatar |
4193 | LLVector3 at = mFrameAgent.getAtAxis(); | 4220 | //LLVector3 at = mFrameAgent.getAtAxis(); |
4194 | at.mV[VZ] = 0.f; | 4221 | //at.mV[VZ] = 0.f; |
4195 | at.normVec(); | 4222 | //at.normVec(); |
4196 | gAgent.resetAxes(at); | 4223 | //gAgent.resetAxes(at); |
4197 | 4224 | ||
4198 | if( mCameraMode != CAMERA_MODE_CUSTOMIZE_AVATAR ) | 4225 | if( mCameraMode != CAMERA_MODE_CUSTOMIZE_AVATAR ) |
4199 | { | 4226 | { |
@@ -4206,28 +4233,37 @@ void LLAgent::changeCameraToCustomizeAvatar(BOOL animate) | |||
4206 | mbFlagsDirty = TRUE; | 4233 | mbFlagsDirty = TRUE; |
4207 | } | 4234 | } |
4208 | 4235 | ||
4209 | gViewerWindow->setKeyboardFocus( NULL, NULL ); | 4236 | gViewerWindow->setKeyboardFocus( NULL ); |
4210 | gViewerWindow->setMouseCapture( NULL ); | 4237 | gViewerWindow->setMouseCapture( NULL ); |
4211 | 4238 | ||
4212 | LLVOAvatar::onCustomizeStart(); | 4239 | LLVOAvatar::onCustomizeStart(); |
4213 | } | 4240 | } |
4214 | 4241 | ||
4215 | if (animate && !mAvatarObject.isNull()) | 4242 | if (!mAvatarObject.isNull()) |
4216 | { | 4243 | { |
4217 | sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_START); | 4244 | if(avatar_animate) |
4218 | mAvatarObject->startMotion(ANIM_AGENT_CUSTOMIZE); | ||
4219 | LLMotion* turn_motion = mAvatarObject->findMotion(ANIM_AGENT_CUSTOMIZE); | ||
4220 | |||
4221 | if (turn_motion) | ||
4222 | { | 4245 | { |
4223 | mAnimationDuration = turn_motion->getDuration() + CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP; | 4246 | // Remove any pitch from the avatar |
4247 | LLVector3 at = mFrameAgent.getAtAxis(); | ||
4248 | at.mV[VZ] = 0.f; | ||
4249 | at.normVec(); | ||
4250 | gAgent.resetAxes(at); | ||
4224 | 4251 | ||
4225 | } | 4252 | sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_START); |
4226 | else | 4253 | mCustomAnim = TRUE ; |
4227 | { | 4254 | mAvatarObject->startMotion(ANIM_AGENT_CUSTOMIZE); |
4228 | mAnimationDuration = gSavedSettings.getF32("ZoomTime"); | 4255 | LLMotion* turn_motion = mAvatarObject->findMotion(ANIM_AGENT_CUSTOMIZE); |
4229 | } | ||
4230 | 4256 | ||
4257 | if (turn_motion) | ||
4258 | { | ||
4259 | mAnimationDuration = turn_motion->getDuration() + CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP; | ||
4260 | |||
4261 | } | ||
4262 | else | ||
4263 | { | ||
4264 | mAnimationDuration = gSavedSettings.getF32("ZoomTime"); | ||
4265 | } | ||
4266 | } | ||
4231 | 4267 | ||
4232 | 4268 | ||
4233 | 4269 | ||
@@ -5206,6 +5242,102 @@ void LLAgent::processAgentDropGroup(LLMessageSystem *msg, void **) | |||
5206 | } | 5242 | } |
5207 | } | 5243 | } |
5208 | 5244 | ||
5245 | class LLAgentDropGroupViewerNode : public LLHTTPNode | ||
5246 | { | ||
5247 | virtual void post( | ||
5248 | LLHTTPNode::ResponsePtr response, | ||
5249 | const LLSD& context, | ||
5250 | const LLSD& input) const | ||
5251 | { | ||
5252 | |||
5253 | if ( | ||
5254 | !input.isMap() || | ||
5255 | !input.has("body") ) | ||
5256 | { | ||
5257 | //what to do with badly formed message? | ||
5258 | response->status(400); | ||
5259 | response->result(LLSD("Invalid message parameters")); | ||
5260 | } | ||
5261 | |||
5262 | LLSD body = input["body"]; | ||
5263 | if ( body.has("body") ) | ||
5264 | { | ||
5265 | //stupid message system doubles up the "body"s | ||
5266 | body = body["body"]; | ||
5267 | } | ||
5268 | |||
5269 | if ( | ||
5270 | body.has("AgentData") && | ||
5271 | body["AgentData"].isArray() && | ||
5272 | body["AgentData"][0].isMap() ) | ||
5273 | { | ||
5274 | llinfos << "VALID DROP GROUP" << llendl; | ||
5275 | |||
5276 | //there is only one set of data in the AgentData block | ||
5277 | LLSD agent_data = body["AgentData"][0]; | ||
5278 | LLUUID agent_id; | ||
5279 | LLUUID group_id; | ||
5280 | |||
5281 | agent_id = agent_data["AgentID"].asUUID(); | ||
5282 | group_id = agent_data["GroupID"].asUUID(); | ||
5283 | |||
5284 | if (agent_id != gAgentID) | ||
5285 | { | ||
5286 | llwarns | ||
5287 | << "AgentDropGroup for agent other than me" << llendl; | ||
5288 | |||
5289 | response->notFound(); | ||
5290 | return; | ||
5291 | } | ||
5292 | |||
5293 | // Remove the group if it already exists remove it | ||
5294 | // and add the new data to pick up changes. | ||
5295 | LLGroupData gd; | ||
5296 | gd.mID = group_id; | ||
5297 | S32 index = gAgent.mGroups.find(gd); | ||
5298 | if (index != -1) | ||
5299 | { | ||
5300 | gAgent.mGroups.remove(index); | ||
5301 | if (gAgent.getGroupID() == group_id) | ||
5302 | { | ||
5303 | gAgent.mGroupID.setNull(); | ||
5304 | gAgent.mGroupPowers = 0; | ||
5305 | gAgent.mGroupName[0] = '\0'; | ||
5306 | gAgent.mGroupTitle[0] = '\0'; | ||
5307 | } | ||
5308 | |||
5309 | // refresh all group information | ||
5310 | gAgent.sendAgentDataUpdateRequest(); | ||
5311 | |||
5312 | gGroupMgr->clearGroupData(group_id); | ||
5313 | // close the floater for this group, if any. | ||
5314 | LLFloaterGroupInfo::closeGroup(group_id); | ||
5315 | // refresh the group panel of the search window, | ||
5316 | //if necessary. | ||
5317 | LLFloaterDirectory::refreshGroup(group_id); | ||
5318 | } | ||
5319 | else | ||
5320 | { | ||
5321 | llwarns | ||
5322 | << "AgentDropGroup, agent is not part of group " | ||
5323 | << group_id << llendl; | ||
5324 | } | ||
5325 | |||
5326 | response->result(LLSD()); | ||
5327 | } | ||
5328 | else | ||
5329 | { | ||
5330 | //what to do with badly formed message? | ||
5331 | response->status(400); | ||
5332 | response->result(LLSD("Invalid message parameters")); | ||
5333 | } | ||
5334 | } | ||
5335 | }; | ||
5336 | |||
5337 | LLHTTPRegistration<LLAgentDropGroupViewerNode> | ||
5338 | gHTTPRegistrationAgentDropGroupViewerNode( | ||
5339 | "/message/AgentDropGroup"); | ||
5340 | |||
5209 | // static | 5341 | // static |
5210 | void LLAgent::processAgentGroupDataUpdate(LLMessageSystem *msg, void **) | 5342 | void LLAgent::processAgentGroupDataUpdate(LLMessageSystem *msg, void **) |
5211 | { | 5343 | { |
@@ -5783,6 +5915,11 @@ void LLAgent::setTeleportState(ETeleportState state) | |||
5783 | { | 5915 | { |
5784 | LLFloaterSnapshot::hide(0); | 5916 | LLFloaterSnapshot::hide(0); |
5785 | } | 5917 | } |
5918 | if (mTeleportState == TELEPORT_MOVING) | ||
5919 | { | ||
5920 | // We're outa here. Save "back" slurl. | ||
5921 | mTeleportSourceSLURL = getSLURL(); | ||
5922 | } | ||
5786 | } | 5923 | } |
5787 | 5924 | ||
5788 | void LLAgent::fidget() | 5925 | void LLAgent::fidget() |