[RLVa] Fix things that weren't working (new commands with params)

Code cleanup, better word a comment or two
Don't claim to support camdraw* or camtextures commands until we actually do
This commit is contained in:
Inusaito Sayori
2015-06-04 09:35:59 -04:00
parent e7a0867cf3
commit 63b67d62ef
3 changed files with 45 additions and 63 deletions

View File

@@ -22,7 +22,6 @@
#include "llgroupactions.h"
#include "llhudtext.h"
#include "llstartup.h"
#include "llviewercamera.h"
#include "llviewermessage.h"
#include "llviewerobjectlist.h"
#include "llviewerparcelmgr.h"
@@ -1327,67 +1326,24 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd)
break;
case RLV_BHVR_CAMZOOMMAX: // @camzoommax:<max_multiplier>=n|y - Checked: 2015-05-25 (RLVa:LF)
case RLV_BHVR_CAMZOOMMIN: // @camzoommin:<min_multiplier>=n|y - Checked: 2015-05-25 (RLVa:LF)
{
F32 zoom;
LLStringUtil::convertToF32(strOption, zoom);
if (RLV_TYPE_ADD == eType)
addException(rlvCmd.getObjectID(), eBhvr, zoom);
else
removeException(rlvCmd.getObjectID(), eBhvr, zoom);
updatePole(eBhvr, eBhvr == RLV_BHVR_CAMDISTMAX);
if (hasBehaviour(eBhvr))
{
LLViewerCamera& inst(LLViewerCamera::instance());
inst.mSavedFOVLoaded ? inst.loadDefaultFOV() : inst.setDefaultFOV(gSavedSettings.getF32("CameraAngle"));
}
break;
}
case RLV_BHVR_CAMDISTMAX: // @camdistmax:<max_distance>=n|y - Checked: 2015-05-25 (RLVa:LF)
case RLV_BHVR_CAMDISTMIN: // @camdistmin:<min_distance>=n|y - Checked: 2015-05-25 (RLVa:LF)
{
F32 zoom;
LLStringUtil::convertToF32(strOption, zoom);
if (RLV_TYPE_ADD == eType)
addException(rlvCmd.getObjectID(), eBhvr, zoom);
else
removeException(rlvCmd.getObjectID(), eBhvr, zoom);
updatePole(eBhvr, eBhvr == RLV_BHVR_CAMDISTMAX);
if (hasBehaviour(eBhvr))
{
if (eBhvr == RLV_BHVR_CAMDISTMAX && zoom <= 0)
{
if (!gAgentCamera.cameraMouselook())
gAgentCamera.changeCameraToMouselook();
}
else
{
if (eBhvr == RLV_BHVR_CAMDISTMIN && zoom > 0 && gAgentCamera.cameraMouselook())
gAgentCamera.changeCameraToDefault();
gAgentCamera.cameraPanUp(0); // Hacky, but meh.
}
}
break;
}
case RLV_BHVR_CAMDRAWMAX: // @camdrawmax:<max_distance>=n|y - Checked: 2015-05-25 (RLVa:LF)
case RLV_BHVR_CAMDRAWMIN: // @camdrawmin:<min_distance>=n|y - Checked: 2015-05-25 (RLVa:LF)
case RLV_BHVR_CAMDRAWALPHAMAX: // @camdrawalphamax:<max_alpha>=n|y - Checked: 2015-05-25 (RLVa:LF)
case RLV_BHVR_CAMDRAWALPHAMIN: // @camdrawalphamin:<min_alpha>=n|y - Checked: 2015-05-25 (RLVa:LF)
case RLV_BHVR_CAMAVDIST: // @camavdist:<distance>=n|y - Checked: 2015-05-25 (RLVa:LF)
{
F32 param;
LLStringUtil::convertToF32(strOption, param);
VERIFY_OPTION_REF(LLStringUtil::convertToF32(strOption, param));
if (RLV_TYPE_ADD == eType)
addException(rlvCmd.getObjectID(), eBhvr, param);
else
removeException(rlvCmd.getObjectID(), eBhvr, param);
updatePole(eBhvr, eBhvr == RLV_BHVR_CAMDRAWMAX || eBhvr == RLV_BHVR_CAMDRAWALPHAMAX);
if (hasBehaviour(eBhvr))
{
// Singu TODO: Implement
}
eRet = RLV_RET_FAILED_UNKNOWN; // Singu TODO: Implement
updatePole(eBhvr, eBhvr == RLV_BHVR_CAMDISTMAX || eBhvr == RLV_BHVR_CAMZOOMMAX || eBhvr == RLV_BHVR_CAMDRAWMAX || eBhvr == RLV_BHVR_CAMDRAWALPHAMAX);
break;
}
case RLV_BHVR_CAMDRAWCOLOR: // @camdrawcolor:<red>;<green>;<blue>=n|y - Checked: 2015-05-25 (RLVa:LF)
case RLV_BHVR_CAMDRAWCOLOR: // @camdrawcolor:<red>;<green>;<blue>=n|y - Checked: 2015-05-25 (RLVa:LF)
{
LLColor3 color;
if (!strOption.empty())
@@ -1402,18 +1358,8 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd)
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:<distance>=n|y - Checked: 2015-05-25 (RLVa:LF)
{
F32 dist;
LLStringUtil::convertToF32(strOption, dist);
if (RLV_TYPE_ADD == eType)
addException(rlvCmd.getObjectID(), eBhvr, dist);
else
removeException(rlvCmd.getObjectID(), eBhvr, dist);
updatePole(eBhvr, false);
// Singu TODO: If there is work to be done immediately after this is toggled, add to the onToggleCamXXX section in rlvui.cpp
eRet = RLV_RET_FAILED_UNKNOWN; // Singu TODO: Hook this up and remove this line.
break;
}
// The following block is only valid if there's no option

