From: FruitieX Date: Tue, 18 May 2010 13:52:07 +0000 (+0300) Subject: draw accuracy bar as a background to the weapon icon, with the size == weapon icon... X-Git-Tag: xonotic-v0.1.0preview~541^2~146 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0b84c36300db7086740e3c31adba2b29504ecd90;p=xonotic%2Fxonotic-data.pk3dir.git draw accuracy bar as a background to the weapon icon, with the size == weapon icon size for better skinning options. Adapt accuracy bar from old HUD to this --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 4752f9100..c669f3f11 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -1341,7 +1341,6 @@ seta hud_weaponicons 1 "enable/disable this panel" seta hud_weaponicons_pos "-0.635295 -0.134116" "position of this panel" seta hud_weaponicons_size "0.352942 0.064845" "size of this panel" seta hud_weaponicons_number 1 "show number of weapon" -seta hud_weaponicons_accuracy_height 3 "height of accuracy bar" seta hud_weaponicons_accuracy_yellow 40 "percentage at which the accuracy color is yellow" seta hud_weaponicons_bg "" "if set to something else than \"\" = override default background, if set to 0 = disable background" seta hud_weaponicons_bg_color "" "optional R G B string of the background color, otherwise use hud default" diff --git a/gfx/hud/old/accuracy_bar.tga b/gfx/hud/old/accuracy_bar.tga deleted file mode 100644 index 96e853d70..000000000 Binary files a/gfx/hud/old/accuracy_bar.tga and /dev/null differ diff --git a/gfx/hud/old/weapon_accuracy.tga b/gfx/hud/old/weapon_accuracy.tga new file mode 100644 index 000000000..0e0c26f3e Binary files /dev/null and b/gfx/hud/old/weapon_accuracy.tga differ diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 7c13b9a92..e9c664a85 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -1150,13 +1150,12 @@ float weaponorder_cmp(float i, float j, entity pass) void HUD_WeaponIcons() { float id = 0; - float alpha, accuracybar_height, stat_weapons; // "constants" + float alpha, stat_weapons; // "constants" vector pos, mySize, accuracy_color; float i, weapid, fade, weapon_stats, weapon_hit, weapon_damage, weapon_cnt; // variables pos = HUD_Panel_GetPos(id); mySize = HUD_Panel_GetSize(id); - accuracybar_height = cvar_or("hud_weaponicons_accuracy_height", 3); stat_weapons = getstati(STAT_WEAPONS); for(i = WEP_FIRST; i <= WEP_LAST; ++i) @@ -1217,12 +1216,9 @@ void HUD_WeaponIcons() 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_skin(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), "weapon_current_bg", eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows), '1 1 1', fade * hud_alpha_fg, DRAWFLAG_NORMAL); - drawpic(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), strcat("gfx/weapons/weapon", self.netname), eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows), '1 1 1', fade * hud_alpha_fg, DRAWFLAG_NORMAL); - - if(cvar_or("hud_weaponicons_number", 1)) - drawstring(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), ftos(weapid), '1 1 0' * 0.5 * mySize_y*(1/rows), '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL); // draw the weapon accuracy on the HUD if(hud_accuracy_hud && !(gametype == GAME_RACE || gametype == GAME_CTS)) @@ -1232,8 +1228,14 @@ void HUD_WeaponIcons() accuracy_color = HUD_AccuracyColor(weapon_stats); if(weapon_damage) - drawpic_skin(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows) - '2 0 0' + eY * (mySize_y/rows - accuracybar_height), "accuracy_bar.tga", eX * mySize_x*(1/columns) + eY * accuracybar_height, accuracy_color, hud_alpha_fg, DRAWFLAG_NORMAL); + drawpic_skin(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), "weapon_accuracy", eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows), accuracy_color, hud_alpha_fg, DRAWFLAG_NORMAL); } + + // draw the weapon icon + drawpic(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), strcat("gfx/weapons/weapon", self.netname), eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows), '1 1 1', fade * hud_alpha_fg, DRAWFLAG_NORMAL); + + if(cvar_or("hud_weaponicons_number", 1)) + drawstring(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), ftos(weapid), '1 1 0' * 0.5 * mySize_y*(1/rows), '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL); } ++row;