Makes math helpers defines for performance

This commit is contained in:
kevinz000
2018-12-06 16:15:00 -05:00
committed by VirgoBot
parent 4a27ffb35a
commit fc178c1e04
48 changed files with 1000 additions and 228 deletions
+4 -4
View File
@@ -152,7 +152,7 @@
// Makes shields become gradually more red as the projector's health decreases.
/obj/item/shield_projector/proc/update_shield_colors()
// This is done at the projector instead of the shields themselves to avoid needing to calculate this more than once every update.
var/lerp_weight = shield_health / max_shield_health
var/interpolate_weight = shield_health / max_shield_health
var/list/low_color_list = hex2rgb(low_color)
var/low_r = low_color_list[1]
@@ -164,9 +164,9 @@
var/high_g = high_color_list[2]
var/high_b = high_color_list[3]
var/new_r = Interpolate(low_r, high_r, weight = lerp_weight)
var/new_g = Interpolate(low_g, high_g, weight = lerp_weight)
var/new_b = Interpolate(low_b, high_b, weight = lerp_weight)
var/new_r = LERP(low_r, high_r, interpolate_weight)
var/new_g = LERP(low_g, high_g, interpolate_weight)
var/new_b = LERP(low_b, high_b, interpolate_weight)
var/new_color = rgb(new_r, new_g, new_b)