diff options
Diffstat (limited to 'linden/indra/newview/llagent.cpp')
-rw-r--r-- | linden/indra/newview/llagent.cpp | 99 |
1 files changed, 52 insertions, 47 deletions
diff --git a/linden/indra/newview/llagent.cpp b/linden/indra/newview/llagent.cpp index 51b6c53..fc12f33 100644 --- a/linden/indra/newview/llagent.cpp +++ b/linden/indra/newview/llagent.cpp | |||
@@ -400,7 +400,8 @@ LLAgent::LLAgent() : | |||
400 | mAgentWearablesUpdateSerialNum(0), | 400 | mAgentWearablesUpdateSerialNum(0), |
401 | mWearablesLoaded(FALSE), | 401 | mWearablesLoaded(FALSE), |
402 | mTextureCacheQueryID(0), | 402 | mTextureCacheQueryID(0), |
403 | mAppearanceSerialNum(0) | 403 | mAppearanceSerialNum(0), |
404 | mbTeleportKeepsLookAt(false) | ||
404 | { | 405 | { |
405 | U32 i; | 406 | U32 i; |
406 | for (i = 0; i < TOTAL_CONTROLS; i++) | 407 | for (i = 0; i < TOTAL_CONTROLS; i++) |
@@ -536,7 +537,9 @@ void LLAgent::resetView(BOOL reset_camera, BOOL change_camera) | |||
536 | gMenuHolder->hideMenus(); | 537 | gMenuHolder->hideMenus(); |
537 | } | 538 | } |
538 | 539 | ||
539 | if (change_camera && !gSavedSettings.getBOOL("FreezeTime")) | 540 | static BOOL* sFreezeTime = rebind_llcontrol<BOOL>("FreezeTime", &gSavedSettings, true); |
541 | |||
542 | if (change_camera && !(*sFreezeTime)) | ||
540 | { | 543 | { |
541 | changeCameraToDefault(); | 544 | changeCameraToDefault(); |
542 | 545 | ||
@@ -560,7 +563,7 @@ void LLAgent::resetView(BOOL reset_camera, BOOL change_camera) | |||
560 | } | 563 | } |
561 | 564 | ||
562 | 565 | ||
563 | if (reset_camera && !gSavedSettings.getBOOL("FreezeTime")) | 566 | if (reset_camera && !(*sFreezeTime)) |
564 | { | 567 | { |
565 | if (!gViewerWindow->getLeftMouseDown() && cameraThirdPerson()) | 568 | if (!gViewerWindow->getLeftMouseDown() && cameraThirdPerson()) |
566 | { | 569 | { |
@@ -1975,7 +1978,9 @@ void LLAgent::cameraOrbitIn(const F32 meters) | |||
1975 | 1978 | ||
1976 | mCameraZoomFraction = (mTargetCameraDistance - meters) / camera_offset_dist; | 1979 | mCameraZoomFraction = (mTargetCameraDistance - meters) / camera_offset_dist; |
1977 | 1980 | ||
1978 | if (!gSavedSettings.getBOOL("FreezeTime") && mCameraZoomFraction < MIN_ZOOM_FRACTION && meters > 0.f) | 1981 | static BOOL* sFreezeTime = rebind_llcontrol<BOOL>("FreezeTime", &gSavedSettings, true); |
1982 | |||
1983 | if (!(*sFreezeTime) && mCameraZoomFraction < MIN_ZOOM_FRACTION && meters > 0.f) | ||
1979 | { | 1984 | { |
1980 | // No need to animate, camera is already there. | 1985 | // No need to animate, camera is already there. |
1981 | changeCameraToMouselook(FALSE); | 1986 | changeCameraToMouselook(FALSE); |
@@ -2900,7 +2905,8 @@ static const LLFloaterView::skip_list_t& get_skip_list() | |||
2900 | { | 2905 | { |
2901 | static LLFloaterView::skip_list_t skip_list; | 2906 | static LLFloaterView::skip_list_t skip_list; |
2902 | skip_list.insert(LLFloaterMap::getInstance()); | 2907 | skip_list.insert(LLFloaterMap::getInstance()); |
2903 | if(gSavedSettings.getBOOL("ShowStatusBarInMouselook")) | 2908 | static BOOL *sShowStatusBarInMouselook = rebind_llcontrol<BOOL>("ShowStatusBarInMouselook", &gSavedSettings, true); |
2909 | if(*sShowStatusBarInMouselook) | ||
2904 | { | 2910 | { |
2905 | skip_list.insert(LLFloaterStats::getInstance()); | 2911 | skip_list.insert(LLFloaterStats::getInstance()); |
2906 | } | 2912 | } |
@@ -6099,16 +6105,21 @@ bool LLAgent::teleportCore(bool is_local) | |||
6099 | 6105 | ||
6100 | void LLAgent::teleportRequest( | 6106 | void LLAgent::teleportRequest( |
6101 | const U64& region_handle, | 6107 | const U64& region_handle, |
6102 | const LLVector3& pos_local) | 6108 | const LLVector3& pos_local, |
6109 | bool keep_look_at) | ||
6103 | { | 6110 | { |
6104 | LLViewerRegion* regionp = getRegion(); | 6111 | LLViewerRegion* regionp = getRegion(); |
6105 | 6112 | if (!regionp) | |
6113 | { | ||
6114 | return; | ||
6115 | } | ||
6106 | // Set last region data for teleport history | 6116 | // Set last region data for teleport history |
6107 | gAgent.setLastRegionData(regionp->getName(),gAgent.getPositionAgent()); | 6117 | gAgent.setLastRegionData(regionp->getName(),gAgent.getPositionAgent()); |
6108 | 6118 | ||
6109 | if(regionp && teleportCore()) | 6119 | bool is_local = (region_handle == to_region_handle(getPositionGlobal())); |
6120 | if(teleportCore(is_local)) | ||
6110 | { | 6121 | { |
6111 | llinfos << "TeleportRequest: '" << region_handle << "':" << pos_local | 6122 | llinfos << "TeleportLocationRequest: '" << region_handle << "':" << pos_local |
6112 | << llendl; | 6123 | << llendl; |
6113 | LLMessageSystem* msg = gMessageSystem; | 6124 | LLMessageSystem* msg = gMessageSystem; |
6114 | msg->newMessage("TeleportLocationRequest"); | 6125 | msg->newMessage("TeleportLocationRequest"); |
@@ -6119,6 +6130,10 @@ void LLAgent::teleportRequest( | |||
6119 | msg->addU64("RegionHandle", region_handle); | 6130 | msg->addU64("RegionHandle", region_handle); |
6120 | msg->addVector3("Position", pos_local); | 6131 | msg->addVector3("Position", pos_local); |
6121 | LLVector3 look_at(0,1,0); | 6132 | LLVector3 look_at(0,1,0); |
6133 | if (keep_look_at) | ||
6134 | { | ||
6135 | look_at = LLViewerCamera::getInstance()->getAtAxis(); | ||
6136 | } | ||
6122 | msg->addVector3("LookAt", look_at); | 6137 | msg->addVector3("LookAt", look_at); |
6123 | sendReliableMessage(); | 6138 | sendReliableMessage(); |
6124 | } | 6139 | } |
@@ -6219,46 +6234,29 @@ void LLAgent::teleportViaLocation(const LLVector3d& pos_global) | |||
6219 | } | 6234 | } |
6220 | // [/RLVa:KB] | 6235 | // [/RLVa:KB] |
6221 | 6236 | ||
6222 | LLViewerRegion* regionp = getRegion(); | 6237 | U64 region_handle = to_region_handle(pos_global); |
6223 | LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global); | 6238 | LLVector3 pos_local = (LLVector3)(pos_global - from_region_handle(region_handle)); |
6224 | if(regionp && info) | 6239 | teleportRequest(region_handle, pos_local, false); |
6225 | { | 6240 | } |
6226 | U32 x_pos; | ||
6227 | U32 y_pos; | ||
6228 | from_region_handle(info->mHandle, &x_pos, &y_pos); | ||
6229 | LLVector3 pos_local( | ||
6230 | (F32)(pos_global.mdV[VX] - x_pos), | ||
6231 | (F32)(pos_global.mdV[VY] - y_pos), | ||
6232 | (F32)(pos_global.mdV[VZ])); | ||
6233 | teleportRequest(info->mHandle, pos_local); | ||
6234 | } | ||
6235 | else if(regionp && | ||
6236 | teleportCore(regionp->getHandle() == to_region_handle_global((F32)pos_global.mdV[VX], (F32)pos_global.mdV[VY]))) | ||
6237 | { | ||
6238 | llwarns << "Using deprecated teleportlocationrequest." << llendl; | ||
6239 | // send the message | ||
6240 | LLMessageSystem* msg = gMessageSystem; | ||
6241 | msg->newMessageFast(_PREHASH_TeleportLocationRequest); | ||
6242 | msg->nextBlockFast(_PREHASH_AgentData); | ||
6243 | msg->addUUIDFast(_PREHASH_AgentID, getID()); | ||
6244 | msg->addUUIDFast(_PREHASH_SessionID, getSessionID()); | ||
6245 | 6241 | ||
6246 | msg->nextBlockFast(_PREHASH_Info); | 6242 | // Teleport to global position, but keep facing in the same direction |
6247 | F32 width = regionp->getWidth(); | 6243 | void LLAgent::teleportViaLocationLookAt(const LLVector3d& pos_global) |
6248 | LLVector3 pos(fmod((F32)pos_global.mdV[VX], width), | 6244 | { |
6249 | fmod((F32)pos_global.mdV[VY], width), | 6245 | // RLVa stuff copied from LLAgent::teleportViaLocation |
6250 | (F32)pos_global.mdV[VZ]); | 6246 | if ( (rlv_handler_t::isEnabled()) && |
6251 | F32 region_x = (F32)(pos_global.mdV[VX]); | 6247 | ( (gRlvHandler.hasBehaviourExcept(RLV_BHVR_TPLOC, gRlvHandler.getCurrentObject())) || |
6252 | F32 region_y = (F32)(pos_global.mdV[VY]); | 6248 | ( (mAvatarObject.notNull()) && (mAvatarObject->mIsSitting) && |
6253 | U64 region_handle = to_region_handle_global(region_x, region_y); | 6249 | (gRlvHandler.hasBehaviourExcept(RLV_BHVR_UNSIT, gRlvHandler.getCurrentObject()))) ) ) |
6254 | msg->addU64Fast(_PREHASH_RegionHandle, region_handle); | 6250 | { |
6255 | msg->addVector3Fast(_PREHASH_Position, pos); | 6251 | return; |
6256 | pos.mV[VX] += 1; | ||
6257 | msg->addVector3Fast(_PREHASH_LookAt, pos); | ||
6258 | sendReliableMessage(); | ||
6259 | } | 6252 | } |
6260 | } | ||
6261 | 6253 | ||
6254 | mbTeleportKeepsLookAt = true; | ||
6255 | setFocusOnAvatar(FALSE, ANIMATE); // detach camera form avatar, so it keeps direction | ||
6256 | U64 region_handle = to_region_handle(pos_global); | ||
6257 | LLVector3 pos_local = (LLVector3)(pos_global - from_region_handle(region_handle)); | ||
6258 | teleportRequest(region_handle, pos_local, mbTeleportKeepsLookAt); | ||
6259 | } | ||
6262 | 6260 | ||
6263 | void LLAgent::teleportHome() | 6261 | void LLAgent::teleportHome() |
6264 | { | 6262 | { |
@@ -6286,7 +6284,14 @@ bool LLAgent::teleportHomeCallback( const LLSD& notification, const LLSD& respon | |||
6286 | void LLAgent::setTeleportState(ETeleportState state) | 6284 | void LLAgent::setTeleportState(ETeleportState state) |
6287 | { | 6285 | { |
6288 | mTeleportState = state; | 6286 | mTeleportState = state; |
6289 | if (mTeleportState > TELEPORT_NONE && gSavedSettings.getBOOL("FreezeTime")) | 6287 | if (mTeleportState == TELEPORT_NONE) |
6288 | { | ||
6289 | mbTeleportKeepsLookAt = false; | ||
6290 | } | ||
6291 | |||
6292 | static BOOL* sFreezeTime = rebind_llcontrol<BOOL>("FreezeTime", &gSavedSettings, true); | ||
6293 | |||
6294 | if (mTeleportState > TELEPORT_NONE && (*sFreezeTime)) | ||
6290 | { | 6295 | { |
6291 | LLFloaterSnapshot::hide(0); | 6296 | LLFloaterSnapshot::hide(0); |
6292 | } | 6297 | } |