5 float sb_lines; // still don't know what to do with that NOTE: check dp's sbar.c to see what that should be
9 float sbar_hudselector;
11 float ps_primary, ps_secondary;
12 float ts_primary, ts_secondary;
17 void Sbar_FinaleOverlay()
20 pos_x = (vid_conwidth - 1)/2;
24 //drawpic(pos, "gfx/finale", '0 0 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
26 //drawstring(pos, "END", sbar_fontsize, '1 1 1', 1, DRAWFLAG_NORMAL);
30 float weaponspace[10];
31 float weapon_first, weapon_last;
32 void Sbar_DrawWeapon_Clear()
37 for(idx = 0; idx < 10; ++idx)
39 for(idx = 0; idx <= 23; ++idx)
41 if(weaponimpulse[idx] >= 0)
49 void Sbar_DrawWeapon(float nr, float fade, float active)
51 vector pos, vsize, color;
52 float value, idx, imp, sp;
54 imp = weaponimpulse[nr];
60 value = (active) ? 1 : 0.6;
61 color_x = color_y = color_z = value;
63 if(sbar_hudselector == 1)
65 // width = 300, height = 100
66 const float w_width = 32, w_height = 12, w_space = 2, font_size = 8;
68 sp = weaponspace[idx] + 1;
69 weaponspace[idx] = sp;
71 pos_x = (vid_conwidth - w_width * 9) * 0.5 + w_width * idx;
72 pos_y = (vid_conheight - w_height * sp);
77 drawpic(pos, strcat("gfx/inv_weapon", ftos(nr)), vsize, color, value * fade * sbar_alpha_fg, 0);
83 drawstring(pos, ftos(imp), vsize, '1 1 0', sbar_alpha_fg, 0);
87 // width = 300, height = 100
88 const float w2_width = 300, w2_height = 100, w2_space = 10;
89 const float w2_scale = 0.4;
92 f = 9 / (weapon_last + 1 - weapon_first);
94 pos_x = vid_conwidth - (w2_width + w2_space) * w2_scale * f;
95 pos_y = (w2_height + w2_space) * w2_scale * nr * f + w2_space;
97 vsize_x = w2_width * w2_scale * f;
98 vsize_y = w2_height * w2_scale * f;
101 drawpic(pos, strcat("gfx/inv_weapon", ftos(nr)), vsize, color, value * fade * sbar_alpha_fg, 0);
104 void Sbar_DrawXNum (vector pos, float num, float digits, float lettersize, vector rgb, float a, float dflags)
111 vsize_x = vsize_y = lettersize;
126 str = strcat(substring("0000000000", 0, digits - strlen(tmp)), tmp);
134 str = substring(str, l-digits, 999);
136 } else if(l < digits)
137 pos_x += (digits-l) * lettersize;
141 drawpic(sbar + pos, "gfx/num_minus", vsize, rgb, a * sbar_alpha_fg, dflags);
145 for(i = 0; i < l; ++i)
147 drawpic(sbar + pos, strcat("gfx/num_", substring(str, i, 1)), vsize, rgb, a * sbar_alpha_fg, dflags);
152 void Cmd_Sbar_SetFields(float argc);
153 void Sbar_InitScores()
157 ps_primary = ps_secondary = ts_primary = ts_secondary = -1;
158 for(i = 0; i < MAX_SCORE; ++i)
160 f = (scores_flags[i] & SFL_SORT_PRIO_MASK);
161 if(f == SFL_SORT_PRIO_PRIMARY)
163 if(f == SFL_SORT_PRIO_SECONDARY)
166 if(ps_secondary == -1)
167 ps_secondary = ps_primary;
169 for(i = 0; i < MAX_TEAMSCORE; ++i)
171 f = (teamscores_flags[i] & SFL_SORT_PRIO_MASK);
172 if(f == SFL_SORT_PRIO_PRIMARY)
174 if(f == SFL_SORT_PRIO_SECONDARY)
177 if(ts_secondary == -1)
178 ts_secondary = ts_primary;
180 Cmd_Sbar_SetFields(0);
183 void Sbar_UpdatePlayerPos(entity pl);
184 float SetTeam(entity pl, float Team);
186 void Sbar_UpdatePlayerTeams()
193 for(pl = players.sort_next; pl; pl = pl.sort_next)
196 Team = GetPlayerColor(pl.sv_entnum);
197 if(SetTeam(pl, Team))
200 Sbar_UpdatePlayerPos(pl);
204 pl = players.sort_next;
209 print(strcat("PNUM: ", ftos(num), "\n"));
214 float Sbar_ComparePlayerScores(entity left, entity right)
217 vl = GetPlayerColor(left.sv_entnum);
218 vr = GetPlayerColor(right.sv_entnum);
225 if(vl == COLOR_SPECTATOR)
227 // FIRST the one with scores (spectators), THEN the ones without (downloaders)
229 if(!left.gotscores && right.gotscores)
234 vl = left.scores[ps_primary];
235 vr = right.scores[ps_primary];
236 if(scores_flags[ps_primary] & SFL_ZERO_IS_WORST)
238 if(vl == 0 && vr != 0)
240 if(vl != 0 && vr == 0)
244 return IS_INCREASING(scores_flags[ps_primary]);
246 return IS_DECREASING(scores_flags[ps_primary]);
248 vl = left.scores[ps_secondary];
249 vr = right.scores[ps_secondary];
250 if(scores_flags[ps_secondary] & SFL_ZERO_IS_WORST)
252 if(vl == 0 && vr != 0)
254 if(vl != 0 && vr == 0)
258 return IS_INCREASING(scores_flags[ps_secondary]);
260 return IS_DECREASING(scores_flags[ps_secondary]);
265 void Sbar_UpdatePlayerPos(entity player)
267 for(other = player.sort_next; other && Sbar_ComparePlayerScores(player, other); other = player.sort_next)
269 SORT_SWAP(player, other);
271 for(other = player.sort_prev; other != players && Sbar_ComparePlayerScores(other, player); other = player.sort_prev)
273 SORT_SWAP(other, player);
277 float Sbar_CompareTeamScores(entity left, entity right)
281 if(left.team == COLOR_SPECTATOR)
283 if(right.team == COLOR_SPECTATOR)
286 vl = left.teamscores[ts_primary];
287 vr = right.teamscores[ts_primary];
289 return IS_INCREASING(teamscores_flags[ts_primary]);
291 return IS_DECREASING(teamscores_flags[ts_primary]);
293 vl = left.teamscores[ts_secondary];
294 vr = right.teamscores[ts_secondary];
296 return IS_INCREASING(teamscores_flags[ts_secondary]);
298 return IS_DECREASING(teamscores_flags[ts_secondary]);
303 void Sbar_UpdateTeamPos(entity Team)
305 for(other = Team.sort_next; other && Sbar_CompareTeamScores(Team, other); other = Team.sort_next)
307 SORT_SWAP(Team, other);
309 for(other = Team.sort_prev; other != teams && Sbar_CompareTeamScores(other, Team); other = Team.sort_prev)
311 SORT_SWAP(other, Team);
315 void Cmd_Sbar_Help(float argc)
317 print("You can modify the scoreboard using the\n");
318 print("^3|---------------------------------------------------------------|\n");
319 print("^1 TO BE DONE\n");
321 print("^2sbar_columns_set default\n");
322 print("^2sbar_columns_set ^7filed1 field2 ...\n");
323 print("The following field names are recognized (case INsensitive):\n");
324 print("You can use a ^3|^7 to start the right-aligned fields.\n");
326 print("^3name^7 or ^3nick^7 Name of a player\n");
327 print("^3ping^7 Ping time\n\n");
328 print("^3kd^7 or ^3kdr^7 or ^3kdratio^7 or ^3k/d\n");
329 print(" The kill-death ratio\n");
331 print("Before a field you can put a + or - sign, then a comma separated list\n");
332 print("of game types, then a slash, to make the field show up only in these\n");
333 print("or in all but these game types.\n");
336 print("Additional columns:\n");
337 for(i = 0; i < MAX_SCORE; ++i)
339 if(scores_label[i] != "")
340 print(strcat(scores_label[i], "\n"));
344 #define MIN_NAMELEN 24
345 #define MAX_NAMELEN 24
347 string Sbar_DefaultColumnLayout()
349 return "ping pl name | -ctf,kh/kills -ctf,kh/deaths +kh/caps +kh/pushes +kh/destroyed +ctf/caps +ctf/pickups +ctf/fckills +ctf/returns -lms/score";
352 void Cmd_Sbar_SetFields(float argc)
355 string str, pattern, subpattern;
357 float have_name, have_primary, have_secondary, have_separator;
360 // TODO: re enable with gametype dependant cvars?
361 if(argc < 2) // no arguments provided
362 argc = tokenizebyseparator(strcat("x ", cvar_string("sbar_columns")), " ");
365 argc = tokenizebyseparator(strcat("x ", Sbar_DefaultColumnLayout()), " ");
369 if(argv(1) == "default")
370 argc = tokenizebyseparator(strcat("x ", Sbar_DefaultColumnLayout()), " ");
371 else if(argv(1) == "all")
374 s = "ping pl name |";
375 for(i = 0; i < MAX_SCORE; ++i)
378 if(i != ps_secondary)
379 if(scores_label[i] != "")
380 s = strcat(s, " ", scores_label[i]);
382 if(ps_secondary != ps_primary)
383 s = strcat(s, " ", scores_label[ps_secondary]);
384 s = strcat(s, " ", scores_label[ps_primary]);
385 argc = tokenizebyseparator(strcat("x ", s), " ");
390 argc = min(MAX_SBAR_FIELDS, argc);
393 drawfont = sbar_font;
394 digit = stringwidth("0123456789", FALSE) / 10;
396 subpattern = strcat(",", GametypeNameFromType(gametype), ",");
398 argc = min(argc-1, MAX_SBAR_FIELDS-1);
399 for(i = 0; i < argc; ++i)
403 slash = strstrofs(str, "/", 0);
406 pattern = substring(str, 0, slash);
407 str = substring(str, slash + 1, strlen(str) - (slash + 1));
409 if(substring(pattern, 0, 1) == "-")
411 pattern = substring(pattern, 1, strlen(pattern) - 1);
412 if(strstrofs(strcat(",", pattern, ","), subpattern, 0) >= 0)
417 if(substring(pattern, 0, 1) == "+")
418 pattern = substring(pattern, 1, strlen(pattern) - 1);
419 if(strstrofs(strcat(",", pattern, ","), subpattern, 0) < 0)
424 strunzone(sbar_title[sbar_num_fields]);
425 sbar_title[sbar_num_fields] = strzone(str);
426 sbar_size[sbar_num_fields] = stringwidth(str, FALSE);
427 str = strtolower(str);
430 sbar_field[sbar_num_fields] = SP_PING;
431 } else if(str == "pl") {
432 sbar_field[sbar_num_fields] = SP_PL;
433 } else if(str == "kd" || str == "kdr" || str == "kdratio" || str == "k/d") {
434 sbar_field[sbar_num_fields] = SP_KDRATIO;
435 } else if(str == "name" || str == "nick") {
436 sbar_field[sbar_num_fields] = SP_NAME;
437 sbar_size[sbar_num_fields] = MIN_NAMELEN; // minimum size? any use?
439 } else if(str == "|") {
440 sbar_field[sbar_num_fields] = SP_SEPARATOR;
443 for(j = 0; j < MAX_SCORE; ++j)
444 if(str == strtolower(scores_label[j]))
445 goto found; // sorry, but otherwise fteqcc -O3 miscompiles this and warns about "unreachable code"
447 print(strcat("^1Error:^7 Unknown score field: '", str, "'\n"));
450 sbar_field[sbar_num_fields] = j;
453 if(j == ps_secondary)
459 if(scores_flags[ps_primary] & SFL_ALLOW_HIDE)
461 if(scores_flags[ps_secondary] & SFL_ALLOW_HIDE)
463 if(ps_primary == ps_secondary)
465 missing = !have_primary + !have_secondary + !have_separator + !have_name;
467 if(sbar_num_fields+missing < MAX_SBAR_FIELDS)
471 strunzone(sbar_title[sbar_num_fields]);
472 for(i = sbar_num_fields; i > 0; --i)
474 sbar_title[i] = sbar_title[i-1];
475 sbar_size[i] = sbar_size[i-1];
476 sbar_field[i] = sbar_field[i-1];
478 sbar_title[0] = strzone("name");
479 sbar_field[0] = SP_NAME;
480 sbar_size[0] = MIN_NAMELEN; // minimum size? any use?
482 print("fixed missing field 'name'\n");
486 strunzone(sbar_title[sbar_num_fields]);
487 for(i = sbar_num_fields; i > 1; --i)
489 sbar_title[i] = sbar_title[i-1];
490 sbar_size[i] = sbar_size[i-1];
491 sbar_field[i] = sbar_field[i-1];
493 sbar_title[1] = strzone("|");
494 sbar_field[1] = SP_SEPARATOR;
495 sbar_size[1] = stringwidth("|", FALSE);
497 print("fixed missing field '|'\n");
500 else if(!have_separator)
502 strunzone(sbar_title[sbar_num_fields]);
503 sbar_title[sbar_num_fields] = strzone("|");
504 sbar_size[sbar_num_fields] = stringwidth("|", FALSE);
505 sbar_field[sbar_num_fields] = SP_SEPARATOR;
507 print("fixed missing field '|'\n");
512 strunzone(sbar_title[sbar_num_fields]);
513 sbar_title[sbar_num_fields] = strzone(scores_label[ps_secondary]);
514 sbar_size[sbar_num_fields] = stringwidth(sbar_title[sbar_num_fields], FALSE);
515 sbar_field[sbar_num_fields] = ps_secondary;
517 print("fixed missing field '", scores_label[ps_secondary], "'\n");
522 strunzone(sbar_title[sbar_num_fields]);
523 sbar_title[sbar_num_fields] = strzone(scores_label[ps_primary]);
524 sbar_size[sbar_num_fields] = stringwidth(sbar_title[sbar_num_fields], FALSE);
525 sbar_field[sbar_num_fields] = ps_primary;
527 print("fixed missing field '", scores_label[ps_primary], "'\n");
531 sbar_field[sbar_num_fields] = SP_END;
535 vector sbar_field_rgb;
536 string Sbar_GetField(entity pl, float field)
538 float tmp, num, denom, f;
540 sbar_field_rgb = '1 1 1';
545 return "\x8D\x8D\x8D"; // >>> sign
546 str = getplayerkey(pl.sv_entnum, "ping");
549 tmp = max(0, min(220, stof(str)-80)) / 220;
550 sbar_field_rgb = '1 1 1' - '0 1 1'*tmp;
556 str = getplayerkey(pl.sv_entnum, "pl");
559 tmp = bound(0, stof(str), 20) / 20; // 20% is REALLY BAD pl
560 sbar_field_rgb = '1 0.5 0.5' - '0 0.5 0.5'*tmp;
564 return getplayerkey(pl.sv_entnum, "name");
567 num = pl.(scores[SP_KILLS]);
568 denom = pl.(scores[SP_DEATHS]);
571 sbar_field_rgb = '0 1 0';
573 } else if(num <= 0) {
574 sbar_field_rgb = '1 0 0';
575 str = ftos(num/denom);
577 str = ftos(num/denom);
579 tmp = strstrofs(str, ".", 0);
581 str = substring(str, 0, tmp+2);
585 tmp = pl.(scores[field]);
586 f = scores_flags[field];
587 if(field == ps_primary)
588 sbar_field_rgb = '1 1 0';
589 else if(field == ps_secondary)
590 sbar_field_rgb = '0 1 1';
592 sbar_field_rgb = '1 1 1';
593 return ScoreString(f, tmp);
598 // shamelessly stolen from menu QC :P <- as if I would steal YOUR code pfft ;)
599 float textLengthUpToWidth(string theText, float maxWidth, float handleColors)
602 // The following function is SLOW.
603 // For your safety and for the protection of those around you...
604 // DO NOT CALL THIS AT HOME.
606 if(stringwidth(theText, handleColors) <= maxWidth)
607 return strlen(theText); // yeah!
609 // binary search for right place to cut string
610 float left, right, middle; // this always works
612 right = strlen(theText); // this always fails
615 middle = floor((left + right) / 2);
616 if(stringwidth(substring(theText, 0, middle), handleColors) <= maxWidth)
621 while(left < right - 1);
623 // NOTE: when color codes are involved, this binary search is,
624 // mathematically, BROKEN. However, it is obviously guaranteed to
625 // terminate, as the range still halves each time - but nevertheless, it is
626 // guaranteed that it finds ONE valid cutoff place (where "left" is in
627 // range, and "right" is outside).
631 string textShortenToWidth(string theText, float maxWidth, float handleColors)
633 if(stringwidth(theText, handleColors) <= maxWidth)
636 return strcat(substring(theText, 0, textLengthUpToWidth(theText, maxWidth - stringwidth("...", handleColors), handleColors)), "...");
639 float xmin, xmax, ymin, ymax, sbwidth;
641 void Sbar_PrintScoreboardItem(vector pos, entity pl, float is_self)
647 is_spec = (GetPlayerColor(pl.sv_entnum) == COLOR_SPECTATOR);
654 tmp_y = sbar_fontsize_y;
655 drawfill(pos - '1 1 0', tmp + '2 2 0', '1 1 1', 0.3, DRAWFLAG_NORMAL);
659 for(i = 0; i < sbar_num_fields; ++i)
661 field = sbar_field[i];
662 if(field == SP_SEPARATOR)
665 if(is_spec && field != SP_NAME && field != SP_PING) {
666 pos_x += sbar_fontsize_x*sbar_size[i] + sbar_fontsize_x;
669 str = Sbar_GetField(pl, field);
675 realsize = sbar_size[i];
676 if(i+1 < sbar_num_fields)
677 if(sbar_field[i+1] == SP_SEPARATOR)
679 realsize = (xmax - xmin) / sbar_fontsize_x;
680 for(j = 0; j < sbar_num_fields; ++j) if(j != i) if(sbar_field[j] != SP_SEPARATOR)
681 realsize -= sbar_size[j] + 1;
684 str = textShortenToWidth(str, realsize, TRUE);
686 len = stringwidth(str, TRUE);
688 if(sbar_size[i] < len)
691 pos_x += sbar_fontsize_x*sbar_size[i] + sbar_fontsize_x;
693 if(field == SP_NAME) {
694 tmp_x = sbar_fontsize_x*sbar_size[i] + sbar_fontsize_x;
695 drawcolorcodedstring(pos - tmp, str, sbar_fontsize, 1, DRAWFLAG_NORMAL);
697 tmp_x = len*sbar_fontsize_x + sbar_fontsize_x;
698 drawstring(pos - tmp, str, sbar_fontsize, sbar_field_rgb, 1, DRAWFLAG_NORMAL);
702 if(sbar_field[i] == SP_SEPARATOR)
705 for(i = sbar_num_fields-1; i > 0; --i)
707 field = sbar_field[i];
708 if(field == SP_SEPARATOR)
711 if(is_spec && field != SP_NAME && field != SP_PING) {
712 pos_x -= sbar_fontsize_x*sbar_size[i] + sbar_fontsize_x;
716 str = Sbar_GetField(pl, field);
719 str = textShortenToWidth(str, sbar_size[i], TRUE);
720 len = stringwidth(str, TRUE);
722 if(sbar_size[i] < len)
725 if(field == SP_NAME) {
726 tmp_x = sbar_fontsize_x*len; // left or right aligned? let's put it right...
727 drawcolorcodedstring(pos - tmp, str, sbar_fontsize, 1, DRAWFLAG_NORMAL);
729 tmp_x = sbar_fontsize_x*len; //strlen(str);
730 drawstring(pos - tmp, str, sbar_fontsize, sbar_field_rgb, 1, DRAWFLAG_NORMAL);
732 pos_x -= sbar_fontsize_x*sbar_size[i] + sbar_fontsize_x;
738 void Sbar_DrawScoreboard()
740 //float xmin, ymin, xmax, ymax;
741 vector rgb, pos, tmp, sbar_save;
746 if(time > lastpingstime + 10)
749 lastpingstime = time;
752 sbwidth = Sbar_GetWidth(6.5 * sbar_fontsize_y);
754 xmin = 0.5 * (vid_conwidth - sbwidth);
757 xmax = vid_conwidth - xmin;
758 ymax = vid_conheight - 0.2*vid_conheight;
760 center_x = xmin + 0.5*sbwidth;
762 //Sbar_UpdateFields();
764 // Initializes position
770 drawfont = sbar_bigfont;
771 pos_x = center_x - stringwidth("Scoreboard", TRUE)*0.5*24;
772 drawstring(pos, "Scoreboard", '24 24 0', '1 1 1', 1, DRAWFLAG_NORMAL);
776 // Titlebar background:
778 tmp_y = sbar_fontsize_y;
779 drawfill(pos - '1 1 0', tmp + '2 2 0', '0.5 0.5 0.5', 0.5, DRAWFLAG_NORMAL);
781 drawfont = sbar_font;
783 for(i = 0; i < sbar_num_fields; ++i)
785 if(sbar_field[i] == SP_SEPARATOR)
787 drawstring(pos, sbar_title[i], sbar_fontsize, '1 1 1', 1, DRAWFLAG_NORMAL);
788 pos_x += sbar_fontsize_x*sbar_size[i] + sbar_fontsize_x;
791 if(sbar_field[i] == SP_SEPARATOR)
793 pos_x = xmax + sbar_fontsize_x;
795 for(i = sbar_num_fields-1; i > 0; --i)
797 if(sbar_field[i] == SP_SEPARATOR)
800 pos_x -= sbar_fontsize_x*sbar_size[i] + sbar_fontsize_x;
803 * Using the following line will fuck it all up:
805 * tmp_x = sbar_size[i] - strlen(sbar_title[i])*8;
807 tmp_x = sbar_fontsize_x*sbar_size[i];
808 tmp_x -= stringwidth(sbar_title[i], FALSE)*sbar_fontsize_x;
809 drawstring(pos + tmp, sbar_title[i], sbar_fontsize, '1 1 1', 1, DRAWFLAG_NORMAL);
814 pos_y += 1.5 * sbar_fontsize_y;
821 //for(tm = sortedTeams.sort_next; tm; tm = tm.sort_next)
822 for(tm = teams.sort_next; tm; tm = tm.sort_next)
824 if(!tm.team_size || tm.team == COLOR_SPECTATOR)
827 rgb = GetTeamRGB(tm.team);
832 pos - '6.5 0 0' * sbar_fontsize_y,
833 tm.(teamscores[ts_primary]),
834 4, sbar_fontsize_y * 1.5, rgb, 1, DRAWFLAG_NORMAL);
836 if(ts_primary != ts_secondary)
838 pos - '4.5 0 0' * sbar_fontsize_y + '0 1.5 0' * sbar_fontsize_y,
839 tm.(teamscores[ts_secondary]),
840 4, sbar_fontsize_y * 1, rgb, 1, DRAWFLAG_NORMAL);
842 specs = tm.team_size;
848 tmp_y = 1.25 * sbar_fontsize_y * specs;
849 drawfill(pos - '1 1 0', tmp + '2 0 0', rgb, 0.2, DRAWFLAG_NORMAL);
851 for(pl = players.sort_next; pl; pl = pl.sort_next)
853 if(pl.team != tm.team)
855 Sbar_PrintScoreboardItem(pos, pl, (pl.sv_entnum == player_localentnum - 1));
856 pos_y += 1.25 * sbar_fontsize_y;
857 tmp_y -= 1.25 * sbar_fontsize_y;
859 pos_y += tmp_y + 1.5 * sbar_fontsize_y;
861 // rgb := tempvector :)
862 rgb = pos + '0 1.5 0' * sbar_fontsize_y;
863 pos_y += 3 * sbar_fontsize_y;
865 for(pl = players.sort_next; pl; pl = pl.sort_next)
867 if(pl.team != COLOR_SPECTATOR)
869 //drawcolorcodedstring(pos, getplayerkey(pl.sb_player, "name"), '8 8 0', 1, 0);
870 Sbar_PrintScoreboardItem(pos, pl, (pl.sv_entnum == player_localentnum - 1));
871 pos += '0 1.25 0' * sbar_fontsize_y;
876 drawstring(rgb, "Spectators", sbar_fontsize, '1 1 1', 1, 0);
879 for(pl = players.sort_next; pl; pl = pl.sort_next)
881 if(pl.team == COLOR_SPECTATOR)
883 Sbar_PrintScoreboardItem(pos, pl, (pl.sv_entnum == player_localentnum - 1));
884 pos_y += 1.25 * sbar_fontsize_y;
885 tmp_y -= 1.25 * sbar_fontsize_y;
888 // rgb := tempvector :)
889 rgb = pos + '0 1.5 0' * sbar_fontsize_y;
890 pos_y += 3 * sbar_fontsize_y;
892 for(pl = players.sort_next; pl; pl = pl.sort_next)
894 if(pl.team != COLOR_SPECTATOR)
896 Sbar_PrintScoreboardItem(pos, pl, (pl.sv_entnum == player_localentnum - 1));
897 pos += '0 1.25 0' * sbar_fontsize_y;
902 drawstring(rgb, "Spectators", sbar_fontsize, '1 1 1', 1, 0);
907 str = strcat("playing on ^2", shortmapname, "^7");
908 tl = getstatf(STAT_TIMELIMIT);
909 fl = getstatf(STAT_FRAGLIMIT);
910 if(gametype == GAME_LMS)
913 str = strcat(str, " for up to ^1", ftos(tl), " minutes^7");
918 str = strcat(str, " for ^1", ftos(tl), " minutes^7");
922 str = strcat(str, " or");
923 str = strcat(str, " until ^3", ScoreString(scores_flags[ps_primary], fl));
924 if(scores_label[ps_primary] == "score")
925 str = strcat(str, " points^7");
926 else if(scores_label[ps_primary] == "fastest")
927 str = strcat(str, " is beaten^7");
929 str = strcat(str, " ", scores_label[ps_primary]);
934 pos_y += 1.5 * sbar_fontsize_y;
935 drawcolorcodedstring(pos + '0.5 0 0' * (sbwidth - sbar_fontsize_x * stringwidth(str, TRUE)), str, sbar_fontsize, 0.8, 0);
940 string MakeRaceString(float cp, float mytime, float histime, float lapdelta, string hisname)
948 if(histime == 0) // goal hit
952 timestr = strcat("+", ftos_decimals(+mytime, 1));
962 timestr = strcat("-", ftos_decimals(-mytime, 1));
968 lapstr = strcat(" (-", ftos(lapdelta), "L)");
971 else if(lapdelta < 0)
973 lapstr = strcat(" (+", ftos(-lapdelta), "L)");
977 else if(histime > 0) // anticipation
979 if(mytime >= histime)
980 timestr = strcat("+", ftos_decimals(mytime - histime, 1));
982 timestr = mmsss(histime * 10);
989 cpname = strcat("Intermediate ", ftos(cp));
991 cpname = "Finish line";
994 return strcat(col, cpname);
995 else if(hisname == "")
996 return strcat(col, cpname, " (", timestr, ")");
998 return strcat(col, cpname, " (", timestr, " ", strcat(hisname, col, lapstr), ")");
1001 void dummyfunction(float a1, float a2, float a3, float a4, float a5, float a6, float a7, float a8)
1005 void Sbar_Score(float margin)
1007 float timelimit, timeleft, minutes, seconds, distribution, myplace, score;
1008 vector sbar_save, place;
1012 myteam = GetPlayerColor(player_localentnum - 1);
1014 sbar_y = vid_conheight - (32+12);
1017 place = '-48 -12 0';
1022 // team1 team3 team4
1025 //for(i = 0; i < 4; ++i)
1026 for(tm = teams.sort_next; tm; tm = tm.sort_next)
1028 if(tm.team == COLOR_SPECTATOR || !tm.team_size) // no players? don't display
1031 score = tm.(teamscores[ts_primary]);
1032 if(tm.team == myteam)
1033 Sbar_DrawXNum('-128 0 0', score, 4, 32, GetTeamRGB(tm.team), 1, DRAWFLAG_NORMAL);
1036 Sbar_DrawXNum(place, score, 4, 12, GetTeamRGB(tm.team), 1, DRAWFLAG_NORMAL);
1041 // me vector := [team/connected frags id]
1043 for(me = players.sort_next; me; me = me.sort_next)
1045 if(me.team != COLOR_SPECTATOR)
1047 if(me.sv_entnum == player_localentnum - 1)
1055 distribution = me.(scores[ps_primary]) - pl.(scores[ps_primary]);
1060 Sbar_DrawXNum('-36 -12 0', myplace, 3, 12, '1 1 1', 1, DRAWFLAG_NORMAL);
1061 else if(myplace == 2)
1062 Sbar_DrawXNum('-36 -12 0', myplace, 3, 12, '1 1 0', 1, DRAWFLAG_NORMAL);
1064 Sbar_DrawXNum('-36 -12 0', myplace, 3, 12, '1 0 0', 1, DRAWFLAG_NORMAL);
1066 score = me.(scores[ps_primary]);
1067 if(distribution >= 0)
1069 Sbar_DrawXNum('-84 -12 0', distribution, 4, 12, ' 1 1 1', 1, DRAWFLAG_NORMAL);
1070 Sbar_DrawXNum('-128 0 0', score, 4, 32, '1 1 1', 1, DRAWFLAG_NORMAL);
1071 } else if(distribution >= -5)
1073 Sbar_DrawXNum('-84 -12 0', distribution, 4, 12, ' 1 1 0', 1, DRAWFLAG_NORMAL);
1074 Sbar_DrawXNum('-128 0 0', score, 4, 32, '1 1 0', 1, DRAWFLAG_NORMAL);
1076 Sbar_DrawXNum('-84 -12 0', distribution, 4, 12, ' 1 0 0', 1, DRAWFLAG_NORMAL);
1077 Sbar_DrawXNum('-128 0 0', score, 4, 32, '1 0 0', 1, DRAWFLAG_NORMAL);
1080 timelimit = getstatf(STAT_TIMELIMIT);
1083 timeleft = max(0, timelimit * 60 + getstatf(STAT_GAMESTARTTIME) - time);
1084 timeleft = ceil(timeleft);
1085 minutes = floor(timeleft / 60);
1086 seconds = timeleft - minutes*60;
1089 Sbar_DrawXNum('-72 32 0', minutes, 3, 12, '1 1 1', 1, DRAWFLAG_NORMAL);
1090 drawpic(sbar + '-36 32 0', "gfx/num_colon", '12 12 0', '1 1 1', sbar_alpha_fg, 0);
1091 Sbar_DrawXNum('-24 32 0', seconds, -2, 12, '1 1 1', 1, DRAWFLAG_NORMAL);
1092 } else if(minutes >= 1)
1094 Sbar_DrawXNum('-72 32 0', minutes, 3, 12, '1 1 0', 1, DRAWFLAG_NORMAL);
1095 drawpic(sbar + '-36 32 0', "gfx/num_colon", '12 12 0', '1 1 0', sbar_alpha_fg, 0);
1096 Sbar_DrawXNum('-24 32 0', seconds, -2, 12, '1 1 0', 1, DRAWFLAG_NORMAL);
1098 Sbar_DrawXNum('-24 32 0', seconds, -2, 12, '1 0 0', 1, DRAWFLAG_NORMAL);
1101 minutes = floor(time / 60);
1102 seconds = floor(time - minutes*60);
1103 Sbar_DrawXNum('-72 32 0', minutes, 3, 12, '1 1 1', 1, DRAWFLAG_NORMAL);
1104 drawpic(sbar + '-36 32 0', "gfx/num_colon", '12 12 0', '1 1 1', sbar_alpha_fg, 0);
1105 Sbar_DrawXNum('-24 32 0', seconds, -2, 12, '1 1 1', 1, DRAWFLAG_NORMAL);
1108 if(gametype == GAME_RACE)
1110 drawfont = sbar_bigfont;
1113 string s, forcetime;
1115 m = '0.5 0 0' * vid_conwidth + '0 0.25 0' * vid_conheight;
1117 if(race_checkpointtime)
1120 a = bound(0, 2 - (time - race_checkpointtime), 1);
1123 if(a > 0) // just hit a checkpoint?
1125 if(race_time && race_previousbesttime)
1126 s = MakeRaceString(race_checkpoint, race_time / 10 - race_previousbesttime / 10, 0, 0, race_previousbestname);
1128 s = MakeRaceString(race_checkpoint, 0, -1, 0, race_previousbestname);
1130 forcetime = mmsss(race_time);
1134 if(race_laptime && race_nextbesttime)
1136 a = bound(0, 2 - ((race_laptime + race_nextbesttime/10) - time), 1);
1137 if(a > 0) // next one?
1139 s = MakeRaceString(race_nextcheckpoint, time - race_laptime, race_nextbesttime / 10, 0, race_nextbestname);
1144 if(s != "" && a > 0)
1146 dummyfunction(0, 0, 0, 0, 0, 0, 0, 0); // work around DP bug (set OFS_PARAM5 to 0)
1147 drawcolorcodedstring(m - '0 16 0' - '8 0 0' * stringwidth(s, TRUE), s, '16 16 0', sbar_alpha_fg * a, 0);
1153 a = bound(0, 1 - 2 * (time - race_checkpointtime), 1);
1154 sz = 1.2 / (a + 0.2);
1155 drawstring(m - '0 0 0' - '0 16 0' * (sz - 1) - '16 0 0' * sz * stringwidth(forcetime, FALSE), forcetime, '32 32 0' * sz, '1 1 1', sbar_alpha_fg * a, 0);
1163 s = mmsss(10*(time - race_laptime));
1164 drawstring(m - '0 0 0' - '16 0 0' * stringwidth(s, FALSE), s, '32 32 0', '1 1 1', sbar_alpha_fg * a, 0);
1169 if(race_mycheckpointtime)
1171 a = bound(0, 2 - (time - race_mycheckpointtime), 1);
1172 s = MakeRaceString(race_mycheckpoint, race_mycheckpointdelta / 10, -!race_mycheckpointenemy, race_mycheckpointlapsdelta, race_mycheckpointenemy);
1173 dummyfunction(0, 0, 0, 0, 0, 0, 0, 0); // work around DP bug (set OFS_PARAM5 to 0)
1174 drawcolorcodedstring(m - '0 16 0' - '8 0 0' * stringwidth(s, TRUE), s, '16 16 0', sbar_alpha_fg * a, 0);
1176 if(race_othercheckpointtime && race_othercheckpointenemy != "")
1178 a = bound(0, 2 - (time - race_othercheckpointtime), 1);
1179 s = MakeRaceString(race_othercheckpoint, -race_othercheckpointdelta / 10, -!race_othercheckpointenemy, race_othercheckpointlapsdelta, race_othercheckpointenemy);
1180 dummyfunction(0, 0, 0, 0, 0, 0, 0, 0); // work around DP bug (set OFS_PARAM5 to 0)
1181 drawcolorcodedstring(m - '0 0 0' - '8 0 0' * stringwidth(s, TRUE), s, '16 16 0', sbar_alpha_fg * a, 0);
1185 drawfont = sbar_font;
1191 void Sbar_MiniscoreItem(vector pos, entity pl, float is_self)
1197 drawfill(pos + '0 1 0', '40 6 0', GetTeamRGB(pl.team)*0.5, 1, DRAWFLAG_NORMAL);
1199 drawfill(pos + '0 1 0', '40 6 0', '0.5 0.5 0.5', 0.5, DRAWFLAG_NORMAL);
1202 score = pl.(scores[ps_primary]);
1203 pos_x -= stringwidth(ftos(score), FALSE)*8;
1204 drawstring(pos, ftos(score), '8 8 0', '1 1 1', 1, DRAWFLAG_NORMAL);
1209 drawstring(pos, "\x0D", '8 8 0', '1 1 1', 1, DRAWFLAG_NORMAL);
1213 drawcolorcodedstring(pos, getplayerkey(pl.sv_entnum, "name"), '8 8 0', 1, 0);
1216 void Sbar_MiniscoreTeamItem(vector pos, float color, float frags, float is_self)
1222 drawfill(pos + '0 1 0', '40 6 0', GetTeamRGB(color)*0.5, 1, DRAWFLAG_NORMAL);
1224 drawfill(pos + '0 1 0', '40 6 0', '0.5 0.5 0.5', 0.5, DRAWFLAG_NORMAL);
1227 pos_x -= stringwidth(ftos(frags), FALSE)*8;
1228 drawstring(pos, ftos(frags), '8 8 0', '1 1 1', 1, DRAWFLAG_NORMAL);
1233 drawstring(pos, "\x0D", '8 8 0', '1 1 1', 1, DRAWFLAG_NORMAL);
1237 drawstring(pos, GetTeamName(color), '8 8 0', '1 1 1', 1, DRAWFLAG_NORMAL);
1240 void Sbar_MiniDeathmatchOverlay(vector pos)
1242 float numlines, up, down, score;
1244 float miniscoreboard_size;
1245 miniscoreboard_size = cvar("sbar_miniscoreboard_size");
1247 if(miniscoreboard_size == 0)
1249 pos_y = vid_conheight - 8;
1251 if(miniscoreboard_size < 0)
1252 numlines = (vid_conheight - sbar_y + 7) / 8;
1254 numlines = miniscoreboard_size;
1256 // give up if there isn't enough room
1257 if(pos_x >= vid_conwidth || pos_y >= vid_conheight || numlines < 1)
1260 // me vector := [team/connected frags id]
1261 for(me = players.sort_next; me; me = me.sort_next)
1263 if(me.sv_entnum == player_localentnum - 1)
1268 numlines -= numteams;
1270 // figure out how many players above and below we can show
1271 up = floor(numlines/2);
1273 if((up + down) > numlines)
1274 down = numlines - up;
1277 for(pl = me.sort_next; pl && down > 0; pl = pl.sort_next)
1279 if(pl.team == COLOR_SPECTATOR)
1281 Sbar_MiniscoreItem(pos, pl, false);
1285 Sbar_MiniscoreItem(pos, me, true);
1287 up += down; // if there weren't enough lines below... add them
1288 for(pl = me.sort_prev; pl && up > 0; pl = pl.sort_prev)
1290 if(pl.team == COLOR_SPECTATOR)
1292 Sbar_MiniscoreItem(pos, pl, false);
1299 for(tm = teams.sort_next; tm.sort_next; tm = tm.sort_next);
1300 for(; tm; tm = tm.sort_prev)
1302 if(!tm.team_size || tm.team == COLOR_SPECTATOR)
1304 score = tm.(teamscores[ts_primary]);
1305 Sbar_MiniscoreTeamItem(pos, tm.team, score, (tm.team == me.team));
1311 float Sbar_WouldDrawScoreboard ()
1315 else if (intermission == 1)
1317 else if (intermission == 2)
1319 else if (getstati(STAT_HEALTH) <= 0 && cvar("cl_deathscoreboard"))
1321 else if(sb_showscores_force)
1326 vector Sbar_DrawNoteLine(vector offset, string s)
1328 dummyfunction(0, 0, 0, 0, 0, 0, 0, 0); // work around DP bug (set OFS_PARAM5 to 0)
1329 drawcolorcodedstring(
1330 offset - sbar_fontsize_x * '1 0 0' * stringwidth(s, TRUE),
1336 return offset + sbar_fontsize_y * '0 1 0';
1339 void Sbar_Draw (void)
1343 float stat_items, stat_weapons;
1344 vector o; o = '1 0 0' * vid_conwidth;
1347 sbar_fontsize = Sbar_GetFontsize();
1349 if(spectatee_status)
1351 if(spectatee_status == -1)
1354 s = strcat("^1Spectating ^7", getplayerkey(spectatee_status - 1, "name"));
1355 o = Sbar_DrawNoteLine(o, s);
1357 if(spectatee_status == -1)
1358 s = strcat("^1Press ^3", getcommandkey("primary fire", "+attack"), "^1 to spectate");
1360 s = strcat("^1Press ^3", getcommandkey("primary fire", "+attack"), "^1 for another player");
1361 o = Sbar_DrawNoteLine(o, s);
1363 if(spectatee_status == -1)
1364 s = strcat("^1Use ^3", getcommandkey("next weapon", "weapnext"), "^1 or ^3", getcommandkey("previous weapon", "weapprev"), "^1 to change the speed");
1366 s = strcat("^1Press ^3", getcommandkey("secondary fire", "+attack2"), "^1 to observe");
1367 o = Sbar_DrawNoteLine(o, s);
1369 if(gametype == GAME_ARENA)
1370 s = "^1Wait for your turn to join";
1371 else if(gametype == GAME_LMS)
1374 sk = playerslots[player_localentnum - 1];
1375 if(sk.(scores[ps_primary]) >= 666)
1376 s = "^1Match has already begun";
1377 else if(sk.(scores[ps_primary]) > 0)
1378 s = "^1You have no more lives left";
1380 s = strcat("^1Press ^3", getcommandkey("jump", "+jump"), "^1 to join");
1383 s = strcat("^1Press ^3", getcommandkey("jump", "+jump"), "^1 to join");
1384 o = Sbar_DrawNoteLine(o, s);
1389 if(ready_waiting_for_me)
1392 s = strcat("^2Press ^3", getcommandkey("ready", "ready"), "^2 to end warmup");
1394 s = strcat("^2Press ^3", getcommandkey("ready", "ready"), "^2 once you are ready");
1399 s = strcat("^2Waiting for others to ready up to end warmup...");
1401 s = strcat("^2Waiting for others to ready up...");
1403 o = Sbar_DrawNoteLine(o, s);
1407 s = strcat("^2A vote has been called for ^1", vote_called_vote);
1408 o = Sbar_DrawNoteLine(o, s);
1410 if(vote_waiting_for_me)
1412 s = strcat("^2Press ^3", getcommandkey("vote yes", "vyes"), "^2 to accept");
1413 o = Sbar_DrawNoteLine(o, s);
1415 s = strcat("^2Press ^3", getcommandkey("vote no", "vno"), "^2 to reject");
1416 o = Sbar_DrawNoteLine(o, s);
1418 s = strcat("^2Press ^3", getcommandkey("vote abstain", "vabstain"), "^2 to abstain");
1419 o = Sbar_DrawNoteLine(o, s);
1423 s = strcat("^2Waiting for others to vote...");
1424 o = Sbar_DrawNoteLine(o, s);
1429 Sbar_UpdatePlayerTeams();
1434 Sbar_DrawScoreboard();
1435 else if (intermission == 1)
1437 Sbar_DrawScoreboard();
1440 else if (intermission == 2)
1441 Sbar_FinaleOverlay();
1444 if (sb_showscores || sb_showscores_force || (getstati(STAT_HEALTH) <= 0 && cvar("cl_deathscoreboard")))
1446 sbar_x = (vid_conwidth - 640.0)*0.5;
1447 sbar_y = vid_conheight - 47;
1448 //Sbar_DrawAlphaPic (sbar_x, sbar_y, sb_scorebar, sbar_alpha_bg.value);
1449 //drawpic('0 0 0', "gfx/scorebar", '0 0 0', '1 1 1', cvar("sbar_alpha_bg"), 0);
1450 Sbar_DrawScoreboard ();
1454 if (sb_lines && sbar_hudselector == 1)
1456 stat_items = getstati(STAT_ITEMS);
1457 stat_weapons = getstati(STAT_WEAPONS);
1459 sbar_x = (vid_conwidth - 320.0)*0.5;
1460 sbar_y = vid_conheight - 24.0 - 16.0;
1463 fade = 3.2 - 2 * (time - weapontime);
1464 fade = bound(0.7, fade, 1);
1467 Sbar_DrawWeapon_Clear();
1468 for(i = 1; i <= 24; ++i)
1470 if(weaponimpulse[i-1] >= 0)
1471 if(stat_weapons & x)
1473 Sbar_DrawWeapon(i-1, fade, (i == activeweapon));
1479 x = getstati(STAT_ARMOR);
1483 //Sbar_DrawStretchPic (72, 0, sb_armor[0], sbar_alpha_fg.value, 24, 24);
1484 drawpic(sbar + '72 0 0', "gfx/sb_armor", '24 24 0', '1 1 1', sbar_alpha_fg, 0);
1486 Sbar_DrawXNum('0 0 0', x, 3, 24, '0 1 0', 1, 0);
1488 Sbar_DrawXNum('0 0 0', x, 3, 24, '0.2 1 0', 1, 0);
1490 Sbar_DrawXNum('0 0 0', x, 3, 24, '0.6 0.7 0.8', 1, 0);
1492 Sbar_DrawXNum('0 0 0', x, 3, 24, '1 1 0.2', 1, 0);
1494 Sbar_DrawXNum('0 0 0', x, 3, 24, '0.7 0 0', 1, 0);
1498 x = getstati(STAT_HEALTH);
1502 //Sbar_DrawStretchPic (184, 0, sb_health, sbar_alpha_fg.value, 24, 24);
1503 drawpic(sbar + '184 0 0', "gfx/sb_health", '24 24 0', '1 1 1', sbar_alpha_fg, 0);
1505 Sbar_DrawXNum('112 0 0', x, 3, 24, '0 1 0', 1, 0);
1507 Sbar_DrawXNum('112 0 0', x, 3, 24, '0.2 1 0', 1, 0);
1509 Sbar_DrawXNum('112 0 0', x, 3, 24, '0.6 0.7 0.8', 1, 0);
1511 Sbar_DrawXNum('112 0 0', x, 3, 24, '1 1 0.2', 1, 0);
1513 Sbar_DrawXNum('112 0 0', x, 3, 24, '0.7 0 0', 1, 0);
1517 x = getstati(STAT_AMMO);
1518 if ((stat_items & IT_AMMO) || x != 0)
1520 if (stat_items & IT_SHELLS)
1521 drawpic(sbar + '296 0 0', "gfx/sb_shells", '24 24 0', '1 1 1', sbar_alpha_fg, 0);
1522 else if (stat_items & IT_NAILS)
1523 drawpic(sbar + '296 0 0', "gfx/sb_bullets", '24 24 0', '1 1 1', sbar_alpha_fg, 0);
1524 else if (stat_items & IT_ROCKETS)
1525 drawpic(sbar + '296 0 0', "gfx/sb_rocket", '24 24 0', '1 1 1', sbar_alpha_fg, 0);
1526 else if (stat_items & IT_CELLS)
1527 drawpic(sbar + '296 0 0', "gfx/sb_cells", '24 24 0', '1 1 1', sbar_alpha_fg, 0);
1529 Sbar_DrawXNum('224 0 0', x, 3, 24, '0.6 0.7 0.8', 1, 0);
1531 Sbar_DrawXNum('224 0 0', x, 3, 24, '0.7 0 0', 1, 0);
1534 if (sbar_x + 320 + 160 <= vid_conwidth)
1535 Sbar_MiniDeathmatchOverlay(sbar + '320 0 0');
1538 // The margin can be at most 8 to support 640x480 console size:
1539 // 320 + 2 * (144 + 16) = 640
1544 stat_items = getstati(STAT_ITEMS);
1545 stat_weapons = getstati(STAT_WEAPONS);
1547 sbar_x = (vid_conwidth - 640.0)*0.5;
1548 sbar_y = vid_conheight - 47;
1551 fade = 3 - 2 * (time - weapontime);
1554 Sbar_DrawWeapon_Clear();
1555 for(i = 1; i <= 24; ++i)
1557 if(weaponimpulse[i-1] >= 0)
1558 if(stat_weapons & x)
1560 Sbar_DrawWeapon(i-1, fade, (i == activeweapon));
1566 drawpic(sbar, "gfx/sbar", '0 0 0', '1 1 1', sbar_alpha_fg, 0);
1568 drawpic(sbar, "gfx/sbar_minimal", '0 0 0', '1 1 1', sbar_alpha_fg, 0);
1572 Sbar_DrawXNum('268 12 0', getstati(STAT_ARMOR), 3, 24, '0.6 0.7 0.8', 1, 0);
1576 x = getstati(STAT_HEALTH);
1578 Sbar_DrawXNum('82 12 0', x, 3, 24, '1 1 1', 1, 0);
1579 else if(x <= 25 && time - floor(time) > 0.5)
1580 Sbar_DrawXNum('82 12 0', x, 3, 24, '0.7 0 0', 1, 0);
1582 Sbar_DrawXNum('81 12 0', x, 3, 24, '0.6 0.7 0.8', 1, 0);
1584 // AK dont draw ammo for the laser
1585 x = getstati(STAT_AMMO);
1586 if(activeweapon != 12)
1589 if (stat_items & IT_SHELLS)
1590 drawpic(sbar + '519 0 0', "gfx/sb_shells", '0 0 0', '1 1 1', sbar_alpha_fg, 0);
1591 else if (stat_items & IT_NAILS)
1592 drawpic(sbar + '519 0 0', "gfx/sb_bullets", '0 0 0', '1 1 1', sbar_alpha_fg, 0);
1593 else if (stat_items & IT_ROCKETS)
1594 drawpic(sbar + '519 0 0', "gfx/sb_rocket", '0 0 0', '1 1 1', sbar_alpha_fg, 0);
1595 else if (stat_items & IT_CELLS)
1596 drawpic(sbar + '519 0 0', "gfx/sb_cells", '0 0 0', '1 1 1', sbar_alpha_fg, 0);
1598 Sbar_DrawXNum('447 12 0', x, 3, 24, '0.6 0.7 0.8', 1, 0);
1600 Sbar_DrawXNum('447 12 0', x, 3, 24, '0.7 0 0', 1, 0);
1604 drawpic(sbar, "gfx/sbar_overlay", '0 0 0', '1 1 1', 1, DRAWFLAG_MODULATE);
1606 if (sbar_x + 600 + 160 <= vid_conwidth)
1607 Sbar_MiniDeathmatchOverlay (sbar + '600 0 0');
1612 // Mini scoreboard uses 12*4 per other team, that is, 144
1613 // pixels when there are four teams...
1614 // Nexuiz by default sets vid_conwidth to 800... makes
1616 // so we need to shift it by 64 pixels to the right to fit
1617 // BUT: then it overlaps with the image that gets drawn
1618 // for viewsize 100! Therefore, just account for 3 teams,
1619 // that is, 96 pixels mini scoreboard size, needing 16 pixels
1624 if(gametype == GAME_KEYHUNT)
1627 } else if(gametype == GAME_CTF)
1635 void CSQC_ctf_hud(void)
1637 // cvar("sbar_flagstatus_right") move the flag icons right
1638 // cvar("sbar_flagstatus_pos") pixel position of the nexuiz flagstatus icons
1639 float redflag, blueflag;
1643 stat_items = getstati(STAT_ITEMS);
1644 redflag = (stat_items/32768) & 3;
1645 blueflag = (stat_items/131072) & 3;
1649 * For some reason now not even THAT works there...
1650 * Maybe the minus' precedence screws it up? The last one there, maybe I should use brackets
1652 * pos_x = (cvar("sbar_flagstatus_right")) ? vid_conwidth - 10 - sbar_x - 64 : 10 - sbar_x;
1653 ** Should try those later:
1654 * pos_x = (cvar("sbar_flagstatus_right")) ? (vid_conwidth - 10 - sbar_x - 64) : (10 - sbar_x);
1655 * pos_x = ( (cvar("sbar_flagstatus_right")) ? vid_conwidth - 10 - 64 : 10 ) - sbar_x;
1658 if(cvar("sbar_flagstatus_right"))
1659 pos_x = vid_conwidth - 10 - sbar_x - 64;
1661 pos_x = 10 - sbar_x;
1665 if(sbar_hudselector == 1)
1666 pos_y = (vid_conheight - sbar_y) - cvar("sbar_flagstatus_pos") - 64;
1674 case 1: drawpic(pos, "gfx/sb_flag_red_taken", '0 0 0', '1 1 1', 1, DRAWFLAG_NORMAL); break;
1675 case 2: drawpic(pos, "gfx/sb_flag_red_lost", '0 0 0', '1 1 1', 1, DRAWFLAG_NORMAL); break;
1676 case 3: drawpic(pos, "gfx/sb_flag_red_carrying", '0 0 0', '1 1 1', 1, DRAWFLAG_NORMAL); break;
1683 case 1: drawpic(pos, "gfx/sb_flag_blue_taken", '0 0 0', '1 1 1', 1, 0); break;
1684 case 2: drawpic(pos, "gfx/sb_flag_blue_lost", '0 0 0', '1 1 1', 1, 0); break;
1685 case 3: drawpic(pos, "gfx/sb_flag_blue_carrying", '0 0 0', '1 1 1', 1, 0); break;