|
Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
|
|
#include <common/scores.qh>Go to the source code of this file.
Macros | |
| #define | PlayerScore_Get(player, scorefield) |
| Returns the player's score. | |
| #define | WINNINGCONDITIONHELPER_LOWERISBETTER_WORST 999999999 |
Functions | |
| string | GetPlayerScoreString (entity pl, float shortString) |
| Returns score strings for eventlog etc. | |
| 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. | |
| void | PlayerScore_Detach (entity player) |
| Detaches a PlayerScore entity from the player. | |
| 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. | |
| float | PlayerTeamScore_Add (entity player, PlayerScoreField pscorefield, float tscorefield, float score) |
| Adds a score to both the player and the team. | |
| void | Score_ClearAll () |
| Clear ALL scores (for ready-restart). | |
| void | Score_NicePrint (entity to) |
| Prints the scores to the console of a player. | |
| void | ScoreInfo_Init (int teams) |
| Initialize the scores info for the given number of teams. | |
| void | ScoreInfo_SetLabel_PlayerScore (PlayerScoreField i, string label, float scoreflags) |
| Set the label of a player score item, as well as the scoring flags. | |
| void | ScoreInfo_SetLabel_TeamScore (int i, string label, float scoreflags) |
| Set the label of a team score item, as well as the scoring flags. | |
| 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. | |
| float | TeamScore_GetCompareValue (float t) |
| Returns a value indicating the team score (and higher is better). | |
| void | WinningConditionHelper (entity this) |
| Sets the following results for the current scores entities. | |
Variables | |
| bool | autocvar_g_full_getstatus_responses |
| entity | scores_initialized |
| float | WinningConditionHelper_equality |
| we have no winner | |
| float | WinningConditionHelper_lowerisbetter |
| lower is better, duh | |
| entity | WinningConditionHelper_second |
| the second player, or NULL if none | |
| float | WinningConditionHelper_secondscore |
| second highest score | |
| float | WinningConditionHelper_secondteam |
| the color of the second team, or -1 if none | |
| float | WinningConditionHelper_topscore |
| highest score | |
| entity | WinningConditionHelper_winner |
| the winning player, or NULL if none | |
| float | WinningConditionHelper_winnerteam |
| the color of the winning team, or -1 if none | |
| float | WinningConditionHelper_zeroisworst |
| zero is worst, duh | |
| #define PlayerScore_Get | ( | player, | |
| scorefield ) |
Returns the player's score.
| [in] | player | Player to inspect. |
| [in] | scorefield | Field of the score. |
Definition at line 42 of file scores.qh.
Referenced by DynamicHandicap_UpdateHandicap(), MayhemCalculatePlayerScore(), MUTATOR_HOOKFUNCTION(), and TeamBalance_GetPlayerForTeamSwitch().
| #define WINNINGCONDITIONHELPER_LOWERISBETTER_WORST 999999999 |
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 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.
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().
| 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().
| 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().
| 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().
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().
| void ScoreInfo_SetLabel_PlayerScore | ( | PlayerScoreField | i, |
| string | label, | ||
| float | scoreflags ) |
Set the label of a team score item, as well as the scoring flags.
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().
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().
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().
| bool autocvar_g_full_getstatus_responses |
Definition at line 5 of file scores.qh.
Referenced by WinningConditionHelper().
| entity scores_initialized |
Definition at line 7 of file scores.qh.
Referenced by GameplayMode_DelayedInit(), PlayerScore_Add(), PlayerScore_Set(), ScoreInfo_Init(), and TeamScore_AddToTeam().
| float WinningConditionHelper_equality |
we have no winner
Definition at line 111 of file scores.qh.
Referenced by WinningCondition_Scores(), and WinningConditionHelper().
| float WinningConditionHelper_lowerisbetter |
lower is better, duh
Definition at line 114 of file scores.qh.
Referenced by WinningCondition_Scores(), and WinningConditionHelper().
| entity WinningConditionHelper_second |
the second player, or NULL if none
Definition at line 113 of file scores.qh.
Referenced by WinningConditionHelper().
| float WinningConditionHelper_secondscore |
second highest score
Definition at line 108 of file scores.qh.
Referenced by WinningCondition_LMS(), WinningCondition_Scores(), and WinningConditionHelper().
| float WinningConditionHelper_secondteam |
the color of the second team, or -1 if none
Definition at line 110 of file scores.qh.
Referenced by WinningConditionHelper().
| float WinningConditionHelper_topscore |
highest score
Definition at line 107 of file scores.qh.
Referenced by WinningCondition_LMS(), WinningCondition_Scores(), and WinningConditionHelper().
| entity WinningConditionHelper_winner |
the winning player, or NULL if none
Definition at line 112 of file scores.qh.
Referenced by WinningCondition_LMS(), WinningCondition_Scores(), and WinningConditionHelper().
| float WinningConditionHelper_winnerteam |
the color of the winning team, or -1 if none
Definition at line 109 of file scores.qh.
Referenced by MatchEnd_RestoreSpectatorAndTeamStatus(), WinningCondition_Scores(), and WinningConditionHelper().
| float WinningConditionHelper_zeroisworst |
zero is worst, duh
Definition at line 115 of file scores.qh.
Referenced by WinningCondition_Scores(), and WinningConditionHelper().