aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llagent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llagent.cpp')
-rw-r--r--linden/indra/newview/llagent.cpp216
1 files changed, 201 insertions, 15 deletions
diff --git a/linden/indra/newview/llagent.cpp b/linden/indra/newview/llagent.cpp
index 5f0a875..d73ddb6 100644
--- a/linden/indra/newview/llagent.cpp
+++ b/linden/indra/newview/llagent.cpp
@@ -232,6 +232,7 @@ LLAgent gAgent;
232// Statics 232// Statics
233// 233//
234BOOL LLAgent::sDebugDisplayTarget = FALSE; 234BOOL LLAgent::sDebugDisplayTarget = FALSE;
235BOOL LLAgent::sPhantom = FALSE;
235 236
236const F32 LLAgent::TYPING_TIMEOUT_SECS = 5.f; 237const F32 LLAgent::TYPING_TIMEOUT_SECS = 5.f;
237 238
@@ -757,6 +758,9 @@ void LLAgent::movePitch(S32 direction)
757// Does this parcel allow you to fly? 758// Does this parcel allow you to fly?
758BOOL LLAgent::canFly() 759BOOL LLAgent::canFly()
759{ 760{
761// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0c)
762 if (gRlvHandler.hasBehaviour(RLV_BHVR_FLY)) return FALSE;
763// [/RLVa:KB]
760 if (isGodlike()) return TRUE; 764 if (isGodlike()) return TRUE;
761 765
762 LLViewerRegion* regionp = getRegion(); 766 LLViewerRegion* regionp = getRegion();
@@ -796,6 +800,13 @@ void LLAgent::setFlying(BOOL fly)
796 800
797 if (fly) 801 if (fly)
798 { 802 {
803// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0c)
804 if (gRlvHandler.hasBehaviour(RLV_BHVR_FLY))
805 {
806 return;
807 }
808// [/RLVa:KB]
809
799 BOOL was_flying = getFlying(); 810 BOOL was_flying = getFlying();
800 if (!canFly() && !was_flying) 811 if (!canFly() && !was_flying)
801 { 812 {
@@ -835,6 +846,35 @@ void LLAgent::toggleFlying()
835 846
836 847
837//----------------------------------------------------------------------------- 848//-----------------------------------------------------------------------------
849// togglePhantom()
850//-----------------------------------------------------------------------------
851void LLAgent::togglePhantom()
852{
853 BOOL phan = !(sPhantom);
854
855 setPhantom( phan );
856}
857
858
859//-----------------------------------------------------------------------------
860// setPhantom() lgg
861//-----------------------------------------------------------------------------
862void LLAgent::setPhantom(BOOL phantom)
863{
864 sPhantom = phantom;
865}
866
867
868//-----------------------------------------------------------------------------
869// getPhantom() lgg
870//-----------------------------------------------------------------------------
871BOOL LLAgent::getPhantom()
872{
873 return sPhantom;
874}
875
876
877//-----------------------------------------------------------------------------
838// setRegion() 878// setRegion()
839//----------------------------------------------------------------------------- 879//-----------------------------------------------------------------------------
840void LLAgent::setRegion(LLViewerRegion *regionp) 880void LLAgent::setRegion(LLViewerRegion *regionp)
@@ -4213,6 +4253,13 @@ void LLAgent::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL camera_ani
4213 return; 4253 return;
4214 } 4254 }
4215 4255
4256// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g)
4257 if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (mAvatarObject.notNull()) && (mAvatarObject->mIsSitting) )
4258 {
4259 return;
4260 }
4261// [/RLVa:KB]
4262
4216 setControlFlags(AGENT_CONTROL_STAND_UP); // force stand up 4263 setControlFlags(AGENT_CONTROL_STAND_UP); // force stand up
4217 gViewerWindow->getWindow()->resetBusyCount(); 4264 gViewerWindow->getWindow()->resetBusyCount();
4218 4265
@@ -5007,6 +5054,14 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO
5007// utility to build a location string 5054// utility to build a location string
5008void LLAgent::buildLocationString(std::string& str) 5055void LLAgent::buildLocationString(std::string& str)
5009{ 5056{
5057// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a)
5058 if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
5059 {
5060 str = rlv_handler_t::cstrHidden;
5061 return;
5062 }
5063// [/RLVa:KB]
5064
5010 const LLVector3& agent_pos_region = getPositionAgent(); 5065 const LLVector3& agent_pos_region = getPositionAgent();
5011 S32 pos_x = S32(agent_pos_region.mV[VX]); 5066 S32 pos_x = S32(agent_pos_region.mV[VX]);
5012 S32 pos_y = S32(agent_pos_region.mV[VY]); 5067 S32 pos_y = S32(agent_pos_region.mV[VY]);
@@ -5889,6 +5944,15 @@ void LLAgent::teleportRequest(
5889// Landmark ID = LLUUID::null means teleport home 5944// Landmark ID = LLUUID::null means teleport home
5890void LLAgent::teleportViaLandmark(const LLUUID& landmark_asset_id) 5945void LLAgent::teleportViaLandmark(const LLUUID& landmark_asset_id)
5891{ 5946{
5947// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d)
5948 if ( (rlv_handler_t::isEnabled()) &&
5949 ( (gRlvHandler.hasBehaviour("tplm")) ||
5950 ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (mAvatarObject.notNull()) && (mAvatarObject->mIsSitting)) ))
5951 {
5952 return;
5953 }
5954// [/RLVa:KB]
5955
5892 LLViewerRegion *regionp = getRegion(); 5956 LLViewerRegion *regionp = getRegion();
5893 if(regionp && teleportCore()) 5957 if(regionp && teleportCore())
5894 { 5958 {
@@ -5953,6 +6017,17 @@ void LLAgent::teleportCancel()
5953 6017
5954void LLAgent::teleportViaLocation(const LLVector3d& pos_global) 6018void LLAgent::teleportViaLocation(const LLVector3d& pos_global)
5955{ 6019{
6020// [RLVa:KB] - Alternate: Snowglobe-1.0 | Checked: 2009-07-07 (RLVa-1.0.0d)
6021 // If we're getting teleported due to @tpto we should disregard any @tploc=n or @unsit=n restrictions from the same object
6022 if ( (rlv_handler_t::isEnabled()) &&
6023 ( (gRlvHandler.hasBehaviourExcept("tploc", gRlvHandler.getCurrentObject())) ||
6024 ( (mAvatarObject.notNull()) && (mAvatarObject->mIsSitting) &&
6025 (gRlvHandler.hasBehaviourExcept(RLV_BHVR_UNSIT, gRlvHandler.getCurrentObject()))) ) )
6026 {
6027 return;
6028 }
6029// [/RLVa:KB]
6030
5956 LLViewerRegion* regionp = getRegion(); 6031 LLViewerRegion* regionp = getRegion();
5957 LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global); 6032 LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global);
5958 if(regionp && info) 6033 if(regionp && info)
@@ -6027,6 +6102,13 @@ void LLAgent::setTeleportState(ETeleportState state)
6027 // We're outa here. Save "back" slurl. 6102 // We're outa here. Save "back" slurl.
6028 mTeleportSourceSLURL = getSLURL(); 6103 mTeleportSourceSLURL = getSLURL();
6029 } 6104 }
6105
6106// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-07 (RLVa-1.0.0d) | Added: RLVa-0.2.0b
6107 if ( (rlv_handler_t::isEnabled()) && (TELEPORT_NONE == mTeleportState) )
6108 {
6109 gRlvHandler.setCanCancelTp(true);
6110 }
6111// [/RLVa:KB]
6030} 6112}
6031 6113
6032void LLAgent::stopCurrentAnimations() 6114void LLAgent::stopCurrentAnimations()
@@ -6654,10 +6736,17 @@ void LLAgent::processAgentInitialWearablesUpdate( LLMessageSystem* mesgsys, void
6654 } 6736 }
6655 6737
6656 // now that we have the asset ids...request the wearable assets 6738 // now that we have the asset ids...request the wearable assets
6739// [RLVa:KB] - Checked: 2009-08-08 (RLVa-1.0.1g) | Added: RLVa-1.0.1g
6740 LLInventoryFetchObserver::item_ref_t rlvItems;
6741// [/RLVa:KB]
6657 for( i = 0; i < WT_COUNT; i++ ) 6742 for( i = 0; i < WT_COUNT; i++ )
6658 { 6743 {
6659 if( !gAgent.mWearableEntry[i].mItemID.isNull() ) 6744 if( !gAgent.mWearableEntry[i].mItemID.isNull() )
6660 { 6745 {
6746// [RLVa:KB] - Checked: 2009-08-08 (RLVa-1.0.1g) | Added: RLVa-1.0.1g
6747 if (rlv_handler_t::isEnabled())
6748 rlvItems.push_back(gAgent.mWearableEntry[i].mItemID);
6749// [/RLVa:KB]
6661 gWearableList.getAsset( 6750 gWearableList.getAsset(
6662 asset_id_array[i], 6751 asset_id_array[i],
6663 LLStringUtil::null, 6752 LLStringUtil::null,
@@ -6665,6 +6754,15 @@ void LLAgent::processAgentInitialWearablesUpdate( LLMessageSystem* mesgsys, void
6665 LLAgent::onInitialWearableAssetArrived, (void*)(intptr_t)i ); 6754 LLAgent::onInitialWearableAssetArrived, (void*)(intptr_t)i );
6666 } 6755 }
6667 } 6756 }
6757
6758// [RLVa:KB] - Checked: 2009-08-08 (RLVa-1.0.1g) | Added: RLVa-1.0.1g
6759 // TODO-RLVa: checking that we're in STATE_STARTED is probably not needed, but leave it until we can be absolutely sure
6760 if ( (rlv_handler_t::isEnabled()) && (LLStartUp::getStartupState() == STATE_STARTED) )
6761 {
6762 RlvCurrentlyWorn f;
6763 f.fetchItems(rlvItems);
6764 }
6765// [/RLVa:KB]
6668 } 6766 }
6669} 6767}
6670 6768
@@ -7162,6 +7260,13 @@ void LLAgent::removeWearable( EWearableType type )
7162 return; 7260 return;
7163 } 7261 }
7164 7262
7263// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-07 (RLVa-1.0.0d)
7264 if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.isRemovable(type)) )
7265 {
7266 return;
7267 }
7268// [/RLVa:KB]
7269
7165 if( old_wearable ) 7270 if( old_wearable )
7166 { 7271 {
7167 if( old_wearable->isDirty() ) 7272 if( old_wearable->isDirty() )
@@ -7284,15 +7389,17 @@ void LLAgent::setWearableOutfit(
7284 wearables_to_remove[WT_SKIN] = FALSE; 7389 wearables_to_remove[WT_SKIN] = FALSE;
7285 wearables_to_remove[WT_HAIR] = FALSE; 7390 wearables_to_remove[WT_HAIR] = FALSE;
7286 wearables_to_remove[WT_EYES] = FALSE; 7391 wearables_to_remove[WT_EYES] = FALSE;
7287 wearables_to_remove[WT_SHIRT] = remove; 7392// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Added: RLVa-0.2.2a
7288 wearables_to_remove[WT_PANTS] = remove; 7393 wearables_to_remove[WT_SHIRT] = remove && gRlvHandler.isRemovable(WT_SHIRT);
7289 wearables_to_remove[WT_SHOES] = remove; 7394 wearables_to_remove[WT_PANTS] = remove && gRlvHandler.isRemovable(WT_PANTS);
7290 wearables_to_remove[WT_SOCKS] = remove; 7395 wearables_to_remove[WT_SHOES] = remove && gRlvHandler.isRemovable(WT_SHOES);
7291 wearables_to_remove[WT_JACKET] = remove; 7396 wearables_to_remove[WT_SOCKS] = remove && gRlvHandler.isRemovable(WT_SOCKS);
7292 wearables_to_remove[WT_GLOVES] = remove; 7397 wearables_to_remove[WT_JACKET] = remove && gRlvHandler.isRemovable(WT_JACKET);
7293 wearables_to_remove[WT_UNDERSHIRT] = (!gAgent.isTeen()) & remove; 7398 wearables_to_remove[WT_GLOVES] = remove && gRlvHandler.isRemovable(WT_GLOVES);
7294 wearables_to_remove[WT_UNDERPANTS] = (!gAgent.isTeen()) & remove; 7399 wearables_to_remove[WT_UNDERSHIRT] = (!gAgent.isTeen()) && remove && gRlvHandler.isRemovable(WT_UNDERSHIRT);
7295 wearables_to_remove[WT_SKIRT] = remove; 7400 wearables_to_remove[WT_UNDERPANTS] = (!gAgent.isTeen()) && remove && gRlvHandler.isRemovable(WT_UNDERPANTS);
7401 wearables_to_remove[WT_SKIRT] = remove && gRlvHandler.isRemovable(WT_SKIRT);
7402// [/RLVa:KB]
7296 7403
7297 S32 count = wearables.count(); 7404 S32 count = wearables.count();
7298 llassert( items.count() == count ); 7405 llassert( items.count() == count );
@@ -7384,6 +7491,15 @@ void LLAgent::setWearable( LLInventoryItem* new_item, LLWearable* new_wearable )
7384 EWearableType type = new_wearable->getType(); 7491 EWearableType type = new_wearable->getType();
7385 7492
7386 LLWearable* old_wearable = mWearableEntry[ type ].mWearable; 7493 LLWearable* old_wearable = mWearableEntry[ type ].mWearable;
7494
7495// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d)
7496 // Block if: we can't wear on that layer; or we're already wearing something there we can't take off
7497 if ( (rlv_handler_t::isEnabled()) && ((!gRlvHandler.isWearable(type)) || ((old_wearable) && (!gRlvHandler.isRemovable(type)))) )
7498 {
7499 return;
7500 }
7501// [/RLVa:KB]
7502
7387 if( old_wearable ) 7503 if( old_wearable )
7388 { 7504 {
7389 const LLUUID& old_item_id = mWearableEntry[ type ].mItemID; 7505 const LLUUID& old_item_id = mWearableEntry[ type ].mItemID;
@@ -7592,10 +7708,13 @@ void LLAgent::userRemoveAllAttachments( void* userdata )
7592 return; 7708 return;
7593 } 7709 }
7594 7710
7595 gMessageSystem->newMessage("ObjectDetach"); 7711// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Added: RLVa-0.2.0c
7596 gMessageSystem->nextBlockFast(_PREHASH_AgentData); 7712 // NOTE-RLVa: This function is called from inside RlvHandler as well, hence the rather heavy modifications
7597 gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); 7713 std::list<U32> rlvAttachments;
7598 gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); 7714 // TODO-RLVa: Once we have the improved "removeWearable" logic implemented we can just get rid of the whole "rlvCompFolders" hassle
7715 #ifdef RLV_EXPERIMENTAL_COMPOSITES
7716 std::list<LLUUID> rlvCompFolders;
7717 #endif // RLV_EXPERIMENTAL_COMPOSITES
7599 7718
7600 for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); 7719 for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin();
7601 iter != avatarp->mAttachmentPoints.end(); ) 7720 iter != avatarp->mAttachmentPoints.end(); )
@@ -7605,11 +7724,78 @@ void LLAgent::userRemoveAllAttachments( void* userdata )
7605 LLViewerObject* objectp = attachment->getObject(); 7724 LLViewerObject* objectp = attachment->getObject();
7606 if (objectp) 7725 if (objectp)
7607 { 7726 {
7727 if (rlv_handler_t::isEnabled())
7728 {
7729 if (!gRlvHandler.isDetachable(curiter->first))
7730 continue;
7731
7732 // Check if we're being called in response to an RLV command (that would be @detach=force)
7733 if ( (gRlvHandler.getCurrentCommand()) && (attachment->getItemID().notNull()) )
7734 {
7735 if (!gRlvHandler.isStrippable(attachment->getItemID())) // "nostrip" can be taken off by the user but not @detach
7736 continue;
7737
7738 #ifdef RLV_EXPERIMENTAL_COMPOSITES
7739 LLViewerInventoryCategory* pFolder;
7740 if (gRlvHandler.getCompositeInfo(attachment->getItemID(), NULL, &pFolder))
7741 {
7742 #ifdef RLV_EXPERIMENTAL_COMPOSITE_LOCKING
7743 if (!gRlvHandler.canTakeOffComposite(pFolder))
7744 continue;
7745 #endif // RLV_EXPERIMENTAL_COMPOSITE_LOCKING
7746
7747 // The attachment belongs to a composite folder so there may be additional things we need to take off
7748 if (std::find(rlvCompFolders.begin(), rlvCompFolders.end(), pFolder->getUUID()) != rlvCompFolders.end())
7749 rlvCompFolders.push_back(pFolder->getUUID());
7750 }
7751 #endif // RLV_EXPERIMENTAL_COMPOSITES
7752 }
7753 }
7754 rlvAttachments.push_back(objectp->getLocalID());
7755 }
7756 }
7757
7758 // Only send the message if we actually have something to detach
7759 if (rlvAttachments.size() > 0)
7760 {
7761 gMessageSystem->newMessage("ObjectDetach");
7762 gMessageSystem->nextBlockFast(_PREHASH_AgentData);
7763 gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
7764 gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
7765
7766 for (std::list<U32>::const_iterator itAttach = rlvAttachments.begin(); itAttach != rlvAttachments.end(); ++itAttach)
7767 {
7608 gMessageSystem->nextBlockFast(_PREHASH_ObjectData); 7768 gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
7609 gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, objectp->getLocalID()); 7769 gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, *itAttach);
7610 } 7770 }
7771
7772 gMessageSystem->sendReliable( gAgent.getRegionHost() );
7611 } 7773 }
7612 gMessageSystem->sendReliable( gAgent.getRegionHost() ); 7774
7775 #ifdef RLV_EXPERIMENTAL_COMPOSITES
7776 if (rlv_handler_t::isEnabled)
7777 {
7778 // If we encountered any composite folders then we need to @detach all of them
7779 for (std::list<LLUUID>::const_iterator itFolder = rlvCompFolders.begin(); itFolder != rlvCompFolders.end(); ++itFolder)
7780 {
7781 std::string strFolder = gRlvHandler.getSharedPath(*itFolder);
7782
7783 // It shouldn't happen but make absolutely sure that we don't issue @detach:=force and reenter this function
7784 if (!strFolder.empty())
7785 {
7786 std::string strCmd = "detach:" + strFolder + "=force";
7787 #ifdef RLV_DEBUG
7788 RLV_INFOS << "\t- detaching composite folder: @" << strCmd << LL_ENDL;
7789 #endif // RLV_DEBUG
7790
7791 // HACK-RLV: executing a command while another command is currently executing isn't the best thing to do, however
7792 // in this specific case it is safe (and still better than making processForceCommand public)
7793 gRlvHandler.processCommand(gRlvHandler.getCurrentObject(), strCmd);
7794 }
7795 }
7796 }
7797 #endif // RLV_EXPERIMENTAL_COMPOSITES
7798// [/RLVa:KB]
7613} 7799}
7614 7800
7615void LLAgent::observeFriends() 7801void LLAgent::observeFriends()