Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
scoreboard.qh File Reference
#include "../panel.qh"
Include dependency graph for scoreboard.qh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define GET_NEXTMAP()

Functions

void Cmd_Scoreboard_SetFields (int argc)
float HUD_Scoreboard_InputEvent (float bInputType, float nPrimary, float nSecondary)
void Scoreboard_InitScores ()
void Scoreboard_UI_Enable (int mode)
void Scoreboard_UpdatePlayerPos (entity pl)
void Scoreboard_UpdatePlayerTeams ()
void Scoreboard_UpdateTeamPos (entity Team)
bool Scoreboard_WouldDraw ()

Variables

string autocvar__nextmap
bool autocvar__scoreboard_team_selection
bool autocvar_cl_deathscoreboard
float autocvar_cl_deathscoreboard_delay = 1
float autocvar_hud_panel_scoreboard_namesize = 15
string autocvar_scoreboard_columns
bool ignored
 player is ignored
int numplayers
const int SB_PANEL_FIRST = 1
const int SB_PANEL_MAX = 2
const int SB_PANEL_RANKINGS = 2
const int SB_PANEL_SCOREBOARD = 1
bool sb_showscores
 set by +showscores engine command
float scoreboard_acc_fade_alpha
bool scoreboard_active
float scoreboard_bottom
float scoreboard_fade_alpha
float scoreboard_itemstats_fade_alpha
float scoreboard_left
float scoreboard_right
int scoreboard_selected_columns_layout
int scoreboard_selected_panel
float scoreboard_selected_panel_time
entity scoreboard_selected_player
entity scoreboard_selected_team
float scoreboard_top
int scoreboard_ui_enabled
int ts_max
 maximum team size
int ts_min
 minimum team size

Macro Definition Documentation

◆ GET_NEXTMAP

#define GET_NEXTMAP ( )
Value:
string autocvar__nextmap
Definition scoreboard.qh:9

Definition at line 12 of file scoreboard.qh.

Referenced by Scoreboard_Draw().

Function Documentation

◆ Cmd_Scoreboard_SetFields()

void Cmd_Scoreboard_SetFields ( int argc)

Definition at line 774 of file scoreboard.qc.

