From 4ca6a5c52ca7398caa5f429c0d8560611c85d739 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Tue, 22 Jul 2014 07:07:38 -0400 Subject: [PATCH] Sync up most of the realistic mouselook code with alchemy. This should fix the inverted mouselook when sitting problem Think the bug was in llvoavatar, but keeping in sync is always good for the future overall. --- indra/newview/llagent.cpp | 19 +++---------------- indra/newview/llagentcamera.cpp | 6 +++--- indra/newview/llvoavatar.cpp | 2 +- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 051a68fcd..7fb21ab0d 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -1293,25 +1293,12 @@ F32 LLAgent::clampPitchToLimits(F32 angle) LLVector3 skyward = getReferenceUpVector(); - F32 look_down_limit; - F32 look_up_limit = 10.f * DEG_TO_RAD; + static const LLCachedControl useRealisticMouselook(gSavedSettings, "UseRealisticMouselook", false); + const F32 look_down_limit = (useRealisticMouselook ? 160.f : (isAgentAvatarValid() && gAgentAvatarp->isSitting() ? 130.f : 179.f)) * DEG_TO_RAD; + const F32 look_up_limit = (useRealisticMouselook ? 20.f : 1.f) * DEG_TO_RAD;; F32 angle_from_skyward = acos( mFrameAgent.getAtAxis() * skyward ); - if (gAgentCamera.cameraMouselook() && gSavedSettings.getBOOL("UseRealisticMouselook")) - { - look_down_limit = 160.f * DEG_TO_RAD; - look_up_limit = 20.f * DEG_TO_RAD; - } - else if (isAgentAvatarValid() && gAgentAvatarp->isSitting()) - { - look_down_limit = 130.f * DEG_TO_RAD; - } - else - { - look_down_limit = 170.f * DEG_TO_RAD; - } - // clamp pitch to limits if ((angle >= 0.f) && (angle_from_skyward + angle > look_down_limit)) { diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 4dfe7bc4b..a8e0a5c2a 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -1493,14 +1493,14 @@ void LLAgentCamera::updateCamera() if (realistic_ml) { LLQuaternion agent_rot(gAgent.getFrameAgent().getQuaternion()); - if (static_cast(gAgentAvatarp->getRoot())->flagCameraDecoupled()) - if (LLViewerObject* parent = static_cast(gAgentAvatarp->getParent())) + if (LLViewerObject* parent = static_cast(gAgentAvatarp->getParent())) + if (static_cast(gAgentAvatarp->getRoot())->flagCameraDecoupled()) agent_rot *= parent->getRenderRotation(); LLViewerCamera::getInstance()->updateCameraLocation(head_pos, mCameraUpVector, gAgentAvatarp->mHeadp->getWorldPosition() + LLVector3(1.0, 0.0, 0.0) * agent_rot); } else { - const LLVector3 diff = (mCameraPositionAgent - head_pos) * ~gAgentAvatarp->mRoot->getWorldRotation(); + const LLVector3 diff((mCameraPositionAgent - head_pos) * ~gAgentAvatarp->mRoot->getWorldRotation()); gAgentAvatarp->mPelvisp->setPosition(gAgentAvatarp->mPelvisp->getPosition() + diff); } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index bd0000846..802105235 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4149,7 +4149,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) static const LLCachedControl useRealisticMouselook("UseRealisticMouselook"); F32 pelvis_rot_threshold = clamp_rescale(speed, 0.1f, 1.0f, useRealisticMouselook ? s_pelvis_rot_threshold_slow * 2 : s_pelvis_rot_threshold_slow, s_pelvis_rot_threshold_fast); - if (self_in_mouselook) + if (self_in_mouselook && !useRealisticMouselook) { pelvis_rot_threshold *= MOUSELOOK_PELVIS_FOLLOW_FACTOR; }