diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 967ab90a97e0285a87d7a9f7146d07639c2a4b4d..42a3da88735604fbcdf566c94f4e3c0ebcd4cd02 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -3403,7 +3403,7 @@ void LLAgent::teleportCancel() void LLAgent::teleportViaLocation(const LLVector3d& pos_global) { // [RLVa:KB] - Checked: 2010-03-02 (RLVa-1.2.0c) | Modified: RLVa-1.2.0a - if (rlv_handler_t::isEnabled()) + if ( (rlv_handler_t::isEnabled()) && (!RlvUtil::isForceTp()) ) { // If we're getting teleported due to @tpto we should disregard any @tploc=n or @unsit=n restrictions from the same object if ( (gRlvHandler.hasBehaviourExcept(RLV_BHVR_TPLOC, gRlvHandler.getCurrentObject())) || diff --git a/indra/newview/llagentlistener.cpp b/indra/newview/llagentlistener.cpp index 745b9933da4e9076de8980fe7c87af5b962051d8..66f3853e792d4f5dc36fc85526f1e13ca0ca3f2a 100644 --- a/indra/newview/llagentlistener.cpp +++ b/indra/newview/llagentlistener.cpp @@ -98,6 +98,18 @@ void LLAgentListener::requestSit(LLSD const & event_data) const if (object && object->getPCode() == LL_PCODE_VOLUME) { +// [RLVa:KB] - Checked: 2010-08-29 (RLVa-1.2.1c) | Added: RLVa-1.2.1c + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_STANDTP)) && (isAgentAvatarValid()) ) + { + if (gAgentAvatarp->isSitting()) + { + gAgent.standUp(); + return; + } + gRlvHandler.setSitSource(gAgent.getPositionGlobal()); + } +// [/RLVa:KB] + gMessageSystem->newMessageFast(_PREHASH_AgentRequestSit); gMessageSystem->nextBlockFast(_PREHASH_AgentData); gMessageSystem->addUUIDFast(_PREHASH_AgentID, mAgent.getID()); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 48231c6e660419e0e5c62ff70849f4c3bbfcdf0f..bc8ddaa44eae4f8a8cdd2b088e96e797032f3e37 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -3768,6 +3768,18 @@ void handle_object_sit_or_stand() ((!rlv_handler_t::isEnabled()) || (gRlvHandler.canSit(object, pick.mObjectOffset))) ) // [/RLVa:KB] { +// [RLVa:KB] - Checked: 2010-08-29 (RLVa-1.2.1c) | Added: RLVa-1.2.1c + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_STANDTP)) && (isAgentAvatarValid()) ) + { + if (gAgentAvatarp->isSitting()) + { + gAgent.standUp(); + return; + } + gRlvHandler.setSitSource(gAgent.getPositionGlobal()); + } +// [/RLVa:KB] + gMessageSystem->newMessageFast(_PREHASH_AgentRequestSit); gMessageSystem->nextBlockFast(_PREHASH_AgentData); gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 97916f887377edb7a10d7e340fc4a0d8432a945b..908ef3eaa6089b246898301ff390effe310b34bb 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5753,13 +5753,11 @@ void LLVOAvatar::sitDown(BOOL bSitting) // Update Movement Controls according to own Sitting mode LLFloaterMove::setSittingMode(bSitting); -// [RLVa:KB] - Checked: 2010-04-01 (RLVa-1.2.0c) | Added: RLVa-0.2.1d - #ifdef RLV_EXTENSION_STARTLOCATION +// [RLVa:KB] - Checked: 2010-08-29 (RLVa-1.2.1c) | Modified: RLVa-1.2.1c if (rlv_handler_t::isEnabled()) { - RlvSettings::updateLoginLastLocation(); + gRlvHandler.onSitOrStand(bSitting); } - #endif // RLV_EXTENSION_STARTLOCATION // [/RLVa:KB] } } diff --git a/indra/newview/rlvcommon.cpp b/indra/newview/rlvcommon.cpp index 526005b9075104158ed4aa36ae4cf292bfc9b4f8..4dae07fdf6286002a0996e5a63df530992889170 100644 --- a/indra/newview/rlvcommon.cpp +++ b/indra/newview/rlvcommon.cpp @@ -330,6 +330,8 @@ bool RlvStrings::hasString(const std::string& strStringName) // RlvUtil // +bool RlvUtil::m_fForceTp = false; + // Checked: 2009-07-04 (RLVa-1.0.0a) | Modified: RLVa-1.0.0a void RlvUtil::filterLocation(std::string& strUTF8Text) { @@ -363,6 +365,14 @@ void RlvUtil::filterNames(std::string& strUTF8Text) } } +// Checked: 2010-08-29 (RLVa-1.2.1c) | Added: RLVa-1.2.1c +void RlvUtil::forceTp(const LLVector3d &posDest) +{ + m_fForceTp = true; + gAgent.teleportViaLocation(posDest); + m_fForceTp = false; +} + // Checked: 2010-04-22 (RLVa-1.2.0f) | Modified: RLVa-1.2.0f bool RlvUtil::isNearbyAgent(const LLUUID& idAgent) { diff --git a/indra/newview/rlvcommon.h b/indra/newview/rlvcommon.h index c7295ce1fd900ad5bd383591934383c70b3f603f..a0e99b7154a02adcee4b8d1093576bf762b08d64 100644 --- a/indra/newview/rlvcommon.h +++ b/indra/newview/rlvcommon.h @@ -129,12 +129,18 @@ public: static void filterLocation(std::string& strUTF8Text); // @showloc static void filterNames(std::string& strUTF8Text); // @shownames + static bool isForceTp() { return m_fForceTp; } + static void forceTp(const LLVector3d& posDest); // Ignores restrictions that might otherwise prevent tp'ing + static void notifyFailedAssertion(const char* pstrAssert, const char* pstrFile, int nLine); static void sendBusyMessage(const LLUUID& idTo, const std::string& strMsg, const LLUUID& idSession = LLUUID::null); static bool isValidReplyChannel(S32 nChannel); static bool sendChatReply(S32 nChannel, const std::string& strUTF8Text); static bool sendChatReply(const std::string& strChannel, const std::string& strUTF8Text); + +protected: + static bool m_fForceTp; // @standtp }; // ============================================================================ diff --git a/indra/newview/rlvdefines.h b/indra/newview/rlvdefines.h index 6d5e9ecfc6c349207415cd09f30013e52d07a530..5251252aa030446c4e28b589f7fdb769ab4ba8de 100644 --- a/indra/newview/rlvdefines.h +++ b/indra/newview/rlvdefines.h @@ -177,6 +177,7 @@ enum ERlvBehaviour { RLV_BHVR_UNSIT, // "unsit" RLV_BHVR_SIT, // "sit" RLV_BHVR_SITTP, // "sittp" + RLV_BHVR_STANDTP, // "standtp" RLV_BHVR_SETDEBUG, // "setdebug" RLV_BHVR_SETENV, // "setenv" RLV_BHVR_DETACHME, // "detachme" diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 83d0cf5a6c8e2535a93cc361e6170c4bbcf37b2b..5da6322b3068e107ba1133f29da47edd8cd955ad 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -107,7 +107,7 @@ static bool rlvParseNotifyOption(const std::string& strOption, S32& nChannel, st // // Checked: 2010-04-07 (RLVa-1.2.0d) | Modified: RLVa-1.0.1d -RlvHandler::RlvHandler() : m_fCanCancelTp(true), m_pGCTimer(NULL), m_pWLSnapshot(NULL) +RlvHandler::RlvHandler() : m_fCanCancelTp(true), m_posSitSource(), m_pGCTimer(NULL), m_pWLSnapshot(NULL) { // Array auto-initialization to 0 is non-standard? (Compiler warning in VC-8.0) memset(m_Behaviours, 0, sizeof(S16) * RLV_BHVR_COUNT); @@ -385,6 +385,23 @@ ERlvCmdRet RlvHandler::processClearCommand(const LLUUID& idObj, const RlvCommand // Externally invoked event handlers // +// Checked: 2010-08-29 (RLVa-1.2.1c) | Modified: RLVa-1.2.1c +void RlvHandler::onSitOrStand(bool fSitting) +{ + #ifdef RLV_EXTENSION_STARTLOCATION + if (rlv_handler_t::isEnabled()) + { + RlvSettings::updateLoginLastLocation(); + } + #endif // RLV_EXTENSION_STARTLOCATION + + if ( (hasBehaviour(RLV_BHVR_STANDTP)) && (!fSitting) && (!m_posSitSource.isExactlyZero()) ) + { + RlvUtil::forceTp(m_posSitSource); + m_posSitSource.setZero(); + } +} + // Checked: 2010-03-11 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a void RlvHandler::onAttach(const LLViewerObject* pAttachObj, const LLViewerJointAttachment* pAttachPt) { @@ -1100,6 +1117,7 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const LLUUID& idObj, const RlvComman case RLV_BHVR_SHOWHOVERTEXTHUD: // @showhovertexthud=n|y - Checked: 2010-03-27 (RLVa-1.2.0b) case RLV_BHVR_SHOWHOVERTEXTWORLD: // @showhovertextworld=n|y - Checked: 2010-03-27 (RLVa-1.2.0b) case RLV_BHVR_SHOWHOVERTEXTALL: // @showhovertextall=n|y - Checked: 2010-03-27 (RLVa-1.2.0b) + case RLV_BHVR_STANDTP: // @standtp=n|y - Checked: 2010-08-29 (RLVa-1.2.1c) case RLV_BHVR_TPLM: // @tplm=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h case RLV_BHVR_TPLOC: // @tploc=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h case RLV_BHVR_VIEWNOTE: // @viewnote=n|y - Checked: 2010-03-27 (RLVa-1.2.0b) @@ -1464,6 +1482,12 @@ ERlvCmdRet RlvHandler::onForceSit(const LLUUID& idObj, const RlvCommand& rlvCmd) if (!canSit(pObj)) return RLV_RET_FAILED_LOCK; + else if ( (hasBehaviour(RLV_BHVR_STANDTP)) && (isAgentAvatarValid()) ) + { + if (gAgentAvatarp->isSitting()) + return RLV_RET_FAILED_LOCK; + m_posSitSource = gAgent.getPositionGlobal(); + } // Copy/paste from handle_sit_or_stand() [see http://wiki.secondlife.com/wiki/AgentRequestSit] gMessageSystem->newMessageFast(_PREHASH_AgentRequestSit); diff --git a/indra/newview/rlvhandler.h b/indra/newview/rlvhandler.h index 5f9008a2ca9ce17d7c4bf0f14840acef80073091..d4af20a7c14d6007d26ebec3500225cf5fdc4ab0 100644 --- a/indra/newview/rlvhandler.h +++ b/indra/newview/rlvhandler.h @@ -86,8 +86,10 @@ public: */ public: // Accessors - bool getCanCancelTp() const { return m_fCanCancelTp; } // @accepttp and @tpto - void setCanCancelTp(bool fAllow) { m_fCanCancelTp = fAllow; } // @accepttp and @tpto + bool getCanCancelTp() const { return m_fCanCancelTp; } // @accepttp and @tpto + void setCanCancelTp(bool fAllow) { m_fCanCancelTp = fAllow; } // @accepttp and @tpto + const LLVector3d& getSitSource() const { return m_posSitSource; } // @standtp + void setSitSource(const LLVector3d& posSource) { m_posSitSource = posSource; } // @standtp // Command specific helper functions bool canShowHoverText(LLViewerObject* pObj) const; // @showhovertext* command family @@ -138,6 +140,7 @@ public: void onDetach(const LLViewerObject* pAttachObj, const LLViewerJointAttachment* pAttachPt); bool onGC(); void onLoginComplete(); + void onSitOrStand(bool fSitting); void onTeleportFailed(); void onTeleportFinished(const LLVector3d& posArrival); static void onIdleStartup(void* pParam); @@ -197,7 +200,8 @@ protected: static BOOL m_fEnabled; // Use setEnabled() to toggle this - bool m_fCanCancelTp; + bool m_fCanCancelTp; // @accepttp and @tpto + mutable LLVector3d m_posSitSource; // @standtp (mutable because onForceXXX handles are all declared as const) friend class RlvSharedRootFetcher; // Fetcher needs access to m_fFetchComplete friend class RlvGCTimer; // Timer clear its own point at destruction @@ -241,12 +245,14 @@ inline bool RlvHandler::canSit(LLViewerObject* pObj, const LLVector3& posOffset // The user can sit on the specified object if: // - not prevented from sitting // - not prevented from standing up or not currently sitting + // - not standtp restricted or not currently sitting (if the user is sitting and tried to sit elsewhere the tp would just kick in) // - [regular sit] not @sittp=n or @fartouch=n restricted or if they clicked on a point within 1.5m of the avie's current position // - [force sit] not @sittp=n restricted by a *different* object than the one that issued the command or the object is within 1.5m return ( (pObj) && (LL_PCODE_VOLUME == pObj->getPCode()) ) && (!hasBehaviour(RLV_BHVR_SIT)) && - ( (!hasBehaviour(RLV_BHVR_UNSIT)) || ((isAgentAvatarValid()) && (!gAgentAvatarp->isSitting())) ) && + ( ((!hasBehaviour(RLV_BHVR_UNSIT)) && (!hasBehaviour(RLV_BHVR_STANDTP))) || + ((isAgentAvatarValid()) && (!gAgentAvatarp->isSitting())) ) && ( ((NULL == getCurrentCommand() || (RLV_BHVR_SIT != getCurrentCommand()->getBehaviourType())) ? ((!hasBehaviour(RLV_BHVR_SITTP)) && (!hasBehaviour(RLV_BHVR_FARTOUCH))) // [regular sit] : (!hasBehaviourExcept(RLV_BHVR_SITTP, getCurrentObject()))) || // [force sit] diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp index 3311344f32544f09c6a24f0928a729c190b5fcc0..ec38b3d902933bb908bc43753ed5cacfeba6bcb6 100644 --- a/indra/newview/rlvhelper.cpp +++ b/indra/newview/rlvhelper.cpp @@ -131,10 +131,11 @@ void RlvCommand::initLookupTable() "notify", "showinv", "showminimap", "showworldmap", "showloc", "shownames", "showhovertext", "showhovertexthud", "showhovertextworld", "showhovertextall", "tplm", "tploc", "tplure", "viewnote", "viewscript", "viewtexture", "acceptpermission", "accepttp", "allowidle", "edit", "rez", "fartouch", "interact", "touch", "touchattach", "touchhud", - "touchworld", "fly", "unsit", "sit", "sittp", "setdebug", "setenv", "detachme", "detachthis", "detachall", "detachallthis", - "attachthis", "attachall", "attachallthis", "tpto", "version", "versionnew", "versionnum", "getattach", "getattachnames", - "getaddattachnames", "getremattachnames", "getoutfit", "getoutfitnames", "getaddoutfitnames", "getremoutfitnames", - "findfolder", "findfolders", "getpath", "getpathnew", "getinv", "getinvworn", "getsitid", "getstatus", "getstatusall" + "touchworld", "fly", "unsit", "sit", "sittp", "standtp", "setdebug", "setenv", "detachme", "detachthis", "detachall", + "detachallthis", "attachthis", "attachall", "attachallthis", "tpto", "version", "versionnew", "versionnum", + "getattach", "getattachnames", "getaddattachnames", "getremattachnames", "getoutfit", "getoutfitnames", + "getaddoutfitnames", "getremoutfitnames", "findfolder", "findfolders", "getpath", "getpathnew", "getinv", "getinvworn", + "getsitid", "getstatus", "getstatusall" }; for (int idxBvhr = 0; idxBvhr < RLV_BHVR_COUNT; idxBvhr++)