From a4fd74c93d2c49bab59c9cfbb17530b004da7e9b Mon Sep 17 00:00:00 2001 From: Samual Date: Tue, 18 Oct 2011 02:14:27 -0400 Subject: [PATCH] Some more ground work... --- qcsrc/client/View.qc | 29 +---------------------------- qcsrc/client/announcer.qc | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index a90788526..aa70b736d 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -78,30 +78,6 @@ void Porto_Draw() } } -/** - * Checks whether the server initiated a map restart (stat_game_starttime changed) - * - * TODO: Use a better solution where a common shared entitiy is used that contains - * timelimit, fraglimit and game_starttime! Requires engine changes (remove STAT_TIMELIMIT - * and STAT_FRAGLIMIT to be auto-sent) - */ -void CheckForGamestartChange() { - float startTime; - startTime = getstatf(STAT_GAMESTARTTIME); - if (previous_game_starttime != startTime) { - if ((time + 5.0) < startTime) { - //if connecting to server while restart was active don't always play prepareforbattle - sound(world, CH_INFO, strcat("announcer/", autocvar_cl_announcer, "/prepareforbattle.wav"), VOL_BASEVOICE, ATTN_NONE); - } - if (time < startTime) { - restartAnnouncer = spawn(); - restartAnnouncer.think = restartAnnouncer_Think; - restartAnnouncer.nextthink = startTime - floor(startTime - time); //synchronize nextthink to startTime - } - } - previous_game_starttime = startTime; -} - void Porto_Init() { porto = spawn(); @@ -520,10 +496,7 @@ void CSQC_UpdateView(float w, float h) calledhooks |= HOOK_END; } - CheckForGamestartChange(); - serverAnnouncer(); - maptimeAnnouncer(); - carrierAnnouncer(); + Announcer(); fov = autocvar_fov; if(fov <= 59.5) diff --git a/qcsrc/client/announcer.qc b/qcsrc/client/announcer.qc index 833eb8e12..65d7500ca 100644 --- a/qcsrc/client/announcer.qc +++ b/qcsrc/client/announcer.qc @@ -9,6 +9,30 @@ void serverAnnouncer() } } +/** + * Checks whether the server initiated a map restart (stat_game_starttime changed) + * + * TODO: Use a better solution where a common shared entitiy is used that contains + * timelimit, fraglimit and game_starttime! Requires engine changes (remove STAT_TIMELIMIT + * and STAT_FRAGLIMIT to be auto-sent) + */ +void CheckForGamestartChange() { + float startTime; + startTime = getstatf(STAT_GAMESTARTTIME); + if (previous_game_starttime != startTime) { + if ((time + 5.0) < startTime) { + //if connecting to server while restart was active don't always play prepareforbattle + sound(world, CH_INFO, strcat("announcer/", autocvar_cl_announcer, "/prepareforbattle.wav"), VOL_BASEVOICE, ATTN_NONE); + } + if (time < startTime) { + restartAnnouncer = spawn(); + restartAnnouncer.think = restartAnnouncer_Think; + restartAnnouncer.nextthink = startTime - floor(startTime - time); //synchronize nextthink to startTime + } + } + previous_game_starttime = startTime; +} + void restartAnnouncer_Think() { float countdown_rounded, countdown; countdown = getstatf(STAT_GAMESTARTTIME) - time; @@ -130,6 +154,14 @@ void carrierAnnouncer() { redflag_prev = redflag; } +void Announcer() +{ + CheckForGamestartChange(); + serverAnnouncer(); + maptimeAnnouncer(); + carrierAnnouncer(); +} + /** * Add all future announcer sounds precaches here. * TODO: announcer queues -- 2.39.2