shithub: choc

Download patch

ref: d3cd96a9dc73d4b261757a34bf1e3c59b48ddf19
parent: d71cfa9e4af661ace3f957162fa14cbdba8bd83c
author: Simon Howard <fraggle@gmail.com>
date: Fri Apr 5 16:24:20 EDT 2013

Use two-stage netgame startup for Heretic.

Subversion-branch: /branches/v2-branch
Subversion-revision: 2584

--- a/src/heretic/d_main.c
+++ b/src/heretic/d_main.c
@@ -88,6 +88,7 @@
 
 static int show_endoom = 1;
 
+void D_ConnectNetGame(void);
 void D_CheckNetGame(void);
 void D_PageDrawer(void);
 void D_AdvanceDemo(void);
@@ -945,6 +946,14 @@
         testcontrols = true;
     }
 
+#ifdef FEATURE_MULTIPLAYER
+    tprintf("NET_Init: Init network subsystem.\n", 1);
+    NET_Init ();
+#endif
+
+    I_InitTimer();
+    D_ConnectNetGame();
+
     // haleyjd: removed WATCOMC
     initStartup();
 
@@ -971,11 +980,6 @@
     tprintf(DEH_String("MN_Init: Init menu system.\n"), 1);
     MN_Init();
 
-#ifdef FEATURE_MULTIPLAYER
-    tprintf ("NET_Init: Init network subsystem.\n", 1);
-    NET_Init ();
-#endif
-
     CT_Init();
 
     tprintf(DEH_String("R_Init: Init Heretic refresh daemon."), 1);
@@ -990,7 +994,6 @@
 
     tprintf(DEH_String("I_Init: Setting up machine state.\n"), 1);
     I_CheckIsScreensaver();
-    I_InitTimer();
     I_InitJoystick();
     IncThermo();
 
--- a/src/heretic/d_net.c
+++ b/src/heretic/d_net.c
@@ -176,18 +176,10 @@
     connect_data->is_freedoom = 0;
 }
 
-//
-// D_CheckNetGame
-// Works out player numbers among the net participants
-//
-
-void D_CheckNetGame (void)
+void D_ConnectNetGame(void)
 {
     net_connect_data_t connect_data;
-    net_gamesettings_t settings;
 
-    D_RegisterLoopCallbacks(&doom_loop_interface);
-
     InitConnectData(&connect_data);
     netgame = D_InitNetGame(&connect_data);
 
@@ -203,7 +195,19 @@
     {
         netgame = true;
     }
+}
 
+//
+// D_CheckNetGame
+// Works out player numbers among the net participants
+//
+
+void D_CheckNetGame (void)
+{
+    net_gamesettings_t settings;
+
+    D_RegisterLoopCallbacks(&doom_loop_interface);
+
     if (netgame)
     {
         autostart = true;
@@ -213,3 +217,4 @@
     D_StartNetGame(&settings);
     LoadGameSettings(&settings);
 }
+