summaryrefslogtreecommitdiff
path: root/indra/newview/llagent.cpp
diff options
context:
space:
mode:
authorleviathan <leviathan@lindenlab.com>2026-08-25 17:37:01 -0700
committerleviathan <leviathan@lindenlab.com>2026-10-16 13:14:37 -0700
commit9a3fe7fa1337e9d9cfbcd5060455bb5715a210a4 (patch)
tree0ff4c183314c6d8ef7037363ab6c3c326a4f8cac /indra/newview/llagent.cpp
parentefe6ab8510d972da1bccb21d03355576a757bf3b (diff)
mouse-mode is now cursor-mode, add zoom to other modes
Diffstat (limited to 'indra/newview/llagent.cpp')
-rw-r--r--indra/newview/llagent.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 8ca84e6574..cb521cc3db 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -5003,7 +5003,7 @@ static S32 g_deltaFrame { 0 };
void LLAgent::updateGameControlMode()
{
// Auto-derive the active mode from avatar/camera state. Flycam takes
- // precedence (it is toggled via a game-control binding), then Mouse-cursor
+ // precedence (it is toggled via a game-control binding), then Cursor
// mode (also an explicit toggle -- see mUsingMouseCursor/toggleMouseCursorMode()),
// then mouselook (the camera mode can be entered while sitting too, so it is
// checked ahead of Captive), then sitting/controls-taken maps to Captive,
@@ -5015,7 +5015,7 @@ void LLAgent::updateGameControlMode()
}
else if (mUsingMouseCursor)
{
- mode = LLGameControl::CONTROL_MODE_MOUSE;
+ mode = LLGameControl::CONTROL_MODE_CURSOR;
}
else if (gAgentCamera.cameraMouselook())
{
@@ -5092,11 +5092,11 @@ void LLAgent::applyExternalActions(const LLGameControl::AgentActions& actions)
toggleMouseCursorMode();
}
- // CONTROL_MODE_MOUSE: drive the actual on-screen cursor from
+ // CONTROL_MODE_CURSOR: drive the actual on-screen cursor from
// actions.mMouseCursorDX/DY (the analog deflection of whatever's bound to "Mouse
// left/right"/"Mouse up/down") BEFORE the click dispatch below, so a synthesized
// click lands wherever the stick just moved the cursor to, in the same frame.
- if (LLGameControl::getAgentControlMode() == LLGameControl::CONTROL_MODE_MOUSE)
+ if (LLGameControl::getAgentControlMode() == LLGameControl::CONTROL_MODE_CURSOR)
{
constexpr F32 MOUSE_CURSOR_PIXELS_PER_SEC = 1200.f;
U64 mouse_cursor_now = LLFrameTimer::getTotalTime();
@@ -5253,6 +5253,17 @@ void LLAgent::applyExternalActions(const LLGameControl::AgentActions& actions)
movePitch(pitch_sign * fabs(actions.mPitchAmplitude));
}
+ // actions.mZoomAmplitude ([-1, 1], from "Zoom +/-"/"Zoom +"/"Zoom -") drives the
+ // camera's field-of-view zoom. Positive amplitude zooms in (narrows the FOV);
+ if (actions.mZoomAmplitude != 0.f)
+ {
+ constexpr F32 FOV_ZOOM_RATE = 1.2f;
+ F32 fov_scale = powf(FOV_ZOOM_RATE, -actions.mZoomAmplitude * g_deltaTime);
+ LLViewerCamera* camera = LLViewerCamera::getInstance();
+ camera->setDefaultFOV(camera->getDefaultFOV() * fov_scale);
+ gSavedSettings.setF32("CameraAngle", camera->getView());
+ }
+
if (mExternalActionFlags & AGENT_CONTROL_STOP)
{
setControlFlags(AGENT_CONTROL_STOP);