shithub: choc

Download patch

ref: 79446c49acfeb8b97fc535268cea4d9343cbaadf
parent: 74c2dc333a383f27ebddf479e3b666a9068d6d36
author: Simon Howard <[email protected]>
date: Sat Nov 27 10:36:43 EST 2010

Fix -timer / -avg options to work like Vanilla when playing demos.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2171

--- a/src/d_main.c
+++ b/src/d_main.c
@@ -1305,10 +1305,9 @@
 
     p = M_CheckParm ("-timer");
 
-    if (p && p < myargc-1 && deathmatch)
+    if (p && p < myargc-1)
     {
 	timelimit = atoi(myargv[p+1]);
-	printf("timer: %i\n", timelimit);
     }
 
     //!
@@ -1320,10 +1319,8 @@
 
     p = M_CheckParm ("-avg");
 
-    if (p && p < myargc-1 && deathmatch)
+    if (p && p < myargc-1)
     {
-        DEH_printf("Austin Virtual Gaming: Levels will end "
-                       "after 20 minutes\n");
 	timelimit = 20;
     }
 
--- a/src/d_net.c
+++ b/src/d_net.c
@@ -378,12 +378,22 @@
 
     // Show players here; the server might have specified a time limit
 
-    if (timelimit > 0)
+    if (timelimit > 0 && deathmatch)
     {
-	DEH_printf("Levels will end after %d minute", timelimit);
-	if (timelimit > 1)
-	    printf("s");
-	printf(".\n");
+        // Gross hack to work like Vanilla:
+
+        if (timelimit == 20 && M_CheckParm("-avg"))
+        {
+            DEH_printf("Austin Virtual Gaming: Levels will end "
+                           "after 20 minutes\n");
+        }
+        else
+        {
+            DEH_printf("Levels will end after %d minute", timelimit);
+            if (timelimit > 1)
+                printf("s");
+            printf(".\n");
+        }
     }
 }
 
--- a/src/p_spec.c
+++ b/src/p_spec.c
@@ -1389,10 +1389,9 @@
     if (W_CheckNumForName(DEH_String("texture2")) >= 0)
 	episode = 2;
 
-    
     // See if -TIMER was specified.
 
-    if (timelimit > 0)
+    if (timelimit > 0 && deathmatch)
     {
         levelTimer = true;
         levelTimeCount = timelimit * 60 * TICRATE;
@@ -1401,7 +1400,7 @@
     {
 	levelTimer = false;
     }
-    
+
     //	Init special SECTORs.
     sector = sectors;
     for (i=0 ; i<numsectors ; i++, sector++)