summaryrefslogtreecommitdiff
path: root/src/net_common.c
diff options
context:
space:
mode:
authorSimon Howard2006-02-19 13:42:27 +0000
committerSimon Howard2006-02-19 13:42:27 +0000
commitbef7af18c671dbe1ff4d822206a15f4bcab56e67 (patch)
treee69f9be3eae2200d20cd207b42cae153b94f884f /src/net_common.c
parent76d69779c9bcebec6a2188d6b9e2483240e26a8a (diff)
downloadchocolate-doom-bef7af18c671dbe1ff4d822206a15f4bcab56e67.tar.gz
chocolate-doom-bef7af18c671dbe1ff4d822206a15f4bcab56e67.tar.bz2
chocolate-doom-bef7af18c671dbe1ff4d822206a15f4bcab56e67.zip
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
Diffstat (limited to 'src/net_common.c')
-rw-r--r--src/net_common.c32
1 files changed, 31 insertions, 1 deletions
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;
+}
+
+