[Scummvm-cvs-logs] SF.net SVN: scummvm:[53401] scummvm/trunk/engines/toon
anotherguest at users.sourceforge.net
anotherguest at users.sourceforge.net
Wed Oct 13 09:14:38 CEST 2010
Revision: 53401
http://scummvm.svn.sourceforge.net/scummvm/?rev=53401&view=rev
Author: anotherguest
Date: 2010-10-13 07:14:38 +0000 (Wed, 13 Oct 2010)
Log Message:
-----------
TOON: Updated code to build properly for WINSCW and GCCE(symbian)
Added templates to MAX & MIN functions. Correct usage of OpcodeV2(instead of Opcode)
Match implementation with function definition. (int32 is not == int on all platforms)
Modified Paths:
--------------
scummvm/trunk/engines/toon/audio.cpp
scummvm/trunk/engines/toon/audio.h
scummvm/trunk/engines/toon/character.cpp
scummvm/trunk/engines/toon/path.cpp
scummvm/trunk/engines/toon/script.cpp
scummvm/trunk/engines/toon/script.h
scummvm/trunk/engines/toon/script_func.cpp
scummvm/trunk/engines/toon/script_func.h
scummvm/trunk/engines/toon/toon.cpp
Modified: scummvm/trunk/engines/toon/audio.cpp
===================================================================
--- scummvm/trunk/engines/toon/audio.cpp 2010-10-13 04:13:44 UTC (rev 53400)
+++ scummvm/trunk/engines/toon/audio.cpp 2010-10-13 07:14:38 UTC (rev 53401)
@@ -128,7 +128,7 @@
}
-void AudioManager::playSFX(int32 id, int32 volume , bool genericSFX) {
+void AudioManager::playSFX(int32 id, int volume , bool genericSFX) {
debugC(4, kDebugAudio, "playSFX(%d, %d)", id, (genericSFX) ? 1 : 0);
// find a free SFX channel
@@ -218,7 +218,7 @@
}
}
-int32 AudioStreamInstance::readBuffer(int16 *buffer, const int numSamples) {
+int AudioStreamInstance::readBuffer(int16 *buffer, const int numSamples) {
debugC(5, kDebugAudio, "readBuffer(buffer, %d)", numSamples);
handleFade(numSamples);
@@ -353,7 +353,7 @@
handleFade(0);
}
-void AudioStreamInstance::handleFade(int numSamples) {
+void AudioStreamInstance::handleFade(int32 numSamples) {
debugC(5, kDebugAudio, "handleFade(%d)", numSamples);
// Fading enabled only for music
Modified: scummvm/trunk/engines/toon/audio.h
===================================================================
--- scummvm/trunk/engines/toon/audio.h 2010-10-13 04:13:44 UTC (rev 53400)
+++ scummvm/trunk/engines/toon/audio.h 2010-10-13 07:14:38 UTC (rev 53401)
@@ -54,7 +54,7 @@
void setVolume(int32 volume);
protected:
- int32 readBuffer(int16 *buffer, const int numSamples);
+ int readBuffer(int16 *buffer, const int numSamples);
bool isStereo() const {
return false;
}
Modified: scummvm/trunk/engines/toon/character.cpp
===================================================================
--- scummvm/trunk/engines/toon/character.cpp 2010-10-13 04:13:44 UTC (rev 53400)
+++ scummvm/trunk/engines/toon/character.cpp 2010-10-13 07:14:38 UTC (rev 53401)
@@ -96,8 +96,8 @@
_vm->getPathFinding()->resetBlockingRects();
if (_id == 1) {
- int32 sizeX = MAX(5, 40 * _vm->getDrew()->getScale() / 1024);
- int32 sizeY = MAX(2, 20 * _vm->getDrew()->getScale() / 1024);
+ int32 sizeX = MAX<int32>(5, 40 * _vm->getDrew()->getScale() / 1024);
+ int32 sizeY = MAX<int32>(2, 20 * _vm->getDrew()->getScale() / 1024);
_vm->getPathFinding()->addBlockingEllipse(_vm->getDrew()->getFinalX(), _vm->getDrew()->getFinalY(), sizeX, sizeY);
}
@@ -126,7 +126,7 @@
if (_blockingWalk) {
while ((_x != newPosX || _y != newPosY) && _currentPathNode < _currentPathNodeCount && !_vm->shouldQuitGame()) {
if (_currentPathNode < _currentPathNodeCount - 10) {
- int32 delta = MIN(10, _currentPathNodeCount - _currentPathNode);
+ int32 delta = MIN<int32>(10, _currentPathNodeCount - _currentPathNode);
int32 dx = _currentPathX[_currentPathNode+delta] - _x;
int32 dy = _currentPathY[_currentPathNode+delta] - _y;
setFacing(getFacingFromDirection(dx, dy));
@@ -265,7 +265,7 @@
if ((_flags & 0x1) && _currentPathNodeCount > 0) {
if (_currentPathNode < _currentPathNodeCount) {
if (_currentPathNode < _currentPathNodeCount - 10) {
- int32 delta = MIN(10, _currentPathNodeCount - _currentPathNode);
+ int32 delta = MIN<int32>(10, _currentPathNodeCount - _currentPathNode);
int32 dx = _currentPathX[_currentPathNode+delta] - _x;
int32 dy = _currentPathY[_currentPathNode+delta] - _y;
setFacing(getFacingFromDirection(dx, dy));
Modified: scummvm/trunk/engines/toon/path.cpp
===================================================================
--- scummvm/trunk/engines/toon/path.cpp 2010-10-13 04:13:44 UTC (rev 53400)
+++ scummvm/trunk/engines/toon/path.cpp 2010-10-13 07:14:38 UTC (rev 53401)
@@ -37,13 +37,13 @@
return size;
}
-int PathFindingHeap::unload() {
+int32 PathFindingHeap::unload() {
if (_data)
delete[] _data;
return 0;
}
-int PathFindingHeap::clear() {
+int32 PathFindingHeap::clear() {
//debugC(1, kDebugPath, "clear()");
_count = 0;
@@ -51,7 +51,7 @@
return 1;
}
-int PathFindingHeap::push(int x, int y, int weight) {
+int32 PathFindingHeap::push(int32 x, int32 y, int32 weight) {
//debugC(6, kDebugPath, "push(%d, %d, %d)", x, y, weight);
_count++;
@@ -193,7 +193,7 @@
}
}
-int PathFinding::findPath(int32 x, int32 y, int32 destx, int32 desty) {
+int32 PathFinding::findPath(int32 x, int32 y, int32 destx, int32 desty) {
debugC(1, kDebugPath, "findPath(%d, %d, %d, %d)", x, y, destx, desty);
if (x == destx && y == desty) {
@@ -220,10 +220,10 @@
_heap->pop(&curX, &curY, &curWeight);
int curNode = curX + curY * _width;
- int32 endX = MIN(curX + 1, _width - 1);
- int32 endY = MIN(curY + 1, _height - 1);
- int32 startX = MAX(curX - 1, 0);
- int32 startY = MAX(curY - 1, 0);
+ int32 endX = MIN<int32>(curX + 1, _width - 1);
+ int32 endY = MIN<int32>(curY + 1, _height - 1);
+ int32 startX = MAX<int32>(curX - 1, 0);
+ int32 startY = MAX<int32>(curY - 1, 0);
for (int32 px = startX; px <= endX; px++) {
for (int py = startY; py <= endY; py++) {
@@ -271,10 +271,10 @@
int32 bestX = -1;
int32 bestY = -1;
- int32 endX = MIN(curX + 1, _width - 1);
- int32 endY = MIN(curY + 1, _height - 1);
- int32 startX = MAX(curX - 1, 0);
- int32 startY = MAX(curY - 1, 0);
+ int32 endX = MIN<int32>(curX + 1, _width - 1);
+ int32 endY = MIN<int32>(curY + 1, _height - 1);
+ int32 startX = MAX<int32>(curX - 1, 0);
+ int32 startY = MAX<int32>(curY - 1, 0);
for (int32 px = startX; px <= endX; px++) {
for (int32 py = startY; py <= endY; py++) {
Modified: scummvm/trunk/engines/toon/script.cpp
===================================================================
--- scummvm/trunk/engines/toon/script.cpp 2010-10-13 04:13:44 UTC (rev 53400)
+++ scummvm/trunk/engines/toon/script.cpp 2010-10-13 07:14:38 UTC (rev 53401)
@@ -102,7 +102,7 @@
return false;
}
-bool EMCInterpreter::load(const char *filename, EMCData *scriptData, const Common::Array<const Opcode *> *opcodes) {
+bool EMCInterpreter::load(const char *filename, EMCData *scriptData, const Common::Array<const OpcodeV2 *> *opcodes) {
Common::SeekableReadStream *stream = _vm->resources()->openFile(filename);
if (!stream) {
error("Couldn't open script file '%s'", filename);
Modified: scummvm/trunk/engines/toon/script.h
===================================================================
--- scummvm/trunk/engines/toon/script.h 2010-10-13 04:13:44 UTC (rev 53400)
+++ scummvm/trunk/engines/toon/script.h 2010-10-13 07:14:38 UTC (rev 53401)
@@ -36,7 +36,8 @@
namespace Toon {
struct EMCState;
-typedef Common::Functor1<EMCState *, int> Opcode;
+class ScriptFunc;
+typedef Common::Functor1Mem<EMCState *, int32, ScriptFunc> OpcodeV2;
struct EMCData {
char filename[13];
@@ -46,7 +47,7 @@
uint16 *ordr;
uint16 dataSize;
- const Common::Array<const Opcode *> *sysFuncs;
+ const Common::Array<const OpcodeV2 *> *sysFuncs;
};
struct EMCState {
@@ -98,7 +99,7 @@
public:
EMCInterpreter(ToonEngine *vm);
- bool load(const char *filename, EMCData *data, const Common::Array<const Opcode *> *opcodes);
+ bool load(const char *filename, EMCData *data, const Common::Array<const OpcodeV2 *> *opcodes);
void unload(EMCData *data);
void init(EMCState *scriptState, const EMCData *data);
Modified: scummvm/trunk/engines/toon/script_func.cpp
===================================================================
--- scummvm/trunk/engines/toon/script_func.cpp 2010-10-13 04:13:44 UTC (rev 53400)
+++ scummvm/trunk/engines/toon/script_func.cpp 2010-10-13 07:14:38 UTC (rev 53401)
@@ -34,13 +34,12 @@
namespace Toon {
-typedef Common::Functor1Mem<EMCState *, int32, ScriptFunc> OpcodeV2;
#define SetOpcodeTable(x) table = &x;
#define Opcode(x) table->push_back(new OpcodeV2(this, &ScriptFunc::x))
#define OpcodeUnImpl() table->push_back(new OpcodeV2(this, 0))
ScriptFunc::ScriptFunc(ToonEngine *vm) {
- Common::Array<const Opcode *> *table = 0;
+ Common::Array<const OpcodeV2 *> *table = 0;
_vm = vm;
_opcodes.reserve(176);
Modified: scummvm/trunk/engines/toon/script_func.h
===================================================================
--- scummvm/trunk/engines/toon/script_func.h 2010-10-13 04:13:44 UTC (rev 53400)
+++ scummvm/trunk/engines/toon/script_func.h 2010-10-13 07:14:38 UTC (rev 53401)
@@ -31,12 +31,15 @@
namespace Toon {
+class ScriptFunc;
+typedef Common::Functor1Mem<EMCState *, int32, ScriptFunc> OpcodeV2;
+
class ScriptFunc {
public:
ScriptFunc(ToonEngine *vm);
~ScriptFunc(void);
- Common::Array<const Opcode *> _opcodes;
+ Common::Array<const OpcodeV2 *> _opcodes;
ToonEngine *_vm;
#define SYSFUNC(x) int32 x(EMCState*)
Modified: scummvm/trunk/engines/toon/toon.cpp
===================================================================
--- scummvm/trunk/engines/toon/toon.cpp 2010-10-13 04:13:44 UTC (rev 53400)
+++ scummvm/trunk/engines/toon/toon.cpp 2010-10-13 07:14:38 UTC (rev 53401)
@@ -1099,7 +1099,7 @@
setCursor(5);
}
-void ToonEngine::setCursor(int32 type, bool inventory, int32 offsetX, int32 offsetY) {
+void ToonEngine::setCursor(int32 type, bool inventory, int32 offsetX, int offsetY) {
static const int32 offsets[] = {
0, 1, 1, 6, 7, 1, 8, 10, 18, 10,
@@ -2234,7 +2234,7 @@
return 1;
}
-int ToonEngine::runConversationCommand(int16 **command) {
+int32 ToonEngine::runConversationCommand(int16 **command) {
// Strangerke - Commented (not used)
// int16 com = **command;
@@ -2822,7 +2822,7 @@
_sceneAnimationScripts[i]._active = loadFile->readByte();
_sceneAnimationScripts[i]._frozen = loadFile->readByte();
int32 oldTimer = loadFile->readSint32BE();
- _sceneAnimationScripts[i]._lastTimer = MAX(0,oldTimer + timerDiff);
+ _sceneAnimationScripts[i]._lastTimer = MAX<int32>(0,oldTimer + timerDiff);
_script->loadState(&_sceneAnimationScripts[i]._state, loadFile);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list