X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fannouncer.qc;h=b53c04da052b048a233054639cbf659480d3cc34;hb=915eaae02a08ea935c9c4b3ba7e5596fa1fbe9da;hp=0409aea8bcdee9ca80b59562ba10ef1ae742e2d0;hpb=d598635bbc779b2d8e4f247f2b3c30e18d1b4d9f;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/announcer.qc b/qcsrc/client/announcer.qc index 0409aea8b..b53c04da0 100644 --- a/qcsrc/client/announcer.qc +++ b/qcsrc/client/announcer.qc @@ -1,40 +1,41 @@ -void Announcer_Play(string announcement) -{ - /*if((announcement != previous_announcement) || (time >= (previous_announcement_time + autocvar_cl_announcer_antispam))) - { - sound(world, CH_INFO, strcat("announcer/", autocvar_cl_announcer, "/", announcement, ".wav"), VOL_BASEVOICE, ATTN_NONE); - - if(previous_announcement) { strunzone(previous_announcement); } - - previous_announcement = strzone(announcement); - previous_announcement_time = time; - }*/ -} - float announcer_1min; float announcer_5min; void Announcer_Countdown() { float starttime = getstatf(STAT_GAMESTARTTIME); + float roundstarttime = getstatf(STAT_ROUNDSTARTTIME); + if(roundstarttime == -1) + { + Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_ROUNDSTOP); + remove(self); + return; + } + if(roundstarttime >= starttime) + starttime = roundstarttime; + if(starttime <= time && roundstarttime != starttime) // game start time has passed + announcer_5min = announcer_1min = FALSE; // reset maptime announcers now as well + float countdown = (starttime - time); float countdown_rounded = floor(0.5 + countdown); - + if(countdown <= 0) // countdown has finished, starttime is now { + Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_BEGIN); Local_Notification(MSG_MULTI, MULTI_COUNTDOWN_BEGIN); - announcer_5min = announcer_1min = FALSE; // reset maptime announcers now as well remove(self); return; } else // countdown is still going { - Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_GAMESTART, countdown_rounded); - - switch(countdown_rounded) + if(roundstarttime == starttime) + { + Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_ROUNDSTART, countdown_rounded); + Local_Notification(MSG_ANNCE, Announcer_PickNumber(CNT_ROUNDSTART, countdown_rounded)); + } + else { - case 1: Local_Notification(MSG_ANNCE, ANNCE_NUM_1); break; - case 2: Local_Notification(MSG_ANNCE, ANNCE_NUM_2); break; - case 3: Local_Notification(MSG_ANNCE, ANNCE_NUM_3); break; + Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_GAMESTART, countdown_rounded); + Local_Notification(MSG_ANNCE, Announcer_PickNumber(CNT_GAMESTART, countdown_rounded)); } self.nextthink = (starttime - (countdown - 1)); @@ -52,17 +53,24 @@ void Announcer_Countdown() void Announcer_Gamestart() { float startTime = getstatf(STAT_GAMESTARTTIME); - + float roundstarttime = getstatf(STAT_ROUNDSTARTTIME); + if(roundstarttime > startTime) + startTime = roundstarttime; + if(previous_game_starttime != startTime) { if((time + 5.0) < startTime) // if connecting to server while restart was active don't always play prepareforbattle Local_Notification(MSG_ANNCE, ANNCE_PREPARE); - + if(time < startTime) { - entity e; - e = spawn(); - e.think = Announcer_Countdown; + entity e = find(world, classname, "announcer_countdown"); + if not(e) + { + e = spawn(); + e.classname = "announcer_countdown"; + e.think = Announcer_Countdown; + } e.nextthink = startTime - floor(startTime - time); //synchronize nextthink to startTime } }