X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fannouncer.qc;h=a2e13be53d12bd8901437715a28451a8aedc1c39;hb=e9e91f9bc18dd5002e60c595c83cb8f45068a14b;hp=19e51cedc6b98f2611c274476fba9cc0430300d2;hpb=9eb82dd6fc682e3ddecd471835f9047816236342;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/announcer.qc b/qcsrc/client/announcer.qc index 19e51cedc..a2e13be53 100644 --- a/qcsrc/client/announcer.qc +++ b/qcsrc/client/announcer.qc @@ -1,20 +1,29 @@ #include "announcer.qh" -#include "_all.qh" + +#include "mutators/events.qh" #include "../common/notifications.qh" #include "../common/stats.qh" -#include "../common/util.qh" bool announcer_1min; bool announcer_5min; +string AnnouncerOption() +{ + if(MUTATOR_CALLHOOK(AnnouncerOption, ret_string)) + return ret_string; + + return autocvar_cl_announcer; +} + 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) @@ -29,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 @@ -46,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)); } } @@ -69,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 } }