foxygit / doom Log in
commit 9a8cf12227923e3b2b83625d5b91af2f58cd856b
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Sun Dec 23 18:15:46 2012 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Sun Dec 23 18:15:46 2012 +0000

    Fix Doom episode 4 par time selection.

    Subversion-branch: /branches/v2-branch
    Subversion-revision: 2550
---
 src/doom/g_game.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/doom/g_game.c b/src/doom/g_game.c
index 4ffddb41..f4b64271 100644
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -1379,10 +1379,17 @@ void G_DoCompleted (void)
     wminfo.maxitems = totalitems;
     wminfo.maxsecret = totalsecret;
     wminfo.maxfrags = 0;
-    if ( gamemode == commercial )
-	wminfo.partime = TICRATE*cpars[gamemap-1];
+
+    // Set par time. Doom episode 4 doesn't have a par time, so this
+    // overflows into the cpars array. It's necessary to emulate this
+    // for statcheck regression testing.
+    if (gamemode == commercial)
+	wminfo.partime = TICRATE*cpars[gamemap-1];
+    else if (gameepisode < 4)
+	wminfo.partime = TICRATE*pars[gameepisode][gamemap];
     else
-	wminfo.partime = TICRATE*pars[gameepisode][gamemap];
+        wminfo.partime = TICRATE*cpars[gamemap];
+
     wminfo.pnum = consoleplayer;

     for (i=0 ; i<MAXPLAYERS ; i++)