775{
776 TC(int, argc);
777 if (!gametype)
778 return; // do nothing, we don't know gametype and scores yet
779
780 int i;
781 bool have_name = false, have_primary = false, have_secondary = false, have_separator = false;
782
783 // sbt_fields uses strunzone on the titles!
784 if (!sbt_field_title[0])
785 for (i = 0; i < MAX_SBT_FIELDS; ++i)
786 sbt_field_title[i] = strzone("(null)");
787
788 // TODO: re-enable with gametype-dependent cvars?
789 if (argc < 3) // no arguments provided
791
792 if (argc < 3)
794
795 if (argc == 3)
796 {
797 if (argv(2) == "default" || argv(2) == "expand_default")
798 {
799 if (argv(2) == "expand_default")
800 cvar_set("scoreboard_columns", SCOREBOARD_DEFAULT_COLUMNS);
802 }
803 else if (argv(2) == "all" || argv(2) == "ALL")
804 {
805 string s = "ping pl name |"; // scores without label (not really scores)
806 if (argv(2) == "ALL")
807 {
808 // scores without label
809 s = strcat(s, " ", "sum");
810 s = strcat(s, " ", "kdratio");
811 s = strcat(s, " ", "frags");
812 }
813 FOREACH(Scores, it != ps_primary && it != ps_secondary && scores_label(it) != "",
814 s = strcat(s, " ", scores_label(it)));
816 s = strcat(s, " ", scores_label(ps_secondary));
817 s = strcat(s, " ", scores_label(ps_primary));
818 argc = tokenizebyseparator(strcat("0 1 ", s), " ");
819 }
820 }
821
822
823 sbt_num_fields = 0;
824
825 hud_fontsize = HUD_GetFontsize("hud_fontsize");
826
827 string str, pattern;
828 int slash;
829 bool nocomplain;
830 for (i = 1; i < argc - 1; ++i)
831 {
832 str = argv(i+1);
833 nocomplain = false;
834 if (substring(str, 0, 1) == "?")
835 {
836 nocomplain = true;
837 str = substring(str, 1, strlen(str) - 1);
838 }
839
840 slash = strstrofs(str, "/", 0);
841 if (slash >= 0)
842 {
843 pattern = substring(str, 0, slash);
844 str = substring(str, slash + 1, strlen(str) - (slash + 1));
845
846 if (!isGametypeInFilter(gametype, teamplay, false, pattern))
847 continue;
848 }
849
850 str = strtolower(str);
852
854 switch (str)
855 {
856 // fields without a label (not networked via the score system)
857 case "ping": sbt_field[sbt_num_fields] = SP_PING; break;
858 case "pl": sbt_field[sbt_num_fields] = SP_PL; break;
859 case "name":
860 case "nick": sbt_field[sbt_num_fields] = SP_NAME; have_name = true; break;
861 case "|": sbt_field[sbt_num_fields] = SP_SEPARATOR; have_separator = true; break;
862 case "kd":
863 case "kdr":
864 case "kdratio": sbt_field[sbt_num_fields] = SP_KDRATIO; break;
865 case "sum":
866 case "diff":
867 case "k-d": sbt_field[sbt_num_fields] = SP_SUM; break;
868 case "frags": sbt_field[sbt_num_fields] = SP_FRAGS; break;
869 default: // fields with a label
870 {
871 // map alternative labels
872 if (str == "damage")
873 str = "dmg";
874 if (str == "damagetaken")
875 str = "dmgtaken";
876
877 FOREACH(Scores, str == strtolower(scores_label(it)),
878 {
879 j = it;
880 goto found; // sorry, but otherwise fteqcc -O3 miscompiles this and warns about "unreachable code"
881 });
882
883 // NOTE: can't check STAT(SHOWFPS) here, if checked too early it returns false anyway
884 if (!nocomplain && str != "fps" && str != "skill") // server can disable the fps or skill fields
885 LOG_INFOF("^1Error:^7 Unknown score field: '%s'", str);
886
888 continue;
889
890 LABEL(found)
892 if (j == ps_primary)
893 have_primary = true;
894 if (j == ps_secondary)
895 have_secondary = true;
896
897 }
898 }
901 break;
902 }
903
905 have_primary = true;
907 have_secondary = true;
909 have_secondary = true;
910 int missing = (!have_primary) + (!have_secondary) + (!have_separator) + (!have_name);
911
912 if (sbt_num_fields + missing < MAX_SBT_FIELDS)
913 {
914 if (!have_name)
915 {
917 for (i = sbt_num_fields; i > 0; --i)
918 {
920 sbt_field[i] = sbt_field[i-1];
921 }
923 sbt_field[0] = SP_NAME;
925 LOG_INFO("fixed missing field 'name'");
926
927 if (!have_separator)
928 {
930 for (i = sbt_num_fields; i > 1; --i)
931 {
933 sbt_field[i] = sbt_field[i-1];
934 }
935 sbt_field_title[1] = strzone("|");
936 sbt_field[1] = SP_SEPARATOR;
938 LOG_INFO("fixed missing field '|'");
939 }
940 }
941 else if (!have_separator)
942 {
944 sbt_field[sbt_num_fields] = SP_SEPARATOR;
946 LOG_INFO("fixed missing field '|'");
947 }
948 if (!have_secondary)
949 {
953 LOG_INFOF("fixed missing field '%s'", scores_label(ps_secondary));
954 }
955 if (!have_primary)
956 {
960 LOG_INFOF("fixed missing field '%s'", scores_label(ps_primary));
961 }
962 }
963
964 sbt_field[sbt_num_fields] = SP_END;
966}
vector hud_fontsize
Definition main.qh:77
entity gametype
Definition main.qh:43
#define scores_label(this)
Definition scores.qh:146
entity PlayerScoreField
Definition scores.qh:140
#define scores_flags(this)
Definition scores.qh:147
const int SFL_ALLOW_HIDE
Allow a column to be hidden (do not automatically add it even if it is a sorting key).
Definition scores.qh:112
float isGametypeInFilter(Gametype gt, float tp, float ts, string pattern)
Definition util.qc:1189
string strtolower(string s)
#define LABEL(id)
Definition compiler.qh:34
#define strstrofs
#define strlen
#define tokenizebyseparator
vector HUD_GetFontsize(string cvarname)
Definition hud.qc:112
PlayerScoreField ps_secondary
Definition hud.qh:117
PlayerScoreField ps_primary
Definition hud.qh:117
#define FOREACH(list, cond, body)
Definition iter.qh:19
#define TC(T, sym)
Definition _all.inc:82
#define LOG_INFO(...)
Definition log.qh:62
#define LOG_INFOF(...)
Definition log.qh:63
void cvar_set(string name, string value)
string substring(string s, float start, float length)
string strzone(string s)
string argv(float n)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
int sbt_num_fields
Definition scoreboard.qc:52
string TranslateScoresLabel(string label)
PlayerScoreField sbt_field[MAX_SBT_FIELDS+1]
Definition scoreboard.qc:47
#define SCOREBOARD_DEFAULT_COLUMNS
const int MAX_SBT_FIELDS
Definition scoreboard.qc:45
int sb_field_sizes_init
Definition scoreboard.qc:59
string sbt_field_title[MAX_SBT_FIELDS+1]
Definition scoreboard.qc:49
string autocvar_scoreboard_columns
Definition scoreboard.qh:6
#define strfree(this)
Definition string.qh:57
#define strcpy(this, s)
Definition string.qh:51
bool teamplay
Definition teams.qh:59

