aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/rlvextensions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/rlvextensions.cpp')
-rw-r--r--linden/indra/newview/rlvextensions.cpp109
1 files changed, 77 insertions, 32 deletions
diff --git a/linden/indra/newview/rlvextensions.cpp b/linden/indra/newview/rlvextensions.cpp
index f31c62e..c20c077 100644
--- a/linden/indra/newview/rlvextensions.cpp
+++ b/linden/indra/newview/rlvextensions.cpp
@@ -1,3 +1,19 @@
1/**
2 *
3 * Copyright (c) 2009-2010, Kitty Barnett
4 *
5 * The source code in this file is provided to you under the terms of the
6 * GNU General Public License, version 2.0, but WITHOUT ANY WARRANTY;
7 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
8 * PARTICULAR PURPOSE. Terms of the GPL can be found in doc/GPL-license.txt
9 * in this distribution, or online at http://www.gnu.org/licenses/gpl-2.0.txt
10 *
11 * By copying, modifying or distributing this software, you acknowledge that
12 * you have read and understood your obligations described above, and agree to
13 * abide by those obligations.
14 *
15 */
16
1#include "llviewerprecompiledheaders.h" 17#include "llviewerprecompiledheaders.h"
2#include "llagent.h" 18#include "llagent.h"
3#include "llfloaterwindlight.h" 19#include "llfloaterwindlight.h"
@@ -38,19 +54,19 @@ RlvExtGetSet::RlvExtGetSet()
38} 54}
39 55
40// Checked: 2009-05-17 (RLVa-0.2.0a) 56// Checked: 2009-05-17 (RLVa-0.2.0a)
41BOOL RlvExtGetSet::onForceCommand(const RlvEvent& rlvEvent) 57bool RlvExtGetSet::onForceCommand(const LLUUID& idObj, const RlvCommand& rlvCmd, ERlvCmdRet& cmdRet)
42{ 58{
43 return processCommand(rlvEvent.getSenderID(), rlvEvent.getCommand()); 59 return processCommand(idObj, rlvCmd, cmdRet);
44} 60}
45 61
46// Checked: 2009-05-17 (RLVa-0.2.0a) 62// Checked: 2009-05-17 (RLVa-0.2.0a)
47BOOL RlvExtGetSet::onReplyCommand(const EventType& rlvEvent) 63bool RlvExtGetSet::onReplyCommand(const LLUUID& idObj, const RlvCommand& rlvCmd, ERlvCmdRet& cmdRet)
48{ 64{
49 return processCommand(rlvEvent.getSenderID(), rlvEvent.getCommand()); 65 return processCommand(idObj, rlvCmd, cmdRet);
50} 66}
51 67
52// Checked: 2009-06-18 (RLVa-0.2.1d) | Modified: RLVa-0.2.1d 68// Checked: 2009-12-23 (RLVa-1.1.0k) | Modified: RLVa-1.1.0k
53BOOL RlvExtGetSet::processCommand(const LLUUID& idObj, const RlvCommand& rlvCmd) 69bool RlvExtGetSet::processCommand(const LLUUID& idObj, const RlvCommand& rlvCmd, ERlvCmdRet& eRet)
54{ 70{
55 std::string strBehaviour = rlvCmd.getBehaviour(), strGetSet, strSetting; 71 std::string strBehaviour = rlvCmd.getBehaviour(), strGetSet, strSetting;
56 int idxSetting = strBehaviour.find('_'); 72 int idxSetting = strBehaviour.find('_');
@@ -67,13 +83,14 @@ BOOL RlvExtGetSet::processCommand(const LLUUID& idObj, const RlvCommand& rlvCmd)
67 if ( ("get" == strGetSet) && (RLV_TYPE_REPLY == rlvCmd.getParamType()) ) 83 if ( ("get" == strGetSet) && (RLV_TYPE_REPLY == rlvCmd.getParamType()) )
68 { 84 {
69 rlvSendChatReply(rlvCmd.getParam(), onGetDebug(strSetting)); 85 rlvSendChatReply(rlvCmd.getParam(), onGetDebug(strSetting));
70 return TRUE; 86 eRet = RLV_RET_SUCCESS;
87 return true;
71 } 88 }
72 else if ( ("set" == strGetSet) && (RLV_TYPE_FORCE == rlvCmd.getParamType()) ) 89 else if ( ("set" == strGetSet) && (RLV_TYPE_FORCE == rlvCmd.getParamType()) )
73 { 90 {
74 if (!gRlvHandler.hasBehaviourExcept(RLV_BHVR_SETDEBUG, idObj)) 91 if (!gRlvHandler.hasBehaviourExcept(RLV_BHVR_SETDEBUG, idObj))
75 onSetDebug(strSetting, rlvCmd.getOption()); 92 eRet = onSetDebug(strSetting, rlvCmd.getOption());
76 return TRUE; 93 return true;
77 } 94 }
78 } 95 }
79 else if ("env" == strBehaviour) 96 else if ("env" == strBehaviour)
@@ -81,13 +98,14 @@ BOOL RlvExtGetSet::processCommand(const LLUUID& idObj, const RlvCommand& rlvCmd)
81 if ( ("get" == strGetSet) && (RLV_TYPE_REPLY == rlvCmd.getParamType()) ) 98 if ( ("get" == strGetSet) && (RLV_TYPE_REPLY == rlvCmd.getParamType()) )
82 { 99 {
83 rlvSendChatReply(rlvCmd.getParam(), onGetEnv(strSetting)); 100 rlvSendChatReply(rlvCmd.getParam(), onGetEnv(strSetting));
84 return TRUE; 101 eRet = RLV_RET_SUCCESS;
102 return true;
85 } 103 }
86 else if ( ("set" == strGetSet) && (RLV_TYPE_FORCE == rlvCmd.getParamType()) ) 104 else if ( ("set" == strGetSet) && (RLV_TYPE_FORCE == rlvCmd.getParamType()) )
87 { 105 {
88 if (!gRlvHandler.hasBehaviourExcept(RLV_BHVR_SETENV, idObj)) 106 if (!gRlvHandler.hasBehaviourExcept(RLV_BHVR_SETENV, idObj))
89 onSetEnv(strSetting, rlvCmd.getOption()); 107 eRet = onSetEnv(strSetting, rlvCmd.getOption());
90 return TRUE; 108 return true;
91 } 109 }
92 } 110 }
93 } 111 }
@@ -97,7 +115,7 @@ BOOL RlvExtGetSet::processCommand(const LLUUID& idObj, const RlvCommand& rlvCmd)
97 F32 nAngle = 0.0f; 115 F32 nAngle = 0.0f;
98 if (LLStringUtil::convertToF32(rlvCmd.getOption(), nAngle)) 116 if (LLStringUtil::convertToF32(rlvCmd.getOption(), nAngle))
99 { 117 {
100 nAngle += RLV_SETROT_OFFSET; 118 nAngle = RLV_SETROT_OFFSET - nAngle;
101 119
102 gAgent.startCameraAnimation(); 120 gAgent.startCameraAnimation();
103 121
@@ -106,10 +124,13 @@ BOOL RlvExtGetSet::processCommand(const LLUUID& idObj, const RlvCommand& rlvCmd)
106 at.normalize(); 124 at.normalize();
107 gAgent.resetAxes(at); 125 gAgent.resetAxes(at);
108 126
109 return TRUE; 127 eRet = RLV_RET_SUCCESS;
110 } 128 }
129 else
130 eRet = RLV_RET_FAILED_OPTION;
131 return true;
111 } 132 }
112 return FALSE; 133 return false;
113} 134}
114 135
115// Checked: 2009-06-03 (RLVa-0.2.0h) | Modified: RLVa-0.2.0h 136// Checked: 2009-06-03 (RLVa-0.2.0h) | Modified: RLVa-0.2.0h
@@ -117,6 +138,10 @@ bool RlvExtGetSet::findDebugSetting(std::string& strSetting, S16& flags)
117{ 138{
118 LLStringUtil::toLower(strSetting); // Convenience for non-RLV calls 139 LLStringUtil::toLower(strSetting); // Convenience for non-RLV calls
119 140
141 // HACK-RLVa: bad code but it's just a temporary measure to provide a smooth changeover from the old to the new rebranded settings
142 if ( (strSetting.length() >= 14) && (0 == strSetting.find("restrainedlife")) )
143 strSetting = "restrainedlove" + strSetting.substr(14);
144
120 std::string strTemp; 145 std::string strTemp;
121 for (std::map<std::string, S16>::const_iterator itSetting = m_DbgAllowed.begin(); itSetting != m_DbgAllowed.end(); ++itSetting) 146 for (std::map<std::string, S16>::const_iterator itSetting = m_DbgAllowed.begin(); itSetting != m_DbgAllowed.end(); ++itSetting)
122 { 147 {
@@ -194,11 +219,12 @@ std::string RlvExtGetSet::onGetPseudoDebug(const std::string& strSetting)
194} 219}
195 220
196// Checked: 2009-10-10 (RLVa-1.0.4e) | Modified: RLVa-1.0.4e 221// Checked: 2009-10-10 (RLVa-1.0.4e) | Modified: RLVa-1.0.4e
197void RlvExtGetSet::onSetDebug(std::string strSetting, const std::string& strValue) 222ERlvCmdRet RlvExtGetSet::onSetDebug(std::string strSetting, const std::string& strValue)
198{ 223{
199 S16 dbgFlags; 224 S16 dbgFlags; ERlvCmdRet eRet = RLV_RET_FAILED_UNKNOWN;
200 if ( (findDebugSetting(strSetting, dbgFlags)) && ((dbgFlags & DBG_WRITE) == DBG_WRITE) ) 225 if ( (findDebugSetting(strSetting, dbgFlags)) && ((dbgFlags & DBG_WRITE) == DBG_WRITE) )
201 { 226 {
227 eRet = RLV_RET_FAILED_OPTION;
202 if ((dbgFlags & DBG_PSEUDO) == 0) 228 if ((dbgFlags & DBG_PSEUDO) == 0)
203 { 229 {
204 LLControlVariable* pSetting = gSavedSettings.getControl(strSetting); 230 LLControlVariable* pSetting = gSavedSettings.getControl(strSetting);
@@ -209,18 +235,28 @@ void RlvExtGetSet::onSetDebug(std::string strSetting, const std::string& strValu
209 { 235 {
210 case TYPE_U32: 236 case TYPE_U32:
211 if (LLStringUtil::convertToU32(strValue, u32Value)) 237 if (LLStringUtil::convertToU32(strValue, u32Value))
238 {
212 gSavedSettings.setU32(strSetting, u32Value); 239 gSavedSettings.setU32(strSetting, u32Value);
240 eRet = RLV_RET_SUCCESS;
241 }
213 break; 242 break;
214 case TYPE_S32: 243 case TYPE_S32:
215 if (LLStringUtil::convertToS32(strValue, s32Value)) 244 if (LLStringUtil::convertToS32(strValue, s32Value))
245 {
216 gSavedSettings.setS32(strSetting, s32Value); 246 gSavedSettings.setS32(strSetting, s32Value);
247 eRet = RLV_RET_SUCCESS;
248 }
217 break; 249 break;
218 case TYPE_BOOLEAN: 250 case TYPE_BOOLEAN:
219 if (LLStringUtil::convertToBOOL(strValue, fValue)) 251 if (LLStringUtil::convertToBOOL(strValue, fValue))
252 {
220 gSavedSettings.setBOOL(strSetting, fValue); 253 gSavedSettings.setBOOL(strSetting, fValue);
254 eRet = RLV_RET_SUCCESS;
255 }
221 break; 256 break;
222 default: 257 default:
223 RLV_ERRS << "Unexpected debug setting type" << LL_ENDL; 258 RLV_ERRS << "Unexpected debug setting type" << LL_ENDL;
259 eRet = RLV_RET_FAILED;
224 break; 260 break;
225 } 261 }
226 262
@@ -230,20 +266,26 @@ void RlvExtGetSet::onSetDebug(std::string strSetting, const std::string& strValu
230 } 266 }
231 else 267 else
232 { 268 {
233 onSetPseudoDebug(strSetting, strValue); 269 eRet = onSetPseudoDebug(strSetting, strValue);
234 } 270 }
235 } 271 }
272 return eRet;
236} 273}
237 274
238// Checked: 2009-10-10 (RLVa-1.0.4e) | Modified: RLVa-1.0.4e 275// Checked: 2009-10-10 (RLVa-1.0.4e) | Modified: RLVa-1.0.4e
239void RlvExtGetSet::onSetPseudoDebug(const std::string& strSetting, const std::string& strValue) 276ERlvCmdRet RlvExtGetSet::onSetPseudoDebug(const std::string& strSetting, const std::string& strValue)
240{ 277{
278 ERlvCmdRet eRet = RLV_RET_FAILED_OPTION;
241 if ("AvatarSex" == strSetting) 279 if ("AvatarSex" == strSetting)
242 { 280 {
243 BOOL fValue; 281 BOOL fValue;
244 if (LLStringUtil::convertToBOOL(strValue, fValue)) 282 if (LLStringUtil::convertToBOOL(strValue, fValue))
283 {
245 m_PseudoDebug[strSetting] = strValue; 284 m_PseudoDebug[strSetting] = strValue;
285 eRet = RLV_RET_SUCCESS;
286 }
246 } 287 }
288 return eRet;
247} 289}
248 290
249// Checked: 2009-09-16 (RLVa-1.0.3c) | Modified: RLVa-1.0.3c 291// Checked: 2009-09-16 (RLVa-1.0.3c) | Modified: RLVa-1.0.3c
@@ -322,7 +364,7 @@ std::string RlvExtGetSet::onGetEnv(std::string strSetting)
322} 364}
323 365
324// Checked: 2009-09-16 (RLVa-1.0.3c) | Modified: RLVa-1.0.3c 366// Checked: 2009-09-16 (RLVa-1.0.3c) | Modified: RLVa-1.0.3c
325void RlvExtGetSet::onSetEnv(std::string strSetting, const std::string& strValue) 367ERlvCmdRet RlvExtGetSet::onSetEnv(std::string strSetting, const std::string& strValue)
326{ 368{
327 // HACK: see RlvExtGetSet::onGetEnv 369 // HACK: see RlvExtGetSet::onGetEnv
328 if (!LLFloaterWindLight::isOpen()) 370 if (!LLFloaterWindLight::isOpen())
@@ -337,8 +379,8 @@ void RlvExtGetSet::onSetEnv(std::string strSetting, const std::string& strValue)
337 379
338 F32 nValue = 0.0f; 380 F32 nValue = 0.0f;
339 // Sanity check - make sure strValue specifies a number for all settings except "preset" 381 // Sanity check - make sure strValue specifies a number for all settings except "preset"
340 if ( (rlv_handler_t::fNoSetEnv) || ( (!LLStringUtil::convertToF32(strValue, nValue)) && ("preset" != strSetting) )) 382 if ( (RlvSettings::getNoSetEnv()) || ( (!LLStringUtil::convertToF32(strValue, nValue)) && ("preset" != strSetting) ))
341 return; 383 return RLV_RET_FAILED_OPTION;
342 384
343 // Not quite correct, but RLV-1.16.0 will halt the default daytime cycle on invalid commands so we need to as well 385 // Not quite correct, but RLV-1.16.0 will halt the default daytime cycle on invalid commands so we need to as well
344 pWLParams->mAnimator.mIsRunning = false; 386 pWLParams->mAnimator.mIsRunning = false;
@@ -357,19 +399,19 @@ void RlvExtGetSet::onSetEnv(std::string strSetting, const std::string& strValue)
357 pWLParams->mAnimator.mIsRunning = true; 399 pWLParams->mAnimator.mIsRunning = true;
358 pWLParams->mAnimator.mUseLindenTime = true; 400 pWLParams->mAnimator.mUseLindenTime = true;
359 } 401 }
360 return; 402 return RLV_RET_SUCCESS;
361 } 403 }
362 // See LLFloaterWindLight::onChangePresetName() 404 // See LLFloaterWindLight::onChangePresetName()
363 else if ("preset" == strSetting) 405 else if ("preset" == strSetting)
364 { 406 {
365 pWLParams->loadPreset(strValue, true); 407 pWLParams->loadPreset(strValue, true);
366 return; 408 return RLV_RET_SUCCESS;
367 } 409 }
368 // See LLFloaterWindLight::onStarAlphaMoved 410 // See LLFloaterWindLight::onStarAlphaMoved
369 else if ("starbrightness" == strSetting) 411 else if ("starbrightness" == strSetting)
370 { 412 {
371 pWLParams->mCurParams.setStarBrightness(nValue); 413 pWLParams->mCurParams.setStarBrightness(nValue);
372 return; 414 return RLV_RET_SUCCESS;
373 } 415 }
374 // See LLFloaterWindLight::onGlowRMoved() / LLFloaterWindLight::onGlowBMoved() 416 // See LLFloaterWindLight::onGlowRMoved() / LLFloaterWindLight::onGlowBMoved()
375 else if ( ("sunglowfocus" == strSetting) || ("sunglowsize" == strSetting) ) 417 else if ( ("sunglowfocus" == strSetting) || ("sunglowsize" == strSetting) )
@@ -382,7 +424,7 @@ void RlvExtGetSet::onSetEnv(std::string strSetting, const std::string& strValue)
382 424
383 pColour->update(pWLParams->mCurParams); 425 pColour->update(pWLParams->mCurParams);
384 pWLParams->propagateParameters(); 426 pWLParams->propagateParameters();
385 return; 427 return RLV_RET_SUCCESS;
386 } 428 }
387 // See LLFloaterWindLight::onSunMoved() 429 // See LLFloaterWindLight::onSunMoved()
388 else if ( ("eastangle" == strSetting) || ("sunmoonposition" == strSetting) ) 430 else if ( ("eastangle" == strSetting) || ("sunmoonposition" == strSetting) )
@@ -401,18 +443,18 @@ void RlvExtGetSet::onSetEnv(std::string strSetting, const std::string& strValue)
401 443
402 pColour->update(pWLParams->mCurParams); 444 pColour->update(pWLParams->mCurParams);
403 pWLParams->propagateParameters(); 445 pWLParams->propagateParameters();
404 return; 446 return RLV_RET_SUCCESS;
405 } 447 }
406 // See LLFloaterWindLight::onCloudScrollXMoved() / LLFloaterWindLight::onCloudScrollYMoved() 448 // See LLFloaterWindLight::onCloudScrollXMoved() / LLFloaterWindLight::onCloudScrollYMoved()
407 else if ("cloudscrollx" == strSetting) 449 else if ("cloudscrollx" == strSetting)
408 { 450 {
409 pWLParams->mCurParams.setCloudScrollX(nValue + 10.0f); 451 pWLParams->mCurParams.setCloudScrollX(nValue + 10.0f);
410 return; 452 return RLV_RET_SUCCESS;
411 } 453 }
412 else if ("cloudscrolly" == strSetting) 454 else if ("cloudscrolly" == strSetting)
413 { 455 {
414 pWLParams->mCurParams.setCloudScrollY(nValue + 10.0f); 456 pWLParams->mCurParams.setCloudScrollY(nValue + 10.0f);
415 return; 457 return RLV_RET_SUCCESS;
416 } 458 }
417 // See LLFloaterWindLight::onFloatControlMoved() 459 // See LLFloaterWindLight::onFloatControlMoved()
418 else if ("cloudcoverage" == strSetting) pFloat = &pWLParams->mCloudCoverage; 460 else if ("cloudcoverage" == strSetting) pFloat = &pWLParams->mCloudCoverage;
@@ -430,14 +472,14 @@ void RlvExtGetSet::onSetEnv(std::string strSetting, const std::string& strValue)
430 pFloat->x = nValue / pFloat->mult; 472 pFloat->x = nValue / pFloat->mult;
431 pFloat->update(pWLParams->mCurParams); 473 pFloat->update(pWLParams->mCurParams);
432 pWLParams->propagateParameters(); 474 pWLParams->propagateParameters();
433 return; 475 return RLV_RET_SUCCESS;
434 } 476 }
435 else if (pColour) 477 else if (pColour)
436 { 478 {
437 pColour->r = nValue; 479 pColour->r = nValue;
438 pColour->update(pWLParams->mCurParams); 480 pColour->update(pWLParams->mCurParams);
439 pWLParams->propagateParameters(); 481 pWLParams->propagateParameters();
440 return; 482 return RLV_RET_SUCCESS;
441 } 483 }
442 484
443 // RGBI settings 485 // RGBI settings
@@ -466,7 +508,7 @@ void RlvExtGetSet::onSetEnv(std::string strSetting, const std::string& strValue)
466 if ('i' == ch) // (See: LLFloaterWindLight::onColorControlIMoved) 508 if ('i' == ch) // (See: LLFloaterWindLight::onColorControlIMoved)
467 { 509 {
468 if (!pColour->hasSliderName) 510 if (!pColour->hasSliderName)
469 return; 511 return RLV_RET_FAILED_UNKNOWN;
470 512
471 F32 curMax = llmax(pColour->r, pColour->g, pColour->b); 513 F32 curMax = llmax(pColour->r, pColour->g, pColour->b);
472 if ( (0.0f == nValue) || (0.0f == curMax) ) 514 if ( (0.0f == nValue) || (0.0f == curMax) )
@@ -490,8 +532,11 @@ void RlvExtGetSet::onSetEnv(std::string strSetting, const std::string& strValue)
490 532
491 pColour->update(pWLParams->mCurParams); 533 pColour->update(pWLParams->mCurParams);
492 pWLParams->propagateParameters(); 534 pWLParams->propagateParameters();
535
536 return RLV_RET_SUCCESS;
493 } 537 }
494 } 538 }
539 return RLV_RET_FAILED_UNKNOWN;
495} 540}
496 541
497// ============================================================================ 542// ============================================================================