aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llagent.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-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 5f0a875..e71f1b7 100644
--- a/linden/indra/newview/llagent.cpp
+++ b/linden/indra/newview/llagent.cpp
@@ -757,6 +757,9 @@ void LLAgent::movePitch(S32 direction)
757// Does this parcel allow you to fly? 757// Does this parcel allow you to fly?
758BOOL LLAgent::canFly() 758BOOL LLAgent::canFly()
759{ 759{
760// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0c)
761 if (gRlvHandler.hasBehaviour(RLV_BHVR_FLY)) return FALSE;
762// [/RLVa:KB]
760 if (isGodlike()) return TRUE; 763 if (isGodlike()) return TRUE;
761 764
762 LLViewerRegion* regionp = getRegion(); 765 LLViewerRegion* regionp = getRegion();
@@ -796,6 +799,13 @@ void LLAgent::setFlying(BOOL fly)
796 799
797 if (fly) 800 if (fly)
798 { 801 {
802// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0c)
803 if (gRlvHandler.hasBehaviour(RLV_BHVR_FLY))
804 {
805 return;
806 }
807// [/RLVa:KB]
808
799 BOOL was_flying = getFlying(); 809 BOOL was_flying = getFlying();
800 if (!canFly() && !was_flying) 810 if (!canFly() && !was_flying)
801 { 811 {
@@ -4213,6 +4223,13 @@ void LLAgent::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL camera_ani
4213 return; 4223 return;
4214 } 4224 }
4215 4225
4226// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g)
4227 if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (mAvatarObject.notNull()) && (mAvatarObject->mIsSitting) )
4228 {
4229 return;
4230 }
4231// [/RLVa:KB]
4232
4216 setControlFlags(AGENT_CONTROL_STAND_UP); // force stand up 4233 setControlFlags(AGENT_CONTROL_STAND_UP); // force stand up
4217 gViewerWindow->getWindow()->resetBusyCount(); 4234 gViewerWindow->getWindow()->resetBusyCount();
4218 4235
@@ -5007,6 +5024,14 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO
5007// utility to build a location string 5024// utility to build a location string
5008void LLAgent::buildLocationString(std::string& str) 5025void LLAgent::buildLocationString(std::string& str)
5009{ 5026{
5027// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a)
5028 if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
5029 {
5030 str = rlv_handler_t::cstrHidden;
5031 return;
5032 }
5033// [/RLVa:KB]
5034
5010 const LLVector3& agent_pos_region = getPositionAgent(); 5035 const LLVector3& agent_pos_region = getPositionAgent();
5011 S32 pos_x = S32(agent_pos_region.mV[VX]); 5036 S32 pos_x = S32(agent_pos_region.mV[VX]);
5012 S32 pos_y = S32(agent_pos_region.mV[VY]); 5037 S32 pos_y = S32(agent_pos_region.mV[VY]);
@@ -5889,6 +5914,15 @@ void LLAgent::teleportRequest(
5889// Landmark ID = LLUUID::null means teleport home 5914// Landmark ID = LLUUID::null means teleport home
5890void LLAgent::teleportViaLandmark(const LLUUID& landmark_asset_id) 5915void LLAgent::teleportViaLandmark(const LLUUID& landmark_asset_id)
5891{ 5916{
5917// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d)
5918 if ( (rlv_handler_t::isEnabled()) &&
5919 ( (gRlvHandler.hasBehaviour("tplm")) ||
5920 ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (mAvatarObject.notNull()) && (mAvatarObject->mIsSitting)) ))
5921 {
5922 return;
5923 }
5924// [/RLVa:KB]
5925
5892 LLViewerRegion *regionp = getRegion(); 5926 LLViewerRegion *regionp = getRegion();
5893 if(regionp && teleportCore()) 5927 if(regionp && teleportCore())
5894 { 5928 {
@@ -5953,6 +5987,17 @@ void LLAgent::teleportCancel()
5953 5987
5954void LLAgent::teleportViaLocation(const LLVector3d& pos_global) 5988void LLAgent::teleportViaLocation(const LLVector3d& pos_global)
5955{ 5989{
5990// [RLVa:KB] - Alternate: Snowglobe-1.0 | Checked: 2009-07-07 (RLVa-1.0.0d)
5991 // If we're getting teleported due to @tpto we should disregard any @tploc=n or @unsit=n restrictions from the same object
5992 if ( (rlv_handler_t::isEnabled()) &&
5993 ( (gRlvHandler.hasBehaviourExcept("tploc", gRlvHandler.getCurrentObject())) ||
5994 ( (mAvatarObject.notNull()) && (mAvatarObject->mIsSitting) &&
5995 (gRlvHandler.hasBehaviourExcept(RLV_BHVR_UNSIT, gRlvHandler.getCurrentObject()))) ) )
5996 {
5997 return;
5998 }
5999// [/RLVa:KB]
6000
5956 LLViewerRegion* regionp = getRegion(); 6001 LLViewerRegion* regionp = getRegion();
5957 LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global); 6002 LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global);
5958 if(regionp && info) 6003 if(regionp && info)
@@ -6027,6 +6072,13 @@ void LLAgent::setTeleportState(ETeleportState state)
6027 // We're outa here. Save "back" slurl. 6072 // We're outa here. Save "back" slurl.
6028 mTeleportSourceSLURL = getSLURL(); 6073 mTeleportSourceSLURL = getSLURL();
6029 } 6074 }
6075
6076// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-07 (RLVa-1.0.0d) | Added: RLVa-0.2.0b
6077 if ( (rlv_handler_t::isEnabled()) && (TELEPORT_NONE == mTeleportState) )
6078 {
6079 gRlvHandler.setCanCancelTp(true);
6080 }
6081// [/RLVa:KB]
6030} 6082}
6031 6083
6032void LLAgent::stopCurrentAnimations() 6084void LLAgent::stopCurrentAnimations()
@@ -6654,10 +6706,17 @@ void LLAgent::processAgentInitialWearablesUpdate( LLMessageSystem* mesgsys, void
6654 } 6706 }
6655 6707
6656 // now that we have the asset ids...request the wearable assets 6708 // now that we have the asset ids...request the wearable assets
6709// [RLVa:KB] - Checked: 2009-08-08 (RLVa-1.0.1g) | Added: RLVa-1.0.1g
6710 LLInventoryFetchObserver::item_ref_t rlvItems;
6711// [/RLVa:KB]
6657 for( i = 0; i < WT_COUNT; i++ ) 6712 for( i = 0; i < WT_COUNT; i++ )
6658 { 6713 {
6659 if( !gAgent.mWearableEntry[i].mItemID.isNull() ) 6714 if( !gAgent.mWearableEntry[i].mItemID.isNull() )
6660 { 6715 {
6716// [RLVa:KB] - Checked: 2009-08-08 (RLVa-1.0.1g) | Added: RLVa-1.0.1g
6717 if (rlv_handler_t::isEnabled())
6718 rlvItems.push_back(gAgent.mWearableEntry[i].mItemID);
6719// [/RLVa:KB]
6661 gWearableList.getAsset( 6720 gWearableList.getAsset(
6662 asset_id_array[i], 6721 asset_id_array[i],
6663 LLStringUtil::null, 6722 LLStringUtil::null,
@@ -6665,6 +6724,15 @@ void LLAgent::processAgentInitialWearablesUpdate( LLMessageSystem* mesgsys, void
6665 LLAgent::onInitialWearableAssetArrived, (void*)(intptr_t)i ); 6724 LLAgent::onInitialWearableAssetArrived, (void*)(intptr_t)i );
6666 } 6725 }
6667 } 6726 }
6727
6728// [RLVa:KB] - Checked: 2009-08-08 (RLVa-1.0.1g) | Added: RLVa-1.0.1g
6729 // TODO-RLVa: checking that we're in STATE_STARTED is probably not needed, but leave it until we can be absolutely sure
6730 if ( (rlv_handler_t::isEnabled()) && (LLStartUp::getStartupState() == STATE_STARTED) )
6731 {
6732 RlvCurrentlyWorn f;
6733 f.fetchItems(rlvItems);
6734 }
6735// [/RLVa:KB]
6668 } 6736 }
6669} 6737}
6670 6738
@@ -7162,6 +7230,13 @@ void LLAgent::removeWearable( EWearableType type )
7162 return; 7230 return;
7163 } 7231 }
7164 7232
7233// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-07 (RLVa-1.0.0d)
7234 if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.isRemovable(type)) )
7235 {
7236 return;
7237 }
7238// [/RLVa:KB]
7239
7165 if( old_wearable ) 7240 if( old_wearable )
7166 { 7241 {
7167 if( old_wearable->isDirty() ) 7242 if( old_wearable->isDirty() )
@@ -7284,15 +7359,17 @@ void LLAgent::setWearableOutfit(
7284 wearables_to_remove[WT_SKIN] = FALSE; 7359 wearables_to_remove[WT_SKIN] = FALSE;
7285 wearables_to_remove[WT_HAIR] = FALSE; 7360 wearables_to_remove[WT_HAIR] = FALSE;
7286 wearables_to_remove[WT_EYES] = FALSE; 7361 wearables_to_remove[WT_EYES] = FALSE;
7287 wearables_to_remove[WT_SHIRT] = remove; 7362// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Added: RLVa-0.2.2a
7288 wearables_to_remove[WT_PANTS] = remove; 7363 wearables_to_remove[WT_SHIRT] = remove && gRlvHandler.isRemovable(WT_SHIRT);
7289 wearables_to_remove[WT_SHOES] = remove; 7364 wearables_to_remove[WT_PANTS] = remove && gRlvHandler.isRemovable(WT_PANTS);
7290 wearables_to_remove[WT_SOCKS] = remove; 7365 wearables_to_remove[WT_SHOES] = remove && gRlvHandler.isRemovable(WT_SHOES);
7291 wearables_to_remove[WT_JACKET] = remove; 7366 wearables_to_remove[WT_SOCKS] = remove && gRlvHandler.isRemovable(WT_SOCKS);
7292 wearables_to_remove[WT_GLOVES] = remove; 7367 wearables_to_remove[WT_JACKET] = remove && gRlvHandler.isRemovable(WT_JACKET);
7293 wearables_to_remove[WT_UNDERSHIRT] = (!gAgent.isTeen()) & remove; 7368 wearables_to_remove[WT_GLOVES] = remove && gRlvHandler.isRemovable(WT_GLOVES);
7294 wearables_to_remove[WT_UNDERPANTS] = (!gAgent.isTeen()) & remove; 7369 wearables_to_remove[WT_UNDERSHIRT] = (!gAgent.isTeen()) && remove && gRlvHandler.isRemovable(WT_UNDERSHIRT);
7295 wearables_to_remove[WT_SKIRT] = remove; 7370 wearables_to_remove[WT_UNDERPANTS] = (!gAgent.isTeen()) && remove && gRlvHandler.isRemovable(WT_UNDERPANTS);
7371 wearables_to_remove[WT_SKIRT] = remove && gRlvHandler.isRemovable(WT_SKIRT);
7372// [/RLVa:KB]
7296 7373
7297 S32 count = wearables.count(); 7374 S32 count = wearables.count();
7298 llassert( items.count() == count ); 7375 llassert( items.count() == count );
@@ -7384,6 +7461,15 @@ void LLAgent::setWearable( LLInventoryItem* new_item, LLWearable* new_wearable )
7384 EWearableType type = new_wearable->getType(); 7461 EWearableType type = new_wearable->getType();
7385 7462
7386 LLWearable* old_wearable = mWearableEntry[ type ].mWearable; 7463 LLWearable* old_wearable = mWearableEntry[ type ].mWearable;
7464
7465// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d)
7466 // Block if: we can't wear on that layer; or we're already wearing something there we can't take off
7467 if ( (rlv_handler_t::isEnabled()) && ((!gRlvHandler.isWearable(type)) || ((old_wearable) && (!gRlvHandler.isRemovable(type)))) )
7468 {
7469 return;
7470 }
7471// [/RLVa:KB]
7472
7387 if( old_wearable ) 7473 if( old_wearable )
7388 { 7474 {
7389 const LLUUID& old_item_id = mWearableEntry[ type ].mItemID; 7475 const LLUUID& old_item_id = mWearableEntry[ type ].mItemID;
@@ -7592,10 +7678,13 @@ void LLAgent::userRemoveAllAttachments( void* userdata )
7592 return; 7678 return;
7593 } 7679 }
7594 7680
7595 gMessageSystem->newMessage("ObjectDetach"); 7681// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Added: RLVa-0.2.0c
7596 gMessageSystem->nextBlockFast(_PREHASH_AgentData); 7682 // NOTE-RLVa: This function is called from inside RlvHandler as well, hence the rather heavy modifications
7597 gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); 7683 std::list<U32> rlvAttachments;
7598 gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); 7684 // TODO-RLVa: Once we have the improved "removeWearable" logic implemented we can just get rid of the whole "rlvCompFolders" hassle
7685 #ifdef RLV_EXPERIMENTAL_COMPOSITES
7686 std::list<LLUUID> rlvCompFolders;
7687 #endif // RLV_EXPERIMENTAL_COMPOSITES
7599 7688
7600 for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); 7689 for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin();
7601 iter != avatarp->mAttachmentPoints.end(); ) 7690 iter != avatarp->mAttachmentPoints.end(); )
@@ -7605,11 +7694,78 @@ void LLAgent::userRemoveAllAttachments( void* userdata )
7605 LLViewerObject* objectp = attachment->getObject(); 7694 LLViewerObject* objectp = attachment->getObject();
7606 if (objectp) 7695 if (objectp)
7607 { 7696 {
7697 if (rlv_handler_t::isEnabled())
7698 {
7699 if (!gRlvHandler.isDetachable(curiter->first))
7700 continue;
7701
7702 // Check if we're being called in response to an RLV command (that would be @detach=force)
7703 if ( (gRlvHandler.getCurrentCommand()) && (attachment->getItemID().notNull()) )
7704 {
7705 if (!gRlvHandler.isStrippable(attachment->getItemID())) // "nostrip" can be taken off by the user but not @detach
7706 continue;
7707
7708 #ifdef RLV_EXPERIMENTAL_COMPOSITES
7709 LLViewerInventoryCategory* pFolder;
7710 if (gRlvHandler.getCompositeInfo(attachment->getItemID(), NULL, &pFolder))
7711 {
7712 #ifdef RLV_EXPERIMENTAL_COMPOSITE_LOCKING
7713 if (!gRlvHandler.canTakeOffComposite(pFolder))
7714 continue;
7715 #endif // RLV_EXPERIMENTAL_COMPOSITE_LOCKING
7716
7717 // The attachment belongs to a composite folder so there may be additional things we need to take off
7718 if (std::find(rlvCompFolders.begin(), rlvCompFolders.end(), pFolder->getUUID()) != rlvCompFolders.end())
7719 rlvCompFolders.push_back(pFolder->getUUID());
7720 }
7721 #endif // RLV_EXPERIMENTAL_COMPOSITES
7722 }
7723 }
7724 rlvAttachments.push_back(objectp->getLocalID());
7725 }
7726 }
7727
7728 // Only send the message if we actually have something to detach
7729 if (rlvAttachments.size() > 0)
7730 {
7731 gMessageSystem->newMessage("ObjectDetach");
7732 gMessageSystem->nextBlockFast(_PREHASH_AgentData);
7733 gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
7734 gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
7735
7736 for (std::list<U32>::const_iterator itAttach = rlvAttachments.begin(); itAttach != rlvAttachments.end(); ++itAttach)
7737 {
7608 gMessageSystem->nextBlockFast(_PREHASH_ObjectData); 7738 gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
7609 gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, objectp->getLocalID()); 7739 gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, *itAttach);
7610 } 7740 }
7741
7742 gMessageSystem->sendReliable( gAgent.getRegionHost() );
7611 } 7743 }
7612 gMessageSystem->sendReliable( gAgent.getRegionHost() ); 7744
7745 #ifdef RLV_EXPERIMENTAL_COMPOSITES
7746 if (rlv_handler_t::isEnabled)
7747 {
7748 // If we encountered any composite folders then we need to @detach all of them
7749 for (std::list<LLUUID>::const_iterator itFolder = rlvCompFolders.begin(); itFolder != rlvCompFolders.end(); ++itFolder)
7750 {
7751 std::string strFolder = gRlvHandler.getSharedPath(*itFolder);
7752
7753 // It shouldn't happen but make absolutely sure that we don't issue @detach:=force and reenter this function
7754 if (!strFolder.empty())
7755 {
7756 std::string strCmd = "detach:" + strFolder + "=force";
7757 #ifdef RLV_DEBUG
7758 RLV_INFOS << "\t- detaching composite folder: @" << strCmd << LL_ENDL;
7759 #endif // RLV_DEBUG
7760
7761 // HACK-RLV: executing a command while another command is currently executing isn't the best thing to do, however
7762 // in this specific case it is safe (and still better than making processForceCommand public)
7763 gRlvHandler.processCommand(gRlvHandler.getCurrentObject(), strCmd);
7764 }
7765 }
7766 }
7767 #endif // RLV_EXPERIMENTAL_COMPOSITES
7768// [/RLVa:KB]
7613} 7769}
7614 7770
7615void LLAgent::observeFriends() 7771void LLAgent::observeFriends()