]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
health/armor fixes, inventory fixes
authorFruitieX <rasse@rasse-lappy.localdomain>
Sun, 2 May 2010 08:21:03 +0000 (11:21 +0300)
committerFruitieX <rasse@rasse-lappy.localdomain>
Sun, 2 May 2010 11:40:19 +0000 (14:40 +0300)
gfx/hud/sb_armor.tga
gfx/hud/sb_health.tga
qcsrc/client/hud.qc

index 669bbc84c6e6138a407aac98ccd0e3371f02171f..4801835a5df71a8e4c2057fc54cc82f5bb5e432f 100644 (file)
Binary files a/gfx/hud/sb_armor.tga and b/gfx/hud/sb_armor.tga differ
index 77286922495e3aa052417e31bbc0edb0c2f5dfad..1fd71d893dade72c4464abbc08a3e6b25189ef16 100644 (file)
Binary files a/gfx/hud/sb_health.tga and b/gfx/hud/sb_health.tga differ
index 241df8fb9f44500f2173bed602c167d46f643b7c..4a5a2d7bb279f0dfdbfc065303eb4fa3cc35160c 100644 (file)
@@ -560,6 +560,12 @@ vector HUD_Panel_CheckLimitSize(float id, vector mySize)
                        mySize_x = max(mySize_y * (1/10), mySize_x); // at least 1/10 * height
                        mySize_y = max(mySize_x * (1/26), mySize_y); // at least 1/26 * width
                        break;
+               case 1: 
+                       mySize_x = max(mySize_y * 0.7, mySize_x); // at least 0.7 * height
+                       break;
+               case 3: 
+                       mySize_x = max(mySize_y * 2, mySize_x); // at least 2 * height
+                       break;
        }
        return mySize;
 }
@@ -1329,6 +1335,7 @@ void HUD_HealthArmor(void)
        health = getstati(STAT_HEALTH);
        float numbers;
 
+       // TODO!
        if(hud_hudselector == 2) // combined health and armor display
        {
                vector v;
@@ -1357,11 +1364,11 @@ void HUD_HealthArmor(void)
        {
                vector health_pos, armor_pos;
 
+               // TODO!
                if (hud_hudselector == 0) { // old style layout with armor left of health
                        armor_pos = pos;
                        health_pos = pos + eX * 0.5 * mySize_x;
-               }
-               else {
+               } else {
                        health_pos = pos;
                        armor_pos = pos + eX * 0.5 * mySize_x;
                }
@@ -1371,12 +1378,7 @@ void HUD_HealthArmor(void)
                {
                        // armor
                        x = armor;
-                       if (x < 10)
-                               numbers = 1;
-                       else if (x < 100)
-                               numbers = 2;
-                       else
-                               numbers = 3;
+                       numbers = strlen(ftos(x));
 
                        if (x > 0)
                        {
@@ -1390,18 +1392,13 @@ void HUD_HealthArmor(void)
                        // health
                        x = health;
                        drawpic(pos + eX * mySize_x - eX * mySize_y, "gfx/hud/sb_health", '1 1 0' * mySize_y, '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
-                       HUD_DrawXNum_Colored(pos + eX * mySize_x - eX * 2.25 * mySize_y + eY * 0.25 * mySize_y, x, 3, 0.5 * mySize_y, hud_alpha_fg);
+                       HUD_DrawXNum_Colored(pos + eX * mySize_x - eX * 2.5 * mySize_y + eY * 0.25 * mySize_y, x, 3, 0.5 * mySize_y, hud_alpha_fg);
                }
                else if (mySize_x/mySize_y > 3.2)
                {
                        // armor
                        x = armor;
-                       if (x < 10)
-                               numbers = 1;
-                       else if (x < 100)
-                               numbers = 2;
-                       else
-                               numbers = 3;
+                       numbers = strlen(ftos(x));
 
                        if (x > 0)
                        {
@@ -1414,47 +1411,32 @@ void HUD_HealthArmor(void)
 
                        // health
                        x = health;
-                       if (x < 10)
-                               numbers = 1;
-                       else if (x < 100)
-                               numbers = 2;
-                       else
-                               numbers = 3;
+                       numbers = strlen(ftos(x));
 
-                       drawpic(pos + eX * mySize_x - eX * 1.22 * mySize_y, "gfx/hud/sb_health", '0.7 0.7 0' * mySize_y, '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
+                       drawpic(pos + eX * mySize_x - eX * 1.1 * mySize_y, "gfx/hud/sb_health", '0.7 0.7 0' * mySize_y, '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
                        HUD_DrawXNum_Colored(pos + eX * mySize_x - eX * numbers * 0.5 * mySize_y + eY * 0.55 * mySize_y, x, numbers, 0.5 * mySize_y, hud_alpha_fg);
                }
                else
                {
                        // armor
                        x = armor;
-                       if (x < 10)
-                               numbers = 1;
-                       else if (x < 100)
-                               numbers = 2;
-                       else
-                               numbers = 3;
+                       numbers = strlen(ftos(x));
 
                        if (x > 0)
                        {
                                if (x > 45)
-                                       drawpic(pos + eX * 0.4 * mySize_y, "gfx/hud/sb_armor", '0.7 0.7 0' * mySize_y, '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
+                                       drawpic(pos, "gfx/hud/sb_armor", '0.5 0.5 0' * mySize_y, '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
                                else
-                                       drawpic(pos + eX * 0.4 * mySize_y, "gfx/hud/sb_armor", '0.7 0.7 0' * mySize_y, '1 1 1', (x+10)/55 * hud_alpha_fg, DRAWFLAG_NORMAL);
-                               HUD_DrawXNum_Colored(pos + eY * 0.55 * mySize_y, x, numbers, 0.5 * mySize_y, hud_alpha_fg);
+                                       drawpic(pos, "gfx/hud/sb_armor", '0.5 0.5 0' * mySize_y, '1 1 1', (x+10)/55 * hud_alpha_fg, DRAWFLAG_NORMAL);
+                               HUD_DrawXNum_Colored(pos + eX * 0.5 * mySize_y, x, numbers, 0.5 * mySize_y, hud_alpha_fg);
                        }
 
                        // health
                        x = health;
-                       if (x < 10)
-                               numbers = 1;
-                       else if (x < 100)
-                               numbers = 2;
-                       else
-                               numbers = 3;
+                       numbers = strlen(ftos(x));
 
-                       drawpic(pos + eX * mySize_x - eX * 1.22 * mySize_y, "gfx/hud/sb_health", '0.7 0.7 0' * mySize_y, '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
-                       HUD_DrawXNum_Colored(pos + eX * mySize_x - eX * numbers * 0.5 * mySize_y + eY * 0.55 * mySize_y, x, numbers, 0.5 * mySize_y, hud_alpha_fg);
+                       drawpic(pos + eY * 0.5 * mySize_y, "gfx/hud/sb_health", '0.5 0.5 0' * mySize_y, '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
+                       HUD_DrawXNum_Colored(pos + eX * 0.5 * mySize_y + eY * 0.5 * mySize_y, x, numbers, 0.5 * mySize_y, hud_alpha_fg);
                }
        }
 }