aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llvoavatar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llvoavatar.cpp')
-rw-r--r--linden/indra/newview/llvoavatar.cpp204
1 files changed, 189 insertions, 15 deletions
diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp
index 1203c56..d35ad40 100644
--- a/linden/indra/newview/llvoavatar.cpp
+++ b/linden/indra/newview/llvoavatar.cpp
@@ -83,6 +83,9 @@
83#include "llvoicevisualizer.h" // Ventrella 83#include "llvoicevisualizer.h" // Ventrella
84 84
85#include "boost/lexical_cast.hpp" 85#include "boost/lexical_cast.hpp"
86// [RLVa:KB]
87#include "llstartup.h"
88// [/RLVa:KB]
86 89
87using namespace LLVOAvatarDefines; 90using namespace LLVOAvatarDefines;
88 91
@@ -175,6 +178,10 @@ enum ERenderName
175//----------------------------------------------------------------------------- 178//-----------------------------------------------------------------------------
176// Callback data 179// Callback data
177//----------------------------------------------------------------------------- 180//-----------------------------------------------------------------------------
181LLVector3d LLVOAvatar::sBeamLastAt;
182int LLVOAvatar::sPartsNow;
183
184
178struct LLAvatarTexData 185struct LLAvatarTexData
179{ 186{
180 LLAvatarTexData( const LLUUID& id, ETextureIndex index ) 187 LLAvatarTexData( const LLUUID& id, ETextureIndex index )
@@ -741,7 +748,11 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
741 mTexEyeColor( NULL ), 748 mTexEyeColor( NULL ),
742 mNeedsSkin(FALSE), 749 mNeedsSkin(FALSE),
743 mUpdatePeriod(1), 750 mUpdatePeriod(1),
751// mFullyLoadedInitialized(FALSE)
752 mPreviousFullyLoaded(FALSE),
753 mVisibleChat( FALSE ),
744 mFullyLoadedInitialized(FALSE), 754 mFullyLoadedInitialized(FALSE),
755 mFullyLoaded(FALSE),
745 mHasBakedHair( FALSE ) 756 mHasBakedHair( FALSE )
746{ 757{
747 LLMemType mt(LLMemType::MTYPE_AVATAR); 758 LLMemType mt(LLMemType::MTYPE_AVATAR);
@@ -1717,6 +1728,10 @@ BOOL LLVOAvatar::buildSkeleton(const LLVOAvatarSkeletonInfo *info)
1717{ 1728{
1718 LLMemType mt(LLMemType::MTYPE_AVATAR); 1729 LLMemType mt(LLMemType::MTYPE_AVATAR);
1719 1730
1731 //this can get called with null info on startup sometimes
1732 if (!info)
1733 return FALSE;
1734
1720 //------------------------------------------------------------------------- 1735 //-------------------------------------------------------------------------
1721 // allocate joints 1736 // allocate joints
1722 //------------------------------------------------------------------------- 1737 //-------------------------------------------------------------------------
@@ -1981,9 +1996,15 @@ void LLVOAvatar::buildCharacter()
1981 if (attachment->getGroup() == i) 1996 if (attachment->getGroup() == i)
1982 { 1997 {
1983 LLMenuItemCallGL* item; 1998 LLMenuItemCallGL* item;
1999// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c)
2000 // We need the userdata param to disable options in this pie menu later on (Left Hand / Right Hand option)
1984 item = new LLMenuItemCallGL(attachment->getName(), 2001 item = new LLMenuItemCallGL(attachment->getName(),
1985 NULL, 2002 NULL,
1986 object_selected_and_point_valid); 2003 object_selected_and_point_valid, attachment);
2004// [/RLVa:KB]
2005// item = new LLMenuItemCallGL(attachment->getName(),
2006// NULL,
2007// object_selected_and_point_valid);
1987 item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", curiter->first); 2008 item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", curiter->first);
1988 2009
1989 gAttachPieMenu->append(item); 2010 gAttachPieMenu->append(item);
@@ -2038,9 +2059,15 @@ void LLVOAvatar::buildCharacter()
2038 if (attachment->getGroup() == 8) 2059 if (attachment->getGroup() == 8)
2039 { 2060 {
2040 LLMenuItemCallGL* item; 2061 LLMenuItemCallGL* item;
2062// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c)
2063 // We need the userdata param to disable options in this pie menu later on
2041 item = new LLMenuItemCallGL(attachment->getName(), 2064 item = new LLMenuItemCallGL(attachment->getName(),
2042 NULL, 2065 NULL,
2043 object_selected_and_point_valid); 2066 object_selected_and_point_valid, attachment);
2067// [/RLVa:KB]
2068// item = new LLMenuItemCallGL(attachment->getName(),
2069// NULL,
2070// object_selected_and_point_valid);
2044 item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", curiter->first); 2071 item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", curiter->first);
2045 gAttachScreenPieMenu->append(item); 2072 gAttachScreenPieMenu->append(item);
2046 gDetachScreenPieMenu->append(new LLMenuItemCallGL(attachment->getName(), 2073 gDetachScreenPieMenu->append(new LLMenuItemCallGL(attachment->getName(),
@@ -2059,12 +2086,14 @@ void LLVOAvatar::buildCharacter()
2059 { 2086 {
2060 continue; 2087 continue;
2061 } 2088 }
2089 // RELEASE-RLVa: random comment because we want know if LL ever changes this to not include "attachment" as userdata
2062 LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(), 2090 LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(),
2063 NULL, &object_selected_and_point_valid, 2091 NULL, &object_selected_and_point_valid,
2064 &attach_label, attachment); 2092 &attach_label, attachment);
2093if (item){
2065 item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", curiter->first); 2094 item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", curiter->first);
2066 gAttachSubMenu->append(item); 2095 gAttachSubMenu->append(item);
2067 2096}
2068 gDetachSubMenu->append(new LLMenuItemCallGL(attachment->getName(), 2097 gDetachSubMenu->append(new LLMenuItemCallGL(attachment->getName(),
2069 &handle_detach_from_avatar, object_attached, &detach_label, attachment)); 2098 &handle_detach_from_avatar, object_attached, &detach_label, attachment));
2070 2099
@@ -2118,8 +2147,13 @@ void LLVOAvatar::buildCharacter()
2118 LLViewerJointAttachment* attachment = get_if_there(mAttachmentPoints, attach_index, (LLViewerJointAttachment*)NULL); 2147 LLViewerJointAttachment* attachment = get_if_there(mAttachmentPoints, attach_index, (LLViewerJointAttachment*)NULL);
2119 if (attachment) 2148 if (attachment)
2120 { 2149 {
2150// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c)
2151 // We need the userdata param to disable options in this pie menu later on
2121 LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(), 2152 LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(),
2122 NULL, object_selected_and_point_valid); 2153 NULL, object_selected_and_point_valid, attachment);
2154// [/RLVa:KB]
2155// LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(),
2156// NULL, object_selected_and_point_valid);
2123 gAttachBodyPartPieMenus[group]->append(item); 2157 gAttachBodyPartPieMenus[group]->append(item);
2124 item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", attach_index); 2158 item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", attach_index);
2125 gDetachBodyPartPieMenus[group]->append(new LLMenuItemCallGL(attachment->getName(), 2159 gDetachBodyPartPieMenus[group]->append(new LLMenuItemCallGL(attachment->getName(),
@@ -2944,10 +2978,16 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
2944 const F32 time_visible = mTimeVisible.getElapsedTimeF32(); 2978 const F32 time_visible = mTimeVisible.getElapsedTimeF32();
2945 const F32 NAME_SHOW_TIME = gSavedSettings.getF32("RenderNameShowTime"); // seconds 2979 const F32 NAME_SHOW_TIME = gSavedSettings.getF32("RenderNameShowTime"); // seconds
2946 const F32 FADE_DURATION = gSavedSettings.getF32("RenderNameFadeDuration"); // seconds 2980 const F32 FADE_DURATION = gSavedSettings.getF32("RenderNameFadeDuration"); // seconds
2981// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0b
2982 bool fRlvShowNames = gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES);
2983// [/RLVa:KB]
2947 BOOL visible_avatar = isVisible() || mNeedsAnimUpdate; 2984 BOOL visible_avatar = isVisible() || mNeedsAnimUpdate;
2948 BOOL visible_chat = gSavedSettings.getBOOL("UseChatBubbles") && (mChats.size() || mTyping); 2985 BOOL visible_chat = gSavedSettings.getBOOL("UseChatBubbles") && (mChats.size() || mTyping);
2949 BOOL render_name = visible_chat || 2986 BOOL render_name = visible_chat ||
2950 (visible_avatar && 2987 (visible_avatar &&
2988// [RLVa:KB] - Checked: 2009-08-11 (RLVa-1.0.1h) | Added: RLVa-1.0.0h
2989 ( (!fRlvShowNames) || (RlvSettings::fShowNameTags) ) &&
2990// [/RLVa:KB]
2951 ((sRenderName == RENDER_NAME_ALWAYS) || 2991 ((sRenderName == RENDER_NAME_ALWAYS) ||
2952 (sRenderName == RENDER_NAME_FADE && time_visible < NAME_SHOW_TIME))); 2992 (sRenderName == RENDER_NAME_FADE && time_visible < NAME_SHOW_TIME)));
2953 // If it's your own avatar, don't draw in mouselook, and don't 2993 // If it's your own avatar, don't draw in mouselook, and don't
@@ -2968,7 +3008,18 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
2968 new_name = TRUE; 3008 new_name = TRUE;
2969 } 3009 }
2970 3010
2971 if (sRenderGroupTitles != mRenderGroupTitles) 3011// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0b
3012 if (fRlvShowNames)
3013 {
3014 if (mRenderGroupTitles)
3015 {
3016 mRenderGroupTitles = FALSE;
3017 new_name = TRUE;
3018 }
3019 }
3020 else if (sRenderGroupTitles != mRenderGroupTitles)
3021// [/RLVa]
3022 //if (sRenderGroupTitles != mRenderGroupTitles)
2972 { 3023 {
2973 mRenderGroupTitles = sRenderGroupTitles; 3024 mRenderGroupTitles = sRenderGroupTitles;
2974 new_name = TRUE; 3025 new_name = TRUE;
@@ -3073,17 +3124,11 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3073 || is_appearance != mNameAppearance) 3124 || is_appearance != mNameAppearance)
3074 { 3125 {
3075 std::string line; 3126 std::string line;
3076 if (!sRenderGroupTitles) 3127
3077 { 3128 if (title && title->getString() && title->getString()[0] != '\0')
3078 // If all group titles are turned off, stack first name
3079 // on a line above last name
3080 line += firstname->getString();
3081 line += "\n";
3082 }
3083 else if (title && title->getString() && title->getString()[0] != '\0')
3084 { 3129 {
3085 line += title->getString(); 3130 line += title->getString();
3086 LLStringFn::replace_ascii_controlchars(line,LL_UNKNOWN_CHAR); 3131 //LLStringFn::replace_ascii_controlchars(line,LL_UNKNOWN_CHAR); IMP-136 -- McCabe
3087 line += "\n"; 3132 line += "\n";
3088 line += firstname->getString(); 3133 line += firstname->getString();
3089 } 3134 }
@@ -3094,6 +3139,15 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3094 3139
3095 line += " "; 3140 line += " ";
3096 line += lastname->getString(); 3141 line += lastname->getString();
3142
3143// [RLVa:KB]
3144 if (fRlvShowNames)
3145 {
3146 // User is not allowed to see who it is, due to RLV settings.
3147 line = gRlvHandler.getAnonym(line);
3148 }
3149// [/RLVa:KB]
3150
3097 BOOL need_comma = FALSE; 3151 BOOL need_comma = FALSE;
3098 3152
3099 if (is_away || is_muted || is_busy) 3153 if (is_away || is_muted || is_busy)
@@ -3134,7 +3188,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
3134 mNameMute = is_muted; 3188 mNameMute = is_muted;
3135 mNameAppearance = is_appearance; 3189 mNameAppearance = is_appearance;
3136 mTitle = title ? title->getString() : ""; 3190 mTitle = title ? title->getString() : "";
3137 LLStringFn::replace_ascii_controlchars(mTitle,LL_UNKNOWN_CHAR); 3191 //LLStringFn::replace_ascii_controlchars(mTitle,LL_UNKNOWN_CHAR); IMP-136 -- McCabe
3138 mNameString = utf8str_to_wstring(line); 3192 mNameString = utf8str_to_wstring(line);
3139 new_name = TRUE; 3193 new_name = TRUE;
3140 } 3194 }
@@ -3258,6 +3312,26 @@ void LLVOAvatar::idleUpdateTractorBeam()
3258 if (!needsRenderBeam() || !mIsBuilt) 3312 if (!needsRenderBeam() || !mIsBuilt)
3259 { 3313 {
3260 mBeam = NULL; 3314 mBeam = NULL;
3315 if(gSavedSettings.getBOOL("ParticleChat"))
3316 {
3317 if(sPartsNow != FALSE)
3318 {
3319 sPartsNow = FALSE;
3320 LLMessageSystem* msg = gMessageSystem;
3321 msg->newMessageFast(_PREHASH_ChatFromViewer);
3322 msg->nextBlockFast(_PREHASH_AgentData);
3323 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
3324 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
3325 msg->nextBlockFast(_PREHASH_ChatData);
3326 msg->addStringFast(_PREHASH_Message, "stop");
3327 msg->addU8Fast(_PREHASH_Type, CHAT_TYPE_WHISPER);
3328 msg->addS32("Channel", 9000);
3329
3330 gAgent.sendReliableMessage();
3331 sBeamLastAt = LLVector3d::zero;
3332 LLViewerStats::getInstance()->incStat(LLViewerStats::ST_CHAT_COUNT);
3333 }
3334 }
3261 } 3335 }
3262 else if (!mBeam || mBeam->isDead()) 3336 else if (!mBeam || mBeam->isDead())
3263 { 3337 {
@@ -3276,6 +3350,48 @@ void LLVOAvatar::idleUpdateTractorBeam()
3276 { 3350 {
3277 // get point from pointat effect 3351 // get point from pointat effect
3278 mBeam->setPositionGlobal(gAgent.mPointAt->getPointAtPosGlobal()); 3352 mBeam->setPositionGlobal(gAgent.mPointAt->getPointAtPosGlobal());
3353
3354 if(gSavedSettings.getBOOL("ParticleChat"))
3355 {
3356 if(sPartsNow != TRUE)
3357 {
3358 sPartsNow = TRUE;
3359 LLMessageSystem* msg = gMessageSystem;
3360 msg->newMessageFast(_PREHASH_ChatFromViewer);
3361 msg->nextBlockFast(_PREHASH_AgentData);
3362 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
3363 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
3364 msg->nextBlockFast(_PREHASH_ChatData);
3365 msg->addStringFast(_PREHASH_Message, "start");
3366 msg->addU8Fast(_PREHASH_Type, CHAT_TYPE_WHISPER);
3367 msg->addS32("Channel", 9000);
3368
3369 gAgent.sendReliableMessage();
3370
3371 LLViewerStats::getInstance()->incStat(LLViewerStats::ST_CHAT_COUNT);
3372 }
3373 //LLVector3d a = sBeamLastAt-gAgent.mPointAt->getPointAtPosGlobal();
3374 //if(a.length > 2)
3375 if( (sBeamLastAt-gAgent.mPointAt->getPointAtPosGlobal()).length() > .2)
3376 //if(sBeamLastAt!=gAgent.mPointAt->getPointAtPosGlobal())
3377 {
3378 sBeamLastAt = gAgent.mPointAt->getPointAtPosGlobal();
3379
3380 LLMessageSystem* msg = gMessageSystem;
3381 msg->newMessageFast(_PREHASH_ChatFromViewer);
3382 msg->nextBlockFast(_PREHASH_AgentData);
3383 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
3384 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
3385 msg->nextBlockFast(_PREHASH_ChatData);
3386 msg->addStringFast(_PREHASH_Message, llformat("<%.6f, %.6f, %.6f>",(F32)(sBeamLastAt.mdV[VX]),(F32)(sBeamLastAt.mdV[VY]),(F32)(sBeamLastAt.mdV[VZ])));
3387 msg->addU8Fast(_PREHASH_Type, CHAT_TYPE_WHISPER);
3388 msg->addS32("Channel", 9000); // *TODO: make configurable
3389
3390 gAgent.sendReliableMessage();
3391 }
3392
3393 }
3394
3279 mBeam->triggerLocal(); 3395 mBeam->triggerLocal();
3280 } 3396 }
3281 else if (selection->getFirstRootObject() && 3397 else if (selection->getFirstRootObject() &&
@@ -5932,6 +6048,40 @@ BOOL LLVOAvatar::attachObject(LLViewerObject *viewer_object)
5932 { 6048 {
5933 updateAttachmentVisibility(gAgent.getCameraMode()); 6049 updateAttachmentVisibility(gAgent.getCameraMode());
5934 6050
6051// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g)
6052 if (rlv_handler_t::isEnabled())
6053 {
6054 static bool fRlvFullyLoaded = false;
6055 static LLFrameTimer* pRlvFullyLoadedTimer = NULL;
6056
6057 // There's no way to know when we're done reattaching what was attached at log-off but this ugly evil bad hack tries anyway
6058 if (!fRlvFullyLoaded)
6059 {
6060 if (pRlvFullyLoadedTimer)
6061 {
6062 if (pRlvFullyLoadedTimer->getElapsedTimeF32() > 30.0f)
6063 {
6064 fRlvFullyLoaded = true;
6065 delete pRlvFullyLoadedTimer;
6066 pRlvFullyLoadedTimer = NULL;
6067 }
6068 else
6069 {
6070 pRlvFullyLoadedTimer->reset();
6071 }
6072 }
6073 else if ( (!pRlvFullyLoadedTimer) &&
6074 ( (0 == mPendingAttachment.size()) ||
6075 ((1 == mPendingAttachment.size()) && (mPendingAttachment[0] == viewer_object)) ) )
6076 {
6077 pRlvFullyLoadedTimer = new LLFrameTimer();
6078 }
6079 }
6080
6081 gRlvHandler.onAttach(attachment, fRlvFullyLoaded);
6082 }
6083// [/RLVa:KB]
6084
5935 // Then make sure the inventory is in sync with the avatar. 6085 // Then make sure the inventory is in sync with the avatar.
5936 gInventory.addChangedMask( LLInventoryObserver::LABEL, attachment->getItemID() ); 6086 gInventory.addChangedMask( LLInventoryObserver::LABEL, attachment->getItemID() );
5937 gInventory.notifyObservers(); 6087 gInventory.notifyObservers();
@@ -5993,6 +6143,14 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object)
5993 // only one object per attachment point for now 6143 // only one object per attachment point for now
5994 if (attachment->getObject() == viewer_object) 6144 if (attachment->getObject() == viewer_object)
5995 { 6145 {
6146// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g)
6147 // URGENT-RLV: it looks like LLApp::isExiting() isn't always accurate so find something better (if it exists)
6148 if ( (rlv_handler_t::isEnabled()) && (!LLApp::isExiting()) && (mIsSelf) )
6149 {
6150 gRlvHandler.onDetach(attachment);
6151 }
6152// [/RLVa:KB]
6153
5996 LLUUID item_id = attachment->getItemID(); 6154 LLUUID item_id = attachment->getItemID();
5997 attachment->removeObject(viewer_object); 6155 attachment->removeObject(viewer_object);
5998 if (mIsSelf) 6156 if (mIsSelf)
@@ -6051,6 +6209,14 @@ void LLVOAvatar::sitOnObject(LLViewerObject *sit_object)
6051 6209
6052 gPipeline.markMoved(mDrawable, TRUE); 6210 gPipeline.markMoved(mDrawable, TRUE);
6053 mIsSitting = TRUE; 6211 mIsSitting = TRUE;
6212// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.1d
6213 #ifdef RLV_EXTENSION_STARTLOCATION
6214 if (rlv_handler_t::isEnabled())
6215 {
6216 RlvSettings::updateLoginLastLocation();
6217 }
6218 #endif // RLV_EXTENSION_STARTLOCATION
6219// [/RLVa:KB]
6054 mRoot.getXform()->setParent(&sit_object->mDrawable->mXform); // LLVOAvatar::sitOnObject 6220 mRoot.getXform()->setParent(&sit_object->mDrawable->mXform); // LLVOAvatar::sitOnObject
6055 mRoot.setPosition(getPosition()); 6221 mRoot.setPosition(getPosition());
6056 mRoot.updateWorldMatrixChildren(); 6222 mRoot.updateWorldMatrixChildren();
@@ -6112,6 +6278,14 @@ void LLVOAvatar::getOffObject()
6112 gPipeline.markMoved(mDrawable, TRUE); 6278 gPipeline.markMoved(mDrawable, TRUE);
6113 6279
6114 mIsSitting = FALSE; 6280 mIsSitting = FALSE;
6281// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.1d
6282 #ifdef RLV_EXTENSION_STARTLOCATION
6283 if (rlv_handler_t::isEnabled())
6284 {
6285 RlvSettings::updateLoginLastLocation();
6286 }
6287 #endif // RLV_EXTENSION_STARTLOCATION
6288// [/RLVa:KB]
6115 mRoot.getXform()->setParent(NULL); // LLVOAvatar::getOffObject 6289 mRoot.getXform()->setParent(NULL); // LLVOAvatar::getOffObject
6116 mRoot.setPosition(cur_position_world); 6290 mRoot.setPosition(cur_position_world);
6117 mRoot.setRotation(cur_rotation_world); 6291 mRoot.setRotation(cur_rotation_world);