Skip to content

Add option to override direct mouse coordinate range#746

Open
finalpatch wants to merge 2 commits into
schellingb:mainfrom
finalpatch:main
Open

Add option to override direct mouse coordinate range#746
finalpatch wants to merge 2 commits into
schellingb:mainfrom
finalpatch:main

Conversation

@finalpatch

@finalpatch finalpatch commented Jun 7, 2026

Copy link
Copy Markdown

This adds an option to override the direct mouse coordinate range for touch screen devices.

In Might and Magic 3/4/5, the game explicitly sets the mouse cursor range to x:2-309 and y:2-187 (using INT 33h feature 0x07 and 0x08). I believe the game did this to keep the cursor sprite inside the frame buffer (so that it does not need to worry about clipping it). But this also causes the direct mouse logic to use the 309/187 range to compute the cursor position and leads to the tapping position not aligning with cursor on screen.

This PR introduces a new option "mouse_range_override" that allows the user to override the mouse range so that the direct mouse coordinates are computed correctly using the actual game resolution (320x200), while keeping the game specified cursor range, and only use that for clampping. We still get the coordinate range the game expects, but the scaling factor is fixed.

The new option defaults to "disabled" because most games either do not explicitly change the mouse range, or simply set it to the screen resolution.

Edit:
Examples of games that require mouse range override to work correctly in direct mode:

  • Might and Magic III Isles of Terra (override with 320x200)
  • Might and Magic IV Clouds of Xeen (override with 320x200)
  • Might and Magic V Darkside of Xeen (override with 320x200)
  • KOEI Uncharted Water II (override with 640x480)
  • KOEI Air Management II (override with 640x480)
  • KOEI Teitoku no Ketsudan (Pacific Theater of Operations) (override with 640x480)

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