engine: fix signed integers encoding with alternate format for GoldSrc protocol
This commit is contained in:
parent
60ab13d216
commit
0b2cc066dd
1 changed files with 12 additions and 14 deletions
|
@ -213,27 +213,25 @@ void MSG_WriteSBitLong( sizebuf_t *sb, int data, int numbits )
|
|||
// do we have a valid # of bits to encode with?
|
||||
Assert( numbits >= 1 && numbits <= 32 );
|
||||
|
||||
if( sb->iAlternateSign )
|
||||
{
|
||||
MSG_WriteOneBit( sb, data < 0 ? 1 : 0 );
|
||||
MSG_WriteUBitLong( sb, (uint)abs( data ), numbits - 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( data < 0 )
|
||||
{
|
||||
if( sb->iAlternateSign )
|
||||
MSG_WriteOneBit( sb, 1 );
|
||||
|
||||
MSG_WriteUBitLong( sb, (uint)( 0x80000000 + data ), numbits - 1 );
|
||||
|
||||
if( !sb->iAlternateSign )
|
||||
MSG_WriteOneBit( sb, 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( sb->iAlternateSign )
|
||||
MSG_WriteOneBit( sb, 0 );
|
||||
|
||||
MSG_WriteUBitLong( sb, (uint)data, numbits - 1 );
|
||||
|
||||
if( !sb->iAlternateSign )
|
||||
MSG_WriteOneBit( sb, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MSG_WriteBitLong( sizebuf_t *sb, uint data, int numbits, qboolean bSigned )
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue