float is_spec;\r
is_spec = (GetPlayerColor(pl.sv_entnum) == COLOR_SPECTATOR);\r
\r
- if((rgb == '1 1 1') && (!is_spec)) {\r
- rgb_x = cvar("sbar_color_bg_r") + 0.5;\r
- rgb_y = cvar("sbar_color_bg_g") + 0.5;\r
- rgb_z = cvar("sbar_color_bg_b") + 0.5; }\r
- \r
+ if((rgb == '1 1 1') && (!is_spec))\r
+ rgb = stov(cvar_string("sbar_color_bg")) + '0.5 0.5 0.5';\r
+\r
// Layout:\r
tmp_x = sbwidth;\r
tmp_y = sbar_fontsize_y * 1.25;\r
drawcolorcodedstring(pos, textShortenToWidth(str, 138, '11 11 0', stringwidth_colors), '11 11 0', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
}\r
\r
- if(field == ST_HEALTH)\r
- if(stof(str) > 0) {\r
+ if(field == ST_HEALTH) {\r
pos_x += 138;\r
if(pl.sv_entnum == player_localentnum - 1 || (spectatee_status && pl.sv_entnum == spectatee_status - 1))\r
drawcolorcodedstring(pos, "self", '11 11 0', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
float is_spec;\r
is_spec = (GetPlayerColor(pl.sv_entnum) == COLOR_SPECTATOR);\r
vector hl_rgb;\r
- hl_rgb_x = cvar("sbar_color_bg_r") + 0.5;\r
- hl_rgb_y = cvar("sbar_color_bg_g") + 0.5;\r
- hl_rgb_z = cvar("sbar_color_bg_b") + 0.5;\r
+ hl_rgb = stov(cvar_string("sbar_color_bg")) + '0.5 0.5 0.5';\r
\r
pos_y += sbar_fontsize_y;\r
drawstring(pos, strcat("Rankings"), sbar_fontsize, '1 1 1', sbar_scoreboard_alpha_fg, DRAWFLAG_NORMAL);\r
}\r
else\r
{\r
- rgb_x = cvar("sbar_color_bg_r");\r
- rgb_y = cvar("sbar_color_bg_g");\r
- rgb_z = cvar("sbar_color_bg_b");\r
+ rgb = stov(cvar_string("sbar_color_bg"));\r
\r
for(tm = teams.sort_next; tm; tm = tm.sort_next)\r
{\r
return 0;\r
}\r
\r
+float GetAmmoStat(float i)\r
+{\r
+ switch(i)\r
+ {\r
+ case 0: return STAT_FUEL;\r
+ default: return -1;\r
+ }\r
+}\r
+\r
+float GetAmmoItemCode(float i)\r
+{\r
+ switch(i)\r
+ {\r
+ case 0: return IT_FUEL;\r
+ default: return -1;\r
+ }\r
+}\r
+\r
+string GetAmmoPicture(float i)\r
+{\r
+ switch(i)\r
+ {\r
+ case 0:\r
+ if(getstati(STAT_ITEMS) & IT_FUEL_REGEN)\r
+ return "gfx/hud/sb_fuel_regen";\r
+ else\r
+ return "gfx/hud/sb_fuel";\r
+ default:\r
+ return "";\r
+ }\r
+}\r
+\r
float race_status_time;\r
float race_status_prev;\r
string race_status_name_prev;\r
}\r
}\r
\r
+void Sbar_Status()\r
+{\r
+ vector bottom;\r
+ bottom_x = vid_conwidth/2;\r
+ bottom_y = vid_conheight;\r
+ bottom_z = 0;\r
+\r
+ float armor, health, x, a;\r
+ armor = getstati(STAT_ARMOR);\r
+ health = getstati(STAT_HEALTH);\r
+\r
+ float stat_items;\r
+ stat_items = getstati(STAT_ITEMS);\r
+\r
+ vector health_pos, armor_pos, pos;\r
+ health_pos = bottom - '43 58 0';\r
+ armor_pos = bottom - '43 68 0';\r
+\r
+ if (cvar("viewsize") <= 100) {\r
+ if (teamplay)\r
+ drawpic(bottom - '96 96 0', "gfx/hud/bg_status", '192 96 0', GetTeamRGB(myteam) * sbar_color_bg_team, sbar_alpha_bg, DRAWFLAG_NORMAL); // hud color = myteam color\r
+ else {\r
+ // allow for custom HUD colors in non-teamgames\r
+ color = stov(cvar_string("sbar_color_bg"));\r
+\r
+ drawpic(bottom - '96 96 0', "gfx/hud/bg_status", '192 96 0', color, sbar_alpha_bg, DRAWFLAG_NORMAL);\r
+ }\r
+ }\r
+\r
+ // armor\r
+ x = armor;\r
+ if (x > 0)\r
+ {\r
+ drawpic(armor_pos + '-8 -13.5 0', "gfx/hud/sb_armor", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ armor_pos -= '1 0 0' * stringwidth(ftos(x), FALSE, '12 12 0') * 0.5;\r
+ Sbar_DrawXNum(armor_pos, x, 3, 0, 12, Sbar_NumColor(x), sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ }\r
+\r
+ // health\r
+ x = health;\r
+ drawpic(health_pos + '-11 16 0', "gfx/hud/sb_health", '32 32 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ health_pos -= '1 0 0' * stringwidth(ftos(x), FALSE, '22 22 0') * 0.5;\r
+ Sbar_DrawXNum(health_pos, x, 3, 0, 22, Sbar_NumColor(x), sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+\r
+ // ammo\r
+ pos_x = bottom_x + 140;\r
+ pos_y = bottom_y - 20;\r
+\r
+ float weapon_clipload, weapon_clipsize;\r
+ vector ammo_pos_offset;\r
+\r
+ // if we are using the jetpack, show fuel ammo. Otherwise show the ammo of our weapon\r
+ if(stat_items & IT_JETPACK && button_jetpack)\r
+ {\r
+ a = getstati(GetAmmoStat(0)); // how much fuel do we have?\r
+ drawpic(pos - '98 18 0', GetAmmoPicture(0), '20 20 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ ammo_pos_offset = '1 0 0' * stringwidth(ftos(a), FALSE, '16 16 0') * 0.5;\r
+ Sbar_DrawXNum(pos - '118 16 0' - ammo_pos_offset, a, 3, 0, 16, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ }\r
+ else\r
+ {\r
+ float i;\r
+ for (i = 0; i < 1; ++i)\r
+ {\r
+ if (stat_items & GetAmmoItemCode(i))\r
+ {\r
+ a = getstati(GetAmmoStat(i)); // how much ammo do we have of type i?\r
+ drawpic(pos - '98 18 0', GetAmmoPicture(i), '20 20 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ weapon_clipsize = getstati(STAT_WEAPON_CLIPSIZE);\r
+ // if the weapon we're holding is reloadable, show both its ammo and load\r
+ if(weapon_clipsize)\r
+ {\r
+ weapon_clipload = getstati(STAT_WEAPON_CLIPLOAD);\r
+ if(weapon_clipload < 0) // we're reloading\r
+ {\r
+ ammo_pos_offset = '1 0 0' * stringwidth("- -", FALSE, '16 16 0') * 0.5;\r
+ drawstring(pos - '118 23 0' - ammo_pos_offset, "- -", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ }\r
+ else\r
+ {\r
+ ammo_pos_offset = '1 0 0' * stringwidth(ftos(weapon_clipload), FALSE, '16 16 0') * 0.5;\r
+ Sbar_DrawXNum(pos - '118 23 0' - ammo_pos_offset, weapon_clipload, 2, 0, 16, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ }\r
+ ammo_pos_offset = '1 0 0' * stringwidth(ftos(a), FALSE, '12 12 0') * 0.5;\r
+ Sbar_DrawXNum(pos - '118 7 0' - ammo_pos_offset, a, 3, 0, 12, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ }\r
+ else\r
+ {\r
+ ammo_pos_offset = '1 0 0' * stringwidth(ftos(a), FALSE, '16 16 0') * 0.5;\r
+ Sbar_DrawXNum(pos - '118 16 0' - ammo_pos_offset, a, 3, 0, 16, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ // weapon icon\r
+ entity e;\r
+ e = get_weaponinfo(activeweapon);\r
+ if (e && e.netname != "" && e.netname != "N/A")\r
+ drawpic(bottom - '96 96 0', strcat("gfx/hud/bg_status_activeweapon_", e.netname), '192 96 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+}\r
+\r
void Sbar_Timer()\r
{\r
float timelimit, elapsedTime, minutes, seconds, timeleft, minutesLeft, secondsLeft;\r
if (teamplay)\r
drawpic(bgpos, "gfx/hud/bg_timer", '120 30 0' * scale, GetTeamRGB(myteam) * sbar_color_bg_team, sbar_alpha_bg, DRAWFLAG_NORMAL); // timer bg color = myteam color\r
else {\r
- color_x = cvar("sbar_color_bg_r");\r
- color_y = cvar("sbar_color_bg_g");\r
- color_z = cvar("sbar_color_bg_b");\r
+ color = stov(cvar_string("sbar_color_bg"));\r
\r
drawpic(bgpos, "gfx/hud/bg_timer", '120 30 0' * scale, color, sbar_alpha_bg, DRAWFLAG_NORMAL);\r
}\r
drawstring(position, text, scale, rgb, alpha, flag);\r
}\r
\r
-float GetAmmoStat(float i)\r
-{\r
- switch(i)\r
- {\r
- case 0: return STAT_FUEL;\r
- default: return -1;\r
- }\r
-}\r
-\r
-float GetAmmoItemCode(float i)\r
-{\r
- switch(i)\r
- {\r
- case 0: return IT_FUEL;\r
- default: return -1;\r
- }\r
-}\r
-\r
-string GetAmmoPicture(float i)\r
-{\r
- switch(i)\r
- {\r
- case 0:\r
- if(getstati(STAT_ITEMS) & IT_FUEL_REGEN)\r
- return "gfx/hud/sb_fuel_regen";\r
- else\r
- return "gfx/hud/sb_fuel";\r
- default:\r
- return "";\r
- }\r
-}\r
-\r
void Sbar_Reset (void)\r
{\r
// reset gametype specific icons\r
sbar_color_bg_team = cvar("sbar_color_bg_team");\r
\r
float weapon_stats;\r
- float x, fade;\r
- float stat_items, stat_weapons;\r
+ float fade;\r
\r
weapon_stats = getstati(STAT_DAMAGE_HITS);\r
weapon_number = weapon_stats & 63;\r
\r
if (teamplay)\r
color = GetTeamRGB(myteam) * sbar_color_bg_team;\r
- else {\r
- color_x = cvar("sbar_color_bg_r");\r
- color_y = cvar("sbar_color_bg_g");\r
- color_z = cvar("sbar_color_bg_b");\r
- }\r
+ else\r
+ color = stov(cvar_string("sbar_color_bg"));\r
\r
vector voteorigin = bottomright - '290 135 0';\r
vector votesize = '280 70 0';\r
Sbar_DrawScoreboard();\r
Sbar_Score();\r
Sbar_Timer();\r
+ if(getstati(STAT_VORE_EATEN))\r
+ Sbar_Status();\r
\r
Sbar_Reset();\r
\r
Sbar_DrawAccuracyStats();\r
else\r
Sbar_DrawScoreboard();\r
- float armor, health;\r
- armor = getstati(STAT_ARMOR);\r
- health = getstati(STAT_HEALTH);\r
-\r
- stat_items = getstati(STAT_ITEMS);\r
- stat_weapons = getstati(STAT_WEAPONS);\r
\r
fade = 3.2 - 2 * (time - weapontime);\r
fade = bound(0.7, fade, 1);\r
\r
+ if(getstati(STAT_HEALTH) > 0)\r
+ if(getstati(STAT_ARMOR) < g_power)\r
+ {\r
+ vector warn_pos;\r
+ warn_pos_x = vid_conwidth / 2;\r
+ warn_pos_y = vid_conheight - vid_conheight / 2.5;\r
+\r
+ drawpic(warn_pos - '128 0 0', "gfx/hud/bg_power_fail", '256 256 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ drawpic(warn_pos - '16 0 0' + '0 150 0', "gfx/hud/sb_power_fail_icon", '32 32 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+\r
+ return;\r
+ }\r
+\r
if(g_vore) // only when the vore system is active\r
{\r
// draw the stomach board\r
drawpic(bottomleft- '0 256 0', "gfx/hud/bg_stomach", '256 256 0', GetTeamRGB(myteam) * sbar_color_bg_team, sbar_alpha_bg, DRAWFLAG_NORMAL); // hud color = myteam color\r
else {\r
// allow for custom HUD colors in non-teamgames\r
- color_x = cvar("sbar_color_bg_r");\r
- color_y = cvar("sbar_color_bg_g");\r
- color_z = cvar("sbar_color_bg_b");\r
+ color = stov(cvar_string("sbar_color_bg"));\r
\r
drawpic(bottomleft - '0 256 0', "gfx/hud/bg_stomach", '256 256 0', color, sbar_alpha_bg, DRAWFLAG_NORMAL);\r
}\r
status_pos = bottomleft - '-43 168 0';\r
status_size = 16;\r
}\r
- else if(g_healthsize) // no point in showing it otherwise\r
+ else if(g_healthsize_center >= 0) // no point in showing it otherwise\r
{\r
status_text = strcat(status_color, ftos(stomach_maxload));\r
status_pos = bottomleft - '-43 170 0';\r
Sbar_PrintStomachboardItemPred(bottomleft - '-76 150 0', pred);\r
}\r
\r
- if (cvar("viewsize") <= 100) {\r
- if (teamplay)\r
- drawpic(bottom - '96 96 0', "gfx/hud/bg_status", '192 96 0', GetTeamRGB(myteam) * sbar_color_bg_team, sbar_alpha_bg, DRAWFLAG_NORMAL); // hud color = myteam color\r
- else {\r
- // allow for custom HUD colors in non-teamgames\r
- color_x = cvar("sbar_color_bg_r");\r
- color_y = cvar("sbar_color_bg_g");\r
- color_z = cvar("sbar_color_bg_b");\r
-\r
- drawpic(bottom - '96 96 0', "gfx/hud/bg_status", '192 96 0', color, sbar_alpha_bg, DRAWFLAG_NORMAL);\r
- }\r
- }\r
-\r
- vector health_pos, armor_pos;\r
- health_pos = bottom - '43 58 0';\r
- armor_pos = bottom - '43 68 0';\r
-\r
- // armor\r
- x = armor;\r
- if (x > 0)\r
- {\r
- drawpic(armor_pos + '-8 -13.5 0', "gfx/hud/sb_armor", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- armor_pos -= '1 0 0' * stringwidth(ftos(x), FALSE, '12 12 0') * 0.5;\r
- Sbar_DrawXNum(armor_pos, x, 3, 0, 12, Sbar_NumColor(x), sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- }\r
-\r
- // health\r
- x = health;\r
- drawpic(health_pos + '-11 16 0', "gfx/hud/sb_health", '32 32 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- health_pos -= '1 0 0' * stringwidth(ftos(x), FALSE, '22 22 0') * 0.5;\r
- Sbar_DrawXNum(health_pos, x, 3, 0, 22, Sbar_NumColor(x), sbar_alpha_fg, DRAWFLAG_NORMAL);\r
-\r
- // ammo\r
- pos_x = bottom_x + 140;\r
- pos_y = bottom_y - 20;\r
-\r
- float weapon_clipload, weapon_clipsize;\r
- vector ammo_pos_offset;\r
-\r
- // if we are using the jetpack, show fuel ammo. Otherwise show the ammo of our weapon\r
- if(stat_items & IT_JETPACK && button_jetpack)\r
- {\r
- a = getstati(GetAmmoStat(0)); // how much fuel do we have?\r
- drawpic(pos - '98 18 0', GetAmmoPicture(0), '20 20 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- ammo_pos_offset = '1 0 0' * stringwidth(ftos(a), FALSE, '16 16 0') * 0.5;\r
- Sbar_DrawXNum(pos - '118 16 0' - ammo_pos_offset, a, 3, 0, 16, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- }\r
- else\r
- {\r
- float i;\r
- for (i = 0; i < 1; ++i)\r
- {\r
- if (stat_items & GetAmmoItemCode(i))\r
- {\r
- a = getstati(GetAmmoStat(i)); // how much ammo do we have of type i?\r
- drawpic(pos - '98 18 0', GetAmmoPicture(i), '20 20 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- weapon_clipsize = getstati(STAT_WEAPON_CLIPSIZE);\r
-\r
- // if the weapon we're holding is reloadable, show both its ammo and load\r
- if(weapon_clipsize)\r
- {\r
- weapon_clipload = getstati(STAT_WEAPON_CLIPLOAD);\r
- if(weapon_clipload < 0) // we're reloading\r
- {\r
- ammo_pos_offset = '1 0 0' * stringwidth("- -", FALSE, '16 16 0') * 0.5;\r
- drawstring(pos - '118 23 0' - ammo_pos_offset, "- -", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- }\r
- else\r
- {\r
- ammo_pos_offset = '1 0 0' * stringwidth(ftos(weapon_clipload), FALSE, '16 16 0') * 0.5;\r
- Sbar_DrawXNum(pos - '118 23 0' - ammo_pos_offset, weapon_clipload, 2, 0, 16, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- }\r
- ammo_pos_offset = '1 0 0' * stringwidth(ftos(a), FALSE, '12 12 0') * 0.5;\r
- Sbar_DrawXNum(pos - '118 7 0' - ammo_pos_offset, a, 3, 0, 12, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- }\r
- else\r
- {\r
- ammo_pos_offset = '1 0 0' * stringwidth(ftos(a), FALSE, '16 16 0') * 0.5;\r
- Sbar_DrawXNum(pos - '118 16 0' - ammo_pos_offset, a, 3, 0, 16, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- }\r
- }\r
- }\r
- }\r
-\r
- // weapon icon\r
- entity e;\r
- e = get_weaponinfo(activeweapon);\r
- if (e && e.netname != "" && e.netname != "N/A")\r
- drawpic(bottom - '96 96 0', strcat("gfx/hud/bg_status_activeweapon_", e.netname), '192 96 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
-\r
- // draw scores, timer, and ring\r
+ // draw status, scores, timer, and ring\r
+ Sbar_Status();\r
Sbar_Score();\r
Sbar_Timer();\r
Sbar_Ring();\r