summaryrefslogtreecommitdiff
path: root/src/strife/d_net.c
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/strife/d_net.c
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/strife/d_net.c')
-rw-r--r--src/strife/d_net.c70
1 files changed, 26 insertions, 44 deletions
diff --git a/src/strife/d_net.c b/src/strife/d_net.c
index a3f5513c..355dde56 100644
--- a/src/strife/d_net.c
+++ b/src/strife/d_net.c
@@ -117,8 +117,7 @@ static loop_interface_t strife_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;
@@ -133,6 +132,7 @@ static void LoadGameSettings(net_gamesettings_t *settings,
fastparm = settings->fast_monsters;
respawnparm = settings->respawn_monsters;
timelimit = settings->timelimit;
+ consoleplayer = settings->consoleplayer;
if (lowres_turn)
{
@@ -140,16 +140,7 @@ static void LoadGameSettings(net_gamesettings_t *settings,
"because there is a client recording a Vanilla demo.\n");
}
- if (!connect_data->drone)
- {
- consoleplayer = settings->consoleplayer;
- }
- else
- {
- consoleplayer = 0;
- }
-
- for (i=0; i<MAXPLAYERS; ++i)
+ for (i = 0; i < MAXPLAYERS; ++i)
{
playeringame[i] = i < settings->num_players;
}
@@ -158,8 +149,7 @@ 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)
{
// Fill in game settings structure with appropriate parameters
// for the new game
@@ -177,7 +167,10 @@ static void SaveGameSettings(net_gamesettings_t *settings,
settings->lowres_turn = M_CheckParm("-record") > 0
&& M_CheckParm("-longtics") == 0;
+}
+static void InitConnectData(net_connect_data_t *connect_data)
+{
connect_data->drone = false;
connect_data->max_players = MAXPLAYERS;
@@ -216,7 +209,8 @@ static void SaveGameSettings(net_gamesettings_t *settings,
// Are we recording a demo? Possibly set lowres turn mode
- connect_data->lowres_turn = settings->lowres_turn;
+ connect_data->lowres_turn = M_CheckParm("-record") > 0
+ && M_CheckParm("-longtics") == 0;
// Read checksums of our WAD directory and dehacked information
@@ -226,29 +220,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
@@ -264,19 +235,30 @@ void D_CheckNetGame (void)
I_AtExit(D_QuitNetGame, true);
- SaveGameSettings(&settings, &connect_data);
+ InitConnectData(&connect_data);
+ netgame = D_InitNetGame(&connect_data);
+
+ //!
+ // @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 (D_InitNetGame(&connect_data, &settings))
+ 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);
// Strife games are always deathmatch, though -altdeath is
// supported for respawning items.