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

Go to the source code of this file.

Functions

void round_handler_FirstThink (entity this)
void round_handler_Init (float the_delay, float the_count, float the_round_timelimit)
void round_handler_Remove ()
void round_handler_Reset (float next_think)
void round_handler_Spawn (bool() canRoundStart_func, bool() canRoundEnd_func, void() roundStart_func)
void round_handler_Think (entity this)

Function Documentation

◆ round_handler_FirstThink()

void round_handler_FirstThink ( entity this)

Definition at line 96 of file round_handler.qc.

97{
101}
float count
Definition powerups.qc:22
float round_starttime
Definition stats.qh:83
float game_starttime
Definition stats.qh:82
float time
float nextthink
float max(float f,...)
void round_handler_Think(entity this)
#define setthink(e, f)

References count, entity(), game_starttime, max(), nextthink, round_handler_Think(), round_starttime, setthink, and time.

Referenced by round_handler_Spawn().

◆ round_handler_Init()

void round_handler_Init ( float the_delay,
float the_count,
float the_round_timelimit )

Definition at line 84 of file round_handler.qc.

85{
86 entity this = round_handler;
87 this.delay = (the_delay > 0) ? the_delay : 0;
88 this.count = fabs(floor(the_count));
89 this.cnt = this.count + 1;
90 this.round_timelimit = (the_round_timelimit > 0) ? the_round_timelimit : 0;
91 round_limit = the_round_timelimit;
92}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float cnt
Definition powerups.qc:24
float delay
Definition items.qc:17
float round_limit
Definition stats.qh:378
float fabs(float f)
float floor(float f)
float round_timelimit
entity round_handler

References cnt, count, delay, entity(), fabs(), floor(), round_handler, round_limit, and round_timelimit.

Referenced by CA_CheckWinner(), dom_DelayedInit(), Domination_CheckWinner(), freezetag_CheckWinner(), freezetag_Initialize(), Invasion_CheckWinner(), invasion_DelayedInit(), ons_DelayedInit(), Onslaught_CheckWinner(), REGISTER_MUTATOR(), round_handler_Spawn(), Surv_CheckWinner(), and surv_Initialize().

◆ round_handler_Remove()

void round_handler_Remove ( )

Definition at line 139 of file round_handler.qc.

140{
141 delete(round_handler);
143}
#define NULL
Definition post.qh:14

References NULL, and round_handler.

Referenced by round_handler_Think().

◆ round_handler_Reset()

void round_handler_Reset ( float next_think)

Definition at line 124 of file round_handler.qc.

125{
126 entity this = round_handler;
127 this.wait = false;
129 if (this.count)
130 if (this.cnt < this.count + 1) this.cnt = this.count + 1;
131 this.nextthink = next_think;
132 if (next_think)
133 {
134 if (next_think <= game_starttime) rounds_played = 0;
135 round_starttime = next_think + this.count;
136 }
137}
float wait
Definition items.qc:17
int rounds_played
Definition stats.qh:379
#define round_handler_ResetEndDelayTime()

References cnt, count, entity(), game_starttime, nextthink, round_handler, round_handler_ResetEndDelayTime, round_starttime, rounds_played, and wait.

Referenced by reset_map(), and round_handler_Think().

◆ round_handler_Spawn()

void round_handler_Spawn ( bool() canRoundStart_func,
bool() canRoundEnd_func,
void() roundStart_func )

Definition at line 103 of file round_handler.qc.

104{
105 if (round_handler)
106 {
107 backtrace("Can't spawn round_handler again!");
108 return;
109 }
111
113 this.canRoundStart = canRoundStart_func;
114 this.canRoundEnd = canRoundEnd_func;
115 this.roundStart = roundStart_func;
116 this.wait = false;
118 round_handler_Init(5, 5, 180);
119 this.nextthink = time;
120
121 ScoreInfo_SetLabel_PlayerScore(SP_ROUNDS_PL, "rounds_pl", 0);
122}
#define backtrace(msg)
Definition log.qh:96
#define new_pure(class)
purely logical entities (not linked to the area grid)
Definition oo.qh:66
void round_handler_Init(float the_delay, float the_count, float the_round_timelimit)
void round_handler_FirstThink(entity this)
void ScoreInfo_SetLabel_PlayerScore(PlayerScoreField i, string label, int scoreflags)
Definition scores.qc:168

