diff options
author | Jacek Antonelli | 2008-08-15 23:44:54 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:54 -0500 |
commit | b2afb8800bb033a04bb3ecdf0363068d56648ef1 (patch) | |
tree | 3568129b5bbddb47cd39d622b4137a8fbff4abaf /linden/indra/newview/llagent.cpp | |
parent | Second Life viewer sources 1.14.0.1 (diff) | |
download | meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.zip meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.gz meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.bz2 meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.xz |
Second Life viewer sources 1.15.0.2
Diffstat (limited to 'linden/indra/newview/llagent.cpp')
-rw-r--r-- | linden/indra/newview/llagent.cpp | 101 |
1 files changed, 60 insertions, 41 deletions
diff --git a/linden/indra/newview/llagent.cpp b/linden/indra/newview/llagent.cpp index a6ec948..ff16682 100644 --- a/linden/indra/newview/llagent.cpp +++ b/linden/indra/newview/llagent.cpp | |||
@@ -4,6 +4,7 @@ | |||
4 | * | 4 | * |
5 | * Copyright (c) 2001-2007, Linden Research, Inc. | 5 | * Copyright (c) 2001-2007, Linden Research, Inc. |
6 | * | 6 | * |
7 | * Second Life Viewer Source Code | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | 8 | * The source code in this file ("Source Code") is provided by Linden Lab |
8 | * to you under the terms of the GNU General Public License, version 2.0 | 9 | * to you under the terms of the GNU General Public License, version 2.0 |
9 | * ("GPL"), unless you have obtained a separate licensing agreement | 10 | * ("GPL"), unless you have obtained a separate licensing agreement |
@@ -222,6 +223,9 @@ BOOL LLAgent::sDebugDisplayTarget = FALSE; | |||
222 | 223 | ||
223 | const F32 LLAgent::TYPING_TIMEOUT_SECS = 5.f; | 224 | const F32 LLAgent::TYPING_TIMEOUT_SECS = 5.f; |
224 | 225 | ||
226 | std::map<LLString, LLString> LLAgent::sTeleportErrorMessages; | ||
227 | std::map<LLString, LLString> LLAgent::sTeleportProgressMessages; | ||
228 | |||
225 | class LLAgentFriendObserver : public LLFriendObserver | 229 | class LLAgentFriendObserver : public LLFriendObserver |
226 | { | 230 | { |
227 | public: | 231 | public: |
@@ -328,9 +332,6 @@ LLAgent::LLAgent() | |||
328 | 332 | ||
329 | mbJump(FALSE), | 333 | mbJump(FALSE), |
330 | 334 | ||
331 | mWanderTimer(), | ||
332 | mWanderTargetGlobal( LLVector3d::zero ), | ||
333 | |||
334 | mAutoPilot(FALSE), | 335 | mAutoPilot(FALSE), |
335 | mAutoPilotFlyOnStop(FALSE), | 336 | mAutoPilotFlyOnStop(FALSE), |
336 | mAutoPilotTargetGlobal(), | 337 | mAutoPilotTargetGlobal(), |
@@ -2116,36 +2117,6 @@ BOOL LLAgent::getBusy() const | |||
2116 | 2117 | ||
2117 | 2118 | ||
2118 | //----------------------------------------------------------------------------- | 2119 | //----------------------------------------------------------------------------- |
2119 | // updateWanderTarget() | ||
2120 | //----------------------------------------------------------------------------- | ||
2121 | void LLAgent::updateWanderTarget() | ||
2122 | { | ||
2123 | S32 num_regions; | ||
2124 | LLViewerRegion* rand_region; | ||
2125 | F32 rand_x; | ||
2126 | F32 rand_y; | ||
2127 | |||
2128 | if (mWanderTimer.checkExpirationAndReset(ll_frand(MAX_WANDER_TIME))) | ||
2129 | { | ||
2130 | // Pick a random spot to wander towards | ||
2131 | num_regions = gWorldPointer->mActiveRegionList.getLength(); | ||
2132 | S32 region_num = llround(ll_frand() * num_regions); | ||
2133 | rand_region = gWorldPointer->mActiveRegionList.getFirstData(); | ||
2134 | S32 i = 0; | ||
2135 | while (i < region_num) | ||
2136 | { | ||
2137 | rand_region = gWorldPointer->mActiveRegionList.getNextData(); | ||
2138 | i++; | ||
2139 | } | ||
2140 | rand_x = ll_frand(rand_region->getWidth()); | ||
2141 | rand_y = ll_frand(rand_region->getWidth()); | ||
2142 | |||
2143 | stopAutoPilot(); | ||
2144 | startAutoPilotGlobal(rand_region->getPosGlobalFromRegion(LLVector3(rand_x, rand_y, 0.f))); | ||
2145 | } | ||
2146 | } | ||
2147 | |||
2148 | //----------------------------------------------------------------------------- | ||
2149 | // startAutoPilotGlobal() | 2120 | // startAutoPilotGlobal() |
2150 | //----------------------------------------------------------------------------- | 2121 | //----------------------------------------------------------------------------- |
2151 | void LLAgent::startAutoPilotGlobal(const LLVector3d &target_global, const std::string& behavior_name, const LLQuaternion *target_rotation, void (*finish_callback)(BOOL, void *), void *callback_data, F32 stop_distance, F32 rot_threshold) | 2122 | void LLAgent::startAutoPilotGlobal(const LLVector3d &target_global, const std::string& behavior_name, const LLQuaternion *target_rotation, void (*finish_callback)(BOOL, void *), void *callback_data, F32 stop_distance, F32 rot_threshold) |
@@ -4062,10 +4033,6 @@ void LLAgent::changeCameraToFollow(BOOL animate) | |||
4062 | mbFlagsDirty = TRUE; | 4033 | mbFlagsDirty = TRUE; |
4063 | } | 4034 | } |
4064 | 4035 | ||
4065 | //RN: this doesn't seem to be necessary and destroys the UE for script-driven cameras | ||
4066 | //gViewerWindow->setKeyboardFocus( NULL, NULL ); | ||
4067 | //gViewerWindow->setMouseCapture( NULL, NULL ); | ||
4068 | |||
4069 | if (animate) | 4036 | if (animate) |
4070 | { | 4037 | { |
4071 | startCameraAnimation(); | 4038 | startCameraAnimation(); |
@@ -4129,9 +4096,6 @@ void LLAgent::changeCameraToThirdPerson(BOOL animate) | |||
4129 | mbFlagsDirty = TRUE; | 4096 | mbFlagsDirty = TRUE; |
4130 | } | 4097 | } |
4131 | 4098 | ||
4132 | //RN: this doesn't seem to be necessary and destroys the UE for script-driven cameras | ||
4133 | //gViewerWindow->setKeyboardFocus( NULL, NULL ); | ||
4134 | //gViewerWindow->setMouseCapture( NULL, NULL ); | ||
4135 | } | 4099 | } |
4136 | 4100 | ||
4137 | // Remove any pitch from the avatar | 4101 | // Remove any pitch from the avatar |
@@ -4204,7 +4168,7 @@ void LLAgent::changeCameraToCustomizeAvatar(BOOL animate) | |||
4204 | } | 4168 | } |
4205 | 4169 | ||
4206 | gViewerWindow->setKeyboardFocus( NULL, NULL ); | 4170 | gViewerWindow->setKeyboardFocus( NULL, NULL ); |
4207 | gViewerWindow->setMouseCapture( NULL, NULL ); | 4171 | gViewerWindow->setMouseCapture( NULL ); |
4208 | 4172 | ||
4209 | LLVOAvatar::onCustomizeStart(); | 4173 | LLVOAvatar::onCustomizeStart(); |
4210 | } | 4174 | } |
@@ -5531,6 +5495,8 @@ bool LLAgent::teleportCore(bool is_local) | |||
5531 | LLFloaterWorldMap::hide(NULL); | 5495 | LLFloaterWorldMap::hide(NULL); |
5532 | LLFloaterDirectory::hide(NULL); | 5496 | LLFloaterDirectory::hide(NULL); |
5533 | 5497 | ||
5498 | gParcelMgr->deselectLand(); | ||
5499 | |||
5534 | // Close all pie menus, deselect land, etc. | 5500 | // Close all pie menus, deselect land, etc. |
5535 | // Don't change the camera until we know teleport succeeded. JC | 5501 | // Don't change the camera until we know teleport succeeded. JC |
5536 | resetView(FALSE); | 5502 | resetView(FALSE); |
@@ -7256,4 +7222,57 @@ void LLAgent::observeFriends() | |||
7256 | } | 7222 | } |
7257 | } | 7223 | } |
7258 | 7224 | ||
7225 | void LLAgent::parseTeleportMessages(const LLString& xml_filename) | ||
7226 | { | ||
7227 | LLXMLNodePtr root; | ||
7228 | BOOL success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root); | ||
7229 | |||
7230 | if (!success || !root || !root->hasName( "teleport_messages" )) | ||
7231 | { | ||
7232 | llerrs << "Problem reading teleport string XML file: " | ||
7233 | << xml_filename << llendl; | ||
7234 | return; | ||
7235 | } | ||
7236 | |||
7237 | for (LLXMLNode* message_set = root->getFirstChild(); | ||
7238 | message_set != NULL; | ||
7239 | message_set = message_set->getNextSibling()) | ||
7240 | { | ||
7241 | if ( !message_set->hasName("message_set") ) continue; | ||
7242 | |||
7243 | std::map<LLString, LLString> *teleport_msg_map = NULL; | ||
7244 | LLString message_set_name; | ||
7245 | |||
7246 | if ( message_set->getAttributeString("name", message_set_name) ) | ||
7247 | { | ||
7248 | //now we loop over all the string in the set and add them | ||
7249 | //to the appropriate set | ||
7250 | if ( message_set_name == "errors" ) | ||
7251 | { | ||
7252 | teleport_msg_map = &sTeleportErrorMessages; | ||
7253 | } | ||
7254 | else if ( message_set_name == "progress" ) | ||
7255 | { | ||
7256 | teleport_msg_map = &sTeleportProgressMessages; | ||
7257 | } | ||
7258 | } | ||
7259 | |||
7260 | if ( !teleport_msg_map ) continue; | ||
7261 | |||
7262 | LLString message_name; | ||
7263 | for (LLXMLNode* message_node = message_set->getFirstChild(); | ||
7264 | message_node != NULL; | ||
7265 | message_node = message_node->getNextSibling()) | ||
7266 | { | ||
7267 | if ( message_node->hasName("message") && | ||
7268 | message_node->getAttributeString("name", message_name) ) | ||
7269 | { | ||
7270 | (*teleport_msg_map)[message_name] = | ||
7271 | message_node->getTextContents(); | ||
7272 | } //end if ( message exists and has a name) | ||
7273 | } //end for (all message in set) | ||
7274 | }//end for (all message sets in xml file) | ||
7275 | } | ||
7276 | |||
7277 | |||
7259 | // EOF | 7278 | // EOF |