\r
void Sbar_DrawXNum (vector pos, float num, float digits, float showminusplus, float lettersize, vector rgb, float alpha, float dflags)\r
{\r
- float l, i;\r
- string str, tmp, l_length;\r
+ float l;\r
+ string str, tmp, l_length, final_num;\r
float minus, plus;\r
vector vsize;\r
\r
}\r
\r
if(minus)\r
- {\r
- drawstring(pos, "-", vsize, rgb, alpha, dflags);\r
- pos_x += lettersize / 2;\r
- } else if(plus)\r
- {\r
- drawstring(pos, "+", vsize, rgb, alpha, dflags);\r
- pos_x += lettersize / 2;\r
- }\r
+ final_num = "-";\r
+ else if(plus)\r
+ final_num = "+";\r
\r
- drawstring(pos, str, vsize, rgb, alpha, dflags);\r
+ final_num = strcat(final_num, str);\r
+ drawstring(pos, final_num, vsize, rgb, alpha, dflags);\r
}\r
\r
void Sbar_DrawXNum_Colored (vector pos, float x, float lettersize, float alpha)\r
\r
string str;\r
float f, field, field_number;\r
+ vector hl_color;\r
field_number = 3; // the number of components each row has\r
\r
for(fieldcounter = 1; fieldcounter <= field_number; ++fieldcounter)\r
if(field == ST_HIGHLIGHT)\r
{\r
if(getstati(STAT_VORE_EATEN))\r
- drawfill(pos - '0 0 0', '193 11 0', stov(cvar_string("sbar_stomachboard_color2")), cvar("sbar_stomachboard_highlight_alpha") * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ {\r
+ if(teamplay && GetPlayerColor(pl.entnum - 1) == GetPlayerColor(player_localentnum - 1)) // same team\r
+ hl_color = stov(cvar_string("sbar_stomachboard_color2"));\r
+ else\r
+ hl_color = stov(cvar_string("sbar_stomachboard_color3"));\r
+ }\r
else\r
- drawfill(pos - '0 0 0', '193 11 0', stov(cvar_string("sbar_stomachboard_color1")), cvar("sbar_stomachboard_highlight_alpha") * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ hl_color = stov(cvar_string("sbar_stomachboard_color1"));\r
+ drawfill(pos - '0 0 0', '193 11 0', hl_color, cvar("sbar_stomachboard_highlight_alpha") * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
}\r
\r
if(field == ST_NAME) {\r
void Sbar_Score()\r
{\r
float score, distribution, leader;\r
- vector score_pos, secondary_score_pos, distribution_color;\r
+ vector score_pos, secondary_score_pos, race_score_pos, distribution_color;\r
+ string racetime, secondary_racetime;\r
entity tm, pl, me;\r
me = (spectatee_status > 0) ? playerslots[spectatee_status - 1] : playerslots[player_localentnum - 1];\r
\r
score = me.(scores[ps_primary]);\r
\r
float racemin, racesec, racemsec;\r
- float distsec, distmsec, minusplus;\r
+ float distsec, distmsec;\r
+ string s_racemin, s_racesec, s_racemsec;\r
\r
racemin = floor(score/(60 * TIME_FACTOR));\r
racesec = floor((score - racemin*(60 * TIME_FACTOR))/TIME_FACTOR);\r
racemsec = score - racemin*60*TIME_FACTOR - racesec*TIME_FACTOR;\r
\r
+ if(racemin < 10) s_racemin = strcat("0", ftos(racemin));\r
+ else s_racemin = ftos(racemin);\r
+ if(racesec < 10) s_racesec = strcat("0", ftos(racesec));\r
+ else s_racesec = ftos(racesec);\r
+ if(racemsec < 10) s_racemsec = strcat("0", ftos(racemsec));\r
+ else s_racemsec = ftos(racemsec);\r
+\r
if (pl && ((!(scores_flags[ps_primary] & SFL_ZERO_IS_WORST)) || score)) {\r
// distribution display\r
distribution = me.(scores[ps_primary]) - pl.(scores[ps_primary]);\r
if (distribution < TIME_FACTOR && distribution > -TIME_FACTOR)\r
distmsec = fabs(distribution);\r
else {\r
- distsec = floor(fabs(distribution)/TIME_FACTOR);\r
- distmsec = fabs(distribution) - distsec*TIME_FACTOR;\r
- if (distribution < 0)\r
- distsec = -distsec;\r
+ distsec = floor(fabs(distribution) / TIME_FACTOR);\r
+ distmsec = fabs(distribution) - distsec * TIME_FACTOR;\r
}\r
\r
- if (distribution <= 0) {\r
+ if (distribution < 0) {\r
distribution_color = '0 1 0';\r
- minusplus = 1; // minusplus 1: always prefix with minus sign\r
+ secondary_racetime = "-"; // always prefix with minus sign\r
}\r
- else {\r
+ else if (distribution > 0) {\r
distribution_color = '1 0 0';\r
- minusplus = 2; // minusplus 1: always prefix with plus sign\r
+ secondary_racetime = "+"; // minusplus 1: always prefix with plus sign\r
}\r
- Sbar_DrawXNum(score_pos + '212 -4 0' - '16 0 0' * TIME_DECIMALS, distmsec, -TIME_DECIMALS, 0, 16, distribution_color, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- Sbar_DrawXNum(score_pos + '212 12 0' - '16 0 0' * TIME_DECIMALS, distsec, 4, minusplus, 16, distribution_color, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- }\r
+ else\r
+ distribution_color = '1 1 1';\r
\r
- Sbar_DrawXNum(score_pos + '192 0 0' - TIME_DECIMALS * '30 0 0', racemsec, -TIME_DECIMALS, 0, 30, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- Sbar_DrawXNum(score_pos + '192 0 0' - TIME_DECIMALS * '30 0 0' - '66 0 0', racesec, -2, 0, 30, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- drawstring(score_pos + '192 0 0' - TIME_DECIMALS * '30 0 0' - '21 0 0', ".", '30 30 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE);\r
+ secondary_racetime = strcat(secondary_racetime, ftos(distsec), ".", ftos(distmsec));\r
+ drawstring(score_pos + '222 0 0' - '14 0 0', secondary_racetime, '14 14 0', distribution_color, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ }\r
\r
- Sbar_DrawXNum(score_pos + '192 0 0' - TIME_DECIMALS * '30 0 0' - '132 0 0', racemin, -2, 0, 30, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- drawstring(score_pos + '192 0 0' - TIME_DECIMALS * '30 0 0' - '88 0 0', ":", '30 30 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE);\r
+ racetime = strcat(s_racemin, " : ", s_racesec, " . ", s_racemsec);\r
+ race_score_pos = top + '0 0 0';\r
+ race_score_pos -= '1 0 0' * stringwidth(racetime, FALSE, '30 30 0') * 0.5;\r
+ drawstring(race_score_pos, racetime, '30 30 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
\r
} else if (!teamplay) { // non-teamgames, except race/cts\r
// me vector := [team/connected frags id]\r
else\r
distribution_color = '1 0 0';\r
\r
- Sbar_DrawXNum(secondary_score_pos, distribution, 6, 0, 16, distribution_color, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ Sbar_DrawXNum(secondary_score_pos, distribution, 6, 3, 16, distribution_color, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
Sbar_DrawXNum(score_pos, score, 6, 0, 34, distribution_color, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
} else { // teamgames\r
float max_fragcount;\r
if(tm.team == myteam) {\r
if (max_fragcount == score)\r
leader = 1;\r
- Sbar_DrawXNum(score_pos, score, 6, 0, 34, GetTeamRGB(tm.team) * 0.8, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ Sbar_DrawXNum(score_pos, score, 6, 0, 34, GetTeamRGB(tm.team), sbar_alpha_fg, DRAWFLAG_NORMAL);\r
} else {\r
if (max_fragcount == score)\r
leader = 1;\r
- Sbar_DrawXNum(secondary_score_pos, score, 6, 0, 16, GetTeamRGB(tm.team) * 0.8, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ Sbar_DrawXNum(secondary_score_pos, score, 6, 3, 16, GetTeamRGB(tm.team), sbar_alpha_fg, DRAWFLAG_NORMAL);\r
secondary_score_pos = secondary_score_pos + '0 16 0';\r
}\r
}\r
void Sbar_Timer()\r
{\r
float timelimit, elapsedTime, minutes, seconds, timeleft, minutesLeft, secondsLeft;\r
- vector bgpos, timer_color;\r
+ vector pos, bgpos, timer_color;\r
+ string finaltime;\r
bgpos = '0 0 0';\r
\r
vector topright;\r
} else {\r
minutes = minutesLeft;\r
seconds = secondsLeft;\r
- if (minutes == 0)\r
- bgpos_x = topright_x - (36 + 7 + 12) * scale;\r
- else if (minutes < 10) // nudge the timer background left if more digits are drawn\r
+ if (minutes < 10) // nudge the timer background left if more digits are drawn\r
bgpos_x = topright_x - (54 + 17 + 12) * scale;\r
else if (minutes < 100)\r
- bgpos_x = topright_x - (72 + 17 + 12) * scale;\r
+ bgpos_x = topright_x - (62 + 17 + 12) * scale;\r
else\r
- bgpos_x = topright_x - (90 + 17 + 12) * scale;\r
+ bgpos_x = topright_x - (70 + 17 + 12) * scale;\r
bgpos_y = 0;\r
bgpos_z = 0;\r
}\r
}\r
\r
drawpic(topright - ('19 0 0' + '3 0 0' - '0 2 0'), "gfx/hud/sb_time", '22 22 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- if(minutesLeft >= 1 || cvar("sbar_increment_maptime") || timelimit == 0 || warmup_stage) {\r
- Sbar_DrawXNum(topright - ('50 -2 0' - '0 2 0') - (strlen(ftos(minutes)) * 18 * scale * '0.5 0 0'), minutes, 3, 0, 18 * scale, timer_color, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- drawstring(topright - ('48 -2 0' - '0 1 0'), ":", '18 18 0' * scale, timer_color, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- }\r
- Sbar_DrawXNum(topright - ('37 -2 0' + '3 0 0' - '0 2 0'), seconds, -2, 0, 18 * scale, timer_color, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ finaltime = strcat(ftos(minutes), ":");\r
+ if(seconds < 10)\r
+ finaltime = strcat(finaltime, "0", ftos(seconds));\r
+ else\r
+ finaltime = strcat(finaltime, ftos(seconds));\r
+\r
+ pos = topright - ('24 -2 0' + '3 0 0' - '0 2 0');\r
+ pos -= '1 0 0' * stringwidth(finaltime, FALSE, 18 * scale * '1 1 0');\r
+ drawstring(pos, finaltime, 18 * scale * '1 1 0', timer_color, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+}\r
+\r
+void Sbar_Ring()\r
+{\r
+ vector pos;\r
+ pos_x = vid_conwidth / 2;\r
+ pos_y = vid_conheight / 1.375;\r
+ pos_z = 0;\r
+\r
+ DrawCircleClippedPic(pos, 100, "gfx/hud/sb_ring.tga", 0.85, '1 1 1', 1 * sbar_alpha_fg, DRAWFLAG_ADDITIVE);\r
+\r
+ DrawCircleClippedPic(pos, 80, "gfx/hud/sb_ring.tga", 0.75, '1 1 1', 1 * sbar_alpha_fg, DRAWFLAG_ADDITIVE);\r
}\r
\r
void CSQC_Strength_Timer() {\r
{\r
drawpic(pos, "gfx/hud/sb_str", picsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE);\r
}\r
- Sbar_DrawXNum(pos - '20 -2 0', ceil(dt), 2, 0, countdown_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ Sbar_DrawXNum(pos - '30 -2 0', ceil(dt), 2, 0, countdown_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
}\r
else if(dt > -1)\r
{\r
{\r
drawpic(pos - '0 -22 0', "gfx/hud/sb_invinc", picsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE);\r
}\r
- Sbar_DrawXNum(pos - '20 -24 0', ceil(dt), 2, 0, countdown_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ Sbar_DrawXNum(pos - '30 -24 0', ceil(dt), 2, 0, countdown_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
}\r
else if(dt > -1)\r
{\r
}\r
}\r
\r
+ vector hl_color;\r
+ string hl_string;\r
if(getstati(STAT_VORE_EATEN))\r
{\r
- drawpic(bottomleft - '0 256 0', "gfx/hud/bg_stomach_status", '256 256 0', StomachStatus_ColorFade(stov(cvar_string("sbar_stomachboard_color2"))), cvar("sbar_stomachboard_status_alpha") * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- drawstring(bottomleft - '-80 173 0', "predator:", '11 11 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ if(teamplay && GetPlayerColor(getstati(STAT_VORE_EATEN) - 1) == GetPlayerColor(player_localentnum - 1)) // same team\r
+ hl_color = stov(cvar_string("sbar_stomachboard_color2"));\r
+ else\r
+ hl_color = stov(cvar_string("sbar_stomachboard_color3"));\r
+ hl_string = "predator:";\r
}\r
else\r
{\r
- drawpic(bottomleft - '0 256 0', "gfx/hud/bg_stomach_status", '256 256 0', StomachStatus_ColorFade(stov(cvar_string("sbar_stomachboard_color1"))), cvar("sbar_stomachboard_status_alpha") * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- drawstring(bottomleft - '-80 173 0', "self:", '11 11 0', ' 1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ hl_color = stov(cvar_string("sbar_stomachboard_color1"));\r
+ hl_string = "self:";\r
}\r
+ drawpic(bottomleft - '0 256 0', "gfx/hud/bg_stomach_status", '256 256 0', StomachStatus_ColorFade(hl_color), cvar("sbar_stomachboard_status_alpha") * sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ drawstring(bottomleft - '-80 173 0', hl_string, '11 11 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
\r
float stomach_load;\r
stomach_load = getstati(STAT_VORE_LOAD); // shows the predator's stomach load when we are eaten, and ours otherwise\r
\r
- Sbar_DrawXNum(bottomleft - '-26 171 0', bound(0, stomach_load, 9), 1, 0, 22, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- drawstring(bottomleft - '-41 171 0', "/", '22 22 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- Sbar_DrawXNum(bottomleft - '-50 171 0', bound(0, g_balance_vore_swallow_limit, 9), 1, 0, 22, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+ vector status_pos;\r
+ string status_text;\r
+ status_text = strcat(ftos(bound(0, stomach_load, 9)), "/", ftos(bound(0, g_balance_vore_swallow_limit, 9)));\r
+ status_pos = bottomleft - '-43 171 0';\r
+ status_pos -= '1 0 0' * stringwidth(status_text, FALSE, '22 22 0') * 0.5;\r
+ drawstring(status_pos, status_text, '22 22 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
\r
if(getstati(STAT_VORE_DIGESTING))\r
drawstring(bottomleft - '-76 142 0', "stomach digesting", '12 12 0', '1 0.5 0.5', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
}\r
\r
vector health_pos, armor_pos;\r
- health_pos = bottom - '60 58 0';\r
- armor_pos = bottom - '52.5 68 0';\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 + '0 -13.5 0', "gfx/hud/sb_armor", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- if(x < 100) armor_pos_x += 2.5; // always center\r
- if(x < 10) armor_pos_x += 2.5; // always center\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_Colored(armor_pos, x, 12, sbar_alpha_fg);\r
}\r
\r
// health\r
x = health;\r
- drawpic(health_pos + '4.5 16 0', "gfx/hud/sb_health", '32 32 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- if(x < 100) health_pos_x += 5; // always center\r
- if(x < 10) health_pos_x += 5; // always center\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_Colored(health_pos, x, 22, sbar_alpha_fg);\r
\r
// ammo\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
- Sbar_DrawXNum(pos - '128 16 0', a, 3, 0, 16, '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
{\r
weapon_clipload = getstati(STAT_WEAPON_CLIPLOAD);\r
if(weapon_clipload < 0) // we're reloading\r
- drawstring(pos - '128 23 0', "- -", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\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
- Sbar_DrawXNum(pos - '128 23 0', weapon_clipload, 2, 0, 16, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
- Sbar_DrawXNum(pos - '128 7 0', a, 3, 0, 12, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\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
- Sbar_DrawXNum(pos - '128 16 0', a, 3, 0, 16, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\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
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 and timer\r
+ // draw scores, timer, and ring\r
Sbar_Score();\r
Sbar_Timer();\r
+ Sbar_Ring();\r
\r
// draw strength/invincibility icon and timer\r
CSQC_Strength_Timer();\r