* Replaced a bunch of inline and __inline with ID_INLINE
* Replaced a bunch of __i386__ with id386 * General tidy up of asm preprocessor decisions * Removed C_ONLY from the dedicated server build
This commit is contained in:
parent
857a5e264e
commit
e4b7a04d5c
24 changed files with 506 additions and 795 deletions
|
@ -21,8 +21,15 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
*/
|
||||
//
|
||||
// q_math.c -- stateless support routines that are included in each code module
|
||||
#include "q_shared.h"
|
||||
|
||||
// Some of the vector functions are static inline in q_shared.h. q3asm
|
||||
// doesn't understand static functions though, so we only want them in
|
||||
// one file. That's what this is about.
|
||||
#ifdef Q3_VM
|
||||
#define __Q3_VM_MATH
|
||||
#endif
|
||||
|
||||
#include "q_shared.h"
|
||||
|
||||
vec3_t vec3_origin = {0,0,0};
|
||||
vec3_t axisDefault[3] = { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } };
|
||||
|
@ -153,63 +160,6 @@ float Q_crandom( int *seed ) {
|
|||
return 2.0 * ( Q_random( seed ) - 0.5 );
|
||||
}
|
||||
|
||||
#ifdef Q3_VM
|
||||
|
||||
int VectorCompare( const vec3_t v1, const vec3_t v2 ) {
|
||||
if (v1[0] != v2[0] || v1[1] != v2[1] || v1[2] != v2[2]) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
vec_t VectorLength( const vec3_t v ) {
|
||||
return (vec_t)sqrt (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
|
||||
}
|
||||
|
||||
vec_t VectorLengthSquared( const vec3_t v ) {
|
||||
return (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
|
||||
}
|
||||
|
||||
vec_t Distance( const vec3_t p1, const vec3_t p2 ) {
|
||||
vec3_t v;
|
||||
|
||||
VectorSubtract (p2, p1, v);
|
||||
return VectorLength( v );
|
||||
}
|
||||
|
||||
vec_t DistanceSquared( const vec3_t p1, const vec3_t p2 ) {
|
||||
vec3_t v;
|
||||
|
||||
VectorSubtract (p2, p1, v);
|
||||
return v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
|
||||
}
|
||||
|
||||
// fast vector normalize routine that does not check to make sure
|
||||
// that length != 0, nor does it return length, uses rsqrt approximation
|
||||
void VectorNormalizeFast( vec3_t v )
|
||||
{
|
||||
float ilength;
|
||||
|
||||
ilength = Q_rsqrt( DotProduct( v, v ) );
|
||||
|
||||
v[0] *= ilength;
|
||||
v[1] *= ilength;
|
||||
v[2] *= ilength;
|
||||
}
|
||||
|
||||
void VectorInverse( vec3_t v ){
|
||||
v[0] = -v[0];
|
||||
v[1] = -v[1];
|
||||
v[2] = -v[2];
|
||||
}
|
||||
|
||||
void CrossProduct( const vec3_t v1, const vec3_t v2, vec3_t cross ) {
|
||||
cross[0] = v1[1]*v2[2] - v1[2]*v2[1];
|
||||
cross[1] = v1[2]*v2[0] - v1[0]*v2[2];
|
||||
cross[2] = v1[0]*v2[1] - v1[1]*v2[0];
|
||||
}
|
||||
#endif
|
||||
|
||||
//=======================================================
|
||||
|
||||
signed char ClampChar( int i ) {
|
||||
|
@ -736,10 +686,7 @@ int BoxOnPlaneSide2 (vec3_t emins, vec3_t emaxs, struct cplane_s *p)
|
|||
==================
|
||||
*/
|
||||
|
||||
// if not GNU x86 and configured to use asm
|
||||
#if !( (defined __GNUC__) && (defined __i386__) && (!defined C_ONLY))
|
||||
|
||||
#if defined Q3_VM || defined C_ONLY || !id386 || defined __VECTORC
|
||||
#if !id386
|
||||
|
||||
int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *p)
|
||||
{
|
||||
|
@ -804,6 +751,8 @@ int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *p)
|
|||
|
||||
return sides;
|
||||
}
|
||||
#elif __GNUC__
|
||||
// use matha.s
|
||||
#else
|
||||
#pragma warning( disable: 4035 )
|
||||
|
||||
|
@ -1038,7 +987,6 @@ Lerror:
|
|||
}
|
||||
#pragma warning( default: 4035 )
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue