From a0d614e6b002adc951227b102ab149c600af35ef Mon Sep 17 00:00:00 2001 From: Kp Date: Fri, 21 Oct 2016 02:16:48 +0000 Subject: [PATCH] Use clamp_symmetric_value in kconfig_read_controls Avoid open-coding the test. --- similar/main/kconfig.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/similar/main/kconfig.cpp b/similar/main/kconfig.cpp index f75b1e368..7cf76d44a 100644 --- a/similar/main/kconfig.cpp +++ b/similar/main/kconfig.cpp @@ -1763,10 +1763,7 @@ void kconfig_read_controls(const d_event &event, int automap_flag) { int mouse_null_value = (i==2?16:PlayerCfg.MouseFSDead*8); Controls.raw_mouse_axis[i] += ax[i]; - if (Controls.raw_mouse_axis[i] < -MOUSEFS_DELTA_RANGE) - Controls.raw_mouse_axis[i] = -MOUSEFS_DELTA_RANGE; - if (Controls.raw_mouse_axis[i] > MOUSEFS_DELTA_RANGE) - Controls.raw_mouse_axis[i] = MOUSEFS_DELTA_RANGE; + clamp_symmetric_value(Controls.raw_mouse_axis[i], MOUSEFS_DELTA_RANGE); if (Controls.raw_mouse_axis[i] > mouse_null_value) Controls.mouse_axis[i] = (((Controls.raw_mouse_axis[i] - mouse_null_value) * MOUSEFS_DELTA_RANGE) / (MOUSEFS_DELTA_RANGE - mouse_null_value) * frametime) / MOUSEFS_DELTA_RANGE; else if (Controls.raw_mouse_axis[i] < -mouse_null_value)