[Scummvm-cvs-logs] scummvm master -> 2def212de75b3885738c4db188f0a42b712bd48f

dhewg dhewg at wiibrew.org
Sat Mar 19 11:26:57 CET 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
2def212de7 ALL: s/PI/M_PI/


Commit: 2def212de75b3885738c4db188f0a42b712bd48f
    https://github.com/scummvm/scummvm/commit/2def212de75b3885738c4db188f0a42b712bd48f
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-19T03:24:06-07:00

Commit Message:
ALL: s/PI/M_PI/

Tip of the day: git grep -w PI

Changed paths:
    audio/softsynth/opl/dbopl.cpp
    backends/platform/ps2/Gs2dScreen.cpp
    engines/sci/engine/kmovement.cpp
    engines/sword25/util/lua/lmathlib.cpp
    graphics/jpeg.cpp
    test/audio/helper.h



diff --git a/audio/softsynth/opl/dbopl.cpp b/audio/softsynth/opl/dbopl.cpp
index 47e263b..2c46cfe 100644
--- a/audio/softsynth/opl/dbopl.cpp
+++ b/audio/softsynth/opl/dbopl.cpp
@@ -41,10 +41,6 @@
 namespace OPL {
 namespace DOSBox {
 
-#ifndef PI
-#define PI 3.14159265358979323846
-#endif
-
 namespace DBOPL {
 
 #define OPLRATE		((double)(14318180.0 / 288.0))
@@ -1392,7 +1388,7 @@ void InitTables( void ) {
 	//Add 0.5 for the trunc rounding of the integer cast
 	//Do a PI sinetable instead of the original 0.5 PI
 	for ( int i = 0; i < 512; i++ ) {
-		SinTable[i] = (Bit16s)( 0.5 - log10( sin( (i + 0.5) * (PI / 512.0) ) ) / log10(2.0)*256 );
+		SinTable[i] = (Bit16s)( 0.5 - log10( sin( (i + 0.5) * (M_PI / 512.0) ) ) / log10(2.0)*256 );
 	}
 #endif
 #if ( DBOPL_WAVE == WAVE_TABLEMUL )
@@ -1406,7 +1402,7 @@ void InitTables( void ) {
 
 	//Sine Wave Base
 	for ( int i = 0; i < 512; i++ ) {
-		WaveTable[ 0x0200 + i ] = (Bit16s)(sin( (i + 0.5) * (PI / 512.0) ) * 4084);
+		WaveTable[ 0x0200 + i ] = (Bit16s)(sin( (i + 0.5) * (M_PI / 512.0) ) * 4084);
 		WaveTable[ 0x0000 + i ] = -WaveTable[ 0x200 + i ];
 	}
 	//Exponential wave
@@ -1418,7 +1414,7 @@ void InitTables( void ) {
 #if ( DBOPL_WAVE == WAVE_TABLELOG )
 	//Sine Wave Base
 	for ( int i = 0; i < 512; i++ ) {
-		WaveTable[ 0x0200 + i ] = (Bit16s)( 0.5 - log10( sin( (i + 0.5) * (PI / 512.0) ) ) / log10(2.0)*256 );
+		WaveTable[ 0x0200 + i ] = (Bit16s)( 0.5 - log10( sin( (i + 0.5) * (M_PI / 512.0) ) ) / log10(2.0)*256 );
 		WaveTable[ 0x0000 + i ] = ((Bit16s)0x8000) | WaveTable[ 0x200 + i];
 	}
 	//Exponential wave
diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp
index f869779..a460b91 100644
--- a/backends/platform/ps2/Gs2dScreen.cpp
+++ b/backends/platform/ps2/Gs2dScreen.cpp
@@ -680,7 +680,7 @@ void Gs2dScreen::animThread(void) {
 		{ SCALE(1),   SCALE(1) }, { SCALE(1),   SCALE(14) },
 		{ SCALE(128), SCALE(1) }, { SCALE(128), SCALE(14) }
 	};
-	float angleStep = ((2 * PI) / _tvHeight);
+	float angleStep = ((2 * M_PI) / _tvHeight);
 
 	while (!_systemQuit) {
 		do {
@@ -739,7 +739,7 @@ void Gs2dScreen::animThread(void) {
 				float z[4];
 				GsVertex nodes[4];
 
-				float angle = PI / 2 + angleStep * drawY;
+				float angle = M_PI / 2 + angleStep * drawY;
 				float rotSin = sinf(angle);
 				float rotCos = cosf(angle);
 				for (int coord = 0; coord < 4; coord++) {
diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp
index 49d2900..f93a671 100644
--- a/engines/sci/engine/kmovement.cpp
+++ b/engines/sci/engine/kmovement.cpp
@@ -569,8 +569,8 @@ reg_t kDoAvoider(EngineState *s, int argc, reg_t *argv) {
 		debugC(kDebugLevelBresen, " avoider %04x:%04x", PRINT_REG(avoider));
 
 		for (moves = 0; moves < 8; moves++) {
-			int move_x = (int)(sin(angle * PI / 180.0) * (xstep));
-			int move_y = (int)(-cos(angle * PI / 180.0) * (ystep));
+			int move_x = (int)(sin(angle * M_PI / 180.0) * (xstep));
+			int move_y = (int)(-cos(angle * M_PI / 180.0) * (ystep));
 
 			writeSelectorValue(segMan, client, SELECTOR(x), oldx + move_x);
 			writeSelectorValue(segMan, client, SELECTOR(y), oldy + move_y);
diff --git a/engines/sword25/util/lua/lmathlib.cpp b/engines/sword25/util/lua/lmathlib.cpp
index ed50539..bb9c6ed 100644
--- a/engines/sword25/util/lua/lmathlib.cpp
+++ b/engines/sword25/util/lua/lmathlib.cpp
@@ -16,12 +16,7 @@
 #include "lauxlib.h"
 #include "lualib.h"
 
-
-#undef PI
-#define PI (3.14159265358979323846)
-#define RADIANS_PER_DEGREE (PI/180.0)
-
-
+#define RADIANS_PER_DEGREE (M_PI/180.0)
 
 static int math_abs (lua_State *L) {
   lua_pushnumber(L, fabs(luaL_checknumber(L, 1)));
@@ -250,7 +245,7 @@ static const luaL_Reg mathlib[] = {
 */
 LUALIB_API int luaopen_math (lua_State *L) {
   luaL_register(L, LUA_MATHLIBNAME, mathlib);
-  lua_pushnumber(L, PI);
+  lua_pushnumber(L, M_PI);
   lua_setfield(L, -2, "pi");
 #if defined(MACOSX) && defined(__GNUC__) && ! defined( __XLC__ )
   // WORKAROUND for a bug in the Mac OS X 10.2.8 SDK. It defines
diff --git a/graphics/jpeg.cpp b/graphics/jpeg.cpp
index aa4b876..5ddd675 100644
--- a/graphics/jpeg.cpp
+++ b/graphics/jpeg.cpp
@@ -46,7 +46,7 @@ static const uint8 _zigZagOrder[64] = {
 };
 
 // IDCT table built with :
-// _idct8x8[x][y] = cos(((2 * x + 1) * y) * (PI / 16.0)) * 0.5;
+// _idct8x8[x][y] = cos(((2 * x + 1) * y) * (M_PI / 16.0)) * 0.5;
 // _idct8x8[x][y] /= sqrt(2.0) if y == 0
 static const double _idct8x8[8][8] = {
 	{ 0.353553390593274,  0.490392640201615,  0.461939766255643,  0.415734806151273,  0.353553390593274,  0.277785116509801,  0.191341716182545,  0.097545161008064 },
diff --git a/test/audio/helper.h b/test/audio/helper.h
index 262ca1c..e0d034a 100644
--- a/test/audio/helper.h
+++ b/test/audio/helper.h
@@ -18,7 +18,7 @@ static T *createSine(const int sampleRate, const int time) {
 	const T maxValue = std::numeric_limits<T>::max() ^ xorMask;
 
 	for (int i = 0; i < time * sampleRate; ++i)
-		sine[i] = ((T)(sin((double)i / sampleRate * 2 * PI) * maxValue)) ^ xorMask;
+		sine[i] = ((T)(sin((double)i / sampleRate * 2 * M_PI) * maxValue)) ^ xorMask;
 
 	return sine;
 }






More information about the Scummvm-git-logs mailing list