]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
add progressbar to combined health/armor mode and do various other tweaks to it...
authorFruitieX <rasse@rasse-lappy.localdomain>
Sun, 13 Jun 2010 09:20:30 +0000 (12:20 +0300)
committerFruitieX <rasse@rasse-lappy.localdomain>
Sun, 13 Jun 2010 09:20:30 +0000 (12:20 +0300)
qcsrc/client/hud.qc
qcsrc/menu/xonotic/dialog_hudpanel_healtharmor.c
qcsrc/menu/xonotic/dialog_hudsetup_exit.c

index 4135f65604d33779a3505d312ece43ebb77bc976..dc163b0884fd5cbd4bd8410f42d3721fd943adf5 100644 (file)
@@ -1857,6 +1857,9 @@ void HUD_HealthArmor(void)
                return;
 
        float len;
+       vector barpos, barsize;
+       vector picpos;
+       vector numpos;
 
        if(cvar("hud_healtharmor") == 2) // combined health and armor display
        {
@@ -1866,27 +1869,37 @@ void HUD_HealthArmor(void)
                float x;
                x = floor(v_x + 1);
 
+               if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+                       barpos = pos + eX * mySize_x - eX * mySize_x * min(1, x/400);
+                       barsize = eX * mySize_x * min(1, x/400) + eY * mySize_y;
+                       picpos = pos;
+                       numpos = picpos + eX * 1.5 * mySize_y;
+               } else {
+                       barpos = pos;
+                       barsize = eX * mySize_x * min(1, x/400) + eY * mySize_y;
+                       picpos = pos + eX * 3 * mySize_y;
+                       numpos = pos;
+               }
+
                if(v_z) // NOT fully armored
                {
-                       drawpic_skin(pos + eX * 3 * mySize_y, "health", '1 1 0' * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor("health"), cvar("hud_progressbar_alpha") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+                       drawpic_skin(picpos, "health", '1 1 0' * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
                        if(armor)
-                               drawpic_skin(pos + eX * 4 * mySize_y, "armor", '0.5 0.5 0' * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id) * armor / health, DRAWFLAG_NORMAL);
+                               drawpic_skin(picpos + eX * mySize_y, "armor", '0.5 0.5 0' * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id) * armor / health, DRAWFLAG_NORMAL);
                }
                else
                {
-                       drawpic_skin(pos + eX * 4 * mySize_y, "health", '0.5 0.5 0' * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id) * health / armor, DRAWFLAG_NORMAL);
+                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor("armor"), cvar("hud_progressbar_alpha") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+                       drawpic_skin(picpos + eX * mySize_y, "health", '0.5 0.5 0' * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id) * health / armor, DRAWFLAG_NORMAL);
                        if(armor)
-                               drawpic_skin(pos + eX * 3 * mySize_y, "armor", '1 1 0' * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+                               drawpic_skin(picpos, "armor", '1 1 0' * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
                }
-               HUD_DrawXNum_Colored(pos, x, 3, mySize_y, HUD_Panel_GetFgAlpha(id)); // draw the combined health and armor
+               HUD_DrawXNum_Colored(numpos, x, 3, mySize_y, HUD_Panel_GetFgAlpha(id)); // draw the combined health and armor
        }
 
        else
        {
-               vector barpos, barsize;
-               vector picpos;
-               vector numpos;
-
                string leftname, rightname;
                float leftcnt, rightcnt;
                float leftactive, rightactive;
index 45f8f589bb5570932dc2e5f706a5ae240e8c6034..246fd65f5c5f130281b1edee931e0184eedd1259 100644 (file)
@@ -15,19 +15,24 @@ void fillXonoticHUDHealthArmorDialog(entity me)
 {
        entity e;
        me.TR(me);
-               me.TR(me);
-                       me.TD(me, 1, 3, e = makeXonoticCheckBox(1, "hud_healtharmor", "On/Off"));
-               me.TR(me);
-                       me.TD(me, 1, 2, e = makeXonoticTextLabel(0, "Team Color:"));
-                               me.TD(me, 1, 2, e = makeXonoticSlider(0, 1, 0.01, "hud_healtharmor_bg_color_team"));
-               me.TR(me);
-                       me.TD(me, 1, 2, e = makeXonoticTextLabel(0, "Background Alpha:"));
-                               me.TD(me, 1, 2, e = makeXonoticSlider(0, 1, 0.01, "hud_healtharmor_bg_alpha"));
-               me.TR(me);
-                       me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_healtharmor_flip", "Flip"));
-               me.TR(me);
-                       me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_healtharmor_mirror", "Mirror"));
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Status:"));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("hud_healtharmor"));
+                       e.addValue(e, "Disabled", "0");
+                       e.addValue(e, "Enabled", "1");
+                       e.addValue(e, "Combined h/a", "2");
+                       e.configureXonoticTextSliderValues(e);
        me.TR(me);
+
+       me.TR(me);
+               me.TD(me, 1, 2, e = makeXonoticTextLabel(0, "Team Color:"));
+                       me.TD(me, 1, 2, e = makeXonoticSlider(0, 1, 0.01, "hud_healtharmor_bg_color_team"));
+       me.TR(me);
+               me.TD(me, 1, 2, e = makeXonoticTextLabel(0, "Background Alpha:"));
+                       me.TD(me, 1, 2, e = makeXonoticSlider(0, 1, 0.01, "hud_healtharmor_bg_alpha"));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_healtharmor_flip", "Flip"));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_healtharmor_mirror", "Mirror"));
        //me.gotoRC(me, me.rows - 1, 0);
                //me.TD(me, 1, me.columns, e = makeXonoticCommandButton("Exit Setup", '0 0 0', "_hud_configure 0", 1));
 }
index 8e58fd5ee02448438a3f7e7283b6d93759c44bc9..37dee5faf9a64f5019a1a94b6ee87113acbd596a 100644 (file)
@@ -16,7 +16,7 @@ void fillXonoticHUDExitDialog(entity me)
 {
        entity e;
        me.TR(me);
-               me.TD(me, 1, 4, makeXonoticTextLabel(0, "Panel Settings:"));
+               me.TD(me, 1, 4, makeXonoticTextLabel(0, "Panel Defaults:"));
                        me.TR(me);
                                me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_bg", "Panel Background"));
                        me.TR(me);