diff options
author | Simon Howard | 2013-04-05 20:15:56 +0000 |
---|---|---|
committer | Simon Howard | 2013-04-05 20:15:56 +0000 |
commit | d71cfa9e4af661ace3f957162fa14cbdba8bd83c (patch) | |
tree | d7ee9b4635c4d44fe071ca0e99ab720706b7ee14 /src | |
parent | 6617f41db080196a0e0844c2fcf6e4f982e161b3 (diff) | |
download | chocolate-doom-d71cfa9e4af661ace3f957162fa14cbdba8bd83c.tar.gz chocolate-doom-d71cfa9e4af661ace3f957162fa14cbdba8bd83c.tar.bz2 chocolate-doom-d71cfa9e4af661ace3f957162fa14cbdba8bd83c.zip |
Split Doom netgame startup into two stages.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2583
Diffstat (limited to 'src')
-rw-r--r-- | src/d_loop.c | 9 | ||||
-rw-r--r-- | src/d_loop.h | 2 | ||||
-rw-r--r-- | src/doom/d_main.c | 52 | ||||
-rw-r--r-- | src/doom/d_net.c | 24 | ||||
-rw-r--r-- | src/heretic/d_net.c | 4 | ||||
-rw-r--r-- | src/hexen/d_net.c | 4 | ||||
-rw-r--r-- | src/strife/d_net.c | 4 |
7 files changed, 46 insertions, 53 deletions
diff --git a/src/d_loop.c b/src/d_loop.c index a22c1bd2..04d6ef0f 100644 --- a/src/d_loop.c +++ b/src/d_loop.c @@ -143,7 +143,7 @@ static boolean BuildNewTic(void) gameticdiv = gametic/ticdup; I_StartTic (); - loop_interface->ProcesEvents(); + loop_interface->ProcessEvents(); // Always run the menu @@ -422,6 +422,10 @@ boolean D_InitNetGame(net_connect_data_t *connect_data) net_addr_t *addr = NULL; int i; + // Call D_QuitNetGame on exit: + + I_AtExit(D_QuitNetGame, true); + #ifdef FEATURE_MULTIPLAYER //! @@ -519,12 +523,9 @@ boolean D_InitNetGame(net_connect_data_t *connect_data) void D_QuitNetGame (void) { #ifdef FEATURE_MULTIPLAYER - NET_SV_Shutdown(); NET_CL_Disconnect(); - #endif - } static int GetLowTic(void) diff --git a/src/d_loop.h b/src/d_loop.h index 9ff30b4c..7eed035b 100644 --- a/src/d_loop.h +++ b/src/d_loop.h @@ -33,7 +33,7 @@ typedef struct { // 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. diff --git a/src/doom/d_main.c b/src/doom/d_main.c index 0746a579..9f8b806c 100644 --- a/src/doom/d_main.c +++ b/src/doom/d_main.c @@ -134,7 +134,8 @@ char mapdir[1024]; // directory of development maps int show_endoom = 1; -void D_CheckNetGame (void); +void D_ConnectNetGame(void); +void D_CheckNetGame(void); // @@ -1366,7 +1367,32 @@ void D_DoomMain (void) 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 @@ void D_DoomMain (void) 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 (); @@ -1523,16 +1537,6 @@ void D_DoomMain (void) 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); diff --git a/src/doom/d_net.c b/src/doom/d_net.c index 29e2e7c6..15f1098e 100644 --- a/src/doom/d_net.c +++ b/src/doom/d_net.c @@ -216,20 +216,9 @@ static void InitConnectData(net_connect_data_t *connect_data) 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,12 +235,23 @@ void D_CheckNetGame (void) { 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); LoadGameSettings(&settings); diff --git a/src/heretic/d_net.c b/src/heretic/d_net.c index 3950b129..54b0c14d 100644 --- a/src/heretic/d_net.c +++ b/src/heretic/d_net.c @@ -188,10 +188,6 @@ void D_CheckNetGame (void) D_RegisterLoopCallbacks(&doom_loop_interface); - // Call D_QuitNetGame on exit - - I_AtExit(D_QuitNetGame, true); - InitConnectData(&connect_data); netgame = D_InitNetGame(&connect_data); diff --git a/src/hexen/d_net.c b/src/hexen/d_net.c index 16525340..bacd1332 100644 --- a/src/hexen/d_net.c +++ b/src/hexen/d_net.c @@ -218,10 +218,6 @@ void D_CheckNetGame (void) D_RegisterLoopCallbacks(&hexen_loop_interface); - // Call D_QuitNetGame on exit - - I_AtExit(D_QuitNetGame, true); - InitConnectData(&connect_data); netgame = D_InitNetGame(&connect_data); diff --git a/src/strife/d_net.c b/src/strife/d_net.c index 355dde56..42de5bd0 100644 --- a/src/strife/d_net.c +++ b/src/strife/d_net.c @@ -231,10 +231,6 @@ void D_CheckNetGame (void) D_RegisterLoopCallbacks(&strife_loop_interface); - // Call D_QuitNetGame on exit - - I_AtExit(D_QuitNetGame, true); - InitConnectData(&connect_data); netgame = D_InitNetGame(&connect_data); |