|
Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
|
|
#include "scores.qh"#include <common/mapinfo.qh>#include <common/mutators/base.qh>#include <common/net_linked.qh>#include <common/playerstats.qh>#include <common/scores.qh>#include <common/state.qh>#include <common/stats.qh>#include <common/teams.qh>#include <common/weapons/_all.qh>#include <server/client.qh>#include <server/command/common.qh>#include <server/intermission.qh>#include <server/mutators/_mod.qh>#include <server/round_handler.qh>#include <server/world.qh>Go to the source code of this file.
Functions | |
| string | GetPlayerScoreString (entity pl, float shortString) |
| Returns score strings for eventlog etc. | |
| string | GetScoreLogLabel (string label, float fl) |
| string | GetTeamScoreString (int tm, float shortString) |
| float | PlayerScore_Add (entity player, PlayerScoreField scorefield, float score) |
| Adds a score to the player's scores. | |
| void | PlayerScore_Attach (entity player) |
| Attaches a PlayerScore entity to a player. | |
| bool | PlayerScore_Clear (entity player) |
| Initialize the score of this player if needed. | |
| float | PlayerScore_Compare (entity t1, entity t2, bool strict) |
| void | PlayerScore_Detach (entity player) |
| Detaches a PlayerScore entity from the player. | |
| void | PlayerScore_PlayerStats (entity p) |
| bool | PlayerScore_SendEntity (entity this, entity to, float sendflags) |
| float | PlayerScore_Set (entity player, PlayerScoreField scorefield, float score) |
| Sets the player's score to the score parameter. | |
| entity | PlayerScore_Sort (.float field, int teams, bool strict, bool nospectators) |
| Sorts the players and stores their place in the given field, starting with. | |
| void | PlayerScore_TeamStats () |
| float | PlayerTeamScore_Add (entity player, PlayerScoreField pscorefield, float tscorefield, float score) |
| Adds a score to both the player and the team. | |
| int | PlayerTeamScore_Compare (entity p1, entity p2, float teams, bool strict) |
| void | Score_ClearAll () |
| Clear ALL scores (for ready-restart). | |
| void | Score_NicePrint (entity to) |
| Prints the scores to the console of a player. | |
| string | Score_NicePrint_ItemColor (int vflags) |
| void | Score_NicePrint_Player (entity to, entity p, float w) |
| void | Score_NicePrint_Spectator (entity to, entity p) |
| void | Score_NicePrint_Spectators (entity to) |
| void | Score_NicePrint_Team (entity to, float t, float w) |
| int | ScoreField_Compare (entity t1, entity t2,.float field, int fieldflags, int previous) |
| void | ScoreInfo_Init (int teams) |
| Initialize the scores info for the given number of teams. | |
| bool | ScoreInfo_SendEntity (entity this, entity to, int sf) |
| void | ScoreInfo_SetLabel_PlayerScore (PlayerScoreField i, string label, int scoreflags) |
| void | ScoreInfo_SetLabel_TeamScore (int i, string label, int scoreflags) |
| float | TeamScore_Add (entity player, float scorefield, float score) |
| Adds a score to the player's team's scores. | |
| float | TeamScore_AddToTeam (int t, float scorefield, float score) |
| Adds a score to the given team. | |
| int | TeamScore_Compare (entity t1, entity t2, bool strict) |
| float | TeamScore_GetCompareValue (float t) |
| Returns a value indicating the team score (and higher is better). | |
| bool | TeamScore_SendEntity (entity this, entity to, float sendflags) |
| void | TeamScore_Spawn (float t, string name) |
| void | WinningConditionHelper (entity this) |
| Sets the following results for the current scores entities. | |
Variables | |
| const float | NAMEWIDTH = 22 |
| float | score_dummyfield |
| entity | scorekeeper |
| int | scores_flags_primary |
| int | scores_flags_secondary |
| var int | scores_primary |
| var int | scores_secondary |
| const float | SCORESWIDTH = 58 |
| entity | teamscorekeepers [16] |
| int | teamscores_entities_count |
| int | teamscores_flags_primary |
| var int | teamscores_primary |
Returns score strings for eventlog etc.
When called with NULL, or 0, as argument, they return the labels in the same order. The strings are comma separated; labels that end with !! designate primary, labels that end with ! designate high priority. Labels get an appended < if the scores are better if smaller (e.g. deaths). High priorities always come first. Example label string: score!!,kills,deaths<,suicides< If shortString is set, only the sort keys are returned.
Definition at line 613 of file scores.qc.
References CS(), entity(), FOREACH, ftos(), GetScoreLogLabel(), scorekeeper, scores_flags, scores_label, SFL_SORT_PRIO_MASK, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_SECONDARY, strcat(), strlen, and substring().
Referenced by DumpStats(), and WinningConditionHelper().
Definition at line 602 of file scores.qc.
References SFL_LOWER_IS_BETTER, SFL_SORT_PRIO_MASK, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_SECONDARY, and strcat().
Referenced by GetPlayerScoreString(), and GetTeamScoreString().
Definition at line 674 of file scores.qc.
References entity(), ftos(), GetScoreLogLabel(), MAX_TEAMSCORE, SFL_SORT_PRIO_MASK, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_SECONDARY, strcat(), strlen, substring(), teamscorekeepers, teamscores_flags, and teamscores_label.
Referenced by DumpStats(), and WinningConditionHelper().
| float PlayerScore_Add | ( | entity | player, |
| PlayerScoreField | scorefield, | ||
| float | score ) |
Adds a score to the player's scores.
NEVER call this if PlayerScore_Attach has not been called yet! Means: FIXME make players unable to join the game when not called ClientConnect yet. Returns the new score.
Definition at line 352 of file scores.qc.
References BIT, CS(), entity(), game_stopped, LOG_WARN, M_ARGV, MUTATOR_CALLHOOK, PlayerStats_GameReport_Event_Player, PLAYERSTATS_TOTAL, scores_initialized, scores_label, strcat(), and warmup_stage.
Referenced by _GameRules_scoring_add_float2int(), and PlayerTeamScore_Add().
Attaches a PlayerScore entity to a player.
Use that in ClientConnect. Remember to detach it in ClientDisconnect!
Definition at line 334 of file scores.qc.
References CS(), entity(), error, Net_LinkEntity(), new_pure, PlayerScore_SendEntity(), and scorekeeper.
Referenced by ClientState_attach().
Initialize the score of this player if needed.
Does nothing in teamplay. Use that when a spectator becomes a player. Returns whether clearing has been performed
Definition at line 285 of file scores.qc.
References BIT, CS(), entity(), FOREACH, MUTATOR_CALLHOOK, scores_label, and teamscores_entities_count.
Referenced by PutPlayerInServer(), and SetPlayerTeam().
Definition at line 415 of file scores.qc.
References entity(), FOREACH, result, ScoreField_Compare(), scores, scores_flags, scores_flags_primary, scores_flags_secondary, scores_label, scores_primary, scores_secondary, and SFL_SORT_PRIO_MASK.
Referenced by PlayerTeamScore_Compare(), and WinningConditionHelper().
Detaches a PlayerScore entity from the player.
Use that in ClientDisconnect.
Definition at line 344 of file scores.qc.
References CS(), entity(), error, NULL, and scorekeeper.
Referenced by ClientState_detach().
Definition at line 950 of file scores.qc.
References CS(), entity(), FOREACH, PlayerStats_GameReport_Event_Player, PLAYERSTATS_SCOREBOARD, scores_label, and strcat().
Referenced by PlayerStats_GameReport().
Definition at line 257 of file scores.qc.
References BIT, entity(), etof, FOREACH, MSG_ENTITY, owner, scores, WriteByte(), WriteChar(), WriteHeader, and WriteShort().
Referenced by PlayerScore_Attach().
| float PlayerScore_Set | ( | entity | player, |
| PlayerScoreField | scorefield, | ||
| float | score ) |
Sets the player's score to the score parameter.
NEVER call this if PlayerScore_Attach has not been called yet! Means: FIXME make players unable to join the game when not called ClientConnect yet. Returns the new (or old if unchanged) score.
Definition at line 384 of file scores.qc.
References BIT, CS(), entity(), game_stopped, LOG_WARN, scores_initialized, and scores_label.
Referenced by NET_HANDLE().
Sorts the players and stores their place in the given field, starting with.
Definition at line 748 of file scores.qc.
References CS(), entity(), FOREACH_CLIENT, FRAGS_SPECTATOR, NULL, PlayerTeamScore_Compare(), scorekeeper, and teams.
Referenced by MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), PlayerStats_GameReport(), and Score_NicePrint().
| void PlayerScore_TeamStats | ( | ) |
Definition at line 960 of file scores.qc.
References entity(), MAX_TEAMSCORE, PlayerStats_GameReport_Event_Team, PLAYERSTATS_SCOREBOARD, strcat(), teamscorekeepers, and teamscores_label.
Referenced by PlayerStats_GameReport().
| float PlayerTeamScore_Add | ( | entity | player, |
| PlayerScoreField | pscorefield, | ||
| float | tscorefield, | ||
| float | score ) |
Adds a score to both the player and the team.
Returns the team score if possible, otherwise the player score.
Definition at line 406 of file scores.qc.
References entity(), PlayerScore_Add(), TeamScore_Add(), and teamscores_entities_count.
Referenced by _GameRules_scoring_add_float2int().
Definition at line 730 of file scores.qc.
References CS(), entity(), PlayerScore_Compare(), scorekeeper, teams, TeamScore_Compare(), teamscorekeepers, and teamscores_entities_count.
Referenced by PlayerScore_Sort().
| void Score_ClearAll | ( | ) |
Clear ALL scores (for ready-restart).
Definition at line 306 of file scores.qc.
References BIT, CS(), entity(), FOREACH, FOREACH_CLIENTSLOT, MAX_TEAMSCORE, scores_label, teamscorekeepers, and teamscores_label.
Referenced by reset_map().
Prints the scores to the console of a player.
Definition at line 917 of file scores.qc.
References bound(), entity(), floor(), FOREACH, FOREACH_CLIENT, IS_PLAYER, PlayerScore_Sort(), score_dummyfield, Score_NicePrint_Player(), Score_NicePrint_Spectator(), Score_NicePrint_Spectators(), Score_NicePrint_Team(), scores_label, SCORESWIDTH, and teamscores_entities_count.
Referenced by CommonCommand_teamstatus(), MUTATOR_HOOKFUNCTION(), and MUTATOR_HOOKFUNCTION().
Definition at line 832 of file scores.qc.
References SFL_SORT_PRIO_PRIMARY, and SFL_SORT_PRIO_SECONDARY.
Referenced by Score_NicePrint_Player(), and Score_NicePrint_Team().
Definition at line 876 of file scores.qc.
References CS(), entity(), FOREACH, NAMEWIDTH, playername(), print_to(), Score_NicePrint_ItemColor(), scores_flags, scores_label, ScoreString(), strcat(), strlen, and substring().
Referenced by Score_NicePrint().
Definition at line 911 of file scores.qc.
References entity(), playername(), print_to(), and strcat().
Referenced by Score_NicePrint().
Definition at line 906 of file scores.qc.
References entity(), and print_to().
Referenced by Score_NicePrint().
Definition at line 842 of file scores.qc.
References entity(), FOREACH, max(), MAX_TEAMSCORE, NAMEWIDTH, print_to(), s2, Score_NicePrint_ItemColor(), scores_flags, scores_label, ScoreString(), strcat(), substring(), Team_ColoredFullName, teamscorekeepers, teamscores_flags, and teamscores_label.
Referenced by Score_NicePrint().
Definition at line 30 of file scores.qc.
References entity(), SFL_LOWER_IS_BETTER, SFL_NOT_SORTABLE, and SFL_ZERO_IS_WORST.
Referenced by PlayerScore_Compare(), and TeamScore_Compare().
Initialize the scores info for the given number of teams.
Set all labels right before this call.
Definition at line 232 of file scores.qc.
References BIT, Net_LinkEntity(), new_pure, NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, NUM_TEAM_4, ScoreInfo_SendEntity(), scores_initialized, teams, and TeamScore_Spawn().
Referenced by ScoreRules_basics_end().
Definition at line 204 of file scores.qc.
References CS(), cvar_string(), entity(), FOREACH, loaded_gametype_custom_string, MapInfo_LoadedGametype, MAX_TEAMSCORE, MSG_ENTITY, scores_flags, scores_label, SendWelcomeMessage(), strcat(), teamscores_flags, teamscores_label, time, WriteByte(), WriteHeader, WriteRegistered, and WriteString().
Referenced by ScoreInfo_Init().
| void ScoreInfo_SetLabel_PlayerScore | ( | PlayerScoreField | i, |
| string | label, | ||
| int | scoreflags ) |
Definition at line 167 of file scores.qc.
References PlayerStats_GameReport_AddEvent(), PLAYERSTATS_SCOREBOARD, PLAYERSTATS_TOTAL, scores, scores_flags, scores_flags_primary, scores_flags_secondary, scores_label, scores_primary, scores_secondary, SFL_SORT_PRIO_MASK, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_SECONDARY, and strcat().
Referenced by round_handler_Spawn(), and ScoreRules_basics().
Definition at line 188 of file scores.qc.
References PlayerStats_GameReport_AddEvent(), PLAYERSTATS_SCOREBOARD, PLAYERSTATS_TOTAL, SFL_SORT_PRIO_MASK, SFL_SORT_PRIO_PRIMARY, strcat(), teamscores, teamscores_flags, teamscores_flags_primary, teamscores_label, and teamscores_primary.
Referenced by ScoreRules_basics().
Adds a score to the player's team's scores.
NEVER call this if team has not been set yet! Returns the new score.
Definition at line 134 of file scores.qc.
References entity(), and TeamScore_AddToTeam().
Referenced by PlayerTeamScore_Add().
Adds a score to the given team.
NEVER call this if team has not been set yet! Returns the new score.
Definition at line 107 of file scores.qc.
References BIT, entity(), error, game_stopped, scores_initialized, teamscorekeepers, and teamscores_label.
Referenced by CA_CheckWinner(), ctf_Handle_Return(), Domination_CheckWinner(), dompointthink(), freezetag_CheckWinner(), GoalTouch(), Onslaught_CheckWinner(), TeamScore_Add(), WinningCondition_Assault(), and WinningCondition_RanOutOfSpawns().
Definition at line 140 of file scores.qc.
References boolean, entity(), error, MAX_TEAMSCORE, result, ScoreField_Compare(), teamscores, teamscores_flags, and teamscores_primary.
Referenced by PlayerTeamScore_Compare(), and WinningConditionHelper().
Returns a value indicating the team score (and higher is better).
Definition at line 806 of file scores.qc.
References entity(), error, game_stopped, SFL_LOWER_IS_BETTER, SFL_ZERO_IS_WORST, teamscorekeepers, and teamscores_flags_primary.
Referenced by WinningCondition_Scores().
Definition at line 63 of file scores.qc.
References assert, BIT, entity(), eprint(), MAX_TEAMSCORE, MSG_ENTITY, team, teamscores, WriteByte(), WriteChar(), WriteHeader, and WriteShort().
Referenced by TeamScore_Spawn().
Definition at line 96 of file scores.qc.
References entity(), name, Net_LinkEntity(), new_pure, PlayerStats_GameReport_AddTeam(), TeamScore_SendEntity(), teamscorekeepers, and teamscores_entities_count.
Referenced by ScoreInfo_Init().
Sets the following results for the current scores entities.
Definition at line 443 of file scores.qc.
References autocvar_g_full_getstatus_responses, autocvar_g_xonoticversion, CS(), cvar_purechanges_count, entity(), FOREACH_CLIENT, ftos(), GetGametype(), GetPlayerScoreString(), GetTeamScoreString(), INGAME_JOINED, IS_PLAYER, IS_REAL_CLIENT, modname, nJoinAllowed(), NULL, player_count, PlayerScore_Compare(), scores_flags_primary, serverflags, SFL_LOWER_IS_BETTER, SFL_ZERO_IS_WORST, strcat(), strcpy, sv_termsofservice_url_escaped, TeamScore_Compare(), teamscorekeepers, teamscores_entities_count, teamscores_flags_primary, WinningConditionHelper_equality, WinningConditionHelper_lowerisbetter, WinningConditionHelper_second, WinningConditionHelper_secondscore, WinningConditionHelper_secondteam, WinningConditionHelper_topscore, WinningConditionHelper_winner, WinningConditionHelper_winnerteam, WinningConditionHelper_zeroisworst, and worldstatus.
Referenced by spawnfunc(), WinningCondition_Assault(), WinningCondition_Invasion(), WinningCondition_LMS(), and WinningCondition_Scores().
| const float NAMEWIDTH = 22 |
Definition at line 829 of file scores.qc.
Referenced by Score_NicePrint_Player(), and Score_NicePrint_Team().
| float score_dummyfield |
Definition at line 916 of file scores.qc.
Referenced by PlayerStats_GameReport(), and Score_NicePrint().
| entity scorekeeper |
Definition at line 19 of file scores.qc.
Referenced by GetPlayerScoreString(), PlayerScore_Attach(), PlayerScore_Detach(), PlayerScore_Sort(), and PlayerTeamScore_Compare().
| int scores_flags_primary |
Definition at line 24 of file scores.qc.
Referenced by PlayerScore_Compare(), ScoreInfo_SetLabel_PlayerScore(), and WinningConditionHelper().
| int scores_flags_secondary |
Definition at line 27 of file scores.qc.
Referenced by PlayerScore_Compare(), and ScoreInfo_SetLabel_PlayerScore().
| var int scores_primary |
Definition at line 22 of file scores.qc.
Referenced by PlayerScore_Compare(), and ScoreInfo_SetLabel_PlayerScore().
| var int scores_secondary |
Definition at line 26 of file scores.qc.
Referenced by PlayerScore_Compare(), and ScoreInfo_SetLabel_PlayerScore().
| const float SCORESWIDTH = 58 |
Definition at line 830 of file scores.qc.
Referenced by Score_NicePrint().
| entity teamscorekeepers[16] |
Definition at line 20 of file scores.qc.
Referenced by GetTeamScoreString(), PlayerScore_TeamStats(), PlayerStats_GameReport_Reset_All(), PlayerTeamScore_Compare(), Score_ClearAll(), Score_NicePrint_Team(), TeamScore_AddToTeam(), TeamScore_GetCompareValue(), TeamScore_Spawn(), and WinningConditionHelper().
| int teamscores_entities_count |
Definition at line 21 of file scores.qc.
Referenced by PlayerScore_Clear(), PlayerTeamScore_Add(), PlayerTeamScore_Compare(), Score_NicePrint(), TeamScore_Spawn(), and WinningConditionHelper().
| int teamscores_flags_primary |
Definition at line 25 of file scores.qc.
Referenced by ScoreInfo_SetLabel_TeamScore(), TeamScore_GetCompareValue(), and WinningConditionHelper().
| var int teamscores_primary |
Definition at line 23 of file scores.qc.
Referenced by ScoreInfo_SetLabel_TeamScore(), and TeamScore_Compare().