Xonotic
sv_rules.qh
Go to the documentation of this file.
1 #pragma once
2 
3 //int autocvar_leadlimit;
6 
7 // TODO: find a better location for these?
9 
10 .int ingame;
11 #define INGAME_STATUS_NONE 0
12 #define INGAME_STATUS_JOINING 0.5
13 #define INGAME_STATUS_JOINED 1
14 
15 // typically used by game modes that temporarily turn players into spectators/observers
16 // when they are eliminated but keeping them "in game", i.e. listed among players
17 #define INGAME_STATUS_SET(it, s) (it).ingame = s
18 #define INGAME_STATUS_CLEAR(it) INGAME_STATUS_SET(it, INGAME_STATUS_NONE)
19 
20 #define INGAME(it) ((it).ingame)
21 #define INGAME_JOINED(it) ((it).ingame == INGAME_STATUS_JOINED)
22 #define INGAME_JOINING(it) ((it).ingame == INGAME_STATUS_JOINING)
23 
24 
25 // todo: accept the number of teams as a parameter
26 void GameRules_teams(bool value);
27 
31 void GameRules_spawning_teams(bool value);
32 
36 void GameRules_score_enabled(bool value);
37 
38 void GameRules_limit_score(int limit);
39 void GameRules_limit_lead(int limit);
40 void GameRules_limit_time(int limit);
41 void GameRules_limit_time_qualifying(int limit);
42 
47 
53 #define GameRules_scoring(teams, spprio, stprio, fields) MACRO_BEGIN \
54  _GameRules_scoring_begin((teams), (spprio), (stprio)); \
55  noref void(entity, string, float) field = _GameRules_scoring_field; \
56  /* todo: just have the one `field` function */ \
57  noref void(int, string, float) field_team = _GameRules_scoring_field_team; \
58  LAMBDA(fields); \
59  _GameRules_scoring_end(); \
60 MACRO_END
61 
62 void _GameRules_scoring_begin(int teams, float spprio, float stprio);
63 void _GameRules_scoring_field(entity i, string label, int scoreflags);
64 void _GameRules_scoring_field_team(float i, string label, int scoreflags);
66 
72 void GameRules_scoring_vip(entity player, bool value);
73 bool GameRules_scoring_is_vip(entity player);
74 
75 #define GameRules_scoring_add_float2int(client, fld, value, float_field, score_factor) \
76  _GameRules_scoring_add_float2int(client, SP_##fld, value, float_field, score_factor)
77 float _GameRules_scoring_add_float2int(entity client, entity sp, float value, .float field, float score_factor);
78 #define GameRules_scoring_add(client, fld, value) _GameRules_scoring_add(client, SP_##fld, value)
79 float _GameRules_scoring_add(entity client, entity sp, float value);
80 #define GameRules_scoring_add_team(client, fld, value) _GameRules_scoring_add_team(client, SP_##fld, ST_##fld, value)
81 float _GameRules_scoring_add_team(entity client, entity sp, int st, float value);
void GameRules_limit_fallbacks()
Set any unspecified rules to their defaults.
Definition: sv_rules.qc:73
float _GameRules_scoring_add(entity client, entity sp, float value)
Definition: sv_rules.qc:126
bool GameRules_scoring_is_vip(entity player)
Definition: sv_rules.qc:102
entity() spawn
void GameRules_limit_time(int limit)
Definition: sv_rules.qc:54
void GameRules_scoring_vip(entity player, bool value)
Mark a player as being 'important' (flag carrier, ball carrier, etc)
Definition: sv_rules.qc:98
void GameRules_teams(bool value)
Definition: sv_rules.qc:6
void GameRules_limit_score(int limit)
Definition: sv_rules.qc:34
void _GameRules_scoring_end()
Definition: sv_rules.qc:92
void GameRules_score_enabled(bool value)
Disabling score disables the "score" column on the scoreboard.
Definition: sv_rules.qc:28
void GameRules_limit_time_qualifying(int limit)
Definition: sv_rules.qc:64
entity teams
Definition: main.qh:44
int autocvar_leadlimit_override
Definition: sv_rules.qh:5
int ingame
Definition: sv_rules.qh:10
int autocvar_leadlimit_and_fraglimit
Definition: sv_rules.qh:4
void _GameRules_scoring_field(entity i, string label, int scoreflags)
Definition: sv_rules.qc:84
void _GameRules_scoring_begin(int teams, float spprio, float stprio)
Definition: sv_rules.qc:80
void GameRules_limit_lead(int limit)
Definition: sv_rules.qc:44
int total_players
Definition: sv_rules.qh:8
void GameRules_spawning_teams(bool value)
Used to disable team spawns in team modes.
Definition: sv_rules.qc:22
float _GameRules_scoring_add_float2int(entity client, entity sp, float value,.float field, float score_factor)
Definition: sv_rules.qc:111
float _GameRules_scoring_add_team(entity client, entity sp, int st, float value)
Definition: sv_rules.qc:130
void _GameRules_scoring_field_team(float i, string label, int scoreflags)
Definition: sv_rules.qc:88