diff options
author | David Seikel | 2011-04-26 21:30:21 +1000 |
---|---|---|
committer | David Seikel | 2011-04-26 21:30:21 +1000 |
commit | da97e24c3b045d16589124496d032ffb9b4ca07f (patch) | |
tree | 34d84cf4355f83e1a106d06a10ed2a4bb121fdc4 /linden/indra/newview/llagent.cpp | |
parent | Apparently there is a wrong client tag for firestorm out in the wild. (diff) | |
parent | Changed version to Experimental 2011.04.19 (diff) | |
download | meta-impy-da97e24c3b045d16589124496d032ffb9b4ca07f.zip meta-impy-da97e24c3b045d16589124496d032ffb9b4ca07f.tar.gz meta-impy-da97e24c3b045d16589124496d032ffb9b4ca07f.tar.bz2 meta-impy-da97e24c3b045d16589124496d032ffb9b4ca07f.tar.xz |
Merge remote-tracking branch 'imprudence/exp' into exp
Conflicts (for future reference):
linden/indra/llcommon/llstring.cpp
linden/indra/newview/llpanelnetwork.cpp
linden/indra/newview/llselectmgr.cpp
linden/indra/newview/llstartup.cpp
linden/indra/newview/lltoolmgr.cpp
linden/indra/newview/llvoavatar.cpp
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llagent.cpp | 139 |
1 files changed, 130 insertions, 9 deletions
diff --git a/linden/indra/newview/llagent.cpp b/linden/indra/newview/llagent.cpp index 7bc57f8..85a1b36 100644 --- a/linden/indra/newview/llagent.cpp +++ b/linden/indra/newview/llagent.cpp | |||
@@ -56,6 +56,7 @@ | |||
56 | #include "llsdutil.h" | 56 | #include "llsdutil.h" |
57 | //#include "vmath.h" | 57 | //#include "vmath.h" |
58 | 58 | ||
59 | #include "hippogridmanager.h" | ||
59 | #include "imageids.h" | 60 | #include "imageids.h" |
60 | #include "llbox.h" | 61 | #include "llbox.h" |
61 | #include "llbutton.h" | 62 | #include "llbutton.h" |
@@ -2734,14 +2735,24 @@ void LLAgent::updateLookAt(const S32 mouse_x, const S32 mouse_y) | |||
2734 | } | 2735 | } |
2735 | else if (cameraThirdPerson()) | 2736 | else if (cameraThirdPerson()) |
2736 | { | 2737 | { |
2737 | // range from -.5 to .5 | 2738 | if (gSavedSettings.getBOOL("HeadFollowsMouse")) |
2738 | F32 x_from_center = | 2739 | { |
2739 | ((F32) mouse_x / (F32) gViewerWindow->getWindowWidth() ) - 0.5f; | 2740 | // range from -.5 to .5 |
2740 | F32 y_from_center = | 2741 | F32 x_from_center = |
2741 | ((F32) mouse_y / (F32) gViewerWindow->getWindowHeight() ) - 0.5f; | 2742 | ((F32) mouse_x / (F32) gViewerWindow->getWindowWidth() ) - 0.5f; |
2742 | 2743 | F32 y_from_center = | |
2743 | frameCamera.yaw( - x_from_center * gSavedSettings.getF32("YawFromMousePosition") * DEG_TO_RAD); | 2744 | ((F32) mouse_y / (F32) gViewerWindow->getWindowHeight() ) - 0.5f; |
2744 | frameCamera.pitch( - y_from_center * gSavedSettings.getF32("PitchFromMousePosition") * DEG_TO_RAD); | 2745 | |
2746 | frameCamera.yaw( - x_from_center * gSavedSettings.getF32("YawFromMousePosition") | ||
2747 | * DEG_TO_RAD); | ||
2748 | frameCamera.pitch( - y_from_center * gSavedSettings.getF32("PitchFromMousePosition") | ||
2749 | * DEG_TO_RAD); | ||
2750 | } | ||
2751 | else | ||
2752 | { | ||
2753 | frameCamera.yaw( 0.f ); | ||
2754 | frameCamera.pitch( 0.f ); | ||
2755 | } | ||
2745 | lookAtType = LOOKAT_TARGET_FREELOOK; | 2756 | lookAtType = LOOKAT_TARGET_FREELOOK; |
2746 | } | 2757 | } |
2747 | 2758 | ||
@@ -4772,6 +4783,116 @@ void LLAgent::lookAtLastChat() | |||
4772 | } | 4783 | } |
4773 | } | 4784 | } |
4774 | 4785 | ||
4786 | void LLAgent::lookAtObject(LLUUID object_id, ECameraPosition camera_pos) | ||
4787 | { | ||
4788 | // Block if camera is animating or not in normal third person camera mode | ||
4789 | if (mCameraAnimating || !cameraThirdPerson()) | ||
4790 | { | ||
4791 | return; | ||
4792 | } | ||
4793 | |||
4794 | LLViewerObject *chatter = gObjectList.findObject(object_id); | ||
4795 | if (chatter) | ||
4796 | { | ||
4797 | LLVector3 delta_pos; | ||
4798 | if (chatter->isAvatar()) | ||
4799 | { | ||
4800 | LLVOAvatar *chatter_av = (LLVOAvatar*)chatter; | ||
4801 | if (!mAvatarObject.isNull() && chatter_av->mHeadp) | ||
4802 | { | ||
4803 | delta_pos = chatter_av->mHeadp->getWorldPosition() - mAvatarObject->mHeadp->getWorldPosition(); | ||
4804 | } | ||
4805 | else | ||
4806 | { | ||
4807 | delta_pos = chatter->getPositionAgent() - getPositionAgent(); | ||
4808 | } | ||
4809 | delta_pos.normVec(); | ||
4810 | |||
4811 | setControlFlags(AGENT_CONTROL_STOP); | ||
4812 | |||
4813 | changeCameraToThirdPerson(); | ||
4814 | |||
4815 | LLVector3 new_camera_pos = mAvatarObject->mHeadp->getWorldPosition(); | ||
4816 | LLVector3 left = delta_pos % LLVector3::z_axis; | ||
4817 | left.normVec(); | ||
4818 | LLVector3 up = left % delta_pos; | ||
4819 | up.normVec(); | ||
4820 | new_camera_pos -= delta_pos * 0.4f; | ||
4821 | new_camera_pos += left * 0.3f; | ||
4822 | new_camera_pos += up * 0.2f; | ||
4823 | |||
4824 | F32 radius = chatter_av->getVObjRadius(); | ||
4825 | LLVector3d view_dist(radius, radius, 0.0f); | ||
4826 | |||
4827 | if (chatter_av->mHeadp) | ||
4828 | { | ||
4829 | setFocusGlobal(getPosGlobalFromAgent(chatter_av->mHeadp->getWorldPosition()), object_id); | ||
4830 | mCameraFocusOffsetTarget = getPosGlobalFromAgent(new_camera_pos) - gAgent.getPosGlobalFromAgent(chatter_av->mHeadp->getWorldPosition()); | ||
4831 | |||
4832 | switch(camera_pos) | ||
4833 | { | ||
4834 | case CAMERA_POSITION_SELF: | ||
4835 | mCameraFocusOffsetTarget = getPosGlobalFromAgent(new_camera_pos) - gAgent.getPosGlobalFromAgent(chatter_av->mHeadp->getWorldPosition()); | ||
4836 | break; | ||
4837 | case CAMERA_POSITION_OBJECT: | ||
4838 | mCameraFocusOffsetTarget = view_dist; | ||
4839 | break; | ||
4840 | } | ||
4841 | } | ||
4842 | else | ||
4843 | { | ||
4844 | setFocusGlobal(chatter->getPositionGlobal(), object_id); | ||
4845 | mCameraFocusOffsetTarget = getPosGlobalFromAgent(new_camera_pos) - chatter->getPositionGlobal(); | ||
4846 | |||
4847 | switch(camera_pos) | ||
4848 | { | ||
4849 | case CAMERA_POSITION_SELF: | ||
4850 | mCameraFocusOffsetTarget = getPosGlobalFromAgent(new_camera_pos) - chatter->getPositionGlobal(); | ||
4851 | break; | ||
4852 | case CAMERA_POSITION_OBJECT: | ||
4853 | mCameraFocusOffsetTarget = view_dist; | ||
4854 | break; | ||
4855 | } | ||
4856 | } | ||
4857 | setFocusOnAvatar(FALSE, TRUE); | ||
4858 | } | ||
4859 | else | ||
4860 | { | ||
4861 | delta_pos = chatter->getRenderPosition() - getPositionAgent(); | ||
4862 | delta_pos.normVec(); | ||
4863 | |||
4864 | setControlFlags(AGENT_CONTROL_STOP); | ||
4865 | |||
4866 | changeCameraToThirdPerson(); | ||
4867 | |||
4868 | LLVector3 new_camera_pos = mAvatarObject->mHeadp->getWorldPosition(); | ||
4869 | LLVector3 left = delta_pos % LLVector3::z_axis; | ||
4870 | left.normVec(); | ||
4871 | LLVector3 up = left % delta_pos; | ||
4872 | up.normVec(); | ||
4873 | new_camera_pos -= delta_pos * 0.4f; | ||
4874 | new_camera_pos += left * 0.3f; | ||
4875 | new_camera_pos += up * 0.2f; | ||
4876 | |||
4877 | setFocusGlobal(chatter->getPositionGlobal(), object_id); | ||
4878 | |||
4879 | switch(camera_pos) | ||
4880 | { | ||
4881 | case CAMERA_POSITION_SELF: | ||
4882 | mCameraFocusOffsetTarget = getPosGlobalFromAgent(new_camera_pos) - chatter->getPositionGlobal(); | ||
4883 | break; | ||
4884 | case CAMERA_POSITION_OBJECT: | ||
4885 | F32 radius = chatter->getVObjRadius(); | ||
4886 | LLVector3d view_dist(radius, radius, 0.0f); | ||
4887 | mCameraFocusOffsetTarget = view_dist; | ||
4888 | break; | ||
4889 | } | ||
4890 | |||
4891 | setFocusOnAvatar(FALSE, TRUE); | ||
4892 | } | ||
4893 | } | ||
4894 | } | ||
4895 | |||
4775 | const F32 SIT_POINT_EXTENTS = 0.2f; | 4896 | const F32 SIT_POINT_EXTENTS = 0.2f; |
4776 | 4897 | ||
4777 | void LLAgent::setStartPosition( U32 location_id ) | 4898 | void LLAgent::setStartPosition( U32 location_id ) |
@@ -5480,7 +5601,7 @@ void LLAgent::getName(std::string& name) | |||
5480 | } | 5601 | } |
5481 | else | 5602 | else |
5482 | { | 5603 | { |
5483 | name = gSavedSettings.getString("FirstName") + " " + gSavedSettings.getString("LastName"); | 5604 | name = gHippoGridManager->getCurrentGrid()->getFirstName() + " " + gHippoGridManager->getCurrentGrid()->getLastName(); |
5484 | } | 5605 | } |
5485 | } | 5606 | } |
5486 | 5607 | ||