From 9616a43cb00bfd1266064e242fd200de92a02553 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Tue, 26 May 2015 02:50:24 -0400 Subject: [PATCH] [RLVa] Implement core of @camdrawcolor, without actually hooking it up. --- indra/newview/rlvhandler.cpp | 30 +++++++++++++++++++++++++++++- indra/newview/rlvhandler.h | 1 + 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index d4e89945a..a0ea47ebe 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -840,6 +840,19 @@ bool RlvHandler::redirectChatOrEmote(const std::string& strUTF8Text) const return true; } +LLColor3 RlvHandler::camDrawColor() const +{ + LLColor3 ret; + U32 count(0); + for (rlv_exception_map_t::const_iterator i = m_Exceptions.lower_bound(RLV_BHVR_CAMDRAWCOLOR), + end = m_Exceptions.upper_bound(RLV_BHVR_CAMDRAWCOLOR); i != end; ++i, ++count) + ret += boost::get(i->second.varOption); + ret.mV[0]/=count; + ret.mV[1]/=count; + ret.mV[2]/=count; + return ret; +} + F32 RlvHandler::camAvDist() const { F32 ret(F32_MAX); @@ -1335,8 +1348,23 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd) eRet = RLV_RET_FAILED_UNKNOWN; // Singu TODO: Implement break; case RLV_BHVR_CAMDRAWCOLOR: // @camdrawcolor:;;=n|y - Checked: 2015-05-25 (RLVa:LF) - eRet = RLV_RET_FAILED_UNKNOWN; // Singu TODO: Implement + { + LLColor3 color; + if (!strOption.empty()) + { + boost_tokenizer tokens(strOption, boost::char_separator(";", "", boost::keep_empty_tokens)); + boost_tokenizer::const_iterator it = tokens.begin(); + for (U8 i = 0; i < LENGTHOFCOLOR3 && it != tokens.end(); ++it, ++i) + LLStringUtil::convertToF32(*it, color.mV[i]); + color.clamp(); + } + if (RLV_TYPE_ADD == eType) + addException(rlvCmd.getObjectID(), eBhvr, color); + else + removeException(rlvCmd.getObjectID(), eBhvr, color); + eRet = RLV_RET_FAILED_UNKNOWN; // Singu TODO: Hook this up break; + } case RLV_BHVR_CAMAVDIST: // @camavdist:=n|y - Checked: 2015-05-25 (RLVa:LF) { F32 dist; diff --git a/indra/newview/rlvhandler.h b/indra/newview/rlvhandler.h index 97ff955a4..d243e6d8d 100644 --- a/indra/newview/rlvhandler.h +++ b/indra/newview/rlvhandler.h @@ -100,6 +100,7 @@ public: bool canTouch(const LLViewerObject* pObj, const LLVector3& posOffset = LLVector3::zero) const; // @touch bool filterChat(std::string& strUTF8Text, bool fFilterEmote) const; // @sendchat, @recvchat and @redirchat bool redirectChatOrEmote(const std::string& strUTF8Test) const; // @redirchat and @rediremote + LLColor3 camDrawColor() const; // @camdrawcolor F32 camAvDist() const; // @camavdist // Command processing helper functions