From 7dcf5274bc4c6e80a644f0814520818a8cedcd40 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Wed, 31 Aug 2005 23:41:16 +0000 Subject: * Fixed the issue where the Mac qvm JIT compiler would not compile Tremulous * Removed the mp3 decoder from the source --- Makefile | 1 - src/cgame/cg_consolecmds.c | 23 ---------------------- src/cgame/cg_local.h | 5 ----- src/game/bg_lib.c | 48 ++++++++++++++++++++++++++++------------------ 4 files changed, 29 insertions(+), 48 deletions(-) diff --git a/Makefile b/Makefile index 4750eb15..e9d3cd3b 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,6 @@ CGOBJ = \ $(CGDIRNAME)/cg_view.o \ $(CGDIRNAME)/cg_weapons.o \ $(CGDIRNAME)/cg_mem.o \ - $(CGDIRNAME)/cg_mp3decoder.o \ $(CGDIRNAME)/cg_scanner.o \ $(CGDIRNAME)/cg_trails.o \ $(CGDIRNAME)/cg_particles.o \ diff --git a/src/cgame/cg_consolecmds.c b/src/cgame/cg_consolecmds.c index 3e654c90..bf15145c 100644 --- a/src/cgame/cg_consolecmds.c +++ b/src/cgame/cg_consolecmds.c @@ -144,28 +144,6 @@ static void CG_TellAttacker_f( void ) trap_SendClientCommand( command ); } -/* -================== -CG_DecodeMP3_f -================== -*/ -void CG_DecodeMP3_f( void ) -{ - char mp3file[ MAX_QPATH ]; - char wavfile[ MAX_QPATH ]; - - if( trap_Argc( ) < 2 ) - { - CG_Printf( "usage: decodeMP3 \n" ); - return; - } - - Q_strncpyz( mp3file, CG_Argv( 1 ), MAX_QPATH ); - Q_strncpyz( wavfile, CG_Argv( 2 ), MAX_QPATH ); - - S_decodeMP3( mp3file, wavfile ); -} - typedef struct { char *cmd; @@ -193,7 +171,6 @@ static consoleCommand_t commands[ ] = { "tell_target", CG_TellTarget_f }, { "tell_attacker", CG_TellAttacker_f }, { "tcmd", CG_TargetCommand_f }, - { "decodeMP3", CG_DecodeMP3_f }, }; diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index d12e8001..ad44eafc 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1776,11 +1776,6 @@ void *CG_Alloc( int size ); void CG_Free( void *ptr ); void CG_DefragmentMemory( void ); -// -// cg_mp3decoder.c -// -qboolean S_decodeMP3( char *mp3File, char *wavFile ); - // // cg_particles.c // diff --git a/src/game/bg_lib.c b/src/game/bg_lib.c index 1b594eb2..b0f543bf 100644 --- a/src/game/bg_lib.c +++ b/src/game/bg_lib.c @@ -828,9 +828,6 @@ double tan( double x ) * ==================================================== */ -/* A union which permits us to convert between a float and a 32 bit - int. */ - typedef union { float value; @@ -855,6 +852,9 @@ do { \ (d) = sf_u.value; \ } while (0) +/* A union which permits us to convert between a float and a 32 bit + int. */ + //acos static const float pi = 3.1415925026e+00, /* 0x40490fda */ @@ -878,39 +878,43 @@ acos */ double acos( double x ) { - float z, p, q, r, w, s, c, df; + float z, subp, p, q, r, w, s, c, df; int hx, ix; GET_FLOAT_WORD( hx, x ); ix = hx & 0x7fffffff; if( ix == 0x3f800000 ) - { /* |x|==1 */ + { // |x|==1 if( hx > 0 ) - return 0.0; /* acos(1) = 0 */ + return 0.0; // acos(1) = 0 else - return pi + (float)2.0 * pio2_lo; /* acos(-1)= pi */ + return pi + (float)2.0 * pio2_lo; // acos(-1)= pi } else if( ix > 0x3f800000 ) - { /* |x| >= 1 */ - return (x-x)/(x-x); /* acos(|x|>1) is NaN */ + { // |x| >= 1 + return (x-x)/(x-x); // acos(|x|>1) is NaN } if( ix < 0x3f000000 ) - { /* |x| < 0.5 */ + { // |x| < 0.5 if( ix <= 0x23000000 ) - return pio2_hi + pio2_lo;/*if|x|<2**-57*/ + return pio2_hi + pio2_lo;//if|x|<2**-57 z = x * x; - p = z * ( pS0 + z * ( pS1 + z * ( pS2 + z * ( pS3 + z * ( pS4 + z * pS5 ) ) ) ) ); + subp = pS3 + z * ( pS4 + z * pS5 ); + // chop up expression to keep mac register based stack happy + p = z * ( pS0 + z * ( pS1 + z * ( pS2 + z * subp ) ) ); q = 1.0 + z * ( qS1 + z * ( qS2 + z * ( qS3 + z * qS4 ) ) ); r = p / q; return pio2_hi - ( x - ( pio2_lo - x * r ) ); } else if( hx < 0 ) - { /* x < -0.5 */ + { // x < -0.5 z = ( 1.0 + x ) * (float)0.5; - p = z * ( pS0 + z * ( pS1 + z * ( pS2 + z * ( pS3 + z * ( pS4 + z * pS5 ) ) ) ) ); + subp = pS3 + z * ( pS4 + z * pS5 ); + // chop up expression to keep mac register based stack happy + p = z * ( pS0 + z * ( pS1 + z * ( pS2 + z * subp ) ) ); q = 1.0 + z * ( qS1 + z * ( qS2 + z * ( qS3 + z * qS4 ) ) ); s = sqrt( z ); r = p / q; @@ -918,7 +922,7 @@ double acos( double x ) return pi - (float)2.0 * ( s + w ); } else - { /* x > 0.5 */ + { // x > 0.5 int idf; z = ( 1.0 - x ) * (float)0.5; s = sqrt( z ); @@ -926,7 +930,9 @@ double acos( double x ) GET_FLOAT_WORD( idf, df ); SET_FLOAT_WORD( df, idf & 0xfffff000 ); c = ( z - df * df ) / ( s + df ); - p = z * ( pS0 + z * ( pS1 + z * ( pS2 + z * ( pS3 + z * ( pS4 + z * pS5 ) ) ) ) ); + subp = pS3 + z * ( pS4 + z * pS5 ); + // chop up expression to keep mac register based stack happy + p = z * ( pS0 + z * ( pS1 + z * ( pS2 + z * subp ) ) ); q = 1.0 + z * ( qS1 + z * ( qS2 + z * ( qS3 + z * qS4 ) ) ); r = p / q; w = r * s + c; @@ -1037,7 +1043,7 @@ pow float pow( float x, float y ) { float z, ax, z_h, z_l, p_h, p_l; - float y1, t1, t2, r, s, t, u, v, w; + float y1, subt1, t1, t2, subr, r, s, t, u, v, w; int i, j, k, yisint, n; int hx, hy, ix, iy, is; @@ -1192,7 +1198,9 @@ float pow( float x, float y ) s_l = v * ( ( u - s_h * t_h ) - s_h * t_l ); /* compute log(ax) */ s2 = s * s; - r = s2 * s2 * ( L1 + s2 * ( L2 + s2 * ( L3 + s2 * ( L4 + s2 * ( L5 + s2 * L6 ) ) ) ) ); + subr = L3 + s2 * ( L4 + s2 * ( L5 + s2 * L6 ) ); + // chop up expression to keep mac register based stack happy + r = s2 * s2 * ( L1 + s2 * ( L2 + s2 * subr ) ); r += s_l * ( s_h + s ); s2 = s_h * s_h; t_h = (float)3.0 + s2 + r; @@ -1272,7 +1280,9 @@ float pow( float x, float y ) z = u + v; w = v - ( z - u ); t = z * z; - t1 = z - t * ( P1 + t * ( P2 + t * ( P3 + t * ( P4 + t * P5 ) ) ) ); + subt1 = P3 + t * ( P4 + t * P5 ); + // chop up expression to keep mac register based stack happy + t1 = z - t * ( P1 + t * ( P2 + t * subt1 ) ); r = ( z * t1 ) / ( t1 - two ) - ( w + z * w ); z = one - ( r - z ); GET_FLOAT_WORD( j, z ); -- cgit