This is an automated email from the git hooks/post-receive script. smcv pushed a commit to annotated tag 1.42d in repository iortcw.
commit d49d4bef96ed0e67cf4716f4c674d0e83134fdd9 Author: [email protected] <[email protected]@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a> Date: Mon Sep 1 01:28:49 2014 +0000 All: Fix some clang warnings --- MP/code/botlib/be_aas_route.c | 25 +------- MP/code/botlib/be_aas_routetable.c | 9 ++- MP/code/client/cl_avi.c | 2 + MP/code/game/g_mover.c | 8 +-- MP/code/game/g_weapon.c | 4 ++ MP/code/rend2/tr_animation.c | 127 ------------------------------------- MP/code/renderer/tr_animation.c | 127 ------------------------------------- SP/code/botlib/be_aas_route.c | 30 ++------- SP/code/botlib/be_aas_routetable.c | 9 ++- SP/code/client/cl_avi.c | 2 + SP/code/game/g_weapon.c | 2 +- SP/code/rend2/tr_animation.c | 127 ------------------------------------- SP/code/renderer/tr_animation.c | 127 ------------------------------------- 13 files changed, 34 insertions(+), 565 deletions(-) diff --git a/MP/code/botlib/be_aas_route.c b/MP/code/botlib/be_aas_route.c index d95dbaf..c94bc6a 100644 --- a/MP/code/botlib/be_aas_route.c +++ b/MP/code/botlib/be_aas_route.c @@ -51,6 +51,8 @@ If you have questions concerning this license or the applicable additional terms #include "be_interface.h" #include "be_aas_def.h" +#define LL(x) x=LittleLong(x) + #define ROUTING_DEBUG //travel time in hundreths of a second = distance * 100 / speed @@ -1010,7 +1012,7 @@ aas_routingcache_t *AAS_ReadCache( fileHandle_t fp ) { unsigned char *cache_reachabilities; botimport.FS_Read( &size, sizeof( size ), fp ); - size = LittleLong( size ); + LL( size ); cache = (aas_routingcache_32_t *) AAS_RoutingGetMemory( size ); cache->size = size; botimport.FS_Read( (unsigned char *)cache + sizeof( size ), size - sizeof( size ), fp ); @@ -1244,27 +1246,6 @@ void AAS_FreeRoutingCaches( void ) { ( *aasworld ).areawaypoints = NULL; } //end of the function AAS_FreeRoutingCaches //=========================================================================== -// this function could be replaced by a bubble sort or for even faster -// routing by a B+ tree -// -// Parameter: - -// Returns: - -// Changes Globals: - -//=========================================================================== -static ID_INLINE void AAS_AddUpdateToList( aas_routingupdate_t **updateliststart, - aas_routingupdate_t **updatelistend, - aas_routingupdate_t *update ) { - if ( !update->inlist ) { - if ( *updatelistend ) { - ( *updatelistend )->next = update; - } else { *updateliststart = update;} - update->prev = *updatelistend; - update->next = NULL; - *updatelistend = update; - update->inlist = qtrue; - } //end if -} //end of the function AAS_AddUpdateToList -//=========================================================================== // // Parameter: - // Returns: - diff --git a/MP/code/botlib/be_aas_routetable.c b/MP/code/botlib/be_aas_routetable.c index ae50487..345bf8d 100644 --- a/MP/code/botlib/be_aas_routetable.c +++ b/MP/code/botlib/be_aas_routetable.c @@ -47,6 +47,9 @@ If you have questions concerning this license or the applicable additional terms #include "be_interface.h" #include "be_aas_def.h" +#define LL(x) x=LittleLong(x) +#define LS(x) x=LittleShort(x) + // ugly hack to turn off route-tables, can't find a way to check cvar's int disable_routetable = 0; @@ -339,7 +342,7 @@ qboolean AAS_RT_ReadRouteTable( fileHandle_t fp ) { // check ident AAS_RT_DBG_Read( &ident, sizeof( ident ), fp ); - ident = LittleLong( ident ); + LL( ident ); if ( ident != RTBID ) { AAS_Error( "File is not an RTB file\n" ); @@ -349,7 +352,7 @@ qboolean AAS_RT_ReadRouteTable( fileHandle_t fp ) { // check version AAS_RT_DBG_Read( &version, sizeof( version ), fp ); - version = LittleLong( version ); + LL( version ); if ( version != RTBVERSION ) { AAS_Error( "File is version %i not %i\n", version, RTBVERSION ); @@ -359,7 +362,7 @@ qboolean AAS_RT_ReadRouteTable( fileHandle_t fp ) { // read the CRC check on the AAS data AAS_RT_DBG_Read( &crc, sizeof( crc ), fp ); - crc = LittleShort( crc ); + LS( crc ); // calculate a CRC on the AAS areas crc_aas = CRC_ProcessString( (unsigned char *)( *aasworld ).areas, sizeof( aas_area_t ) * ( *aasworld ).numareas ); diff --git a/MP/code/client/cl_avi.c b/MP/code/client/cl_avi.c index 0fcc1cc..27a4c50 100644 --- a/MP/code/client/cl_avi.c +++ b/MP/code/client/cl_avi.c @@ -126,10 +126,12 @@ static ID_INLINE void WRITE_2BYTES( int x ) { WRITE_1BYTES =============== */ +#if 0 static ID_INLINE void WRITE_1BYTES( int x ) { buffer[ bufIndex ] = x; bufIndex += 1; } +#endif /* =============== diff --git a/MP/code/game/g_mover.c b/MP/code/game/g_mover.c index c9abcc5..cfb94ba 100644 --- a/MP/code/game/g_mover.c +++ b/MP/code/game/g_mover.c @@ -3067,7 +3067,7 @@ radius = maximum distance from center of entity to place each bat (default=32) speed = speed to travel to next waypoint (default=300) */ void FuncBatsReached( gentity_t *self ) { - if ( !self->active ) { + if ( self->active == 2 ) { self->nextthink = -1; self->think = 0; return; @@ -3080,7 +3080,7 @@ void FuncBatsReached( gentity_t *self ) { self->r.contents = 0; if ( !self->nextTrain || !self->nextTrain->target ) { - self->active = qfalse; // remove the bats at next point + self->active = 2; // remove the bats at next point return; } } @@ -3127,7 +3127,7 @@ void BatMoveThink( gentity_t *bat ) { } } - } else if ( !owner->active ) { + } else if ( owner->active == 2 ) { // owner has finished G_FreeEntity( bat ); return; @@ -3189,7 +3189,7 @@ void FuncBatsActivate( gentity_t *self, gentity_t * other, gentity_t * activator self->use = FuncBatsActivate; // make sure this stays the same } else { // second use kills bats - self->active = qfalse; + self->active = 2; } } diff --git a/MP/code/game/g_weapon.c b/MP/code/game/g_weapon.c index 46cae41..2ee6e17 100644 --- a/MP/code/game/g_weapon.c +++ b/MP/code/game/g_weapon.c @@ -1060,6 +1060,10 @@ trace_t *CheckMeleeAttack( gentity_t *ent, float dist, qboolean isTest ) { return NULL; } + if ( ent->client->noclip ) { + return NULL; + } + traceEnt = &g_entities[ tr.entityNum ]; // send blood impact diff --git a/MP/code/rend2/tr_animation.c b/MP/code/rend2/tr_animation.c index 0d6faca..e65a53e 100644 --- a/MP/code/rend2/tr_animation.c +++ b/MP/code/rend2/tr_animation.c @@ -396,48 +396,18 @@ static ID_INLINE void LocalMatrixTransformVector( vec3_t in, vec3_t mat[ 3 ], ve out[ 2 ] = in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ]; } -static ID_INLINE void LocalMatrixTransformVectorTranslate( vec3_t in, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) { - out[ 0 ] = in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] + tr[ 0 ]; - out[ 1 ] = in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] + tr[ 1 ]; - out[ 2 ] = in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] + tr[ 2 ]; -} - static ID_INLINE void LocalScaledMatrixTransformVector( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t out ) { out[ 0 ] = ( 1.0f - s ) * in[ 0 ] + s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] ); out[ 1 ] = ( 1.0f - s ) * in[ 1 ] + s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] ); out[ 2 ] = ( 1.0f - s ) * in[ 2 ] + s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] ); } -static ID_INLINE void LocalScaledMatrixTransformVectorTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) { - out[ 0 ] = ( 1.0f - s ) * in[ 0 ] + s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] + tr[ 0 ] ); - out[ 1 ] = ( 1.0f - s ) * in[ 1 ] + s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] + tr[ 1 ] ); - out[ 2 ] = ( 1.0f - s ) * in[ 2 ] + s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] + tr[ 2 ] ); -} - -static ID_INLINE void LocalScaledMatrixTransformVectorFullTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) { - out[ 0 ] = ( 1.0f - s ) * in[ 0 ] + s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] ) + tr[ 0 ]; - out[ 1 ] = ( 1.0f - s ) * in[ 1 ] + s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] ) + tr[ 1 ]; - out[ 2 ] = ( 1.0f - s ) * in[ 2 ] + s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] ) + tr[ 2 ]; -} - -static ID_INLINE void LocalAddScaledMatrixTransformVectorFullTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) { - out[ 0 ] += s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] ) + tr[ 0 ]; - out[ 1 ] += s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] ) + tr[ 1 ]; - out[ 2 ] += s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] ) + tr[ 2 ]; -} - static ID_INLINE void LocalAddScaledMatrixTransformVectorTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) { out[ 0 ] += s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] + tr[ 0 ] ); out[ 1 ] += s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] + tr[ 1 ] ); out[ 2 ] += s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] + tr[ 2 ] ); } -static ID_INLINE void LocalAddScaledMatrixTransformVector( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t out ) { - out[ 0 ] += s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] ); - out[ 1 ] += s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] ); - out[ 2 ] += s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] ); -} - static float LAVangle; static float sp, sy, cp, cy; //static float sr, cr;// TTimo: unused @@ -481,28 +451,6 @@ static ID_INLINE void SLerp_Normal( vec3_t from, vec3_t to, float tt, vec3_t out =============================================================================== */ -static ID_INLINE void Matrix4Multiply( const vec4_t a[4], const vec4_t b[4], vec4_t dst[4] ) { - dst[0][0] = a[0][0] * b[0][0] + a[0][1] * b[1][0] + a[0][2] * b[2][0] + a[0][3] * b[3][0]; - dst[0][1] = a[0][0] * b[0][1] + a[0][1] * b[1][1] + a[0][2] * b[2][1] + a[0][3] * b[3][1]; - dst[0][2] = a[0][0] * b[0][2] + a[0][1] * b[1][2] + a[0][2] * b[2][2] + a[0][3] * b[3][2]; - dst[0][3] = a[0][0] * b[0][3] + a[0][1] * b[1][3] + a[0][2] * b[2][3] + a[0][3] * b[3][3]; - - dst[1][0] = a[1][0] * b[0][0] + a[1][1] * b[1][0] + a[1][2] * b[2][0] + a[1][3] * b[3][0]; - dst[1][1] = a[1][0] * b[0][1] + a[1][1] * b[1][1] + a[1][2] * b[2][1] + a[1][3] * b[3][1]; - dst[1][2] = a[1][0] * b[0][2] + a[1][1] * b[1][2] + a[1][2] * b[2][2] + a[1][3] * b[3][2]; - dst[1][3] = a[1][0] * b[0][3] + a[1][1] * b[1][3] + a[1][2] * b[2][3] + a[1][3] * b[3][3]; - - dst[2][0] = a[2][0] * b[0][0] + a[2][1] * b[1][0] + a[2][2] * b[2][0] + a[2][3] * b[3][0]; - dst[2][1] = a[2][0] * b[0][1] + a[2][1] * b[1][1] + a[2][2] * b[2][1] + a[2][3] * b[3][1]; - dst[2][2] = a[2][0] * b[0][2] + a[2][1] * b[1][2] + a[2][2] * b[2][2] + a[2][3] * b[3][2]; - dst[2][3] = a[2][0] * b[0][3] + a[2][1] * b[1][3] + a[2][2] * b[2][3] + a[2][3] * b[3][3]; - - dst[3][0] = a[3][0] * b[0][0] + a[3][1] * b[1][0] + a[3][2] * b[2][0] + a[3][3] * b[3][0]; - dst[3][1] = a[3][0] * b[0][1] + a[3][1] * b[1][1] + a[3][2] * b[2][1] + a[3][3] * b[3][1]; - dst[3][2] = a[3][0] * b[0][2] + a[3][1] * b[1][2] + a[3][2] * b[2][2] + a[3][3] * b[3][2]; - dst[3][3] = a[3][0] * b[0][3] + a[3][1] * b[1][3] + a[3][2] * b[2][3] + a[3][3] * b[3][3]; -} - // TTimo: const usage would require an explicit cast, non ANSI C // see unix/const-arg.c static ID_INLINE void Matrix4MultiplyInto3x3AndTranslation( /*const*/ vec4_t a[4], /*const*/ vec4_t b[4], vec3_t dst[3], vec3_t t ) { @@ -522,60 +470,6 @@ static ID_INLINE void Matrix4MultiplyInto3x3AndTranslation( /*const*/ vec4_t a[4 t[2] = a[2][0] * b[0][3] + a[2][1] * b[1][3] + a[2][2] * b[2][3] + a[2][3] * b[3][3]; } -static ID_INLINE void Matrix4Transpose( const vec4_t matrix[4], vec4_t transpose[4] ) { - int i, j; - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 4; j++ ) { - transpose[i][j] = matrix[j][i]; - } - } -} - -static ID_INLINE void Matrix4FromAxis( const vec3_t axis[3], vec4_t dst[4] ) { - int i, j; - for ( i = 0; i < 3; i++ ) { - for ( j = 0; j < 3; j++ ) { - dst[i][j] = axis[i][j]; - } - dst[3][i] = 0; - dst[i][3] = 0; - } - dst[3][3] = 1; -} - -static ID_INLINE void Matrix4FromScaledAxis( const vec3_t axis[3], const float scale, vec4_t dst[4] ) { - int i, j; - - for ( i = 0; i < 3; i++ ) { - for ( j = 0; j < 3; j++ ) { - dst[i][j] = scale * axis[i][j]; - if ( i == j ) { - dst[i][j] += 1.0f - scale; - } - } - dst[3][i] = 0; - dst[i][3] = 0; - } - dst[3][3] = 1; -} - -static ID_INLINE void Matrix4FromTranslation( const vec3_t t, vec4_t dst[4] ) { - int i, j; - - for ( i = 0; i < 3; i++ ) { - for ( j = 0; j < 3; j++ ) { - if ( i == j ) { - dst[i][j] = 1; - } else { - dst[i][j] = 0; - } - } - dst[i][3] = t[i]; - dst[3][i] = 0; - } - dst[3][3] = 1; -} - // can put an axis rotation followed by a translation directly into one matrix // TTimo: const usage would require an explicit cast, non ANSI C // see unix/const-arg.c @@ -610,27 +504,6 @@ static ID_INLINE void Matrix4FromScaledAxisPlusTranslation( /*const*/ vec3_t axi dst[3][3] = 1; } -static ID_INLINE void Matrix4FromScale( const float scale, vec4_t dst[4] ) { - int i, j; - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 4; j++ ) { - if ( i == j ) { - dst[i][j] = scale; - } else { - dst[i][j] = 0; - } - } - } - dst[3][3] = 1; -} - -static ID_INLINE void Matrix4TransformVector( const vec4_t m[4], const vec3_t src, vec3_t dst ) { - dst[0] = m[0][0] * src[0] + m[0][1] * src[1] + m[0][2] * src[2] + m[0][3]; - dst[1] = m[1][0] * src[0] + m[1][1] * src[1] + m[1][2] * src[2] + m[1][3]; - dst[2] = m[2][0] * src[0] + m[2][1] * src[1] + m[2][2] * src[2] + m[2][3]; -} - /* =============================================================================== diff --git a/MP/code/renderer/tr_animation.c b/MP/code/renderer/tr_animation.c index fc8808f..a4ee895 100644 --- a/MP/code/renderer/tr_animation.c +++ b/MP/code/renderer/tr_animation.c @@ -394,48 +394,18 @@ static ID_INLINE void LocalMatrixTransformVector( vec3_t in, vec3_t mat[ 3 ], ve out[ 2 ] = in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ]; } -static ID_INLINE void LocalMatrixTransformVectorTranslate( vec3_t in, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) { - out[ 0 ] = in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] + tr[ 0 ]; - out[ 1 ] = in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] + tr[ 1 ]; - out[ 2 ] = in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] + tr[ 2 ]; -} - static ID_INLINE void LocalScaledMatrixTransformVector( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t out ) { out[ 0 ] = ( 1.0f - s ) * in[ 0 ] + s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] ); out[ 1 ] = ( 1.0f - s ) * in[ 1 ] + s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] ); out[ 2 ] = ( 1.0f - s ) * in[ 2 ] + s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] ); } -static ID_INLINE void LocalScaledMatrixTransformVectorTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) { - out[ 0 ] = ( 1.0f - s ) * in[ 0 ] + s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] + tr[ 0 ] ); - out[ 1 ] = ( 1.0f - s ) * in[ 1 ] + s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] + tr[ 1 ] ); - out[ 2 ] = ( 1.0f - s ) * in[ 2 ] + s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] + tr[ 2 ] ); -} - -static ID_INLINE void LocalScaledMatrixTransformVectorFullTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) { - out[ 0 ] = ( 1.0f - s ) * in[ 0 ] + s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] ) + tr[ 0 ]; - out[ 1 ] = ( 1.0f - s ) * in[ 1 ] + s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] ) + tr[ 1 ]; - out[ 2 ] = ( 1.0f - s ) * in[ 2 ] + s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] ) + tr[ 2 ]; -} - -static ID_INLINE void LocalAddScaledMatrixTransformVectorFullTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) { - out[ 0 ] += s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] ) + tr[ 0 ]; - out[ 1 ] += s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] ) + tr[ 1 ]; - out[ 2 ] += s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] ) + tr[ 2 ]; -} - static ID_INLINE void LocalAddScaledMatrixTransformVectorTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) { out[ 0 ] += s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] + tr[ 0 ] ); out[ 1 ] += s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] + tr[ 1 ] ); out[ 2 ] += s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] + tr[ 2 ] ); } -static ID_INLINE void LocalAddScaledMatrixTransformVector( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t out ) { - out[ 0 ] += s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] ); - out[ 1 ] += s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] ); - out[ 2 ] += s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] ); -} - static float LAVangle; static float sp, sy, cp, cy; //static float sr, cr;// TTimo: unused @@ -479,28 +449,6 @@ static ID_INLINE void SLerp_Normal( vec3_t from, vec3_t to, float tt, vec3_t out =============================================================================== */ -static ID_INLINE void Matrix4Multiply( const vec4_t a[4], const vec4_t b[4], vec4_t dst[4] ) { - dst[0][0] = a[0][0] * b[0][0] + a[0][1] * b[1][0] + a[0][2] * b[2][0] + a[0][3] * b[3][0]; - dst[0][1] = a[0][0] * b[0][1] + a[0][1] * b[1][1] + a[0][2] * b[2][1] + a[0][3] * b[3][1]; - dst[0][2] = a[0][0] * b[0][2] + a[0][1] * b[1][2] + a[0][2] * b[2][2] + a[0][3] * b[3][2]; - dst[0][3] = a[0][0] * b[0][3] + a[0][1] * b[1][3] + a[0][2] * b[2][3] + a[0][3] * b[3][3]; - - dst[1][0] = a[1][0] * b[0][0] + a[1][1] * b[1][0] + a[1][2] * b[2][0] + a[1][3] * b[3][0]; - dst[1][1] = a[1][0] * b[0][1] + a[1][1] * b[1][1] + a[1][2] * b[2][1] + a[1][3] * b[3][1]; - dst[1][2] = a[1][0] * b[0][2] + a[1][1] * b[1][2] + a[1][2] * b[2][2] + a[1][3] * b[3][2]; - dst[1][3] = a[1][0] * b[0][3] + a[1][1] * b[1][3] + a[1][2] * b[2][3] + a[1][3] * b[3][3]; - - dst[2][0] = a[2][0] * b[0][0] + a[2][1] * b[1][0] + a[2][2] * b[2][0] + a[2][3] * b[3][0]; - dst[2][1] = a[2][0] * b[0][1] + a[2][1] * b[1][1] + a[2][2] * b[2][1] + a[2][3] * b[3][1]; - dst[2][2] = a[2][0] * b[0][2] + a[2][1] * b[1][2] + a[2][2] * b[2][2] + a[2][3] * b[3][2]; - dst[2][3] = a[2][0] * b[0][3] + a[2][1] * b[1][3] + a[2][2] * b[2][3] + a[2][3] * b[3][3]; - - dst[3][0] = a[3][0] * b[0][0] + a[3][1] * b[1][0] + a[3][2] * b[2][0] + a[3][3] * b[3][0]; - dst[3][1] = a[3][0] * b[0][1] + a[3][1] * b[1][1] + a[3][2] * b[2][1] + a[3][3] * b[3][1]; - dst[3][2] = a[3][0] * b[0][2] + a[3][1] * b[1][2] + a[3][2] * b[2][2] + a[3][3] * b[3][2]; - dst[3][3] = a[3][0] * b[0][3] + a[3][1] * b[1][3] + a[3][2] * b[2][3] + a[3][3] * b[3][3]; -} - // TTimo: const usage would require an explicit cast, non ANSI C // see unix/const-arg.c static ID_INLINE void Matrix4MultiplyInto3x3AndTranslation( /*const*/ vec4_t a[4], /*const*/ vec4_t b[4], vec3_t dst[3], vec3_t t ) { @@ -520,60 +468,6 @@ static ID_INLINE void Matrix4MultiplyInto3x3AndTranslation( /*const*/ vec4_t a[4 t[2] = a[2][0] * b[0][3] + a[2][1] * b[1][3] + a[2][2] * b[2][3] + a[2][3] * b[3][3]; } -static ID_INLINE void Matrix4Transpose( const vec4_t matrix[4], vec4_t transpose[4] ) { - int i, j; - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 4; j++ ) { - transpose[i][j] = matrix[j][i]; - } - } -} - -static ID_INLINE void Matrix4FromAxis( const vec3_t axis[3], vec4_t dst[4] ) { - int i, j; - for ( i = 0; i < 3; i++ ) { - for ( j = 0; j < 3; j++ ) { - dst[i][j] = axis[i][j]; - } - dst[3][i] = 0; - dst[i][3] = 0; - } - dst[3][3] = 1; -} - -static ID_INLINE void Matrix4FromScaledAxis( const vec3_t axis[3], const float scale, vec4_t dst[4] ) { - int i, j; - - for ( i = 0; i < 3; i++ ) { - for ( j = 0; j < 3; j++ ) { - dst[i][j] = scale * axis[i][j]; - if ( i == j ) { - dst[i][j] += 1.0f - scale; - } - } - dst[3][i] = 0; - dst[i][3] = 0; - } - dst[3][3] = 1; -} - -static ID_INLINE void Matrix4FromTranslation( const vec3_t t, vec4_t dst[4] ) { - int i, j; - - for ( i = 0; i < 3; i++ ) { - for ( j = 0; j < 3; j++ ) { - if ( i == j ) { - dst[i][j] = 1; - } else { - dst[i][j] = 0; - } - } - dst[i][3] = t[i]; - dst[3][i] = 0; - } - dst[3][3] = 1; -} - // can put an axis rotation followed by a translation directly into one matrix // TTimo: const usage would require an explicit cast, non ANSI C // see unix/const-arg.c @@ -608,27 +502,6 @@ static ID_INLINE void Matrix4FromScaledAxisPlusTranslation( /*const*/ vec3_t axi dst[3][3] = 1; } -static ID_INLINE void Matrix4FromScale( const float scale, vec4_t dst[4] ) { - int i, j; - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 4; j++ ) { - if ( i == j ) { - dst[i][j] = scale; - } else { - dst[i][j] = 0; - } - } - } - dst[3][3] = 1; -} - -static ID_INLINE void Matrix4TransformVector( const vec4_t m[4], const vec3_t src, vec3_t dst ) { - dst[0] = m[0][0] * src[0] + m[0][1] * src[1] + m[0][2] * src[2] + m[0][3]; - dst[1] = m[1][0] * src[0] + m[1][1] * src[1] + m[1][2] * src[2] + m[1][3]; - dst[2] = m[2][0] * src[0] + m[2][1] * src[1] + m[2][2] * src[2] + m[2][3]; -} - /* =============================================================================== diff --git a/SP/code/botlib/be_aas_route.c b/SP/code/botlib/be_aas_route.c index 7f6cebf..fd90d7b 100644 --- a/SP/code/botlib/be_aas_route.c +++ b/SP/code/botlib/be_aas_route.c @@ -53,6 +53,8 @@ If you have questions concerning this license or the applicable additional terms #define ROUTING_DEBUG +#define LL(x) x=LittleLong(x) + //travel time in hundreths of a second = distance * 100 / speed #define DISTANCEFACTOR_CROUCH 1.3 //crouch speed = 100 #define DISTANCEFACTOR_SWIM 1 //should be 0.66, swim speed = 150 @@ -1011,7 +1013,7 @@ aas_routingcache_t *AAS_ReadCache( fileHandle_t fp ) { unsigned char *cache_reachabilities; botimport.FS_Read( &size, sizeof( size ), fp ); - size = LittleLong( size ); + LL( size ); cache = (aas_routingcache_32_t *) AAS_RoutingGetMemory( size ); cache->size = size; botimport.FS_Read( (unsigned char *)cache + sizeof( size ), size - sizeof( size ), fp ); @@ -1111,7 +1113,8 @@ int AAS_ReadRouteCache( void ) { //AAS_Error("route cache dump has wrong number of clusters\n"); return qfalse; } //end if -#ifdef _WIN32 // crc code is only good on intel machines +#ifdef _WIN32 + // crc code is only good on intel machines if ( routecacheheader.areacrc != CRC_ProcessString( (unsigned char *)( *aasworld ).areas, sizeof( aas_area_t ) * ( *aasworld ).numareas ) ) { botimport.FS_FCloseFile( fp ); @@ -1160,7 +1163,7 @@ int AAS_ReadRouteCache( void ) { for ( i = 0; i < ( *aasworld ).numareas; i++ ) { botimport.FS_Read( &size, sizeof( size ), fp ); - size = LittleLong( size ); + LL( size ); if ( size ) { ( *aasworld ).areavisibility[i] = (byte *) GetMemory( size ); botimport.FS_Read( ( *aasworld ).areavisibility[i], size, fp ); @@ -1265,27 +1268,6 @@ void AAS_FreeRoutingCaches( void ) { ( *aasworld ).areawaypoints = NULL; } //end of the function AAS_FreeRoutingCaches //=========================================================================== -// this function could be replaced by a bubble sort or for even faster -// routing by a B+ tree -// -// Parameter: - -// Returns: - -// Changes Globals: - -//=========================================================================== -static ID_INLINE void AAS_AddUpdateToList( aas_routingupdate_t **updateliststart, - aas_routingupdate_t **updatelistend, - aas_routingupdate_t *update ) { - if ( !update->inlist ) { - if ( *updatelistend ) { - ( *updatelistend )->next = update; - } else { *updateliststart = update;} - update->prev = *updatelistend; - update->next = NULL; - *updatelistend = update; - update->inlist = qtrue; - } //end if -} //end of the function AAS_AddUpdateToList -//=========================================================================== // // Parameter: - // Returns: - diff --git a/SP/code/botlib/be_aas_routetable.c b/SP/code/botlib/be_aas_routetable.c index 392d104..dbeb920 100644 --- a/SP/code/botlib/be_aas_routetable.c +++ b/SP/code/botlib/be_aas_routetable.c @@ -47,6 +47,9 @@ If you have questions concerning this license or the applicable additional terms #include "be_interface.h" #include "be_aas_def.h" +#define LL(x) x=LittleLong(x) +#define LS(x) x=LittleShort(x) + // ugly hack to turn off route-tables, can't find a way to check cvar's int disable_routetable = 0; @@ -339,7 +342,7 @@ qboolean AAS_RT_ReadRouteTable( fileHandle_t fp ) { // check ident AAS_RT_DBG_Read( &ident, sizeof( ident ), fp ); - ident = LittleLong( ident ); + LL( ident ); if ( ident != RTBID ) { AAS_Error( "File is not an RTB file\n" ); @@ -349,7 +352,7 @@ qboolean AAS_RT_ReadRouteTable( fileHandle_t fp ) { // check version AAS_RT_DBG_Read( &version, sizeof( version ), fp ); - version = LittleLong( version ); + LL( version ); if ( version != RTBVERSION ) { AAS_Error( "File is version %i not %i\n", version, RTBVERSION ); @@ -359,7 +362,7 @@ qboolean AAS_RT_ReadRouteTable( fileHandle_t fp ) { // read the CRC check on the AAS data AAS_RT_DBG_Read( &crc, sizeof( crc ), fp ); - crc = LittleShort( crc ); + LS( crc ); // calculate a CRC on the AAS areas crc_aas = CRC_ProcessString( (unsigned char *)( *aasworld ).areas, sizeof( aas_area_t ) * ( *aasworld ).numareas ); diff --git a/SP/code/client/cl_avi.c b/SP/code/client/cl_avi.c index 0fcc1cc..27a4c50 100644 --- a/SP/code/client/cl_avi.c +++ b/SP/code/client/cl_avi.c @@ -126,10 +126,12 @@ static ID_INLINE void WRITE_2BYTES( int x ) { WRITE_1BYTES =============== */ +#if 0 static ID_INLINE void WRITE_1BYTES( int x ) { buffer[ bufIndex ] = x; bufIndex += 1; } +#endif /* =============== diff --git a/SP/code/game/g_weapon.c b/SP/code/game/g_weapon.c index 59e0c1d..e205775 100644 --- a/SP/code/game/g_weapon.c +++ b/SP/code/game/g_weapon.c @@ -483,7 +483,7 @@ trace_t *CheckMeleeAttack( gentity_t *ent, float dist, qboolean isTest ) { } if ( ent->client->noclip ) { - return qfalse; + return NULL; } traceEnt = &g_entities[ tr.entityNum ]; diff --git a/SP/code/rend2/tr_animation.c b/SP/code/rend2/tr_animation.c index 315d08e..6ed9c6f 100644 --- a/SP/code/rend2/tr_animation.c +++ b/SP/code/rend2/tr_animation.c @@ -417,48 +417,18 @@ static ID_INLINE void LocalMatrixTransformVector( vec3_t in, vec3_t mat[ 3 ], ve out[ 2 ] = in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ]; } -static ID_INLINE void LocalMatrixTransformVectorTranslate( vec3_t in, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) { - out[ 0 ] = in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] + tr[ 0 ]; - out[ 1 ] = in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] + tr[ 1 ]; - out[ 2 ] = in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] + tr[ 2 ]; -} - static ID_INLINE void LocalScaledMatrixTransformVector( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t out ) { out[ 0 ] = ( 1.0f - s ) * in[ 0 ] + s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] ); out[ 1 ] = ( 1.0f - s ) * in[ 1 ] + s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] ); out[ 2 ] = ( 1.0f - s ) * in[ 2 ] + s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] ); } -static ID_INLINE void LocalScaledMatrixTransformVectorTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) { - out[ 0 ] = ( 1.0f - s ) * in[ 0 ] + s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] + tr[ 0 ] ); - out[ 1 ] = ( 1.0f - s ) * in[ 1 ] + s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] + tr[ 1 ] ); - out[ 2 ] = ( 1.0f - s ) * in[ 2 ] + s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] + tr[ 2 ] ); -} - -static ID_INLINE void LocalScaledMatrixTransformVectorFullTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) { - out[ 0 ] = ( 1.0f - s ) * in[ 0 ] + s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] ) + tr[ 0 ]; - out[ 1 ] = ( 1.0f - s ) * in[ 1 ] + s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] ) + tr[ 1 ]; - out[ 2 ] = ( 1.0f - s ) * in[ 2 ] + s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] ) + tr[ 2 ]; -} - -static ID_INLINE void LocalAddScaledMatrixTransformVectorFullTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) { - out[ 0 ] += s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] ) + tr[ 0 ]; - out[ 1 ] += s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] ) + tr[ 1 ]; - out[ 2 ] += s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] ) + tr[ 2 ]; -} - static ID_INLINE void LocalAddScaledMatrixTransformVectorTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) { out[ 0 ] += s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] + tr[ 0 ] ); out[ 1 ] += s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] + tr[ 1 ] ); out[ 2 ] += s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] + tr[ 2 ] ); } -static ID_INLINE void LocalAddScaledMatrixTransformVector( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t out ) { - out[ 0 ] += s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] ); - out[ 1 ] += s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] ); - out[ 2 ] += s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] ); -} - static float LAVangle; //static float sr; // TTimo: unused static float sp, sy; @@ -504,28 +474,6 @@ static ID_INLINE void SLerp_Normal( vec3_t from, vec3_t to, float tt, vec3_t out =============================================================================== */ -static ID_INLINE void Matrix4Multiply( const vec4_t a[4], const vec4_t b[4], vec4_t dst[4] ) { - dst[0][0] = a[0][0] * b[0][0] + a[0][1] * b[1][0] + a[0][2] * b[2][0] + a[0][3] * b[3][0]; - dst[0][1] = a[0][0] * b[0][1] + a[0][1] * b[1][1] + a[0][2] * b[2][1] + a[0][3] * b[3][1]; - dst[0][2] = a[0][0] * b[0][2] + a[0][1] * b[1][2] + a[0][2] * b[2][2] + a[0][3] * b[3][2]; - dst[0][3] = a[0][0] * b[0][3] + a[0][1] * b[1][3] + a[0][2] * b[2][3] + a[0][3] * b[3][3]; - - dst[1][0] = a[1][0] * b[0][0] + a[1][1] * b[1][0] + a[1][2] * b[2][0] + a[1][3] * b[3][0]; - dst[1][1] = a[1][0] * b[0][1] + a[1][1] * b[1][1] + a[1][2] * b[2][1] + a[1][3] * b[3][1]; - dst[1][2] = a[1][0] * b[0][2] + a[1][1] * b[1][2] + a[1][2] * b[2][2] + a[1][3] * b[3][2]; - dst[1][3] = a[1][0] * b[0][3] + a[1][1] * b[1][3] + a[1][2] * b[2][3] + a[1][3] * b[3][3]; - - dst[2][0] = a[2][0] * b[0][0] + a[2][1] * b[1][0] + a[2][2] * b[2][0] + a[2][3] * b[3][0]; - dst[2][1] = a[2][0] * b[0][1] + a[2][1] * b[1][1] + a[2][2] * b[2][1] + a[2][3] * b[3][1]; - dst[2][2] = a[2][0] * b[0][2] + a[2][1] * b[1][2] + a[2][2] * b[2][2] + a[2][3] * b[3][2]; - dst[2][3] = a[2][0] * b[0][3] + a[2][1] * b[1][3] + a[2][2] * b[2][3] + a[2][3] * b[3][3]; - - dst[3][0] = a[3][0] * b[0][0] + a[3][1] * b[1][0] + a[3][2] * b[2][0] + a[3][3] * b[3][0]; - dst[3][1] = a[3][0] * b[0][1] + a[3][1] * b[1][1] + a[3][2] * b[2][1] + a[3][3] * b[3][1]; - dst[3][2] = a[3][0] * b[0][2] + a[3][1] * b[1][2] + a[3][2] * b[2][2] + a[3][3] * b[3][2]; - dst[3][3] = a[3][0] * b[0][3] + a[3][1] * b[1][3] + a[3][2] * b[2][3] + a[3][3] * b[3][3]; -} - // TTimo: const vec_t ** would require explicit casts for ANSI C conformance // see unix/const-arg.c in Wolf MP source static ID_INLINE void Matrix4MultiplyInto3x3AndTranslation( /*const*/ vec4_t a[4], /*const*/ vec4_t b[4], vec3_t dst[3], vec3_t t ) { @@ -545,60 +493,6 @@ static ID_INLINE void Matrix4MultiplyInto3x3AndTranslation( /*const*/ vec4_t a[4 t[2] = a[2][0] * b[0][3] + a[2][1] * b[1][3] + a[2][2] * b[2][3] + a[2][3] * b[3][3]; } -static ID_INLINE void Matrix4Transpose( const vec4_t matrix[4], vec4_t transpose[4] ) { - int i, j; - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 4; j++ ) { - transpose[i][j] = matrix[j][i]; - } - } -} - -static ID_INLINE void Matrix4FromAxis( const vec3_t axis[3], vec4_t dst[4] ) { - int i, j; - for ( i = 0; i < 3; i++ ) { - for ( j = 0; j < 3; j++ ) { - dst[i][j] = axis[i][j]; - } - dst[3][i] = 0; - dst[i][3] = 0; - } - dst[3][3] = 1; -} - -static ID_INLINE void Matrix4FromScaledAxis( const vec3_t axis[3], const float scale, vec4_t dst[4] ) { - int i, j; - - for ( i = 0; i < 3; i++ ) { - for ( j = 0; j < 3; j++ ) { - dst[i][j] = scale * axis[i][j]; - if ( i == j ) { - dst[i][j] += 1.0f - scale; - } - } - dst[3][i] = 0; - dst[i][3] = 0; - } - dst[3][3] = 1; -} - -static ID_INLINE void Matrix4FromTranslation( const vec3_t t, vec4_t dst[4] ) { - int i, j; - - for ( i = 0; i < 3; i++ ) { - for ( j = 0; j < 3; j++ ) { - if ( i == j ) { - dst[i][j] = 1; - } else { - dst[i][j] = 0; - } - } - dst[i][3] = t[i]; - dst[3][i] = 0; - } - dst[3][3] = 1; -} - // can put an axis rotation followed by a translation directly into one matrix // TTimo: const vec_t ** would require explicit casts for ANSI C conformance // see unix/const-arg.c in Wolf MP source @@ -633,27 +527,6 @@ static ID_INLINE void Matrix4FromScaledAxisPlusTranslation( /*const*/ vec3_t axi dst[3][3] = 1; } -static ID_INLINE void Matrix4FromScale( const float scale, vec4_t dst[4] ) { - int i, j; - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 4; j++ ) { - if ( i == j ) { - dst[i][j] = scale; - } else { - dst[i][j] = 0; - } - } - } - dst[3][3] = 1; -} - -static ID_INLINE void Matrix4TransformVector( const vec4_t m[4], const vec3_t src, vec3_t dst ) { - dst[0] = m[0][0] * src[0] + m[0][1] * src[1] + m[0][2] * src[2] + m[0][3]; - dst[1] = m[1][0] * src[0] + m[1][1] * src[1] + m[1][2] * src[2] + m[1][3]; - dst[2] = m[2][0] * src[0] + m[2][1] * src[1] + m[2][2] * src[2] + m[2][3]; -} - /* =============================================================================== diff --git a/SP/code/renderer/tr_animation.c b/SP/code/renderer/tr_animation.c index f0de5c7..91c3cd9 100644 --- a/SP/code/renderer/tr_animation.c +++ b/SP/code/renderer/tr_animation.c @@ -415,48 +415,18 @@ static ID_INLINE void LocalMatrixTransformVector( vec3_t in, vec3_t mat[ 3 ], ve out[ 2 ] = in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ]; } -static ID_INLINE void LocalMatrixTransformVectorTranslate( vec3_t in, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) { - out[ 0 ] = in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] + tr[ 0 ]; - out[ 1 ] = in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] + tr[ 1 ]; - out[ 2 ] = in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] + tr[ 2 ]; -} - static ID_INLINE void LocalScaledMatrixTransformVector( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t out ) { out[ 0 ] = ( 1.0f - s ) * in[ 0 ] + s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] ); out[ 1 ] = ( 1.0f - s ) * in[ 1 ] + s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] ); out[ 2 ] = ( 1.0f - s ) * in[ 2 ] + s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] ); } -static ID_INLINE void LocalScaledMatrixTransformVectorTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) { - out[ 0 ] = ( 1.0f - s ) * in[ 0 ] + s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] + tr[ 0 ] ); - out[ 1 ] = ( 1.0f - s ) * in[ 1 ] + s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] + tr[ 1 ] ); - out[ 2 ] = ( 1.0f - s ) * in[ 2 ] + s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] + tr[ 2 ] ); -} - -static ID_INLINE void LocalScaledMatrixTransformVectorFullTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) { - out[ 0 ] = ( 1.0f - s ) * in[ 0 ] + s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] ) + tr[ 0 ]; - out[ 1 ] = ( 1.0f - s ) * in[ 1 ] + s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] ) + tr[ 1 ]; - out[ 2 ] = ( 1.0f - s ) * in[ 2 ] + s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] ) + tr[ 2 ]; -} - -static ID_INLINE void LocalAddScaledMatrixTransformVectorFullTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) { - out[ 0 ] += s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] ) + tr[ 0 ]; - out[ 1 ] += s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] ) + tr[ 1 ]; - out[ 2 ] += s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] ) + tr[ 2 ]; -} - static ID_INLINE void LocalAddScaledMatrixTransformVectorTranslate( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t tr, vec3_t out ) { out[ 0 ] += s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] + tr[ 0 ] ); out[ 1 ] += s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] + tr[ 1 ] ); out[ 2 ] += s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] + tr[ 2 ] ); } -static ID_INLINE void LocalAddScaledMatrixTransformVector( vec3_t in, float s, vec3_t mat[ 3 ], vec3_t out ) { - out[ 0 ] += s * ( in[ 0 ] * mat[ 0 ][ 0 ] + in[ 1 ] * mat[ 0 ][ 1 ] + in[ 2 ] * mat[ 0 ][ 2 ] ); - out[ 1 ] += s * ( in[ 0 ] * mat[ 1 ][ 0 ] + in[ 1 ] * mat[ 1 ][ 1 ] + in[ 2 ] * mat[ 1 ][ 2 ] ); - out[ 2 ] += s * ( in[ 0 ] * mat[ 2 ][ 0 ] + in[ 1 ] * mat[ 2 ][ 1 ] + in[ 2 ] * mat[ 2 ][ 2 ] ); -} - static float LAVangle; //static float sr; // TTimo: unused static float sp, sy; @@ -502,28 +472,6 @@ static ID_INLINE void SLerp_Normal( vec3_t from, vec3_t to, float tt, vec3_t out =============================================================================== */ -static ID_INLINE void Matrix4Multiply( const vec4_t a[4], const vec4_t b[4], vec4_t dst[4] ) { - dst[0][0] = a[0][0] * b[0][0] + a[0][1] * b[1][0] + a[0][2] * b[2][0] + a[0][3] * b[3][0]; - dst[0][1] = a[0][0] * b[0][1] + a[0][1] * b[1][1] + a[0][2] * b[2][1] + a[0][3] * b[3][1]; - dst[0][2] = a[0][0] * b[0][2] + a[0][1] * b[1][2] + a[0][2] * b[2][2] + a[0][3] * b[3][2]; - dst[0][3] = a[0][0] * b[0][3] + a[0][1] * b[1][3] + a[0][2] * b[2][3] + a[0][3] * b[3][3]; - - dst[1][0] = a[1][0] * b[0][0] + a[1][1] * b[1][0] + a[1][2] * b[2][0] + a[1][3] * b[3][0]; - dst[1][1] = a[1][0] * b[0][1] + a[1][1] * b[1][1] + a[1][2] * b[2][1] + a[1][3] * b[3][1]; - dst[1][2] = a[1][0] * b[0][2] + a[1][1] * b[1][2] + a[1][2] * b[2][2] + a[1][3] * b[3][2]; - dst[1][3] = a[1][0] * b[0][3] + a[1][1] * b[1][3] + a[1][2] * b[2][3] + a[1][3] * b[3][3]; - - dst[2][0] = a[2][0] * b[0][0] + a[2][1] * b[1][0] + a[2][2] * b[2][0] + a[2][3] * b[3][0]; - dst[2][1] = a[2][0] * b[0][1] + a[2][1] * b[1][1] + a[2][2] * b[2][1] + a[2][3] * b[3][1]; - dst[2][2] = a[2][0] * b[0][2] + a[2][1] * b[1][2] + a[2][2] * b[2][2] + a[2][3] * b[3][2]; - dst[2][3] = a[2][0] * b[0][3] + a[2][1] * b[1][3] + a[2][2] * b[2][3] + a[2][3] * b[3][3]; - - dst[3][0] = a[3][0] * b[0][0] + a[3][1] * b[1][0] + a[3][2] * b[2][0] + a[3][3] * b[3][0]; - dst[3][1] = a[3][0] * b[0][1] + a[3][1] * b[1][1] + a[3][2] * b[2][1] + a[3][3] * b[3][1]; - dst[3][2] = a[3][0] * b[0][2] + a[3][1] * b[1][2] + a[3][2] * b[2][2] + a[3][3] * b[3][2]; - dst[3][3] = a[3][0] * b[0][3] + a[3][1] * b[1][3] + a[3][2] * b[2][3] + a[3][3] * b[3][3]; -} - // TTimo: const vec_t ** would require explicit casts for ANSI C conformance // see unix/const-arg.c in Wolf MP source static ID_INLINE void Matrix4MultiplyInto3x3AndTranslation( /*const*/ vec4_t a[4], /*const*/ vec4_t b[4], vec3_t dst[3], vec3_t t ) { @@ -543,60 +491,6 @@ static ID_INLINE void Matrix4MultiplyInto3x3AndTranslation( /*const*/ vec4_t a[4 t[2] = a[2][0] * b[0][3] + a[2][1] * b[1][3] + a[2][2] * b[2][3] + a[2][3] * b[3][3]; } -static ID_INLINE void Matrix4Transpose( const vec4_t matrix[4], vec4_t transpose[4] ) { - int i, j; - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 4; j++ ) { - transpose[i][j] = matrix[j][i]; - } - } -} - -static ID_INLINE void Matrix4FromAxis( const vec3_t axis[3], vec4_t dst[4] ) { - int i, j; - for ( i = 0; i < 3; i++ ) { - for ( j = 0; j < 3; j++ ) { - dst[i][j] = axis[i][j]; - } - dst[3][i] = 0; - dst[i][3] = 0; - } - dst[3][3] = 1; -} - -static ID_INLINE void Matrix4FromScaledAxis( const vec3_t axis[3], const float scale, vec4_t dst[4] ) { - int i, j; - - for ( i = 0; i < 3; i++ ) { - for ( j = 0; j < 3; j++ ) { - dst[i][j] = scale * axis[i][j]; - if ( i == j ) { - dst[i][j] += 1.0f - scale; - } - } - dst[3][i] = 0; - dst[i][3] = 0; - } - dst[3][3] = 1; -} - -static ID_INLINE void Matrix4FromTranslation( const vec3_t t, vec4_t dst[4] ) { - int i, j; - - for ( i = 0; i < 3; i++ ) { - for ( j = 0; j < 3; j++ ) { - if ( i == j ) { - dst[i][j] = 1; - } else { - dst[i][j] = 0; - } - } - dst[i][3] = t[i]; - dst[3][i] = 0; - } - dst[3][3] = 1; -} - // can put an axis rotation followed by a translation directly into one matrix // TTimo: const vec_t ** would require explicit casts for ANSI C conformance // see unix/const-arg.c in Wolf MP source @@ -631,27 +525,6 @@ static ID_INLINE void Matrix4FromScaledAxisPlusTranslation( /*const*/ vec3_t axi dst[3][3] = 1; } -static ID_INLINE void Matrix4FromScale( const float scale, vec4_t dst[4] ) { - int i, j; - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 4; j++ ) { - if ( i == j ) { - dst[i][j] = scale; - } else { - dst[i][j] = 0; - } - } - } - dst[3][3] = 1; -} - -static ID_INLINE void Matrix4TransformVector( const vec4_t m[4], const vec3_t src, vec3_t dst ) { - dst[0] = m[0][0] * src[0] + m[0][1] * src[1] + m[0][2] * src[2] + m[0][3]; - dst[1] = m[1][0] * src[0] + m[1][1] * src[1] + m[1][2] * src[2] + m[1][3]; - dst[2] = m[2][0] * src[0] + m[2][1] * src[1] + m[2][2] * src[2] + m[2][3]; -} - /* =============================================================================== -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git _______________________________________________ Pkg-games-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

