induktio / thinker

Improved game engine features for SMACX.
https://discord.gg/XdFuwWzzku
GNU General Public License v2.0
75 stars 11 forks source link

Allow the map to be zoomed using the mousewheel #49

Closed DrazharLn closed 1 year ago

DrazharLn commented 1 year ago

Previously, using the mousewheel would always send synthetic up and down keys, which would cause units to be ordered up or down when they were selected on the map screen, which is unexpected.

Closes #48

induktio commented 1 year ago

Uh oh, now we edited the same piece of code so the pull request might be stale. The fix on head commit already includes additional checks for other windows that might be open on top of the world map. It would be useful if you can test it for any issues though.

DrazharLn commented 1 year ago

Looks okay to me. I think the documentation on map_is_visible is worthwhile. The comment would need to be updated not to mention the monument screen, but is otherwise correct.

induktio commented 1 year ago

With the latest fix it should not activate zooming when unit workshop is open. Note the additional checks on map_is_visible. Also I excluded TutWin from the checks because it didn't seem to cause any issues. Can you give other examples of other windows where mouse wheel scrolling causes unintentionally zooming? Hmm, now that I checked, game save/open window might be one of them. So either these other windows should be added to the checked list or the code should check in a more reliable way if the world map has focus, like something related to blink_timer.

DrazharLn commented 1 year ago

You continue to be much better at reversing code than me: I don't know how to find the structs for the different windows. If it works really well then I don't think there's a need for a comment, though there's no harm in noting that PRACX does it with the blink_timer in case there are problems with it in the future.