Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/g_consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@
// ( 64) deathmatch mode change
#define EV_ON_ADMIN ( 128) // admin
#define EV_ON_UNADMIN ( 256) // unadmin
#define EV_ON_COUNTDOWN_START ( 512) // countdown start
#define EV_ON_COUNTDOWN_BREAK (1024) // countdown break

// CTF
#define CTF_RUNE_RES 1 // IT_SIGIL1
Expand Down
2 changes: 2 additions & 0 deletions include/g_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,8 @@ void on_match_end(gedict_t *p);
void on_match_break(gedict_t *p);
void on_admin(gedict_t *p);
void on_unadmin(gedict_t *p);
void on_countdown_start(gedict_t *p);
void on_countdown_break(gedict_t *p);

void info_ev_update(gedict_t *p, char *from, char *to);
void info_kf_update(gedict_t *p, char *from, char *to);
Expand Down
36 changes: 36 additions & 0 deletions src/g_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -2576,6 +2576,40 @@ void on_unadmin(gedict_t *p)
stuffcmd_flags(p, STUFFCMD_IGNOREINDEMO, "on_unadmin\n");
}

void on_countdown_start(gedict_t *p)
{
if (!(iKey(p, "ev") & EV_ON_COUNTDOWN_START))
{
return;
}

if (p->ct == ctPlayer)
{
stuffcmd_flags(p, STUFFCMD_IGNOREINDEMO, "on_countdown_start\n");
}
else
{
stuffcmd_flags(p, STUFFCMD_IGNOREINDEMO, "on_spec_countdown_start\n");
}
}

void on_countdown_break(gedict_t *p)
{
if (!(iKey(p, "ev") & EV_ON_COUNTDOWN_BREAK))
{
return;
}

if (p->ct == ctPlayer)
{
stuffcmd_flags(p, STUFFCMD_IGNOREINDEMO, "on_countdown_break\n");
}
else
{
stuffcmd_flags(p, STUFFCMD_IGNOREINDEMO, "on_spec_countdown_break\n");
}
}

void ev_print(gedict_t *p, int new_ev, int old_ev, int bit, char *msg)
{
int on;
Expand All @@ -2597,6 +2631,8 @@ void info_ev_update(gedict_t *p, char *from, char *to)
ev_print(p, new_ev, old_ev, EV_ON_MATCH_BREAK, "[on_matchbreak] event: ");
ev_print(p, new_ev, old_ev, EV_ON_ADMIN, "[on_admin] event: ");
ev_print(p, new_ev, old_ev, EV_ON_UNADMIN, "[on_unadmin] event: ");
ev_print(p, new_ev, old_ev, EV_ON_COUNTDOWN_START, "[on_countdown_start] event: ");
ev_print(p, new_ev, old_ev, EV_ON_COUNTDOWN_BREAK, "[on_countdown_break] event: ");
}

void info_kf_update(gedict_t *p, char *from, char *to)
Expand Down
23 changes: 23 additions & 0 deletions src/match.c
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,26 @@ void SM_on_MatchStart(void)
}
}

void SM_on_CountdownStart(void)
{
gedict_t *p;

for (p = world; (p = find_client(p));)
{
on_countdown_start(p);
}
}

void SM_on_CountdownBreak(void)
{
gedict_t *p;

for (p = world; (p = find_client(p));)
{
on_countdown_break(p);
}
}

// Reset player frags and start the timer.
void HideSpawnPoints(void);

Expand Down Expand Up @@ -2536,6 +2556,8 @@ void StartTimer(void)
localcmd("serverinfo status Countdown\n");

StartDemoRecord(); // if allowed

SM_on_CountdownStart();
}

static qbool match_can_cancel_demo(void)
Expand Down Expand Up @@ -3116,6 +3138,7 @@ void PlayerBreak(void)
{
G_bprint(2, "%s %s\n", self->netname, redtext("stops the countdown"));
StopTimer(1);
SM_on_CountdownBreak();
}
else
{
Expand Down