Clean up Q_ftol() for Linux porting in DLL sources.

This commit is contained in:
Knightmare66 2021-10-11 22:02:12 -04:00
parent fa0f460482
commit 4635d4a5b8
11 changed files with 69 additions and 34 deletions

View file

@ -244,7 +244,7 @@ float Q_fabs (float f)
#if defined _M_IX86 && !defined C_ONLY
#pragma warning (disable:4035)
__declspec( naked ) long Q_ftol( float f )
__declspec( naked ) int Q_ftol (float f)
{
static int tmp;
__asm fld dword ptr [esp+4]
@ -253,6 +253,11 @@ __declspec( naked ) long Q_ftol( float f )
__asm ret
}
#pragma warning (default:4035)
#else
int Q_ftol (float f)
{
return (int)f;
}
#endif
/*

View file

@ -192,11 +192,14 @@ extern vec3_t vec3_origin;
// microsoft's fabs seems to be ungodly slow...
//float Q_fabs (float f);
//#define fabs(f) Q_fabs(f)
#if !defined C_ONLY
extern long Q_ftol( float f );
#else
#define Q_ftol( f ) ( long ) (f)
#endif
//#if !defined C_ONLY && !defined __linux__ && !defined __sgi
// This used to be a macro, do NOT use this!
// We now use the declared function in a jump table elsewhere.
extern int Q_ftol (float f);
//#else
//#define Q_ftol( f ) ( long ) (f)
//#endif
#define DotProduct(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2])
#define VectorSubtract(a,b,c) (c[0]=a[0]-b[0],c[1]=a[1]-b[1],c[2]=a[2]-b[2])

View file

@ -248,7 +248,7 @@ float Q_fabs(float f)
#if defined _M_IX86 && !defined C_ONLY
#pragma warning (disable:4035)
__declspec( naked ) long Q_ftol( float f )
__declspec( naked ) int Q_ftol (float f)
{
static int tmp;
__asm fld dword ptr [esp+4]
@ -257,6 +257,11 @@ __declspec( naked ) long Q_ftol( float f )
__asm ret
}
#pragma warning (default:4035)
#else
int Q_ftol (float f)
{
return (int)f;
}
#endif
/*

View file

@ -226,11 +226,14 @@ extern vec3_t vec3_border;
// microsoft's fabs seems to be ungodly slow...
//float Q_fabs (float f);
//#define fabs(f) Q_fabs(f)
#if !defined C_ONLY && !defined __linux__ && !defined __sgi
extern long Q_ftol( float f );
#else
#define Q_ftol( f ) ( long ) (f)
#endif
//#if !defined C_ONLY && !defined __linux__ && !defined __sgi
// This used to be a macro, do NOT use this!
// We now use the declared function in a jump table elsewhere.
extern int Q_ftol (float f);
//#else
//#define Q_ftol( f ) ( long ) (f)
//#endif
#define DotProduct(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2])
#define VectorSubtract(a,b,c) (c[0]=a[0]-b[0],c[1]=a[1]-b[1],c[2]=a[2]-b[2])

View file

@ -306,7 +306,7 @@ float Q_fabs (float f)
#if defined _M_IX86 && !defined C_ONLY
#pragma warning (disable:4035)
__declspec( naked ) int Q_ftol( float f )
__declspec( naked ) int Q_ftol (float f)
{
static int tmp;
__asm fld dword ptr [esp+4]
@ -315,9 +315,9 @@ __declspec( naked ) int Q_ftol( float f )
__asm ret
}
#pragma warning (default:4035)
//#else
#elif !defined(Q_ftol)
int Q_ftol( float f )
//#elif !defined(Q_ftol)
#else
int Q_ftol (float f)
{
return (int)f;
}

View file

@ -310,11 +310,14 @@ extern vec4_t vec4_origin;
// microsoft's fabs seems to be ungodly slow...
//float Q_fabs (float f);
//#define fabs(f) Q_fabs(f)
#if !defined C_ONLY && !defined __linux__ && !defined __sgi
extern int Q_ftol( float f );
#else
#define Q_ftol( f ) ( long ) (f)
#endif
//#if !defined C_ONLY && !defined __linux__ && !defined __sgi
// This used to be a macro, do NOT use this!
// We now use the declared function in a jump table elsewhere.
extern int Q_ftol (float f);
//#else
//#define Q_ftol( f ) ( long ) (f)
//#endif
#define DotProduct(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2])
#define VectorSubtract(a,b,c) (c[0]=a[0]-b[0],c[1]=a[1]-b[1],c[2]=a[2]-b[2])

View file

@ -242,7 +242,7 @@ float Q_fabs (float f)
#if defined _M_IX86 && !defined C_ONLY
#pragma warning (disable:4035)
__declspec( naked ) long Q_ftol( float f )
__declspec( naked ) int Q_ftol (float f)
{
static int tmp;
__asm fld dword ptr [esp+4]
@ -251,6 +251,11 @@ __declspec( naked ) long Q_ftol( float f )
__asm ret
}
#pragma warning (default:4035)
#else
int Q_ftol (float f)
{
return (int)f;
}
#endif
/*

View file

@ -229,11 +229,14 @@ extern vec3_t vec3_origin;
// microsoft's fabs seems to be ungodly slow...
//float Q_fabs (float f);
//#define fabs(f) Q_fabs(f)
#if !defined C_ONLY && !defined __linux__ && !defined __sgi
extern long Q_ftol( float f );
#else
#define Q_ftol( f ) ( long ) (f)
#endif
//#if !defined C_ONLY && !defined __linux__ && !defined __sgi
// This used to be a macro, do NOT use this!
// We now use the declared function in a jump table elsewhere.
extern int Q_ftol (float f);
//#else
//#define Q_ftol( f ) ( long ) (f)
//#endif
#define DotProduct(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2])
#define VectorSubtract(a,b,c) (c[0]=a[0]-b[0],c[1]=a[1]-b[1],c[2]=a[2]-b[2])

View file

@ -385,7 +385,7 @@ void ( APIENTRY * qglVertexPointer )(GLint size, GLenum type, GLsizei stride, co
void ( APIENTRY * qglViewport )(GLint x, GLint y, GLsizei width, GLsizei height);
// Knightmare added
void ( APIENTRY * qglDrawRangeElementsEXT)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
void ( APIENTRY * qglDrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
void ( APIENTRY * qglLockArraysEXT)( int, int);
void ( APIENTRY * qglUnlockArraysEXT) ( void );

View file

@ -244,7 +244,7 @@ float Q_fabs (float f)
#if defined _M_IX86 && !defined C_ONLY
#pragma warning (disable:4035)
__declspec( naked ) long Q_ftol( float f )
__declspec( naked ) int Q_ftol (float f)
{
static int tmp;
__asm fld dword ptr [esp+4]
@ -253,6 +253,11 @@ __declspec( naked ) long Q_ftol( float f )
__asm ret
}
#pragma warning (default:4035)
#else
int Q_ftol (float f)
{
return (int)f;
}
#endif
/*

View file

@ -187,11 +187,14 @@ extern vec3_t vec3_origin;
// microsoft's fabs seems to be ungodly slow...
//float Q_fabs (float f);
//#define fabs(f) Q_fabs(f)
#if !defined C_ONLY
extern long Q_ftol( float f );
#else
#define Q_ftol( f ) ( long ) (f)
#endif
//#if !defined C_ONLY && !defined __linux__ && !defined __sgi
// This used to be a macro, do NOT use this!
// We now use the declared function in a jump table elsewhere.
extern int Q_ftol (float f);
//#else
//#define Q_ftol( f ) ( long ) (f)
//#endif
#define DotProduct(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2])
#define VectorSubtract(a,b,c) (c[0]=a[0]-b[0],c[1]=a[1]-b[1],c[2]=a[2]-b[2])