Referenced by Scoreboard_InitScores().

◆ HUD_Scoreboard_InputEvent()

float HUD_Scoreboard_InputEvent ( float bInputType,
float nPrimary,
float nSecondary )

Definition at line 238 of file scoreboard.qc.

239{
241 return false;
242
243 if (bInputType == 3)
244 {
245 mousepos.x = nPrimary;
246 mousepos.y = nSecondary;
247 return true;
248 }
249
250 if (bInputType == 2)
251 return false;
252
253 // at this point bInputType can only be 0 or 1 (key pressed or released)
254 bool key_pressed = bInputType == 0;
255
256 // ESC to exit (TAB-ESC works too)
257 if (nPrimary == K_ESCAPE)
258 {
259 if (!key_pressed)
260 return true;
262 return true;
263 }
264
265 // block any input while a menu dialog is fading
267 {
268 hudShiftState = 0;
269 return true;
270 }
271
272 // allow console bind to work
273 string con_keys = findkeysforcommand("toggleconsole", 0);
274 int keys = tokenize(con_keys); // findkeysforcommand returns data for this
275
276 bool hit_con_bind = false;
277 for (int i = 0; i < keys; ++i)
278 if (nPrimary == stof(argv(i)))
279 hit_con_bind = true;
280
281 if (key_pressed)
282 {
283 if (nPrimary == K_ALT) hudShiftState |= S_ALT;
284 if (nPrimary == K_CTRL) hudShiftState |= S_CTRL;
285 if (nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
286 if (nPrimary == K_TAB) hudShiftState |= S_TAB;
287 }
288 else
289 {
290 if (nPrimary == K_ALT) hudShiftState &= ~S_ALT;
291 if (nPrimary == K_CTRL) hudShiftState &= ~S_CTRL;
292 if (nPrimary == K_SHIFT) hudShiftState &= ~S_SHIFT;
293 if (nPrimary == K_TAB) hudShiftState &= ~S_TAB;
294 }
295
296 if (nPrimary == K_TAB)
297 {
298 if (!key_pressed)
299 return true;
300 if (scoreboard_ui_enabled == 2)
301 {
303 goto uparrow_action;
304 else
305 goto downarrow_action;
306 }
307
309 {
315 }
316 else
317 {
323 }
324
326 }
327 else if (nPrimary == K_DOWNARROW)
328 {
329 if (!key_pressed)
330 return true;
331 LABEL(downarrow_action);
333 {
334 if (scoreboard_ui_enabled == 2)
335 {
336 bool scoreboard_selected_team_found = !scoreboard_selected_team;
337
338 entity curr_team = NULL;
339 for (entity tm = teams.sort_next; tm; tm = tm.sort_next)
340 {
341 if (tm.team == NUM_SPECTATOR)
342 continue;
343 curr_team = tm;
344 if (scoreboard_selected_team_found)
345 goto ok_team;
346 if (scoreboard_selected_team == tm)
347 scoreboard_selected_team_found = true;
348 }
349 LABEL(ok_team);
350 if (curr_team == scoreboard_selected_team) // loop reached the last team
351 curr_team = NULL;
352 scoreboard_selected_team = curr_team;
353 }
354 else
355 {
356 bool scoreboard_selected_player_found = !scoreboard_selected_player;
357
358 entity curr_pl = NULL;
359 for (entity pl, tm = teams.sort_next; tm; tm = tm.sort_next)
360 if (tm.team != NUM_SPECTATOR)
361 for (pl = players.sort_next; pl; pl = pl.sort_next)
362 {
363 if (pl.team != tm.team)
364 continue;
365 curr_pl = pl;
366 if (scoreboard_selected_player_found)
367 goto ok_done;
369 scoreboard_selected_player_found = true;
370 }
371 LABEL(ok_done);
372 if (curr_pl == scoreboard_selected_player) // loop reached the last player
373 curr_pl = NULL;
375 }
376 }
377 }
378 else if (nPrimary == K_UPARROW)
379 {
380 if (!key_pressed)
381 return true;
382 LABEL(uparrow_action);
384 {
385 if (scoreboard_ui_enabled == 2)
386 {
388 for (entity tm = teams.sort_next; tm; tm = tm.sort_next)
389 {
390 if (tm.team == NUM_SPECTATOR)
391 continue;
392 if (tm == scoreboard_selected_team)
393 goto ok_team2;
394 prev_team = tm;
395 }
396 LABEL(ok_team2);
398 }
399 else
400 {
401 entity prev_pl = NULL;
402 for (entity pl, tm = teams.sort_next; tm; tm = tm.sort_next)
403 if (tm.team != NUM_SPECTATOR)
404 for (pl = players.sort_next; pl; pl = pl.sort_next)
405 {
406 if (pl.team != tm.team)
407 continue;
409 goto ok_done2;
410 prev_pl = pl;
411 }
412 LABEL(ok_done2);
414 }
415 }
416 }
417 else if (nPrimary == K_RIGHTARROW)
418 {
419 if (!key_pressed)
420 return true;
423 }
424 else if (nPrimary == K_LEFTARROW)
425 {
426 if (!key_pressed)
427 return true;
430 }
431 else if (nPrimary == K_ENTER || nPrimary == K_SPACE || nPrimary == K_KP_ENTER)
432 {
433 if (!key_pressed)
434 return true;
436 {
437 if (scoreboard_ui_enabled == 2)
438 {
439 string team_name;
441 team_name = "auto";
442 else
444 localcmd(strcat("cmd join ", team_name, "\n"));
446 }
448 localcmd(sprintf("spectate %d\n", scoreboard_selected_player.sv_entnum + 1));
449 }
450 }
451 else if (nPrimary == 'c' && (hudShiftState & S_CTRL))
452 {
453 if (!key_pressed)
454 return true;
456 {
458 {
459 case 0:
462 && autocvar_scoreboard_columns != "default")
463 {
464 localcmd("scoreboard_columns_set\n"); // sets the layout saved in scoreboard_columns
466 break;
467 }
468 // fallthrough
469 case 1:
470 localcmd("scoreboard_columns_set default\n");
472 break;
473 case 2:
474 localcmd("scoreboard_columns_set all\n");
476 break;
477 }
478 }
479 }
480 else if (nPrimary == 'r' && (hudShiftState & S_CTRL))
481 {
482 if (!key_pressed)
483 return true;
485 localcmd("toggle hud_panel_scoreboard_scores_per_round\n");
486 }
487 else if (nPrimary == 't' && (hudShiftState & S_CTRL))
488 {
489 if (!key_pressed)
490 return true;
493 {
494 localcmd(strcat("commandmode tell \"", entcs_GetName(scoreboard_selected_player.sv_entnum), "^7\"\n"));
496 }
497 }
498 else if (nPrimary == 'k' && (hudShiftState & S_CTRL))
499 {
500 if (!key_pressed)
501 return true;
504 localcmd(strcat("vcall kick \"", entcs_GetName(scoreboard_selected_player.sv_entnum), "^7\"\n"));
505 }
506 else if (hit_con_bind || nPrimary == K_PAUSE)
507 return false;
508
509 return true;
510}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float RANKINGS_RECEIVED_CNT
Definition main.qh:79
entity players
Definition main.qh:57
entity teams
Definition main.qh:58
float time
string entcs_GetName(int i)
Definition ent_cs.qh:148
const int S_SHIFT
Definition hud.qh:129
int hudShiftState
Definition hud.qh:128
const int S_ALT
Definition hud.qh:131
float autocvar__menu_alpha
Definition hud.qh:187
vector mousepos
Definition hud.qh:103
const int S_TAB
Definition hud.qh:132
const int S_CTRL
Definition hud.qh:130
float K_SHIFT
Definition keycodes.qc:22
float K_UPARROW
Definition keycodes.qc:15
float K_DOWNARROW
Definition keycodes.qc:16
float K_CTRL
Definition keycodes.qc:21
float K_RIGHTARROW
Definition keycodes.qc:18
float K_SPACE
Definition keycodes.qc:10
float K_ALT
Definition keycodes.qc:20
float K_ENTER
Definition keycodes.qc:8
float K_LEFTARROW
Definition keycodes.qc:17
float K_KP_ENTER
Definition keycodes.qc:74
float K_TAB
Definition keycodes.qc:7
float K_ESCAPE
Definition keycodes.qc:9
float K_PAUSE
Definition keycodes.qc:78
void localcmd(string command,...)
float ceil(float f)
float stof(string val,...)
float min(float f,...)
float tokenize(string s)
float max(float f,...)
#define NULL
Definition post.qh:14
bool scoreboard_ui_disabling
int rankings_cnt
int rankings_start_column
int rankings_columns
int rankings_rows
void HUD_Scoreboard_UI_Disable()
int scoreboard_selected_panel
Definition scoreboard.qh:44
entity scoreboard_selected_player
Definition scoreboard.qh:46
int scoreboard_selected_columns_layout
Definition scoreboard.qh:48
int scoreboard_ui_enabled
Definition scoreboard.qh:40
const int SB_PANEL_SCOREBOARD
Definition scoreboard.qh:52
entity scoreboard_selected_team
Definition scoreboard.qh:47
const int SB_PANEL_FIRST
Definition scoreboard.qh:51
const int SB_PANEL_MAX
Definition scoreboard.qh:54
const int SB_PANEL_RANKINGS
Definition scoreboard.qh:53
float scoreboard_selected_panel_time
Definition scoreboard.qh:45
int prev_team
string Static_Team_ColorName(int teamid)
Definition teams.qh:103
const int NUM_SPECTATOR
Definition teams.qh:23

