shithub: choc

Download patch

ref: 0688ecda7a802723ae64ab516cfe6508d9890ec7
parent: d1a3967194323b08227b20822acedb837e05281a
author: Simon Howard <fraggle@gmail.com>
date: Fri Dec 10 19:10:10 EST 2010

Rearrange single player init to always use net_gamesettings_t structure.

Subversion-branch: /branches/raven-branch
Subversion-revision: 2216

--- a/src/doom/d_net.c
+++ b/src/doom/d_net.c
@@ -337,9 +337,6 @@
 	printf("Syncing netgames like Vanilla Doom.\n");
     }
 
-    netgame = true;
-    autostart = true;
-
     if (!drone)
     {
         consoleplayer = settings->consoleplayer;
@@ -439,28 +436,15 @@
     connect_data->lowres_turn = settings->lowres_turn;
 }
 
-void D_InitSinglePlayerGame(void)
+void D_InitSinglePlayerGame(net_gamesettings_t *settings)
 {
-    int i;
-
     // default values for single player
 
-    consoleplayer = 0;
+    settings->consoleplayer = 0;
+    settings->num_players = 1;
+
     netgame = false;
-    ticdup = 1;
-    extratics = 1;
-    lowres_turn = false;
-    offsetms = 0;
-    
-    for (i=0; i<MAXPLAYERS; i++)
-    {
-        playeringame[i] = false;
-    }
 
-    recvtic = 0;
-
-    playeringame[0] = true;
-
     //!
     // @category net
     //
@@ -609,6 +593,9 @@
     net_connect_data_t connect_data;
     net_gamesettings_t settings;
 
+    offsetms = 0;
+    recvtic = 0;
+
     // Call D_QuitNetGame on exit 
 
     I_AtExit(D_QuitNetGame, true);
@@ -617,12 +604,15 @@
 
     if (D_InitNetGame(&connect_data, &settings))
     {
-        LoadGameSettings(&settings);
+        netgame = true;
+        autostart = true;
     }
     else
     {
-        D_InitSinglePlayerGame();
+        D_InitSinglePlayerGame(&settings);
     }
+
+    LoadGameSettings(&settings);
 
     DEH_printf("startskill %i  deathmatch: %i  startmap: %i  startepisode: %i\n",
                startskill, deathmatch, startmap, startepisode);