diff options
Diffstat (limited to 'linden/indra/newview/llagent.cpp')
-rw-r--r-- | linden/indra/newview/llagent.cpp | 119 |
1 files changed, 41 insertions, 78 deletions
diff --git a/linden/indra/newview/llagent.cpp b/linden/indra/newview/llagent.cpp index fc12f33..eb5cf9b 100644 --- a/linden/indra/newview/llagent.cpp +++ b/linden/indra/newview/llagent.cpp | |||
@@ -136,6 +136,10 @@ | |||
136 | #include "llviewerjoystick.h" | 136 | #include "llviewerjoystick.h" |
137 | #include "llfollowcam.h" | 137 | #include "llfollowcam.h" |
138 | 138 | ||
139 | // [RLVa:KB] | ||
140 | #include "rlvhandler.h" | ||
141 | // [/RLVa:KB] | ||
142 | |||
139 | using namespace LLVOAvatarDefines; | 143 | using namespace LLVOAvatarDefines; |
140 | 144 | ||
141 | extern LLMenuBarGL* gMenuBarView; | 145 | extern LLMenuBarGL* gMenuBarView; |
@@ -4878,7 +4882,15 @@ void LLAgent::onAnimStop(const LLUUID& id) | |||
4878 | } | 4882 | } |
4879 | else if (id == ANIM_AGENT_AWAY) | 4883 | else if (id == ANIM_AGENT_AWAY) |
4880 | { | 4884 | { |
4885 | //clearAFK(); | ||
4886 | // [RLVa:KB] - Checked: 2009-10-19 (RLVa-1.1.0g) | Added: RLVa-1.1.0g | ||
4887 | #ifdef RLV_EXTENSION_CMD_ALLOWIDLE | ||
4888 | if (!gRlvHandler.hasBehaviour(RLV_BHVR_ALLOWIDLE)) | ||
4889 | clearAFK(); | ||
4890 | #else | ||
4881 | clearAFK(); | 4891 | clearAFK(); |
4892 | #endif // RLV_EXTENSION_CMD_ALLOWIDLE | ||
4893 | // [/RLVa:KB] | ||
4882 | } | 4894 | } |
4883 | else if (id == ANIM_AGENT_STANDUP) | 4895 | else if (id == ANIM_AGENT_STANDUP) |
4884 | { | 4896 | { |
@@ -5220,7 +5232,7 @@ void LLAgent::buildLocationString(std::string& str) | |||
5220 | // [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) | 5232 | // [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) |
5221 | if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) | 5233 | if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) |
5222 | { | 5234 | { |
5223 | str = rlv_handler_t::cstrHidden; | 5235 | str = RlvStrings::getString(RLV_STRING_HIDDEN); |
5224 | return; | 5236 | return; |
5225 | } | 5237 | } |
5226 | // [/RLVa:KB] | 5238 | // [/RLVa:KB] |
@@ -6223,14 +6235,21 @@ void LLAgent::teleportCancel() | |||
6223 | 6235 | ||
6224 | void LLAgent::teleportViaLocation(const LLVector3d& pos_global) | 6236 | void LLAgent::teleportViaLocation(const LLVector3d& pos_global) |
6225 | { | 6237 | { |
6226 | // [RLVa:KB] - Alternate: Snowglobe-1.0 | Checked: 2009-07-07 (RLVa-1.0.0d) | 6238 | // [RLVa:KB] - Alternate: Snowglobe-1.2.4 | Checked: 2010-03-02 (RLVa-1.1.1a) | Modified: RLVa-1.2.0a |
6227 | // If we're getting teleported due to @tpto we should disregard any @tploc=n or @unsit=n restrictions from the same object | 6239 | if (rlv_handler_t::isEnabled()) |
6228 | if ( (rlv_handler_t::isEnabled()) && | ||
6229 | ( (gRlvHandler.hasBehaviourExcept(RLV_BHVR_TPLOC, gRlvHandler.getCurrentObject())) || | ||
6230 | ( (mAvatarObject.notNull()) && (mAvatarObject->mIsSitting) && | ||
6231 | (gRlvHandler.hasBehaviourExcept(RLV_BHVR_UNSIT, gRlvHandler.getCurrentObject()))) ) ) | ||
6232 | { | 6240 | { |
6233 | return; | 6241 | // If we're getting teleported due to @tpto we should disregard any @tploc=n or @unsit=n restrictions from the same object |
6242 | if ( (gRlvHandler.hasBehaviourExcept(RLV_BHVR_TPLOC, gRlvHandler.getCurrentObject())) || | ||
6243 | ( (mAvatarObject.notNull()) && (mAvatarObject->mIsSitting) && | ||
6244 | (gRlvHandler.hasBehaviourExcept(RLV_BHVR_UNSIT, gRlvHandler.getCurrentObject()))) ) | ||
6245 | { | ||
6246 | return; | ||
6247 | } | ||
6248 | |||
6249 | if ( (gRlvHandler.getCurrentCommand()) && (RLV_BHVR_TPTO == gRlvHandler.getCurrentCommand()->getBehaviourType()) ) | ||
6250 | { | ||
6251 | gRlvHandler.setCanCancelTp(false); | ||
6252 | } | ||
6234 | } | 6253 | } |
6235 | // [/RLVa:KB] | 6254 | // [/RLVa:KB] |
6236 | 6255 | ||
@@ -6300,7 +6319,7 @@ void LLAgent::setTeleportState(ETeleportState state) | |||
6300 | // We're outa here. Save "back" slurl. | 6319 | // We're outa here. Save "back" slurl. |
6301 | mTeleportSourceSLURL = getSLURL(); | 6320 | mTeleportSourceSLURL = getSLURL(); |
6302 | } | 6321 | } |
6303 | // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-07 (RLVa-1.0.0d) | Added: RLVa-0.2.0b | 6322 | // [RLVa:KB] - Alternate: Snowglobe-1.2.4 | Version: 1.23.4 | Checked: 2009-07-07 (RLVa-1.0.0d) | Added: RLVa-0.2.0b |
6304 | if ( (rlv_handler_t::isEnabled()) && (TELEPORT_NONE == mTeleportState) ) | 6323 | if ( (rlv_handler_t::isEnabled()) && (TELEPORT_NONE == mTeleportState) ) |
6305 | { | 6324 | { |
6306 | gRlvHandler.setCanCancelTp(true); | 6325 | gRlvHandler.setCanCancelTp(true); |
@@ -6943,14 +6962,14 @@ void LLAgent::processAgentInitialWearablesUpdate( LLMessageSystem* mesgsys, void | |||
6943 | } | 6962 | } |
6944 | 6963 | ||
6945 | // now that we have the asset ids...request the wearable assets | 6964 | // now that we have the asset ids...request the wearable assets |
6946 | // [RLVa:KB] - Checked: 2009-08-08 (RLVa-1.0.1g) | Added: RLVa-1.0.1g | 6965 | // [RLVa:KB] - Alternate: Snowglobe-1.2.4 | Checked: 2009-08-08 (RLVa-1.0.1g) | Added: RLVa-1.0.1g |
6947 | LLInventoryFetchObserver::item_ref_t rlvItems; | 6966 | LLInventoryFetchObserver::item_ref_t rlvItems; |
6948 | // [/RLVa:KB] | 6967 | // [/RLVa:KB] |
6949 | for( i = 0; i < WT_COUNT; i++ ) | 6968 | for( i = 0; i < WT_COUNT; i++ ) |
6950 | { | 6969 | { |
6951 | if( !gAgent.mWearableEntry[i].mItemID.isNull() ) | 6970 | if( !gAgent.mWearableEntry[i].mItemID.isNull() ) |
6952 | { | 6971 | { |
6953 | // [RLVa:KB] - Checked: 2009-08-08 (RLVa-1.0.1g) | Added: RLVa-1.0.1g | 6972 | // [RLVa:KB] - Alternate: Snowglobe-1.2.4 | Checked: 2009-08-08 (RLVa-1.0.1g) | Added: RLVa-1.0.1g |
6954 | if (rlv_handler_t::isEnabled()) | 6973 | if (rlv_handler_t::isEnabled()) |
6955 | rlvItems.push_back(gAgent.mWearableEntry[i].mItemID); | 6974 | rlvItems.push_back(gAgent.mWearableEntry[i].mItemID); |
6956 | // [/RLVa:KB] | 6975 | // [/RLVa:KB] |
@@ -6962,7 +6981,7 @@ void LLAgent::processAgentInitialWearablesUpdate( LLMessageSystem* mesgsys, void | |||
6962 | } | 6981 | } |
6963 | } | 6982 | } |
6964 | 6983 | ||
6965 | // [RLVa:KB] - Checked: 2009-08-08 (RLVa-1.0.1g) | Added: RLVa-1.0.1g | 6984 | // [RLVa:KB] - Alternate: Snowglobe-1.2.4 | Checked: 2009-08-08 (RLVa-1.0.1g) | Added: RLVa-1.0.1g |
6966 | // TODO-RLVa: checking that we're in STATE_STARTED is probably not needed, but leave it until we can be absolutely sure | 6985 | // TODO-RLVa: checking that we're in STATE_STARTED is probably not needed, but leave it until we can be absolutely sure |
6967 | if ( (rlv_handler_t::isEnabled()) && (LLStartUp::getStartupState() == STATE_STARTED) ) | 6986 | if ( (rlv_handler_t::isEnabled()) && (LLStartUp::getStartupState() == STATE_STARTED) ) |
6968 | { | 6987 | { |
@@ -7949,93 +7968,37 @@ void LLAgent::userRemoveAllAttachments( void* userdata ) | |||
7949 | return; | 7968 | return; |
7950 | } | 7969 | } |
7951 | 7970 | ||
7952 | // [RLVa:KB] - Checked: 2009-10-10 (RLVa-1.0.5a) | Modified: RLVa-1.0.5a | 7971 | // [RLVa:KB] - Checked: 2009-11-24 (RLVa-1.1.0f) | Modified: RLVa-1.1.0e |
7953 | // NOTE-RLVa: This function is called from inside RlvHandler as well, hence the rather heavy modifications | 7972 | std::list<U32> LocalIDs; |
7954 | std::list<U32> rlvAttachments; | 7973 | for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); iter != avatarp->mAttachmentPoints.end(); ) |
7955 | // TODO-RLVa: Once we have the improved "removeWearable" logic implemented we can just get rid of the whole "rlvCompFolders" hassle | ||
7956 | #ifdef RLV_EXPERIMENTAL_COMPOSITES | ||
7957 | std::list<LLUUID> rlvCompFolders; | ||
7958 | #endif // RLV_EXPERIMENTAL_COMPOSITES | ||
7959 | |||
7960 | for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); | ||
7961 | iter != avatarp->mAttachmentPoints.end(); ) | ||
7962 | { | 7974 | { |
7963 | LLVOAvatar::attachment_map_t::iterator curiter = iter++; | 7975 | LLVOAvatar::attachment_map_t::iterator curiter = iter++; |
7964 | LLViewerJointAttachment* attachment = curiter->second; | 7976 | LLViewerJointAttachment* attachment = curiter->second; |
7965 | LLViewerObject* objectp = attachment->getObject(); | 7977 | LLViewerObject* objectp = attachment->getObject(); |
7966 | if (objectp) | 7978 | if (objectp) |
7967 | { | 7979 | { |
7968 | if (rlv_handler_t::isEnabled()) | 7980 | if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.isLockedAttachment(curiter->first, RLV_LOCK_REMOVE)) ) |
7969 | { | 7981 | continue; |
7970 | if (gRlvHandler.isLockedAttachment(curiter->first, RLV_LOCK_REMOVE)) | 7982 | LocalIDs.push_back(objectp->getLocalID()); |
7971 | continue; | ||
7972 | |||
7973 | // Check if we're being called in response to an RLV command (that would be @detach=force) | ||
7974 | if ( (gRlvHandler.getCurrentCommand()) && (attachment->getItemID().notNull()) ) | ||
7975 | { | ||
7976 | if (!gRlvHandler.isStrippable(attachment->getItemID())) // "nostrip" can be taken off by the user but not @detach | ||
7977 | continue; | ||
7978 | |||
7979 | #ifdef RLV_EXPERIMENTAL_COMPOSITES | ||
7980 | LLViewerInventoryCategory* pFolder; | ||
7981 | if (gRlvHandler.getCompositeInfo(attachment->getItemID(), NULL, &pFolder)) | ||
7982 | { | ||
7983 | #ifdef RLV_EXPERIMENTAL_COMPOSITE_LOCKING | ||
7984 | if (!gRlvHandler.canTakeOffComposite(pFolder)) | ||
7985 | continue; | ||
7986 | #endif // RLV_EXPERIMENTAL_COMPOSITE_LOCKING | ||
7987 | |||
7988 | // The attachment belongs to a composite folder so there may be additional things we need to take off | ||
7989 | if (std::find(rlvCompFolders.begin(), rlvCompFolders.end(), pFolder->getUUID()) != rlvCompFolders.end()) | ||
7990 | rlvCompFolders.push_back(pFolder->getUUID()); | ||
7991 | } | ||
7992 | #endif // RLV_EXPERIMENTAL_COMPOSITES | ||
7993 | } | ||
7994 | } | ||
7995 | rlvAttachments.push_back(objectp->getLocalID()); | ||
7996 | } | 7983 | } |
7997 | } | 7984 | } |
7998 | 7985 | ||
7999 | // Only send the message if we actually have something to detach | 7986 | // Only send the message if we actually have something to detach |
8000 | if (rlvAttachments.size() > 0) | 7987 | if (LocalIDs.size() > 0) |
8001 | { | 7988 | { |
8002 | gMessageSystem->newMessage("ObjectDetach"); | 7989 | gMessageSystem->newMessage("ObjectDetach"); |
8003 | gMessageSystem->nextBlockFast(_PREHASH_AgentData); | 7990 | gMessageSystem->nextBlockFast(_PREHASH_AgentData); |
8004 | gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); | 7991 | gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); |
8005 | gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); | 7992 | gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); |
8006 | 7993 | ||
8007 | for (std::list<U32>::const_iterator itAttach = rlvAttachments.begin(); itAttach != rlvAttachments.end(); ++itAttach) | 7994 | for (std::list<U32>::const_iterator itLocalID = LocalIDs.begin(); itLocalID != LocalIDs.end(); ++itLocalID) |
8008 | { | 7995 | { |
8009 | gMessageSystem->nextBlockFast(_PREHASH_ObjectData); | 7996 | gMessageSystem->nextBlockFast(_PREHASH_ObjectData); |
8010 | gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, *itAttach); | 7997 | gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, *itLocalID); |
8011 | } | 7998 | } |
8012 | 7999 | ||
8013 | gMessageSystem->sendReliable( gAgent.getRegionHost() ); | 8000 | gMessageSystem->sendReliable(gAgent.getRegionHost()); |
8014 | } | 8001 | } |
8015 | |||
8016 | #ifdef RLV_EXPERIMENTAL_COMPOSITES | ||
8017 | if (rlv_handler_t::isEnabled) | ||
8018 | { | ||
8019 | // If we encountered any composite folders then we need to @detach all of them | ||
8020 | for (std::list<LLUUID>::const_iterator itFolder = rlvCompFolders.begin(); itFolder != rlvCompFolders.end(); ++itFolder) | ||
8021 | { | ||
8022 | std::string strFolder = gRlvHandler.getSharedPath(*itFolder); | ||
8023 | |||
8024 | // It shouldn't happen but make absolutely sure that we don't issue @detach:=force and reenter this function | ||
8025 | if (!strFolder.empty()) | ||
8026 | { | ||
8027 | std::string strCmd = "detach:" + strFolder + "=force"; | ||
8028 | #ifdef RLV_DEBUG | ||
8029 | RLV_INFOS << "\t- detaching composite folder: @" << strCmd << LL_ENDL; | ||
8030 | #endif // RLV_DEBUG | ||
8031 | |||
8032 | // HACK-RLV: executing a command while another command is currently executing isn't the best thing to do, however | ||
8033 | // in this specific case it is safe (and still better than making processForceCommand public) | ||
8034 | gRlvHandler.processCommand(gRlvHandler.getCurrentObject(), strCmd); | ||
8035 | } | ||
8036 | } | ||
8037 | } | ||
8038 | #endif // RLV_EXPERIMENTAL_COMPOSITES | ||
8039 | // [/RLVa:KB] | 8002 | // [/RLVa:KB] |
8040 | } | 8003 | } |
8041 | 8004 | ||