References argv(), autocvar__menu_alpha, autocvar_scoreboard_columns, ceil(), entcs_GetName(), entity(), HUD_Scoreboard_UI_Disable(), hudShiftState, K_ALT, K_CTRL, K_DOWNARROW, K_ENTER, K_ESCAPE, K_KP_ENTER, K_LEFTARROW, K_PAUSE, K_RIGHTARROW, K_SHIFT, K_SPACE, K_TAB, K_UPARROW, LABEL, localcmd(), max(), min(), mousepos, NULL, NUM_SPECTATOR, players, prev_team, rankings_cnt, rankings_columns, RANKINGS_RECEIVED_CNT, rankings_rows, rankings_start_column, S_ALT, S_CTRL, S_SHIFT, S_TAB, SB_PANEL_FIRST, SB_PANEL_MAX, SB_PANEL_RANKINGS, SB_PANEL_SCOREBOARD, scoreboard_selected_columns_layout, scoreboard_selected_panel, scoreboard_selected_panel_time, scoreboard_selected_player, scoreboard_selected_team, scoreboard_ui_disabling, scoreboard_ui_enabled, Static_Team_ColorName(), stof(), strcat(), teams, time, and tokenize().

Referenced by CSQC_InputEvent().

◆ Scoreboard_InitScores()

