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

This commit is contained in:
Alibek Omarov 2022-07-13 19:20:43 +03:00
parent 5bf6f814ef
commit a2d11f670a
2 changed files with 5 additions and 5 deletions

View File

@ -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;

View File

@ -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