Browse Source

engine: network: remove unused MSG_Read/WriteBitFloat

pull/2/head
Alibek Omarov 2 years ago
parent
commit
9cdce1ce69
  1. 37
      engine/common/net_buffer.c
  2. 2
      engine/common/net_buffer.h

37
engine/common/net_buffer.c

@ -359,17 +359,6 @@ void MSG_WriteVec3Angles( sizebuf_t *sb, const float *fa )
MSG_WriteBitAngle( sb, fa[2], 16 ); MSG_WriteBitAngle( sb, fa[2], 16 );
} }
void MSG_WriteBitFloat( sizebuf_t *sb, float val )
{
int intVal;
Assert( sizeof( int ) == sizeof( float ));
Assert( sizeof( float ) == 4 );
intVal = FloatAsInt( val );
MSG_WriteUBitLong( sb, intVal, 32 );
}
void MSG_WriteCmdExt( sizebuf_t *sb, int cmd, netsrc_t type, const char *name ) void MSG_WriteCmdExt( sizebuf_t *sb, int cmd, netsrc_t type, const char *name )
{ {
#ifdef DEBUG_NET_MESSAGES_SEND #ifdef DEBUG_NET_MESSAGES_SEND
@ -523,32 +512,6 @@ uint MSG_ReadUBitLong( sizebuf_t *sb, int numbits )
return ret; return ret;
} }
float MSG_ReadBitFloat( sizebuf_t *sb )
{
int val;
int bit, byte;
Assert( sizeof( float ) == sizeof( int ));
Assert( sizeof( float ) == 4 );
if( MSG_Overflow( sb, 32 ))
return 0.0f;
bit = sb->iCurBit & 0x7;
byte = sb->iCurBit >> 3;
val = sb->pData[byte] >> bit;
val |= ((int)sb->pData[byte + 1]) << ( 8 - bit );
val |= ((int)sb->pData[byte + 2]) << ( 16 - bit );
val |= ((int)sb->pData[byte + 3]) << ( 24 - bit );
if( bit != 0 )
val |= ((int)sb->pData[byte + 4]) << ( 32 - bit );
sb->iCurBit += 32;
return IntAsFloat( val );
}
qboolean MSG_ReadBits( sizebuf_t *sb, void *pOutData, int nBits ) qboolean MSG_ReadBits( sizebuf_t *sb, void *pOutData, int nBits )
{ {
byte *pOut = (byte *)pOutData; byte *pOut = (byte *)pOutData;

2
engine/common/net_buffer.h

@ -84,7 +84,6 @@ void MSG_WriteSBitLong( sizebuf_t *sb, int data, int numbits );
void MSG_WriteBitLong( sizebuf_t *sb, uint data, int numbits, qboolean bSigned ); void MSG_WriteBitLong( sizebuf_t *sb, uint data, int numbits, qboolean bSigned );
qboolean MSG_WriteBits( sizebuf_t *sb, const void *pData, int nBits ); qboolean MSG_WriteBits( sizebuf_t *sb, const void *pData, int nBits );
void MSG_WriteBitAngle( sizebuf_t *sb, float fAngle, int numbits ); void MSG_WriteBitAngle( sizebuf_t *sb, float fAngle, int numbits );
void MSG_WriteBitFloat( sizebuf_t *sb, float val );
// Byte-write functions // Byte-write functions
#define MSG_BeginServerCmd( sb, cmd ) MSG_WriteCmdExt( sb, cmd, NS_SERVER, NULL ) #define MSG_BeginServerCmd( sb, cmd ) MSG_WriteCmdExt( sb, cmd, NS_SERVER, NULL )
@ -117,7 +116,6 @@ _inline byte *MSG_GetBuf( sizebuf_t *sb ) { return sb->pData; } // just an alias
// Bit-read functions // Bit-read functions
int MSG_ReadOneBit( sizebuf_t *sb ); int MSG_ReadOneBit( sizebuf_t *sb );
float MSG_ReadBitFloat( sizebuf_t *sb );
qboolean MSG_ReadBits( sizebuf_t *sb, void *pOutData, int nBits ); qboolean MSG_ReadBits( sizebuf_t *sb, void *pOutData, int nBits );
float MSG_ReadBitAngle( sizebuf_t *sb, int numbits ); float MSG_ReadBitAngle( sizebuf_t *sb, int numbits );
int MSG_ReadSBitLong( sizebuf_t *sb, int numbits ); int MSG_ReadSBitLong( sizebuf_t *sb, int numbits );

Loading…
Cancel
Save