foxygit / doom Log in
commit 79446c49acfeb8b97fc535268cea4d9343cbaadf
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Sat Nov 27 15:36:43 2010 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Sat Nov 27 15:36:43 2010 +0000

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

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 2171
---
 src/d_main.c |  7 ++-----
 src/d_net.c  | 20 +++++++++++++++-----
 src/p_spec.c |  5 ++---
 3 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/src/d_main.c b/src/d_main.c
index 671c4e9c..a5b38949 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -1305,10 +1305,9 @@ void D_DoomMain (void)

     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 @@ void D_DoomMain (void)

     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;
     }

diff --git a/src/d_net.c b/src/d_net.c
index faf47821..b8e34dec 100644
--- a/src/d_net.c
+++ b/src/d_net.c
@@ -378,12 +378,22 @@ void D_CheckNetGame (void)

     // 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");
+        }
     }
 }

diff --git a/src/p_spec.c b/src/p_spec.c
index 37beb850..fa3ec335 100644
--- a/src/p_spec.c
+++ b/src/p_spec.c
@@ -1389,10 +1389,9 @@ void P_SpawnSpecials (void)
     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 @@ void P_SpawnSpecials (void)
     {
 	levelTimer = false;
     }
-
+
     //	Init special SECTORs.
     sector = sectors;
     for (i=0 ; i<numsectors ; i++, sector++)