References backtrace, entity(), new_pure, nextthink, round_handler, round_handler_FirstThink(), round_handler_Init(), round_handler_ResetEndDelayTime, ScoreInfo_SetLabel_PlayerScore(), setthink, time, and wait.

Referenced by dom_DelayedInit(), freezetag_Initialize(), invasion_DelayedInit(), ons_DelayedInit(), REGISTER_MUTATOR(), and surv_Initialize().

◆ round_handler_Think()

void round_handler_Think ( entity this)

Definition at line 13 of file round_handler.qc.

14{
16 {
19 return;
20 }
21
22 if (time < game_starttime)
23 {
25 return;
26 }
27
28 game_stopped = false;
29
30 if (this.wait)
31 {
32 this.wait = false;
33 this.cnt = this.count + 1; // init countdown
34 round_starttime = time + this.count;
35 reset_map(false);
36 }
37
38 if (this.cnt > 0) // countdown running
39 {
40 if (this.canRoundStart() && !(autocvar_g_campaign && !campaign_bots_may_start))
41 {
42 if (this.cnt == this.count + 1) round_starttime = time + this.count;
43 int f = this.cnt - 1;
44 if (f == 0)
45 {
46 FOREACH_CLIENT((IS_PLAYER(it) || INGAME(it)), {
47 GameRules_scoring_add(it, ROUNDS_PL, 1);
48 });
49 this.cnt = 0;
50 this.round_endtime = (this.round_timelimit) ? time + this.round_timelimit : 0;
51 this.nextthink = time;
53 if (this.roundStart) this.roundStart();
54 return;
55 }
56 --this.cnt;
57 }
58 else
59 {
61 round_starttime = -1; // can't start
62 }
63 this.nextthink = time + 1; // canRoundStart every second
64 }
65 else
66 {
67 if (this.canRoundEnd())
68 {
69 // schedule a new round
70 this.wait = true;
71 this.nextthink = time + this.delay;
73
74 // new round = last round ended
75 MUTATOR_CALLHOOK(RoundEnd);
76 }
77 else
78 {
79 this.nextthink = time; // canRoundEnd every frame
80 }
81 }
82}
#define MUTATOR_CALLHOOK(name,...)
Definition base.qh:186
#define IS_PLAYER(s)
Definition player.qh:242
float game_stopped
Definition stats.qh:81
bool intermission_running
bool autocvar_g_campaign
Definition menu.qc:752
void round_handler_Remove()
void round_handler_Reset(float next_think)
float round_endtime
bool campaign_bots_may_start
campaign mode: bots shall spawn but wait for the player to spawn before they do anything in other gam...
Definition campaign.qh:26
void reset_map(bool is_fake_round_start)
Definition vote.qc:351
#define INGAME(it)
Definition sv_rules.qh:24
#define GameRules_scoring_add(client, fld, value)
Definition sv_rules.qh:85
#define FOREACH_CLIENT(cond, body)
Definition utils.qh:52

References autocvar_g_campaign, campaign_bots_may_start, cnt, count, delay, entity(), FOREACH_CLIENT, game_starttime, game_stopped, GameRules_scoring_add, INGAME, intermission_running, IS_PLAYER, MUTATOR_CALLHOOK, nextthink, reset_map(), round_endtime, round_handler_Remove(), round_handler_Reset(), round_handler_ResetEndDelayTime, round_starttime, round_timelimit, rounds_played, time, and wait.

Referenced by round_handler_FirstThink().