ref: d71cfa9e4af661ace3f957162fa14cbdba8bd83c
parent: 6617f41db080196a0e0844c2fcf6e4f982e161b3
author: Simon Howard <[email protected]>
date: Fri Apr 5 16:15:56 EDT 2013
Split Doom netgame startup into two stages. Subversion-branch: /branches/v2-branch Subversion-revision: 2583
--- a/src/d_loop.c
+++ b/src/d_loop.c
@@ -143,7 +143,7 @@
gameticdiv = gametic/ticdup;
I_StartTic ();
- loop_interface->ProcesEvents();
+ loop_interface->ProcessEvents();
// Always run the menu
@@ -422,6 +422,10 @@
net_addr_t *addr = NULL;
int i;
+ // Call D_QuitNetGame on exit:
+
+ I_AtExit(D_QuitNetGame, true);
+
#ifdef FEATURE_MULTIPLAYER
//!
@@ -519,12 +523,9 @@
void D_QuitNetGame (void)
{
#ifdef FEATURE_MULTIPLAYER
-
NET_SV_Shutdown();
NET_CL_Disconnect();
-
#endif
-
}
static int GetLowTic(void)
--- a/src/d_loop.h
+++ b/src/d_loop.h
@@ -33,7 +33,7 @@
{
// Read events from the event queue, and process them.
- void (*ProcesEvents)();
+ void (*ProcessEvents)();
// Given the current input state, fill in the fields of the specified
// ticcmd_t structure with data for a new tic.
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -134,7 +134,8 @@
int show_endoom = 1;
-void D_CheckNetGame (void);
+void D_ConnectNetGame(void);
+void D_CheckNetGame(void);
//
@@ -1366,7 +1367,32 @@
if (W_CheckNumForName(name[i])<0)
I_Error(DEH_String("\nThis is not the registered version."));
}
-
+
+ if (W_CheckNumForName("SS_START") >= 0
+ || W_CheckNumForName("FF_END") >= 0)
+ {
+ I_PrintDivider();
+ printf(" WARNING: The loaded WAD file contains modified sprites or\n"
+ " floor textures. You may want to use the '-merge' command\n"
+ " line option instead of '-file'.\n");
+ }
+
+ I_PrintStartupBanner(gamedescription);
+ PrintDehackedBanners();
+
+ DEH_printf("I_Init: Setting up machine state.\n");
+ I_CheckIsScreensaver();
+ I_InitTimer();
+ I_InitJoystick();
+
+#ifdef FEATURE_MULTIPLAYER
+ printf ("NET_Init: Init network subsystem.\n");
+ NET_Init ();
+#endif
+
+ // Initial netgame startup. Connect to server etc.
+ D_ConnectNetGame();
+
// get skill / episode / map from parms
startskill = sk_medium;
startepisode = 1;
@@ -1502,18 +1528,6 @@
startloadgame = -1;
}
- if (W_CheckNumForName("SS_START") >= 0
- || W_CheckNumForName("FF_END") >= 0)
- {
- I_PrintDivider();
- printf(" WARNING: The loaded WAD file contains modified sprites or\n"
- " floor textures. You may want to use the '-merge' command\n"
- " line option instead of '-file'.\n");
- }
-
- I_PrintStartupBanner(gamedescription);
- PrintDehackedBanners();
-
DEH_printf("M_Init: Init miscellaneous info.\n");
M_Init ();
@@ -1522,16 +1536,6 @@
DEH_printf("\nP_Init: Init Playloop state.\n");
P_Init ();
-
- DEH_printf("I_Init: Setting up machine state.\n");
- I_CheckIsScreensaver();
- I_InitTimer();
- I_InitJoystick();
-
-#ifdef FEATURE_MULTIPLAYER
- printf ("NET_Init: Init network subsystem.\n");
- NET_Init ();
-#endif
DEH_printf("S_Init: Setting up sound.\n");
S_Init (sfxVolume * 8, musicVolume * 8);
--- a/src/doom/d_net.c
+++ b/src/doom/d_net.c
@@ -216,21 +216,10 @@
connect_data->is_freedoom = W_CheckNumForName("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);
-
- // Call D_QuitNetGame on exit
-
- I_AtExit(D_QuitNetGame, true);
-
InitConnectData(&connect_data);
netgame = D_InitNetGame(&connect_data);
@@ -246,11 +235,22 @@
{
netgame = true;
}
+}
+//
+// D_CheckNetGame
+// Works out player numbers among the net participants
+//
+void D_CheckNetGame (void)
+{
+ net_gamesettings_t settings;
+
if (netgame)
{
autostart = true;
}
+
+ D_RegisterLoopCallbacks(&doom_loop_interface);
SaveGameSettings(&settings);
D_StartNetGame(&settings);
--- a/src/heretic/d_net.c
+++ b/src/heretic/d_net.c
@@ -188,10 +188,6 @@
D_RegisterLoopCallbacks(&doom_loop_interface);
- // Call D_QuitNetGame on exit
-
- I_AtExit(D_QuitNetGame, true);
-
InitConnectData(&connect_data);
netgame = D_InitNetGame(&connect_data);
--- a/src/hexen/d_net.c
+++ b/src/hexen/d_net.c
@@ -218,10 +218,6 @@
D_RegisterLoopCallbacks(&hexen_loop_interface);
- // Call D_QuitNetGame on exit
-
- I_AtExit(D_QuitNetGame, true);
-
InitConnectData(&connect_data);
netgame = D_InitNetGame(&connect_data);
--- a/src/strife/d_net.c
+++ b/src/strife/d_net.c
@@ -231,10 +231,6 @@
D_RegisterLoopCallbacks(&strife_loop_interface);
- // Call D_QuitNetGame on exit
-
- I_AtExit(D_QuitNetGame, true);
-
InitConnectData(&connect_data);
netgame = D_InitNetGame(&connect_data);