From: FruitieX Date: Mon, 29 Nov 2010 10:10:11 +0000 (+0200) Subject: custom max values for the health/armor status bars X-Git-Tag: xonotic-v0.1.0preview~94^2~8 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=bc2db9f264c9e70133898e1495911b8658813e04;p=xonotic%2Fxonotic-data.pk3dir.git custom max values for the health/armor status bars --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 275c8a28f..a075ba8cb 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -1348,6 +1348,9 @@ seta hud_panel_weapons_ammo_full_fuel 100 "show 100% of the status bar at this a seta hud_panel_weapons_timeout "3" "panel disappears if you don't switch weapon for this amount of seconds" seta hud_panel_weapons_timeout_effect "1" "disappearance effect: 0) no effect; 1) panel moves out of screen; 2) panel fades out" +seta hud_panel_healtharmor_maxhealth "250" "when you have this much health, the health status bar is full" +seta hud_panel_healtharmor_maxarmor "150" "when you have this much armor, the armor status bar is full" + seta hud_panel_notify_time 10 "time that a new entry stays until it fades out" seta hud_panel_notify_fadetime 3 "fade out time" diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 01dc01663..cfcb369d7 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -2320,6 +2320,9 @@ void HUD_HealthArmor(void) float baralign = cvar("hud_panel_healtharmor_baralign"); float iconalign = cvar("hud_panel_healtharmor_iconalign"); float progressbar = cvar("hud_panel_healtharmor_progressbar"); + + float maxhealth = cvar("hud_panel_healtharmor_maxhealth"); + float maxarmor = cvar("hud_panel_healtharmor_maxarmor"); if(autocvar_hud_panel_healtharmor == 2) // combined health and armor display { vector v; @@ -2328,12 +2331,14 @@ void HUD_HealthArmor(void) float x; x = floor(v_x + 1); + float maxtotal = maxhealth + maxarmor; + if(baralign == 1 || baralign == 3) { // right align - barpos = pos + eX * mySize_x - eX * mySize_x * min(1, x/400); - barsize = eX * mySize_x * min(1, x/400) + eY * mySize_y; + barpos = pos + eX * mySize_x - eX * mySize_x * min(1, x/maxtotal); + barsize = eX * mySize_x * min(1, x/maxtotal) + eY * mySize_y; } else { // left align barpos = pos; - barsize = eX * mySize_x * min(1, x/400) + eY * mySize_y; + barsize = eX * mySize_x * min(1, x/maxtotal) + eY * mySize_y; } string biggercount; @@ -2359,7 +2364,7 @@ void HUD_HealthArmor(void) if(health) drawpic_aspect_skin(pos + eX * mySize_x - eX * 0.5 * mySize_y, "health", '0.5 0.5 0' * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); } - DrawNumIcon(iconalign, pos, mySize, x, biggercount, 1, HUD_Get_Num_Color(x, 2 * 200), 1); + DrawNumIcon(iconalign, pos, mySize, x, biggercount, 1, HUD_Get_Num_Color(x, maxtotal), 1); // fuel if(fuel) @@ -2379,6 +2384,7 @@ void HUD_HealthArmor(void) { string leftname, rightname; float leftcnt, rightcnt; + float leftmax, rightmax; float leftactive, rightactive; float leftalpha, rightalpha; float flip = cvar("hud_panel_healtharmor_flip"); @@ -2388,22 +2394,26 @@ void HUD_HealthArmor(void) if(leftcnt) leftactive = 1; leftalpha = min((armor+10)/55, 1); + leftmax = maxarmor; rightname = "health"; rightcnt = health; rightactive = 1; rightalpha = 1; + rightmax = maxhealth; } else { leftname = "health"; leftcnt = health; leftactive = 1; leftalpha = 1; + leftmax = maxhealth; rightname = "armor"; rightcnt = armor; if(rightcnt) rightactive = 1; rightalpha = min((armor+10)/55, 1); + rightmax = maxarmor; } if (mySize_x/mySize_y > 4) @@ -2411,11 +2421,11 @@ void HUD_HealthArmor(void) if(leftactive) { if(baralign == 1 || baralign == 3) { // right align - barpos = pos + eX * 0.5 * mySize_x - eX * 0.5 * mySize_x * min(1, leftcnt/200); - barsize = eX * 0.5 * mySize_x * min(1, leftcnt/200) + eY * mySize_y; + barpos = pos + eX * 0.5 * mySize_x - eX * 0.5 * mySize_x * min(1, leftcnt/leftmax); + barsize = eX * 0.5 * mySize_x * min(1, leftcnt/leftmax) + eY * mySize_y; } else { // left align barpos = pos; - barsize = eX * 0.5 * mySize_x * min(1, leftcnt/200) + eY * mySize_y; + barsize = eX * 0.5 * mySize_x * min(1, leftcnt/leftmax) + eY * mySize_y; } if(progressbar) @@ -2423,17 +2433,17 @@ void HUD_HealthArmor(void) HUD_Panel_GetProgressBarColorForString(leftname); HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); } - DrawNumIcon(iconalign, pos, eX * 0.5 * mySize_x + eY * mySize_y, leftcnt, leftname, 1, HUD_Get_Num_Color(leftcnt, 200), 1); + DrawNumIcon(iconalign, pos, eX * 0.5 * mySize_x + eY * mySize_y, leftcnt, leftname, 1, HUD_Get_Num_Color(leftcnt, leftmax), 1); } if(rightactive) { if(baralign == 0 || baralign == 3) { // left align barpos = pos + eX * 0.5 * mySize_x; - barsize = eX * 0.5 * mySize_x * min(1, rightcnt/200) + eY * mySize_y; + barsize = eX * 0.5 * mySize_x * min(1, rightcnt/rightmax) + eY * mySize_y; } else { // right align - barpos = pos + eX * mySize_x - eX * 0.5 * mySize_x * min(1, rightcnt/200); - barsize = eX * 0.5 * mySize_x * min(1, rightcnt/200) + eY * mySize_y; + barpos = pos + eX * mySize_x - eX * 0.5 * mySize_x * min(1, rightcnt/rightmax); + barsize = eX * 0.5 * mySize_x * min(1, rightcnt/rightmax) + eY * mySize_y; } if(progressbar) @@ -2441,7 +2451,7 @@ void HUD_HealthArmor(void) HUD_Panel_GetProgressBarColorForString(rightname); HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); } - DrawNumIcon(iconalign, pos + eX * 0.5 * mySize_x, eX * 0.5 * mySize_x + eY * mySize_y, rightcnt, rightname, 0, HUD_Get_Num_Color(rightcnt, 200), 1); + DrawNumIcon(iconalign, pos + eX * 0.5 * mySize_x, eX * 0.5 * mySize_x + eY * mySize_y, rightcnt, rightname, 0, HUD_Get_Num_Color(rightcnt, rightmax), 1); } if(fuel) @@ -2462,11 +2472,11 @@ void HUD_HealthArmor(void) if(leftactive) { if(baralign == 1 || baralign == 3) { // right align - barpos = pos + eX * mySize_x - eX * mySize_x * min(1, leftcnt/200); - barsize = eX * mySize_x * min(1, leftcnt/200) + eY * 0.5 * mySize_y; + barpos = pos + eX * mySize_x - eX * mySize_x * min(1, leftcnt/leftmax); + barsize = eX * mySize_x * min(1, leftcnt/leftmax) + eY * 0.5 * mySize_y; } else { // left align barpos = pos; - barsize = eX * mySize_x * min(1, leftcnt/200) + eY * 0.5 * mySize_y; + barsize = eX * mySize_x * min(1, leftcnt/leftmax) + eY * 0.5 * mySize_y; } if(progressbar) @@ -2474,17 +2484,17 @@ void HUD_HealthArmor(void) HUD_Panel_GetProgressBarColorForString(leftname); HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); } - DrawNumIcon(iconalign, pos, eX * mySize_x + eY * 0.5 * mySize_y, leftcnt, leftname, 1, HUD_Get_Num_Color(leftcnt, 200), 1); + DrawNumIcon(iconalign, pos, eX * mySize_x + eY * 0.5 * mySize_y, leftcnt, leftname, 1, HUD_Get_Num_Color(leftcnt, leftmax), 1); } if(rightactive) { if(baralign == 0 || baralign == 3) { // left align barpos = pos + eY * 0.5 * mySize_y; - barsize = eX * mySize_x * min(1, rightcnt/200) + eY * 0.5 * mySize_y; + barsize = eX * mySize_x * min(1, rightcnt/rightmax) + eY * 0.5 * mySize_y; } else { // right align - barpos = pos + eX * mySize_x - eX * mySize_x * min(1, rightcnt/200) + eY * 0.5 * mySize_y; - barsize = eX * mySize_x * min(1, rightcnt/200) + eY * 0.5 * mySize_y; + barpos = pos + eX * mySize_x - eX * mySize_x * min(1, rightcnt/rightmax) + eY * 0.5 * mySize_y; + barsize = eX * mySize_x * min(1, rightcnt/rightmax) + eY * 0.5 * mySize_y; } if(progressbar) @@ -2492,7 +2502,7 @@ void HUD_HealthArmor(void) HUD_Panel_GetProgressBarColorForString(rightname); HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); } - DrawNumIcon(iconalign, pos + eY * 0.5 * mySize_y, eX * mySize_x + eY * 0.5 * mySize_y, rightcnt, rightname, 0, HUD_Get_Num_Color(rightcnt, 200), 1); + DrawNumIcon(iconalign, pos + eY * 0.5 * mySize_y, eX * mySize_x + eY * 0.5 * mySize_y, rightcnt, rightname, 0, HUD_Get_Num_Color(rightcnt, rightmax), 1); } if(fuel) @@ -2513,11 +2523,11 @@ void HUD_HealthArmor(void) if(leftactive) { if(baralign == 1 || baralign == 3) { // down align - barpos = pos + eY * mySize_y - eY * mySize_y * min(1, leftcnt/200); - barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, leftcnt/200); + barpos = pos + eY * mySize_y - eY * mySize_y * min(1, leftcnt/leftmax); + barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, leftcnt/leftmax); } else { // up align barpos = pos; - barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, leftcnt/200); + barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, leftcnt/leftmax); } if(iconalign == 1 || iconalign == 3) { // down align @@ -2534,17 +2544,17 @@ void HUD_HealthArmor(void) HUD_Panel_DrawProgressBar(barpos, 1, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); } drawpic_aspect_skin(picpos, leftname, '0.4 0.4 0' * mySize_x, '1 1 1', leftalpha * panel_fg_alpha, DRAWFLAG_NORMAL); - drawstring_aspect(numpos, ftos(leftcnt), eX * 0.5 * mySize_x + eY * 0.25 * mySize_x, HUD_Get_Num_Color(leftcnt, 200), panel_fg_alpha, DRAWFLAG_NORMAL); + drawstring_aspect(numpos, ftos(leftcnt), eX * 0.5 * mySize_x + eY * 0.25 * mySize_x, HUD_Get_Num_Color(leftcnt, leftmax), panel_fg_alpha, DRAWFLAG_NORMAL); } if(rightactive) { if(baralign == 0 || baralign == 3) { // up align barpos = pos + eX * 0.5 * mySize_x; - barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, rightcnt/200); + barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, rightcnt/rightmax); } else { // down align - barpos = pos + eY * mySize_y - eY * mySize_y * min(1, rightcnt/200) + eX * 0.5 * mySize_x; - barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, rightcnt/200); + barpos = pos + eY * mySize_y - eY * mySize_y * min(1, rightcnt/rightmax) + eX * 0.5 * mySize_x; + barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, rightcnt/rightmax); } if(iconalign == 0 || iconalign == 3) { // up align @@ -2561,7 +2571,7 @@ void HUD_HealthArmor(void) HUD_Panel_DrawProgressBar(barpos, 1, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); } drawpic_aspect_skin(picpos, rightname, '0.4 0.4 0' * mySize_x, '1 1 1', rightalpha * panel_fg_alpha, DRAWFLAG_NORMAL); - drawstring_aspect(numpos, ftos(rightcnt), eX * 0.5 * mySize_x + eY * 0.25 * mySize_x, HUD_Get_Num_Color(rightcnt, 200), panel_fg_alpha, DRAWFLAG_NORMAL); + drawstring_aspect(numpos, ftos(rightcnt), eX * 0.5 * mySize_x + eY * 0.25 * mySize_x, HUD_Get_Num_Color(rightcnt, rightmax), panel_fg_alpha, DRAWFLAG_NORMAL); } if(fuel)