From 29b48c594ed0e71396376e39fe361a1634f709b2 Mon Sep 17 00:00:00 2001 From: Ragnvald Maartmann-Moe IV Date: Sun, 30 Dec 2001 06:08:24 +0000 Subject: [PATCH] More tweaks to joystick code. amp settings have a far greater effect now... --- libs/video/targets/joy.c | 64 ++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 42 deletions(-) diff --git a/libs/video/targets/joy.c b/libs/video/targets/joy.c index 90a1f84b5..721e0d555 100644 --- a/libs/video/targets/joy.c +++ b/libs/video/targets/joy.c @@ -86,8 +86,8 @@ JOY_Move (void) if (!joy_active || !joy_enable->int_val) return; - mult_joy = 1 / (201 - (4 * joy_amp->value * joy_pre_amp->value * - in_amp->value * in_pre_amp->value)); + mult_joy = (joy_amp->value * joy_pre_amp->value * + in_amp->value * in_pre_amp->value) / 200.0; // Yes, mult_joy looks like a mess, but use of pre_amp values is useful in // scripts, and *_pre_amp will matter once joystick filtering/acceleration // is implemented @@ -95,64 +95,44 @@ JOY_Move (void) for (i = 0; i < JOY_MAX_AXES; i++) { switch (joy_axes[i].axis->int_val) { case 1: - if (joy_axes[i].current) { - viewdelta.angles[YAW] -= - (float) (joy_axes[i].current * mult_joy); - } + if (joy_axes[i].current) + viewdelta.angles[YAW] -= joy_axes[i].current * mult_joy; break; case -1: - if (joy_axes[i].current) { - viewdelta.angles[YAW] += - (float) (joy_axes[i].current * mult_joy); - } + if (joy_axes[i].current) + viewdelta.angles[YAW] += joy_axes[i].current * mult_joy; break; case 2: - if (joy_axes[i].current) { - viewdelta.position[2] -= - (float) (joy_axes[i].current * mult_joy); - } + if (joy_axes[i].current) + viewdelta.position[2] -= joy_axes[i].current * mult_joy; break; case -2: - if (joy_axes[i].current) { - viewdelta.position[2] += - (float) (joy_axes[i].current * mult_joy); - } + if (joy_axes[i].current) + viewdelta.position[2] += joy_axes[i].current * mult_joy; break; case 3: - if (joy_axes[i].current) { - viewdelta.position[0] += - (float) (joy_axes[i].current * mult_joy); - } + if (joy_axes[i].current) + viewdelta.position[0] += joy_axes[i].current * mult_joy; break; case -3: - if (joy_axes[i].current) { - viewdelta.position[0] -= - (float) (joy_axes[i].current * mult_joy); - } + if (joy_axes[i].current) + viewdelta.position[0] -= joy_axes[i].current * mult_joy; break; case 4: - if (joy_axes[i].current) { - viewdelta.angles[PITCH] -= - (float) (joy_axes[i].current * mult_joy); - } + if (joy_axes[i].current) + viewdelta.angles[PITCH] -= joy_axes[i].current * mult_joy; break; case -4: - if (joy_axes[i].current) { - viewdelta.angles[PITCH] += - (float) (joy_axes[i].current * mult_joy); - } + if (joy_axes[i].current) + viewdelta.angles[PITCH] += joy_axes[i].current * mult_joy; break; case 5: - if (joy_axes[i].current) { - viewdelta.position[1] -= - (float) (joy_axes[i].current * mult_joy); - } + if (joy_axes[i].current) + viewdelta.position[1] -= joy_axes[i].current * mult_joy; break; case -5: - if (joy_axes[i].current) { - viewdelta.position[1] += - (float) (joy_axes[i].current * mult_joy); - } + if (joy_axes[i].current) + viewdelta.position[1] += joy_axes[i].current * mult_joy; break; default: break;