void Scoreboard_InitScores ( )

Definition at line 521 of file scoreboard.qc.

522{
525
526 int f;
527 FOREACH(Scores, !(scores_flags(it) & SFL_NOT_SORTABLE),
528 {
530 if (f == SFL_SORT_PRIO_PRIMARY)
531 ps_primary = it;
533 ps_secondary = it;
534 });
535 if (ps_secondary == NULL)
537
538 for (int i = 0; i < MAX_TEAMSCORE; ++i)
539 {
541 if (f == SFL_SORT_PRIO_PRIMARY)
542 ts_primary = i;
544 ts_secondary = i;
545 }
546 if (ts_secondary == -1)
548
550}
#define MAX_TEAMSCORE
Definition scores.qh:149
#define teamscores_flags(i)
Definition scores.qh:156
const int SFL_NOT_SORTABLE
Definition scores.qh:124
const int SFL_SORT_PRIO_MASK
Definition scores.qh:135
const int SFL_SORT_PRIO_SECONDARY
Scoring priority (NOTE: PRIMARY is used for fraglimit) NOTE: SFL_SORT_PRIO_SECONDARY value must be lo...
Definition scores.qh:133
const int SFL_SORT_PRIO_PRIMARY
Definition scores.qh:134
int ts_secondary
Definition hud.qh:118
int ts_primary
Definition hud.qh:118
void Cmd_Scoreboard_SetFields(int argc)

