summaryrefslogtreecommitdiff
path: root/indra/newview/llagent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llagent.cpp')
-rw-r--r--indra/newview/llagent.cpp104
1 files changed, 80 insertions, 24 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 085155714a..9ce14eb0ab 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -121,8 +121,8 @@ const F32 MIN_FIDGET_TIME = 8.f; // seconds
const F32 MAX_FIDGET_TIME = 20.f; // seconds
const S32 UI_FEATURE_VERSION = 1;
-// For version 1, flag holds: 1 - inventory thumbnails, 2 - gltf, 4 - inventory favorites
-const S32 UI_FEATURE_FLAGS = 7;
+// For version 1: 1 - inventory, 2 - gltf
+const S32 UI_FEATURE_FLAGS = 3;
// The agent instance.
LLAgent gAgent;
@@ -223,6 +223,7 @@ private:
LLVector3d mPosGlobal;
};
+
class LLTeleportRequestViaLocationLookAt : public LLTeleportRequestViaLocation
{
public:
@@ -385,6 +386,10 @@ LLAgent::LLAgent() :
mbRunning(false),
mbTeleportKeepsLookAt(false),
+ mAllowedToStand(true),
+ mAllowedToSit(true),
+ mSitObjectID(LLUUID::null),
+
mAgentAccess(new LLAgentAccess(gSavedSettings)),
mGodLevelChangeSignal(),
mCanEditParcel(false),
@@ -603,7 +608,7 @@ void LLAgent::getFeatureVersionAndFlags(S32& version, S32& flags)
if (feature_version.isInteger())
{
version = feature_version.asInteger();
- flags = 3; // show 'favorites' notification
+ flags = 1; // inventory flag
}
else if (feature_version.isMap())
{
@@ -629,8 +634,13 @@ void LLAgent::showLatestFeatureNotification(const std::string key)
if (key == "inventory")
{
- // Notify user about new favorites support
- flag = 4;
+ // Notify user about new thumbnail support
+ flag = 1;
+ }
+
+ if (key == "gltf")
+ {
+ flag = 2;
}
if ((flags & flag) == 0)
@@ -837,6 +847,7 @@ void LLAgent::movePitch(F32 mag)
}
}
+
// Does this parcel allow you to fly?
bool LLAgent::canFly()
{
@@ -916,6 +927,7 @@ void LLAgent::setFlying(bool fly, bool fail_sound)
LLFloaterMove::setFlyingMode(fly);
}
+
// UI based mechanism of setting fly state
//-----------------------------------------------------------------------------
// toggleFlying()
@@ -961,7 +973,11 @@ bool LLAgent::isSitting()
void LLAgent::standUp()
{
- setControlFlags(AGENT_CONTROL_STAND_UP);
+ if (mAllowedToStand)
+ {
+ setControlFlags(AGENT_CONTROL_STAND_UP);
+ mSitObjectID = LLUUID::null;
+ }
}
void LLAgent::changeParcels()
@@ -994,6 +1010,7 @@ void LLAgent::capabilityReceivedCallback(const LLUUID &region_id, LLViewerRegion
}
}
+
//-----------------------------------------------------------------------------
// setRegion()
//-----------------------------------------------------------------------------
@@ -1099,6 +1116,7 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
mRegionChangedSignal();
}
+
//-----------------------------------------------------------------------------
// getRegion()
//-----------------------------------------------------------------------------
@@ -1107,6 +1125,7 @@ LLViewerRegion *LLAgent::getRegion() const
return mRegionp;
}
+
LLHost LLAgent::getRegionHost() const
{
if (mRegionp)
@@ -1137,6 +1156,7 @@ bool LLAgent::inPrelude()
return mRegionp && mRegionp->isPrelude();
}
+
std::string LLAgent::getRegionCapability(const std::string &name)
{
if (!mRegionp)
@@ -1145,6 +1165,7 @@ std::string LLAgent::getRegionCapability(const std::string &name)
return mRegionp->getCapability(name);
}
+
//-----------------------------------------------------------------------------
// canManageEstate()
//-----------------------------------------------------------------------------
@@ -1172,6 +1193,7 @@ void LLAgent::sendMessage()
gMessageSystem->sendMessage(mRegionp->getHost());
}
+
//-----------------------------------------------------------------------------
// sendReliableMessage()
//-----------------------------------------------------------------------------
@@ -1205,6 +1227,7 @@ LLVector3 LLAgent::getVelocity() const
}
}
+
//-----------------------------------------------------------------------------
// setPositionAgent()
//-----------------------------------------------------------------------------
@@ -1278,6 +1301,7 @@ const LLVector3 &LLAgent::getPositionAgent()
}
}
+
return mFrameAgent.getOrigin();
}
@@ -1286,6 +1310,7 @@ boost::signals2::connection LLAgent::whenPositionChanged(position_signal_t::slot
return mOnPositionChanged.connect(fn);
}
+
//-----------------------------------------------------------------------------
// getRegionsVisited()
//-----------------------------------------------------------------------------
@@ -1302,6 +1327,7 @@ F64 LLAgent::getDistanceTraveled() const
return mDistanceTraveled;
}
+
//-----------------------------------------------------------------------------
// getPosAgentFromGlobal()
//-----------------------------------------------------------------------------
@@ -1312,6 +1338,7 @@ LLVector3 LLAgent::getPosAgentFromGlobal(const LLVector3d &pos_global) const
return pos_agent;
}
+
//-----------------------------------------------------------------------------
// getPosGlobalFromAgent()
//-----------------------------------------------------------------------------
@@ -1324,9 +1351,10 @@ LLVector3d LLAgent::getPosGlobalFromAgent(const LLVector3 &pos_agent) const
void LLAgent::sitDown()
{
- setControlFlags(AGENT_CONTROL_SIT_ON_GROUND);
+ if (mAllowedToSit) setControlFlags(AGENT_CONTROL_SIT_ON_GROUND);
}
+
//-----------------------------------------------------------------------------
// resetAxes()
//-----------------------------------------------------------------------------
@@ -1335,6 +1363,7 @@ void LLAgent::resetAxes()
mFrameAgent.resetAxes();
}
+
// Copied from LLCamera::setOriginAndLookAt
// Look_at must be unit vector
//-----------------------------------------------------------------------------
@@ -1363,6 +1392,7 @@ void LLAgent::resetAxes(const LLVector3 &look_at)
mFrameAgent.setAxes(look_at, left, up);
}
+
//-----------------------------------------------------------------------------
// rotate()
//-----------------------------------------------------------------------------
@@ -1371,6 +1401,7 @@ void LLAgent::rotate(F32 angle, const LLVector3 &axis)
mFrameAgent.rotate(angle, axis);
}
+
//-----------------------------------------------------------------------------
// rotate()
//-----------------------------------------------------------------------------
@@ -1379,6 +1410,7 @@ void LLAgent::rotate(F32 angle, F32 x, F32 y, F32 z)
mFrameAgent.rotate(angle, x, y, z);
}
+
//-----------------------------------------------------------------------------
// rotate()
//-----------------------------------------------------------------------------
@@ -1387,6 +1419,7 @@ void LLAgent::rotate(const LLMatrix3 &matrix)
mFrameAgent.rotate(matrix);
}
+
//-----------------------------------------------------------------------------
// rotate()
//-----------------------------------------------------------------------------
@@ -1395,6 +1428,7 @@ void LLAgent::rotate(const LLQuaternion &quaternion)
mFrameAgent.rotate(quaternion);
}
+
//-----------------------------------------------------------------------------
// getReferenceUpVector()
//-----------------------------------------------------------------------------
@@ -1423,6 +1457,7 @@ LLVector3 LLAgent::getReferenceUpVector()
return up_vector;
}
+
// Radians, positive is forward into ground
//-----------------------------------------------------------------------------
// pitch()
@@ -1466,6 +1501,7 @@ void LLAgent::pitch(F32 angle)
}
}
+
//-----------------------------------------------------------------------------
// roll()
//-----------------------------------------------------------------------------
@@ -1474,6 +1510,7 @@ void LLAgent::roll(F32 angle)
mFrameAgent.roll(angle);
}
+
//-----------------------------------------------------------------------------
// yaw()
//-----------------------------------------------------------------------------
@@ -1485,6 +1522,7 @@ void LLAgent::yaw(F32 angle)
}
}
+
// Returns a quat that represents the rotation of the agent in the absolute frame
//-----------------------------------------------------------------------------
// getQuat()
@@ -1510,6 +1548,7 @@ void LLAgent::setControlFlags(U32 mask)
mControlFlags |= mask;
}
+
//-----------------------------------------------------------------------------
// clearControlFlags()
//-----------------------------------------------------------------------------
@@ -1597,6 +1636,7 @@ bool LLAgent::isDoNotDisturb() const
return mIsDoNotDisturb;
}
+
//-----------------------------------------------------------------------------
// startAutoPilotGlobal()
//-----------------------------------------------------------------------------
@@ -1702,6 +1742,7 @@ void LLAgent::startAutoPilotGlobal(
mAutoPilotNoProgressFrameCount = 0;
}
+
//-----------------------------------------------------------------------------
// setAutoPilotTargetGlobal
//-----------------------------------------------------------------------------
@@ -1755,6 +1796,7 @@ void LLAgent::startFollowPilot(const LLUUID &leader_id, bool allow_flying, F32 s
allow_flying);
}
+
//-----------------------------------------------------------------------------
// stopAutoPilot()
//-----------------------------------------------------------------------------
@@ -1796,6 +1838,7 @@ void LLAgent::stopAutoPilot(bool user_cancel)
}
}
+
// Returns necessary agent pitch and yaw changes, radians.
//-----------------------------------------------------------------------------
// autoPilot()
@@ -1984,6 +2027,7 @@ void LLAgent::autoPilot(F32 *delta_yaw)
}
}
+
//-----------------------------------------------------------------------------
// propagate()
//-----------------------------------------------------------------------------
@@ -2004,19 +2048,18 @@ void LLAgent::propagate(const F32 dt)
}
// handle rotation based on keyboard levels
- if (fabs(dt) > 1e-6)
+ constexpr F32 YAW_RATE = 90.f * DEG_TO_RAD; // radians per second
+ F32 angle = YAW_RATE * gAgentCamera.getYawKey() * dt;
+ if (fabs(angle) > 0.0f)
{
- if (fabs(gAgentCamera.getYawKey()) > 1e-6)
- {
- static const F32 YAW_RATE = 90.f * DEG_TO_RAD; // radians per second
- yaw(YAW_RATE * gAgentCamera.getYawKey() * dt);
- }
+ yaw(angle);
+ }
- if (fabs(gAgentCamera.getPitchKey()) > 1e-6)
- {
- static const F32 PITCH_RATE = 90.f * DEG_TO_RAD; // radians per second
- pitch(PITCH_RATE * gAgentCamera.getPitchKey() * dt);
- }
+ constexpr F32 PITCH_RATE = 90.f * DEG_TO_RAD; // radians per second
+ angle = PITCH_RATE * gAgentCamera.getPitchKey() * dt;
+ if (fabs(angle) > 0.0f)
+ {
+ pitch(angle);
}
// handle auto-land behavior
@@ -2178,6 +2221,7 @@ void LLAgent::clearRenderState(U8 clearstate)
mRenderState &= ~clearstate;
}
+
//-----------------------------------------------------------------------------
// getRenderState()
//-----------------------------------------------------------------------------
@@ -2219,7 +2263,6 @@ void LLAgent::endAnimationUpdateUI()
{
return;
}
-
if (gAgentCamera.getCameraMode() == gAgentCamera.getLastCameraMode())
{
// We're already done endAnimationUpdateUI for this transition.
@@ -2285,6 +2328,7 @@ void LLAgent::endAnimationUpdateUI()
mViewsPushed = false;
}
+
gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR);
if( gMorphView )
{
@@ -2916,6 +2960,7 @@ void LLAgent::sendMaturityPreferenceToServer(U8 pPreferredMaturity)
}
}
+
void LLAgent::processMaturityPreferenceFromServer(const LLSD &result, U8 perferredMaturity)
{
U8 maturity = SIM_ACCESS_MIN;
@@ -2985,6 +3030,7 @@ void LLAgent::changeInterestListMode(const std::string &new_mode)
}
}
+
bool LLAgent::requestPostCapability(const std::string &capName, LLSD &postData, httpCallback_t cbSuccess, httpCallback_t cbFailure)
{
if (getRegion())
@@ -3311,6 +3357,7 @@ void LLAgent::sendAnimationStateReset()
sendReliableMessage();
}
+
// Send a message to the region to revoke sepecified permissions on ALL scripts in the region
// If the target is an object in the region, permissions in scripts on that object are cleared.
// If it is the region ID, all scripts clear the permissions for this agent
@@ -3430,11 +3477,14 @@ void LLAgent::initOriginGlobal(const LLVector3d &origin_global)
bool LLAgent::leftButtonGrabbed() const
{
- const bool camera_mouse_look = gAgentCamera.cameraMouselook();
- return (!camera_mouse_look && mControlsTakenCount[CONTROL_LBUTTON_DOWN_INDEX] > 0)
- || (camera_mouse_look && mControlsTakenCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0)
- || (!camera_mouse_look && mControlsTakenPassedOnCount[CONTROL_LBUTTON_DOWN_INDEX] > 0)
- || (camera_mouse_look && mControlsTakenPassedOnCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0);
+ if (gAgentCamera.cameraMouselook())
+ {
+ return mControlsTakenCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0;
+ }
+ else
+ {
+ return mControlsTakenCount[CONTROL_LBUTTON_DOWN_INDEX] > 0;
+ }
}
bool LLAgent::rotateGrabbed() const
@@ -4240,6 +4290,7 @@ void LLAgent::onCapabilitiesReceivedAfterTeleport()
check_merchant_status();
}
+
void LLAgent::teleportRequest(
const U64& region_handle,
const LLVector3& pos_local,
@@ -4353,6 +4404,7 @@ void LLAgent::doTeleportViaLure(const LLUUID& lure_id, bool godlike)
}
}
+
// James Cook, July 28, 2005
void LLAgent::teleportCancel()
{
@@ -4477,6 +4529,7 @@ LLAgent::ETeleportState LLAgent::getTeleportState() const
TELEPORT_NONE : mTeleportState;
}
+
void LLAgent::setTeleportState(ETeleportState state)
{
if (mTeleportRequest && (state != TELEPORT_NONE) && (mTeleportRequest->getStatus() == LLTeleportRequest::kFailed))
@@ -4521,6 +4574,7 @@ void LLAgent::setTeleportState(ETeleportState state)
}
}
+
void LLAgent::stopCurrentAnimations()
{
LL_DEBUGS("Avatar") << "Stopping current animations" << LL_ENDL;
@@ -4635,6 +4689,7 @@ void LLAgent::stopFidget()
gAgent.sendAnimationRequests(anims, ANIM_REQUEST_STOP);
}
+
void LLAgent::requestEnterGodMode()
{
LLMessageSystem* msg = gMessageSystem;
@@ -4755,6 +4810,7 @@ void LLAgent::sendAgentUpdateUserInfo(const std::string& directory_visibility)
}
}
+
void LLAgent::updateAgentUserInfoCoro(std::string capurl, std::string directory_visibility)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);