X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=common.c;h=5c72b72f1dcbe51fe3b99574b9317234af0372ec;hb=14cd78c64d15dc040d555f5f92fd273f37f190bc;hp=6ec9282a00ed6a0c2ba648320d8acb704cb0b63c;hpb=3b91d0d83c47e66cdddae07dfad34c17b60f97c2;p=xonotic%2Fdarkplaces.git diff --git a/common.c b/common.c index 6ec9282a..5c72b72f 100644 --- a/common.c +++ b/common.c @@ -252,6 +252,13 @@ void MSG_WriteAngle32f (sizebuf_t *sb, float f) MSG_WriteFloat (sb, f); } +void MSG_WriteAngle (sizebuf_t *sb, float f, int protocol) +{ + if (protocol == PROTOCOL_DARKPLACES5) + MSG_WriteAngle16i (sb, f); + else + MSG_WriteAngle8i (sb, f); +} // // reading functions @@ -403,7 +410,7 @@ float MSG_ReadAngle8i (void) float MSG_ReadAngle16i (void) { - return MSG_ReadShort () * (360.0/65536.0); + return (unsigned short)MSG_ReadShort () * (360.0/65536.0); } float MSG_ReadAngle32f (void) @@ -411,6 +418,14 @@ float MSG_ReadAngle32f (void) return MSG_ReadFloat (); } +float MSG_ReadAngle (int protocol) +{ + if (protocol == PROTOCOL_DARKPLACES5) + return MSG_ReadAngle16i (); + else + return MSG_ReadAngle8i (); +} + //=========================================================================== @@ -504,7 +519,7 @@ void Com_HexDumpToConsole(const qbyte *data, int size) *cur++ = ' '; *cur++ = ' '; } - if ((j & 3) == 0) + if ((j & 3) == 3) *cur++ = ' '; } // print text