References Cmd_Scoreboard_SetFields(), FOREACH, MAX_TEAMSCORE, NULL, ps_primary, ps_secondary, scores_flags, SFL_NOT_SORTABLE, SFL_SORT_PRIO_MASK, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_SECONDARY, teamscores_flags, ts_primary, and ts_secondary.

Referenced by NET_HANDLE().

◆ Scoreboard_UI_Enable()

void Scoreboard_UI_Enable ( int mode)

Definition at line 205 of file scoreboard.qc.

206{
207 if (isdemo())
208 return;
209
210 if (mode == 1)
211 {
213 return;
214
215 // release player's pressed keys as they aren't released elsewhere
216 // in particular jump needs to be released as it may open the team selection
217 // (when server detects jump has been pressed it sends the command to open the team selection)
221 }
222 else
223 {
224 if (scoreboard_ui_enabled == 1)
225 return;
228 }
232}
void Release_Common_Keys()
Definition main.qc:476
float intermission
float isdemo()

References intermission, isdemo(), NULL, Release_Common_Keys(), SB_PANEL_FIRST, SB_PANEL_SCOREBOARD, scoreboard_selected_panel, scoreboard_selected_panel_time, scoreboard_selected_player, scoreboard_selected_team, scoreboard_ui_enabled, teamplay, and time.

Referenced by CSQC_InputEvent(), and CSQC_UpdateView().

◆ Scoreboard_UpdatePlayerPos()

void Scoreboard_UpdatePlayerPos ( entity pl)

Definition at line 663 of file scoreboard.qc.

664{
665 entity ent;
666 for (ent = player.sort_next; ent && Scoreboard_ComparePlayerScores(player, ent); ent = player.sort_next)
667 SORT_SWAP(player, ent);
668 for (ent = player.sort_prev; ent != players && Scoreboard_ComparePlayerScores(ent, player); ent = player.sort_prev)
669 SORT_SWAP(ent, player);
670}
float Scoreboard_ComparePlayerScores(entity left, entity right)
#define SORT_SWAP(a, b)
Swap two neighbours in a sortlist.
Definition sortlist.qh:14

References entity(), players, Scoreboard_ComparePlayerScores(), and SORT_SWAP.

Referenced by NET_HANDLE(), Playerchecker_Think(), and Scoreboard_UpdatePlayerTeams().

◆ Scoreboard_UpdatePlayerTeams()

void Scoreboard_UpdatePlayerTeams ( )

Definition at line 553 of file scoreboard.qc.

554{
555 static float update_time;
556 if (time <= update_time)
557 return;
559
560 numplayers = 0;
561 //int num = 0;
562 for (entity tmp, pl = players.sort_next; pl; pl = pl.sort_next)
563 {
564 numplayers += pl.team != NUM_SPECTATOR;
565 //++num;
566 int Team = entcs_GetScoreTeam(pl.sv_entnum);
567 if (SetTeam(pl, Team))
568 {
569 tmp = pl.sort_prev;
571 if (tmp)
572 pl = tmp;
573 else
574 pl = players.sort_next;
575 }
576 }
577 /*
578 if (num != lastpnum)
579 print(strcat("PNUM: ", itos(num), "\n"));
580 lastpnum = num;
581 */
582
583 // update the smallest and largest team sizes
584 if (!teamplay || !teams.sort_next)
585 ts_min = ts_max = 0;
586 else
587 {
588 ts_min = 255, ts_max = 0;
589
590 for (entity tm = teams.sort_next; tm; tm = tm.sort_next)
591 {
592 if (tm.team == NUM_SPECTATOR)
593 continue;
594
595 if (ts_min > tm.team_size)
596 ts_min = tm.team_size;
597 if (ts_max < tm.team_size)
598 ts_max = tm.team_size;
599 }
600 }
601}
bool SetTeam(entity o, int Team)
Definition main.qc:347
float update_time
Definition net.qh:11
int entcs_GetScoreTeam(int i)
Same as entcs_GetTeam, but returns -1 for no team in teamplay.
Definition ent_cs.qh:138
void Scoreboard_UpdatePlayerPos(entity player)
int ts_min
minimum team size
Definition scoreboard.qh:27
int numplayers
Definition scoreboard.qh:26
int ts_max
maximum team size
Definition scoreboard.qh:28

