From: havoc Date: Fri, 17 Sep 2004 00:33:05 +0000 (+0000) Subject: use double precision for coord and angle conversions... might help with jerky camera... X-Git-Tag: xonotic-v0.1.0preview~5597 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=49726b0747795d38cc5ada6ec9d8d393716f1e20;p=xonotic%2Fdarkplaces.git use double precision for coord and angle conversions... might help with jerky camera in some mods? git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4509 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/common.c b/common.c index 587aa08c..6ec9282a 100644 --- a/common.c +++ b/common.c @@ -193,17 +193,17 @@ void MSG_WriteString (sizebuf_t *sb, const char *s) void MSG_WriteCoord13i (sizebuf_t *sb, float f) { if (f >= 0) - MSG_WriteShort (sb, (int)(f * 8.0f + 0.5f)); + MSG_WriteShort (sb, (int)(f * 8.0 + 0.5)); else - MSG_WriteShort (sb, (int)(f * 8.0f - 0.5f)); + MSG_WriteShort (sb, (int)(f * 8.0 - 0.5)); } void MSG_WriteCoord16i (sizebuf_t *sb, float f) { if (f >= 0) - MSG_WriteShort (sb, (int)(f + 0.5f)); + MSG_WriteShort (sb, (int)(f + 0.5)); else - MSG_WriteShort (sb, (int)(f - 0.5f)); + MSG_WriteShort (sb, (int)(f - 0.5)); } void MSG_WriteCoord32f (sizebuf_t *sb, float f) @@ -234,17 +234,17 @@ void MSG_WriteVector (sizebuf_t *sb, float *v, int protocol) void MSG_WriteAngle8i (sizebuf_t *sb, float f) { if (f >= 0) - MSG_WriteByte (sb, (int)(f*(256.0f/360.0f) + 0.5f) & 255); + MSG_WriteByte (sb, (int)(f*(256.0/360.0) + 0.5) & 255); else - MSG_WriteByte (sb, (int)(f*(256.0f/360.0f) - 0.5f) & 255); + MSG_WriteByte (sb, (int)(f*(256.0/360.0) - 0.5) & 255); } void MSG_WriteAngle16i (sizebuf_t *sb, float f) { if (f >= 0) - MSG_WriteShort (sb, (int)(f*(65536.0f/360.0f) + 0.5f) & 65535); + MSG_WriteShort (sb, (int)(f*(65536.0/360.0) + 0.5) & 65535); else - MSG_WriteShort (sb, (int)(f*(65536.0f/360.0f) - 0.5f) & 65535); + MSG_WriteShort (sb, (int)(f*(65536.0/360.0) - 0.5) & 65535); } void MSG_WriteAngle32f (sizebuf_t *sb, float f) @@ -363,7 +363,7 @@ int MSG_ReadBytes (int numbytes, unsigned char *out) float MSG_ReadCoord13i (void) { - return MSG_ReadLittleShort() * (1.0f/8.0f); + return MSG_ReadLittleShort() * (1.0/8.0); } float MSG_ReadCoord16i (void) @@ -398,12 +398,12 @@ void MSG_ReadVector (float *v, int protocol) // LordHavoc: round to nearest value, rather than rounding toward zero, fixes crosshair problem float MSG_ReadAngle8i (void) { - return MSG_ReadByte () * (360.0f/256.0f); + return MSG_ReadByte () * (360.0/256.0); } float MSG_ReadAngle16i (void) { - return MSG_ReadShort () * (360.0f/65536.0f); + return MSG_ReadShort () * (360.0/65536.0); } float MSG_ReadAngle32f (void)