[chocolate-doom] 76/79: Remove new networking code from stable version

Jonathan Dowland jmtd at moszumanska.debian.org
Mon Jan 30 15:07:27 UTC 2017


This is an automated email from the git hooks/post-receive script.

jmtd pushed a commit to annotated tag chocolate-doom-0.1.3
in repository chocolate-doom.

commit 59de0cc2b8be20caa22c19dc7fa7aec9fd23da8c
Author: Simon Howard <fraggle at gmail.com>
Date:   Fri Jan 20 17:48:41 2006 +0000

    Remove new networking code from stable version
    
    Subversion-branch: /branches/CHOCOLATE_DOOM_0_1/chocolate-doom
    Subversion-revision: 304
---
 src/net_client.c   | 536 ----------------------------------------
 src/net_client.h   |  93 -------
 src/net_common.c   | 491 -------------------------------------
 src/net_common.h   | 107 --------
 src/net_gui.c      | 193 ---------------
 src/net_gui.h      |  50 ----
 src/net_io.c       | 133 ----------
 src/net_io.h       |  52 ----
 src/net_loop.c     | 233 ------------------
 src/net_loop.h     |  42 ----
 src/net_packet.c   | 299 ----------------------
 src/net_packet.h   |  65 -----
 src/net_sdl.c      | 295 ----------------------
 src/net_sdl.h      |  44 ----
 src/net_server.c   | 707 -----------------------------------------------------
 src/net_server.h   |  57 -----
 src/net_structrw.c | 215 ----------------
 src/net_structrw.h |  53 ----
 18 files changed, 3665 deletions(-)

