Browse Source

engine, public: fix float precision issues in mathlib and monster navigation code

pull/2/head
Alibek Omarov 2 years ago
parent
commit
a2d11f670a
  1. 2
      engine/server/sv_move.c
  2. 8
      public/xash3d_mathlib.h

2
engine/server/sv_move.c

@ -243,7 +243,7 @@ float SV_VecToYaw( const vec3_t src )
} }
else else
{ {
yaw = (int)( atan2( src[1], src[0] ) * 180.0f / M_PI_F ); yaw = (int)( atan2( src[1], src[0] ) * 180.0 / M_PI );
if( yaw < 0 ) yaw += 360.0f; if( yaw < 0 ) yaw += 360.0f;
} }
return yaw; return yaw;

8
public/xash3d_mathlib.h

@ -34,18 +34,18 @@ GNU General Public License for more details.
#define ROLL 2 #define ROLL 2
#ifndef M_PI #ifndef M_PI
#define M_PI (float)3.14159265358979323846 #define M_PI (double)3.14159265358979323846
#endif #endif
#ifndef M_PI2 #ifndef M_PI2
#define M_PI2 ((float)(M_PI * 2)) #define M_PI2 ((double)(M_PI * 2))
#endif #endif
#define M_PI_F ((float)(M_PI)) #define M_PI_F ((float)(M_PI))
#define M_PI2_F ((float)(M_PI2)) #define M_PI2_F ((float)(M_PI2))
#define RAD2DEG( x ) ((float)(x) * (float)(180.f / M_PI_F)) #define RAD2DEG( x ) ((double)(x) * (double)(180.0 / M_PI))
#define DEG2RAD( x ) ((float)(x) * (float)(M_PI_F / 180.f)) #define DEG2RAD( x ) ((double)(x) * (double)(M_PI / 180.0))
#define NUMVERTEXNORMALS 162 #define NUMVERTEXNORMALS 162

Loading…
Cancel
Save