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