aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordhewg2011-03-19 11:24:06 +0100
committerdhewg2011-03-19 11:24:06 +0100
commit2def212de75b3885738c4db188f0a42b712bd48f (patch)
tree03657dca73b120b0e80c73346dac1e47ec543d6a
parenta4c05b1632940b3f2003055e0c64970b4b053f32 (diff)
downloadscummvm-rg350-2def212de75b3885738c4db188f0a42b712bd48f.tar.gz
scummvm-rg350-2def212de75b3885738c4db188f0a42b712bd48f.tar.bz2
scummvm-rg350-2def212de75b3885738c4db188f0a42b712bd48f.zip
ALL: s/PI/M_PI/
Tip of the day: git grep -w PI
-rw-r--r--audio/softsynth/opl/dbopl.cpp10
-rw-r--r--backends/platform/ps2/Gs2dScreen.cpp4
-rw-r--r--engines/sci/engine/kmovement.cpp4
-rw-r--r--engines/sword25/util/lua/lmathlib.cpp9
-rw-r--r--graphics/jpeg.cpp2
-rw-r--r--test/audio/helper.h2
6 files changed, 11 insertions, 20 deletions
diff --git a/audio/softsynth/opl/dbopl.cpp b/audio/softsynth/opl/dbopl.cpp
index 47e263b6b9..2c46cfee75 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 f869779573..a460b919fd 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 49d2900835..f93a6716b9 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 ed50539f1f..bb9c6ed442 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 aa4b876680..5ddd675273 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 262ca1c060..e0d034aaea 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;
}