diff --git a/include/g_consts.h b/include/g_consts.h index c49c52f0..185bf92c 100644 --- a/include/g_consts.h +++ b/include/g_consts.h @@ -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 diff --git a/include/g_local.h b/include/g_local.h index 711828f3..fa744359 100644 --- a/include/g_local.h +++ b/include/g_local.h @@ -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); diff --git a/src/g_utils.c b/src/g_utils.c index 774a1e56..de94b373 100644 --- a/src/g_utils.c +++ b/src/g_utils.c @@ -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; @@ -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) diff --git a/src/match.c b/src/match.c index c18d5756..2e408458 100644 --- a/src/match.c +++ b/src/match.c @@ -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); @@ -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) @@ -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 {