diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/g_utils.c | 2 | ||||
-rw-r--r-- | src/game/g_weapon.c | 2 | ||||
-rw-r--r-- | src/game/q_math.c | 11 | ||||
-rw-r--r-- | src/game/q_shared.h | 1 |
4 files changed, 14 insertions, 2 deletions
diff --git a/src/game/g_utils.c b/src/game/g_utils.c index fa4b5f23..1f4fa6df 100644 --- a/src/game/g_utils.c +++ b/src/game/g_utils.c @@ -987,7 +987,7 @@ gentity_t *G_ClosestEnt( vec3_t origin, gentity_t **entities, int numEntities ) { gentity_t *ent = entities[ i ]; - if( ( nd = VectorDistance( origin, ent->s.origin ) ) < d ) + if( ( nd = Distance( origin, ent->s.origin ) ) < d ) { d = nd; closestEnt = ent; diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index a28da78b..3f523071 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -1131,7 +1131,7 @@ void G_UpdateZaps( int msec ) source = zap->targets[ j - 1 ]; if( target->health <= 0 || !target->inuse || //early out - VectorDistance( source->s.origin, target->s.origin ) > LEVEL2_AREAZAP_RANGE ) + Distance( source->s.origin, target->s.origin ) > LEVEL2_AREAZAP_RANGE ) { target = zap->targets[ j ] = G_FindNewZapTarget( source ); diff --git a/src/game/q_math.c b/src/game/q_math.c index 78209fd1..83410479 100644 --- a/src/game/q_math.c +++ b/src/game/q_math.c @@ -1279,6 +1279,17 @@ void MatrixMultiply( float in1[ 3 ][ 3 ], float in2[ 3 ][ 3 ], float out[ 3 ][ 3 in1[ 2 ][ 2 ] * in2[ 2 ][ 2 ]; } +/* +================ +VectorMatrixMultiply +================ +*/ +void VectorMatrixMultiply( const vec3_t p, vec3_t m[ 3 ], vec3_t out ) +{ + out[ 0 ] = m[ 0 ][ 0 ] * p[ 0 ] + m[ 1 ][ 0 ] * p[ 1 ] + m[ 2 ][ 0 ] * p[ 2 ]; + out[ 1 ] = m[ 0 ][ 1 ] * p[ 0 ] + m[ 1 ][ 1 ] * p[ 1 ] + m[ 2 ][ 1 ] * p[ 2 ]; + out[ 2 ] = m[ 0 ][ 2 ] * p[ 0 ] + m[ 1 ][ 2 ] * p[ 1 ] + m[ 2 ][ 2 ] * p[ 2 ]; +} void AngleVectors( const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up) { diff --git a/src/game/q_shared.h b/src/game/q_shared.h index e9c09c48..6b1c8932 100644 --- a/src/game/q_shared.h +++ b/src/game/q_shared.h @@ -771,6 +771,7 @@ void MakeNormalVectors( const vec3_t forward, vec3_t right, vec3_t up ); //int PlaneTypeForNormal (vec3_t normal); void MatrixMultiply(float in1[3][3], float in2[3][3], float out[3][3]); +void VectorMatrixMultiply( const vec3_t p, vec3_t m[ 3 ], vec3_t out ); void AngleVectors( const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up); void PerpendicularVector( vec3_t dst, const vec3_t src ); |