When sending [[x]] and [[y]] data from the right stick of a gamepad the values are not consistent between different gamepads. From what I have direct access to the Rock Candy Xbox 360 controller works exactly as expected, whereas the Playstation 4 Dual Shock 4 controller is never sending less than 0.75 for the y-axis. I don't know the specific values that were being sent, but someone else tried using a different brand of Xbox 360 and the y value never even got to 0.25 (estimating because I wasn't outputting the numbers, but things should have been happening with values higher than 0.25).
Numbered Steps to Reproduce Problem:
1. Input code in any environment.
2. Add macro "GamepadRightAnalog" with the command "use-weapon-stick [[x]] [[y]]"
3. Run with any controller.
4. Some controllers will not return the correct values for the y-axis.
Code Snippet (if applicable) to Reproduce Problem:
mob/player
var/tmp
weaponwait = 0
controller_dir = 0
last_x = 0
last_y = 0
verb
use_weapon_stick(x as num, y as num)
set hidden = 1
if(weaponwait || (x < last_x+0.25 && x > last_x-0.25) && (y < last_y+0.25 && y > last_y-0.25))
if(x < 0.25 && y < 0.25)
if(x > -0.25 && y > -0.25) controller_dir = null
return
weaponwait = 1
var/_dir = 0
if(x > 0.75)
if(y > 0.25) _dir = NORTHEAST
else if(y < -0.25) _dir = SOUTHEAST
else _dir = EAST
else if(x < -0.75)
if(y > 0.25) _dir = NORTHWEST
else if(y < -0.25) _dir = SOUTHWEST
else _dir = WEST
else if(y > 0.75) _dir = NORTH
else if(y < -0.75) _dir = SOUTH
else _dir = 0
last_x = x
last_y = y
controller_dir = _dir
sleep world.tick_lag
weaponwait = 0
Expected Results:
All controllers should return the same or similar y-axis values.
Actual Results:
Some controllers return y values that are too high or too low.
Does the problem occur:
Every time? Or how often? Every time
In other games? Yes
In other user accounts? Yes
On other computers? Yes
When does the problem NOT occur?
When using a Rock Candy Xbox 360 controller.
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Tested on versions 511.1367-511.1369 and it's present in all versions.
Workarounds:
None.