[Scummvm-cvs-logs] scummvm master -> 23aabc950a2b8ac2fb986dba1988319246b6881d
bluegr
md5 at scummvm.org
Sat Mar 19 01:43:06 CET 2011
This automated email contains information about 10 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
3924fc0bad COMMON: Enable math constants under Visual Studio
156f1c0178 SCI: Added another leftover debug script in the find_callk console command
0eb2c4709e SCI: Changed several places that use PI to use the standard M_PI instead
19d3972f16 VIDEO: Changed several places that use PI to use M_PI instead
334e1cd675 GRAPHICS: Silenced a warning
a6aacc73e2 AUDIO: Changed several places that use PI to use M_PI instead
be3ca52168 MOHAWK: Changed usage of PI to M_PI (normally defined in math.h)
8af0d35a5f TESTBED: Changed usage of PI to M_PI (normally defined in math.h)
d602a420b6 SCUMM: Changed usage of PI to M_PI (normally defined in math.h)
23aabc950a COMMON: Removed custom PI define (M_PI should be used instead)
Commit: 3924fc0bada989332b66292204e328341f6ab72e
https://github.com/scummvm/scummvm/commit/3924fc0bada989332b66292204e328341f6ab72e
Author: md5 (md5 at scummvm.org)
Date: 2011-03-18T16:56:10-07:00
Commit Message:
COMMON: Enable math constants under Visual Studio
Changed paths:
common/scummsys.h
diff --git a/common/scummsys.h b/common/scummsys.h
index b0f514c..a12370c 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -94,6 +94,11 @@
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
+ // MSVC does not define M_PI, M_SQRT2 and other math defines by default.
+ // _USE_MATH_DEFINES must be defined in order to have these defined, thus
+ // we enable it here. For more information, check:
+ // http://msdn.microsoft.com/en-us/library/4hwaceh6(v=VS.100).aspx
+ #define _USE_MATH_DEFINES
#include <math.h>
#endif
Commit: 156f1c01785aee64ecac831e38d6d38d04eb6990
https://github.com/scummvm/scummvm/commit/156f1c01785aee64ecac831e38d6d38d04eb6990
Author: md5 (md5 at scummvm.org)
Date: 2011-03-18T16:57:39-07:00
Commit Message:
SCI: Added another leftover debug script in the find_callk console command
Changed paths:
engines/sci/console.cpp
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index db93333..fddae53 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -2723,9 +2723,10 @@ void Console::printKernelCallsFound(int kernelFuncNum, bool showFoundScripts) {
while (itr != resources->end()) {
// Ignore specific leftover scripts, which require other non-existing scripts
- if ((_engine->getGameId() == GID_HOYLE3 && itr->getNumber() == 995) ||
- (_engine->getGameId() == GID_KQ5 && itr->getNumber() == 980) ||
- (_engine->getGameId() == GID_SLATER && itr->getNumber() == 947)) {
+ if ((_engine->getGameId() == GID_HOYLE3 && itr->getNumber() == 995) ||
+ (_engine->getGameId() == GID_KQ5 && itr->getNumber() == 980) ||
+ (_engine->getGameId() == GID_SLATER && itr->getNumber() == 947) ||
+ (_engine->getGameId() == GID_MOTHERGOOSE256 && itr->getNumber() == 980)) {
itr++;
continue;
}
Commit: 0eb2c4709ebba9b8c63c7e42be3ba83e109ecbc5
https://github.com/scummvm/scummvm/commit/0eb2c4709ebba9b8c63c7e42be3ba83e109ecbc5
Author: md5 (md5 at scummvm.org)
Date: 2011-03-18T17:22:06-07:00
Commit Message:
SCI: Changed several places that use PI to use the standard M_PI instead
Changed paths:
engines/sci/engine/kmath.cpp
diff --git a/engines/sci/engine/kmath.cpp b/engines/sci/engine/kmath.cpp
index f90a5b4..9baf9f5 100644
--- a/engines/sci/engine/kmath.cpp
+++ b/engines/sci/engine/kmath.cpp
@@ -117,7 +117,7 @@ reg_t kGetDistance(EngineState *s, int argc, reg_t *argv) {
int xdiff = (argc > 3) ? argv[3].toSint16() : 0;
int ydiff = (argc > 2) ? argv[2].toSint16() : 0;
int angle = (argc > 5) ? argv[5].toSint16() : 0;
- int xrel = (int)(((float) argv[1].toSint16() - xdiff) / cos(angle * PI / 180.0)); // This works because cos(0)==1
+ int xrel = (int)(((float) argv[1].toSint16() - xdiff) / cos(angle * M_PI / 180.0)); // This works because cos(0)==1
int yrel = argv[0].toSint16() - ydiff;
return make_reg(0, (int16)sqrt((float) xrel*xrel + yrel*yrel));
}
@@ -126,20 +126,20 @@ reg_t kTimesSin(EngineState *s, int argc, reg_t *argv) {
int angle = argv[0].toSint16();
int factor = argv[1].toSint16();
- return make_reg(0, (int16)(factor * sin(angle * PI / 180.0)));
+ return make_reg(0, (int16)(factor * sin(angle * M_PI / 180.0)));
}
reg_t kTimesCos(EngineState *s, int argc, reg_t *argv) {
int angle = argv[0].toSint16();
int factor = argv[1].toSint16();
- return make_reg(0, (int16)(factor * cos(angle * PI / 180.0)));
+ return make_reg(0, (int16)(factor * cos(angle * M_PI / 180.0)));
}
reg_t kCosDiv(EngineState *s, int argc, reg_t *argv) {
int angle = argv[0].toSint16();
int value = argv[1].toSint16();
- double cosval = cos(angle * PI / 180.0);
+ double cosval = cos(angle * M_PI / 180.0);
if ((cosval < 0.0001) && (cosval > -0.0001)) {
error("kCosDiv: Attempted division by zero");
@@ -151,7 +151,7 @@ reg_t kCosDiv(EngineState *s, int argc, reg_t *argv) {
reg_t kSinDiv(EngineState *s, int argc, reg_t *argv) {
int angle = argv[0].toSint16();
int value = argv[1].toSint16();
- double sinval = sin(angle * PI / 180.0);
+ double sinval = sin(angle * M_PI / 180.0);
if ((sinval < 0.0001) && (sinval > -0.0001)) {
error("kSinDiv: Attempted division by zero");
@@ -169,7 +169,7 @@ reg_t kTimesTan(EngineState *s, int argc, reg_t *argv) {
error("kTimesTan: Attempted tan(pi/2)");
return SIGNAL_REG;
} else
- return make_reg(0, (int16) - (tan(param * PI / 180.0) * scale));
+ return make_reg(0, (int16) - (tan(param * M_PI / 180.0) * scale));
}
reg_t kTimesCot(EngineState *s, int argc, reg_t *argv) {
@@ -180,7 +180,7 @@ reg_t kTimesCot(EngineState *s, int argc, reg_t *argv) {
error("kTimesCot: Attempted tan(pi/2)");
return SIGNAL_REG;
} else
- return make_reg(0, (int16)(tan(param * PI / 180.0) * scale));
+ return make_reg(0, (int16)(tan(param * M_PI / 180.0) * scale));
}
#ifdef ENABLE_SCI32
Commit: 19d3972f1673c5cb5fe6bd0521044b3d95f4bff6
https://github.com/scummvm/scummvm/commit/19d3972f1673c5cb5fe6bd0521044b3d95f4bff6
Author: md5 (md5 at scummvm.org)
Date: 2011-03-18T17:29:22-07:00
Commit Message:
VIDEO: Changed several places that use PI to use M_PI instead
Changed paths:
video/codecs/qdm2.cpp
diff --git a/video/codecs/qdm2.cpp b/video/codecs/qdm2.cpp
index d592548..c7e1ffe 100644
--- a/video/codecs/qdm2.cpp
+++ b/video/codecs/qdm2.cpp
@@ -448,7 +448,7 @@ float *ff_cos_tabs[] = {
void initCosineTables(int index) {
int m = 1 << index;
- double freq = 2 * PI / m;
+ double freq = 2 * M_PI / m;
float *tab = ff_cos_tabs[index];
for (int i = 0; i <= m / 4; i++)
@@ -776,7 +776,7 @@ int fftInit(FFTContext *s, int nbits, int inverse) {
s->tmpBuf = (FFTComplex *)malloc(n * sizeof(FFTComplex));
} else {
for (i = 0; i < n / 2; i++) {
- alpha = 2 * PI * (float)i / (float)n;
+ alpha = 2 * M_PI * (float)i / (float)n;
c1 = cos(alpha);
s1 = sin(alpha) * s2;
s->exptab[i].re = c1;
@@ -814,7 +814,7 @@ int fftInit(FFTContext *s, int nbits, int inverse) {
*/
int rdftInit(RDFTContext *s, int nbits, RDFTransformType trans) {
int n = 1 << nbits;
- const double theta = (trans == RDFT || trans == IRIDFT ? -1 : 1) * 2 * PI / n;
+ const double theta = (trans == RDFT || trans == IRIDFT ? -1 : 1) * 2 * M_PI / n;
s->nbits = nbits;
s->inverse = trans == IRDFT || trans == IRIDFT;
@@ -3009,7 +3009,7 @@ void QDM2Stream::qdm2_fft_generate_tone(FFTTone *tone)
float level, f[6];
int i;
QDM2Complex c;
- const double iscale = 2.0 * PI / 512.0;
+ const double iscale = 2.0 * M_PI / 512.0;
tone->phase += tone->phase_shift;
@@ -3050,7 +3050,7 @@ void QDM2Stream::qdm2_fft_generate_tone(FFTTone *tone)
void QDM2Stream::qdm2_fft_tone_synthesizer(uint8 sub_packet) {
int i, j, ch;
- const double iscale = 0.25 * PI;
+ const double iscale = 0.25 * M_PI;
for (ch = 0; ch < _channels; ch++) {
memset(_fft.complex[ch], 0, _frameSize * sizeof(QDM2Complex));
Commit: 334e1cd675d01a92046bb7296c97394d4daabe99
https://github.com/scummvm/scummvm/commit/334e1cd675d01a92046bb7296c97394d4daabe99
Author: md5 (md5 at scummvm.org)
Date: 2011-03-18T17:30:03-07:00
Commit Message:
GRAPHICS: Silenced a warning
Changed paths:
graphics/wincursor.cpp
diff --git a/graphics/wincursor.cpp b/graphics/wincursor.cpp
index d3c9414..10939a6 100644
--- a/graphics/wincursor.cpp
+++ b/graphics/wincursor.cpp
@@ -138,7 +138,7 @@ bool WinCursor::readFromStream(Common::SeekableReadStream &stream) {
if (bitsPerPixel == 1) {
// 1bpp
- for (uint32 j = 0; j < (_width / 8); j++) {
+ for (uint16 j = 0; j < (_width / 8); j++) {
byte p = src[j];
for (int k = 0; k < 8; k++, rowDest++, p <<= 1) {
Commit: a6aacc73e2dc00b6cdeaa5ec08e07b9b285b2fb6
https://github.com/scummvm/scummvm/commit/a6aacc73e2dc00b6cdeaa5ec08e07b9b285b2fb6
Author: md5 (md5 at scummvm.org)
Date: 2011-03-18T17:30:32-07:00
Commit Message:
AUDIO: Changed several places that use PI to use M_PI instead
Changed paths:
audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp
audio/softsynth/opl/mame.cpp
audio/softsynth/pcspk.cpp
audio/softsynth/ym2612.cpp
diff --git a/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp b/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp
index f84fd84..67de8fa 100644
--- a/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp
+++ b/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp
@@ -1253,7 +1253,7 @@ void TownsPC98_FmSynth::generateTables() {
delete[] _oprSinTbl;
_oprSinTbl = new uint32[1024];
for (int i = 0; i < 1024; i++) {
- double val = sin((double)(((i << 1) + 1) * PI / 1024.0));
+ double val = sin((double)(((i << 1) + 1) * M_PI / 1024.0));
double d_dcb = log(1.0 / (double)ABS(val)) / log(2.0) * 256.0;
int32 i_dcb = (int32)(2.0 * d_dcb);
i_dcb = (i_dcb & 1) ? (i_dcb >> 1) + 1 : (i_dcb >> 1);
diff --git a/audio/softsynth/opl/mame.cpp b/audio/softsynth/opl/mame.cpp
index c875080..b4bbcb5 100644
--- a/audio/softsynth/opl/mame.cpp
+++ b/audio/softsynth/opl/mame.cpp
@@ -708,7 +708,7 @@ static int OPLOpenTable(void) {
/* degree 0 = degree 180 = off */
SIN_TABLE[0] = SIN_TABLE[SIN_ENT /2 ] = &TL_TABLE[EG_ENT - 1];
for (s = 1;s <= SIN_ENT / 4; s++) {
- pom = sin(2 * PI * s / SIN_ENT); /* sin */
+ pom = sin(2 * M_PI * s / SIN_ENT); /* sin */
pom = 20 * log10(1 / pom); /* decibel */
j = int(pom / EG_STEP); /* TL_TABLE steps */
@@ -739,14 +739,14 @@ static int OPLOpenTable(void) {
ENV_CURVE[EG_OFF >> ENV_BITS]= EG_ENT - 1;
/* make LFO ams table */
for (i=0; i < AMS_ENT; i++) {
- pom = (1.0 + sin(2 * PI * i / AMS_ENT)) / 2; /* sin */
+ pom = (1.0 + sin(2 * M_PI * i / AMS_ENT)) / 2; /* sin */
AMS_TABLE[i] = (int)((1.0 / EG_STEP) * pom); /* 1dB */
AMS_TABLE[AMS_ENT + i] = (int)((4.8 / EG_STEP) * pom); /* 4.8dB */
}
/* make LFO vibrate table */
for (i=0; i < VIB_ENT; i++) {
/* 100cent = 1seminote = 6% ?? */
- pom = (double)VIB_RATE * 0.06 * sin(2 * PI * i / VIB_ENT); /* +-100sect step */
+ pom = (double)VIB_RATE * 0.06 * sin(2 * M_PI * i / VIB_ENT); /* +-100sect step */
VIB_TABLE[i] = (int)(VIB_RATE + (pom * 0.07)); /* +- 7cent */
VIB_TABLE[VIB_ENT + i] = (int)(VIB_RATE + (pom * 0.14)); /* +-14cent */
}
diff --git a/audio/softsynth/pcspk.cpp b/audio/softsynth/pcspk.cpp
index 69ba113..947c142 100644
--- a/audio/softsynth/pcspk.cpp
+++ b/audio/softsynth/pcspk.cpp
@@ -109,7 +109,7 @@ int8 PCSpeaker::generateSine(uint32 x, uint32 oscLength) {
return 0;
// TODO: Maybe using a look-up-table would be better?
- return CLIP<int16>((int16) (128 * sin(2.0 * PI * x / oscLength)), -128, 127);
+ return CLIP<int16>((int16) (128 * sin(2.0 * M_PI * x / oscLength)), -128, 127);
}
int8 PCSpeaker::generateSaw(uint32 x, uint32 oscLength) {
diff --git a/audio/softsynth/ym2612.cpp b/audio/softsynth/ym2612.cpp
index 94fcfb9..6b3c2aa 100644
--- a/audio/softsynth/ym2612.cpp
+++ b/audio/softsynth/ym2612.cpp
@@ -677,14 +677,14 @@ void MidiDriver_YM2612::createLookupTables() {
int i;
sintbl = new int [2048];
for (i = 0; i < 2048; i++)
- sintbl[i] = (int)(0xffff * sin(i/2048.0*2.0*PI));
+ sintbl[i] = (int)(0xffff * sin(i/2048.0 * 2.0 * M_PI));
}
{
int i;
powtbl = new int [1025];
for (i = 0; i <= 1024; i++)
- powtbl[i] = (int)(0x10000 * pow(2.0, (i-512)/512.0));
+ powtbl[i] = (int)(0x10000 * pow(2.0, (i - 512) / 512.0));
}
{
Commit: be3ca5216881ae01a9a3db7794fb7c685b29fd65
https://github.com/scummvm/scummvm/commit/be3ca5216881ae01a9a3db7794fb7c685b29fd65
Author: md5 (md5 at scummvm.org)
Date: 2011-03-18T17:32:19-07:00
Commit Message:
MOHAWK: Changed usage of PI to M_PI (normally defined in math.h)
Changed paths:
engines/mohawk/myst_stacks/myst.cpp
diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp
index caadf09..5d07032 100644
--- a/engines/mohawk/myst_stacks/myst.cpp
+++ b/engines/mohawk/myst_stacks/myst.cpp
@@ -3133,7 +3133,7 @@ Common::Point Myst::towerRotationMapComputeCoords(const Common::Point ¢er, u
Common::Point end;
// Polar to rect coords
- double radians = angle * PI / 180.0;
+ double radians = angle * M_PI / 180.0;
end.x = (int16)(center.x + cos(radians) * 310.0);
end.y = (int16)(center.y + sin(radians) * 310.0);
Commit: 8af0d35a5ff17e8e4f52401a0758cf6f04e0e17a
https://github.com/scummvm/scummvm/commit/8af0d35a5ff17e8e4f52401a0758cf6f04e0e17a
Author: md5 (md5 at scummvm.org)
Date: 2011-03-18T17:32:53-07:00
Commit Message:
TESTBED: Changed usage of PI to M_PI (normally defined in math.h)
Changed paths:
engines/testbed/graphics.cpp
diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp
index 3cdff5f..588aad8 100644
--- a/engines/testbed/graphics.cpp
+++ b/engines/testbed/graphics.cpp
@@ -360,7 +360,7 @@ void GFXtests::drawEllipse(int cx, int cy, int a, int b) {
// Illuminate the points lying on ellipse
- for (theta = 0; theta <= PI / 2; theta += PI / 360) {
+ for (theta = 0; theta <= M_PI / 2; theta += M_PI / 360) {
x = (int)(b * sin(theta) + 0.5);
y = (int)(a * cos(theta) + 0.5);
Commit: d602a420b622ce77c4a7e3782a4e7cad3a09e480
https://github.com/scummvm/scummvm/commit/d602a420b622ce77c4a7e3782a4e7cad3a09e480
Author: md5 (md5 at scummvm.org)
Date: 2011-03-18T17:33:09-07:00
Commit Message:
SCUMM: Changed usage of PI to M_PI (normally defined in math.h)
Changed paths:
engines/scumm/actor.cpp
engines/scumm/he/logic_he.cpp
engines/scumm/he/script_v90he.cpp
engines/scumm/he/wiz_he.cpp
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index 5906545..2403d2a 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -241,7 +241,7 @@ void Actor::setActorWalkSpeed(uint newSpeedX, uint newSpeedY) {
int getAngleFromPos(int x, int y, bool useATAN) {
if (useATAN) {
double temp = atan2((double)x, (double)-y);
- return normalizeAngle((int)(temp * 180 / PI));
+ return normalizeAngle((int)(temp * 180 / M_PI));
} else {
if (ABS(y) * 2 < ABS(x)) {
if (x > 0)
diff --git a/engines/scumm/he/logic_he.cpp b/engines/scumm/he/logic_he.cpp
index ed92c33..c088fd6 100644
--- a/engines/scumm/he/logic_he.cpp
+++ b/engines/scumm/he/logic_he.cpp
@@ -160,8 +160,8 @@ int32 LogicHErace::dispatch(int op, int numArgs, int32 *args) {
return res;
}
-#define RAD2DEG (180 / PI)
-#define DEG2RAD (PI / 180)
+#define RAD2DEG (180 / M_PI)
+#define DEG2RAD (M_PI / 180)
int32 LogicHErace::op_1003(int32 *args) {
int value = args[2] ? args[2] : 1;
@@ -457,7 +457,7 @@ void LogicHEfunshop::op_1004(int32 *args) {
sq = sqrt(data[i + 1] * data[i + 1] + data[i] * data[i]);
if (at <= 0)
- at += 2 * PI;
+ at += 2 * M_PI;
data[i] = cos(at + a1) * sq;
data[i + 1] = sin(at + a1) * sq;
diff --git a/engines/scumm/he/script_v90he.cpp b/engines/scumm/he/script_v90he.cpp
index 841eba9..1a38a99 100644
--- a/engines/scumm/he/script_v90he.cpp
+++ b/engines/scumm/he/script_v90he.cpp
@@ -351,12 +351,12 @@ void ScummEngine_v90he::o90_max() {
}
void ScummEngine_v90he::o90_sin() {
- double a = pop() * PI / 180.;
+ double a = pop() * M_PI / 180.;
push((int)(sin(a) * 100000));
}
void ScummEngine_v90he::o90_cos() {
- double a = pop() * PI / 180.;
+ double a = pop() * M_PI / 180.;
push((int)(cos(a) * 100000));
}
@@ -372,7 +372,7 @@ void ScummEngine_v90he::o90_sqrt() {
void ScummEngine_v90he::o90_atan2() {
int y = pop();
int x = pop();
- int a = (int)(atan2((double)y, (double)x) * 180. / PI);
+ int a = (int)(atan2((double)y, (double)x) * 180. / M_PI);
if (a < 0) {
a += 360;
}
@@ -384,7 +384,7 @@ void ScummEngine_v90he::o90_getSegmentAngle() {
int x1 = pop();
int dy = y1 - pop();
int dx = x1 - pop();
- int a = (int)(atan2((double)dy, (double)dx) * 180. / PI);
+ int a = (int)(atan2((double)dy, (double)dx) * 180. / M_PI);
if (a < 0) {
a += 360;
}
@@ -2292,13 +2292,13 @@ void ScummEngine_v90he::o90_kernelGetFunctions() {
switch (args[0]) {
case 1001:
{
- double b = args[1] * PI / 180.;
+ double b = args[1] * M_PI / 180.;
push((int)(sin(b) * 100000));
}
break;
case 1002:
{
- double b = args[1] * PI / 180.;
+ double b = args[1] * M_PI / 180.;
push((int)(cos(b) * 100000));
}
break;
diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp
index c7e6a56..3d1aa5b 100644
--- a/engines/scumm/he/wiz_he.cpp
+++ b/engines/scumm/he/wiz_he.cpp
@@ -111,7 +111,7 @@ void Wiz::polygonStore(int id, bool flag, int vert1x, int vert1y, int vert2x, in
}
void Wiz::polygonRotatePoints(Common::Point *pts, int num, int angle) {
- double alpha = angle * PI / 180.;
+ double alpha = angle * M_PI / 180.;
double cos_alpha = cos(alpha);
double sin_alpha = sin(alpha);
Commit: 23aabc950a2b8ac2fb986dba1988319246b6881d
https://github.com/scummvm/scummvm/commit/23aabc950a2b8ac2fb986dba1988319246b6881d
Author: md5 (md5 at scummvm.org)
Date: 2011-03-18T17:39:38-07:00
Commit Message:
COMMON: Removed custom PI define (M_PI should be used instead)
Changed paths:
common/scummsys.h
diff --git a/common/scummsys.h b/common/scummsys.h
index a12370c..86493dd 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -410,10 +410,6 @@
#define STRINGBUFLEN 1024
#endif
-#ifndef PI
-#define PI 3.14159265358979323846
-#endif
-
#ifndef MAXPATHLEN
#define MAXPATHLEN 256
#endif
More information about the Scummvm-git-logs
mailing list