From: Martin Taibr Date: Fri, 11 Aug 2017 15:56:41 +0000 (+0200) Subject: rename variables in map_ranges() X-Git-Tag: xonotic-v0.8.5~2430^2~33 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9331ec285a9b265093093e132eeb35a246e78837;p=xonotic%2Fxonotic-data.pk3dir.git rename variables in map_ranges() --- diff --git a/qcsrc/lib/math.qh b/qcsrc/lib/math.qh index 85ae496e3..3e77b369f 100644 --- a/qcsrc/lib/math.qh +++ b/qcsrc/lib/math.qh @@ -329,10 +329,10 @@ vector solve_quadratic(float a, float b, float c) /// Max can be lower than min if you want to invert the range, values can be negative. ERASEABLE float map_ranges(float value, float src_min, float src_max, float dest_min, float dest_max) { - float velocity_diff = src_max - src_min; - float force_diff = dest_max - dest_min; - float ratio = (value - src_min) / velocity_diff; - return dest_min + force_diff * ratio; + float src_diff = src_max - src_min; + float dest_diff = dest_max - dest_min; + float ratio = (value - src_min) / src_diff; + return dest_min + dest_diff * ratio; } /// Same as `map_ranges` except that values outside the source range are clamped to min or max.