ref: 07a5c09bb0163a1714912e7480ba6c6e8836a613
parent: 8e024a47e049234fc0502ad723dc165388f6e795
author: Simon Howard <[email protected]>
date: Wed May 16 09:49:04 EDT 2007
Rejig net_cl_new_sync and drone to be in d_net.c instead of net_client.c. Fix FEATURE_MULTIPLAYER conditional compile. Move some function definitions in d_net.c into headers. Reorganise the Makefile to split out files into sections based on features. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 875
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -22,21 +22,8 @@
chocolate_server_SOURCES=$(DEDSERV_FILES)
chocolate_server_LDADD = @LDFLAGS@ @SDL_LIBS@ @SDLNET_LIBS@
-SOURCE_FILES=\
+MAIN_SOURCE_FILES=\
am_map.c am_map.h \
-deh_ammo.c \
-deh_cheat.c \
-deh_defs.h \
-deh_frame.c \
-deh_io.c deh_io.h \
-deh_main.c deh_main.h \
-deh_mapping.c deh_mapping.h \
-deh_misc.c deh_misc.h \
-deh_ptr.c \
-deh_sound.c \
-deh_text.c \
-deh_thing.c \
-deh_weapon.c \
d_englsh.h \
d_event.h \
d_items.c d_items.h \
@@ -78,18 +65,6 @@
memio.c memio.h \
mus2mid.c mus2mid.h \
m_random.c m_random.h \
-net_client.c net_client.h \
-net_common.c net_common.h \
-net_dedicated.c net_dedicated.h \
-net_defs.h \
-net_gui.c net_gui.h \
-net_io.c net_io.h \
-net_loop.c net_loop.h \
-net_packet.c net_packet.h \
-net_query.c net_query.h \
-net_sdl.c net_sdl.h \
-net_server.c net_server.h \
-net_structrw.c net_structrw.h \
p_ceilng.c \
p_doors.c \
p_enemy.c \
@@ -121,7 +96,6 @@
r_sky.c r_sky.h \
r_state.h \
r_things.c r_things.h \
-sounds.c sounds.h \
s_sound.c s_sound.h \
st_lib.c st_lib.h \
st_stuff.c st_stuff.h \
@@ -129,9 +103,55 @@
v_video.c v_video.h \
wi_stuff.c wi_stuff.h \
w_checksum.c w_checksum.h \
-w_merge.c w_merge.h \
w_wad.c w_wad.h \
z_zone.c z_zone.h
+
+ASDF=\
+sounds.c sounds.h \
+asdf
+
+# source files needed for FEATURE_DEHACKED
+
+FEATURE_DEHACKED_SOURCE_FILES= \
+deh_ammo.c \
+deh_cheat.c \
+deh_defs.h \
+deh_frame.c \
+deh_io.c deh_io.h \
+deh_main.c deh_main.h \
+deh_mapping.c deh_mapping.h \
+deh_misc.c deh_misc.h \
+deh_ptr.c \
+deh_sound.c \
+deh_text.c \
+deh_thing.c \
+deh_weapon.c
+
+# source files needed for FEATURE_MULTIPLAYER
+
+FEATURE_MULTIPLAYER_SOURCE_FILES= \
+net_client.c net_client.h \
+net_common.c net_common.h \
+net_dedicated.c net_dedicated.h \
+net_defs.h \
+net_gui.c net_gui.h \
+net_io.c net_io.h \
+net_loop.c net_loop.h \
+net_packet.c net_packet.h \
+net_query.c net_query.h \
+net_sdl.c net_sdl.h \
+net_server.c net_server.h \
+net_structrw.c net_structrw.h
+
+# source files needed for FEATURE_WAD_MERGE
+
+FEATURE_WAD_MERGE_SOURCE_FILES = \
+w_merge.c w_merge.h
+
+SOURCE_FILES = $(MAIN_SOURCE_FILES) \
+ $(FEATURE_DEHACKED_SOURCE_FILES) \
+ $(FEATURE_MULTIPLAYER_SOURCE_FILES) \
+ $(FEATURE_WAD_MERGE_SOURCE_FILES)
if HAVE_WINDRES
chocolate_doom_SOURCES=$(SOURCE_FILES) chocolate-doom-res.rc
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -791,6 +791,7 @@
printf (DEH_String("Z_Init: Init zone memory allocation daemon. \n"));
Z_Init ();
+#ifdef FEATURE_MULTIPLAYER
//!
// @category net
//
@@ -829,6 +830,8 @@
if (M_CheckParm("-search"))
NET_LANQuery();
+
+#endif
#ifdef FEATURE_DEHACKED
printf("DEH_Init: Init Dehacked support.\n");
--- a/src/d_main.h
+++ b/src/d_main.h
@@ -48,6 +48,9 @@
event_t *D_PopEvent(void);
+// Read events from all input devices
+
+void D_ProcessEvents (void);
//
@@ -56,6 +59,8 @@
void D_PageTicker (void);
void D_PageDrawer (void);
void D_AdvanceDemo (void);
+void D_DoAdvanceDemo (void);
void D_StartTitle (void);
+
#endif
--- a/src/d_net.c
+++ b/src/d_net.c
@@ -67,17 +67,31 @@
int maketic;
+// Used for original sync code.
+
int lastnettic;
-int skiptics;
-int ticdup;
+int skiptics = 0;
+
+// Reduce the bandwidth needed by sampling game input less and transmitting
+// less. If ticdup is 2, sample half normal, 3 = one third normal, etc.
+
+int ticdup;
+
+// Send this many extra (backup) tics in each packet.
+
int extratics;
+
+// Amount to offset the timer for game sync.
+
fixed_t offsetms;
+// Use new client syncronisation code
-void D_ProcessEvents (void);
-void G_BuildTiccmd (ticcmd_t *cmd);
-void D_DoAdvanceDemo (void);
-
+boolean net_cl_new_sync = true;
+
+// Connected but not participating in the game (observer)
+
+boolean drone = false;
// 35 fps clock adjusted by offsetms milliseconds
--- a/src/d_net.h
+++ b/src/d_net.h
@@ -50,5 +50,8 @@
// Called at start of game loop to initialise timers
void D_StartGameLoop(void);
+extern boolean drone;
+extern boolean net_cl_new_sync;
+
#endif
--- a/src/g_game.h
+++ b/src/g_game.h
@@ -30,9 +30,9 @@
#include "doomdef.h"
#include "d_event.h"
+#include "d_ticcmd.h"
-
//
// GAME
//
@@ -69,6 +69,10 @@
void G_SecretExitLevel (void);
void G_WorldDone (void);
+
+// Read current data from inputs and build a player movement command.
+
+void G_BuildTiccmd (ticcmd_t *cmd);
void G_Ticker (void);
boolean G_Responder (event_t* ev);
--- a/src/net_client.c
+++ b/src/net_client.c
@@ -182,14 +182,6 @@
static fixed_t average_latency;
-// Use new-style ticcmd sync (fixes indigo lag)
-
-boolean net_cl_new_sync = true;
-
-// Connected but not participating in the game (observer)
-
-boolean drone = false;
-
#define NET_CL_ExpandTicNum(b) NET_ExpandTicNum(recvwindow_start, (b))
// Called when a player leaves the game
--- a/src/net_client.h
+++ b/src/net_client.h
@@ -50,8 +50,6 @@
extern char net_player_addresses[MAXPLAYERS][MAXPLAYERNAME];
extern int net_player_number;
extern char *net_player_name;
-extern boolean net_cl_new_sync;
-extern boolean drone;
extern md5_digest_t net_server_wad_md5sum;
extern md5_digest_t net_server_deh_md5sum;