From: FruitieX Date: Sun, 13 Jun 2010 09:20:30 +0000 (+0300) Subject: add progressbar to combined health/armor mode and do various other tweaks to it... X-Git-Tag: xonotic-v0.1.0preview~541^2~54 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=35d5b5876ca4b31a13bac8e62e09cdff305c1bf6;p=xonotic%2Fxonotic-data.pk3dir.git add progressbar to combined health/armor mode and do various other tweaks to it... --- diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 4135f6560..dc163b088 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -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; diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_healtharmor.c b/qcsrc/menu/xonotic/dialog_hudpanel_healtharmor.c index 45f8f589b..246fd65f5 100644 --- a/qcsrc/menu/xonotic/dialog_hudpanel_healtharmor.c +++ b/qcsrc/menu/xonotic/dialog_hudpanel_healtharmor.c @@ -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)); } diff --git a/qcsrc/menu/xonotic/dialog_hudsetup_exit.c b/qcsrc/menu/xonotic/dialog_hudsetup_exit.c index 8e58fd5ee..37dee5faf 100644 --- a/qcsrc/menu/xonotic/dialog_hudsetup_exit.c +++ b/qcsrc/menu/xonotic/dialog_hudsetup_exit.c @@ -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);