References entcs_GetScoreTeam(), entity(), NUM_SPECTATOR, numplayers, players, Scoreboard_UpdatePlayerPos(), SetTeam(), teamplay, teams, time, ts_max, ts_min, and update_time.

Referenced by Announcer_Duel(), HUD_InfoMessages(), HUD_Quickmenu_PlayerListEntries(), HUD_Score_Rankings(), HUD_Timer(), and Scoreboard_Draw().

◆ Scoreboard_UpdateTeamPos()

void Scoreboard_UpdateTeamPos ( entity Team)

Definition at line 709 of file scoreboard.qc.

710{
711 entity ent;
712 for (ent = Team.sort_next; ent && Scoreboard_CompareTeamScores(Team, ent); ent = Team.sort_next)
713 SORT_SWAP(Team, ent);
714 for (ent = Team.sort_prev; ent != teams && Scoreboard_CompareTeamScores(ent, Team); ent = Team.sort_prev)
715 SORT_SWAP(ent, Team);
716}
float Scoreboard_CompareTeamScores(entity left, entity right)

References entity(), Scoreboard_CompareTeamScores(), SORT_SWAP, and teams.

Referenced by NET_HANDLE().

◆ Scoreboard_WouldDraw()

bool Scoreboard_WouldDraw ( )

Definition at line 1874 of file scoreboard.qc.

