k4zmu2a / SpaceCadetPinball

Decompilation of 3D Pinball for Windows – Space Cadet
MIT License
3.49k stars 214 forks source link

"hidden test" mouse control behaves like a joystick #182

Closed TannerAMay closed 1 year ago

TannerAMay commented 1 year ago

Arch Linux; Release 2.0.1

When using the mouse for the hidden test cheat, the ball moves in the direction that the mouse moves instead of being dragged by the mouse. For example, if the cursor is at (0, 0) and the mouse is clicked then moved to (10, 0) the ball will constantly move to the right. The speed is proportional to how far the mouse is moved. The issue occurs even when not clicking on the ball. I tested on wayland KDE 5.27 both in xwayland mode and wayland mode (using SDL_VIDEODRIVER=wayland). I also tried unbinding the nudge binds but it had no effect.

TannerAMay commented 1 year ago

After some further testing it appears that there are two issues. The first is that the mouse sensitivity is very high. The second is what I confused with joystick-like motion. What is actually happening is easier to describe through an example: suppose that the mouse is clicked at (0, 0) and moved to the right to (10, 0). The ball will move much further than those 10 units and will no longer be under the mouse cursor. But if the user then moves the mouse left, then the ball will contiune moving to the right until the mouse passes it's original click point, (0, 0) in this example. A work around I found is to simply release the click and click again, resetting the original click point. Sorry for the incorrect description in the OP.

k4zmu2a commented 1 year ago

This joystick-like cheat behavior is by design. The truth is - you never controlled the ball directly, even in the original game. The illusion of direct control came from hidden mouse cursor.

I adjusted the original “joystick” code to better work across various screen resolutions. I then further refined it in the latest dev version. Current version works with deltas in normalized windows coordinates [-1, 1], which are then translated into in-game impulse via sensitivity constant. I picked that constant arbitrary, where it felt close enough to the original. A direct comparison with the original cannot be made, since it uses absolute coordinates for movement.

I am not going to add direct ball control, since I find current solution good enough. What I can offer to you to partially fix your issue: 1) Hide mouse cursor when mouse control is active. This might bring some of that illusion of control back. 2) Add new option for mouse control sensitivity. So that you could adjust the feel of the cheat for your particular combination of windows size and mouse DPI.

TannerAMay commented 1 year ago

I just pulled master and it is more intuitive now, thanks. I think the 2nd option would be ideal but what it is now is good enough.

k4zmu2a commented 1 year ago

Works OK in 2.1.0. I might add the mouse sensitivity option in the future.