OpenCoD2-Plus
Call of Duty 2 client & server, rebuilt
Loading...
Searching...
No Matches
cod2snap.MsgReader Class Reference

Public Member Functions

 __init__ (self, data)
 read_bit (self)
 read_bits (self, count)
 read_bytes (self, count)
 read_byte (self)
 read_short (self)
 read_long (self)
 read_float (self)
 read_string (self)
 read_value (self, bits)
 read_angle16 (self)
 read_small_float (self, int_bits, bias)

Public Attributes

 data = data
int readcount = 0
int bit = 0

Protected Member Functions

 _need (self, count)

Detailed Description

Mirrors the server's msg_t reads: a bit read that starts a new byte takes
the next unread byte, and byte reads continue after the last byte taken, so
bits and bytes interleave as MSG_WriteBit and MSG_WriteByte wrote them.

Constructor & Destructor Documentation

◆ __init__()

cod2snap.MsgReader.__init__ ( self,
data )

Member Function Documentation

◆ _need()

cod2snap.MsgReader._need ( self,
count )
protected

◆ read_angle16()

cod2snap.MsgReader.read_angle16 ( self)

◆ read_bit()

cod2snap.MsgReader.read_bit ( self)

◆ read_bits()

cod2snap.MsgReader.read_bits ( self,
count )

◆ read_byte()

cod2snap.MsgReader.read_byte ( self)

◆ read_bytes()

cod2snap.MsgReader.read_bytes ( self,
count )

◆ read_float()

cod2snap.MsgReader.read_float ( self)

◆ read_long()

cod2snap.MsgReader.read_long ( self)

◆ read_short()

cod2snap.MsgReader.read_short ( self)
Unsigned, as MSG_ReadShort returns it.

◆ read_small_float()

cod2snap.MsgReader.read_small_float ( self,
int_bits,
bias )
A float either as a biased integer (int_bits low bits, then a byte)
or, after a 1 bit, as its 4 bytes.

◆ read_string()

cod2snap.MsgReader.read_string ( self)

◆ read_value()

cod2snap.MsgReader.read_value ( self,
bits )
MSG_ReadValue: the low bits & 7 as bits, the rest as whole bytes;
a negative count means a signed value.

Member Data Documentation

◆ bit

int cod2snap.MsgReader.bit = 0

◆ data

cod2snap.MsgReader.data = data

◆ readcount

cod2snap.MsgReader.readcount = 0

The documentation for this class was generated from the following file: