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
int numplayers
int SB_PANEL_FIRST = 1
int SB_PANEL_MAX = 2
int SB_PANEL_RANKINGS = 2
int SB_PANEL_SCOREBOARD = 1
bool sb_showscores
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
 team size
int ts_min

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 767 of file scoreboard.qc.

768{
769 TC(int, argc);
770 if (!gametype)
771 return; // do nothing, we don't know gametype and scores yet
772
773 int i;
774 bool have_name = false, have_primary = false, have_secondary = false, have_separator = false;
775
776 // sbt_fields uses strunzone on the titles!
777 if (!sbt_field_title[0])
778 for (i = 0; i < MAX_SBT_FIELDS; ++i)
779 sbt_field_title[i] = strzone("(null)");
780
781 // TODO: re enable with gametype dependant cvars?
782 if (argc < 3) // no arguments provided
784
785 if (argc < 3)
787
788 if (argc == 3)
789 {
790 if (argv(2) == "default" || argv(2) == "expand_default")
791 {
792 if (argv(2) == "expand_default")
793 cvar_set("scoreboard_columns", SCOREBOARD_DEFAULT_COLUMNS);
795 }
796 else if (argv(2) == "all" || argv(2) == "ALL")
797 {
798 string s = "ping pl name |"; // scores without label (not really scores)
799 if (argv(2) == "ALL")
800 {
801 // scores without label
802 s = strcat(s, " ", "sum");
803 s = strcat(s, " ", "kdratio");
804 s = strcat(s, " ", "frags");
805 }
806 FOREACH(Scores, true,
807 {
808 if (it != ps_primary && it != ps_secondary && scores_label(it) != "")
809 s = strcat(s, " ", scores_label(it));
810 });
812 s = strcat(s, " ", scores_label(ps_secondary));
813 s = strcat(s, " ", scores_label(ps_primary));
814 argc = tokenizebyseparator(strcat("0 1 ", s), " ");
815 }
816 }
817
818
819 sbt_num_fields = 0;
820
821 hud_fontsize = HUD_GetFontsize("hud_fontsize");
822
823 string str, pattern;
824 int slash;
825 bool nocomplain;
826 for (i = 1; i < argc - 1; ++i)
827 {
828 str = argv(i+1);
829 nocomplain = false;
830 if (substring(str, 0, 1) == "?")
831 {
832 nocomplain = true;
833 str = substring(str, 1, strlen(str) - 1);
834 }
835
836 slash = strstrofs(str, "/", 0);
837 if (slash >= 0)
838 {
839 pattern = substring(str, 0, slash);
840 str = substring(str, slash + 1, strlen(str) - (slash + 1));
841
842 if (!isGametypeInFilter(gametype, teamplay, false, pattern))
843 continue;
844 }
845
846 str = strtolower(str);
848
850 switch (str)
851 {
852 // fields without a label (not networked via the score system)
853 case "ping": sbt_field[sbt_num_fields] = SP_PING; break;
854 case "pl": sbt_field[sbt_num_fields] = SP_PL; break;
855 case "name":
856 case "nick": sbt_field[sbt_num_fields] = SP_NAME; have_name = true; break;
857 case "|": sbt_field[sbt_num_fields] = SP_SEPARATOR; have_separator = true; break;
858 case "kd":
859 case "kdr":
860 case "kdratio": sbt_field[sbt_num_fields] = SP_KDRATIO; break;
861 case "sum":
862 case "diff":
863 case "k-d": sbt_field[sbt_num_fields] = SP_SUM; break;
864 case "frags": sbt_field[sbt_num_fields] = SP_FRAGS; break;
865 default: // fields with a label
866 {
867 // map alternative labels
868 if (str == "damage")
869 str = "dmg";
870 if (str == "damagetaken")
871 str = "dmgtaken";
872
873 FOREACH(Scores, str == strtolower(scores_label(it)),
874 {
875 j = it;
876 goto found; // sorry, but otherwise fteqcc -O3 miscompiles this and warns about "unreachable code"
877 });
878
879 // NOTE: can't check STAT(SHOWFPS) here, if checked too early it returns false anyway
880 if (!nocomplain && str != "fps" && str != "skill") // server can disable the fps or skill fields
881 LOG_INFOF("^1Error:^7 Unknown score field: '%s'", str);
882
884 continue;
885
886 LABEL(found)
888 if (j == ps_primary)
889 have_primary = true;
890 if (j == ps_secondary)
891 have_secondary = true;
892
893 }
894 }
897 break;
898 }
899
901 have_primary = true;
903 have_secondary = true;
905 have_secondary = true;
906 int missing = (!have_primary) + (!have_secondary) + (!have_separator) + (!have_name);
907
908 if (sbt_num_fields + missing < MAX_SBT_FIELDS)
909 {
910 if (!have_name)
911 {
913 for (i = sbt_num_fields; i > 0; --i)
914 {
916 sbt_field[i] = sbt_field[i-1];
917 }
919 sbt_field[0] = SP_NAME;
921 LOG_INFO("fixed missing field 'name'");
922
923 if (!have_separator)
924 {
926 for (i = sbt_num_fields; i > 1; --i)
927 {
929 sbt_field[i] = sbt_field[i-1];
930 }
931 sbt_field_title[1] = strzone("|");
932 sbt_field[1] = SP_SEPARATOR;
934 LOG_INFO("fixed missing field '|'");
935 }
936 }
937 else if (!have_separator)
938 {
940 sbt_field[sbt_num_fields] = SP_SEPARATOR;
942 LOG_INFO("fixed missing field '|'");
943 }
944 if (!have_secondary)
945 {
949 LOG_INFOF("fixed missing field '%s'", scores_label(ps_secondary));
950 }
951 if (!have_primary)
952 {
956 LOG_INFOF("fixed missing field '%s'", scores_label(ps_primary));
957 }
958 }
959
960 sbt_field[sbt_num_fields] = SP_END;
962}
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:1187
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:65
#define LOG_INFOF(...)
Definition log.qh:66
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:49
string TranslateScoresLabel(string label)
PlayerScoreField sbt_field[MAX_SBT_FIELDS+1]
Definition scoreboard.qc:44
#define SCOREBOARD_DEFAULT_COLUMNS
const int MAX_SBT_FIELDS
Definition scoreboard.qc:42
int sb_field_sizes_init
Definition scoreboard.qc:56
string sbt_field_title[MAX_SBT_FIELDS+1]
Definition scoreboard.qc:46
string autocvar_scoreboard_columns
Definition scoreboard.qh:6
#define strfree(this)
Definition string.qh:59
#define strcpy(this, s)
Definition string.qh:52
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 231 of file scoreboard.qc.

