Skip to content

Don't fire clicks after third-person camera rotation or walking - #941

Merged
foxtacles merged 1 commit into
isledecomp:masterfrom
foxtacles:fix/tp-camera-rmb-click
Nov 23, 2026
Merged

foxtacles merged 1 commit into
isledecomp:masterfrom
foxtacles:fix/tp-camera-rmb-click

Conversation

@foxtacles

Copy link
Copy Markdown
Member

In third-person mode, holding the right mouse button to rotate the camera and clicking the left button during it fired the left click once both buttons were released. Releasing the left button after holding it to walk also fired a click where it was pressed.

The camera's filter in LegoInputManager::ProcessOneEvent only dropped mouse events while the right button was held alone. The left press during a rotation got through and armed a click, the left release was dropped, and the right button's release then completed the click at the spot of the left press. This happened in every order of presses and releases, including holding the left button to walk and adding the right button to steer. The left press also reached the world's own button handlers during the rotation, which, for example, reset the pizza mission during its introduction. The filter now drops every mouse event while the right button is held and cancels the pending click.

For walking, the third-person camera now cancels the pending click once a left button hold turns into walking, also after zooming into first person while still holding the button.

Holding the mouse still is also supposed to end in a drag rather than a click: the original game starts mouse navigation after one second. The timer for this never fired since the move to SDL timers, because its callback built the timer event without pushing it. The event is pushed again and compared by the 8 bits of the timer ID that the notification carries, since SDL timer IDs grow past 255, and the camera's filter leaves timer events alone.

Tested on macOS with scripted mouse, wheel and touch input in a native build, and in the web build in headless Chrome with real mouse input, comparing the old and new behavior in each scenario:

  • Every order of right and left presses and releases during a rotation used to click the player character; none does now. Rotation, walking with both buttons, plain clicks, a click right after a rotation and left button drags behave as before, also with "always on mouse look".
  • Holding the left button for 0.5 or 1.5 seconds walks the same distance as before and no longer clicks; short clicks still click.
  • In first person, holding the mouse still for 1.5 seconds now starts mouse navigation after one second instead of clicking on release; short clicks, right clicks and dragging to navigate behave as before.
  • With the touch schemes, holding a finger still for over a second no longer clicks on release, and movement is unchanged; the mouse touch scheme now also starts navigation after a second, like the mouse.

🤖 Generated with Claude Code

https://claude.ai/code/session_0179vyTGZwyMZgoazji12e2B

@foxtacles
foxtacles enabled auto-merge (squash) November 23, 2026 04:07
Holding the right mouse button to rotate the third-person camera and
clicking the left button during it fired the left click once both
buttons were released. The camera's filter only dropped mouse events
while the right button was held alone, so the left press got through
and the right button's release completed the click. The filter now
drops every mouse event while the right button is held and cancels
the pending click.

Releasing the left button after holding it to walk also fired a click
where it was pressed. The third-person camera now cancels the pending
click once the hold turns into walking.

The one-second auto-drag timer never fired since the move to SDL
timers, because its callback built the timer event without pushing
it, so holding the mouse still always ended in a click. The event is
pushed again and compared by the 8 bits of the timer ID that the
notification carries, since SDL timer IDs grow past 255, and the
camera's filter leaves timer events alone. As in the original game,
holding the mouse still for a second starts mouse navigation instead
of clicking.
@foxtacles
foxtacles force-pushed the fix/tp-camera-rmb-click branch from cb76c4c to fa92f29 Compare November 23, 2026 05:04
@foxtacles
foxtacles merged commit 2b2cd17 into isledecomp:master Nov 23, 2026
21 checks passed
@foxtacles
foxtacles deleted the fix/tp-camera-rmb-click branch November 23, 2026 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant