summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2006-03-30 18:17:58 +0000
committerSimon Howard2006-03-30 18:17:58 +0000
commit4c5d0e68a46ae1f1baf3d9407b0dbd08eda9b987 (patch)
treed61f1a66bb06f7176743f771edc1375cb3b02bc8
parentcd2a2a8d21ebcd5192f7c79793cf4c99790f6f11 (diff)
downloadchocolate-doom-4c5d0e68a46ae1f1baf3d9407b0dbd08eda9b987.tar.gz
chocolate-doom-4c5d0e68a46ae1f1baf3d9407b0dbd08eda9b987.tar.bz2
chocolate-doom-4c5d0e68a46ae1f1baf3d9407b0dbd08eda9b987.zip
Dedicated server mode.
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 454
-rw-r--r--src/Makefile.am4
-rw-r--r--src/d_main.c13
-rw-r--r--src/net_dedicated.c48
-rw-r--r--src/net_dedicated.h35
4 files changed, 97 insertions, 3 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index c9c3619b..56b7468c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,7 +4,6 @@ gamesdir = $(prefix)/games
games_PROGRAMS = chocolate-doom
AM_CFLAGS = -I../textscreen @SDL_CFLAGS@ @SDLMIXER_CFLAGS@ @SDLNET_CFLAGS@ -Wall
-chocolate_doom_LDADD = ../textscreen/libtextscreen.a @LDFLAGS@ @SDL_LIBS@ @SDLMIXER_LIBS@ @SDLNET_LIBS@
SOURCE_FILES=\
am_map.c am_map.h \
@@ -58,6 +57,7 @@ m_random.c m_random.h \
m_swap.c m_swap.h \
net_client.c net_client.h \
net_common.c net_common.h \
+net_dedicated.c net_dedicated.h \
net_defs.h \
net_gui.c net_gui.h \
net_io.c net_io.h \
@@ -114,6 +114,8 @@ else
chocolate_doom_SOURCES=$(SOURCE_FILES)
endif
+chocolate_doom_LDADD = ../textscreen/libtextscreen.a @LDFLAGS@ @SDL_LIBS@ @SDLMIXER_LIBS@ @SDLNET_LIBS@
+
EXTRA_DIST = convert-icon chocolate_doom_icon.c
.rc.o:
diff --git a/src/d_main.c b/src/d_main.c
index 82578c3c..7819c0c4 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: d_main.c 444 2006-03-25 21:50:32Z fraggle $
+// $Id: d_main.c 454 2006-03-30 18:17:58Z 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 444 2006-03-25 21:50:32Z fraggle $";
+static const char rcsid[] = "$Id: d_main.c 454 2006-03-30 18:17:58Z fraggle $";
#define BGCOLOR 7
#define FGCOLOR 8
@@ -238,6 +238,7 @@ static const char rcsid[] = "$Id: d_main.c 444 2006-03-25 21:50:32Z fraggle $";
#include "st_stuff.h"
#include "am_map.h"
#include "net_client.h"
+#include "net_dedicated.h"
#include "p_setup.h"
#include "r_local.h"
@@ -1348,6 +1349,14 @@ void D_DoomMain (void)
printf (DEH_String("Z_Init: Init zone memory allocation daemon. \n"));
Z_Init ();
+ if (M_CheckParm("-dedicated") > 0)
+ {
+ printf("Dedicated server mode.\n");
+ NET_DedicatedServer();
+
+ // Never returns
+ }
+
#ifdef FEATURE_DEHACKED
printf("DEH_Init: Init Dehacked support.\n");
DEH_Init();
diff --git a/src/net_dedicated.c b/src/net_dedicated.c
new file mode 100644
index 00000000..b3f41d6d
--- /dev/null
+++ b/src/net_dedicated.c
@@ -0,0 +1,48 @@
+// Emacs style mode select -*- C++ -*-
+//-----------------------------------------------------------------------------
+//
+// $Id: $
+//
+// Copyright(C) 2005 Simon Howard
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+//
+//-----------------------------------------------------------------------------
+//
+// Dedicated server code.
+//
+
+#include "doomtype.h"
+
+#include "i_system.h"
+
+#include "net_defs.h"
+#include "net_sdl.h"
+#include "net_server.h"
+
+void NET_DedicatedServer(void)
+{
+ NET_SV_Init();
+
+ NET_SV_AddModule(&net_sdl_module);
+
+ while (true)
+ {
+ NET_SV_Run();
+ I_Sleep(10);
+ }
+}
+
diff --git a/src/net_dedicated.h b/src/net_dedicated.h
new file mode 100644
index 00000000..54d0ad4c
--- /dev/null
+++ b/src/net_dedicated.h
@@ -0,0 +1,35 @@
+// Emacs style mode select -*- C++ -*-
+//-----------------------------------------------------------------------------
+//
+// $Id: $
+//
+// Copyright(C) 2005 Simon Howard
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+//
+//-----------------------------------------------------------------------------
+//
+// Dedicated server code.
+//
+
+#ifndef NET_DEDICATED_H
+#define NET_DEDICATED_H
+
+void NET_DedicatedServer(void);
+
+#endif /* #ifndef NET_DEDICATED_H */
+
+