11#define NET_STREAM_BUFFER_SIZE 0x200
13#define NET_PLAYER_STREAM_COUNT 16
22 unsigned char *pBuffer;
31 void StreamAlignReadByte();
39 void StreamFlushWriteByte();
243#define NET_PACKET_MAX_SIZE 256
258 unsigned char bPlayer,
292 unsigned char bPlayer,
295 unsigned char bOptionA,
296 unsigned char bOptionB,
297 unsigned char bOptionC,
298 const char *szPlayerName,
315extern int g_bNetGameSettingUnk_10221280;
A stream of the bytes and bits of a packet, read and written from the most significant bit.
Definition netstream.h:16
void StreamWriteInt32(unsigned nValue)
Write the four bytes of a number, from the next whole byte.
bool StreamIsAtEnd()
Whether the reading arrived at the end of the data written.
unsigned char * StreamGetBufferPtr()
The bytes of the stream.
NetStream()
An empty stream of its own bytes.
void StreamWriteInt16(unsigned nValue)
Write the low two bytes of a number, from the next whole byte.
void StreamAttachBuffer(unsigned char *pData, int nSize)
Read the bytes of a buffer from their start.
int StreamReadInt32()
Read four bytes as a number, from the next whole byte.
int StreamGetWriteSize()
The number of bytes written, counting a byte partly written.
void BitStreamWriteBits(unsigned nValue, int nBits)
Write the low bits of a number.
unsigned StreamReadInt24()
Read three bytes as an unsigned number, from the next whole byte.
void StreamResetReadWrite()
Empty the stream.
void StreamWriteByte(unsigned char bValue)
Write a byte, from the next whole byte.
void StreamResetRead()
Read the stream again from its start.
unsigned char StreamReadByte()
Read a byte, from the next whole byte.
unsigned StreamReadInt16()
Read two bytes as an unsigned number, from the next whole byte.
void StreamSkip(int nCount)
Skip bytes, from the next whole byte.
unsigned BitStreamReadBits(int nBits)
Read bits as an unsigned number.
void StreamWriteInt24(unsigned nValue)
Write the low three bytes of a number, from the next whole byte.
#define NET_STREAM_BUFFER_SIZE
The size of the buffer of a NetStream.
Definition netstream.h:11
bool WritePlayerRankingPacket(NetStream *pStream, unsigned char bPlayer)
Write a packet of the positions of the players: the player with the tag 0x20 and the positions of g_a...
void EncodeKeyframeBitstreamDelta(NetStream *stream, KeyframeState *state, KeyframeState *base)
Encode a keyframe against base, shortening position and progress fields.
bool WriteGameSettingsPacket(NetStream *pStream, unsigned char bPlayer)
Write the maximum player count, track, weather, allowed cars, and tyre and suspension settings.
int g_adwNetPlayerRankPosition[NET_PLAYER_STREAM_COUNT]
The position of each network player in the race, from 0 to 15.
NetStream g_aNetPlayerStreams[NET_PLAYER_STREAM_COUNT]
The streams of the players of network play.
void DeserializeVehicleState(KeyframeState *pState, NetStream *pStream)
Decode a full network vehicle keyframe from the bit stream into pState.
int g_dwVehicleStateSendCounter
The number of local vehicle state updates since the network race started.
void EncodeKeyframeBitstreamFull(NetStream *stream, KeyframeState *state)
Encode orientation, position, motion, progress, lights, and effects as a full keyframe.
bool WriteTimeSyncPacket(NetStream *pStream, unsigned char bPlayer, unsigned nTime, unsigned nValue)
Write a packet of the time of a player: the player with the tag 0xc0, the time in 24 bits,...
unsigned g_dwNetRaceStartCountdownTime
The clock time at which the network race countdown ends, in milliseconds.
int CompareNetworkPlayerProgressDescending(const void *pA, const void *pB)
Order two NetPlayerProgress entries for qsort() by their progress, the greatest first.
float g_afKeyframeAccumMax[7]
The largest values accumulated for the seven keyframe fields before the next send.
unsigned SendKeyframePacket(KeyframeState *state)
Send a complete vehicle keyframe as an unreliable network packet.
unsigned GetInterpolatedRemoteVehicleState(KeyframeState *state, int slotIndex)
Interpolate or predict the vehicle state of a remote player from buffered snapshots.
#define NET_PLAYER_STREAM_COUNT
The number of entries of g_aNetPlayerStreams.
Definition netstream.h:13
unsigned SendLocalVehicleStateUpdate(KeyframeState *state)
Accumulate vehicle state over three frames and send full or delta snapshots on schedule.
KeyframeState g_LastSentKeyframe
The last complete local vehicle state sent to the other players.
NetPlayerProgress g_aNetPlayerProgressSort[NET_PLAYER_STREAM_COUNT]
The players of network play, sorted by their progress.
unsigned SendDeltaKeyframePacket(KeyframeState *state, KeyframeState *base)
Send a vehicle keyframe compressed against base as an unreliable network packet.
bool WritePlayerStatusPacket(NetStream *pStream, unsigned char bPlayer, int nState, int nStatusValue, unsigned char bOptionA, unsigned char bOptionB, unsigned char bOptionC, const char *szPlayerName, unsigned dwOwner)
Write a player's state, options, and owner, followed by a name or countdown for states that include t...
void DeserializeKeyframeDelta(KeyframeState *pState, const KeyframeState *pBase, NetStream *pStream)
Reconstruct position and progress relative to pBase from a delta keyframe.
Vehicle pose and interpolated controls before compact frame encoding.
Definition ghost.h:29
A player of network play and the progress that ranks it.
Definition netstream.h:218
int nPlayer
Definition netstream.h:219
float fProgress
Definition netstream.h:220