draw accuracy bar as a background to the weapon icon, with the size == weapon icon...
authorFruitieX <rasse@rasse-lappy.localdomain>
Tue, 18 May 2010 13:52:07 +0000 (16:52 +0300)
committerFruitieX <rasse@rasse-lappy.localdomain>
Tue, 18 May 2010 13:52:07 +0000 (16:52 +0300)
defaultXonotic.cfg
gfx/hud/old/accuracy_bar.tga [deleted file]
gfx/hud/old/weapon_accuracy.tga [new file with mode: 0644]
qcsrc/client/hud.qc

index 4752f9100ea550ff61684be578d89da4e521e0eb..c669f3f111ba0b2804a7829cab431a14af60225d 100644 (file)
@@ -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 (file)
index 96e853d..0000000
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 (file)
index 0000000..0e0c26f
Binary files /dev/null and b/gfx/hud/old/weapon_accuracy.tga differ
index 7c13b9a922f931fa6cfbfa8ad126ac4fae5e5e84..e9c664a8584721500dd2270db82f0553f535a315 100644 (file)
@@ -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;