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 e6ae7b5..edcb82c 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
@@ -761,6 +762,9 @@ void LLAgent::movePitch(S32 direction)
761// Does this parcel allow you to fly? 762// Does this parcel allow you to fly?
762BOOL LLAgent::canFly() 763BOOL LLAgent::canFly()
763{ 764{
765// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0c)
766 if (gRlvHandler.hasBehaviour(RLV_BHVR_FLY)) return FALSE;
767// [/RLVa:KB]
764 if (isGodlike()) return TRUE; 768 if (isGodlike()) return TRUE;
765 769
766 LLViewerRegion* regionp = getRegion(); 770 LLViewerRegion* regionp = getRegion();
@@ -800,6 +804,13 @@ void LLAgent::setFlying(BOOL fly)
800 804
801 if (fly) 805 if (fly)
802 { 806 {
807// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0c)
808 if (gRlvHandler.hasBehaviour(RLV_BHVR_FLY))
809 {
810 return;
811 }
812// [/RLVa:KB]
813
803 BOOL was_flying = getFlying(); 814 BOOL was_flying = getFlying();
804 if (!canFly() && !was_flying) 815 if (!canFly() && !was_flying)
805 { 816 {
@@ -839,6 +850,35 @@ void LLAgent::toggleFlying()
839 850
840 851
841//----------------------------------------------------------------------------- 852//-----------------------------------------------------------------------------
853// togglePhantom()
854//-----------------------------------------------------------------------------
855void LLAgent::togglePhantom()
856{
857 BOOL phan = !(sPhantom);
858
859 setPhantom( phan );
860}
861
862
863//-----------------------------------------------------------------------------
864// setPhantom() lgg
865//-----------------------------------------------------------------------------
866void LLAgent::setPhantom(BOOL phantom)
867{
868 sPhantom = phantom;
869}
870
871
872//-----------------------------------------------------------------------------
873// getPhantom() lgg
874//-----------------------------------------------------------------------------
875BOOL LLAgent::getPhantom()
876{
877 return sPhantom;
878}
879
880
881//-----------------------------------------------------------------------------
842// setRegion() 882// setRegion()
843//----------------------------------------------------------------------------- 883//-----------------------------------------------------------------------------
844void LLAgent::setRegion(LLViewerRegion *regionp) 884void LLAgent::setRegion(LLViewerRegion *regionp)
@@ -4217,6 +4257,13 @@ void LLAgent::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL camera_ani
4217 return; 4257 return;
4218 } 4258 }
4219 4259
4260// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g)
4261 if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (mAvatarObject.notNull()) && (mAvatarObject->mIsSitting) )
4262 {
4263 return;
4264 }
4265// [/RLVa:KB]
4266
4220 setControlFlags(AGENT_CONTROL_STAND_UP); // force stand up 4267 setControlFlags(AGENT_CONTROL_STAND_UP); // force stand up
4221 gViewerWindow->getWindow()->resetBusyCount(); 4268 gViewerWindow->getWindow()->resetBusyCount();
4222 4269
@@ -5011,6 +5058,14 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO
5011// utility to build a location string 5058// utility to build a location string
5012void LLAgent::buildLocationString(std::string& str) 5059void LLAgent::buildLocationString(std::string& str)
5013{ 5060{
5061// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a)
5062 if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
5063 {
5064 str = rlv_handler_t::cstrHidden;
5065 return;
5066 }
5067// [/RLVa:KB]
5068
5014 const LLVector3& agent_pos_region = getPositionAgent(); 5069 const LLVector3& agent_pos_region = getPositionAgent();
5015 S32 pos_x = S32(agent_pos_region.mV[VX]); 5070 S32 pos_x = S32(agent_pos_region.mV[VX]);
5016 S32 pos_y = S32(agent_pos_region.mV[VY]); 5071 S32 pos_y = S32(agent_pos_region.mV[VY]);
@@ -5893,6 +5948,15 @@ void LLAgent::teleportRequest(
5893// Landmark ID = LLUUID::null means teleport home 5948// Landmark ID = LLUUID::null means teleport home
5894void LLAgent::teleportViaLandmark(const LLUUID& landmark_asset_id) 5949void LLAgent::teleportViaLandmark(const LLUUID& landmark_asset_id)
5895{ 5950{
5951// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d)
5952 if ( (rlv_handler_t::isEnabled()) &&
5953 ( (gRlvHandler.hasBehaviour("tplm")) ||
5954 ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (mAvatarObject.notNull()) && (mAvatarObject->mIsSitting)) ))
5955 {
5956 return;
5957 }
5958// [/RLVa:KB]
5959
5896 LLViewerRegion *regionp = getRegion(); 5960 LLViewerRegion *regionp = getRegion();
5897 if(regionp && teleportCore()) 5961 if(regionp && teleportCore())
5898 { 5962 {
@@ -5957,6 +6021,17 @@ void LLAgent::teleportCancel()
5957 6021
5958void LLAgent::teleportViaLocation(const LLVector3d& pos_global) 6022void LLAgent::teleportViaLocation(const LLVector3d& pos_global)
5959{ 6023{
6024// [RLVa:KB] - Alternate: Snowglobe-1.0 | Checked: 2009-07-07 (RLVa-1.0.0d)
6025 // If we're getting teleported due to @tpto we should disregard any @tploc=n or @unsit=n restrictions from the same object
6026 if ( (rlv_handler_t::isEnabled()) &&
6027 ( (gRlvHandler.hasBehaviourExcept("tploc", gRlvHandler.getCurrentObject())) ||
6028 ( (mAvatarObject.notNull()) && (mAvatarObject->mIsSitting) &&
6029 (gRlvHandler.hasBehaviourExcept(RLV_BHVR_UNSIT, gRlvHandler.getCurrentObject()))) ) )
6030 {
6031 return;
6032 }
6033// [/RLVa:KB]
6034
5960 LLViewerRegion* regionp = getRegion(); 6035 LLViewerRegion* regionp = getRegion();
5961 LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global); 6036 LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global);
5962 if(regionp && info) 6037 if(regionp && info)
@@ -6031,6 +6106,13 @@ void LLAgent::setTeleportState(ETeleportState state)
6031 // We're outa here. Save "back" slurl. 6106 // We're outa here. Save "back" slurl.
6032 mTeleportSourceSLURL = getSLURL(); 6107 mTeleportSourceSLURL = getSLURL();
6033 } 6108 }
6109
6110// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-07 (RLVa-1.0.0d) | Added: RLVa-0.2.0b
6111 if ( (rlv_handler_t::isEnabled()) && (TELEPORT_NONE == mTeleportState) )
6112 {
6113 gRlvHandler.setCanCancelTp(true);
6114 }
6115// [/RLVa:KB]
6034} 6116}
6035 6117
6036void LLAgent::stopCurrentAnimations() 6118void LLAgent::stopCurrentAnimations()
@@ -6666,10 +6748,17 @@ void LLAgent::processAgentInitialWearablesUpdate( LLMessageSystem* mesgsys, void
6666 } 6748 }
6667 6749
6668 // now that we have the asset ids...request the wearable assets 6750 // now that we have the asset ids...request the wearable assets
6751// [RLVa:KB] - Checked: 2009-08-08 (RLVa-1.0.1g) | Added: RLVa-1.0.1g
6752 LLInventoryFetchObserver::item_ref_t rlvItems;
6753// [/RLVa:KB]
6669 for( i = 0; i < WT_COUNT; i++ ) 6754 for( i = 0; i < WT_COUNT; i++ )
6670 { 6755 {
6671 if( !gAgent.mWearableEntry[i].mItemID.isNull() ) 6756 if( !gAgent.mWearableEntry[i].mItemID.isNull() )
6672 { 6757 {
6758// [RLVa:KB] - Checked: 2009-08-08 (RLVa-1.0.1g) | Added: RLVa-1.0.1g
6759 if (rlv_handler_t::isEnabled())
6760 rlvItems.push_back(gAgent.mWearableEntry[i].mItemID);
6761// [/RLVa:KB]
6673 gWearableList.getAsset( 6762 gWearableList.getAsset(
6674 asset_id_array[i], 6763 asset_id_array[i],
6675 LLStringUtil::null, 6764 LLStringUtil::null,
@@ -6677,6 +6766,15 @@ void LLAgent::processAgentInitialWearablesUpdate( LLMessageSystem* mesgsys, void
6677 LLAgent::onInitialWearableAssetArrived, (void*)(intptr_t)i ); 6766 LLAgent::onInitialWearableAssetArrived, (void*)(intptr_t)i );
6678 } 6767 }
6679 } 6768 }
6769
6770// [RLVa:KB] - Checked: 2009-08-08 (RLVa-1.0.1g) | Added: RLVa-1.0.1g
6771 // TODO-RLVa: checking that we're in STATE_STARTED is probably not needed, but leave it until we can be absolutely sure
6772 if ( (rlv_handler_t::isEnabled()) && (LLStartUp::getStartupState() == STATE_STARTED) )
6773 {
6774 RlvCurrentlyWorn f;
6775 f.fetchItems(rlvItems);
6776 }
6777// [/RLVa:KB]
6680 } 6778 }
6681} 6779}
6682 6780
@@ -7174,6 +7272,13 @@ void LLAgent::removeWearable( EWearableType type )
7174 return; 7272 return;
7175 } 7273 }
7176 7274
7275// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-07 (RLVa-1.0.0d)
7276 if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.isRemovable(type)) )
7277 {
7278 return;
7279 }
7280// [/RLVa:KB]
7281
7177 if( old_wearable ) 7282 if( old_wearable )
7178 { 7283 {
7179 if( old_wearable->isDirty() ) 7284 if( old_wearable->isDirty() )
@@ -7296,15 +7401,17 @@ void LLAgent::setWearableOutfit(
7296 wearables_to_remove[WT_SKIN] = FALSE; 7401 wearables_to_remove[WT_SKIN] = FALSE;
7297 wearables_to_remove[WT_HAIR] = FALSE; 7402 wearables_to_remove[WT_HAIR] = FALSE;
7298 wearables_to_remove[WT_EYES] = FALSE; 7403 wearables_to_remove[WT_EYES] = FALSE;
7299 wearables_to_remove[WT_SHIRT] = remove; 7404// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Added: RLVa-0.2.2a
7300 wearables_to_remove[WT_PANTS] = remove; 7405 wearables_to_remove[WT_SHIRT] = remove && gRlvHandler.isRemovable(WT_SHIRT);
7301 wearables_to_remove[WT_SHOES] = remove; 7406 wearables_to_remove[WT_PANTS] = remove && gRlvHandler.isRemovable(WT_PANTS);
7302 wearables_to_remove[WT_SOCKS] = remove; 7407 wearables_to_remove[WT_SHOES] = remove && gRlvHandler.isRemovable(WT_SHOES);
7303 wearables_to_remove[WT_JACKET] = remove; 7408 wearables_to_remove[WT_SOCKS] = remove && gRlvHandler.isRemovable(WT_SOCKS);
7304 wearables_to_remove[WT_GLOVES] = remove; 7409 wearables_to_remove[WT_JACKET] = remove && gRlvHandler.isRemovable(WT_JACKET);
7305 wearables_to_remove[WT_UNDERSHIRT] = (!gAgent.isTeen()) & remove; 7410 wearables_to_remove[WT_GLOVES] = remove && gRlvHandler.isRemovable(WT_GLOVES);
7306 wearables_to_remove[WT_UNDERPANTS] = (!gAgent.isTeen()) & remove; 7411 wearables_to_remove[WT_UNDERSHIRT] = (!gAgent.isTeen()) && remove && gRlvHandler.isRemovable(WT_UNDERSHIRT);
7307 wearables_to_remove[WT_SKIRT] = remove; 7412 wearables_to_remove[WT_UNDERPANTS] = (!gAgent.isTeen()) && remove && gRlvHandler.isRemovable(WT_UNDERPANTS);
7413 wearables_to_remove[WT_SKIRT] = remove && gRlvHandler.isRemovable(WT_SKIRT);
7414// [/RLVa:KB]
7308 7415
7309 S32 count = wearables.count(); 7416 S32 count = wearables.count();
7310 llassert( items.count() == count ); 7417 llassert( items.count() == count );
@@ -7396,6 +7503,15 @@ void LLAgent::setWearable( LLInventoryItem* new_item, LLWearable* new_wearable )
7396 EWearableType type = new_wearable->getType(); 7503 EWearableType type = new_wearable->getType();
7397 7504
7398 LLWearable* old_wearable = mWearableEntry[ type ].mWearable; 7505 LLWearable* old_wearable = mWearableEntry[ type ].mWearable;
7506
7507// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d)
7508 // Block if: we can't wear on that layer; or we're already wearing something there we can't take off
7509 if ( (rlv_handler_t::isEnabled()) && ((!gRlvHandler.isWearable(type)) || ((old_wearable) && (!gRlvHandler.isRemovable(type)))) )
7510 {
7511 return;
7512 }
7513// [/RLVa:KB]
7514
7399 if( old_wearable ) 7515 if( old_wearable )
7400 { 7516 {
7401 const LLUUID& old_item_id = mWearableEntry[ type ].mItemID; 7517 const LLUUID& old_item_id = mWearableEntry[ type ].mItemID;
@@ -7604,10 +7720,13 @@ void LLAgent::userRemoveAllAttachments( void* userdata )
7604 return; 7720 return;
7605 } 7721 }
7606 7722
7607 gMessageSystem->newMessage("ObjectDetach"); 7723// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Added: RLVa-0.2.0c
7608 gMessageSystem->nextBlockFast(_PREHASH_AgentData); 7724 // NOTE-RLVa: This function is called from inside RlvHandler as well, hence the rather heavy modifications
7609 gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); 7725 std::list<U32> rlvAttachments;
7610 gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); 7726 // TODO-RLVa: Once we have the improved "removeWearable" logic implemented we can just get rid of the whole "rlvCompFolders" hassle
7727 #ifdef RLV_EXPERIMENTAL_COMPOSITES
7728 std::list<LLUUID> rlvCompFolders;
7729 #endif // RLV_EXPERIMENTAL_COMPOSITES
7611 7730
7612 for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); 7731 for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin();
7613 iter != avatarp->mAttachmentPoints.end(); ) 7732 iter != avatarp->mAttachmentPoints.end(); )
@@ -7617,11 +7736,78 @@ void LLAgent::userRemoveAllAttachments( void* userdata )
7617 LLViewerObject* objectp = attachment->getObject(); 7736 LLViewerObject* objectp = attachment->getObject();
7618 if (objectp) 7737 if (objectp)
7619 { 7738 {
7739 if (rlv_handler_t::isEnabled())
7740 {
7741 if (!gRlvHandler.isDetachable(curiter->first))
7742 continue;
7743
7744 // Check if we're being called in response to an RLV command (that would be @detach=force)
7745 if ( (gRlvHandler.getCurrentCommand()) && (attachment->getItemID().notNull()) )
7746 {
7747 if (!gRlvHandler.isStrippable(attachment->getItemID())) // "nostrip" can be taken off by the user but not @detach
7748 continue;
7749
7750 #ifdef RLV_EXPERIMENTAL_COMPOSITES
7751 LLViewerInventoryCategory* pFolder;
7752 if (gRlvHandler.getCompositeInfo(attachment->getItemID(), NULL, &pFolder))
7753 {
7754 #ifdef RLV_EXPERIMENTAL_COMPOSITE_LOCKING
7755 if (!gRlvHandler.canTakeOffComposite(pFolder))
7756 continue;
7757 #endif // RLV_EXPERIMENTAL_COMPOSITE_LOCKING
7758
7759 // The attachment belongs to a composite folder so there may be additional things we need to take off
7760 if (std::find(rlvCompFolders.begin(), rlvCompFolders.end(), pFolder->getUUID()) != rlvCompFolders.end())
7761 rlvCompFolders.push_back(pFolder->getUUID());
7762 }
7763 #endif // RLV_EXPERIMENTAL_COMPOSITES
7764 }
7765 }
7766 rlvAttachments.push_back(objectp->getLocalID());
7767 }
7768 }
7769
7770 // Only send the message if we actually have something to detach
7771 if (rlvAttachments.size() > 0)
7772 {
7773 gMessageSystem->newMessage("ObjectDetach");
7774 gMessageSystem->nextBlockFast(_PREHASH_AgentData);
7775 gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
7776 gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
7777
7778 for (std::list<U32>::const_iterator itAttach = rlvAttachments.begin(); itAttach != rlvAttachments.end(); ++itAttach)
7779 {
7620 gMessageSystem->nextBlockFast(_PREHASH_ObjectData); 7780 gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
7621 gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, objectp->getLocalID()); 7781 gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, *itAttach);
7622 } 7782 }
7783
7784 gMessageSystem->sendReliable( gAgent.getRegionHost() );
7623 } 7785 }
7624 gMessageSystem->sendReliable( gAgent.getRegionHost() ); 7786
7787 #ifdef RLV_EXPERIMENTAL_COMPOSITES
7788 if (rlv_handler_t::isEnabled)
7789 {
7790 // If we encountered any composite folders then we need to @detach all of them
7791 for (std::list<LLUUID>::const_iterator itFolder = rlvCompFolders.begin(); itFolder != rlvCompFolders.end(); ++itFolder)
7792 {
7793 std::string strFolder = gRlvHandler.getSharedPath(*itFolder);
7794
7795 // It shouldn't happen but make absolutely sure that we don't issue @detach:=force and reenter this function
7796 if (!strFolder.empty())
7797 {
7798 std::string strCmd = "detach:" + strFolder + "=force";
7799 #ifdef RLV_DEBUG
7800 RLV_INFOS << "\t- detaching composite folder: @" << strCmd << LL_ENDL;
7801 #endif // RLV_DEBUG
7802
7803 // HACK-RLV: executing a command while another command is currently executing isn't the best thing to do, however
7804 // in this specific case it is safe (and still better than making processForceCommand public)
7805 gRlvHandler.processCommand(gRlvHandler.getCurrentObject(), strCmd);
7806 }
7807 }
7808 }
7809 #endif // RLV_EXPERIMENTAL_COMPOSITES
7810// [/RLVa:KB]
7625} 7811}
7626 7812
7627void LLAgent::observeFriends() 7813void LLAgent::observeFriends()