From bef7af18c671dbe1ff4d822206a15f4bcab56e67 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 19 Feb 2006 13:42:27 +0000 Subject: Move tic number expansion code to common code. Parse game data packets received from the server. Strip down d_net.[ch] to work through the new networking code. Remove game sync code. Remove i_net.[ch] as it is no longer needed. Working networking! Subversion-branch: /trunk/chocolate-doom Subversion-revision: 374 --- src/net_common.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'src/net_common.c') diff --git a/src/net_common.c b/src/net_common.c index 92c050e1..d79d30ec 100644 --- a/src/net_common.c +++ b/src/net_common.c @@ -1,7 +1,7 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // -// $Id: net_common.c 279 2006-01-10 19:59:26Z fraggle $ +// $Id: net_common.c 374 2006-02-19 13:42:27Z fraggle $ // // Copyright(C) 2005 Simon Howard // @@ -21,6 +21,14 @@ // 02111-1307, USA. // // $Log$ +// Revision 1.5 2006/02/19 13:42:27 fraggle +// Move tic number expansion code to common code. Parse game data packets +// received from the server. +// Strip down d_net.[ch] to work through the new networking code. Remove +// game sync code. +// Remove i_net.[ch] as it is no longer needed. +// Working networking! +// // Revision 1.4 2006/01/10 19:59:26 fraggle // Reliable packet transport mechanism // @@ -489,3 +497,25 @@ net_packet_t *NET_Conn_NewReliable(net_connection_t *conn, int packet_type) return packet; } +// Used to expand the least significant byte of a tic number into +// the full tic number, from the current tic number + +unsigned int NET_ExpandTicNum(unsigned int relative, unsigned int b) +{ + unsigned int l, h; + unsigned int result; + + h = relative & ~0xff; + l = relative & 0xff; + + result = h | b; + + if (l < 0x40 && b > 0xb0) + result -= 0x100; + if (l > 0xb0 && b < 0x40) + result += 0x100; + + return result; +} + + -- cgit v1.2.3