Add option to override direct mouse coordinate range#746
Open
finalpatch wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: