Fix MSG_ReadDeltaKey setting bit 1<<bits often

MSG_ReadDeltaKey would often set 1<<bits, it should never be set. It exceeds the size of what was being read.
Worked okay for weapons/forward/right/up as they stored as chars (value would wrap around to correct value, lucky).
Angles had the wrong value, not sure if it was causing issues.
This commit is contained in:
Zack Middleton 2013-02-01 22:07:52 -06:00
parent 517c65d85e
commit b4ad5a8411
1 changed files with 1 additions and 1 deletions

View File

@ -631,7 +631,7 @@ void MSG_WriteDeltaKey( msg_t *msg, int key, int oldV, int newV, int bits ) {
int MSG_ReadDeltaKey( msg_t *msg, int key, int oldV, int bits ) { int MSG_ReadDeltaKey( msg_t *msg, int key, int oldV, int bits ) {
if ( MSG_ReadBits( msg, 1 ) ) { if ( MSG_ReadBits( msg, 1 ) ) {
return MSG_ReadBits( msg, bits ) ^ (key & kbitmask[bits]); return MSG_ReadBits( msg, bits ) ^ (key & kbitmask[ bits - 1 ]);
} }
return oldV; return oldV;
} }