diff --git a/src/d_netserver.h b/src/d_netserver.h index 29acca84b1..c7e191390a 100644 --- a/src/d_netserver.h +++ b/src/d_netserver.h @@ -23,14 +23,6 @@ #include "d_net.h" -enum class NetPacketType -{ - ConnectRequest, - ConnectResponse, - Disconnect, - Tic -}; - enum class NodeStatus { Closed, diff --git a/src/d_netsync.cpp b/src/d_netsync.cpp index 793c23f5f7..23369d3f50 100644 --- a/src/d_netsync.cpp +++ b/src/d_netsync.cpp @@ -21,6 +21,7 @@ #include "c_dispatch.h" #include "actor.h" #include "doomstat.h" +#include "i_net.h" extern bool netserver, netclient; diff --git a/src/d_netsync.h b/src/d_netsync.h index 7dd531a1f9..9c7a486a49 100644 --- a/src/d_netsync.h +++ b/src/d_netsync.h @@ -3,7 +3,6 @@ #include "vectors.h" #include "r_data/renderstyle.h" -#include "d_netserver.h" // Maximum size of the packets sent out by the server. #define MAX_UDP_PACKET 8192 @@ -11,6 +10,16 @@ // This is the longest possible string we can pass over the network. #define MAX_NETWORK_STRING 2048 +enum class NetPacketType +{ + ConnectRequest, + ConnectResponse, + Disconnect, + Tic +}; + +class AActor; + struct NetSyncData { DVector3 Pos; DVector3 Vel; @@ -121,6 +130,8 @@ struct NETBUFFER_s int WriteTo( BYTESTREAM_s &ByteStream ) const; }; +struct NetPacket; + /** * \author Benjamin Berkels */ diff --git a/src/i_net.h b/src/i_net.h index ccea62bacb..090a250f44 100644 --- a/src/i_net.h +++ b/src/i_net.h @@ -2,13 +2,21 @@ #pragma once #include +#include "d_netsync.h" #define MAX_MSGLEN 14000 #define DOOMPORT 5029 struct NetPacket { - NetPacket() { memset(data, 0, sizeof(data)); } + NetPacket() + { + memset(data, 0, sizeof(data)); + stream.pbStream = data; + stream.bitBuffer = NULL; + stream.bitShift = -1; + stream.pbStreamEnd = stream.pbStream + sizeof(data); + } // packet data to be sent uint8_t data[MAX_MSGLEN]; @@ -21,6 +29,8 @@ struct NetPacket uint8_t &operator[](int i) { return data[i]; } const uint8_t &operator[](int i) const { return data[i]; } + + BYTESTREAM_s stream; }; // Network packet data.