1875{
1876 deathscoreboard = false;
1878 {
1880 {
1881 if (scoreboard_fade_alpha == 0)
1883 return false;
1884 }
1886 {
1888 return false;
1889 }
1890 return true;
1891 }
1892 else if (MUTATOR_CALLHOOK(DrawScoreboard))
1893 return false;
1894 else if (QuickMenu_IsOpened())
1895 return false;
1896 else if (HUD_Radar_Clickable())
1897 return false;
1898 else if (sb_showscores) // set by +showscores engine command
1899 return true;
1900 else if (intermission == 1)
1901 return true;
1902 else if (intermission == 2)
1903 return false;
1904 else if (spectatee_status != -1 && STAT(HEALTH) <= 0 && autocvar_cl_deathscoreboard && !MUTATOR_CALLHOOK(DrawDeathScoreboard)
1907 {
1908 if (gametype.m_1v1) // display all info if 1v1 even if dead - only 2 players, lots of room
1909 deathscoreboard = true;
1910 return true;
1911 }
1912 else if (scoreboard_showscores_force || MUTATOR_CALLHOOK(DrawScoreboard_Force))
1913 return true;
1914 return false;
1915}
#define MUTATOR_CALLHOOK(name,...)
Definition base.qh:186
entity active_minigame
bool HUD_MinigameMenu_IsOpened()
int spectatee_status
the -1 disables HUD panels before CSQC receives necessary data
Definition main.qh:197
float player_localentnum
float death_time
entity CSQCModel_server2csqc(int i)
Definition cl_model.qc:314
bool QuickMenu_IsOpened()
Definition quickmenu.qc:290
bool HUD_Radar_Clickable()
Definition radar.qc:26
#define STAT(...)
Definition stats.qh:94
bool scoreboard_showscores_force
Definition racetimer.qh:46
bool deathscoreboard
Whether the scoreboard is displaying because we're dead - hide accuracy & item stats & rankings.
void HUD_Scoreboard_UI_Disable_Instantly()
bool autocvar_cl_deathscoreboard
Definition scoreboard.qh:4
float scoreboard_fade_alpha
Definition scoreboard.qh:17
bool sb_showscores
set by +showscores engine command
Definition scoreboard.qh:14
float autocvar_cl_deathscoreboard_delay
Definition scoreboard.qh:5

References active_minigame, autocvar_cl_deathscoreboard, autocvar_cl_deathscoreboard_delay, CSQCModel_server2csqc(), death_time, deathscoreboard, gametype, HUD_MinigameMenu_IsOpened(), HUD_Radar_Clickable(), HUD_Scoreboard_UI_Disable_Instantly(), intermission, MUTATOR_CALLHOOK, player_localentnum, QuickMenu_IsOpened(), sb_showscores, scoreboard_fade_alpha, scoreboard_showscores_force, scoreboard_ui_disabling, scoreboard_ui_enabled, spectatee_status, STAT, and time.

Referenced by CSQC_UpdateView().

Variable Documentation

◆ autocvar__nextmap

string autocvar__nextmap

Definition at line 9 of file scoreboard.qh.

◆ autocvar__scoreboard_team_selection

bool autocvar__scoreboard_team_selection

Definition at line 41 of file scoreboard.qh.

Referenced by CSQC_UpdateView().

◆ autocvar_cl_deathscoreboard

bool autocvar_cl_deathscoreboard

Definition at line 4 of file scoreboard.qh.

Referenced by Scoreboard_WouldDraw().

◆ autocvar_cl_deathscoreboard_delay

float autocvar_cl_deathscoreboard_delay = 1

Definition at line 5 of file scoreboard.qh.

Referenced by Scoreboard_WouldDraw().

◆ autocvar_hud_panel_scoreboard_namesize

float autocvar_hud_panel_scoreboard_namesize = 15

◆ autocvar_scoreboard_columns

string autocvar_scoreboard_columns

Definition at line 6 of file scoreboard.qh.

Referenced by Cmd_Scoreboard_SetFields(), and HUD_Scoreboard_InputEvent().

◆ ignored

bool ignored

player is ignored

Definition at line 30 of file scoreboard.qh.

◆ numplayers

◆ SB_PANEL_FIRST

const int SB_PANEL_FIRST = 1

Definition at line 51 of file scoreboard.qh.

Referenced by HUD_Scoreboard_InputEvent(), and Scoreboard_UI_Enable().

◆ SB_PANEL_MAX

const int SB_PANEL_MAX = 2

Definition at line 54 of file scoreboard.qh.

Referenced by HUD_Scoreboard_InputEvent().

◆ SB_PANEL_RANKINGS

const int SB_PANEL_RANKINGS = 2

Definition at line 53 of file scoreboard.qh.

Referenced by HUD_Scoreboard_InputEvent(), and Scoreboard_Rankings_Draw().

◆ SB_PANEL_SCOREBOARD

const int SB_PANEL_SCOREBOARD = 1

◆ sb_showscores

bool sb_showscores

set by +showscores engine command

Definition at line 14 of file scoreboard.qh.

Referenced by HUD_Scoreboard_UI_Disable(), and Scoreboard_WouldDraw().

◆ scoreboard_acc_fade_alpha

float scoreboard_acc_fade_alpha

Definition at line 18 of file scoreboard.qh.

Referenced by Scoreboard_AccuracyStats_Draw(), and Scoreboard_Draw().

◆ scoreboard_active

bool scoreboard_active

◆ scoreboard_bottom

float scoreboard_bottom

Definition at line 22 of file scoreboard.qh.

Referenced by HUD_CenterPrint(), HUD_Notify(), and Scoreboard_Draw().

◆ scoreboard_fade_alpha

◆ scoreboard_itemstats_fade_alpha

float scoreboard_itemstats_fade_alpha

Definition at line 19 of file scoreboard.qh.

Referenced by Scoreboard_Draw(), and Scoreboard_ItemStats_Draw().

◆ scoreboard_left

float scoreboard_left

◆ scoreboard_right

float scoreboard_right

◆ scoreboard_selected_columns_layout

int scoreboard_selected_columns_layout

Definition at line 48 of file scoreboard.qh.

Referenced by HUD_Scoreboard_InputEvent().

◆ scoreboard_selected_panel

◆ scoreboard_selected_panel_time

float scoreboard_selected_panel_time

◆ scoreboard_selected_player

◆ scoreboard_selected_team

◆ scoreboard_top

float scoreboard_top

Definition at line 21 of file scoreboard.qh.

Referenced by HUD_Notify(), and Scoreboard_Draw().

◆ scoreboard_ui_enabled

◆ ts_max

int ts_max

maximum team size

Definition at line 28 of file scoreboard.qh.

Referenced by HUD_InfoMessages(), HUD_Timer(), Scoreboard_UpdatePlayerTeams(), and TeamBalance_SizeDifference().

◆ ts_min

int ts_min

minimum team size

Definition at line 27 of file scoreboard.qh.

Referenced by HUD_InfoMessages(), HUD_Timer(), Scoreboard_UpdatePlayerTeams(), and TeamBalance_SizeDifference().