diff --git a/src/net_client.c b/src/net_client.c
deleted file mode 100644
index 6d69ea4..0000000
--- a/src/net_client.c
+++ /dev/null
@@ -1,536 +0,0 @@
-// Emacs style mode select   -*- C++ -*- 
-//-----------------------------------------------------------------------------
-//
-// $Id: net_client.c 295 2006-01-14 02:06:48Z fraggle $
-//
-// 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.
-//
-// $Log$
-// Revision 1.21  2006/01/14 02:06:48  fraggle
-// Include the game version in the settings structure.
-//
-// Revision 1.20  2006/01/13 23:52:12  fraggle
-// Fix game start packet parsing logic.
-//
-// Revision 1.19  2006/01/13 02:19:18  fraggle
-// Only accept sane player values when starting a new game.
-//
-// Revision 1.18  2006/01/12 02:18:59  fraggle
-// Only start new games when in the waiting-for-start state.
-//
-// Revision 1.17  2006/01/12 02:11:52  fraggle
-// Game start packets
-//
-// Revision 1.16  2006/01/10 19:59:25  fraggle
-// Reliable packet transport mechanism
-//
-// Revision 1.15  2006/01/09 02:03:39  fraggle
-// Send clients their player number, and indicate on the waiting screen
-// which client we are.
-//
-// Revision 1.14  2006/01/09 01:50:51  fraggle
-// Deduce a sane player name by examining environment variables.  Add
-// a "player_name" setting to chocolate-doom.cfg.  Transmit the name
-// to the server and use the names players send in the waiting data list.
-//
-// Revision 1.13  2006/01/08 04:52:26  fraggle
-// Allow the server to reject clients
-//
-// Revision 1.12  2006/01/08 03:36:40  fraggle
-// Fix double free of addresses
-//
-// Revision 1.11  2006/01/08 02:53:31  fraggle
-// Detect when client connection is disconnected.
-//
-// Revision 1.10  2006/01/08 00:10:47  fraggle
-// Move common connection code into net_common.c, shared by server
-// and client code.
-//
-// Revision 1.9  2006/01/07 20:08:11  fraggle
-// Send player name and address in the waiting data packets.  Display these
-// on the waiting screen, and improve the waiting screen appearance.
-//
-// Revision 1.8  2006/01/02 21:50:26  fraggle
-// Restructure the waiting screen code.  Establish our own separate event
-// loop while waiting for the game to start, to avoid affecting the original
-// code too much.  Move some _gui variables to net_client.c.
-//
-// Revision 1.7  2006/01/02 20:14:07  fraggle
-// Fix connect timeout and shutdown client properly if we fail to connect.
-//
-// Revision 1.6  2006/01/02 00:54:17  fraggle
-// Fix packet not freed back after being sent.
-// Code to disconnect clients from the server side.
-//
-// Revision 1.5  2006/01/02 00:00:08  fraggle
-// Neater prefixes: NET_Client -> NET_CL_.  NET_Server -> NET_SV_.
-//
-// Revision 1.4  2006/01/01 23:54:31  fraggle
-// Client disconnect code
-//
-// Revision 1.3  2005/12/30 18:58:22  fraggle
-// Fix client code to correctly send reply to server on connection.
-// Add "waiting screen" while waiting for the game to start.
-// Hook in the new networking code into the main game code.
-//
-// Revision 1.2  2005/12/29 21:29:55  fraggle
-// Working client connect code
-//
-// Revision 1.1  2005/12/29 17:48:25  fraggle
-// Add initial client/server connect code.  Reorganise sources list in
-// Makefile.am.
-//
-//
-// Network client code
-//
-
-#include <stdlib.h>
-
-#include "doomdef.h"
-#include "doomstat.h"
-#include "i_system.h"
-#include "net_client.h"
-#include "net_common.h"
-#include "net_defs.h"
-#include "net_gui.h"
-#include "net_io.h"
-#include "net_packet.h"
-#include "net_server.h"
-#include "net_structrw.h"
-
-typedef enum
-{
-    // waiting for the game to start
-
-    CLIENT_STATE_WAITING_START,
-
-    // in game
-
-    CLIENT_STATE_IN_GAME,
-
-} net_clientstate_t;
-
-static net_connection_t client_connection;
-static net_clientstate_t client_state;
-static net_addr_t *server_addr;
-static net_context_t *client_context;
-
-// TRUE if the client code is in use
-
-boolean net_client_connected;
-
-// if TRUE, this client is the controller of the game
-
-boolean net_client_controller = false;
-
-// Number of clients currently connected to the server
-
-int net_clients_in_game;
-
-// Names of all players
-
-char net_player_addresses[MAXPLAYERS][MAXPLAYERNAME];
-char net_player_names[MAXPLAYERS][MAXPLAYERNAME];
-
-// Player number
-
-int net_player_number;
-
-// Waiting for the game to start?
-
-boolean net_waiting_for_start = false;
-
-// Name that we send to the server
-
-char *net_player_name = NULL;
-
-// Shut down the client code, etc.  Invoked after a disconnect.
-
-static void NET_CL_Shutdown(void)
-{
-    if (net_client_connected)
-    {
-        net_client_connected = false;
-
-        NET_FreeAddress(server_addr);
-
-        // Shut down network module, etc.  To do.
-    }
-}
-
-void NET_CL_StartGame(void)
-{
-    net_packet_t *packet;
-    net_gamesettings_t settings;
-
-    // Fill in game settings structure with appropriate parameters
-    // for the new game
-
-    settings.ticdup = 1;
-    settings.extratics = 0;
-    settings.deathmatch = deathmatch;
-    settings.episode = startepisode;
-    settings.map = startmap;
-    settings.skill = startskill;
-    settings.gameversion = gameversion;
-
-    // Send packet
-
-    packet = NET_Conn_NewReliable(&client_connection, 
-                                  NET_PACKET_TYPE_GAMESTART);
-
-    NET_WriteSettings(packet, &settings);
-}
-
-// data received while we are waiting for the game to start
-
-static void NET_CL_ParseWaitingData(net_packet_t *packet)
-{
-    unsigned int num_players;
-    unsigned int is_controller;
-    unsigned int player_number;
-    char *player_names[MAXPLAYERS];
-    char *player_addr[MAXPLAYERS];
-    int i;
-
-    if (!NET_ReadInt8(packet, &num_players)
-     || !NET_ReadInt8(packet, &is_controller)
-     || !NET_ReadInt8(packet, &player_number))
-    {
-        // invalid packet
-
-        return;
-    }
-
-    if (num_players > MAXPLAYERS 
-     || player_number >= num_players)
-    {
-        // insane data
-
-        return;
-    }
- 
-    // Read the player names
-
-    for (i=0; i<num_players; ++i)
-    {
-        player_names[i] = NET_ReadString(packet);
-        player_addr[i] = NET_ReadString(packet);
-
-        if (player_names[i] == NULL || player_addr[i] == NULL)
-        {
-            return;
-        }
-    }
-
-    net_clients_in_game = num_players;
-    net_client_controller = is_controller != 0;
-    net_player_number = player_number;
-
-    for (i=0; i<num_players; ++i)
-    {
-        strncpy(net_player_names[i], player_names[i], MAXPLAYERNAME);
-        net_player_names[i][MAXPLAYERNAME-1] = '\0';
-        strncpy(net_player_addresses[i], player_addr[i], MAXPLAYERNAME);
-        net_player_addresses[i][MAXPLAYERNAME-1] = '\0';
-    }
-}
-
-static void NET_CL_ParseGameStart(net_packet_t *packet)
-{
-    net_gamesettings_t settings;
-    unsigned int player_number, num_players;
-    int i;
-
-    if (!NET_ReadInt8(packet, &num_players)
-     || !NET_ReadInt8(packet, &player_number)
-     || !NET_ReadSettings(packet, &settings))
-    {
-        return;
-    }
-
-    if (client_state != CLIENT_STATE_WAITING_START)
-    {
-        return;
-    }
-
-    if (num_players >= MAXPLAYERS || player_number >= num_players)
-    {
-        // insane values
-        return;
-    }
-
-    // Start the game
-
-    consoleplayer = player_number;
-    
-    for (i=0; i<MAXPLAYERS; ++i) 
-    {
-        playeringame[i] = i < num_players;
-    }
-
-    client_state = CLIENT_STATE_IN_GAME;
-
-    deathmatch = settings.deathmatch;
-    ticdup = settings.ticdup;
-//    extratic = settings.extratics;
-    startepisode = settings.episode;
-    startmap = settings.map;
-    startskill = settings.skill;
-
-    netgame = true;
-    autostart = true;
-}
-
-// parse a received packet
-
-static void NET_CL_ParsePacket(net_packet_t *packet)
-{
-    unsigned int packet_type;
-
-    if (!NET_ReadInt16(packet, &packet_type))
-    {
-        return;
-    }
-
-    if (NET_Conn_Packet(&client_connection, packet, &packet_type))
-    {
-        // Packet eaten by the common connection code
-    }
-    else
-    {
-        switch (packet_type)
-        {
-            case NET_PACKET_TYPE_WAITING_DATA:
-                NET_CL_ParseWaitingData(packet);
-                break;
-
-            case NET_PACKET_TYPE_GAMESTART:
-                NET_CL_ParseGameStart(packet);
-                break;
-
-            case NET_PACKET_TYPE_GAMEDATA:
-                break;
-
-            default:
-                break;
-        }
-    }
-}
-
-// "Run" the client code: check for new packets, send packets as
-// needed
-
-void NET_CL_Run(void)
-{
-    net_addr_t *addr;
-    net_packet_t *packet;
-    
-    if (!net_client_connected)
-    {
-        return;
-    }
-    
-    while (NET_RecvPacket(client_context, &addr, &packet))
-    {
-        // only accept packets from the server
-
-        if (addr == server_addr)
-        {
-            NET_CL_ParsePacket(packet);
-        }
-        else
-        {
-            NET_FreeAddress(addr);
-        }
-
-        NET_FreePacket(packet);
-    }
-
-    // Run the common connection code to send any packets as needed
-
-    NET_Conn_Run(&client_connection);
-
-    if (client_connection.state == NET_CONN_STATE_DISCONNECTED
-     || client_connection.state == NET_CONN_STATE_DISCONNECTED_SLEEP)
-    {
-        // disconnected from server
-
-        NET_CL_Shutdown();
-    }
-    
-    net_waiting_for_start = client_connection.state == NET_CONN_STATE_CONNECTED
-                         && client_state == CLIENT_STATE_WAITING_START;
-}
-
-static void NET_CL_SendSYN(void)
-{
-    net_packet_t *packet;
-
-    packet = NET_NewPacket(10);
-    NET_WriteInt16(packet, NET_PACKET_TYPE_SYN);
-    NET_WriteInt32(packet, NET_MAGIC_NUMBER);
-    NET_WriteInt16(packet, gamemode);
-    NET_WriteInt16(packet, gamemission);
-    NET_WriteString(packet, net_player_name);
-    NET_Conn_SendPacket(&client_connection, packet);
-    NET_FreePacket(packet);
-}
-
-// connect to a server
-
-boolean NET_CL_Connect(net_addr_t *addr)
-{
-    int start_time;
-    int last_send_time;
-
-    server_addr = addr;
-
-    // create a new network I/O context and add just the
-    // necessary module
-
-    client_context = NET_NewContext();
-    
-    // initialise module for client mode
-
-    if (!addr->module->InitClient())
-    {
-        return false;
-    }
-
-    NET_AddModule(client_context, addr->module);
-
-    net_client_connected = true;
-
-    // Initialise connection
-
-    NET_Conn_InitClient(&client_connection, addr);
-
-    // try to connect
- 
-    start_time = I_GetTimeMS();
-    last_send_time = -1;
-
-    while (client_connection.state == NET_CONN_STATE_CONNECTING)
-    {
-        int nowtime = I_GetTimeMS();
-
-        // Send a SYN packet every second.
-
-        if (nowtime - last_send_time > 1000 || last_send_time < 0)
-        {
-            NET_CL_SendSYN();
-            last_send_time = nowtime;
-        }
- 
-        // time out after 5 seconds 
-
-        if (nowtime - start_time > 5000)
-        {
-            break;
-        }
-
-        // run client code
-
-        NET_CL_Run();
-        
-        // run the server, just incase we are doing a loopback
-        // connect
-
-        NET_SV_Run();
-
-        // Don't hog the CPU
-
-        I_Sleep(10);
-    }
-
-    if (client_connection.state == NET_CONN_STATE_CONNECTED)
-    {
-        // connected ok!
-
-        client_state = CLIENT_STATE_WAITING_START;
-
-        return true;
-    }
-    else
-    {
-        // failed to connect
-
-        NET_CL_Shutdown();
-        
-        return false;
-    }
-}
-
-// disconnect from the server
-
-void NET_CL_Disconnect(void)
-{
-    int start_time;
-
-    if (!net_client_connected)
-    {
-        return;
-    }
-    
-    NET_Conn_Disconnect(&client_connection);
-
-    start_time = I_GetTimeMS();
-
-    while (client_connection.state != NET_CONN_STATE_DISCONNECTED
-        && client_connection.state != NET_CONN_STATE_DISCONNECTED_SLEEP)
-    {
-        if (I_GetTimeMS() - start_time > 5000)
-        {
-            // time out after 5 seconds
-            
-            client_state = NET_CONN_STATE_DISCONNECTED;
-
-            fprintf(stderr, "NET_CL_Disconnect: Timeout while disconnecting from server\n");
-            break;
-        }
-
-        NET_CL_Run();
-        NET_SV_Run();
-
-        I_Sleep(10);
-    }
-
-    // Finished sending disconnect packets, etc.
-
-    NET_CL_Shutdown();
-}
-
-void NET_CL_Init(void)
-{
-    // Try to set from the USER and USERNAME environment variables
-    // Otherwise, fallback to "Player"
-
-    if (net_player_name == NULL) 
-        net_player_name = getenv("USER");
-    if (net_player_name == NULL)
-        net_player_name = getenv("USERNAME");
-    if (net_player_name == NULL)
-        net_player_name = "Player";
-}
-
-void NET_Init(void)
-{
-    NET_CL_Init();
-}
-
diff --git a/src/net_client.h b/src/net_client.h
deleted file mode 100644
index 85eb595..0000000
--- a/src/net_client.h
+++ /dev/null
@@ -1,93 +0,0 @@
-// Emacs style mode select   -*- C++ -*- 
-//-----------------------------------------------------------------------------
-//
-// $Id: net_client.h 284 2006-01-12 02:11:52Z fraggle $
-//
-// 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.
-//
-// $Log$
-// Revision 1.10  2006/01/12 02:11:52  fraggle
-// Game start packets
-//
-// Revision 1.9  2006/01/09 02:03:39  fraggle
-// Send clients their player number, and indicate on the waiting screen
-// which client we are.
-//
-// Revision 1.8  2006/01/09 01:50:51  fraggle
-// Deduce a sane player name by examining environment variables.  Add
-// a "player_name" setting to chocolate-doom.cfg.  Transmit the name
-// to the server and use the names players send in the waiting data list.
-//
-// Revision 1.7  2006/01/07 20:08:11  fraggle
-// Send player name and address in the waiting data packets.  Display these
-// on the waiting screen, and improve the waiting screen appearance.
-//
-// Revision 1.6  2006/01/02 21:50:26  fraggle
-// Restructure the waiting screen code.  Establish our own separate event
-// loop while waiting for the game to start, to avoid affecting the original
-// code too much.  Move some _gui variables to net_client.c.
-//
-// Revision 1.5  2006/01/02 00:00:08  fraggle
-// Neater prefixes: NET_Client -> NET_CL_.  NET_Server -> NET_SV_.
-//
-// Revision 1.4  2006/01/01 23:54:31  fraggle
-// Client disconnect code
-//
-// Revision 1.3  2005/12/30 18:58:22  fraggle
-// Fix client code to correctly send reply to server on connection.
-// Add "waiting screen" while waiting for the game to start.
-// Hook in the new networking code into the main game code.
-//
-// Revision 1.2  2005/12/29 21:29:55  fraggle
-// Working client connect code
-//
-// Revision 1.1  2005/12/29 17:48:25  fraggle
-// Add initial client/server connect code.  Reorganise sources list in
-// Makefile.am.
-//
-//
-// Network client code
-//
-
-#ifndef NET_CLIENT_H
-#define NET_CLIENT_H
-
-#include "doomdef.h"
-#include "doomtype.h"
-#include "net_defs.h"
-
-#define MAXPLAYERNAME 30
-
-boolean NET_CL_Connect(net_addr_t *addr);
-void NET_CL_Disconnect(void);
-void NET_CL_Run(void);
-void NET_CL_Init(void);
-void NET_CL_StartGame();
-void NET_Init(void);
-
-extern boolean net_client_connected;
-extern boolean net_client_controller;
-extern int net_clients_in_game;
-extern boolean net_waiting_for_start;
-extern char net_player_names[MAXPLAYERS][MAXPLAYERNAME];
-extern char net_player_addresses[MAXPLAYERS][MAXPLAYERNAME];
-extern int net_player_number;
-extern char *net_player_name;
-
-#endif /* #ifndef NET_CLIENT_H */
-
diff --git a/src/net_common.c b/src/net_common.c
deleted file mode 100644
index 92c050e..0000000
--- a/src/net_common.c
+++ /dev/null
@@ -1,491 +0,0 @@
-// Emacs style mode select   -*- C++ -*- 
-//-----------------------------------------------------------------------------
-//
-// $Id: net_common.c 279 2006-01-10 19:59:26Z fraggle $
-//
-// 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.
-//
-// $Log$
-// Revision 1.4  2006/01/10 19:59:26  fraggle
-// Reliable packet transport mechanism
-//
-// Revision 1.3  2006/01/08 04:52:26  fraggle
-// Allow the server to reject clients
-//
-// Revision 1.2  2006/01/08 02:53:05  fraggle
-// Send keepalives if the connection is not doing anything else.
-// Send all packets using a new NET_Conn_SendPacket to support this.
-//
-// Revision 1.1  2006/01/08 00:10:48  fraggle
-// Move common connection code into net_common.c, shared by server
-// and client code.
-//
-//
-// Common code shared between the client and server
-//
-
-#include <stdlib.h>
-
-#include "doomdef.h"
-#include "i_system.h"
-
-#include "net_common.h"
-#include "net_io.h"
-#include "net_packet.h"
-
-// connections time out after 10 seconds
-
-#define CONNECTION_TIMEOUT_LEN 10
-
-// maximum time between sending packets
-
-#define KEEPALIVE_PERIOD 1
-
-// reliable packet that is guaranteed to reach its destination
-
-struct net_reliable_packet_s 
-{
-    net_packet_t *packet;
-    int last_send_time;
-    int seq;
-    net_reliable_packet_t *next;
-};
-
-static void NET_Conn_Init(net_connection_t *conn, net_addr_t *addr)
-{
-    conn->last_send_time = -1;
-    conn->num_retries = 0;
-    conn->addr = addr;
-    conn->reliable_packets = NULL;
-    conn->reliable_send_seq = 0;
-    conn->reliable_recv_seq = 0;
-}
-
-// Initialise as a client connection
-
-void NET_Conn_InitClient(net_connection_t *conn, net_addr_t *addr)
-{
-    NET_Conn_Init(conn, addr);
-    conn->state = NET_CONN_STATE_CONNECTING;
-}
-
-// Initialise as a server connection
-
-void NET_Conn_InitServer(net_connection_t *conn, net_addr_t *addr)
-{
-    NET_Conn_Init(conn, addr);
-    conn->state = NET_CONN_STATE_WAITING_ACK;
-}
-
-// Send a packet to a connection
-// All packets should be sent through this interface, as it maintains the
-// keepalive_send_time counter.
-
-void NET_Conn_SendPacket(net_connection_t *conn, net_packet_t *packet)
-{
-    conn->keepalive_send_time = I_GetTimeMS();
-    NET_SendPacket(conn->addr, packet);
-}
-
-// parse an ACK packet from a client
-
-static void NET_Conn_ParseACK(net_connection_t *conn, net_packet_t *packet)
-{
-    net_packet_t *reply;
-
-    if (conn->state == NET_CONN_STATE_CONNECTING)
-    {
-        // We are a client
-
-        // received a response from the server to our SYN
-
-        conn->state = NET_CONN_STATE_CONNECTED;
-
-        // We must send an ACK reply to the server's ACK
-
-        reply = NET_NewPacket(10);
-        NET_WriteInt16(reply, NET_PACKET_TYPE_ACK);
-        NET_Conn_SendPacket(conn, reply);
-        NET_FreePacket(reply);
-    }
-    
-    if (conn->state == NET_CONN_STATE_WAITING_ACK)
-    {
-        // We are a server
-
-        // Client is connected
-        
-        conn->state = NET_CONN_STATE_CONNECTED;
-    }
-}
-
-static void NET_Conn_ParseDisconnect(net_connection_t *conn, net_packet_t *packet)
-{
-    net_packet_t *reply;
-
-    // Other end wants to disconnect
-    // Send a DISCONNECT_ACK reply.
-    
-    reply = NET_NewPacket(10);
-    NET_WriteInt16(reply, NET_PACKET_TYPE_DISCONNECT_ACK);
-    NET_Conn_SendPacket(conn, reply);
-    NET_FreePacket(reply);
-
-    conn->last_send_time = I_GetTimeMS();
-    
-    conn->state = NET_CONN_STATE_DISCONNECTED_SLEEP;
-}
-
-// Parse a DISCONNECT_ACK packet
-
-static void NET_Conn_ParseDisconnectACK(net_connection_t *conn,
-                                        net_packet_t *packet)
-{
-
-    if (conn->state == NET_CONN_STATE_DISCONNECTING)
-    {
-        // We have received an acknowledgement to our disconnect
-        // request. We have been disconnected successfully.
-        
-        conn->state = NET_CONN_STATE_DISCONNECTED;
-        conn->last_send_time = -1;
-    }
-}
-
-static void NET_Conn_ParseReject(net_connection_t *conn, net_packet_t *packet)
-{
-    if (conn->state == NET_CONN_STATE_CONNECTING)
-    {
-        // rejected by server
-
-        conn->state = NET_CONN_STATE_DISCONNECTED;
-
-        // there is a rejection message here, but it is unused at the moment.
-    }
-}
-
-static void NET_Conn_ParseReliableACK(net_connection_t *conn, net_packet_t *packet)
-{
-    unsigned int seq;
-
-    if (!NET_ReadInt8(packet, &seq))
-    {
-        return;
-    }
-
-    if (conn->reliable_packets == NULL)
-    {
-        return;
-    }
-            
-    // Is this an acknowledgement for the first packet in the list?
-
-    if (seq == ((conn->reliable_packets->seq + 1) & 0xff))
-    {
-        net_reliable_packet_t *rp;
-
-        // Discard it, then.
-        // Unlink from the list.
-
-        rp = conn->reliable_packets;
-        conn->reliable_packets = rp->next;
-        
-        NET_FreePacket(rp->packet);
-        free(rp);
-    }
-}
-
-// Process the header of a reliable packet
-//
-// Returns true if the packet should be discarded (incorrect sequence)
-
-static boolean NET_Conn_ReliablePacket(net_connection_t *conn, 
-                                       net_packet_t *packet)
-{
-    unsigned int seq;
-    net_packet_t *reply;
-    boolean result;
-
-    // Read the sequence number
-
-    if (!NET_ReadInt8(packet, &seq))
-    {
-        return true;
-    }
-
-    if (seq != (conn->reliable_recv_seq & 0xff))
-    {
-        // This is not the next expected packet in the sequence!
-        //
-        // Discard the packet.  If we were smart, we would use a proper
-        // sliding window protocol to do this, but I'm lazy.
-
-        result = true;
-    }
-    else
-    {
-        // Now we can receive the next packet in the sequence.
-
-        conn->reliable_recv_seq = (conn->reliable_recv_seq + 1) & 0xff;
-    
-        result = false;
-    }
-
-    // Send an acknowledgement
-
-    // Note: this is braindead.  It would be much more sensible to 
-    // include this in the next packet, rather than the overhead of
-    // sending a complete packet just for one byte of information.
-
-    reply = NET_NewPacket(10);
-
-    NET_WriteInt16(reply, NET_PACKET_TYPE_RELIABLE_ACK);
-    NET_WriteInt8(reply, conn->reliable_recv_seq & 0xff);
-
-    NET_Conn_SendPacket(conn, reply);
-
-    NET_FreePacket(reply);
-
-    return result;
-}
-
-// Process a packet received by the server
-//
-// Returns true if eaten by common code
-
-boolean NET_Conn_Packet(net_connection_t *conn, net_packet_t *packet, 
-                        unsigned int *packet_type)
-{
-    conn->keepalive_recv_time = I_GetTimeMS();
-
-    // Is this a reliable packet?
-
-    if (*packet_type & NET_RELIABLE_PACKET)
-    {
-        if (NET_Conn_ReliablePacket(conn, packet)) 
-        {
-            // Invalid packet: eat it.
-
-            return true;
-        }
-
-        // Remove the reliable bit
-
-        *packet_type &= ~NET_RELIABLE_PACKET;
-    }
-    
-    switch (*packet_type)
-    {
-        case NET_PACKET_TYPE_ACK:
-            NET_Conn_ParseACK(conn, packet);
-            break;
-        case NET_PACKET_TYPE_DISCONNECT:
-            NET_Conn_ParseDisconnect(conn, packet);
-            break;
-        case NET_PACKET_TYPE_DISCONNECT_ACK:
-            NET_Conn_ParseDisconnectACK(conn, packet);
-            break;
-        case NET_PACKET_TYPE_KEEPALIVE:
-            // No special action needed.
-            break;
-        case NET_PACKET_TYPE_REJECTED:
-            NET_Conn_ParseReject(conn, packet);
-            break;
-        case NET_PACKET_TYPE_RELIABLE_ACK:
-            NET_Conn_ParseReliableACK(conn, packet);
-            break;
-        default:
-            // Not a common packet
-
-            return false;
-    }
-
-    // We found a packet that we found interesting, and ate it.
-
-    return true;
-}
-
-void NET_Conn_Disconnect(net_connection_t *conn)
-{
-    if (conn->state != NET_CONN_STATE_DISCONNECTED
-     && conn->state != NET_CONN_STATE_DISCONNECTING
-     && conn->state != NET_CONN_STATE_DISCONNECTED_SLEEP)
-    {
-        conn->state = NET_CONN_STATE_DISCONNECTING;
-        conn->last_send_time = -1;
-        conn->num_retries = 0;
-    }
-}
-
-void NET_Conn_Run(net_connection_t *conn)
-{
-    net_packet_t *packet;
-    unsigned int nowtime;
-
-    nowtime = I_GetTimeMS();
-
-    if (conn->state == NET_CONN_STATE_CONNECTED)
-    {
-        // Check the keepalive counters
-
-        if (nowtime - conn->keepalive_recv_time > CONNECTION_TIMEOUT_LEN * 1000)
-        {
-            // Haven't received any packets from the other end in a long
-            // time.  Assume disconnected.
-
-            conn->state = NET_CONN_STATE_DISCONNECTED;
-        }
-        
-        if (nowtime - conn->keepalive_send_time > KEEPALIVE_PERIOD * 1000)
-        {
-            // We have not sent anything in a long time.
-            // Send a keepalive.
-
-            packet = NET_NewPacket(10);
-            NET_WriteInt16(packet, NET_PACKET_TYPE_KEEPALIVE);
-            NET_Conn_SendPacket(conn, packet);
-            NET_FreePacket(packet);
-        }
-
-        // Check the reliable packet list. Has the first packet in the
-        // list timed out?
-        //
-        // NB.  This is braindead, we have a fixed time of one second.
-
-        if (conn->reliable_packets != NULL
-         && (conn->reliable_packets->last_send_time < 0
-          || nowtime - conn->reliable_packets->last_send_time > 1000))
-        {
-            // Packet timed out, time to resend
-
-            NET_Conn_SendPacket(conn, conn->reliable_packets->packet);
-            conn->reliable_packets->last_send_time = nowtime;
-        }
-    }
-    else if (conn->state == NET_CONN_STATE_WAITING_ACK)
-    {
-        if (conn->last_send_time < 0
-         || nowtime - conn->last_send_time > 1000)
-        {
-            // it has been a second since the last ACK was sent, and 
-            // still no reply.
-
-            if (conn->num_retries < MAX_RETRIES)
-            {
-                // send another ACK
-
-                packet = NET_NewPacket(10);
-                NET_WriteInt16(packet, NET_PACKET_TYPE_ACK);
-                NET_Conn_SendPacket(conn, packet);
-                NET_FreePacket(packet);
-                conn->last_send_time = nowtime;
-
-                ++conn->num_retries;
-            }
-            else 
-            {
-                // no more retries allowed.
-
-                conn->state = NET_CONN_STATE_DISCONNECTED;
-            }
-        }
-    }
-    else if (conn->state == NET_CONN_STATE_DISCONNECTING)
-    {
-        // Waiting for a reply to our DISCONNECT request.
-
-        if (conn->last_send_time < 0
-         || nowtime - conn->last_send_time > 1000)
-        {
-            // it has been a second since the last disconnect packet 
-            // was sent, and still no reply.
-
-            if (conn->num_retries < MAX_RETRIES)
-            {
-                // send another disconnect
-
-                packet = NET_NewPacket(10);
-                NET_WriteInt16(packet, NET_PACKET_TYPE_DISCONNECT);
-                NET_Conn_SendPacket(conn, packet);
-                NET_FreePacket(packet);
-                conn->last_send_time = nowtime;
-
-                ++conn->num_retries;
-            }
-            else 
-            {
-                // No more retries allowed.
-                // Force disconnect.
-
-                conn->state = NET_CONN_STATE_DISCONNECTED;
-            }
-        }
-    }
-    else if (conn->state == NET_CONN_STATE_DISCONNECTED_SLEEP)
-    {
-        // We are disconnected, waiting in case we need to send
-        // a DISCONNECT_ACK to the server again.
-
-        if (nowtime - conn->last_send_time > 5000)
-        {
-            // Idle for 5 seconds, switch state
-
-            conn->state = NET_CONN_STATE_DISCONNECTED;
-        }
-    }
-}
-
-net_packet_t *NET_Conn_NewReliable(net_connection_t *conn, int packet_type)
-{
-    net_packet_t *packet;
-    net_reliable_packet_t *rp;
-    net_reliable_packet_t **listend;
-
-    // Generate a packet with the right header
-
-    packet = NET_NewPacket(100);
-
-    NET_WriteInt16(packet, packet_type | NET_RELIABLE_PACKET);
-
-    // write the low byte of the send sequence number
-    
-    NET_WriteInt8(packet, conn->reliable_send_seq & 0xff);
-
-    // Add to the list of reliable packets
-
-    rp = malloc(sizeof(net_reliable_packet_t));
-    rp->packet = packet;
-    rp->next = NULL;
-    rp->seq = conn->reliable_send_seq;
-    rp->last_send_time = -1;
-
-    for (listend = &conn->reliable_packets; 
-         *listend != NULL; 
-         listend = &((*listend)->next));
-
-    *listend = rp;
-
-    // Count along the sequence
-
-    conn->reliable_send_seq = (conn->reliable_send_seq + 1) & 0xff;
-
-    // Finished
-    
-    return packet;
-}
-
diff --git a/src/net_common.h b/src/net_common.h
deleted file mode 100644
index 4f5605d..0000000
--- a/src/net_common.h
+++ /dev/null
@@ -1,107 +0,0 @@
-// Emacs style mode select   -*- C++ -*- 
-//-----------------------------------------------------------------------------
-//
-// $Id: net_common.h 279 2006-01-10 19:59:26Z fraggle $
-//
-// 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.
-//
-// $Log$
-// Revision 1.3  2006/01/10 19:59:26  fraggle
-// Reliable packet transport mechanism
-//
-// Revision 1.2  2006/01/08 02:53:05  fraggle
-// Send keepalives if the connection is not doing anything else.
-// Send all packets using a new NET_Conn_SendPacket to support this.
-//
-// Revision 1.1  2006/01/08 00:10:48  fraggle
-// Move common connection code into net_common.c, shared by server
-// and client code.
-//
-//
-// Common code shared between the client and server
-//
-
-#ifndef NET_COMMON_H
-#define NET_COMMON_H
-
-#include "net_defs.h"
-#include "net_packet.h"
-
-typedef enum 
-{
-    // sending syn packets, waiting for an ACK reply 
-    // (client side)
-
-    NET_CONN_STATE_CONNECTING,
-
-    // received a syn, sent an ack, waiting for an ack reply
-    // (server side)
-
-    NET_CONN_STATE_WAITING_ACK,
-    
-    // successfully connected
-
-    NET_CONN_STATE_CONNECTED,
-
-    // sent a DISCONNECT packet, waiting for a DISCONNECT_ACK reply
-
-    NET_CONN_STATE_DISCONNECTING,
-
-    // client successfully disconnected
-
-    NET_CONN_STATE_DISCONNECTED,
-
-    // We are disconnected, but in a sleep state, waiting for several
-    // seconds.  This is in case the DISCONNECT_ACK we sent failed
-    // to arrive, and we need to send another one.  We keep this as
-    // a valid connection for a few seconds until we are sure that
-    // the other end has successfully disconnected as well.
-
-    NET_CONN_STATE_DISCONNECTED_SLEEP,
-
-} net_connstate_t;
-
-#define MAX_RETRIES 5
-
-typedef struct net_reliable_packet_s net_reliable_packet_t;
-
-typedef struct 
-{
-    net_connstate_t state;
-    net_addr_t *addr;
-    int last_send_time;
-    int num_retries;
-    int keepalive_send_time;
-    int keepalive_recv_time;
-    net_reliable_packet_t *reliable_packets;
-    int reliable_send_seq;
-    int reliable_recv_seq;
-} net_connection_t;
-
-
-void NET_Conn_SendPacket(net_connection_t *conn, net_packet_t *packet);
-void NET_Conn_InitClient(net_connection_t *conn, net_addr_t *addr);
-void NET_Conn_InitServer(net_connection_t *conn, net_addr_t *addr);
-boolean NET_Conn_Packet(net_connection_t *conn, net_packet_t *packet,
-                        unsigned int *packet_type);
-void NET_Conn_Disconnect(net_connection_t *conn);
-void NET_Conn_Run(net_connection_t *conn);
-net_packet_t *NET_Conn_NewReliable(net_connection_t *conn, int packet_type);
-
-#endif /* #ifndef NET_COMMON_H */
-
diff --git a/src/net_gui.c b/src/net_gui.c
deleted file mode 100644
index 3cf3ad0..0000000
--- a/src/net_gui.c
+++ /dev/null
@@ -1,193 +0,0 @@
-// Emacs style mode select   -*- C++ -*- 
-//-----------------------------------------------------------------------------
-//
-// $Id: net_gui.c 294 2006-01-14 00:27:16Z fraggle $
-//
-// 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.
-//
-// $Log$
-// Revision 1.12  2006/01/14 00:27:16  fraggle
-// Set the window caption and title
-//
-// Revision 1.11  2006/01/14 00:13:04  fraggle
-// Detect if disconnected from the server while waiting for the game start.
-//
-// Revision 1.10  2006/01/14 00:10:54  fraggle
-// Change the format of color commands.  Reorganise the waiting dialog.
-//
-// Revision 1.9  2006/01/13 23:56:00  fraggle
-// Add text-mode I/O functions.
-// Use text-mode screen for the waiting screen.
-//
-// Revision 1.8  2006/01/12 02:11:52  fraggle
-// Game start packets
-//
-// Revision 1.7  2006/01/10 22:14:13  fraggle
-// Shut up compiler warnings
-//
-// Revision 1.6  2006/01/09 02:03:39  fraggle
-// Send clients their player number, and indicate on the waiting screen
-// which client we are.
-//
-// Revision 1.5  2006/01/08 17:52:45  fraggle
-// Play some random music for the players while waiting for the game to
-// start.
-//
-// Revision 1.4  2006/01/08 05:04:50  fraggle
-// Don't grab the mouse on the net waiting screen
-//
-// Revision 1.3  2006/01/07 20:08:11  fraggle
-// Send player name and address in the waiting data packets.  Display these
-// on the waiting screen, and improve the waiting screen appearance.
-//
-// Revision 1.2  2006/01/02 21:50:26  fraggle
-// Restructure the waiting screen code.  Establish our own separate event
-// loop while waiting for the game to start, to avoid affecting the original
-// code too much.  Move some _gui variables to net_client.c.
-//
-// Revision 1.1  2005/12/30 18:58:22  fraggle
-// Fix client code to correctly send reply to server on connection.
-// Add "waiting screen" while waiting for the game to start.
-// Hook in the new networking code into the main game code.
-//
-//
-// Graphical stuff related to the networking code:
-//
-//  * The client waiting screen when we are waiting for the server to
-//    start the game.
-//   
-
-#include <ctype.h>
-
-#include "config.h"
-#include "doomstat.h"
-
-#include "i_system.h"
-#include "i_video.h"
-
-#include "net_client.h"
-#include "net_gui.h"
-#include "net_server.h"
-
-#include "txt_main.h"
-#include "txt_gui.h"
-#include "txt_io.h"
-
-static void ProcessEvents(void)
-{
-    int c;
-    
-    while ((c = TXT_GetChar()) > 0)
-    {
-        switch (tolower(c))
-        {
-            case 27:
-            case 'q':
-                TXT_Shutdown();
-                I_Quit();
-                break;
-
-            case ' ':
-                NET_CL_StartGame();
-                break;
-        }
-    }
-}
-
-#define WINDOW_X 15
-#define WINDOW_Y 5
-#define WINDOW_W 50
-#define WINDOW_H 12
-
-static void DrawScreen(void)
-{
-    char buf[40];
-    int i;
-
-    TXT_DrawDesktop(PACKAGE_STRING);
-    TXT_DrawWindow("Waiting for game start...", 
-                    WINDOW_X, WINDOW_Y, 
-                    WINDOW_W, WINDOW_H);
-
-    TXT_BGColor(TXT_COLOR_BLUE, 0);
-
-    for (i=0; i<MAXPLAYERS; ++i)
-    {
-        if (i == net_player_number)
-            TXT_FGColor(TXT_COLOR_YELLOW);
-        else if (i < net_clients_in_game)
-            TXT_FGColor(TXT_COLOR_BRIGHT_WHITE);
-        else
-            TXT_FGColor(TXT_COLOR_GREY);
-
-        snprintf(buf, 39, "%i. ", i + 1);
-        TXT_GotoXY(WINDOW_X + 2, WINDOW_Y + 4 + i);
-        TXT_Puts(buf);
-
-        if (i < net_clients_in_game)
-        {
-            snprintf(buf, 15, "%s", net_player_names[i]);
-            TXT_GotoXY(WINDOW_X + 5, WINDOW_Y + 4 + i);
-            TXT_Puts(buf);
-
-            snprintf(buf, 16, "%s", net_player_addresses[i]);
-            TXT_GotoXY(WINDOW_X + 33, WINDOW_Y + 4 + i);
-            TXT_Puts(buf);
-        }
-    }
-
-    TXT_FGColor(TXT_COLOR_BRIGHT_WHITE);
-    TXT_GotoXY(WINDOW_X + 2, WINDOW_Y + WINDOW_H - 2);
-    TXT_Puts("<brightgreen>ESC</><brightcyan>=</>Abort");
-
-    if (net_client_controller)
-    {
-        TXT_GotoXY(WINDOW_X + WINDOW_W - 18, WINDOW_Y + WINDOW_H - 2);
-        TXT_Puts("<brightgreen>SPACE</><brightcyan>=</>Start game");
-    }
-    
-    TXT_DrawSeparator(WINDOW_X, WINDOW_Y + WINDOW_H - 3, WINDOW_W);
-
-    TXT_UpdateScreen();
-}
-
-void NET_WaitForStart(void)
-{
-    TXT_Init();
-    I_SetWindowCaption();
-    I_SetWindowIcon();
-
-    while (net_waiting_for_start)
-    {
-        ProcessEvents();
-        DrawScreen();
-
-        NET_CL_Run();
-        NET_SV_Run();
-
-        if (!net_client_connected)
-        {
-            I_Error("Disconnected from server");
-        }
-
-        I_Sleep(50);
-    }
-    
-    TXT_Shutdown();
-}
-
diff --git a/src/net_gui.h b/src/net_gui.h
deleted file mode 100644
index 3b097f2..0000000
--- a/src/net_gui.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// Emacs style mode select   -*- C++ -*- 
-//-----------------------------------------------------------------------------
-//
-// $Id: net_gui.h 252 2006-01-02 21:50:26Z fraggle $
-//
-// 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.
-//
-// $Log$
-// Revision 1.2  2006/01/02 21:50:26  fraggle
-// Restructure the waiting screen code.  Establish our own separate event
-// loop while waiting for the game to start, to avoid affecting the original
-// code too much.  Move some _gui variables to net_client.c.
-//
-// Revision 1.1  2005/12/30 18:58:22  fraggle
-// Fix client code to correctly send reply to server on connection.
-// Add "waiting screen" while waiting for the game to start.
-// Hook in the new networking code into the main game code.
-//
-//
-// Graphical stuff related to the networking code:
-//
-//  * The client waiting screen when we are waiting for the server to
-//    start the game.
-//   
-
-
-#ifndef NET_GUI_H 
-#define NET_GUI_H
-
-#include "doomtype.h"
-
-extern void NET_WaitForStart();
-
-#endif /* #ifndef NET_GUI_H */
-
diff --git a/src/net_io.c b/src/net_io.c
deleted file mode 100644
index e4fb5aa..0000000
--- a/src/net_io.c
+++ /dev/null
@@ -1,133 +0,0 @@
-// Emacs style mode select   -*- C++ -*- 
-//-----------------------------------------------------------------------------
-//
-// $Id: net_io.c 249 2006-01-02 21:02:16Z fraggle $
-//
-// 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.
-//
-// $Log$
-// Revision 1.2  2006/01/02 21:02:16  fraggle
-// Change AddrToString function to use an internal static buffer, for
-// ease of use.
-//
-// Revision 1.1  2005/10/30 19:56:15  fraggle
-// Add foundation code for the new networking system
-//
-//
-// DESCRIPTION:
-//     Network packet I/O.  Base layer for sending/receiving packets,
-//     through the network module system
-//
-//-----------------------------------------------------------------------------
-
-#include "i_system.h"
-#include "net_defs.h"
-#include "net_io.h"
-#include "z_zone.h"
-
-#define MAX_MODULES 16
-
-struct _net_context_s
-{
-    net_module_t *modules[MAX_MODULES];
-    int num_modules;
-};
-
-net_context_t *NET_NewContext(void)
-{
-    net_context_t *context;
-
-    context = Z_Malloc(sizeof(net_context_t), PU_STATIC, 0);
-    context->num_modules = 0;
-
-    return context;
-}
-
-void NET_AddModule(net_context_t *context, net_module_t *module)
-{
-    if (context->num_modules >= MAX_MODULES)
-    {
-        I_Error("NET_AddModule: No more modules for context");
-    }
-    
-    context->modules[context->num_modules] = module;
-    ++context->num_modules;
-}
-
-net_addr_t *NET_ResolveAddress(net_context_t *context, char *addr)
-{
-    int i;
-    net_addr_t *result;
-
-    result = NULL;
-
-    for (i=0; i<context->num_modules; ++i)
-    {
-        result = context->modules[i]->ResolveAddress(addr);
-
-        if (result != NULL)
-        {
-            break;
-        }
-    }
-
-    return result;
-}
-
-void NET_SendPacket(net_addr_t *addr, net_packet_t *packet)
-{
-    addr->module->SendPacket(addr, packet);
-}
-
-boolean NET_RecvPacket(net_context_t *context, 
-                       net_addr_t **addr, 
-                       net_packet_t **packet)
-{
-    int i;
-    
-    // check all modules for new packets
-    
-    for (i=0; i<context->num_modules; ++i)
-    {
-        if (context->modules[i]->RecvPacket(addr, packet))
-        {
-            return true;
-        }
-    }
-
-    return false;
-}
-
-// Note: this prints into a static buffer, calling again overwrites
-// the first result
-
-char *NET_AddrToString(net_addr_t *addr)
-{
-    static char buf[128];
-
-    addr->module->AddrToString(addr, buf, sizeof(buf) - 1);
-
-    return buf;
-}
-
-void NET_FreeAddress(net_addr_t *addr)
-{
-    addr->module->FreeAddress(addr);
-}
-
-
diff --git a/src/net_io.h b/src/net_io.h
deleted file mode 100644
index 7ab1450..0000000
--- a/src/net_io.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Emacs style mode select   -*- C++ -*- 
-//-----------------------------------------------------------------------------
-//
-// $Id: net_io.h 249 2006-01-02 21:02:16Z fraggle $
-//
-// 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.
-//
-// $Log$
-// Revision 1.2  2006/01/02 21:02:16  fraggle
-// Change AddrToString function to use an internal static buffer, for
-// ease of use.
-//
-// Revision 1.1  2005/10/30 19:56:15  fraggle
-// Add foundation code for the new networking system
-//
-//
-// DESCRIPTION:
-//      Network packet manipulation (net_packet_t)
-//
-//-----------------------------------------------------------------------------
-
-#ifndef NET_IO_H
-#define NET_IO_H
-
-#include "net_defs.h"
-
-net_context_t *NET_NewContext(void);
-void NET_AddModule(net_context_t *context, net_module_t *module);
-void NET_SendPacket(net_addr_t *addr, net_packet_t *packet);
-boolean NET_RecvPacket(net_context_t *context, net_addr_t **addr, 
-                       net_packet_t **packet);
-char *NET_AddrToString(net_addr_t *addr);
-void NET_FreeAddress(net_addr_t *addr);
-net_addr_t *NET_ResolveAddress(net_context_t *context, char *address);
-
-#endif  /* #ifndef NET_IO_H */
-
diff --git a/src/net_loop.c b/src/net_loop.c
deleted file mode 100644
index f6b128c..0000000
--- a/src/net_loop.c
+++ /dev/null
@@ -1,233 +0,0 @@
-// Emacs style mode select   -*- C++ -*- 
-//-----------------------------------------------------------------------------
-//
-// $Id: net_loop.c 233 2005-12-29 21:29:55Z fraggle $
-//
-// 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.
-//
-// $Log$
-// Revision 1.2  2005/12/29 21:29:55  fraggle
-// Working client connect code
-//
-// Revision 1.1  2005/10/30 19:56:15  fraggle
-// Add foundation code for the new networking system
-//
-//
-// DESCRIPTION:
-//      Loopback network module for server compiled into the client
-//
-//-----------------------------------------------------------------------------
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "i_system.h"
-#include "net_defs.h"
-#include "net_loop.h"
-#include "net_packet.h"
-
-#define MAX_QUEUE_SIZE 16
-
-typedef struct
-{
-    net_packet_t *packets[MAX_QUEUE_SIZE];
-    int head, tail;
-} packet_queue_t;
-
-static packet_queue_t client_queue;
-static packet_queue_t server_queue;
-static net_addr_t client_addr;
-static net_addr_t server_addr;
-
-static void QueueInit(packet_queue_t *queue)
-{
-    queue->head = queue->tail = 0;
-}
-
-static void QueuePush(packet_queue_t *queue, net_packet_t *packet)
-{
-    int new_tail;
-
-    new_tail = (queue->tail + 1) % MAX_QUEUE_SIZE;
-
-    if (new_tail == queue->head)
-    {
-        // queue is full
-        
-        return;
-    }
-
-    queue->packets[queue->tail] = packet;
-    queue->tail = new_tail;
-}
-
-static net_packet_t *QueuePop(packet_queue_t *queue)
-{
-    net_packet_t *packet;
-    
-    if (queue->tail == queue->head)
-    {
-        // queue empty
-
-        return NULL;
-    }
-
-    packet = queue->packets[queue->head];
-    queue->head = (queue->head + 1) % MAX_QUEUE_SIZE;
-
-    return packet;
-}
-
-//-----------------------------------------------------------------------------
-//
-// Client end code
-//
-//-----------------------------------------------------------------------------
-
-static boolean NET_CL_InitClient(void)
-{
-    QueueInit(&client_queue);
-
-    return true;
-}
-
-static boolean NET_CL_InitServer(void)
-{
-    I_Error("NET_CL_InitServer: attempted to initialise client pipe end as a server!");
-    return false;
-}
-
-static void NET_CL_SendPacket(net_addr_t *addr, net_packet_t *packet)
-{
-    QueuePush(&server_queue, NET_PacketDup(packet));
-}
-
-static boolean NET_CL_RecvPacket(net_addr_t **addr, net_packet_t **packet)
-{
-    net_packet_t *popped;
-
-    popped = QueuePop(&client_queue);
-
-    if (popped != NULL)
-    {
-        *packet = popped;
-        *addr = &client_addr;
-        client_addr.module = &net_loop_client_module;
-        
-        return true;
-    }
-
-    return false;
-}
-
-static void NET_CL_AddrToString(net_addr_t *addr, char *buffer, int buffer_len)
-{
-    snprintf(buffer, buffer_len, "local server");
-}
-
-static void NET_CL_FreeAddress(net_addr_t *addr)
-{
-}
-
-static net_addr_t *NET_CL_ResolveAddress(char *address)
-{
-    client_addr.module = &net_loop_client_module;
-
-    return &client_addr;
-}
-
-net_module_t net_loop_client_module =
-{
-    NET_CL_InitClient,
-    NET_CL_InitServer,
-    NET_CL_SendPacket,
-    NET_CL_RecvPacket,
-    NET_CL_AddrToString,
-    NET_CL_FreeAddress,
-    NET_CL_ResolveAddress,
-};
-
-//-----------------------------------------------------------------------------
-//
-// Server end code
-//
-//-----------------------------------------------------------------------------
-
-static boolean NET_SV_InitClient(void)
-{
-    I_Error("NET_SV_InitClient: attempted to initialise server pipe end as a client!");
-    return false;
-}
-
-static boolean NET_SV_InitServer(void)
-{
-    QueueInit(&server_queue);
-
-    return true;
-}
-
-static void NET_SV_SendPacket(net_addr_t *addr, net_packet_t *packet)
-{
-    QueuePush(&client_queue, NET_PacketDup(packet));
-}
-
-static boolean NET_SV_RecvPacket(net_addr_t **addr, net_packet_t **packet)
-{
-    net_packet_t *popped;
-
-    popped = QueuePop(&server_queue);
-
-    if (popped != NULL)
-    {
-        *packet = popped;
-        *addr = &server_addr;
-        server_addr.module = &net_loop_server_module;
-        
-        return true;
-    }
-
-    return false;
-}
-
-static void NET_SV_AddrToString(net_addr_t *addr, char *buffer, int buffer_len)
-{
-    snprintf(buffer, buffer_len, "local client");
-}
-
-static void NET_SV_FreeAddress(net_addr_t *addr)
-{
-}
-
-static net_addr_t *NET_SV_ResolveAddress(char *address)
-{
-    server_addr.module = &net_loop_server_module;
-    return &server_addr;
-}
-
-net_module_t net_loop_server_module =
-{
-    NET_SV_InitClient,
-    NET_SV_InitServer,
-    NET_SV_SendPacket,
-    NET_SV_RecvPacket,
-    NET_SV_AddrToString,
-    NET_SV_FreeAddress,
-    NET_SV_ResolveAddress,
-};
-
-
diff --git a/src/net_loop.h b/src/net_loop.h
deleted file mode 100644
index 62ad4b1..0000000
--- a/src/net_loop.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Emacs style mode select   -*- C++ -*- 
-//-----------------------------------------------------------------------------
-//
-// $Id: net_loop.h 229 2005-10-30 19:56:15Z fraggle $
-//
-// 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.
-//
-// $Log$
-// Revision 1.1  2005/10/30 19:56:15  fraggle
-// Add foundation code for the new networking system
-//
-//
-// DESCRIPTION:
-//      Loopback network module for server compiled into the client
-//
-//-----------------------------------------------------------------------------
-
-#ifndef NET_LOOP_H
-#define NET_LOOP_H
-
-#include "net_defs.h"
-
-extern net_module_t net_loop_client_module;
-extern net_module_t net_loop_server_module;
-
-#endif /* #ifndef NET_LOOP_H */
-
diff --git a/src/net_packet.c b/src/net_packet.c
deleted file mode 100644
index 14623b4..0000000
--- a/src/net_packet.c
+++ /dev/null
@@ -1,299 +0,0 @@
-// Emacs style mode select   -*- C++ -*- 
-//-----------------------------------------------------------------------------
-//
-// $Id: net_packet.c 287 2006-01-13 02:20:12Z fraggle $
-//
-// 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.
-//
-// $Log$
-// Revision 1.3  2006/01/13 02:20:12  fraggle
-// Signed integer read functions.  Use these when reading ticcmd diffs.
-//
-// Revision 1.2  2006/01/01 23:51:41  fraggle
-// String read/write functions
-//
-// Revision 1.1  2005/10/30 19:56:15  fraggle
-// Add foundation code for the new networking system
-//
-//
-// DESCRIPTION:
-//      Network packet manipulation (net_packet_t)
-//
-//-----------------------------------------------------------------------------
-
-#include <string.h>
-#include "net_packet.h"
-#include "z_zone.h"
-
-net_packet_t *NET_NewPacket(int initial_size)
-{
-    net_packet_t *packet;
-
-    packet = (net_packet_t *) Z_Malloc(sizeof(net_packet_t), PU_STATIC, 0);
-    
-    if (initial_size == 0)
-        initial_size = 256;
-
-    packet->alloced = initial_size;
-    packet->data = Z_Malloc(initial_size, PU_STATIC, 0);
-    packet->len = 0;
-    packet->pos = 0;
-
-    return packet;
-}
-
-// duplicates an existing packet
-
-net_packet_t *NET_PacketDup(net_packet_t *packet)
-{
-    net_packet_t *newpacket;
-
-    newpacket = NET_NewPacket(packet->len);
-    memcpy(newpacket->data, packet->data, packet->len);
-    newpacket->len = packet->len;
-
-    return newpacket;
-}
-
-void NET_FreePacket(net_packet_t *packet)
-{
-    Z_Free(packet->data);
-    Z_Free(packet);
-}
-
-// Read a byte from the packet, returning true if read
-// successfully
-
-boolean NET_ReadInt8(net_packet_t *packet, unsigned int *data)
-{
-    if (packet->pos + 1 > packet->len)
-        return false;
-
-    *data = packet->data[packet->pos];
-
-    packet->pos += 1;
-
-    return true;
-}
-
-// Read a 16-bit integer from the packet, returning true if read
-// successfully
-
-boolean NET_ReadInt16(net_packet_t *packet, unsigned int *data)
-{
-    byte *p;
-
-    if (packet->pos + 2 > packet->len)
-        return false;
-
-    p = packet->data + packet->pos;
-
-    *data = (p[0] << 8) | p[1];
-    packet->pos += 2;
-
-    return true;
-}
-
-// Read a 32-bit integer from the packet, returning true if read
-// successfully
-
-boolean NET_ReadInt32(net_packet_t *packet, unsigned int *data)
-{
-    byte *p;
-
-    if (packet->pos + 4 > packet->len)
-        return false;
-
-    p = packet->data + packet->pos;
-
-    *data = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
-    packet->pos += 4;
-    
-    return true;
-}
-
-// Signed read functions
-
-boolean NET_ReadSInt8(net_packet_t *packet, signed int *data)
-{
-    if (NET_ReadInt8(packet,(unsigned int *) data))
-    {
-        if (*data & (1 << 7))
-        {
-            *data &= ~(1 << 7);
-            *data -= (1 << 7);
-        }
-        return true;
-    }
-    else
-    {
-        return false;
-    }
-}
-
-boolean NET_ReadSInt16(net_packet_t *packet, signed int *data)
-{
-    if (NET_ReadInt16(packet, (unsigned int *) data))
-    {
-        if (*data & (1 << 15))
-        {
-            *data &= ~(1 << 15);
-            *data -= (1 << 15);
-        }
-        return true;
-    }
-    else
-    {
-        return false;
-    }
-}
-
-boolean NET_ReadSInt32(net_packet_t *packet, signed int *data)
-{
-    if (NET_ReadInt32(packet, (unsigned int *) data))
-    {
-        if (*data & (1 << 31))
-        {
-            *data &= ~(1 << 31);
-            *data -= (1 << 31);
-        }
-        return true;
-    }
-    else
-    {
-        return false;
-    }
-}
-
-// Read a string from the packet.  Returns NULL if a terminating 
-// NUL character was not found before the end of the packet.
-
-char *NET_ReadString(net_packet_t *packet)
-{
-    char *start;
-
-    start = (char *) packet->data + packet->pos;
-
-    // Search forward for a NUL character
-
-    while (packet->pos < packet->len && packet->data[packet->pos] != '\0')
-    {
-        ++packet->pos;
-    }
-
-    if (packet->pos >= packet->len)
-    {
-        // Reached the end of the packet
-
-        return NULL;
-    }
-
-    // packet->data[packet->pos] == '\0': We have reached a terminating
-    // NULL.  Skip past this NULL and continue reading immediately 
-    // after it.
-
-    ++packet->pos;
-    
-    return start;
-}
-
-// Dynamically increases the size of a packet
-
-static void NET_IncreasePacket(net_packet_t *packet)
-{
-    byte *newdata;
-   
-    packet->alloced *= 2;
-
-    newdata = Z_Malloc(packet->alloced, PU_STATIC, 0);
-
-    memcpy(newdata, packet->data, packet->len);
-
-    Z_Free(packet->data);
-    packet->data = newdata;
-}
-
-// Write a single byte to the packet
-
-void NET_WriteInt8(net_packet_t *packet, unsigned int i)
-{
-    if (packet->len + 1 > packet->alloced)
-        NET_IncreasePacket(packet);
-
-    packet->data[packet->len] = i;
-    packet->len += 1;
-}
-
-// Write a 16-bit integer to the packet
-
-void NET_WriteInt16(net_packet_t *packet, unsigned int i)
-{
-    byte *p;
-    
-    if (packet->len + 2 > packet->alloced)
-        NET_IncreasePacket(packet);
-
-    p = packet->data + packet->len;
-
-    p[0] = (i >> 8) & 0xff;
-    p[1] = i & 0xff;
-
-    packet->len += 2;
-}
-
-
-// Write a single byte to the packet
-
-void NET_WriteInt32(net_packet_t *packet, unsigned int i)
-{
-    byte *p;
-
-    if (packet->len + 4 > packet->alloced)
-        NET_IncreasePacket(packet);
-
-    p = packet->data + packet->len;
-
-    p[0] = (i >> 24) & 0xff;
-    p[1] = (i >> 16) & 0xff;
-    p[2] = (i >> 8) & 0xff;
-    p[3] = i & 0xff;
-
-    packet->len += 4;
-}
-
-void NET_WriteString(net_packet_t *packet, char *string)
-{
-    byte *p;
-
-    // Increase the packet size until large enough to hold the string
-
-    while (packet->len + strlen(string) + 1 > packet->alloced)
-    {
-        NET_IncreasePacket(packet);
-    }
-
-    p = packet->data + packet->len;
-
-    strcpy((char *) p, string);
-
-    packet->len += strlen(string) + 1;
-}
-
-
-
-
diff --git a/src/net_packet.h b/src/net_packet.h
deleted file mode 100644
index 7f1f634..0000000
--- a/src/net_packet.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// Emacs style mode select   -*- C++ -*- 
-//-----------------------------------------------------------------------------
-//
-// $Id: net_packet.h 287 2006-01-13 02:20:12Z fraggle $
-//
-// 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.
-//
-// $Log$
-// Revision 1.3  2006/01/13 02:20:12  fraggle
-// Signed integer read functions.  Use these when reading ticcmd diffs.
-//
-// Revision 1.2  2006/01/01 23:51:41  fraggle
-// String read/write functions
-//
-// Revision 1.1  2005/10/30 19:56:15  fraggle
-// Add foundation code for the new networking system
-//
-//
-// DESCRIPTION:
-//     Definitions for use in networking code.
-//
-//-----------------------------------------------------------------------------
-
-#ifndef NET_PACKET_H
-#define NET_PACKET_H
-
-#include "net_defs.h"
-
-net_packet_t *NET_NewPacket(int initial_size);
-net_packet_t *NET_PacketDup(net_packet_t *packet);
-void NET_FreePacket(net_packet_t *packet);
-
-boolean NET_ReadInt8(net_packet_t *packet, unsigned int *data);
-boolean NET_ReadInt16(net_packet_t *packet, unsigned int *data);
-boolean NET_ReadInt32(net_packet_t *packet, unsigned int *data);
-
-boolean NET_ReadSInt8(net_packet_t *packet, signed int *data);
-boolean NET_ReadSInt16(net_packet_t *packet, signed int *data);
-boolean NET_ReadSInt32(net_packet_t *packet, signed int *data);
-
-char *NET_ReadString(net_packet_t *packet);
-
-void NET_WriteInt8(net_packet_t *packet, unsigned int i);
-void NET_WriteInt16(net_packet_t *packet, unsigned int i);
-void NET_WriteInt32(net_packet_t *packet, unsigned int i);
-
-void NET_WriteString(net_packet_t *packet, char *string);
-
-#endif /* #ifndef NET_PACKET_H */
-
diff --git a/src/net_sdl.c b/src/net_sdl.c
deleted file mode 100644
index 98730dd..0000000
--- a/src/net_sdl.c
+++ /dev/null
@@ -1,295 +0,0 @@
-// Emacs style mode select   -*- C++ -*- 
-//-----------------------------------------------------------------------------
-//
-// $Id: net_sdl.c 244 2006-01-02 20:11:49Z fraggle $
-//
-// 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.
-//
-// $Log$
-// Revision 1.3  2006/01/02 20:11:49  fraggle
-// Rename i_net_module -> net_sdl_module.  Fix the AddrToString method.
-//
-// Revision 1.2  2005/12/29 17:47:47  fraggle
-// Automatically initialise the address table
-//
-// Revision 1.1  2005/10/30 19:56:15  fraggle
-// Add foundation code for the new networking system
-//
-//
-// DESCRIPTION:
-//     Networking module which uses SDL_net
-//
-//-----------------------------------------------------------------------------
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "i_system.h"
-#include "m_argv.h"
-#include "net_defs.h"
-#include "net_packet.h"
-#include "net_sdl.h"
-#include "z_zone.h"
-
-//
-// NETWORKING
-//
-
-#include <SDL_net.h>
-
-static int port = 2342;
-static UDPsocket udpsocket;
-static UDPpacket *recvpacket;
-
-typedef struct
-{
-    net_addr_t net_addr;
-    IPaddress sdl_addr;
-} addrpair_t;
-
-static addrpair_t **addr_table;
-static int addr_table_size = -1;
-
-// Initialises the address table
-
-static void NET_SDL_InitAddrTable(void)
-{
-    addr_table_size = 16;
-
-    addr_table = Z_Malloc(sizeof(addrpair_t *) * addr_table_size,
-                          PU_STATIC, 0);
-    memset(addr_table, 0, sizeof(addrpair_t *) * addr_table_size);
-}
-
-static boolean AddressesEqual(IPaddress *a, IPaddress *b)
-{
-    return a->host == b->host
-        && a->port == b->port;
-}
-
-// Finds an address by searching the table.  If the address is not found,
-// it is added to the table.
-
-static net_addr_t *NET_SDL_FindAddress(IPaddress *addr)
-{
-    addrpair_t *new_entry;
-    int empty_entry = -1;
-    int i;
-
-    if (addr_table_size < 0)
-    {
-        NET_SDL_InitAddrTable();
-    }
-
-    for (i=0; i<addr_table_size; ++i)
-    {
-        if (addr_table[i] != NULL
-         && AddressesEqual(addr, &addr_table[i]->sdl_addr))
-        {
-            return &addr_table[i]->net_addr;
-        }
-
-        if (empty_entry < 0 && addr_table[i] == NULL)
-            empty_entry = i;
-    }
-
-    // Was not found in list.  We need to add it.
-
-    // Is there any space in the table? If not, increase the table size
-
-    if (empty_entry < 0)
-    {
-        addrpair_t **new_addr_table;
-        int new_addr_table_size;
-
-        // after reallocing, we will add this in as the first entry
-        // in the new block of memory
-
-        empty_entry = addr_table_size;
-        
-        // allocate a new array twice the size, init to 0 and copy 
-        // the existing table in.  replace the old table.
-
-        new_addr_table_size = addr_table_size * 2;
-        new_addr_table = Z_Malloc(sizeof(addrpair_t *) * new_addr_table_size,
-                                  PU_STATIC, 0);
-        memset(new_addr_table, 0, sizeof(addrpair_t *) * new_addr_table_size);
-        memcpy(new_addr_table, addr_table, 
-               sizeof(addrpair_t *) * addr_table_size);
-        Z_Free(addr_table);
-        addr_table = new_addr_table;
-        addr_table_size = new_addr_table_size;
-    }
-
-    // Add a new entry
-    
-    new_entry = Z_Malloc(sizeof(addrpair_t), PU_STATIC, 0);
-
-    new_entry->sdl_addr = *addr;
-    new_entry->net_addr.handle = &new_entry->sdl_addr;
-    new_entry->net_addr.module = &net_sdl_module;
-
-    addr_table[empty_entry] = new_entry;
-
-    return &new_entry->net_addr;
-}
-
-static void NET_SDL_FreeAddress(net_addr_t *addr)
-{
-    int i;
-    
-    for (i=0; i<addr_table_size; ++i)
-    {
-        if (addr == &addr_table[i]->net_addr)
-        {
-            Z_Free(addr_table[i]);
-            addr_table[i] = NULL;
-            return;
-        }
-    }
-
-    I_Error("NET_SDL_FreeAddress: Attempted to remove an unused address!");
-}
-
-static boolean NET_SDL_InitClient(void)
-{
-    SDLNet_Init();
-
-    udpsocket = SDLNet_UDP_Open(0);
-
-    if (udpsocket == NULL)
-    {
-        I_Error("NET_SDL_InitClient: Unable to open a socket!");
-    }
-    
-    recvpacket = SDLNet_AllocPacket(1500);
-
-    return true;
-}
-
-static boolean NET_SDL_InitServer(void)
-{
-    int p;
-    
-    p = M_CheckParm("-port");
-    if (p > 0)
-        port = atoi(myargv[p+1]);
-
-    SDLNet_Init();
-
-    udpsocket = SDLNet_UDP_Open(port);
-
-    if (udpsocket == NULL)
-    {
-        I_Error("NET_SDL_InitServer: Unable to bind to port %i", port);
-    }
-
-    recvpacket = SDLNet_AllocPacket(1500);
-
-    return true;
-}
-
-static void NET_SDL_SendPacket(net_addr_t *addr, net_packet_t *packet)
-{
-    UDPpacket sdl_packet;
-    IPaddress *ip = (IPaddress *) addr->handle;
-
-    sdl_packet.channel = 0;
-    sdl_packet.data = packet->data;
-    sdl_packet.len = packet->len;
-    sdl_packet.address = *ip;
-
-    if (!SDLNet_UDP_Send(udpsocket, -1, &sdl_packet))
-    {
-        I_Error("NET_SDL_SendPacket: Error transmitting packet: %s",
-                SDLNet_GetError());
-    }
-}
-
-static boolean NET_SDL_RecvPacket(net_addr_t **addr, net_packet_t **packet)
-{
-    int result;
-
-    result = SDLNet_UDP_Recv(udpsocket, recvpacket);
-
-    if (result < 0)
-    {
-        I_Error("NET_SDL_RecvPacket: Error receiving packet: %s",
-                SDLNet_GetError());
-    }
-
-    // no packets received
-
-    if (result == 0)
-        return false;
-
-    // Put the data into a new packet structure
-
-    *packet = NET_NewPacket(recvpacket->len);
-    memcpy((*packet)->data, recvpacket->data, recvpacket->len);
-    (*packet)->len = recvpacket->len;
-
-    // Address
-
-    *addr = NET_SDL_FindAddress(&recvpacket->address);
-
-    return true;
-}
-
-void NET_SDL_AddrToString(net_addr_t *addr, char *buffer, int buffer_len)
-{
-    IPaddress *ip;
-
-    ip = (IPaddress *) addr->handle;
-    
-    snprintf(buffer, buffer_len, 
-             "%i.%i.%i.%i",
-             ip->host & 0xff,
-             (ip->host >> 8) & 0xff,
-             (ip->host >> 16) & 0xff,
-             (ip->host >> 24) & 0xff);
-}
-
-net_addr_t *NET_SDL_ResolveAddress(char *address)
-{
-    IPaddress ip;
-    
-    if (SDLNet_ResolveHost(&ip, address, port))
-    {
-        // unable to resolve
-
-        return NULL;
-    }
-
-    return NET_SDL_FindAddress(&ip);
-}
-
-// Complete module
-
-net_module_t net_sdl_module =
-{
-    NET_SDL_InitClient,
-    NET_SDL_InitServer,
-    NET_SDL_SendPacket,
-    NET_SDL_RecvPacket,
-    NET_SDL_AddrToString,
-    NET_SDL_FreeAddress,
-    NET_SDL_ResolveAddress,
-};
-
diff --git a/src/net_sdl.h b/src/net_sdl.h
deleted file mode 100644
index 4343096..0000000
--- a/src/net_sdl.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// Emacs style mode select   -*- C++ -*- 
-//-----------------------------------------------------------------------------
-//
-// $Id: net_sdl.h 244 2006-01-02 20:11:49Z fraggle $
-//
-// 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.
-//
-// $Log$
-// Revision 1.2  2006/01/02 20:11:49  fraggle
-// Rename i_net_module -> net_sdl_module.  Fix the AddrToString method.
-//
-// Revision 1.1  2005/10/30 19:56:15  fraggle
-// Add foundation code for the new networking system
-//
-//
-// DESCRIPTION:
-//     Networking module which uses SDL_net
-//
-//-----------------------------------------------------------------------------
-
-#ifndef NET_SDL_H
-#define NET_SDL_H
-
-#include "net_defs.h"
-
-extern net_module_t net_sdl_module;
-
-#endif /* #ifndef NET_SDL_H */
-
diff --git a/src/net_server.c b/src/net_server.c
deleted file mode 100644
index 31ea03e..0000000
--- a/src/net_server.c
+++ /dev/null
@@ -1,707 +0,0 @@
-// Emacs style mode select   -*- C++ -*- 
-//-----------------------------------------------------------------------------
-//
-// $Id: net_server.c 285 2006-01-12 02:18:59Z fraggle $
-//
-// 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.
-//
-// $Log$
-// Revision 1.21  2006/01/12 02:18:59  fraggle
-// Only start new games when in the waiting-for-start state.
-//
-// Revision 1.20  2006/01/12 02:11:52  fraggle
-// Game start packets
-//
-// Revision 1.19  2006/01/10 19:59:26  fraggle
-// Reliable packet transport mechanism
-//
-// Revision 1.18  2006/01/09 02:03:39  fraggle
-// Send clients their player number, and indicate on the waiting screen
-// which client we are.
-//
-// Revision 1.17  2006/01/09 01:50:51  fraggle
-// Deduce a sane player name by examining environment variables.  Add
-// a "player_name" setting to chocolate-doom.cfg.  Transmit the name
-// to the server and use the names players send in the waiting data list.
-//
-// Revision 1.16  2006/01/08 05:06:06  fraggle
-// Reject new connections if the server is not in the waiting state.
-//
-// Revision 1.15  2006/01/08 04:52:26  fraggle
-// Allow the server to reject clients
-//
-// Revision 1.14  2006/01/08 03:36:17  fraggle
-// Fix packet send
-//
-// Revision 1.13  2006/01/08 02:53:05  fraggle
-// Send keepalives if the connection is not doing anything else.
-// Send all packets using a new NET_Conn_SendPacket to support this.
-//
-// Revision 1.12  2006/01/08 00:10:48  fraggle
-// Move common connection code into net_common.c, shared by server
-// and client code.
-//
-// Revision 1.11  2006/01/07 20:08:11  fraggle
-// Send player name and address in the waiting data packets.  Display these
-// on the waiting screen, and improve the waiting screen appearance.
-//
-// Revision 1.10  2006/01/02 21:48:37  fraggle
-// fix client connected function
-//
-// Revision 1.9  2006/01/02 21:04:10  fraggle
-// Create NET_SV_Shutdown function to shut down the server.  Call it
-// when quitting the game.  Print the IP of the server correctly when
-// connecting.
-//
-// Revision 1.8  2006/01/02 20:13:06  fraggle
-// Refer to connected clients by their AddrToString() output rather than just
-// the pointer to their struct.  Listen for IP connections as well as
-// loopback connections.
-//
-// Revision 1.7  2006/01/02 17:24:40  fraggle
-// Remove test code
-//
-// Revision 1.6  2006/01/02 00:54:17  fraggle
-// Fix packet not freed back after being sent.
-// Code to disconnect clients from the server side.
-//
-// Revision 1.5  2006/01/02 00:00:08  fraggle
-// Neater prefixes: NET_Client -> NET_CL_.  NET_Server -> NET_SV_.
-//
-// Revision 1.4  2006/01/01 23:54:31  fraggle
-// Client disconnect code
-//
-// Revision 1.3  2005/12/30 18:58:22  fraggle
-// Fix client code to correctly send reply to server on connection.
-// Add "waiting screen" while waiting for the game to start.
-// Hook in the new networking code into the main game code.
-//
-// Revision 1.2  2005/12/29 21:29:55  fraggle
-// Working client connect code
-//
-// Revision 1.1  2005/12/29 17:48:25  fraggle
-// Add initial client/server connect code.  Reorganise sources list in
-// Makefile.am.
-//
-//
-// Network server code
-//
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "doomdef.h"
-#include "doomstat.h"
-#include "i_system.h"
-#include "net_client.h"
-#include "net_common.h"
-#include "net_defs.h"
-#include "net_io.h"
-#include "net_loop.h"
-#include "net_packet.h"
-#include "net_server.h"
-#include "net_sdl.h"
-#include "net_structrw.h"
-
-typedef enum
-{
-    // waiting for the game to start
-
-    SERVER_WAITING_START,
-
-    // in a game
-
-    SERVER_IN_GAME,
-} net_server_state_t;
-
-typedef struct 
-{
-    boolean active;
-    net_addr_t *addr;
-    net_connection_t connection;
-    int last_send_time;
-    char *name;
-} net_client_t;
-
-static net_server_state_t server_state;
-static boolean server_initialised = false;
-static net_client_t clients[MAXNETNODES];
-static net_context_t *server_context;
-static int sv_gamemode;
-static int sv_gamemission;
-static net_gamesettings_t sv_settings;
-
-static void NET_SV_DisconnectClient(net_client_t *client)
-{
-    if (client->active)
-    {
-        NET_Conn_Disconnect(&client->connection);
-    }
-}
-
-static boolean ClientConnected(net_client_t *client)
-{
-    // Check that the client is properly connected: ie. not in the 
-    // process of connecting or disconnecting
-
-    return client->active 
-        && client->connection.state == NET_CONN_STATE_CONNECTED;
-}
-
-// returns the number of clients connected
-
-static int NET_SV_NumClients(void)
-{
-    int count;
-    int i;
-
-    count = 0;
-
-    for (i=0; i<MAXNETNODES; ++i)
-    {
-        if (ClientConnected(&clients[i]))
-        {
-            ++count;
-        }
-    }
-
-    return count;
-}
-
-// Returns the index of a particular client in the list of connected
-// clients.
-
-static int NET_SV_ClientIndex(net_client_t *client)
-{
-    int count;
-    int i;
-
-    count = 0;
-
-    for (i=0; i<MAXNETNODES; ++i)
-    {
-        if (ClientConnected(&clients[i]))
-        {
-            if (client == &clients[i])
-            {
-                return count;
-            }
-            ++count;
-        }
-    }
-
-    return -1;
-}
-
-// returns a pointer to the client which controls the server
-
-static net_client_t *NET_SV_Controller(void)
-{
-    int i;
-
-    // first client in the list is the controller
-
-    for (i=0; i<MAXNETNODES; ++i)
-    {
-        if (ClientConnected(&clients[i]))
-        {
-            return &clients[i];
-        }
-    }
-
-    return NULL;
-}
-
-// Given an address, find the corresponding client
-
-static net_client_t *NET_SV_FindClient(net_addr_t *addr)
-{
-    int i;
-
-    for (i=0; i<MAXNETNODES; ++i) 
-    {
-        if (clients[i].active && clients[i].addr == addr)
-        {
-            // found the client
-
-            return &clients[i];
-        }
-    }
-
-    return NULL;
-}
-
-// send a rejection packet to a client
-
-static void NET_SV_SendReject(net_addr_t *addr, char *msg)
-{
-    net_packet_t *packet;
-
-    packet = NET_NewPacket(10);
-    NET_WriteInt16(packet, NET_PACKET_TYPE_REJECTED);
-    NET_WriteString(packet, msg);
-    NET_SendPacket(addr, packet);
-    NET_FreePacket(packet);
-}
-
-// parse a SYN from a client(initiating a connection)
-
-static void NET_SV_ParseSYN(net_packet_t *packet, 
-                            net_client_t *client,
-                            net_addr_t *addr)
-{
-    unsigned int magic;
-    unsigned int cl_gamemode, cl_gamemission;
-    char *player_name;
-    int i;
-
-    // read the magic number
-
-    if (!NET_ReadInt32(packet, &magic))
-    {
-        return;
-    }
-
-    if (magic != NET_MAGIC_NUMBER)
-    {
-        // invalid magic number
-
-        return;
-    }
-
-    // read the game mode and mission
-
-    if (!NET_ReadInt16(packet, &cl_gamemode) 
-     || !NET_ReadInt16(packet, &cl_gamemission))
-    {
-        return;
-    }
-
-    // read the player's name
-
-    player_name = NET_ReadString(packet);
-
-    if (player_name == NULL)
-    {
-        return;
-    }
-    
-    // received a valid SYN
-
-    // not accepting new connections?
-    
-    if (server_state != SERVER_WAITING_START)
-    {
-        NET_SV_SendReject(addr, "Server is not currently accepting connections");
-    }
-    
-    // allocate a client slot if there isn't one already
-
-    if (client == NULL)
-    {
-        // find a slot, or return if none found
-
-        for (i=0; i<MAXNETNODES; ++i)
-        {
-            if (!clients[i].active)
-            {
-                client = &clients[i];
-                break;
-            }
-        }
-
-        if (client == NULL)
-        {
-            return;
-        }
-    }
-    else
-    {
-        // If this is a recently-disconnected client, deactivate
-        // to allow immediate reconnection
-
-        if (client->connection.state == NET_CONN_STATE_DISCONNECTED)
-        {
-            client->active = false;
-        }
-    }
-
-    // New client?
-
-    if (!client->active)
-    {
-        int num_clients;
-
-        // Before accepting a new client, check that there is a slot
-        // free
-
-        num_clients = NET_SV_NumClients();
-
-        if (num_clients >= MAXPLAYERS)
-        {
-            NET_SV_SendReject(addr, "Server is full!");
-            return;
-        }
-
-        // Adopt the game mode and mission of the first connecting client
-
-        if (num_clients == 0)
-        {
-            sv_gamemode = cl_gamemode;
-            sv_gamemission = cl_gamemission;
-        }
-
-        // Check the connecting client is playing the same game as all
-        // the other clients
-
-        if (cl_gamemode != sv_gamemode || cl_gamemission != sv_gamemission)
-        {
-            NET_SV_SendReject(addr, "You are playing the wrong game!");
-            return;
-        }
-        
-        // Activate, initialise connection
-
-        client->active = true;
-        NET_Conn_InitServer(&client->connection, addr);
-        client->addr = addr;
-        client->last_send_time = -1;
-        client->name = strdup(player_name);
-    }
-
-    if (client->connection.state == NET_CONN_STATE_WAITING_ACK)
-    {
-        // force an acknowledgement
-        client->connection.last_send_time = -1;
-    }
-}
-
-// Parse a game start packet
-
-static void NET_SV_ParseGameStart(net_packet_t *packet, net_client_t *client)
-{
-    net_gamesettings_t settings;
-    net_packet_t *startpacket;
-    int i;
-    
-    if (client != NET_SV_Controller())
-    {
-        // Only the controller can start a new game
-
-        return;
-    }
-
-    if (!NET_ReadSettings(packet, &settings))
-    {
-        // Malformed packet
-
-        return;
-    }
-
-    if (server_state != SERVER_WAITING_START)
-    {
-        // Can only start a game if we are in the waiting start state.
-
-        return;
-    }
-
-    // Change server state
-
-    server_state = SERVER_IN_GAME;
-    sv_settings = settings;
-
-    // Send start packets to each connected node
-
-    for (i=0; i<MAXNETNODES; ++i) 
-    {
-        if (ClientConnected(&clients[i]))
-        {
-            startpacket = NET_Conn_NewReliable(&clients[i].connection,
-                                               NET_PACKET_TYPE_GAMESTART);
-
-            NET_WriteInt8(startpacket, NET_SV_NumClients());
-            NET_WriteInt8(startpacket, NET_SV_ClientIndex(&clients[i]));
-            NET_WriteSettings(startpacket, &settings);
-        }
-    }
-}
-
-// Process a packet received by the server
-
-static void NET_SV_Packet(net_packet_t *packet, net_addr_t *addr)
-{
-    net_client_t *client;
-    unsigned int packet_type;
-
-    // Find which client this packet came from
-
-    client = NET_SV_FindClient(addr);
-
-    // Read the packet type
-
-    if (!NET_ReadInt16(packet, &packet_type))
-    {
-        // no packet type
-
-        return;
-    }
-
-    if (packet_type == NET_PACKET_TYPE_SYN)
-    {
-        NET_SV_ParseSYN(packet, client, addr);
-    }
-    else if (client == NULL)
-    {
-        // Must come from a valid client; ignore otherwise
-    }
-    else if (NET_Conn_Packet(&client->connection, packet, &packet_type))
-    {
-        // Packet was eaten by the common connection code
-    }
-    else
-    { 
-        //printf("SV: %s: %i\n", NET_AddrToString(addr), packet_type);
-
-        switch (packet_type)
-        {
-            case NET_PACKET_TYPE_GAMESTART:
-                NET_SV_ParseGameStart(packet, client);
-                break;
-            default:
-                // unknown packet type
-
-                break;
-        }
-    }
-
-    // If this address is not in the list of clients, be sure to
-    // free it back.
-
-    if (NET_SV_FindClient(addr) == NULL)
-    {
-        NET_FreeAddress(addr);
-    }
-}
-
-
-static void NET_SV_SendWaitingData(net_client_t *client)
-{
-    net_packet_t *packet;
-    int num_clients;
-    int i;
-
-    num_clients = NET_SV_NumClients();
-
-    // time to send the client another status packet
-
-    packet = NET_NewPacket(10);
-    NET_WriteInt16(packet, NET_PACKET_TYPE_WAITING_DATA);
-
-    // include the number of clients waiting
-
-    NET_WriteInt8(packet, num_clients);
-
-    // indicate whether the client is the controller
-
-    NET_WriteInt8(packet, NET_SV_Controller() == client);
-
-    // send the index of the client
-
-    NET_WriteInt8(packet, NET_SV_ClientIndex(client));
-
-    // send the address of all players
-
-    for (i=0; i<num_clients; ++i)
-    {
-        char *addr;
-
-        // name
-
-        NET_WriteString(packet, clients[i].name);
-
-        // address
-
-        addr = NET_AddrToString(clients[i].addr);
-
-        NET_WriteString(packet, addr);
-    }
-    
-    // send packet to client and free
-
-    NET_Conn_SendPacket(&client->connection, packet);
-    NET_FreePacket(packet);
-}
-
-// Perform any needed action on a client
-
-static void NET_SV_RunClient(net_client_t *client)
-{
-    // Run common code
-
-    NET_Conn_Run(&client->connection);
-    
-    // Is this client disconnected?
-
-    if (client->connection.state == NET_CONN_STATE_DISCONNECTED)
-    {
-        // deactivate and free back 
-
-        client->active = false;
-        free(client->name);
-        NET_FreeAddress(client->addr);
-    }
-    
-    if (!ClientConnected(client))
-    {
-        // client has not yet finished connecting
-
-        return;
-    }
-
-    if (server_state == SERVER_WAITING_START)
-    {
-        // Waiting for the game to start
-
-        // Send information once every second
-
-        if (client->last_send_time < 0 
-         || I_GetTimeMS() - client->last_send_time > 1000)
-        {
-            NET_SV_SendWaitingData(client);
-            client->last_send_time = I_GetTimeMS();
-        }
-    }
-}
-
-// Initialise server and wait for connections
-
-void NET_SV_Init(void)
-{
-    int i;
-
-    // initialise send/receive context, with loopback send/recv
-
-    server_context = NET_NewContext();
-    NET_AddModule(server_context, &net_loop_server_module);
-    net_loop_server_module.InitServer();
-    NET_AddModule(server_context, &net_sdl_module);
-    net_sdl_module.InitServer();
-
-    // no clients yet
-   
-    for (i=0; i<MAXNETNODES; ++i) 
-    {
-        clients[i].active = false;
-    }
-
-    server_state = SERVER_WAITING_START;
-    server_initialised = true;
-}
-
-// Run server code to check for new packets/send packets as the server
-// requires
-
-void NET_SV_Run(void)
-{
-    net_addr_t *addr;
-    net_packet_t *packet;
-    int i;
-
-    if (!server_initialised)
-    {
-        return;
-    }
-
-    while (NET_RecvPacket(server_context, &addr, &packet)) 
-    {
-        NET_SV_Packet(packet, addr);
-    }
-
-    // "Run" any clients that may have things to do, independent of responses
-    // to received packets
-
-    for (i=0; i<MAXNETNODES; ++i)
-    {
-        if (clients[i].active)
-        {
-            NET_SV_RunClient(&clients[i]);
-        }
-    }
-}
-
-void NET_SV_Shutdown(void)
-{
-    int i;
-    boolean running;
-    int start_time;
-
-    if (!server_initialised)
-    {
-        return;
-    }
-    
-    fprintf(stderr, "SV: Shutting down server...\n");
-
-    // Disconnect all clients
-    
-    for (i=0; i<MAXNETNODES; ++i)
-    {
-        if (clients[i].active)
-        {
-            NET_SV_DisconnectClient(&clients[i]);
-        }
-    }
-
-    // Wait for all clients to finish disconnecting
-
-    start_time = I_GetTimeMS();
-    running = true;
-
-    while (running)
-    {
-        // Check if any clients are still not finished
-
-        running = false;
-
-        for (i=0; i<MAXNETNODES; ++i)
-        {
-            if (clients[i].active)
-            {
-                running = true;
-            }
-        }
-
-        // Timed out?
-
-        if (I_GetTimeMS() - start_time > 5000)
-        {
-            running = false;
-            fprintf(stderr, "SV: Timed out waiting for clients to disconnect.\n");
-        }
-
-        // Run the client code in case this is a loopback client.
-
-        NET_CL_Run();
-        NET_SV_Run();
-
-        // Don't hog the CPU
-
-        I_Sleep(10);
-    }
-}
-
diff --git a/src/net_server.h b/src/net_server.h
deleted file mode 100644
index 81eaf4a..0000000
--- a/src/net_server.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Emacs style mode select   -*- C++ -*- 
-//-----------------------------------------------------------------------------
-//
-// $Id: net_server.h 250 2006-01-02 21:04:10Z fraggle $
-//
-// 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.
-//
-// $Log$
-// Revision 1.3  2006/01/02 21:04:10  fraggle
-// Create NET_SV_Shutdown function to shut down the server.  Call it
-// when quitting the game.  Print the IP of the server correctly when
-// connecting.
-//
-// Revision 1.2  2006/01/02 00:00:08  fraggle
-// Neater prefixes: NET_Client -> NET_CL_.  NET_Server -> NET_SV_.
-//
-// Revision 1.1  2005/12/29 17:48:25  fraggle
-// Add initial client/server connect code.  Reorganise sources list in
-// Makefile.am.
-//
-//
-// Network server code
-//
-
-#ifndef NET_SERVER_H
-#define NET_SERVER_H
-
-// initialise server and wait for connections
-
-void NET_SV_Init(void);
-
-// run server: check for new packets received etc.
-
-void NET_SV_Run(void);
-
-// Shut down the server
-// Blocks until all clients disconnect, or until a 5 second timeout
-
-void NET_SV_Shutdown(void);
-
-#endif /* #ifndef NET_SERVER_H */
-
diff --git a/src/net_structrw.c b/src/net_structrw.c
deleted file mode 100644
index a266202..0000000
--- a/src/net_structrw.c
+++ /dev/null
@@ -1,215 +0,0 @@
-// Emacs style mode select   -*- C++ -*- 
-//-----------------------------------------------------------------------------
-//
-// $Id: net_structrw.c 295 2006-01-14 02:06:48Z fraggle $
-//
-// 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.
-//
-// $Log$
-// Revision 1.5  2006/01/14 02:06:48  fraggle
-// Include the game version in the settings structure.
-//
-// Revision 1.4  2006/01/13 02:22:47  fraggle
-// Update prototypes to match header.  Make sure we include the header in the
-// source file.
-//
-// Revision 1.3  2006/01/13 02:20:12  fraggle
-// Signed integer read functions.  Use these when reading ticcmd diffs.
-//
-// Revision 1.2  2006/01/11 01:37:53  fraggle
-// ticcmd diffs: allow compare and patching ticcmds, and reading/writing
-// ticdiffs to packets.
-//
-// Revision 1.1  2005/12/30 18:58:22  fraggle
-// Fix client code to correctly send reply to server on connection.
-// Add "waiting screen" while waiting for the game to start.
-// Hook in the new networking code into the main game code.
-//
-//
-// Reading and writing various structures into packets
-//
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "net_packet.h"
-#include "net_structrw.h"
-
-void NET_WriteSettings(net_packet_t *packet, net_gamesettings_t *settings)
-{
-    NET_WriteInt8(packet, settings->ticdup);
-    NET_WriteInt8(packet, settings->extratics);
-    NET_WriteInt8(packet, settings->deathmatch);
-    NET_WriteInt8(packet, settings->episode);
-    NET_WriteInt8(packet, settings->map);
-    NET_WriteInt8(packet, settings->skill);
-    NET_WriteInt8(packet, settings->gameversion);
-}
-
-boolean NET_ReadSettings(net_packet_t *packet, net_gamesettings_t *settings)
-{
-    return NET_ReadInt8(packet, (unsigned int *) &settings->ticdup)
-        && NET_ReadInt8(packet, (unsigned int *) &settings->extratics)
-        && NET_ReadInt8(packet, (unsigned int *) &settings->deathmatch)
-        && NET_ReadInt8(packet, (unsigned int *) &settings->episode)
-        && NET_ReadInt8(packet, (unsigned int *) &settings->map)
-        && NET_ReadInt8(packet, (unsigned int *) &settings->skill)
-        && NET_ReadInt8(packet, (unsigned int *) &settings->gameversion);
-}
-
-void NET_WriteTiccmdDiff(net_packet_t *packet, net_ticdiff_t *diff, 
-                         boolean lowres_turn)
-{
-    // Header
-
-    NET_WriteInt8(packet, diff->diff);
-
-    // Write the fields which are enabled:
-
-    if (diff->diff & NET_TICDIFF_FORWARD)
-        NET_WriteInt8(packet, diff->cmd.forwardmove);
-    if (diff->diff & NET_TICDIFF_SIDE)
-        NET_WriteInt8(packet, diff->cmd.sidemove);
-    if (diff->diff & NET_TICDIFF_TURN)
-    {
-        if (lowres_turn)
-        {
-            NET_WriteInt8(packet, diff->cmd.angleturn / 256);
-        }
-        else
-        {
-            NET_WriteInt16(packet, diff->cmd.angleturn);
-        }
-    }
-    if (diff->diff & NET_TICDIFF_BUTTONS)
-        NET_WriteInt8(packet, diff->cmd.buttons);
-    if (diff->diff & NET_TICDIFF_CONSISTANCY)
-        NET_WriteInt8(packet, diff->cmd.consistancy);
-    if (diff->diff & NET_TICDIFF_CHATCHAR)
-        NET_WriteInt8(packet, diff->cmd.chatchar);
-}
-
-boolean NET_ReadTiccmdDiff(net_packet_t *packet, net_ticdiff_t *diff,
-                           boolean lowres_turn)
-{
-    unsigned int val;
-    signed int sval;
-
-    // Read header
-
-    if (!NET_ReadInt8(packet, &diff->diff))
-        return false;
-    
-    // Read fields
-
-    if (diff->diff & NET_TICDIFF_FORWARD)
-    {
-        if (!NET_ReadSInt8(packet, &sval))
-            return false;
-        diff->cmd.forwardmove = sval;
-    }
-
-    if (diff->diff & NET_TICDIFF_SIDE)
-    {
-        if (!NET_ReadSInt8(packet, &sval))
-            return false;
-        diff->cmd.sidemove = sval;
-    }
-
-    if (diff->diff & NET_TICDIFF_TURN)
-    {
-        if (lowres_turn)
-        {
-            if (!NET_ReadSInt8(packet, &sval))
-                return false;
-            diff->cmd.angleturn = sval * 256;
-        }
-        else
-        {
-            if (!NET_ReadSInt16(packet, &sval))
-                return false;
-            diff->cmd.angleturn = sval;
-        }
-    }
-
-    if (diff->diff & NET_TICDIFF_BUTTONS)
-    {
-        if (!NET_ReadInt8(packet, &val))
-            return false;
-        diff->cmd.buttons = val;
-    }
-
-    if (diff->diff & NET_TICDIFF_CONSISTANCY)
-    {
-        if (!NET_ReadInt8(packet, &val))
-            return false;
-        diff->cmd.consistancy = val;
-    }
-
-    if (diff->diff & NET_TICDIFF_CHATCHAR)
-    {
-        if (!NET_ReadInt8(packet, &val))
-            return false;
-        diff->cmd.chatchar = val;
-    }
-
-    return true;
-}
-
-void NET_TiccmdDiff(ticcmd_t *tic1, ticcmd_t *tic2, net_ticdiff_t *diff)
-{
-    diff->diff = 0;
-    diff->cmd = *tic2;
-
-    if (tic1->forwardmove != tic2->forwardmove)
-        diff->diff |= NET_TICDIFF_FORWARD;
-    if (tic1->sidemove != tic2->sidemove)
-        diff->diff |= NET_TICDIFF_SIDE;
-    if (tic1->angleturn != tic2->angleturn)
-        diff->diff |= NET_TICDIFF_TURN;
-    if (tic1->buttons != tic2->buttons)
-        diff->diff |= NET_TICDIFF_BUTTONS;
-    if (tic1->consistancy != tic2->consistancy)
-        diff->diff |= NET_TICDIFF_CONSISTANCY;
-    if (tic2->chatchar != 0)
-        diff->diff |= NET_TICDIFF_CHATCHAR;
-}
-
-void NET_TiccmdPatch(ticcmd_t *src, net_ticdiff_t *diff, ticcmd_t *dest)
-{
-    memcpy(dest, src, sizeof(ticcmd_t));
-
-    // Apply the diff
-
-    if (diff->diff & NET_TICDIFF_FORWARD)
-        dest->forwardmove = diff->cmd.forwardmove;
-    if (diff->diff & NET_TICDIFF_SIDE)
-        dest->sidemove = diff->cmd.sidemove;
-    if (diff->diff & NET_TICDIFF_TURN)
-        dest->angleturn = diff->cmd.angleturn;
-    if (diff->diff & NET_TICDIFF_BUTTONS)
-        dest->buttons = diff->cmd.buttons;
-    if (diff->diff & NET_TICDIFF_CONSISTANCY)
-        dest->consistancy = diff->cmd.consistancy;
-
-    if (diff->diff & NET_TICDIFF_CHATCHAR)
-        dest->chatchar = diff->cmd.chatchar;
-    else
-        dest->chatchar = 0;
-}
-
diff --git a/src/net_structrw.h b/src/net_structrw.h
deleted file mode 100644
index 3d835b6..0000000
--- a/src/net_structrw.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// Emacs style mode select   -*- C++ -*- 
-//-----------------------------------------------------------------------------
-//
-// $Id: net_structrw.h 288 2006-01-13 02:22:47Z fraggle $
-//
-// 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.
-//
-// $Log$
-// Revision 1.3  2006/01/13 02:22:47  fraggle
-// Update prototypes to match header.  Make sure we include the header in the
-// source file.
-//
-// Revision 1.2  2006/01/11 01:37:53  fraggle
-// ticcmd diffs: allow compare and patching ticcmds, and reading/writing
-// ticdiffs to packets.
-//
-// Revision 1.1  2005/12/30 18:58:22  fraggle
-// Fix client code to correctly send reply to server on connection.
-// Add "waiting screen" while waiting for the game to start.
-// Hook in the new networking code into the main game code.
-//
-
-#ifndef NET_STRUCTRW_H
-#define NET_STRUCTRW_H
-
-#include "net_defs.h"
-#include "net_packet.h"
-
-extern void NET_WriteSettings(net_packet_t *packet, net_gamesettings_t *settings);
-extern boolean NET_ReadSettings(net_packet_t *packet, net_gamesettings_t *settings);
-
-extern void NET_WriteTiccmdDiff(net_packet_t *packet, net_ticdiff_t *diff, boolean lowres_turn);
-extern boolean NET_ReadTiccmdDiff(net_packet_t *packet, net_ticdiff_t *diff, boolean lowres_turn);
-extern void NET_TiccmdDiff(ticcmd_t *tic1, ticcmd_t *tic2, net_ticdiff_t *diff);
-extern void NET_TiccmdPatch(ticcmd_t *src, net_ticdiff_t *diff, ticcmd_t *dest);
-
-#endif /* #ifndef NET_STRUCTRW_H */
-

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/chocolate-doom.git



More information about the Pkg-games-commits mailing list