Tweak the deadzone code to work better with pre-amp.

Everthing was fine with pre-amp == 1, but if it was anything else, the
offset would become invalid.
This commit is contained in:
Bill Currie 2013-01-27 14:30:13 +09:00
parent f5e1983e0f
commit 173af3a992

View file

@ -140,13 +140,11 @@ JOY_Move (void)
for (i = 0; i < JOY_MAX_AXES; i++) {
ja = &joy_axes[i];
if (abs (ja->offset) + abs (ja->current) <
abs (ja->offset) + abs (ja->deadzone))
ja->current = -ja->offset;
value =
amp * ja->amp * (ja->offset +
ja->current * pre * ja->pre_amp) / 100.0f;
value = ja->current * pre * ja->pre_amp;
if (fabs (value) < ja->deadzone)
value = -ja->offset;
value += ja->offset;
value *= amp * ja->amp / 100.0f;
switch (ja->dest) {
case js_none:
// ignore axis