From: terencehill Date: Tue, 2 Nov 2010 23:26:31 +0000 (+0100) Subject: No need to calculate the acc. color if it's not displayed anyway... (in the HUD weapo... X-Git-Tag: xonotic-v0.1.0preview~134^2~6^2~16 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2c951bdaed89b6c76e87d2b853311e362fa0bcd0;p=xonotic%2Fxonotic-data.pk3dir.git No need to calculate the acc. color if it's not displayed anyway... (in the HUD weapons panel) --- diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index f7c9c9fd0..43658f31b 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -1726,22 +1726,21 @@ void HUD_Weapons(void) { weapon_hit = weapon_hits[self.weapon-WEP_FIRST]; weapon_stats = floor(100 * weapon_hit / weapon_damage); - } - // find the max level lower than weapon_stats - float j; - j = acc_levels-1; - while ( j && weapon_stats < acc_lev[j] ) - --j; + // find the max level lower than weapon_stats + float j; + j = acc_levels-1; + while ( j && weapon_stats < acc_lev[j] ) + --j; - // inject color j+1 in color j, how much depending on how much weapon_stats is higher than level j - float factor; - factor = (weapon_stats - acc_lev[j]) / (acc_lev[j+1] - acc_lev[j]); - color = acc_col[j]; - color = color + factor * (acc_col[j+1] - color); + // inject color j+1 in color j, how much depending on how much weapon_stats is higher than level j + float factor; + factor = (weapon_stats - acc_lev[j]) / (acc_lev[j+1] - acc_lev[j]); + color = acc_col[j]; + color = color + factor * (acc_col[j+1] - color); - if(weapon_damage) drawpic_aspect_skin(wpnpos, "weapon_accuracy", wpnsize, color, panel_fg_alpha, DRAWFLAG_NORMAL); + } } // draw the weapon icon