ref: 2004f1db8a663b30f530aeda6d2e7a6ce518c0a9
parent: 5a0f347208b53e2ce955dbae91666fd51a8c0c6a
author: Simon Howard <fraggle@gmail.com>
date: Sat Mar 25 16:50:32 EST 2006
New feature to allow compiling without multiplayer support Subversion-branch: /trunk/chocolate-doom Subversion-revision: 444
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: d_main.c 440 2006-03-24 21:43:43Z fraggle $
+// $Id: d_main.c 444 2006-03-25 21:50:32Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -184,7 +184,7 @@
//-----------------------------------------------------------------------------
-static const char rcsid[] = "$Id: d_main.c 440 2006-03-24 21:43:43Z fraggle $";
+static const char rcsid[] = "$Id: d_main.c 444 2006-03-25 21:50:32Z fraggle $";
#define BGCOLOR 7
#define FGCOLOR 8
@@ -1647,8 +1647,10 @@
printf (DEH_String("I_Init: Setting up machine state.\n"));
I_Init ();
+#ifdef FEATURE_MULTIPLAYER
printf ("NET_Init: Initialise network subsystem.\n");
NET_Init ();
+#endif
printf (DEH_String("D_CheckNetGame: Checking network game status.\n"));
D_CheckNetGame ();
--- a/src/d_net.c
+++ b/src/d_net.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: d_net.c 441 2006-03-25 18:28:48Z fraggle $
+// $Id: d_net.c 444 2006-03-25 21:50:32Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -117,8 +117,9 @@
//-----------------------------------------------------------------------------
-static const char rcsid[] = "$Id: d_net.c 441 2006-03-25 18:28:48Z fraggle $";
+static const char rcsid[] = "$Id: d_net.c 444 2006-03-25 21:50:32Z fraggle $";
+#include "doomfeatures.h"
#include "d_main.h"
#include "m_argv.h"
@@ -196,11 +197,15 @@
if (singletics)
return;
+#ifdef FEATURE_MULTIPLAYER
+
// Run network subsystems
NET_CL_Run();
NET_SV_Run();
+#endif
+
// check time
nowtime = GetAdjustedTime()/ticdup;
newtics = nowtime - lasttime;
@@ -237,11 +242,15 @@
//printf ("mk:%i ",maketic);
G_BuildTiccmd(&cmd);
+#ifdef FEATURE_MULTIPLAYER
+
if (netgame && !demoplayback)
{
NET_CL_SendTiccmd(&cmd, maketic);
}
+#endif
+
netcmds[consoleplayer][maketic % BACKUPTICS] = cmd;
++maketic;
@@ -259,8 +268,6 @@
void D_CheckNetGame (void)
{
- net_module_t *connect_module = NULL;
- char *connect_addr;
int i;
int num_players;
@@ -281,50 +288,57 @@
playeringame[0] = true;
- // temporary hack
+#ifdef FEATURE_MULTIPLAYER
- if (M_CheckParm("-server") > 0)
{
- NET_SV_Init();
+ net_module_t *connect_module = NULL;
+ char *connect_addr;
- connect_module = &net_loop_client_module;
- connect_addr = "";
- }
- else
- {
- i = M_CheckParm("-connect");
+ if (M_CheckParm("-server") > 0)
+ {
+ NET_SV_Init();
- if (i > 0)
+ connect_module = &net_loop_client_module;
+ connect_addr = "";
+ }
+ else
{
- connect_module = &net_sdl_module;
- connect_addr = myargv[i+1];
+ i = M_CheckParm("-connect");
+
+ if (i > 0)
+ {
+ connect_module = &net_sdl_module;
+ connect_addr = myargv[i+1];
+ }
}
- }
- if (connect_module != NULL)
- {
- net_addr_t *addr;
+ if (connect_module != NULL)
+ {
+ net_addr_t *addr;
- connect_module->InitClient();
+ connect_module->InitClient();
- addr = connect_module->ResolveAddress(connect_addr);
+ addr = connect_module->ResolveAddress(connect_addr);
- if (addr == NULL)
- {
- I_Error("Unable to resolve \"%s\"", connect_addr);
- }
+ if (addr == NULL)
+ {
+ I_Error("Unable to resolve \"%s\"", connect_addr);
+ }
- if (!NET_CL_Connect(addr))
- {
- I_Error("D_CheckNetGame: Failed to connect to %s\n",
- NET_AddrToString(addr));
- }
+ if (!NET_CL_Connect(addr))
+ {
+ I_Error("D_CheckNetGame: Failed to connect to %s\n",
+ NET_AddrToString(addr));
+ }
- printf("D_CheckNetGame: Connected to %s\n", NET_AddrToString(addr));
+ printf("D_CheckNetGame: Connected to %s\n", NET_AddrToString(addr));
- NET_WaitForStart();
+ NET_WaitForStart();
+ }
}
+#endif
+
num_players = 0;
for (i=0; i<MAXPLAYERS; ++i)
@@ -352,8 +366,13 @@
if (debugfile)
fclose (debugfile);
+#ifdef FEATURE_MULTIPLAYER
+
NET_SV_Shutdown();
NET_CL_Disconnect();
+
+#endif
+
}
static int GetLowTic(void)
--- a/src/doomfeatures.h
+++ b/src/doomfeatures.h
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: doomfeatures.h 190 2005-10-12 21:52:01Z fraggle $
+// $Id: doomfeatures.h 444 2006-03-25 21:50:32Z fraggle $
//
// Copyright(C) 2005 Simon Howard
//
@@ -41,6 +41,10 @@
// Enables dehacked support ('-deh')
#define FEATURE_DEHACKED 1
+
+// Enables multiplayer support (network games)
+
+#define FEATURE_MULTIPLAYER 1
#endif /* #ifndef DOOM_FEATURES_H */
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: m_misc.c 429 2006-03-23 17:43:15Z fraggle $
+// $Id: m_misc.c 444 2006-03-25 21:50:32Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -106,7 +106,7 @@
//-----------------------------------------------------------------------------
static const char
-rcsid[] = "$Id: m_misc.c 429 2006-03-23 17:43:15Z fraggle $";
+rcsid[] = "$Id: m_misc.c 444 2006-03-25 21:50:32Z fraggle $";
#include <stdio.h>
#include <stdlib.h>
@@ -123,6 +123,7 @@
#include "config.h"
#include "doomdef.h"
+#include "doomfeatures.h"
#include "z_zone.h"
@@ -401,7 +402,9 @@
{"mouse_acceleration", &mouse_acceleration, DEFAULT_FLOAT},
{"show_endoom", &show_endoom},
{"vanilla_savegame_limit", &vanilla_savegame_limit},
+#ifdef FEATURE_MULTIPLAYER
{"player_name", &net_player_name, DEFAULT_STRING},
+#endif
};
static default_collection_t extra_defaults =