View File

@@ -169,9 +169,10 @@ void RlvCommand::initLookupTable()
"touchme", "fly", "setgroup", "unsit", "sit", "sittp", "standtp", "setdebug", "setenv", "alwaysrun", "temprun", "detachme",
"attachover", "attachthis", "attachthisover", "attachthis_except", "detachthis", "detachthis_except", "attachall",
"attachallover", "detachall", "attachallthis", "attachallthis_except", "attachallthisover", "detachallthis",
"detachallthis_except", "adjustheight",
"camzoommax", "camzoommin", "camdistmax", "camdistmin", "camdrawmax", "camdrawmin",
"camdrawalphamax", "camdrawalphamin", "camdrawcolor", "camunlock", "camavdist", "camtextures",
"detachallthis_except", "adjustheight", "camzoommax", "camzoommin", "camdistmax", "camdistmin",
// Singu TODO: Implement the RLV 2.9 graphics options and remove TODO from their strings so they work (and report as working)
// If there is work to be done immediately after these is toggled, add to the onToggleCamXXX section in rlvui.cpp
"TODOcamdrawmax", "TODOcamdrawmin", "TODOcamdrawalphamax", "TODOcamdrawalphamin", "TODOcamdrawcolor", "camunlock", "camavdist", "TODOcamtextures",
"tpto", "version", "versionnew", "versionnum", "getattach", "getattachnames",
"getaddattachnames", "getremattachnames", "getoutfit", "getoutfitnames", "getaddoutfitnames", "getremoutfitnames",
"findfolder", "findfolders", "getpath", "getpathnew", "getinv", "getinvworn", "getgroup", "getsitid", "getcommand",

View File

@@ -97,6 +97,12 @@ RlvUIEnabler::RlvUIEnabler()
// onToggleCamXXX
m_Handlers.insert(std::pair<ERlvBehaviour, behaviour_handler_t>(RLV_BHVR_CAMUNLOCK, boost::bind(&RlvUIEnabler::onToggleCamUnlock, this)));
void onToggleCamZoom(const ERlvBehaviour& eBhvr);
m_Handlers.insert(std::pair<ERlvBehaviour, behaviour_handler_t>(RLV_BHVR_CAMZOOMMAX, boost::bind(onToggleCamZoom, RLV_BHVR_CAMZOOMMAX)));
m_Handlers.insert(std::pair<ERlvBehaviour, behaviour_handler_t>(RLV_BHVR_CAMZOOMMIN, boost::bind(onToggleCamZoom, RLV_BHVR_CAMZOOMMIN)));
void onToggleCamDist(const ERlvBehaviour& eBhvr);
m_Handlers.insert(std::pair<ERlvBehaviour, behaviour_handler_t>(RLV_BHVR_CAMDISTMAX, boost::bind(onToggleCamDist, RLV_BHVR_CAMDISTMAX)));
m_Handlers.insert(std::pair<ERlvBehaviour, behaviour_handler_t>(RLV_BHVR_CAMDISTMIN, boost::bind(onToggleCamDist, RLV_BHVR_CAMDISTMIN)));
// onToggleTp
m_Handlers.insert(std::pair<ERlvBehaviour, behaviour_handler_t>(RLV_BHVR_TPLOC, boost::bind(&RlvUIEnabler::onToggleTp, this)));
@@ -356,6 +362,35 @@ void RlvUIEnabler::onToggleCamUnlock()
gAgentCamera.resetView(true, true);
}
// Checked: 2015-06-04 (RLVa:LF)
void onToggleCamZoom(const ERlvBehaviour& eBhvr)
{
if (gRlvHandler.hasBehaviour(eBhvr))
{
LLViewerCamera& inst(LLViewerCamera::instance());
inst.mSavedFOVLoaded ? inst.loadDefaultFOV() : inst.setDefaultFOV(gSavedSettings.getF32("CameraAngle"));
}
}
// Checked: 2015-06-04 (RLVa:LF)
void onToggleCamDist(const ERlvBehaviour& eBhvr)
{
if (gRlvHandler.hasBehaviour(eBhvr))
{
if (eBhvr == RLV_BHVR_CAMDISTMAX && gRlvHandler.camPole(eBhvr) <= 0)
{
if (!gAgentCamera.cameraMouselook())
gAgentCamera.changeCameraToMouselook();
}
else
{
if (eBhvr == RLV_BHVR_CAMDISTMIN && gRlvHandler.camPole(eBhvr) > 0 && gAgentCamera.cameraMouselook())
gAgentCamera.changeCameraToDefault();
gAgentCamera.cameraPanUp(0); // Hacky, but meh, issues a proper call to calcCameraPositionTargetGlobal().
}
}
}
// Checked: 2010-08-22 (RLVa-1.2.1a) | Added: RLVa-1.2.1a
void RlvUIEnabler::onToggleTp()
{