]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Some more ground work...
authorSamual <samual@xonotic.org>
Tue, 18 Oct 2011 06:14:27 +0000 (02:14 -0400)
committerSamual <samual@xonotic.org>
Tue, 18 Oct 2011 06:14:27 +0000 (02:14 -0400)
qcsrc/client/View.qc
qcsrc/client/announcer.qc

index a90788526f2e5e12c9296e9b62722c71b7f0b4c5..aa70b736d9f69541034a1a301a24f47775317c93 100644 (file)
@@ -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)
index 833eb8e129fadfe0c2bbca7e220a86acae7050b7..65d7500cae6d65e0fe532bc952aa7e01bc761672 100644 (file)
@@ -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