232{
234 return false;
235
236 if (bInputType == 3)
237 {
238 mousepos.x = nPrimary;
239 mousepos.y = nSecondary;
240 return true;
241 }
242
243 if (bInputType == 2)
244 return false;
245
246 // at this point bInputType can only be 0 or 1 (key pressed or released)
247 bool key_pressed = bInputType == 0;
248
249 // ESC to exit (TAB-ESC works too)
250 if (nPrimary == K_ESCAPE)
251 {
252 if (!key_pressed)
253 return true;
255 return true;
256 }
257
258 // block any input while a menu dialog is fading
260 {
261 hudShiftState = 0;
262 return true;
263 }
264
265 // allow console bind to work
266 string con_keys = findkeysforcommand("toggleconsole", 0);
267 int keys = tokenize(con_keys); // findkeysforcommand returns data for this
268
269 bool hit_con_bind = false;
270 for (int i = 0; i < keys; ++i)
271 if (nPrimary == stof(argv(i)))
272 hit_con_bind = true;
273
274 if (key_pressed)
275 {
276 if (nPrimary == K_ALT) hudShiftState |= S_ALT;
277 if (nPrimary == K_CTRL) hudShiftState |= S_CTRL;
278 if (nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
279 if (nPrimary == K_TAB) hudShiftState |= S_TAB;
280 }
281 else
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
289 if (nPrimary == K_TAB)
290 {
291 if (!key_pressed)
292 return true;
293 if (scoreboard_ui_enabled == 2)
294 {
296 goto uparrow_action;
297 else
298 goto downarrow_action;
299 }
300
302 {
308 }
309 else
310 {
316 }
317
319 }
320 else if (nPrimary == K_DOWNARROW)
321 {
322 if (!key_pressed)
323 return true;
324 LABEL(downarrow_action);
326 {
327 if (scoreboard_ui_enabled == 2)
328 {
329 bool scoreboard_selected_team_found = !scoreboard_selected_team;
330
331 entity curr_team = NULL;
332 for (entity tm = teams.sort_next; tm; tm = tm.sort_next)
333 {
334 if (tm.team == NUM_SPECTATOR)
335 continue;
336 curr_team = tm;
337 if (scoreboard_selected_team_found)
338 goto ok_team;
339 if (scoreboard_selected_team == tm)
340 scoreboard_selected_team_found = true;
341 }
342 LABEL(ok_team);
343 if (curr_team == scoreboard_selected_team) // loop reached the last team
344 curr_team = NULL;
345 scoreboard_selected_team = curr_team;
346 }
347 else
348 {
349 bool scoreboard_selected_player_found = !scoreboard_selected_player;
350
351 entity curr_pl = NULL;
352 for (entity pl, tm = teams.sort_next; tm; tm = tm.sort_next)
353 if (tm.team != NUM_SPECTATOR)
354 for (pl = players.sort_next; pl; pl = pl.sort_next)
355 {
356 if (pl.team != tm.team)
357 continue;
358 curr_pl = pl;
359 if (scoreboard_selected_player_found)
360 goto ok_done;
362 scoreboard_selected_player_found = true;
363 }
364 LABEL(ok_done);
365 if (curr_pl == scoreboard_selected_player) // loop reached the last player
366 curr_pl = NULL;
368 }
369 }
370 }
371 else if (nPrimary == K_UPARROW)
372 {
373 if (!key_pressed)
374 return true;
375 LABEL(uparrow_action);
377 {
378 if (scoreboard_ui_enabled == 2)
379 {
381 for (entity tm = teams.sort_next; tm; tm = tm.sort_next)
382 {
383 if (tm.team == NUM_SPECTATOR)
384 continue;
385 if (tm == scoreboard_selected_team)
386 goto ok_team2;
387 prev_team = tm;
388 }
389 LABEL(ok_team2);
391 }
392 else
393 {
394 entity prev_pl = NULL;
395 for (entity pl, tm = teams.sort_next; tm; tm = tm.sort_next)
396 if (tm.team != NUM_SPECTATOR)
397 for (pl = players.sort_next; pl; pl = pl.sort_next)
398 {
399 if (pl.team != tm.team)
400 continue;
402 goto ok_done2;
403 prev_pl = pl;
404 }
405 LABEL(ok_done2);
407 }
408 }
409 }
410 else if (nPrimary == K_RIGHTARROW)
411 {
412 if (!key_pressed)
413 return true;
416 }
417 else if (nPrimary == K_LEFTARROW)
418 {
419 if (!key_pressed)
420 return true;
423 }
424 else if (nPrimary == K_ENTER || nPrimary == K_SPACE || nPrimary == K_KP_ENTER)
425 {
426 if (!key_pressed)
427 return true;
429 {
430 if (scoreboard_ui_enabled == 2)
431 {
432 string team_name;
434 team_name = "auto";
435 else
437 localcmd(sprintf("cmd selectteam %s; cmd join\n", team_name));
439 }
441 localcmd(sprintf("spectate %d\n", scoreboard_selected_player.sv_entnum + 1));
442 }
443 }
444 else if (nPrimary == 'c' && (hudShiftState & S_CTRL))
445 {
446 if (!key_pressed)
447 return true;
449 {
451 {
452 case 0:
454 {
455 localcmd(sprintf("scoreboard_columns_set\n")); // sets the layout saved in scoreboard_columns
457 break;
458 }
459 // fallthrough
460 case 1:
461 localcmd(sprintf("scoreboard_columns_set default\n"));
463 break;
464 case 2:
465 localcmd(sprintf("scoreboard_columns_set all\n"));
467 break;
468 }
469 }
470 }
471 else if (nPrimary == 'r' && (hudShiftState & S_CTRL))
472 {
473 if (!key_pressed)
474 return true;
476 localcmd("toggle hud_panel_scoreboard_scores_per_round\n");
477 }
478 else if (nPrimary == 't' && (hudShiftState & S_CTRL))
479 {
480 if (!key_pressed)
481 return true;
484 {
485 localcmd(sprintf("commandmode tell \"%s^7\"\n", entcs_GetName(scoreboard_selected_player.sv_entnum)));
487 }
488 }
489 else if (nPrimary == 'k' && (hudShiftState & S_CTRL))
490 {
491 if (!key_pressed)
492 return true;
495 {
496 localcmd(sprintf("vcall kick \"%s^7\"\n", entcs_GetName(scoreboard_selected_player.sv_entnum)));
497 }
498 }
499 else if (hit_con_bind || nPrimary == K_PAUSE)
500 return false;
501
502 return true;
503}
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:151
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:43
int SB_PANEL_FIRST
Definition scoreboard.qh:50
entity scoreboard_selected_player
Definition scoreboard.qh:45
int scoreboard_selected_columns_layout
Definition scoreboard.qh:47
int scoreboard_ui_enabled
Definition scoreboard.qh:39
entity scoreboard_selected_team
Definition scoreboard.qh:46
int SB_PANEL_SCOREBOARD
Definition scoreboard.qh:51
int SB_PANEL_MAX
Definition scoreboard.qh:53
int SB_PANEL_RANKINGS
Definition scoreboard.qh:52
float scoreboard_selected_panel_time
Definition scoreboard.qh:44
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(), teams, time, and tokenize().

Referenced by CSQC_InputEvent().

◆ Scoreboard_InitScores()

void Scoreboard_InitScores ( )

Definition at line 514 of file scoreboard.qc.

515{
518
519 int f;
520 FOREACH(Scores, !(scores_flags(it) & SFL_NOT_SORTABLE),
521 {
523 if (f == SFL_SORT_PRIO_PRIMARY)
524 ps_primary = it;
526 ps_secondary = it;
527 });
528 if (ps_secondary == NULL)
530
531 for (int i = 0; i < MAX_TEAMSCORE; ++i)
532 {
534 if (f == SFL_SORT_PRIO_PRIMARY)
535 ts_primary = i;
537 ts_secondary = i;
538 }
539 if (ts_secondary == -1)
541
543}
#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 198 of file scoreboard.qc.

199{
200 if (isdemo())
201 return;
202
203 if (mode == 1)
204 {
206 return;
207
208 // release player's pressed keys as they aren't released elsewhere
209 // in particular jump needs to be released as it may open the team selection
210 // (when server detects jump has been pressed it sends the command to open the team selection)
214 }
215 else
216 {
217 if (scoreboard_ui_enabled == 1)
218 return;
221 }
225}
void Release_Common_Keys()
Definition main.qc:475
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 656 of file scoreboard.qc.

657{
658 entity ent;
659 for (ent = player.sort_next; ent && Scoreboard_ComparePlayerScores(player, ent); ent = player.sort_next)
660 SORT_SWAP(player, ent);
661 for (ent = player.sort_prev; ent != players && Scoreboard_ComparePlayerScores(ent, player); ent = player.sort_prev)
662 SORT_SWAP(ent, player);
663}
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 546 of file scoreboard.qc.

547{
548 static float update_time;
549 if (time <= update_time)
550 return;
552
553 numplayers = 0;
554 //int num = 0;
555 for (entity tmp, pl = players.sort_next; pl; pl = pl.sort_next)
556 {
557 numplayers += pl.team != NUM_SPECTATOR;
558 //++num;
559 int Team = entcs_GetScoreTeam(pl.sv_entnum);
560 if (SetTeam(pl, Team))
561 {
562 tmp = pl.sort_prev;
564 if (tmp)
565 pl = tmp;
566 else
567 pl = players.sort_next;
568 }
569 }
570 /*
571 if (num != lastpnum)
572 print(strcat("PNUM: ", ftos(num), "\n"));
573 lastpnum = num;
574 */
575
576 // update the smallest and largest team sizes
577 if (!teamplay || !teams.sort_next)
578 ts_min = ts_max = 0;
579 else
580 {
581 ts_min = 255, ts_max = 0;
582
583 for (entity tm = teams.sort_next; tm; tm = tm.sort_next)
584 {
585 if (tm.team == NUM_SPECTATOR)
586 continue;
587
588 if (ts_min > tm.team_size)
589 ts_min = tm.team_size;
590 if (ts_max < tm.team_size)
591 ts_max = tm.team_size;
592 }
593 }
594}
bool SetTeam(entity o, int Team)
Definition main.qc:346
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:141
void Scoreboard_UpdatePlayerPos(entity player)
int ts_min
Definition scoreboard.qh:27
int numplayers
Definition scoreboard.qh:26
int ts_max
team size
Definition scoreboard.qh:27

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 702 of file scoreboard.qc.

703{
704 entity ent;
705 for (ent = Team.sort_next; ent && Scoreboard_CompareTeamScores(Team, ent); ent = Team.sort_next)
706 SORT_SWAP(Team, ent);
707 for (ent = Team.sort_prev; ent != teams && Scoreboard_CompareTeamScores(ent, Team); ent = Team.sort_prev)
708 SORT_SWAP(ent, Team);
709}
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 1764 of file scoreboard.qc.

1765{
1767 {
1769 {
1770 if (scoreboard_fade_alpha == 0)
1772 return false;
1773 }
1775 {
1777 return false;
1778 }
1779 return true;
1780 }
1781 else if (MUTATOR_CALLHOOK(DrawScoreboard))
1782 return false;
1783 else if (QuickMenu_IsOpened())
1784 return false;
1785 else if (HUD_Radar_Clickable())
1786 return false;
1787 else if (sb_showscores) // set by +showscores engine command
1788 return true;
1789 else if (intermission == 1)
1790 return true;
1791 else if (intermission == 2)
1792 return false;
1793 else if (spectatee_status != -1 && STAT(HEALTH) <= 0 && autocvar_cl_deathscoreboard && !MUTATOR_CALLHOOK(DrawDeathScoreboard)
1796 {
1797 return true;
1798 }
1799 else if (scoreboard_showscores_force || MUTATOR_CALLHOOK(DrawScoreboard_Force))
1800 return true;
1801 return false;
1802}
#define MUTATOR_CALLHOOK(id,...)
Definition base.qh:143
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:82
bool scoreboard_showscores_force
Definition racetimer.qh:46
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
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, 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 40 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

Definition at line 29 of file scoreboard.qh.

◆ numplayers

◆ SB_PANEL_FIRST

int SB_PANEL_FIRST = 1

Definition at line 50 of file scoreboard.qh.

Referenced by HUD_Scoreboard_InputEvent(), and Scoreboard_UI_Enable().

◆ SB_PANEL_MAX

int SB_PANEL_MAX = 2

Definition at line 53 of file scoreboard.qh.

Referenced by HUD_Scoreboard_InputEvent().

◆ SB_PANEL_RANKINGS

int SB_PANEL_RANKINGS = 2

Definition at line 52 of file scoreboard.qh.

Referenced by HUD_Scoreboard_InputEvent(), and Scoreboard_Rankings_Draw().

◆ SB_PANEL_SCOREBOARD

◆ sb_showscores

bool sb_showscores

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 47 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

◆ ts_min