fix(mouse): the native mouse camera starts again from the game's angles across a map's load #2851

Merged
HumanBean merged 2 commits from HumanBean/Longshot:fix/mouse-camera-map-load into mod-api 2026-11-30 02:55:49 +00:00
Owner

Summary

With Mouse camera: Native, walking through a loading zone with forward held swings the camera 45 to 90 degrees after
the load, and further the more the view was turned away from Link as he left
(#1728; the controller reports there fit too when Native
is on, since it acts without the mouse moving).

The native mouse look (game_core::camera::mouse) keeps its own yaw and pitch and puts them back into the player camera
at every update, so the game's follow camera never drifts the view. It starts again from the game's angles only for a
new camera, a stick turn, a camera state other than 3 or 4, or 150 ms without an update. A map change can pass none of
those, so the new map's camera, which the game puts behind Link, was turned back to the angles the mouse held in the map
left: a swing by however far the view stood from Link's facing as he went through.

Now, while a map loads, while its arrival's events play and for 30 updates after them, the camera's angles are the
mouse's start at each update. The mouse still turns them, and the new map's camera stays where the game put it. An event
with no load (Navi's words as Link walks, which this game plays during normal play) leaves the mouse's angles held, so
the follow camera's drift that the hold prevents does not come back.

On mod-api (#2822), where the mouse look is the game
side's Rust. Read MouseLook::settling in game/crates/game-core/src/camera/mouse.rs first.

Fixes #1728

Testing

Tested: On this PC (CachyOS Linux, RTX 3090), on mod-api @ aea64d3a.

  • In the game, headless, HOS_MOUSE_NATIVE=1, from the market-entrance save: Link walked out through the Market's
    gate into Hyrule Field, with the player camera's fields read from memory each sample (HOS_CONTROL_MEM=ro). Before
    (mod-api) and after (this PR) the camera came out behind Link (the view's yaw 0 with his facing 0). After, it
    followed the game for the settle window and was held again after it. No faults in either log.
  • What those reads showed, and why this walk does not swing here: the player camera is the same object before and after
    the load. Its yaw (+0x1a4) is kept in the map's own frame: the Market's view at -180 had yaw 0, and Hyrule Field's view
    at 0 had -180. The camera kept updating in state 3 through the departure event. On this PC the camera then missed more
    than 150 ms of updates during the load, which already resets the hold. A load over within 150 ms (a fast PC, as the
    reporter's Ryzen 9 9900) keeps the old map's yaw, which points another way in the new map: the swing. That case is what
    a_load_seen_only_by_the_map_changing_is_a_new_start checks, and why the map's name is watched as well as the flag.
  • cargo test -p game-core: 355 passed. The two new tests (a_new_maps_camera_is_the_games_not_the_last_maps_mouse,
    a_load_seen_only_by_the_map_changing_is_a_new_start) fail on mod-api (the camera held at the mouse's 90 degrees
    instead of the new map's -30 and -180) and pass here. With the fix's || settling taken out they fail again.
  • cargo clippy -p game-core --all-targets and cargo fmt --check: clean.
  • mise run test (before the rebase onto #2848): 821 passed, 17 failed, 11 skipped. Run one at a time after the
    rebase, the 17 give the same results here as on mod-api @ aea64d3a: 14 pass, and test_lifter.py,
    test_present_source_crop.py and test_text_keyboard_policy.py fail on both. None of them reads the mouse look.
  • Not tested here: the reporter's case (forward held, the mouse turned at the exit). A headless run gets no mouse
    motion, and this PC's loads leave the camera stale. It is in Still to test.

Still to test:

  • Windows or Linux, keyboard and mouse, Mouse camera Native: hold W through a loading zone, straight and with the mouse
    turned as you pass, expecting the camera behind Link after the load with no swing (by hand).
  • The same with W let go during the transition, and with Disable camera centering on and off, expecting no change from
    mod-api (by hand).

Measurements

Nothing to measure: a fix in the mouse look's decisions; its cost is one flag read and the map's name per player camera update while Mouse camera is Native.

Risks

  • During a load's arrival and for about half a second after it (30 updates), the game's own camera moves (its follow,
    its placement) count, as they do while the stick turns the camera; the mouse still turns the view throughout.
  • A load the flag does not show would keep the old behaviour. A revert is enough to undo it.
  • Nothing changes for Mouse camera As the stick or Off, saves or longshot_options.ini.

Checklist

Ready for review

  • One topic, on current mod-api; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named). (3 fail on mod-api too, named in Testing)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • A check under tests/ that reads changed source is updated, not weakened. (test_mouse_native.py and test_input_movie.py read it: both pass unchanged)
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary With **Mouse camera: Native**, walking through a loading zone with forward held swings the camera 45 to 90 degrees after the load, and further the more the view was turned away from Link as he left ([#1728](https://git.magicbean.dev/MagicBeanDev/Longshot/issues/1728); the controller reports there fit too when Native is on, since it acts without the mouse moving). The native mouse look (`game_core::camera::mouse`) keeps its own yaw and pitch and puts them back into the player camera at every update, so the game's follow camera never drifts the view. It starts again from the game's angles only for a new camera, a stick turn, a camera state other than 3 or 4, or 150 ms without an update. A map change can pass none of those, so the new map's camera, which the game puts behind Link, was turned back to the angles the mouse held in the map left: a swing by however far the view stood from Link's facing as he went through. Now, while a map loads, while its arrival's events play and for 30 updates after them, the camera's angles are the mouse's start at each update. The mouse still turns them, and the new map's camera stays where the game put it. An event with no load (Navi's words as Link walks, which this game plays during normal play) leaves the mouse's angles held, so the follow camera's drift that the hold prevents does not come back. On `mod-api` ([#2822](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2822)), where the mouse look is the game side's Rust. Read `MouseLook::settling` in `game/crates/game-core/src/camera/mouse.rs` first. Fixes #1728 ## Testing **Tested:** On this PC (CachyOS Linux, RTX 3090), on `mod-api` @ aea64d3a. - In the game, headless, `HOS_MOUSE_NATIVE=1`, from the `market-entrance` save: Link walked out through the Market's gate into Hyrule Field, with the player camera's fields read from memory each sample (`HOS_CONTROL_MEM=ro`). Before (`mod-api`) and after (this PR) the camera came out behind Link (the view's yaw 0 with his facing 0). After, it followed the game for the settle window and was held again after it. No faults in either log. - What those reads showed, and why this walk does not swing here: the player camera is the same object before and after the load. Its yaw (+0x1a4) is kept in the map's own frame: the Market's view at -180 had yaw 0, and Hyrule Field's view at 0 had -180. The camera kept updating in state 3 through the departure event. On this PC the camera then missed more than 150 ms of updates during the load, which already resets the hold. A load over within 150 ms (a fast PC, as the reporter's Ryzen 9 9900) keeps the old map's yaw, which points another way in the new map: the swing. That case is what `a_load_seen_only_by_the_map_changing_is_a_new_start` checks, and why the map's name is watched as well as the flag. - `cargo test -p game-core`: 355 passed. The two new tests (`a_new_maps_camera_is_the_games_not_the_last_maps_mouse`, `a_load_seen_only_by_the_map_changing_is_a_new_start`) fail on `mod-api` (the camera held at the mouse's 90 degrees instead of the new map's -30 and -180) and pass here. With the fix's `|| settling` taken out they fail again. - `cargo clippy -p game-core --all-targets` and `cargo fmt --check`: clean. - `mise run test` (before the rebase onto #2848): 821 passed, 17 failed, 11 skipped. Run one at a time after the rebase, the 17 give the same results here as on `mod-api` @ aea64d3a: 14 pass, and `test_lifter.py`, `test_present_source_crop.py` and `test_text_keyboard_policy.py` fail on both. None of them reads the mouse look. - Not tested here: the reporter's case (forward held, the mouse turned at the exit). A headless run gets no mouse motion, and this PC's loads leave the camera stale. It is in Still to test. **Still to test:** - Windows or Linux, keyboard and mouse, Mouse camera Native: hold W through a loading zone, straight and with the mouse turned as you pass, expecting the camera behind Link after the load with no swing (by hand). - The same with W let go during the transition, and with Disable camera centering on and off, expecting no change from `mod-api` (by hand). ## Measurements Nothing to measure: a fix in the mouse look's decisions; its cost is one flag read and the map's name per player camera update while Mouse camera is Native. ## Risks - During a load's arrival and for about half a second after it (30 updates), the game's own camera moves (its follow, its placement) count, as they do while the stick turns the camera; the mouse still turns the view throughout. - A load the flag does not show would keep the old behaviour. A revert is enough to undo it. - Nothing changes for Mouse camera As the stick or Off, saves or `longshot_options.ini`. ## Checklist ### Ready for review - [x] One topic, on current `mod-api`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). (3 fail on `mod-api` too, named in Testing) - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] A check under `tests/` that reads changed source is updated, not weakened. (`test_mouse_native.py` and `test_input_movie.py` read it: both pass unchanged) - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Fails here: the angles the mouse held in the map left are put back over the
new map's camera while it loads and arrives.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(mouse): the native mouse camera starts again from the game's angles across a map's load (#1728)
All checks were successful
PR description / Title and description (pull_request_target) Successful in 8s
1877bedea8
With Mouse camera on Native, the angles the mouse held were put back into the
player camera every update, through the load and the arrival: the new map's
camera, put behind Link by the game, was turned back to the old map's angles,
a swing by however far the view stood from Link as he left (more the further
the view was turned). Now, while a map loads, while its arrival's events play
and for 30 updates after them, the camera's angles are the mouse's start at
each update (the mouse still turns them). An event without a load leaves the
mouse's angles held, so the game's follow does not creep back in.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean force-pushed fix/mouse-camera-map-load from 1877bedea8
All checks were successful
PR description / Title and description (pull_request_target) Successful in 8s
to 4124dfa1b6
All checks were successful
PR description / Title and description (pull_request_target) Successful in 10s
2026-11-30 02:03:22 +00:00
Compare
HumanBean force-pushed fix/mouse-camera-map-load from 4124dfa1b6
All checks were successful
PR description / Title and description (pull_request_target) Successful in 10s
to 5fbda6f779
All checks were successful
PR description / Title and description (pull_request_target) Successful in 9s
2026-11-30 02:45:20 +00:00
Compare
HumanBean changed title from WIP: fix(mouse): the native mouse camera starts again from the game's angles across a map's load to fix(mouse): the native mouse camera starts again from the game's angles across a map's load 2026-11-30 02:46:06 +00:00
HumanBean merged commit cb37f5ab8a into mod-api 2026-11-30 02:55:49 +00:00
HumanBean deleted branch fix/mouse-camera-map-load 2026-11-30 02:55:49 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2851
No description provided.