shithub: choc

Download patch

ref: d5b1a695090eb49da3a4277686a30920cd5de046
parent: a378d0288a77ef8efff439c5e250e82b03e2c502
author: Ryan Krafnick <kraflab@gmail.com>
date: Fri Mar 12 11:12:58 EST 2021

Fix heretic coop demos (#1358)

* Fix heretic coop demos

* Align whitespace

--- a/src/heretic/g_game.c
+++ b/src/heretic/g_game.c
@@ -115,6 +115,7 @@
 boolean lowres_turn;
 boolean shortticfix;            // calculate lowres turning like doom
 boolean demoplayback;
+boolean netdemo;
 boolean demoextend;
 byte *demobuffer, *demo_p, *demoend;
 boolean singledemo;             // quit after playing a demo from cmdline
@@ -1070,7 +1071,7 @@
             if (demorecording)
                 G_WriteDemoTiccmd(cmd);
 
-            if (netgame && !(gametic % ticdup))
+            if (netgame && !netdemo && !(gametic % ticdup))
             {
                 if (gametic > BACKUPTICS
                     && consistancy[i][buf] != cmd->consistancy)
@@ -1691,6 +1692,7 @@
     paused = false;
     demorecording = false;
     demoplayback = false;
+    netdemo = false;
     viewactive = true;
     gameepisode = episode;
     gamemap = map;
@@ -1987,11 +1989,22 @@
     for (i = 0; i < MAXPLAYERS; i++)
         playeringame[i] = (*demo_p++) != 0;
 
+    if (playeringame[1] || M_CheckParm("-solo-net") > 0
+                        || M_CheckParm("-netdemo") > 0)
+    {
+    	netgame = true;
+    }
+
     precache = false;           // don't spend a lot of time in loadlevel
     G_InitNew(skill, episode, map);
     precache = true;
     usergame = false;
     demoplayback = true;
+
+    if (netgame == true)
+    {
+      netdemo = true;
+    }
 }
 
 
@@ -2025,6 +2038,12 @@
         playeringame[i] = (*demo_p++) != 0;
     }
 
+    if (playeringame[1] || M_CheckParm("-solo-net") > 0
+                        || M_CheckParm("-netdemo") > 0)
+    {
+      netgame = true;
+    }
+
     G_InitNew(skill, episode, map);
     starttime = I_GetTime();
 
@@ -2032,6 +2051,11 @@
     demoplayback = true;
     timingdemo = true;
     singletics = true;
+
+    if (netgame == true)
+    {
+      netdemo = true;
+    }
 }
 
 
@@ -2066,6 +2090,8 @@
 
         W_ReleaseLumpName(defdemoname);
         demoplayback = false;
+        netdemo = false;
+        netgame = false;
         D_AdvanceDemo();
         return true;
     }