From: terencehill Date: Thu, 15 Jul 2010 08:36:34 +0000 (+0200) Subject: Minor cleanups X-Git-Tag: xonotic-v0.1.0preview~362^2~42 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=7846056e0048ad015777b15dfc59ab05460b8224 Minor cleanups - Remove obsolete var alpha - Remove stat_weapons and use directly its value, it's used only once - Make weapon_number local as it actually is - Initialize weapon_damage and weapon_hit when and where they are used - Remove acc_colors_debug --- diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 99419520e7..3c48fa2496 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -1372,7 +1372,7 @@ float GetAmmoTypeForWep(float i) } } -#define MAX_ACCURACY_LEVELS 10 // including implict levels 0 and 100 +#define MAX_ACCURACY_LEVELS 10 float acc_lev[MAX_ACCURACY_LEVELS]; void HUD_WeaponIcons(void) @@ -1382,14 +1382,12 @@ void HUD_WeaponIcons(void) float id = HUD_PANEL_WEAPONICONS; HUD_Panel_UpdateCvarsForId(id); - float alpha, stat_weapons; // "constants" vector pos, mySize; - float i, weapid, fade, weapon_stats, weapon_hit, weapon_damage, weapon_cnt; // variables + float i, weapid, fade, weapon_stats, weapon_number, weapon_cnt; pos = panel_pos; mySize = panel_size; - stat_weapons = getstati(STAT_WEAPONS); weapon_cnt = 0; for(i = WEP_FIRST; i <= WEP_LAST; ++i) { @@ -1481,11 +1479,6 @@ void HUD_WeaponIcons(void) self = weaponorder[i]; weapid = self.impulse; - alpha = (self.weapon == activeweapon) ? 1 : 0.6; - - weapon_hit = weapon_hits[self.weapon-WEP_FIRST]; - weapon_damage = weapon_fired[self.weapon-WEP_FIRST]; - // draw background behind currently selected weapon if(self.weapon == activeweapon) drawpic_aspect_skin(wpnpos, "weapon_current_bg", wpnsize, '1 1 1', fade * panel_fg_alpha, DRAWFLAG_NORMAL); @@ -1493,11 +1486,13 @@ void HUD_WeaponIcons(void) // draw the weapon accuracy if(acc_levels) { + float weapon_hit, weapon_damage; + weapon_damage = weapon_fired[self.weapon-WEP_FIRST]; if(weapon_damage) + { + weapon_hit = weapon_hits[self.weapon-WEP_FIRST]; weapon_stats = floor(100 * weapon_hit / weapon_damage); - - if (cvar("acc_colors_debug") >= 0) - weapon_stats = cvar("acc_colors_debug"); // TEST + } // find the max level lower than weapon_stats float j; @@ -1518,7 +1513,7 @@ void HUD_WeaponIcons(void) } // draw the weapon icon - if((self.impulse >= 0) && (stat_weapons & self.weapons)) + if((self.impulse >= 0) && (getstati(STAT_WEAPONS) & self.weapons)) { drawpic_aspect_skin(wpnpos, strcat("weapon", self.netname), wpnsize, '1 1 1', fade * panel_fg_alpha, DRAWFLAG_NORMAL); diff --git a/qcsrc/client/hud.qh b/qcsrc/client/hud.qh index 63ee81a96b..7d2f0e3085 100644 --- a/qcsrc/client/hud.qh +++ b/qcsrc/client/hud.qh @@ -16,7 +16,6 @@ float hud_color_bg_team; float scoreboard_bottom; float weapon_hits[WEP_MAXCOUNT]; float weapon_fired[WEP_MAXCOUNT]; -float weapon_number; float complain_weapon; string complain_weapon_name;