multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.38k stars 424 forks source link

onClientCursorMove returns 65k on X or Y axis if moving the cursor too fast. #256

Closed Pirulax closed 6 years ago

Pirulax commented 6 years ago

Describe the bug So, if you move ur mouse too fast on an axis(X or Y) it sometimes returns(depends on the speed you are moving ur mouse with) it returns 65k (between 65500 and 65600) for some reason.

To Reproduce Steps to reproduce the behavior:

  1. Add an event handler on onClientCursorMove: addEventHandler("onClientCursorMove", root, function(_, _, cx, cy) if (cx>65000) or (cy>65000) then print(cx, cy) end end)
  2. Move ur mouse like a total idiot
  3. Here u go

Expected behavior It should return a normal value

Screenshots no pls

MTA Client (please complete the following information):

MTA Server (please complete the following information):

Additional context I ran my game in windowed mode, maybe that causes the problem, because my cursor goes out from the screen.

qaisjp commented 6 years ago

Neither @patrikjuvonen or myself can reproduce this.

Please can you download this file and test to see if the problem has been fixed?

@patrikjuvonen perhaps push a change ignoring out of boundary coords and send him a link so he can compare and see which would be best? ref https://github.com/multitheftauto/mtasa-blue/pull/259#issuecomment-407600123

@Pirulax in the meantime can you perhaps try and figure out a more reliable way to reproduce this issue? more details like what resolution you are running windowed mode in, the kind of windowed mode, how many monitors you have, or anything else you think might be relevant? perhaps what might be relevant is the kind of mouse and if it is a high dpi one.

patrikjuvonen commented 6 years ago

I have now pushed a second commit at #259 that ignores out of bounds coordinates instead of clamping them. Let us know which one seems better.

qaisjp commented 6 years ago

thanks @patrikjuvonen. @Pirulax you can get the second copy ("ignore-outofbounds-coords") from this link when the build server is done. The file will be called "InstallFiles.zip"

(p.s. I accidentally edited the wrong comment... sorry 😛)

Pirulax commented 6 years ago

Hihi, I was running MTA in 1280x720 in windowed mode, but my monitor's native resolution is 1920x1080. I made a little if statement which ignored high numbers, it worked just fine. Is there still need of testing the build?

qaisjp commented 6 years ago

@Pirulax do you have multiple monitors?

qaisjp commented 6 years ago

Can you try this build ( https://ci.appveyor.com/project/multitheftauto/mtasa-blue/build/ci-1493/artifacts ) when it appears? This might fix it.

patrikjuvonen commented 6 years ago

For future reference that commit (87879d47db30ffb34a021d5ff8771b1661f759c9) fixed the issue.