X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fannouncer.qc;h=9da998ae679f65c6819a9141f2388cec8735d33b;hb=719ba01817465b96db552e18c7f277721d8dbb7e;hp=5de03953cd4e4dc3a25c7a541a7dcc43c5f907e6;hpb=7efb90d3f4f1f73636764ee8ab21f667d1b49a05;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/announcer.qc b/qcsrc/client/announcer.qc index 5de03953c..9da998ae6 100644 --- a/qcsrc/client/announcer.qc +++ b/qcsrc/client/announcer.qc @@ -1,22 +1,29 @@ #include "announcer.qh" -#include "autocvars.qh" -#include "main.qh" +#include "mutators/events.qh" + #include "../common/notifications.qh" #include "../common/stats.qh" -#include "../common/util.qh" -#include "../dpdefs/csprogsdefs.qh" bool announcer_1min; bool announcer_5min; +string AnnouncerOption() +{ + string ret = autocvar_cl_announcer; + MUTATOR_CALLHOOK(AnnouncerOption, ret); + ret = ret_string; + return ret; +} + void Announcer_Countdown() { + SELFPARAM(); float starttime = getstatf(STAT_GAMESTARTTIME); float roundstarttime = getstatf(STAT_ROUNDSTARTTIME); if(roundstarttime == -1) { Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_ROUNDSTOP); - remove(self); + remove(this); return; } if(roundstarttime >= starttime) @@ -31,7 +38,7 @@ void Announcer_Countdown() { Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_BEGIN); Local_Notification(MSG_MULTI, MULTI_COUNTDOWN_BEGIN); - remove(self); + remove(this); return; } else // countdown is still going @@ -48,7 +55,7 @@ void Announcer_Countdown() Local_Notification(MSG_ANNCE, Announcer_PickNumber(CNT_GAMESTART, countdown_rounded)); } - self.nextthink = (starttime - (countdown - 1)); + this.nextthink = (starttime - (countdown - 1)); } } @@ -71,19 +78,18 @@ void Announcer_Gamestart() { if(time < startTime) { - entity e = find(world, classname, "announcer_countdown"); - if (!e) + static entity announcer_countdown; + if (!announcer_countdown) { - e = spawn(); - e.classname = "announcer_countdown"; - e.think = Announcer_Countdown; + announcer_countdown = new(announcer_countdown); + announcer_countdown.think = Announcer_Countdown; } if(time + 5.0 < startTime) // if connecting to server while restart was active don't always play prepareforbattle - if(time > e.nextthink) // don't play it again if countdown was already going + if(time > announcer_countdown.nextthink) // don't play it again if countdown was already going Local_Notification(MSG_ANNCE, ANNCE_PREPARE); - e.nextthink = startTime - floor(startTime - time); //synchronize nextthink to startTime + announcer_countdown.nextthink = startTime - floor(startTime - time); //synchronize nextthink to startTime } }