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.cpp186
1 files changed, 171 insertions, 15 deletions
diff --git a/linden/indra/newview/llagent.cpp b/linden/indra/newview/llagent.cpp
index 7a70316..d73ddb6 100644
--- a/linden/indra/newview/llagent.cpp
+++ b/linden/indra/newview/llagent.cpp
@@ -758,6 +758,9 @@ void LLAgent::movePitch(S32 direction)
758// Does this parcel allow you to fly? 758// Does this parcel allow you to fly?
759BOOL LLAgent::canFly() 759BOOL LLAgent::canFly()
760{ 760{
761// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0c)
762 if (gRlvHandler.hasBehaviour(RLV_BHVR_FLY)) return FALSE;
763// [/RLVa:KB]
761 if (isGodlike()) return TRUE; 764 if (isGodlike()) return TRUE;
762 765
763 LLViewerRegion* regionp = getRegion(); 766 LLViewerRegion* regionp = getRegion();
@@ -797,6 +800,13 @@ void LLAgent::setFlying(BOOL fly)
797 800
798 if (fly) 801 if (fly)
799 { 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
800 BOOL was_flying = getFlying(); 810 BOOL was_flying = getFlying();
801 if (!canFly() && !was_flying) 811 if (!canFly() && !was_flying)
802 { 812 {
@@ -4243,6 +4253,13 @@ void LLAgent::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL camera_ani
4243 return; 4253 return;
4244 } 4254 }
4245 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
4246 setControlFlags(AGENT_CONTROL_STAND_UP); // force stand up 4263 setControlFlags(AGENT_CONTROL_STAND_UP); // force stand up
4247 gViewerWindow->getWindow()->resetBusyCount(); 4264 gViewerWindow->getWindow()->resetBusyCount();
4248 4265
@@ -5037,6 +5054,14 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO
5037// utility to build a location string 5054// utility to build a location string
5038void LLAgent::buildLocationString(std::string& str) 5055void LLAgent::buildLocationString(std::string& str)
5039{ 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
5040 const LLVector3& agent_pos_region = getPositionAgent(); 5065 const LLVector3& agent_pos_region = getPositionAgent();
5041 S32 pos_x = S32(agent_pos_region.mV[VX]); 5066 S32 pos_x = S32(agent_pos_region.mV[VX]);
5042 S32 pos_y = S32(agent_pos_region.mV[VY]); 5067 S32 pos_y = S32(agent_pos_region.mV[VY]);
@@ -5919,6 +5944,15 @@ void LLAgent::teleportRequest(
5919// Landmark ID = LLUUID::null means teleport home 5944// Landmark ID = LLUUID::null means teleport home
5920void LLAgent::teleportViaLandmark(const LLUUID& landmark_asset_id) 5945void LLAgent::teleportViaLandmark(const LLUUID& landmark_asset_id)
5921{ 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
5922 LLViewerRegion *regionp = getRegion(); 5956 LLViewerRegion *regionp = getRegion();
5923 if(regionp && teleportCore()) 5957 if(regionp && teleportCore())
5924 { 5958 {
@@ -5983,6 +6017,17 @@ void LLAgent::teleportCancel()
5983 6017
5984void LLAgent::teleportViaLocation(const LLVector3d& pos_global) 6018void LLAgent::teleportViaLocation(const LLVector3d& pos_global)
5985{ 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
5986 LLViewerRegion* regionp = getRegion(); 6031 LLViewerRegion* regionp = getRegion();
5987 LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global); 6032 LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global);
5988 if(regionp && info) 6033 if(regionp && info)
@@ -6057,6 +6102,13 @@ void LLAgent::setTeleportState(ETeleportState state)
6057 // We're outa here. Save "back" slurl. 6102 // We're outa here. Save "back" slurl.
6058 mTeleportSourceSLURL = getSLURL(); 6103 mTeleportSourceSLURL = getSLURL();
6059 } 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]
6060} 6112}
6061 6113
6062void LLAgent::stopCurrentAnimations() 6114void LLAgent::stopCurrentAnimations()
@@ -6684,10 +6736,17 @@ void LLAgent::processAgentInitialWearablesUpdate( LLMessageSystem* mesgsys, void
6684 } 6736 }
6685 6737
6686 // 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]
6687 for( i = 0; i < WT_COUNT; i++ ) 6742 for( i = 0; i < WT_COUNT; i++ )
6688 { 6743 {
6689 if( !gAgent.mWearableEntry[i].mItemID.isNull() ) 6744 if( !gAgent.mWearableEntry[i].mItemID.isNull() )
6690 { 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]
6691 gWearableList.getAsset( 6750 gWearableList.getAsset(
6692 asset_id_array[i], 6751 asset_id_array[i],
6693 LLStringUtil::null, 6752 LLStringUtil::null,
@@ -6695,6 +6754,15 @@ void LLAgent::processAgentInitialWearablesUpdate( LLMessageSystem* mesgsys, void
6695 LLAgent::onInitialWearableAssetArrived, (void*)(intptr_t)i ); 6754 LLAgent::onInitialWearableAssetArrived, (void*)(intptr_t)i );
6696 } 6755 }
6697 } 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]
6698 } 6766 }
6699} 6767}
6700 6768
@@ -7192,6 +7260,13 @@ void LLAgent::removeWearable( EWearableType type )
7192 return; 7260 return;
7193 } 7261 }
7194 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
7195 if( old_wearable ) 7270 if( old_wearable )
7196 { 7271 {
7197 if( old_wearable->isDirty() ) 7272 if( old_wearable->isDirty() )
@@ -7314,15 +7389,17 @@ void LLAgent::setWearableOutfit(
7314 wearables_to_remove[WT_SKIN] = FALSE; 7389 wearables_to_remove[WT_SKIN] = FALSE;
7315 wearables_to_remove[WT_HAIR] = FALSE; 7390 wearables_to_remove[WT_HAIR] = FALSE;
7316 wearables_to_remove[WT_EYES] = FALSE; 7391 wearables_to_remove[WT_EYES] = FALSE;
7317 wearables_to_remove[WT_SHIRT] = remove; 7392// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Added: RLVa-0.2.2a
7318 wearables_to_remove[WT_PANTS] = remove; 7393 wearables_to_remove[WT_SHIRT] = remove && gRlvHandler.isRemovable(WT_SHIRT);
7319 wearables_to_remove[WT_SHOES] = remove; 7394 wearables_to_remove[WT_PANTS] = remove && gRlvHandler.isRemovable(WT_PANTS);
7320 wearables_to_remove[WT_SOCKS] = remove; 7395 wearables_to_remove[WT_SHOES] = remove && gRlvHandler.isRemovable(WT_SHOES);
7321 wearables_to_remove[WT_JACKET] = remove; 7396 wearables_to_remove[WT_SOCKS] = remove && gRlvHandler.isRemovable(WT_SOCKS);
7322 wearables_to_remove[WT_GLOVES] = remove; 7397 wearables_to_remove[WT_JACKET] = remove && gRlvHandler.isRemovable(WT_JACKET);
7323 wearables_to_remove[WT_UNDERSHIRT] = (!gAgent.isTeen()) & remove; 7398 wearables_to_remove[WT_GLOVES] = remove && gRlvHandler.isRemovable(WT_GLOVES);
7324 wearables_to_remove[WT_UNDERPANTS] = (!gAgent.isTeen()) & remove; 7399 wearables_to_remove[WT_UNDERSHIRT] = (!gAgent.isTeen()) && remove && gRlvHandler.isRemovable(WT_UNDERSHIRT);
7325 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]
7326 7403
7327 S32 count = wearables.count(); 7404 S32 count = wearables.count();
7328 llassert( items.count() == count ); 7405 llassert( items.count() == count );
@@ -7414,6 +7491,15 @@ void LLAgent::setWearable( LLInventoryItem* new_item, LLWearable* new_wearable )
7414 EWearableType type = new_wearable->getType(); 7491 EWearableType type = new_wearable->getType();
7415 7492
7416 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
7417 if( old_wearable ) 7503 if( old_wearable )
7418 { 7504 {
7419 const LLUUID& old_item_id = mWearableEntry[ type ].mItemID; 7505 const LLUUID& old_item_id = mWearableEntry[ type ].mItemID;
@@ -7622,10 +7708,13 @@ void LLAgent::userRemoveAllAttachments( void* userdata )
7622 return; 7708 return;
7623 } 7709 }
7624 7710
7625 gMessageSystem->newMessage("ObjectDetach"); 7711// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Added: RLVa-0.2.0c
7626 gMessageSystem->nextBlockFast(_PREHASH_AgentData); 7712 // NOTE-RLVa: This function is called from inside RlvHandler as well, hence the rather heavy modifications
7627 gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); 7713 std::list<U32> rlvAttachments;
7628 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
7629 7718
7630 for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); 7719 for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin();
7631 iter != avatarp->mAttachmentPoints.end(); ) 7720 iter != avatarp->mAttachmentPoints.end(); )
@@ -7635,11 +7724,78 @@ void LLAgent::userRemoveAllAttachments( void* userdata )
7635 LLViewerObject* objectp = attachment->getObject(); 7724 LLViewerObject* objectp = attachment->getObject();
7636 if (objectp) 7725 if (objectp)
7637 { 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 {
7638 gMessageSystem->nextBlockFast(_PREHASH_ObjectData); 7768 gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
7639 gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, objectp->getLocalID()); 7769 gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, *itAttach);
7640 } 7770 }
7771
7772 gMessageSystem->sendReliable( gAgent.getRegionHost() );
7641 } 7773 }
7642 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]
7643} 7799}
7644 7800
7645void LLAgent::observeFriends() 7801void LLAgent::observeFriends()