summaryrefslogtreecommitdiff
path: root/src/hexen
diff options
context:
space:
mode:
authorSimon Howard2013-04-05 19:42:26 +0000
committerSimon Howard2013-04-05 19:42:26 +0000
commit6617f41db080196a0e0844c2fcf6e4f982e161b3 (patch)
treed184d55a3cb93848ab7022562ec7416a3fe252de /src/hexen
parent2840213616978c2d806c35b586ff1c4beff0f187 (diff)
downloadchocolate-doom-6617f41db080196a0e0844c2fcf6e4f982e161b3.tar.gz
chocolate-doom-6617f41db080196a0e0844c2fcf6e4f982e161b3.tar.bz2
chocolate-doom-6617f41db080196a0e0844c2fcf6e4f982e161b3.zip
Split D_InitNetGame() into two separate functions for startup.
Subversion-branch: /branches/v2-branch Subversion-revision: 2582
Diffstat (limited to 'src/hexen')
-rw-r--r--src/hexen/d_net.c71
1 files changed, 26 insertions, 45 deletions
diff --git a/src/hexen/d_net.c b/src/hexen/d_net.c
index 7d663154..16525340 100644
--- a/src/hexen/d_net.c
+++ b/src/hexen/d_net.c
@@ -112,8 +112,7 @@ static loop_interface_t hexen_loop_interface = {
// Load game settings from the specified structure and
// set global variables.
-static void LoadGameSettings(net_gamesettings_t *settings,
- net_connect_data_t *connect_data)
+static void LoadGameSettings(net_gamesettings_t *settings)
{
unsigned int i;
@@ -125,15 +124,7 @@ static void LoadGameSettings(net_gamesettings_t *settings,
// TODO startloadgame = settings->loadgame;
nomonsters = settings->nomonsters;
respawnparm = settings->respawn_monsters;
-
- if (!connect_data->drone)
- {
- consoleplayer = settings->consoleplayer;
- }
- else
- {
- consoleplayer = 0;
- }
+ consoleplayer = settings->consoleplayer;
for (i=0; i<MAXPLAYERS; ++i)
{
@@ -150,11 +141,8 @@ static void LoadGameSettings(net_gamesettings_t *settings,
// Save the game settings from global variables to the specified
// game settings structure.
-static void SaveGameSettings(net_gamesettings_t *settings,
- net_connect_data_t *connect_data)
+static void SaveGameSettings(net_gamesettings_t *settings)
{
- int i;
-
// jhaley 20120715: Some parts of the structure are being left
// uninitialized. If -class is not used on the command line, this
// can lead to a crash in SB_Init due to player class == 0xCCCCCCCC.
@@ -173,6 +161,11 @@ static void SaveGameSettings(net_gamesettings_t *settings,
settings->respawn_monsters = respawnparm;
settings->timelimit = 0;
settings->lowres_turn = false;
+}
+
+static void InitConnectData(net_connect_data_t *connect_data)
+{
+ int i;
//
// Connect data
@@ -213,29 +206,6 @@ static void SaveGameSettings(net_gamesettings_t *settings,
connect_data->is_freedoom = 0;
}
-void D_InitSinglePlayerGame(net_gamesettings_t *settings)
-{
- // default values for single player
-
- settings->consoleplayer = 0;
- settings->num_players = 1;
-
- netgame = false;
-
- //!
- // @category net
- //
- // Start the game playing as though in a netgame with a single
- // player. This can also be used to play back single player netgame
- // demos.
- //
-
- if (M_CheckParm("-solo-net") > 0)
- {
- netgame = true;
- }
-}
-
//
// D_CheckNetGame
// Works out player numbers among the net participants
@@ -248,23 +218,34 @@ void D_CheckNetGame (void)
D_RegisterLoopCallbacks(&hexen_loop_interface);
- // Call D_QuitNetGame on exit
+ // Call D_QuitNetGame on exit
I_AtExit(D_QuitNetGame, true);
- SaveGameSettings(&settings, &connect_data);
+ InitConnectData(&connect_data);
+ netgame = D_InitNetGame(&connect_data);
- if (D_InitNetGame(&connect_data, &settings))
+ //!
+ // @category net
+ //
+ // Start the game playing as though in a netgame with a single
+ // player. This can also be used to play back single player netgame
+ // demos.
+ //
+
+ if (M_CheckParm("-solo-net") > 0)
{
netgame = true;
- autostart = true;
}
- else
+
+ if (netgame)
{
- D_InitSinglePlayerGame(&settings);
+ autostart = true;
}
- LoadGameSettings(&settings, &connect_data);
+ SaveGameSettings(&settings);
+ D_StartNetGame(&settings);
+ LoadGameSettings(&settings);
}
//==========================================================================