Merge branch 'master' into terencehill/infinite_ammo
authorterencehill <piuntn@gmail.com>
Thu, 19 May 2011 17:07:27 +0000 (19:07 +0200)
committerterencehill <piuntn@gmail.com>
Thu, 19 May 2011 17:07:27 +0000 (19:07 +0200)
Conflicts:
qcsrc/client/hud.qc

1  2 
qcsrc/client/hud.qc

@@@ -2004,28 -1088,67 +1093,69 @@@ void HUD_Ammo(void
                                return;
                        }
                }
-               return; // nothing to display
-       }
+               return; // nothing to display
+       }
+       stat_items = getstati(STAT_ITEMS);
++      if (stat_items & IT_UNLIMITED_WEAPON_AMMO)
++              infinite_ammo = TRUE;
+       for (i = 0; i < AMMO_COUNT; ++i) {
+               currently_selected = stat_items & GetAmmoItemCode(i);
 -              DrawAmmoItem(pos + eX * column * (ammo_size_x + offset_x) + eY * row * (ammo_size_y + offset_y), ammo_size, i, currently_selected);
++              DrawAmmoItem(pos + eX * column * (ammo_size_x + offset_x) + eY * row * (ammo_size_y + offset_y), ammo_size, i, currently_selected, infinite_ammo);
+               ++row;
+               if(row >= rows)
+               {
+                       row = 0;
+                       column = column + 1;
+               }
+       }
+ }
+ void DrawNumIcon(vector myPos, vector mySize, float x, string icon, float vertical, float icon_right_align, vector color, float alpha)
+ {
+       vector newPos, newSize;
+       vector picpos, numpos;
+       if (vertical)
+       {
+               if(mySize_y/mySize_x > 2)
+               {
+                       newSize_y = 2 * mySize_x;
+                       newSize_x = mySize_x;
+                       newPos_y = myPos_y + (mySize_y - newSize_y) / 2;
+                       newPos_x = myPos_x;
+               }
+               else
+               {
+                       newSize_x = 1/2 * mySize_y;
+                       newSize_y = mySize_y;
+                       newPos_x = myPos_x + (mySize_x - newSize_x) / 2;
+                       newPos_y = myPos_y;
+               }
  
-       stat_items = getstati(STAT_ITEMS);
-       if (stat_items & IT_UNLIMITED_WEAPON_AMMO)
-               infinite_ammo = TRUE;
-       for (i = 0; i < AMMO_COUNT; ++i) {
-               currently_selected = stat_items & GetAmmoItemCode(i);
-               DrawAmmoItem(pos + eX * column * (ammo_size_x + offset_x) + eY * row * (ammo_size_y + offset_y), ammo_size, i, currently_selected, infinite_ammo);
-               ++row;
-               if(row >= rows)
+               if(icon_right_align)
                {
-                       row = 0;
-                       column = column + 1;
+                       numpos = newPos;
+                       picpos = newPos + eY * newSize_x;
+               }
+               else
+               {
+                       picpos = newPos;
+                       numpos = newPos + eY * newSize_x;
                }
+               newSize_y /= 2;
+               drawpic_aspect_skin(picpos, icon, newSize, '1 1 1', panel_fg_alpha * alpha, DRAWFLAG_NORMAL);
+               // make number smaller than icon, it looks better
+               // reduce only y to draw numbers with different number of digits with the same y size
+               numpos_y += newSize_y * ((1 - 0.7) / 2);
+               newSize_y *= 0.7;
+               drawstring_aspect(numpos, ftos(x), newSize, color, panel_fg_alpha * alpha, DRAWFLAG_NORMAL);
+               return;
        }
- }
  
- void DrawNumIcon(float iconalign, vector myPos, vector mySize, float x, string icon, float left, vector color, float alpha)
- {
-       vector newPos;
-       float newSize_x, newSize_y;
        if(mySize_x/mySize_y > 3)
        {
                newSize_x = 3 * mySize_y;