diff options
32 files changed, 523 insertions, 726 deletions
diff --git a/engines/tony/custom.cpp b/engines/tony/custom.cpp index 23c655e35a..425899f3ac 100644 --- a/engines/tony/custom.cpp +++ b/engines/tony/custom.cpp @@ -154,7 +154,6 @@ void rightToMe(CORO_PARAM, uint32, uint32, uint32, uint32) { GLOBALS._tony->setPattern(GLOBALS._tony->PAT_STANDRIGHT); } - void tonySetPerorate(CORO_PARAM, uint32 bStatus, uint32, uint32, uint32) { g_vm->getEngine()->setPerorate(bStatus); } @@ -176,7 +175,6 @@ void setAlwaysDisplay(CORO_PARAM, uint32 val, uint32, uint32, uint32) { GLOBALS._bAlwaysDisplay = (val != 0); } - void setPointer(CORO_PARAM, uint32 dwPointer, uint32, uint32, uint32) { switch (dwPointer) { case 1: @@ -215,7 +213,6 @@ VoiceHeader *searchVoiceHeader(uint32 codehi, uint32 codelo) { return NULL; } - void sendTonyMessage(CORO_PARAM, uint32 dwMessage, uint32 nX, uint32 nY, uint32) { CORO_BEGIN_CONTEXT; RMMessage msg; @@ -337,7 +334,6 @@ void changeBoxStatus(CORO_PARAM, uint32 nLoc, uint32 nBox, uint32 nStatus, uint3 GLOBALS._boxes->changeBoxStatus(nLoc, nBox, nStatus); } - void custLoadLocation(CORO_PARAM, uint32 nLoc, uint32 tX, uint32 tY, uint32 bUseStartPos) { CORO_BEGIN_CONTEXT; uint32 h; @@ -360,7 +356,6 @@ void custLoadLocation(CORO_PARAM, uint32 nLoc, uint32 tX, uint32 tY, uint32 bUse CORO_END_CODE; } - void sendFullscreenMsgStart(CORO_PARAM, uint32 nMsg, uint32 nFont, uint32, uint32) { CORO_BEGIN_CONTEXT; RMMessage *msg; @@ -485,7 +480,6 @@ void closeLocation(CORO_PARAM, uint32, uint32, uint32, uint32) { CORO_END_CODE; } - void changeLocation(CORO_PARAM, uint32 nLoc, uint32 tX, uint32 tY, uint32 bUseStartPos) { CORO_BEGIN_CONTEXT; uint32 h; @@ -639,12 +633,10 @@ void tonyGenericPut2(CORO_PARAM, uint32 nDirection) { CORO_END_CODE; } - void tonyTakeUp1(CORO_PARAM, uint32, uint32, uint32, uint32) { tonyGenericTake1(coroParam, 0); } - void tonyTakeMid1(CORO_PARAM, uint32, uint32, uint32, uint32) { tonyGenericTake1(coroParam, 1); } @@ -657,7 +649,6 @@ void tonyTakeUp2(CORO_PARAM, uint32, uint32, uint32, uint32) { tonyGenericTake2(coroParam, 0); } - void tonyTakeMid2(CORO_PARAM, uint32, uint32, uint32, uint32) { tonyGenericTake2(coroParam, 1); } @@ -690,7 +681,6 @@ void tonyPutDown2(CORO_PARAM, uint32, uint32, uint32, uint32) { tonyGenericPut2(coroParam, 2); } - void tonyOnTheFloor(CORO_PARAM, uint32 dwParte, uint32, uint32, uint32) { if (dwParte == 0) GLOBALS._tony->setPattern(GLOBALS._tony->PAT_ONTHEFLOORLEFT); @@ -1032,7 +1022,6 @@ void tonyScaredEnd(CORO_PARAM, uint32, uint32, uint32, uint32) { CORO_END_CODE; } - void tonyDisgusted(CORO_PARAM, uint32 dwText, uint32, uint32, uint32) { tonySetNumTexts(dwText); GLOBALS._nTonyNextTalkType = GLOBALS._tony->TALK_DISGUSTED; @@ -1101,7 +1090,6 @@ void tonyMacbeth(CORO_PARAM, uint32 nPos, uint32, uint32, uint32) { } } - void enableTony(CORO_PARAM, uint32, uint32, uint32, uint32) { GLOBALS._tony->show(); } @@ -1125,7 +1113,6 @@ void waitForPatternEnd(CORO_PARAM, uint32 nItem, uint32, uint32, uint32) { CORO_END_CODE; } - void setTonyPosition(CORO_PARAM, uint32 nX, uint32 nY, uint32 nLoc, uint32) { GLOBALS._tony->setPosition(RMPoint(nX, nY), nLoc); } @@ -1252,17 +1239,14 @@ void syncScrollLocation(CORO_PARAM, uint32 nX, uint32 nY, uint32 sX, uint32 sY) _ctx->pt._y += (_ctx->dimy * _ctx->dwCurTime) / _ctx->dwTotalTime; else _ctx->pt._y -= (_ctx->dimy * _ctx->dwCurTime) / _ctx->dwTotalTime; - } CORO_INVOKE_2(CoroScheduler.waitForSingleObject, g_vm->_hEndOfFrame, CORO_INFINITE); GLOBALS._loc->setScrollPosition(_ctx->pt); GLOBALS._tony->setScrollPosition(_ctx->pt); - } - // Set the position finale if (sX) { if (_ctx->lx > 0) @@ -1282,7 +1266,6 @@ void syncScrollLocation(CORO_PARAM, uint32 nX, uint32 nY, uint32 sX, uint32 sY) CORO_END_CODE; } - void changeHotspot(CORO_PARAM, uint32 dwCode, uint32 nX, uint32 nY, uint32) { int i; @@ -1304,7 +1287,6 @@ void changeHotspot(CORO_PARAM, uint32 dwCode, uint32 nX, uint32 nY, uint32) { GLOBALS._loc->getItemFromCode(dwCode)->changeHotspot(RMPoint(nX, nY)); } - void autoSave(CORO_PARAM, uint32, uint32, uint32, uint32) { g_vm->autoSave(coroParam); } @@ -1476,7 +1458,6 @@ void charSendMessage(CORO_PARAM, uint32 nChar, uint32 dwMessage, uint32 bIsBack, _ctx->voice = NULL; } - GLOBALS._curBackText = NULL; delete _ctx->text; } @@ -1504,7 +1485,6 @@ void changeInventoryStatus(CORO_PARAM, uint32 dwCode, uint32 dwStatus, uint32, u GLOBALS._inventory->changeItemStatus(dwCode, dwStatus); } - /* * Master Characters */ @@ -1535,7 +1515,6 @@ void mCharResetCode(CORO_PARAM, uint32 nChar, uint32, uint32, uint32) { GLOBALS._mCharacter[nChar]._item = GLOBALS._loc->getItemFromCode(GLOBALS._mCharacter[nChar]._code); } - void mCharSetPosition(CORO_PARAM, uint32 nChar, uint32 nX, uint32 nY, uint32) { assert(nChar < 10); GLOBALS._mCharacter[nChar]._x = nX; @@ -1879,7 +1858,6 @@ void sendDialogMessage(CORO_PARAM, uint32 nPers, uint32 nMsg, uint32, uint32) { CORO_END_CODE; } - // @@@@ This cannot be skipped!!!!!!!!!!!!!!!!!!! void startDialog(CORO_PARAM, uint32 nDialog, uint32 nStartGroup, uint32, uint32) { @@ -1960,7 +1938,6 @@ void startDialog(CORO_PARAM, uint32 nDialog, uint32 nStartGroup, uint32, uint32) CORO_END_CODE; } - /* * Sync between idle and mpal */ @@ -2270,7 +2247,6 @@ void doCredits(CORO_PARAM, uint32 nMsg, uint32 dwTime, uint32, uint32) { _ctx->text[_ctx->i].setPosition(RMPoint(260, 70 + _ctx->i * 26)); } - // Set the position _ctx->text[_ctx->i].setAlwaysDisplay(); _ctx->text[_ctx->i].setForcedTime(dwTime * 1000); @@ -2521,8 +2497,6 @@ void setupGlobalVars(RMTony *tony, RMPointer *ptr, RMGameBoxes *box, RMLocation GLOBALS._ambiance[58] = AMBIANCE_WIND; GLOBALS._ambiance[60] = AMBIANCE_WIND; - - // Create an event for the idle skipping GLOBALS._hSkipIdle = CoroScheduler.createEvent(true, false); } diff --git a/engines/tony/debugger.cpp b/engines/tony/debugger.cpp index 85d9469519..84f05b0d25 100644 --- a/engines/tony/debugger.cpp +++ b/engines/tony/debugger.cpp @@ -77,7 +77,6 @@ void DebugChangeScene(CORO_PARAM, const void *param) { CORO_END_CODE; } - /** * This command loads up the specified new scene number */ diff --git a/engines/tony/detection.cpp b/engines/tony/detection.cpp index 8e6d5a64c3..1094950e2c 100644 --- a/engines/tony/detection.cpp +++ b/engines/tony/detection.cpp @@ -90,7 +90,7 @@ public: bool TonyMetaEngine::hasFeature(MetaEngineFeature f) const { return - (f == kSupportsListSaves) || + (f == kSupportsListSaves) || (f == kSupportsLoadingDuringStartup) || (f == kSupportsDeleteSave) || (f == kSavesSupportMetaInfo) || @@ -186,7 +186,6 @@ SaveStateDescriptor TonyMetaEngine::querySaveMetaInfos(const char *target, int s return SaveStateDescriptor(); } - #if PLUGIN_ENABLED_DYNAMIC(TONY) REGISTER_PLUGIN_DYNAMIC(TONY, PLUGIN_TYPE_ENGINE, TonyMetaEngine); #else diff --git a/engines/tony/detection_tables.h b/engines/tony/detection_tables.h index ce3ab01a9f..ee137927dc 100644 --- a/engines/tony/detection_tables.h +++ b/engines/tony/detection_tables.h @@ -75,6 +75,7 @@ static const TonyGameDescription gameDescriptions[] = { GUIO1(GUIO_NONE) }, }, + { // Tony Tough French "Collection Aventure" provided by Strangerke { @@ -91,6 +92,7 @@ static const TonyGameDescription gameDescriptions[] = { GUIO1(GUIO_NONE) }, }, + { // Tony Tough German "Shoe Box" provided by Strangerke { @@ -107,6 +109,7 @@ static const TonyGameDescription gameDescriptions[] = { GUIO1(GUIO_NONE) }, }, + { // Tony Tough Italian provided by Fabio Barzagli { @@ -123,6 +126,7 @@ static const TonyGameDescription gameDescriptions[] = { GUIO1(GUIO_NONE) }, }, + { // Tony Tough Italian provided by Giovanni Bajo { @@ -139,6 +143,7 @@ static const TonyGameDescription gameDescriptions[] = { GUIO1(GUIO_NONE) }, }, + { // Tony Tough Polish provided by Fabio Barzagli { @@ -155,6 +160,7 @@ static const TonyGameDescription gameDescriptions[] = { GUIO1(GUIO_NONE) }, }, + { // Tony Tough German "Gamestar" provided in bug #3566035 { @@ -171,6 +177,7 @@ static const TonyGameDescription gameDescriptions[] = { GUIO1(GUIO_NONE) }, }, + { // Tony Tough Czech provided in bug #3565765 { @@ -188,6 +195,7 @@ static const TonyGameDescription gameDescriptions[] = { GUIO1(GUIO_NONE) }, }, + { AD_TABLE_END_MARKER } }; diff --git a/engines/tony/font.cpp b/engines/tony/font.cpp index fa018b4464..1729052d42 100644 --- a/engines/tony/font.cpp +++ b/engines/tony/font.cpp @@ -81,7 +81,6 @@ void RMFont::unload() { } } - RMGfxPrimitive *RMFont::makeLetterPrimitive(byte bChar, int &nLength) { RMFontPrimitive *prim; @@ -223,7 +222,6 @@ void RMFontDialog::init() { } } - /***************************************************************************\ * RMFontMacc Methods \****************************************************************************/ @@ -278,8 +276,6 @@ void RMFontCredits::init() { } } - - /***************************************************************************\ * RMFontObj Methods \****************************************************************************/ @@ -544,7 +540,6 @@ void RMText::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) { else if (_aHorType == HRIGHT) prim->getDst().topLeft() -= RMPoint(_dimx, 0); - // Vertically if (_aVerType == VTOP) { @@ -627,7 +622,6 @@ void RMTextDialog::writeText(const Common::String &text, RMFontColor *font, int *time = _time; } - void RMTextDialog::setSkipStatus(bool bEnabled) { _bSkipStatus = bEnabled; } @@ -685,6 +679,7 @@ void RMTextDialog::removeThis(CORO_PARAM, bool &result) { } } } + // Erase the background else if (!(GLOBALS._bCfgDubbing && _hCustomSkip2 != CORO_INVALID_PID_VALUE)) { if (!_bForceNoTime) { @@ -805,7 +800,6 @@ void RMTextDialogScrolling::clipOnScreen(RMGfxPrimitive *prim) { // We must not do anything! } - /****************************************************************************\ * RMTextItemName Methods \****************************************************************************/ @@ -866,7 +860,6 @@ void RMTextItemName::doFrame(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMLocation & CORO_END_CODE; } - void RMTextItemName::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) { CORO_BEGIN_CONTEXT; CORO_END_CONTEXT(_ctx); @@ -952,7 +945,6 @@ void RMDialogChoice::init() { setPriority(140); } - void RMDialogChoice::close() { if (_drawedStrings != NULL) { delete[] _drawedStrings; @@ -1116,7 +1108,6 @@ void RMDialogChoice::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive CORO_END_CODE; } - void RMDialogChoice::hide(CORO_PARAM) { CORO_BEGIN_CONTEXT; int deltay; @@ -1145,7 +1136,6 @@ void RMDialogChoice::hide(CORO_PARAM) { CORO_END_CODE; } - void RMDialogChoice::removeThis(CORO_PARAM, bool &result) { result = _bRemoveFromOT; } diff --git a/engines/tony/font.h b/engines/tony/font.h index 13c1ddf268..9ef50b99ec 100644 --- a/engines/tony/font.h +++ b/engines/tony/font.h @@ -104,7 +104,6 @@ public: int stringLen(char bChar, char bNext = 0); }; - class RMFontColor : public virtual RMFont { private: byte _fontR, _fontG, _fontB; @@ -115,7 +114,6 @@ public: virtual void setBaseColor(byte r, byte g, byte b); }; - class RMFontWithTables : public virtual RMFont { protected: int _cTable[256]; @@ -136,7 +134,6 @@ public: virtual ~RMFontWithTables() {} }; - class RMFontDialog : public RMFontColor, public RMFontWithTables { public: void init(); @@ -175,16 +172,16 @@ private: public: enum HorAlign { - HLEFT, - HLEFTPAR, - HCENTER, - HRIGHT + HLEFT, + HLEFTPAR, + HCENTER, + HRIGHT }; enum VerAlign { - VTOP, - VCENTER, - VBOTTOM + VTOP, + VCENTER, + VBOTTOM }; private: @@ -293,7 +290,6 @@ public: virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); }; - /** * Manages the name of a selected item on the screen */ @@ -319,7 +315,6 @@ public: virtual void removeThis(CORO_PARAM, bool &result); }; - /** * Manages the selection of screen items in a box */ diff --git a/engines/tony/game.cpp b/engines/tony/game.cpp index 42ace987b4..501a588ff5 100644 --- a/engines/tony/game.cpp +++ b/engines/tony/game.cpp @@ -164,7 +164,6 @@ RMOptionSlide::RMOptionSlide(const RMPoint &pt, int nRange, int nStartValue, int _pushRight = new RMOptionButton(RMRect(pt._x + _nSlideSize, pt._y, pt._x + _nSlideSize + 5 + 22, pt._y + 26)); } - RMOptionSlide::~RMOptionSlide() { delete _sliderCenter; _sliderCenter = NULL; @@ -973,7 +972,6 @@ void RMOptionScreen::doFrame(CORO_PARAM, RMInput *input) { CORO_BEGIN_CODE(_ctx); - // If it is not fully open, do nothing if (_fadeStep != 6) return; @@ -1043,8 +1041,8 @@ void RMOptionScreen::doFrame(CORO_PARAM, RMInput *input) { } } -#define KEYPRESS(c) (g_vm->getEngine()->getInput().getAsyncKeyState(c)) -#define PROCESS_CHAR(cod, c) if (KEYPRESS(cod)) { \ +#define KEYPRESS(c) (g_vm->getEngine()->getInput().getAsyncKeyState(c)) +#define PROCESS_CHAR(cod, c) if (KEYPRESS(cod)) { \ _editName[strlen(_editName) + 1] = '\0'; _editName[strlen(_editName)] = c; _ctx->bRefresh = true; } // State Buttons @@ -1058,7 +1056,7 @@ void RMOptionScreen::doFrame(CORO_PARAM, RMInput *input) { for (_ctx->i = 0; _ctx->i < 26 && strlen(_editName) < 12; _ctx->i++) { if (KEYPRESS(Common::KEYCODE_LSHIFT) || - KEYPRESS(Common::KEYCODE_RSHIFT)) { + KEYPRESS(Common::KEYCODE_RSHIFT)) { PROCESS_CHAR((Common::KeyCode)((int)'a' + _ctx->i), _ctx->i + 'A'); } else { PROCESS_CHAR((Common::KeyCode)((int)'a' + _ctx->i), _ctx->i + 'a'); @@ -1222,7 +1220,6 @@ void RMOptionScreen::doFrame(CORO_PARAM, RMInput *input) { CORO_END_CODE; } - void RMOptionScreen::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) { CORO_BEGIN_CONTEXT; int curTime; @@ -1233,7 +1230,7 @@ void RMOptionScreen::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive _ctx->curTime = g_vm->getTime(); #define FADE_SPEED 20 -#define SYNC (_ctx->curTime - _fadeTime) / 25 +#define SYNC (_ctx->curTime - _fadeTime) / 25 if (_bExit) return; @@ -1334,7 +1331,6 @@ void RMOptionScreen::removeThis(CORO_PARAM, bool &result) { result = false; } - bool RMOptionScreen::loadThumbnailFromSaveState(int nState, byte *lpDestBuf, Common::String &name, byte &diff) { char namebuf[256]; Common::InSaveFile *f; diff --git a/engines/tony/game.h b/engines/tony/game.h index 83a1ddaea1..fdf62a2a5d 100644 --- a/engines/tony/game.h +++ b/engines/tony/game.h @@ -324,7 +324,6 @@ public: static bool loadThumbnailFromSaveState(int numState, byte *lpDestBuf, Common::String &name, byte &diff); protected: - // Initialization and state change void initState(CORO_PARAM); void closeState(); diff --git a/engines/tony/gfxcore.cpp b/engines/tony/gfxcore.cpp index 04ce01b0ed..ae2019fb3c 100644 --- a/engines/tony/gfxcore.cpp +++ b/engines/tony/gfxcore.cpp @@ -69,7 +69,6 @@ void RMGfxTaskSetPrior::setPriority(int nPrior) { _nPrior = nPrior; } - /****************************************************************************\ * RMGfxBuffer Methods \****************************************************************************/ @@ -109,7 +108,6 @@ void RMGfxBuffer::offsetY(int nLines, int nBpp) { _buf += nLines * getDimx() * nBpp / 8; } - RMGfxBuffer::operator byte *() { return _buf; } @@ -130,7 +128,6 @@ int RMGfxBuffer::getDimy() { return _dimy; } - /****************************************************************************\ * RMGfxSourceBuffer Methods \****************************************************************************/ @@ -223,7 +220,6 @@ void RMGfxSourceBuffer::offsetY(int nLines) { \****************************************************************************/ RMGfxWoodyBuffer::~RMGfxWoodyBuffer() { - } void RMGfxWoodyBuffer::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) { @@ -242,7 +238,6 @@ void RMGfxWoodyBuffer::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitiv } RMGfxWoodyBuffer::RMGfxWoodyBuffer() { - } RMGfxWoodyBuffer::RMGfxWoodyBuffer(int dimx, int dimy) @@ -487,7 +482,6 @@ bool RMGfxTargetBuffer::getTrackDirtyRects() const { \****************************************************************************/ RMGfxSourceBufferPal::~RMGfxSourceBufferPal() { - } int RMGfxSourceBufferPal::loadPaletteWA(const byte *buf, bool bSwapped) { @@ -567,7 +561,6 @@ RMGfxSourceBuffer4::RMGfxSourceBuffer4(int dimx, int dimy) setPriority(0); } - /** * Returns the number of bits per pixel of the surface * @@ -586,7 +579,6 @@ void RMGfxSourceBuffer4::create(int dimx, int dimy) { \****************************************************************************/ RMGfxSourceBuffer8::~RMGfxSourceBuffer8() { - } void RMGfxSourceBuffer8::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) { @@ -659,7 +651,6 @@ RMGfxSourceBuffer8::RMGfxSourceBuffer8(bool bTrasp0) { _bTrasp0 = bTrasp0; } - /** * Returns the number of bits per pixel of the surface * @@ -677,13 +668,11 @@ void RMGfxSourceBuffer8::create(int dimx, int dimy) { #define GETGREEN(x) (((x) >> 5) & 0x1F) #define GETBLUE(x) ((x) & 0x1F) - /****************************************************************************\ * RMGfxSourceBuffer8AB Methods \****************************************************************************/ RMGfxSourceBuffer8AB::~RMGfxSourceBuffer8AB() { - } int RMGfxSourceBuffer8AB::calcTrasp(int fore, int back) { @@ -703,7 +692,6 @@ int RMGfxSourceBuffer8AB::calcTrasp(int fore, int back) { return (r << 10) | (g << 5) | b; } - void RMGfxSourceBuffer8AB::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) { int width, height, u, v; int bufx = bigBuf.getDimx(); @@ -765,8 +753,6 @@ void RMGfxSourceBuffer8AB::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrim bigBuf.addDirtyRect(Common::Rect(dst._x1, dst._y1, dst._x1 + width, dst._y1 + height)); } - - /****************************************************************************\ * RMGfxSourceBuffer8RLE Methods \****************************************************************************/ @@ -792,7 +778,6 @@ RMGfxSourceBuffer8RLE::~RMGfxSourceBuffer8RLE() { } } - int RMGfxSourceBuffer8RLE::init(const byte *buf, int dimx, int dimy, bool bLoadPalette) { return RMGfxSourceBufferPal::init(buf, dimx, dimy, bLoadPalette); } @@ -967,7 +952,6 @@ void RMGfxSourceBuffer8RLE::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPri } } - /****************************************************************************\ * RMGfxSourceBuffer8RLEByte Methods \****************************************************************************/ @@ -1050,7 +1034,6 @@ void RMGfxSourceBuffer8RLEByte::rleDecompressLine(uint16 *dst, byte *src, int nS src += n; } - while (1) { RLEByteDoTrasp: // Get the trasp of s**t @@ -1155,7 +1138,6 @@ void RMGfxSourceBuffer8RLEByte::rleDecompressLineFlipped(uint16 *dst, byte *src, src += n; } - while (1) { RLEByteFlippedDoTrasp: // Get the trasp of s**t @@ -1212,13 +1194,11 @@ RLEByteFlippedDoCopy2: } } - /****************************************************************************\ * RMGfxSourceBuffer8RLEWord Methods \****************************************************************************/ RMGfxSourceBuffer8RLEWord::~RMGfxSourceBuffer8RLEWord() { - } void RMGfxSourceBuffer8RLEWord::rleWriteTrasp(byte *&cur, int rep) { @@ -1299,7 +1279,6 @@ void RMGfxSourceBuffer8RLEWord::rleDecompressLine(uint16 *dst, byte *src, int nS src += n; } - while (1) { RLEWordDoTrasp: // Get the trasp of s**t @@ -1321,7 +1300,6 @@ RLEWordDoAlpha: src += 2; RLEWordDoAlpha2: - if (n > nLength) n = nLength; @@ -1360,7 +1338,6 @@ RLEWordDoCopy2: return; assert(nLength > 0); - } } @@ -1416,7 +1393,6 @@ void RMGfxSourceBuffer8RLEWord::rleDecompressLineFlipped(uint16 *dst, byte *src, src += n; } - while (1) { RLEWordFlippedDoTrasp: // Get the trasp of s**t @@ -1438,7 +1414,6 @@ RLEWordFlippedDoAlpha: src += 2; RLEWordFlippedDoAlpha2: - if (n > nLength) n = nLength; @@ -1485,7 +1460,6 @@ RLEWordFlippedDoCopy2: \****************************************************************************/ RMGfxSourceBuffer8RLEWordAB::~RMGfxSourceBuffer8RLEWordAB() { - } void RMGfxSourceBuffer8RLEWordAB::rleDecompressLine(uint16 *dst, byte *src, int nStartSkip, int nLength) { @@ -1545,7 +1519,6 @@ void RMGfxSourceBuffer8RLEWordAB::rleDecompressLine(uint16 *dst, byte *src, int src += n; } - while (1) { RLEWordDoTrasp: // Get the trasp of s**t @@ -1567,7 +1540,6 @@ RLEWordDoAlpha: src += 2; RLEWordDoAlpha2: - if (n > nLength) n = nLength; @@ -1651,9 +1623,9 @@ void RMGfxSourceBuffer8AA::calculateAA() { for (int x = 0; x < _dimx; x++) { if (*src == 0) { if ((y > 0 && src[-_dimx] != 0) || - (y < _dimy - 1 && src[_dimx] != 0) || - (x > 0 && src[-1] != 0) || - (x < _dimx - 1 && src[1] != 0)) + (y < _dimy - 1 && src[_dimx] != 0) || + (x > 0 && src[-1] != 0) || + (x < _dimx - 1 && src[1] != 0)) *srcaa = 1; } @@ -1668,9 +1640,9 @@ void RMGfxSourceBuffer8AA::calculateAA() { for (int x = 0; x < _dimx; x++) { if (*src != 0) { if ((y > 0 && srcaa[-_dimx] == 1) || - (y < _dimy - 1 && srcaa[_dimx] == 1) || - (x > 0 && srcaa[-1] == 1) || - (x < _dimx - 1 && srcaa[1] == 1)) + (y < _dimy - 1 && srcaa[_dimx] == 1) || + (x > 0 && srcaa[-1] == 1) || + (x < _dimx - 1 && srcaa[1] == 1)) *srcaa = 2; } @@ -1713,7 +1685,6 @@ void RMGfxSourceBuffer8AA::drawAA(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pri src += READ_LE_UINT16(src); // Eliminate horizontal clipping - if (prim->isFlipped()) { u = _dimx - (width + u); x1 = (prim->getDst()._x1 + _dimx - 1) - u; @@ -1728,9 +1699,8 @@ void RMGfxSourceBuffer8AA::drawAA(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pri bigBuf.addDirtyRect(Common::Rect(x1, y1, x1 + width, y1 + height)); } -// width = _dimx; -// x1 = prim->Dst().x1; - + //width = _dimx; + //x1 = prim->Dst().x1; // Position into the destination buffer buf = bigBuf; @@ -1821,8 +1791,6 @@ void RMGfxSourceBuffer8AA::drawAA(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pri } } - - void RMGfxSourceBuffer8AA::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) { CORO_BEGIN_CONTEXT; CORO_END_CONTEXT(_ctx); @@ -1911,7 +1879,6 @@ void RMGfxSourceBuffer8RLEWordAA::init(Common::ReadStream &ds, int dimx, int dim } } - /****************************************************************************\ * RMGfxSourceBuffer16 Methods \****************************************************************************/ @@ -2041,7 +2008,6 @@ void RMGfxBox::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) bigBuf.addDirtyRect(rcDst); } - /****************************************************************************\ * RMGfxClearTask Methods \****************************************************************************/ diff --git a/engines/tony/gfxcore.h b/engines/tony/gfxcore.h index f0deed83ee..1bacf7e5a9 100644 --- a/engines/tony/gfxcore.h +++ b/engines/tony/gfxcore.h @@ -52,7 +52,6 @@ class RMGfxSourceBuffer16; // Source class RMGfxWoodyBuffer; // Source16+Target class RMGfxClearTask; // Task - /** * Graphics buffer */ @@ -126,7 +125,6 @@ public: virtual RMGfxPrimitive *duplicate(); }; - /** * Graphic drawing task */ @@ -149,7 +147,6 @@ public: virtual void unregister(); }; - /** * Graphic drawing with priority */ @@ -159,7 +156,6 @@ public: void setPriority(int nPrior); }; - /** * Task that cleans the destination buffer */ @@ -172,7 +168,6 @@ public: virtual void removeThis(CORO_PARAM, bool &result); }; - /** * Task that draws a colored box */ @@ -188,7 +183,6 @@ public: virtual void removeThis(CORO_PARAM, bool &result); }; - /** * Buffer source for the design, which is a task. This is an abstract base. */ @@ -210,7 +204,6 @@ public: virtual int getBpp() = 0; }; - /** * 16-bit color source */ @@ -231,7 +224,6 @@ public: virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); }; - /** * Buffer source with palette */ @@ -256,7 +248,6 @@ public: int loadPalette(const byte *buf); }; - /** * Buffer source with a 256 color palette */ @@ -276,7 +267,6 @@ public: virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); }; - /** * Buffer source with a 256 color palette, and alpha blending */ @@ -289,7 +279,6 @@ public: virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); }; - /** * Buffer source with a 256 color palette, RLE compressed */ @@ -370,7 +359,6 @@ public: virtual ~RMGfxSourceBuffer8RLEWordAB(); }; - /** * Buffer source with a 256 color palette, with anti-aliasing */ @@ -397,7 +385,6 @@ public: virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); }; - class RMGfxSourceBuffer8RLEByteAA : public RMGfxSourceBuffer8RLEByte, public RMGfxSourceBuffer8AA { protected: void prepareImage(); @@ -426,7 +413,6 @@ public: virtual ~RMGfxSourceBuffer8RLEWordAA(); }; - /** * Source buffer with 16 colors */ @@ -442,7 +428,6 @@ public: virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim); }; - /** * Destination buffer which manages its own internal list of tasks */ @@ -464,7 +449,7 @@ private: void mergeDirtyRects(); private: -// OSystem::MutexRef csModifyingOT; + //OSystem::MutexRef csModifyingOT; protected: OTList *_otlist; @@ -498,7 +483,6 @@ public: bool getTrackDirtyRects() const; }; - /** * Ring buffer, which is both source and by destination */ diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index c81e553770..cb27e20ab1 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -35,7 +35,6 @@ namespace Tony { - /****************************************************************************\ * RMGfxEngine Methods \****************************************************************************/ @@ -261,7 +260,6 @@ SKIPCLICKSINISTRO: } } - // Right Release // ************* if (_input.mouseRightReleased()) { diff --git a/engines/tony/globals.h b/engines/tony/globals.h index d8d8d3eba5..0ff243b374 100644 --- a/engines/tony/globals.h +++ b/engines/tony/globals.h @@ -63,6 +63,7 @@ struct CharacterStruct { f->writeUint32LE(_endTalkPattern); f->writeUint32LE(_numTexts); } + void load(Common::InSaveFile *f) { _code = f->readUint32LE(); f->readUint32LE(); @@ -106,6 +107,7 @@ struct MCharacterStruct { f->writeUint32LE(_curTalk); f->writeByte(_bAlwaysBack); } + void load(Common::InSaveFile *f) { _code = f->readUint32LE(); f->readUint32LE(); @@ -134,6 +136,7 @@ struct ChangedHotspotStruct { f->writeUint32LE(_nX); f->writeUint32LE(_nY); } + void load(Common::InSaveFile *f) { _dwCode = f->readUint32LE(); _nX = f->readUint32LE(); @@ -141,7 +144,6 @@ struct ChangedHotspotStruct { } }; - /** * Description of a call to a custom function. */ @@ -150,7 +152,7 @@ typedef struct { int _arg1, _arg2, _arg3, _arg4; } CfCall; -typedef CfCall *LpCfCall; +typedef CfCall *LpCfCall; struct CoroutineMutex { CoroutineMutex() : _eventId(0), _ownerPid(0), _lockCount(0) { } @@ -173,20 +175,20 @@ public: Common::String _nextMusic; bool _nextLoop; - int _nextChannel; - int _nextSync; - int _curChannel; - int _flipflop; + int _nextChannel; + int _nextSync; + int _curChannel; + int _flipflop; CharacterStruct _character[16]; MCharacterStruct _mCharacter[10]; ChangedHotspotStruct _changedHotspot[256]; bool _isMChar[16]; bool _bAlwaysDisplay; RMPoint _saveTonyPos; - int _saveTonyLoc; + int _saveTonyLoc; RMTextDialog *_curBackText; bool _bTonyIsSpeaking; - int _curChangedHotspot; + int _curChangedHotspot; bool _bCfgInvLocked; bool _bCfgInvNoScroll; bool _bCfgTimerizedText; @@ -199,16 +201,16 @@ public: bool _bCfgDubbing; bool _bCfgMusic; bool _bCfgSFX; - int _nCfgTonySpeed; - int _nCfgTextSpeed; - int _nCfgDubbingVolume; - int _nCfgMusicVolume; - int _nCfgSFXVolume; + int _nCfgTonySpeed; + int _nCfgTextSpeed; + int _nCfgDubbingVolume; + int _nCfgMusicVolume; + int _nCfgSFXVolume; bool _bSkipSfxNoLoop; bool _bIdleExited; bool _bNoBullsEye; - int _curDialog; - int _curSoundEffect; + int _curDialog; + int _curSoundEffect; bool _bFadeOutStop; RMTony *_tony; diff --git a/engines/tony/inventory.cpp b/engines/tony/inventory.cpp index a1f98d88b4..6b023d5990 100644 --- a/engines/tony/inventory.cpp +++ b/engines/tony/inventory.cpp @@ -34,7 +34,6 @@ namespace Tony { - /****************************************************************************\ * RMInventory Methods \****************************************************************************/ @@ -71,7 +70,6 @@ bool RMInventory::checkPointInside(const RMPoint &pt) { return pt._y < 70; } - void RMInventory::init() { // Create the main buffer create(RM_SX, 68); @@ -143,10 +141,9 @@ void RMInventory::init() { RMMessage msg2(13); RMMessage msg3(14); - _hints[0].writeText(msg1[0], 1); // Examine - _hints[1].writeText(msg2[0], 1); // Take - _hints[2].writeText(msg3[0], 1); // Use - + _hints[0].writeText(msg1[0], 1); // Examine + _hints[1].writeText(msg2[0], 1); // Take + _hints[2].writeText(msg3[0], 1); // Use // Prepare initial inventory prepare(); @@ -280,7 +277,6 @@ void RMInventory::changeItemStatus(uint32 code, uint32 dwStatus) { } } - void RMInventory::prepare() { for (int i = 1; i < RM_SX / 64 - 1; i++) { if (i - 1 + _curPos < _nInv) @@ -353,6 +349,7 @@ bool RMInventory::leftClick(const RMPoint &mpos, int &nCombineObj) { clearOT(); g_system->unlockMutex(_csModifyInterface); } + // Click the left arrow else if ((_state == OPENED) && _bBlinkingLeft) { assert(_curPos > 0); @@ -375,7 +372,6 @@ bool RMInventory::leftClick(const RMPoint &mpos, int &nCombineObj) { g_system->unlockMutex(_csModifyInterface); } - return false; } @@ -458,7 +454,7 @@ bool RMInventory::rightRelease(const RMPoint &mpos, RMTonyAction &curAction) { return false; } -#define INVSPEED 20 +#define INVSPEED 20 void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpos, bool bCanOpen) { bool bNeedRedraw = false; @@ -517,7 +513,7 @@ void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo GLOBALS._bCfgInvLocked = !GLOBALS._bCfgInvLocked; } - if (_bCombining) {//m_state == COMBINING) + if (_bCombining) { // m_state == COMBINING) ptr.setCustomPointer(&_items[_nCombine]._pointer[_items[_nCombine]._status - 1]); ptr.setSpecialPointer(RMPointer::PTR_CUSTOM); } @@ -867,7 +863,7 @@ bool RMInterface::released(const RMPoint &mousepos, RMTonyAction &action) { action = TA_PERORATE; break; - default: // No verb + default: // No verb return false; } @@ -902,8 +898,8 @@ void RMInterface::init() { _hotzone[i].loadPaletteWA(pal); } - _hotbbox[0].setRect(126, 123, 159, 208); // Take - _hotbbox[1].setRect(90, 130, 125, 186); // About + _hotbbox[0].setRect(126, 123, 159, 208); // Take + _hotbbox[1].setRect(90, 130, 125, 186); // About _hotbbox[2].setRect(110, 60, 152, 125); _hotbbox[3].setRect(56, 51, 93, 99); _hotbbox[4].setRect(51, 105, 82, 172); @@ -921,11 +917,11 @@ void RMInterface::init() { RMMessage msg3(15); RMMessage msg4(16); - _hints[0].writeText(msg0[0], 1); // Take - _hints[1].writeText(msg1[0], 1); // Talk - _hints[2].writeText(msg2[0], 1); // Use - _hints[3].writeText(msg3[0], 1); // Examine - _hints[4].writeText(msg4[0], 1); // Show Yourself + _hints[0].writeText(msg0[0], 1); // Take + _hints[1].writeText(msg1[0], 1); // Talk + _hints[2].writeText(msg2[0], 1); // Use + _hints[3].writeText(msg3[0], 1); // Examine + _hints[4].writeText(msg4[0], 1); // Show Yourself _bActive = false; _bPerorate = false; diff --git a/engines/tony/inventory.h b/engines/tony/inventory.h index ce94c86c1b..1d660d51cd 100644 --- a/engines/tony/inventory.h +++ b/engines/tony/inventory.h @@ -174,7 +174,6 @@ public: int loadState(byte *state); }; - class RMInterface : public RMGfxSourceBuffer8RLEByte { private: bool _bActive; diff --git a/engines/tony/loc.cpp b/engines/tony/loc.cpp index 18470aa6fc..5beac842f9 100644 --- a/engines/tony/loc.cpp +++ b/engines/tony/loc.cpp @@ -37,7 +37,6 @@ namespace Tony { using namespace ::Tony::MPAL; - /****************************************************************************\ * RMPalette Methods \****************************************************************************/ @@ -65,7 +64,6 @@ void RMPattern::RMSlot::readFromStream(Common::ReadStream &ds, bool bLOX) { _flag = ds.readByte(); } - /****************************************************************************\ * RMPattern Methods \****************************************************************************/ @@ -329,7 +327,6 @@ RMSprite::~RMSprite() { } } - /****************************************************************************\ * RMSfx Methods \****************************************************************************/ @@ -391,8 +388,6 @@ void RMSfx::stop() { } } - - /****************************************************************************\ * RMItem Methods \****************************************************************************/ @@ -553,7 +548,6 @@ void RMItem::readFromStream(Common::SeekableReadStream &ds, bool bLOX) { _bIsActive = mpalQueryItemIsActive(_mpalCode); } - RMGfxPrimitive *RMItem::newItemPrimitive() { return new RMGfxPrimitive(this); } @@ -648,7 +642,6 @@ void RMItem::removeThis(CORO_PARAM, bool &result) { result = (_nCurSprite == -1); } - void RMItem::setStatus(int nStatus) { _bIsActive = (nStatus > 0); } @@ -745,7 +738,6 @@ RMItem::~RMItem() { CoroScheduler.closeEvent(_hEndPattern); } - void RMItem::waitForEndPattern(CORO_PARAM, uint32 hCustomSkip) { CORO_BEGIN_CONTEXT; uint32 h[2]; @@ -784,12 +776,10 @@ void RMItem::pauseSound(bool bPause) { _sfx[i].pause(bPause); } - /****************************************************************************\ * RMWipe Methods \****************************************************************************/ - RMWipe::RMWipe() { _hUnregistered = CoroScheduler.createEvent(false, false); _hEndOfFade = CoroScheduler.createEvent(false, false); @@ -799,7 +789,6 @@ RMWipe::RMWipe() { _bEndFade = false; _bFading = false; _nFadeStep = 0; - } RMWipe::~RMWipe() { @@ -904,10 +893,10 @@ void RMWipe::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) { /****************************************************************************/ short RMCharacter::findPath(short source, short destination) { - static RMBox box[MAXBOXES]; // Matrix of adjacent boxes - static short nodeCost[MAXBOXES]; // Cost per node - static short valid[MAXBOXES]; // 0:Invalid 1:Valid 2:Saturated - static short nextNode[MAXBOXES]; // Next node + static RMBox box[MAXBOXES]; // Matrix of adjacent boxes + static short nodeCost[MAXBOXES]; // Cost per node + static short valid[MAXBOXES]; // 0:Invalid 1:Valid 2:Saturated + static short nextNode[MAXBOXES]; // Next node short minCost, error = 0; RMBoxLoc *cur; @@ -936,19 +925,19 @@ short RMCharacter::findPath(short source, short destination) { // Find the shortest path while (!finish) { - minCost = 32000; // Reset the minimum cost - error = 1; // Possible error + minCost = 32000; // Reset the minimum cost + error = 1; // Possible error // 1st cycle: explore possible new nodes for (int i = 0; i < cur->_numbBox; i++) { if (valid[i] == 1) { - error = 0; // Failure de-bunked + error = 0; // Failure de-bunked int j = 0; while (((box[i]._adj[j]) != 1) && (j < cur->_numbBox)) j++; if (j >= cur->_numbBox) - valid[i] = 2; // nodo saturated? + valid[i] = 2; // nodo saturated? else { nextNode[i] = j; if (nodeCost[i] + 1 < minCost) @@ -958,7 +947,7 @@ short RMCharacter::findPath(short source, short destination) { } if (error) - finish = true; // All nodes saturated + finish = true; // All nodes saturated // 2nd cycle: adding new nodes that were found, saturate old nodes for (int i = 0; i < cur->_numbBox; i++) { @@ -998,7 +987,6 @@ short RMCharacter::findPath(short source, short destination) { return !error; } - void RMCharacter::goTo(CORO_PARAM, RMPoint destcoord, bool bReversed) { CORO_BEGIN_CONTEXT; CORO_END_CONTEXT(_ctx); @@ -1068,7 +1056,6 @@ void RMCharacter::goTo(CORO_PARAM, RMPoint destcoord, bool bReversed) { CORO_END_CODE; } - RMPoint RMCharacter::searching(char UP, char DOWN, char RIGHT, char LEFT, RMPoint point) { short steps; RMPoint newPt, foundPt; @@ -1082,9 +1069,9 @@ RMPoint RMCharacter::searching(char UP, char DOWN, char RIGHT, char LEFT, RMPoin steps++; } if ((inWhichBox(newPt) != -1) && (steps < minStep) && - findPath(inWhichBox(_pos), inWhichBox(newPt))) { + findPath(inWhichBox(_pos), inWhichBox(newPt))) { minStep = steps; - newPt._y--; // to avoid error? + newPt._y--; // to avoid error? foundPt = newPt; } } @@ -1097,9 +1084,9 @@ RMPoint RMCharacter::searching(char UP, char DOWN, char RIGHT, char LEFT, RMPoin steps++; } if ((inWhichBox(newPt) != -1) && (steps < minStep) && - findPath(inWhichBox(_pos), inWhichBox(newPt))) { + findPath(inWhichBox(_pos), inWhichBox(newPt))) { minStep = steps; - newPt._y++; // to avoid error? + newPt._y++; // to avoid error? foundPt = newPt; } } @@ -1112,9 +1099,9 @@ RMPoint RMCharacter::searching(char UP, char DOWN, char RIGHT, char LEFT, RMPoin steps++; } if ((inWhichBox(newPt) != -1) && (steps < minStep) && - findPath(inWhichBox(_pos), inWhichBox(newPt))) { + findPath(inWhichBox(_pos), inWhichBox(newPt))) { minStep = steps; - newPt._x++; // to avoid error? + newPt._x++; // to avoid error? foundPt = newPt; } } @@ -1127,9 +1114,9 @@ RMPoint RMCharacter::searching(char UP, char DOWN, char RIGHT, char LEFT, RMPoin steps++; } if ((inWhichBox(newPt) != -1) && (steps < minStep) && - findPath(inWhichBox(_pos), inWhichBox(newPt))) { + findPath(inWhichBox(_pos), inWhichBox(newPt))) { minStep = steps; - newPt._x--; // to avoid error? + newPt._x--; // to avoid error? foundPt = newPt; } } @@ -1140,12 +1127,10 @@ RMPoint RMCharacter::searching(char UP, char DOWN, char RIGHT, char LEFT, RMPoin return foundPt; } - RMPoint RMCharacter::nearestPoint(const RMPoint &point) { return searching(1, 1, 1, 1, point); } - short RMCharacter::scanLine(const RMPoint &point) { int Ldx, Ldy, Lcount; float Lfx, Lfy, Lslope; @@ -1175,7 +1160,7 @@ short RMCharacter::scanLine(const RMPoint &point) { Lstatus = 0; } - Lscan = Lstart; // Start scanning + Lscan = Lstart; // Start scanning while (inWhichBox(Lscan) != -1) { Lcount++; if (Lstatus) { @@ -1200,8 +1185,8 @@ short RMCharacter::scanLine(const RMPoint &point) { * Calculates intersections between the straight line and the closest BBOX */ RMPoint RMCharacter::invScanLine(const RMPoint &point) { - RMPoint lStart = point; // Exchange! - RMPoint lEnd = _pos; // :-) + RMPoint lStart = point; // Exchange! + RMPoint lEnd = _pos; // :-) int lDx = lStart._x - lEnd._x; int lDy = lStart._y - lEnd._y; float lFx = lDx; @@ -1256,7 +1241,6 @@ RMPoint RMCharacter::invScanLine(const RMPoint &point) { } } - /** * Returns the HotSpot coordinate closest to the player */ @@ -1510,7 +1494,6 @@ inline int RMCharacter::inWhichBox(const RMPoint &pt) { return _theBoxes->whichBox(_curLocation, pt); } - void RMCharacter::move(CORO_PARAM, RMPoint pt, bool *result) { CORO_BEGIN_CONTEXT; RMPoint dest; @@ -1807,7 +1790,7 @@ bool RMGameBoxes::isInBox(int nLoc, int nBox, const RMPoint &pt) { RMBoxLoc *cur = getBoxes(nLoc); if ((pt._x >= cur->_boxes[nBox]._left) && (pt._x <= cur->_boxes[nBox]._right) && - (pt._y >= cur->_boxes[nBox]._top) && (pt._y <= cur->_boxes[nBox]._bottom)) + (pt._y >= cur->_boxes[nBox]._top) && (pt._y <= cur->_boxes[nBox]._bottom)) return true; else return false; @@ -1822,7 +1805,7 @@ int RMGameBoxes::whichBox(int nLoc, const RMPoint &punto) { for (int i = 0; i < cur->_numbBox; i++) { if (cur->_boxes[i]._bActive) { if ((punto._x >= cur->_boxes[i]._left) && (punto._x <= cur->_boxes[i]._right) && - (punto._y >= cur->_boxes[i]._top) && (punto._y <= cur->_boxes[i]._bottom)) + (punto._y >= cur->_boxes[i]._top) && (punto._y <= cur->_boxes[i]._bottom)) return i; } } @@ -1976,7 +1959,7 @@ bool RMLocation::load(Common::SeekableReadStream &ds) { _buf->init(ds, dimx, dimy, true); // Check the size of the location -// assert(dimy!=512); + //assert(dimy!=512); // Number of objects _nItems = ds.readSint32LE(); @@ -1994,7 +1977,6 @@ bool RMLocation::load(Common::SeekableReadStream &ds) { return ds.err(); } - bool RMLocation::loadLOX(Common::SeekableReadStream &ds) { // Version byte ver = ds.readByte(); @@ -2033,7 +2015,6 @@ bool RMLocation::loadLOX(Common::SeekableReadStream &ds) { return ds.err(); } - /** * Draw method overloaded from RMGfxSourceBUffer8 */ @@ -2070,7 +2051,6 @@ void RMLocation::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pri CORO_END_CODE; } - /** * Prepare a frame, adding the location to the OT list, and all the items that have changed animation frame. */ @@ -2084,7 +2064,6 @@ void RMLocation::doFrame(RMGfxTargetBuffer *bigBuf) { _items[i].doFrame(bigBuf); } - RMItem *RMLocation::getItemFromCode(uint32 dwCode) { for (int i = 0; i < _nItems; i++) { if (_items[i].mpalCode() == (int)dwCode) diff --git a/engines/tony/loc.h b/engines/tony/loc.h index 04ba772458..1306316136 100644 --- a/engines/tony/loc.h +++ b/engines/tony/loc.h @@ -49,7 +49,6 @@ typedef enum { CM_65K } RMColorMode; - /****************************************************************************\ * Class declarations \****************************************************************************/ @@ -65,7 +64,6 @@ public: void readFromStream(Common::ReadStream &ds); }; - /** * Sound effect of an object */ @@ -87,7 +85,6 @@ public: void readFromStream(Common::ReadStream &ds, bool bLOX = false); }; - /** * Object pattern */ @@ -126,8 +123,8 @@ public: private: int _speed; - RMPoint _pos; // Parent coordinates - RMPoint _curPos; // Parent + child coordinates + RMPoint _pos; // Parent coordinates + RMPoint _curPos; // Parent + child coordinates int _bLoop; int _nSlots; int _nCurSlot; @@ -160,7 +157,6 @@ private: void updateCoord(); }; - /** * Sprite (frame) animation of an item */ @@ -185,7 +181,6 @@ public: void readFromStream(Common::SeekableReadStream &ds, bool bLOX = false); }; - /** * Data on an item */ @@ -195,7 +190,7 @@ public: protected: int _z; - RMPoint _pos; // Coordinate ancestor + RMPoint _pos; // Coordinate ancestor RMColorMode _cm; RMPoint _curScroll; @@ -285,15 +280,14 @@ protected: virtual RMGfxSourceBuffer *newItemSpriteBuffer(int dimx, int dimy, bool bPreRLE); }; - -#define MAXBOXES 50 // Maximum number of allowed boxes -#define MAXHOTSPOT 20 // Maximum nimber of allowed hotspots +#define MAXBOXES 50 // Maximum number of allowed boxes +#define MAXHOTSPOT 20 // Maximum nimber of allowed hotspots class RMBox { public: struct Hotspot { - int _hotx, _hoty; // Hotspot coordinates - int _destination; // Hotspot destination + int _hotx, _hoty; // Hotspot coordinates + int _destination; // Hotspot destination }; public: @@ -309,7 +303,6 @@ public: void readFromStream(Common::ReadStream &ds); }; - class RMBoxLoc { public: int _numbBox; @@ -454,7 +447,6 @@ public: void setSpeed(int speed); }; - class RMWipe : public RMGfxTask { private: bool _bFading; @@ -483,25 +475,24 @@ public: virtual int priority(); }; - /** * Location */ class RMLocation : public RMGfxTaskSetPrior { public: - Common::String _name; // Name + Common::String _name; // Name private: - RMColorMode _cmode; // Color mode - RMGfxSourceBuffer *_buf; // Location picture + RMColorMode _cmode; // Color mode + RMGfxSourceBuffer *_buf; // Location picture - int _nItems; // Number of objects - RMItem *_items; // Objects + int _nItems; // Number of objects + RMItem *_items; // Objects - RMPoint _curScroll; // Current scroll position + RMPoint _curScroll; // Current scroll position RMPoint _fixedScroll; - RMPoint _prevScroll; // Previous scroll position + RMPoint _prevScroll; // Previous scroll position RMPoint _prevFixedScroll; public: @@ -552,7 +543,6 @@ public: void pauseSound(bool bPause); }; - /** * MPAL message, composed of more ASCIIZ */ diff --git a/engines/tony/mpal/expr.cpp b/engines/tony/mpal/expr.cpp index 824cd91651..7dc640ba7c 100644 --- a/engines/tony/mpal/expr.cpp +++ b/engines/tony/mpal/expr.cpp @@ -35,7 +35,6 @@ namespace Tony { namespace MPAL { - /** * Duplicate a mathematical expression. * @@ -140,7 +139,6 @@ static void solve(LpExpression one, int num) { } } - /** * Calculates the result of a mathematical expression, replacing the current * value of any variable. @@ -178,7 +176,6 @@ static int evaluateAndFreeExpression(byte *expr) { return val; } - /** * Parses a mathematical expression from the MPC file * @@ -249,7 +246,6 @@ const byte *parseExpression(const byte *lpBuf, MpalHandle *h) { return lpBuf; } - /** * Calculate the value of a mathamatical expression * diff --git a/engines/tony/mpal/expr.h b/engines/tony/mpal/expr.h index 405624b4fe..256d09bb9b 100644 --- a/engines/tony/mpal/expr.h +++ b/engines/tony/mpal/expr.h @@ -70,16 +70,16 @@ namespace MPAL { * Mathamatical framework to manage operations */ typedef struct { - byte _type; // Object Type (see enum ExprListTypes) + byte _type; // Object Type (see enum ExprListTypes) union { - int _num; // Identifier (if type == ELT_NUMBER) - char *_name; // Variable name (if type == ELT_VAR) - MpalHandle _son; // Handle expressions (if type == ELT_PARENTH) - byte *_pson; // Handle lockato (if type == ELT_PARENTH2) + int _num; // Identifier (if type == ELT_NUMBER) + char *_name; // Variable name (if type == ELT_VAR) + MpalHandle _son; // Handle expressions (if type == ELT_PARENTH) + byte *_pson; // Handle lockato (if type == ELT_PARENTH2) } _val; - byte _symbol; // Mathematic symbols (see #define OP_*) + byte _symbol; // Mathematic symbols (see #define OP_*) } Expression; typedef Expression *LpExpression; diff --git a/engines/tony/mpal/loadmpc.cpp b/engines/tony/mpal/loadmpc.cpp index 9c45cdf982..4eb84d1406 100644 --- a/engines/tony/mpal/loadmpc.cpp +++ b/engines/tony/mpal/loadmpc.cpp @@ -90,7 +90,7 @@ static const byte *ParseScript(const byte *lpBuf, LpMpalScript lpmsScript) { lpBuf += 4; break; - case 2: { // Variable assign + case 2: { // Variable assign int len = *lpBuf; lpBuf++; lpmsScript->_command[curCmd]._lpszVarName = (char *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, len + 1); @@ -216,6 +216,7 @@ static const byte *parseDialog(const byte *lpBuf, LpMpalDialog lpmdDialog) { return NULL; break; } + // Do Choice case 3: lpmdDialog->_command[curCmd]._nChoice = READ_LE_UINT16(lpBuf); @@ -317,7 +318,6 @@ static const byte *parseDialog(const byte *lpBuf, LpMpalDialog lpmdDialog) { return lpBuf; } - /** * Parses an item from the MPC file, and inserts its data into a structure * @@ -384,7 +384,7 @@ static const byte *parseItem(const byte *lpBuf, LpMpalItem lpmiItem) { lpmiItem->_command[curCmd]._type = *lpBuf; lpBuf++; switch (lpmiItem->_command[curCmd]._type) { - case 1: // Call custom function + case 1: // Call custom function lpmiItem->_command[curCmd]._nCf = READ_LE_UINT16(lpBuf); lpBuf += 2; lpmiItem->_command[curCmd]._arg1 = (int32)READ_LE_UINT32(lpBuf); @@ -397,7 +397,7 @@ static const byte *parseItem(const byte *lpBuf, LpMpalItem lpmiItem) { lpBuf += 4; break; - case 2: // Variable assign + case 2: // Variable assign len = *lpBuf; lpBuf++; lpmiItem->_command[curCmd]._lpszVarName = (char *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, len + 1); @@ -498,7 +498,6 @@ static const byte *ParseLocation(const byte *lpBuf, LpMpalLocation lpmlLocation) return lpBuf; } - /****************************************************************************\ * Exported functions \****************************************************************************/ @@ -539,7 +538,7 @@ bool parseMpc(const byte *lpBuf) { GLOBALS._lpmvVars->_dwVal = READ_LE_UINT32(lpBuf); lpBuf += 4; - lpBuf++; // Skip 'ext' + lpBuf++; // Skip 'ext' GLOBALS._lpmvVars++; } diff --git a/engines/tony/mpal/lzo.cpp b/engines/tony/mpal/lzo.cpp index 3d0751a5ca..a04a769528 100644 --- a/engines/tony/mpal/lzo.cpp +++ b/engines/tony/mpal/lzo.cpp @@ -69,440 +69,440 @@ namespace Tony { namespace MPAL { -#define pd(a, b) ((uint32) ((a) - (b))) +#define pd(a, b) ((uint32) ((a) - (b))) -#define TEST_IP (ip < ip_end) -#define TEST_OP 1 -#define NEED_IP(x) ((void) 0) -#define NEED_OP(x) ((void) 0) -#define TEST_LB(m_pos) ((void) 0) +#define TEST_IP (ip < ip_end) +#define TEST_OP 1 +#define NEED_IP(x) ((void) 0) +#define NEED_OP(x) ((void) 0) +#define TEST_LB(m_pos) ((void) 0) -#define M2_MAX_OFFSET 0x0800 +#define M2_MAX_OFFSET 0x0800 #define LZO1X /** * Decompresses an LZO compressed resource */ int lzo1x_decompress(const byte *in, uint32 in_len, byte *out, uint32 *out_len) { - register byte *op; - register const byte *ip; - register uint32 t = 0; + register byte *op; + register const byte *ip; + register uint32 t = 0; #if defined(COPY_DICT) - uint32 m_off; - const byte *dict_end; + uint32 m_off; + const byte *dict_end; #else - register const byte *m_pos; + register const byte *m_pos; #endif - const byte * const ip_end = in + in_len; + const byte * const ip_end = in + in_len; #if defined(HAVE_ANY_OP) - byte * const op_end = out + *out_len; + byte * const op_end = out + *out_len; #endif #if defined(LZO1Z) - uint32 last_m_off = 0; + uint32 last_m_off = 0; #endif #if defined(COPY_DICT) - if (dict) - { - if (dict_len > M4_MAX_OFFSET) - { - dict += dict_len - M4_MAX_OFFSET; - dict_len = M4_MAX_OFFSET; - } - dict_end = dict + dict_len; - } - else - { - dict_len = 0; - dict_end = NULL; - } -#endif - - *out_len = 0; - - op = out; - ip = in; - - if (*ip > 17) - { - t = *ip++ - 17; - if (t < 4) - goto match_next; - assert(t > 0); NEED_OP(t); NEED_IP(t+1); - do *op++ = *ip++; while (--t > 0); - goto first_literal_run; - } - - while (TEST_IP && TEST_OP) - { - t = *ip++; - if (t >= 16) - goto match; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; - NEED_IP(1); - } - t += 15 + *ip++; - } - assert(t > 0); NEED_OP(t+3); NEED_IP(t+4); + if (dict) + { + if (dict_len > M4_MAX_OFFSET) + { + dict += dict_len - M4_MAX_OFFSET; + dict_len = M4_MAX_OFFSET; + } + dict_end = dict + dict_len; + } + else + { + dict_len = 0; + dict_end = NULL; + } +#endif + + *out_len = 0; + + op = out; + ip = in; + + if (*ip > 17) + { + t = *ip++ - 17; + if (t < 4) + goto match_next; + assert(t > 0); NEED_OP(t); NEED_IP(t+1); + do *op++ = *ip++; while (--t > 0); + goto first_literal_run; + } + + while (TEST_IP && TEST_OP) + { + t = *ip++; + if (t >= 16) + goto match; + if (t == 0) + { + NEED_IP(1); + while (*ip == 0) + { + t += 255; + ip++; + NEED_IP(1); + } + t += 15 + *ip++; + } + assert(t > 0); NEED_OP(t+3); NEED_IP(t+4); #if defined(LZO_UNALIGNED_OK_8) && defined(LZO_UNALIGNED_OK_4) - t += 3; - if (t >= 8) do - { - UA_COPY64(op, ip); - op += 8; ip += 8; t -= 8; - } while (t >= 8); - if (t >= 4) - { - UA_COPY32(op, ip); - op += 4; ip += 4; t -= 4; - } - if (t > 0) - { - *op++ = *ip++; - if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } - } + t += 3; + if (t >= 8) do + { + UA_COPY64(op, ip); + op += 8; ip += 8; t -= 8; + } while (t >= 8); + if (t >= 4) + { + UA_COPY32(op, ip); + op += 4; ip += 4; t -= 4; + } + if (t > 0) + { + *op++ = *ip++; + if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } + } #elif defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) #if !defined(LZO_UNALIGNED_OK_4) - if (PTR_ALIGNED2_4(op, ip)) - { -#endif - UA_COPY32(op, ip); - op += 4; ip += 4; - if (--t > 0) - { - if (t >= 4) - { - do { - UA_COPY32(op, ip); - op += 4; ip += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *ip++; while (--t > 0); - } - else - do *op++ = *ip++; while (--t > 0); - } + if (PTR_ALIGNED2_4(op, ip)) + { +#endif + UA_COPY32(op, ip); + op += 4; ip += 4; + if (--t > 0) + { + if (t >= 4) + { + do { + UA_COPY32(op, ip); + op += 4; ip += 4; t -= 4; + } while (t >= 4); + if (t > 0) do *op++ = *ip++; while (--t > 0); + } + else + do *op++ = *ip++; while (--t > 0); + } #if !defined(LZO_UNALIGNED_OK_4) - } - else + } + else #endif #endif #if !defined(LZO_UNALIGNED_OK_4) && !defined(LZO_UNALIGNED_OK_8) - { - *op++ = *ip++; *op++ = *ip++; *op++ = *ip++; - do *op++ = *ip++; while (--t > 0); - } + { + *op++ = *ip++; *op++ = *ip++; *op++ = *ip++; + do *op++ = *ip++; while (--t > 0); + } #endif first_literal_run: - t = *ip++; - if (t >= 16) - goto match; + t = *ip++; + if (t >= 16) + goto match; #if defined(COPY_DICT) #if defined(LZO1Z) - m_off = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); - last_m_off = m_off; + m_off = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); + last_m_off = m_off; #else - m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2); + m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2); #endif - NEED_OP(3); - t = 3; COPY_DICT(t, m_off) + NEED_OP(3); + t = 3; COPY_DICT(t, m_off) #else #if defined(LZO1Z) - t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); - m_pos = op - t; - last_m_off = t; + t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); + m_pos = op - t; + last_m_off = t; #else - m_pos = op - (1 + M2_MAX_OFFSET); - m_pos -= t >> 2; - m_pos -= *ip++ << 2; + m_pos = op - (1 + M2_MAX_OFFSET); + m_pos -= t >> 2; + m_pos -= *ip++ << 2; #endif - TEST_LB(m_pos); NEED_OP(3); - *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos; + TEST_LB(m_pos); NEED_OP(3); + *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos; #endif - goto match_done; + goto match_done; - do { + do { match: - if (t >= 64) - { + if (t >= 64) + { #if defined(COPY_DICT) #if defined(LZO1X) - m_off = 1 + ((t >> 2) & 7) + (*ip++ << 3); - t = (t >> 5) - 1; + m_off = 1 + ((t >> 2) & 7) + (*ip++ << 3); + t = (t >> 5) - 1; #elif defined(LZO1Y) - m_off = 1 + ((t >> 2) & 3) + (*ip++ << 2); - t = (t >> 4) - 3; + m_off = 1 + ((t >> 2) & 3) + (*ip++ << 2); + t = (t >> 4) - 3; #elif defined(LZO1Z) - m_off = t & 0x1f; - if (m_off >= 0x1c) - m_off = last_m_off; - else - { - m_off = 1 + (m_off << 6) + (*ip++ >> 2); - last_m_off = m_off; - } - t = (t >> 5) - 1; + m_off = t & 0x1f; + if (m_off >= 0x1c) + m_off = last_m_off; + else + { + m_off = 1 + (m_off << 6) + (*ip++ >> 2); + last_m_off = m_off; + } + t = (t >> 5) - 1; #endif #else #if defined(LZO1X) - m_pos = op - 1; - m_pos -= (t >> 2) & 7; - m_pos -= *ip++ << 3; - t = (t >> 5) - 1; + m_pos = op - 1; + m_pos -= (t >> 2) & 7; + m_pos -= *ip++ << 3; + t = (t >> 5) - 1; #elif defined(LZO1Y) - m_pos = op - 1; - m_pos -= (t >> 2) & 3; - m_pos -= *ip++ << 2; - t = (t >> 4) - 3; + m_pos = op - 1; + m_pos -= (t >> 2) & 3; + m_pos -= *ip++ << 2; + t = (t >> 4) - 3; #elif defined(LZO1Z) - { - uint32 off = t & 0x1f; - m_pos = op; - if (off >= 0x1c) - { - assert(last_m_off > 0); - m_pos -= last_m_off; - } - else - { - off = 1 + (off << 6) + (*ip++ >> 2); - m_pos -= off; - last_m_off = off; - } - } - t = (t >> 5) - 1; -#endif - TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); - goto copy_match; -#endif - } - else if (t >= 32) - { - t &= 31; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; - NEED_IP(1); - } - t += 31 + *ip++; - } + { + uint32 off = t & 0x1f; + m_pos = op; + if (off >= 0x1c) + { + assert(last_m_off > 0); + m_pos -= last_m_off; + } + else + { + off = 1 + (off << 6) + (*ip++ >> 2); + m_pos -= off; + last_m_off = off; + } + } + t = (t >> 5) - 1; +#endif + TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); + goto copy_match; +#endif + } + else if (t >= 32) + { + t &= 31; + if (t == 0) + { + NEED_IP(1); + while (*ip == 0) + { + t += 255; + ip++; + NEED_IP(1); + } + t += 31 + *ip++; + } #if defined(COPY_DICT) #if defined(LZO1Z) - m_off = 1 + (ip[0] << 6) + (ip[1] >> 2); - last_m_off = m_off; + m_off = 1 + (ip[0] << 6) + (ip[1] >> 2); + last_m_off = m_off; #else - m_off = 1 + (ip[0] >> 2) + (ip[1] << 6); + m_off = 1 + (ip[0] >> 2) + (ip[1] << 6); #endif #else #if defined(LZO1Z) - { - uint32 off = 1 + (ip[0] << 6) + (ip[1] >> 2); - m_pos = op - off; - last_m_off = off; - } + { + uint32 off = 1 + (ip[0] << 6) + (ip[1] >> 2); + m_pos = op - off; + last_m_off = off; + } #elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) - m_pos = op - 1; - m_pos -= UA_GET16(ip) >> 2; + m_pos = op - 1; + m_pos -= UA_GET16(ip) >> 2; #else - m_pos = op - 1; - m_pos -= (ip[0] >> 2) + (ip[1] << 6); + m_pos = op - 1; + m_pos -= (ip[0] >> 2) + (ip[1] << 6); #endif #endif - ip += 2; - } - else if (t >= 16) - { + ip += 2; + } + else if (t >= 16) + { #if defined(COPY_DICT) - m_off = (t & 8) << 11; + m_off = (t & 8) << 11; #else - m_pos = op; - m_pos -= (t & 8) << 11; -#endif - t &= 7; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; - NEED_IP(1); - } - t += 7 + *ip++; - } + m_pos = op; + m_pos -= (t & 8) << 11; +#endif + t &= 7; + if (t == 0) + { + NEED_IP(1); + while (*ip == 0) + { + t += 255; + ip++; + NEED_IP(1); + } + t += 7 + *ip++; + } #if defined(COPY_DICT) #if defined(LZO1Z) - m_off += (ip[0] << 6) + (ip[1] >> 2); + m_off += (ip[0] << 6) + (ip[1] >> 2); #else - m_off += (ip[0] >> 2) + (ip[1] << 6); + m_off += (ip[0] >> 2) + (ip[1] << 6); #endif - ip += 2; - if (m_off == 0) - goto eof_found; - m_off += 0x4000; + ip += 2; + if (m_off == 0) + goto eof_found; + m_off += 0x4000; #if defined(LZO1Z) - last_m_off = m_off; + last_m_off = m_off; #endif #else #if defined(LZO1Z) - m_pos -= (ip[0] << 6) + (ip[1] >> 2); + m_pos -= (ip[0] << 6) + (ip[1] >> 2); #elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) - m_pos -= UA_GET16(ip) >> 2; + m_pos -= UA_GET16(ip) >> 2; #else - m_pos -= (ip[0] >> 2) + (ip[1] << 6); + m_pos -= (ip[0] >> 2) + (ip[1] << 6); #endif - ip += 2; - if (m_pos == op) - goto eof_found; - m_pos -= 0x4000; + ip += 2; + if (m_pos == op) + goto eof_found; + m_pos -= 0x4000; #if defined(LZO1Z) - last_m_off = pd((const byte *)op, m_pos); + last_m_off = pd((const byte *)op, m_pos); #endif #endif - } - else - { + } + else + { #if defined(COPY_DICT) #if defined(LZO1Z) - m_off = 1 + (t << 6) + (*ip++ >> 2); - last_m_off = m_off; + m_off = 1 + (t << 6) + (*ip++ >> 2); + last_m_off = m_off; #else - m_off = 1 + (t >> 2) + (*ip++ << 2); + m_off = 1 + (t >> 2) + (*ip++ << 2); #endif - NEED_OP(2); - t = 2; COPY_DICT(t, m_off) + NEED_OP(2); + t = 2; COPY_DICT(t, m_off) #else #if defined(LZO1Z) - t = 1 + (t << 6) + (*ip++ >> 2); - m_pos = op - t; - last_m_off = t; + t = 1 + (t << 6) + (*ip++ >> 2); + m_pos = op - t; + last_m_off = t; #else - m_pos = op - 1; - m_pos -= t >> 2; - m_pos -= *ip++ << 2; + m_pos = op - 1; + m_pos -= t >> 2; + m_pos -= *ip++ << 2; #endif - TEST_LB(m_pos); NEED_OP(2); - *op++ = *m_pos++; *op++ = *m_pos; + TEST_LB(m_pos); NEED_OP(2); + *op++ = *m_pos++; *op++ = *m_pos; #endif - goto match_done; - } + goto match_done; + } #if defined(COPY_DICT) - NEED_OP(t+3-1); - t += 3-1; COPY_DICT(t, m_off) + NEED_OP(t+3-1); + t += 3-1; COPY_DICT(t, m_off) #else - TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); + TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); #if defined(LZO_UNALIGNED_OK_8) && defined(LZO_UNALIGNED_OK_4) - if (op - m_pos >= 8) - { - t += (3 - 1); - if (t >= 8) do - { - UA_COPY64(op, m_pos); - op += 8; m_pos += 8; t -= 8; - } while (t >= 8); - if (t >= 4) - { - UA_COPY32(op, m_pos); - op += 4; m_pos += 4; t -= 4; - } - if (t > 0) - { - *op++ = m_pos[0]; - if (t > 1) { *op++ = m_pos[1]; if (t > 2) { *op++ = m_pos[2]; } } - } - } - else + if (op - m_pos >= 8) + { + t += (3 - 1); + if (t >= 8) do + { + UA_COPY64(op, m_pos); + op += 8; m_pos += 8; t -= 8; + } while (t >= 8); + if (t >= 4) + { + UA_COPY32(op, m_pos); + op += 4; m_pos += 4; t -= 4; + } + if (t > 0) + { + *op++ = m_pos[0]; + if (t > 1) { *op++ = m_pos[1]; if (t > 2) { *op++ = m_pos[2]; } } + } + } + else #elif defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) #if !defined(LZO_UNALIGNED_OK_4) - if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op, m_pos)) - { - assert((op - m_pos) >= 4); + if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op, m_pos)) + { + assert((op - m_pos) >= 4); #else - if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) - { -#endif - UA_COPY32(op, m_pos); - op += 4; m_pos += 4; t -= 4 - (3 - 1); - do { - UA_COPY32(op, m_pos); - op += 4; m_pos += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *m_pos++; while (--t > 0); - } - else -#endif - { + if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) + { +#endif + UA_COPY32(op, m_pos); + op += 4; m_pos += 4; t -= 4 - (3 - 1); + do { + UA_COPY32(op, m_pos); + op += 4; m_pos += 4; t -= 4; + } while (t >= 4); + if (t > 0) do *op++ = *m_pos++; while (--t > 0); + } + else +#endif + { copy_match: - *op++ = *m_pos++; *op++ = *m_pos++; - do *op++ = *m_pos++; while (--t > 0); - } + *op++ = *m_pos++; *op++ = *m_pos++; + do *op++ = *m_pos++; while (--t > 0); + } #endif match_done: #if defined(LZO1Z) - t = ip[-1] & 3; + t = ip[-1] & 3; #else - t = ip[-2] & 3; + t = ip[-2] & 3; #endif - if (t == 0) - break; + if (t == 0) + break; match_next: - assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+1); + assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+1); #if 0 - do *op++ = *ip++; while (--t > 0); + do *op++ = *ip++; while (--t > 0); #else - *op++ = *ip++; - if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } + *op++ = *ip++; + if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } #endif - t = *ip++; - } while (TEST_IP && TEST_OP); - } + t = *ip++; + } while (TEST_IP && TEST_OP); + } #if defined(HAVE_TEST_IP) || defined(HAVE_TEST_OP) - *out_len = pd(op, out); - return LZO_E_EOF_NOT_FOUND; + *out_len = pd(op, out); + return LZO_E_EOF_NOT_FOUND; #endif eof_found: - assert(t == 1); - *out_len = pd(op, out); - return (ip == ip_end ? LZO_E_OK : - (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN)); + assert(t == 1); + *out_len = pd(op, out); + return (ip == ip_end ? LZO_E_OK : + (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN)); #if defined(HAVE_NEED_IP) input_overrun: - *out_len = pd(op, out); - return LZO_E_INPUT_OVERRUN; + *out_len = pd(op, out); + return LZO_E_INPUT_OVERRUN; #endif #if defined(HAVE_NEED_OP) output_overrun: - *out_len = pd(op, out); - return LZO_E_OUTPUT_OVERRUN; + *out_len = pd(op, out); + return LZO_E_OUTPUT_OVERRUN; #endif #if defined(LZO_TEST_OVERRUN_LOOKBEHIND) lookbehind_overrun: - *out_len = pd(op, out); - return LZO_E_LOOKBEHIND_OVERRUN; + *out_len = pd(op, out); + return LZO_E_LOOKBEHIND_OVERRUN; #endif } diff --git a/engines/tony/mpal/memory.cpp b/engines/tony/mpal/memory.cpp index dfbf16e789..9737fe0abf 100644 --- a/engines/tony/mpal/memory.cpp +++ b/engines/tony/mpal/memory.cpp @@ -121,7 +121,6 @@ void MemoryManager::unlockItem(MpalHandle handle) { --item->_lockCount; } - } // end of namespace MPAL } // end of namespace Tony diff --git a/engines/tony/mpal/mpal.cpp b/engines/tony/mpal/mpal.cpp index 8d83363c24..1bb288edaf 100644 --- a/engines/tony/mpal/mpal.cpp +++ b/engines/tony/mpal/mpal.cpp @@ -196,7 +196,6 @@ static int locGetOrderFromNum(uint32 nLoc) { return -1; } - /** * Find the index of a message within the messages array * @param nMsg Message number to search for @@ -233,7 +232,6 @@ static int itemGetOrderFromNum(uint32 nItem) { return -1; } - /** * Find the index of a script within the scripts array * @param nScript Script number to search for @@ -252,7 +250,6 @@ static int scriptGetOrderFromNum(uint32 nScript) { return -1; } - /** * Find the index of a dialog within the dialogs array * @param nDialog Dialog number to search for @@ -271,7 +268,6 @@ static int dialogGetOrderFromNum(uint32 nDialog) { return -1; } - /** * Duplicates a message * @param nMsgOrd Index of the message inside the messages array @@ -302,7 +298,6 @@ static char *DuplicateMessage(uint32 nMsgOrd) { return clonemsg; } - /** * Duplicate a sentence of a dialog * @param nDlgOrd Index of the dialog in the dialogs array @@ -340,7 +335,6 @@ static char *duplicateDialogPeriod(uint32 nPeriod) { return NULL; } - /** * Load a resource from the MPR file * @@ -461,16 +455,16 @@ static LpItem getItemData(uint32 nOrdItem) { dat = (char *)globalLock(hDat); if (dat[0] == 'D' && dat[1] == 'A' && dat[2] == 'T') { - int i = dat[3]; // For version 1.0!! + int i = dat[3]; // For version 1.0!! dat += 4; - if (i >= 0x10) { // From 1.0, there's a destination point for each object + if (i >= 0x10) { // From 1.0, there's a destination point for each object ret->_destX = (int16)READ_LE_UINT16(dat); ret->_destY = (int16)READ_LE_UINT16(dat + 2); dat += 4; } - if (i >= 0x11) { // From 1.1, there's animation speed + if (i >= 0x11) { // From 1.1, there's animation speed ret->_speed = READ_LE_UINT16(dat); dat += 2; } else @@ -511,7 +505,7 @@ static LpItem getItemData(uint32 nOrdItem) { for (int i = 1; i < ret->_numpattern; i++) { for (int j = 0; j < patlength[i]; j++) ret->_pattern[i][j] = dat[j]; - ret->_pattern[i][(int)patlength[i]] = 255; // Terminate pattern + ret->_pattern[i][(int)patlength[i]] = 255; // Terminate pattern dat += patlength[i]; } @@ -538,7 +532,6 @@ static LpItem getItemData(uint32 nOrdItem) { return ret; } - /** * Thread that calls a custom function. It is used in scripts, so that each script * function is executed without delaying the others. @@ -562,7 +555,6 @@ void CustomThread(CORO_PARAM, const void *param) { CORO_END_CODE; } - /** * Main process for running a script. * @@ -587,7 +579,7 @@ void ScriptThread(CORO_PARAM, const void *param) { _ctx->dwStartTime = g_vm->getTime(); _ctx->numHandles = 0; -// debugC(DEBUG_BASIC, kTonyDebugMPAL, "PlayScript(): Moments: %u\n", s->_nMoments); + //debugC(DEBUG_BASIC, kTonyDebugMPAL, "PlayScript(): Moments: %u\n", s->_nMoments); for (_ctx->i = 0; _ctx->i < s->_nMoments; _ctx->i++) { // Sleep for the required time if (s->_moment[_ctx->i]._dwTime == -1) { @@ -596,7 +588,7 @@ void ScriptThread(CORO_PARAM, const void *param) { } else { _ctx->dwCurTime = g_vm->getTime(); if (_ctx->dwCurTime < _ctx->dwStartTime + (s->_moment[_ctx->i]._dwTime * 100)) { - // debugC(DEBUG_BASIC, kTonyDebugMPAL, "PlayScript(): Sleeping %lums\n",_ctx->dwStartTime + (s->_moment[_ctx->i]._dwTime*100) - _ctx->dwCurTime); + //debugC(DEBUG_BASIC, kTonyDebugMPAL, "PlayScript(): Sleeping %lums\n",_ctx->dwStartTime + (s->_moment[_ctx->i]._dwTime*100) - _ctx->dwCurTime); CORO_INVOKE_1(CoroScheduler.sleep, _ctx->dwStartTime + (s->_moment[_ctx->i]._dwTime * 100) - _ctx->dwCurTime); } } @@ -655,7 +647,6 @@ void ScriptThread(CORO_PARAM, const void *param) { CORO_END_CODE; } - /** * Thread that performs an action on an item. the thread always executes the action, * so it should create a new item in which the action is the one required. @@ -752,11 +743,9 @@ void ShutUpActionThread(CORO_PARAM, const void *param) { CORO_INVOKE_1(g_vm->loadState, _ctx->slotNumber); } - CORO_END_CODE; } - /** * Polls one location (starting point of a process) * @@ -764,14 +753,14 @@ void ShutUpActionThread(CORO_PARAM, const void *param) { */ void LocationPollThread(CORO_PARAM, const void *param) { typedef struct { - uint32 _nItem, _nAction; + uint32 _nItem, _nAction; - uint16 _wTime; - byte _perc; + uint16 _wTime; + byte _perc; MpalHandle _when; - byte _nCmds; - uint16 _cmdNum[MAX_COMMANDS_PER_ACTION]; - uint32 _dwLastTime; + byte _nCmds; + uint16 _cmdNum[MAX_COMMANDS_PER_ACTION]; + uint32 _dwLastTime; } MYACTION; typedef struct { @@ -862,7 +851,6 @@ void LocationPollThread(CORO_PARAM, const void *param) { return; } - // We have established that there is at least one item that contains idle actions. // Now we created the mirrored copies of the idle actions. _ctx->myActions = (MYACTION *)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, _ctx->nIdleActions * sizeof(MYACTION)); @@ -905,7 +893,6 @@ void LocationPollThread(CORO_PARAM, const void *param) { // We don't need the item list anymore globalDestroy(_ctx->il); - // Here's the main loop while (1) { // Searching for idle actions requiring time to execute @@ -944,7 +931,7 @@ void LocationPollThread(CORO_PARAM, const void *param) { if (_ctx->curTime >= _ctx->myActions[_ctx->k]._dwLastTime + _ctx->myActions[_ctx->k]._wTime) { _ctx->myActions[_ctx->k]._dwLastTime += _ctx->myActions[_ctx->k]._wTime; - // It's time to check to see if fortune is on the side of the idle action + // It's time to check to see if fortune is on the side of the idle action byte randomVal = (byte)g_vm->_randomSource.getRandomNumber(99); if (randomVal < _ctx->myActions[_ctx->k]._perc) { // Check if there is an action running on the item @@ -1016,7 +1003,6 @@ void LocationPollThread(CORO_PARAM, const void *param) { } } - // Set idle skip on CORO_INVOKE_4(GLOBALS._lplpFunctions[200], 0, 0, 0, 0); @@ -1038,7 +1024,6 @@ void LocationPollThread(CORO_PARAM, const void *param) { CORO_END_CODE; } - /** * Wait for the end of the dialog execution thread, and then restore global * variables indicating that the dialogue has finished. @@ -1071,7 +1056,6 @@ void ShutUpDialogThread(CORO_PARAM, const void *param) { void doChoice(CORO_PARAM, uint32 nChoice); - /** * Executes a group of the current dialog. Can 'be the Starting point of a process. * @parm nGroup Number of the group to perform @@ -1149,7 +1133,6 @@ void GroupThread(CORO_PARAM, const void *param) { CORO_END_CODE; } - /** * Make a choice in the current dialog. * @@ -1247,7 +1230,6 @@ void doChoice(CORO_PARAM, uint32 nChoice) { CORO_END_CODE; } - /** * Perform an action on a certain item. * @@ -1353,7 +1335,6 @@ static uint32 doDialog(uint32 nDlgOrd, uint32 nGroup) { return h; } - /** * Takes note of the selection chosen by the user, and warns the process that was running * the box that it can continue. @@ -1379,7 +1360,6 @@ bool doSelection(uint32 i, uint32 dwData) { return true; } - /** * @defgroup Exported functions */ @@ -1884,7 +1864,6 @@ MpalHandle mpalQueryHANDLE(uint16 wQueryType, ...) { return hRet; } - /** * This is a general function to communicate with the library, to request information * about what is in the .MPC file @@ -2005,7 +1984,6 @@ bool mpalStartIdlePoll(int nLoc) { return false; } - /** * Stop processing the idle actions of the items on one location. * @@ -2063,7 +2041,6 @@ void mpalSaveState(byte *buf) { unlockVar(); } - /** * Load a save state from a buffer. * diff --git a/engines/tony/mpal/mpal.h b/engines/tony/mpal/mpal.h index 5e1b02b3fc..779bdd6188 100644 --- a/engines/tony/mpal/mpal.h +++ b/engines/tony/mpal/mpal.h @@ -26,7 +26,6 @@ * Copyright (c) 1997-2003 Nayma Software */ - /****************************************************************************\ * General Introduction \****************************************************************************/ @@ -56,7 +55,6 @@ * */ - /****************************************************************************\ * Custom Functions \****************************************************************************/ @@ -96,11 +94,11 @@ namespace MPAL { \****************************************************************************/ // OK value for the error codes -#define OK 0 +#define OK 0 -#define MAXFRAMES 400 // frame animation of an object -#define MAXPATTERN 40 // pattern of animation of an object -#define MAXPOLLINGLOCATIONS 64 +#define MAXFRAMES 400 // frame animation of an object +#define MAXPATTERN 40 // pattern of animation of an object +#define MAXPOLLINGLOCATIONS 64 #define GETARG(type) va_arg(v, type) @@ -108,8 +106,8 @@ namespace MPAL { * Macro for use with queries that may refer to X and Y co-ordinates */ enum QueryCoordinates { - MPQ_X, - MPQ_Y + MPQ_X, + MPQ_Y }; /** @@ -117,55 +115,54 @@ enum QueryCoordinates { * that can do at the library */ enum QueryTypes { - // General Query - MPQ_VERSION = 10, - - MPQ_GLOBAL_VAR = 50, - MPQ_RESOURCE, - MPQ_MESSAGE, - - // Query on leases - MPQ_LOCATION_IMAGE = 100, - MPQ_LOCATION_SIZE, - - // Queries about items - MPQ_ITEM_LIST = 200, - MPQ_ITEM_DATA, - MPQ_ITEM_PATTERN, - MPQ_ITEM_NAME, + // General Query + MPQ_VERSION = 10, + + MPQ_GLOBAL_VAR = 50, + MPQ_RESOURCE, + MPQ_MESSAGE, + + // Query on leases + MPQ_LOCATION_IMAGE = 100, + MPQ_LOCATION_SIZE, + + // Queries about items + MPQ_ITEM_LIST = 200, + MPQ_ITEM_DATA, + MPQ_ITEM_PATTERN, + MPQ_ITEM_NAME, MPQ_ITEM_IS_ACTIVE, - // Query dialog - MPQ_DIALOG_PERIOD = 300, - MPQ_DIALOG_WAITFORCHOICE, - MPQ_DIALOG_SELECTLIST, - MPQ_DIALOG_SELECTION, + // Query dialog + MPQ_DIALOG_PERIOD = 300, + MPQ_DIALOG_WAITFORCHOICE, + MPQ_DIALOG_SELECTLIST, + MPQ_DIALOG_SELECTION, - // Query execution - MPQ_DO_ACTION = 400, - MPQ_DO_DIALOG + // Query execution + MPQ_DO_ACTION = 400, + MPQ_DO_DIALOG }; /** * Framework to manage the animation of an item */ typedef struct { - char *_frames[MAXFRAMES]; - Common::Rect _frameslocations[MAXFRAMES]; - Common::Rect _bbox[MAXFRAMES]; - short _pattern[MAXPATTERN][MAXFRAMES]; - short _speed; - char _numframe; - char _numpattern; - char _curframe; - char _curpattern; - short _destX, _destY; - signed char _destZ; - short _objectID; + char *_frames[MAXFRAMES]; + Common::Rect _frameslocations[MAXFRAMES]; + Common::Rect _bbox[MAXFRAMES]; + short _pattern[MAXPATTERN][MAXFRAMES]; + short _speed; + char _numframe; + char _numpattern; + char _curframe; + char _curpattern; + short _destX, _destY; + signed char _destZ; + short _objectID; } Item; typedef Item *LpItem; - /** * Define a custom function, to use the language MPAL to perform various controls as a result of an action */ @@ -206,7 +203,6 @@ typedef LPITEMIRQFUNCTION* LPLPITEMIRQFUNCTION; #define mpalQueryGlobalVar(lpszVarName) \ mpalQueryDWORD(MPQ_GLOBAL_VAR, (const char *)(lpszVarName)) - /** * Provides access to a resource inside the .MPC file * @@ -216,7 +212,6 @@ typedef LPITEMIRQFUNCTION* LPLPITEMIRQFUNCTION; #define mpalQueryResource(dwResId) \ mpalQueryHANDLE(MPQ_RESOURCE, (uint32)(dwResId)) - /** * Returns a message. * @@ -228,7 +223,6 @@ typedef LPITEMIRQFUNCTION* LPLPITEMIRQFUNCTION; #define mpalQueryMessage(nMsg) \ (char *)mpalQueryHANDLE(MPQ_MESSAGE, (uint32)(nMsg)) - /** * Provides a location image * @return Returns a picture handle @@ -236,7 +230,6 @@ typedef LPITEMIRQFUNCTION* LPLPITEMIRQFUNCTION; #define mpalQueryLocationImage(nLoc) \ mpalQueryHANDLE(MPQ_LOCATION_IMAGE, (uint32)(nLoc)) - /** * Request the x or y size of a location in pixels * @@ -247,7 +240,6 @@ typedef LPITEMIRQFUNCTION* LPLPITEMIRQFUNCTION; #define mpalQueryLocationSize(nLoc, dwCoord) \ mpalQueryDWORD(MPQ_LOCATION_SIZE, (uint32)(nLoc), (uint32)(dwCoord)) - /** * Provides the list of objects in a location. * @@ -258,7 +250,6 @@ typedef LPITEMIRQFUNCTION* LPLPITEMIRQFUNCTION; #define mpalQueryItemList(nLoc) \ (uint32 *)mpalQueryHANDLE(MPQ_ITEM_LIST, (uint32)(nLoc)) - /** * Provides information on an item * @@ -268,7 +259,6 @@ typedef LPITEMIRQFUNCTION* LPLPITEMIRQFUNCTION; #define mpalQueryItemData(nItem) \ (LpItem)mpalQueryHANDLE(MPQ_ITEM_DATA, (uint32)(nItem)) - /** * Provides the current pattern of an item * @@ -279,7 +269,6 @@ typedef LPITEMIRQFUNCTION* LPLPITEMIRQFUNCTION; #define mpalQueryItemPattern(nItem) \ mpalQueryDWORD(MPQ_ITEM_PATTERN, (uint32)(nItem)) - /** * Returns true if an item is active * @@ -289,7 +278,6 @@ typedef LPITEMIRQFUNCTION* LPLPITEMIRQFUNCTION; #define mpalQueryItemIsActive(nItem) \ (bool)mpalQueryDWORD(MPQ_ITEM_IS_ACTIVE, (uint32)(nItem)) - /** * Returns the name of an item * @@ -302,7 +290,6 @@ typedef LPITEMIRQFUNCTION* LPLPITEMIRQFUNCTION; #define mpalQueryItemName(nItem, lpszName) \ mpalQueryHANDLE(MPQ_ITEM_NAME, (uint32)(nItem), (char *)(lpszName)) - /** * Returns a sentence of dialog. * @@ -316,7 +303,6 @@ typedef LPITEMIRQFUNCTION* LPLPITEMIRQFUNCTION; #define mpalQueryDialogPeriod(nPeriod) \ (char *)mpalQueryHANDLE(MPQ_DIALOG_PERIOD, (uint32)(nPeriod)) - /** * Wait until the moment in which the need is signaled to make a choice by the user. * @returns Number of choice to be made, or -1 if the dialogue is finished. @@ -393,7 +379,7 @@ typedef LPITEMIRQFUNCTION* LPLPITEMIRQFUNCTION; * @returns TRUE if all OK, FALSE on failure */ bool mpalInit(const char *lpszFileName, const char *lpszMprFileName, - LPLPCUSTOMFUNCTION lplpcfArray, Common::String *lpcfStrings); + LPLPCUSTOMFUNCTION lplpcfArray, Common::String *lpcfStrings); /** * Frees resources allocated by the MPAL subsystem @@ -476,7 +462,6 @@ bool mpalStartIdlePoll(int nLoc); */ void mpalEndIdlePoll(CORO_PARAM, int nLoc, bool *result); - /** * Load a save state from a buffer. * diff --git a/engines/tony/mpal/mpaldll.h b/engines/tony/mpal/mpaldll.h index 8897096f51..92ddf8fc5a 100644 --- a/engines/tony/mpal/mpaldll.h +++ b/engines/tony/mpal/mpaldll.h @@ -73,7 +73,7 @@ namespace MPAL { * MPAL global variables */ struct MpalVar { - uint32 _dwVal; // Variable value + uint32 _dwVal; // Variable value char _lpszVarName[33]; // Variable name } PACKED_STRUCT; typedef MpalVar *LpMpalVar; @@ -82,8 +82,8 @@ typedef MpalVar *LpMpalVar; * MPAL Messages */ struct MpalMsg { - MpalHandle _hText; // Handle to the message text - uint16 _wNum; // Message number + MpalHandle _hText; // Handle to the message text + uint16 _wNum; // Message number } PACKED_STRUCT; typedef MpalMsg *LpMpalMsg; @@ -91,9 +91,9 @@ typedef MpalMsg *LpMpalMsg; * MPAL Locations */ struct MpalLocation { - uint32 _nObj; // Location number - uint32 _dwXlen, _dwYlen; // Dimensions - uint32 _dwPicRes; // Resource that contains the image + uint32 _nObj; // Location number + uint32 _dwXlen, _dwYlen; // Dimensions + uint32 _dwPicRes; // Resource that contains the image } PACKED_STRUCT; typedef MpalLocation *LpMpalLocation; @@ -110,34 +110,33 @@ struct Command { * #3 -> Making a choice (DIALOG) * */ - byte _type; // Type of control + byte _type; // Type of control union { - int32 _nCf; // Custom function call [#1] - char *_lpszVarName; // Variable name [#2] - int32 _nChoice; // Number of choice you make [#3] + int32 _nCf; // Custom function call [#1] + char *_lpszVarName; // Variable name [#2] + int32 _nChoice; // Number of choice you make [#3] }; union { - int32 _arg1; // Argument for custom function [#1] - MpalHandle _expr; // Expression to assign to a variable [#2] + int32 _arg1; // Argument for custom function [#1] + MpalHandle _expr; // Expression to assign to a variable [#2] }; - int32 _arg2, _arg3, _arg4; // Arguments for custom function [#1] + int32 _arg2, _arg3, _arg4; // Arguments for custom function [#1] } PACKED_STRUCT; - /** * MPAL dialog */ struct MpalDialog { - uint32 _nObj; // Dialog number + uint32 _nObj; // Dialog number struct Command _command[MAX_COMMANDS_PER_DIALOG]; struct { uint16 _num; - byte _nCmds; + byte _nCmds; uint16 _cmdNum[MAX_COMMANDS_PER_GROUP]; } _group[MAX_GROUPS_PER_DIALOG]; @@ -152,7 +151,7 @@ struct MpalDialog { uint32 _dwData; uint16 _wPlayGroup[MAX_PLAYGROUPS_PER_SELECT]; - // Bit 0=endchoice Bit 1=enddialog + // Bit 0=endchoice Bit 1=enddialog byte _attr; // Modified at run-time: 0 if the select is currently disabled, @@ -172,23 +171,22 @@ typedef MpalDialog *LpMpalDialog; * MPAL Item */ struct ItemAction { - byte _num; // Action number - uint16 _wTime; // If idle, the time which must pass - byte _perc; // Percentage of the idle run - MpalHandle _when; // Expression to compute. If != 0, then - // action can be done - uint16 _wParm; // Parameter for action - - byte _nCmds; // Number of commands to be executed - uint32 _cmdNum[MAX_COMMANDS_PER_ACTION]; // Commands to execute + byte _num; // Action number + uint16 _wTime; // If idle, the time which must pass + byte _perc; // Percentage of the idle run + MpalHandle _when; // Expression to compute. If != 0, then action can be done + uint16 _wParm; // Parameter for action + + byte _nCmds; // Number of commands to be executed + uint32 _cmdNum[MAX_COMMANDS_PER_ACTION]; // Commands to execute } PACKED_STRUCT; struct MpalItem { - uint32 _nObj; // Item number + uint32 _nObj; // Item number byte _lpszDescribe[MAX_DESCRIBE_SIZE]; // Name - byte _nActions; // Number of managed actions - uint32 _dwRes; // Resource that contains frames and patterns + byte _nActions; // Number of managed actions + uint32 _dwRes; // Resource that contains frames and patterns struct Command _command[MAX_COMMANDS_PER_ITEM]; @@ -209,14 +207,14 @@ struct MpalScript { struct Command _command[MAX_COMMANDS_PER_SCRIPT]; struct { - int32 _dwTime; - byte _nCmds; + int32 _dwTime; + byte _nCmds; uint32 _cmdNum[MAX_COMMANDS_PER_MOMENT]; } _moment[MAX_MOMENTS_PER_SCRIPT]; } PACKED_STRUCT; -typedef MpalScript *LpMpalScript; +typedef MpalScript *LpMpalScript; #include "common/pack-end.h" @@ -235,7 +233,6 @@ typedef MpalScript *LpMpalScript; */ extern int32 varGetValue(const char *lpszVarName); - /** * Sets the value of a MPAL global variable * @param lpszVarName Name of the variable diff --git a/engines/tony/mpal/mpalutils.h b/engines/tony/mpal/mpalutils.h index d92bb6f9a2..f351f22196 100644 --- a/engines/tony/mpal/mpalutils.h +++ b/engines/tony/mpal/mpalutils.h @@ -38,19 +38,19 @@ namespace MPAL { class RMRes { protected: MpalHandle _h; - byte *_buf; + byte *_buf; public: RMRes(uint32 resID); - virtual ~RMRes(); + virtual ~RMRes(); - // Attributes + // Attributes unsigned int size(); - const byte *dataPointer(); + const byte *dataPointer(); bool isValid(); - // Casting for access to data - operator const byte*(); + // Casting for access to data + operator const byte*(); Common::SeekableReadStream *getReadStream(); }; diff --git a/engines/tony/resid.h b/engines/tony/resid.h index f4d2c9a4fa..0d601b7dd6 100644 --- a/engines/tony/resid.h +++ b/engines/tony/resid.h @@ -30,7 +30,6 @@ #ifndef TONY_RESID_H #define TONY_RESID_H - #define RES_I_INTERFACE 10300 #define RES_I_INTERPAL 10301 #define RES_I_INTERPPAL 10302 @@ -40,16 +39,16 @@ #define RES_I_INTERP4 10306 #define RES_I_INTERP5 10307 -#define RES_I_DLGTEXT 10350 +#define RES_I_DLGTEXT 10350 #define RES_I_DLGTEXTLINE 10351 -#define RES_I_DLGTEXTPAL 10352 +#define RES_I_DLGTEXTPAL 10352 #define RES_I_MINIINTER 10360 -#define RES_P_PAL 10410 -#define RES_P_GO 10400 +#define RES_P_PAL 10410 +#define RES_P_GO 10400 #define RES_P_TAKE 10401 -#define RES_P_USE 10402 +#define RES_P_USE 10402 #define RES_P_EXAM 10403 #define RES_P_TALK 10404 diff --git a/engines/tony/sound.cpp b/engines/tony/sound.cpp index 8697d7ce29..90ae241db0 100644 --- a/engines/tony/sound.cpp +++ b/engines/tony/sound.cpp @@ -45,8 +45,8 @@ namespace Tony { * to the linear scale used by the mixer. */ static int remapVolume(int volume) { - double dsvol = (double)(63 - volume) * -10000.0 / 63.0; - return (int)((double)Audio::Mixer::kMaxChannelVolume * pow(10.0, dsvol / 2000.0) + 0.5); + double dsvol = (double)(63 - volume) * -10000.0 / 63.0; + return (int)((double)Audio::Mixer::kMaxChannelVolume * pow(10.0, dsvol / 2000.0) + 0.5); } /****************************************************************************\ @@ -75,7 +75,6 @@ bool FPSound::init() { * Destroy the object and free the memory * */ - FPSound::~FPSound() { } @@ -86,7 +85,6 @@ FPSound::~FPSound() { * * @returns True is everything is OK, False otherwise */ - bool FPSound::createStream(FPStream **streamPtr) { (*streamPtr) = new FPStream(_soundSupported); @@ -100,7 +98,6 @@ bool FPSound::createStream(FPStream **streamPtr) { * * @returns True is everything is OK, False otherwise */ - bool FPSound::createSfx(FPSfx **sfxPtr) { (*sfxPtr) = new FPSfx(_soundSupported); @@ -112,7 +109,6 @@ bool FPSound::createSfx(FPSfx **sfxPtr) { * * @param volume Volume to set (0-63) */ - void FPSound::setMasterVolume(int volume) { if (!_soundSupported) return; @@ -128,7 +124,6 @@ void FPSound::setMasterVolume(int volume) { * * @param volumePtr Variable that will contain the volume (0-63) */ - void FPSound::getMasterVolume(int *volumePtr) { if (!_soundSupported) return; @@ -143,7 +138,6 @@ void FPSound::getMasterVolume(int *volumePtr) { * create it using FPSound::CreateSfx() * */ - FPSfx::FPSfx(bool soundOn) { _soundSupported = soundOn; _fileLoaded = false; @@ -164,7 +158,6 @@ FPSfx::FPSfx(bool soundOn) { * currently played, and free the memory it uses. * */ - FPSfx::~FPSfx() { if (!_soundSupported) return; @@ -189,7 +182,6 @@ FPSfx::~FPSfx() { * FPSound::CreateStream(). * Object pointers are no longer valid after this call. */ - void FPSfx::release() { delete this; } @@ -231,7 +223,6 @@ bool FPSfx::loadVoiceFromVDB(Common::File &vdbFP) { * * @returns True is everything is OK, False otherwise */ - bool FPSfx::loadFile(const char *fileName, uint32 codec) { if (!_soundSupported) return true; @@ -272,7 +263,6 @@ bool FPSfx::loadFile(const char *fileName, uint32 codec) { * * @returns True is everything is OK, False otherwise */ - bool FPSfx::play() { stop(); // sanity check @@ -307,7 +297,6 @@ bool FPSfx::play() { * * @returns True is everything is OK, False otherwise */ - bool FPSfx::stop() { if (_fileLoaded) { g_system->getMixer()->stopHandle(_handle); @@ -326,7 +315,6 @@ bool FPSfx::stop() { * playing. Any changes made during the play will have * no effect until the sfx is stopped then played again. */ - void FPSfx::setLoop(bool loop) { _loop = loop; } @@ -335,7 +323,6 @@ void FPSfx::setLoop(bool loop) { * Pauses a Sfx. * */ - void FPSfx::setPause(bool pause) { if (_fileLoaded) { if (g_system->getMixer()->isSoundHandleActive(_handle) && (pause ^ _paused)) @@ -351,7 +338,6 @@ void FPSfx::setPause(bool pause) { * @param volume Volume to be set (0-63) * */ - void FPSfx::setVolume(int volume) { if (volume > 63) volume = 63; @@ -389,7 +375,6 @@ void FPSfx::setVolume(int volume) { * @param volumePtr Will contain the current Sfx volume * */ - void FPSfx::getVolume(int *volumePtr) { if (g_system->getMixer()->isSoundHandleActive(_handle)) *volumePtr = _lastVolume; @@ -400,7 +385,6 @@ void FPSfx::getVolume(int *volumePtr) { /** * Returns true if the underlying sound has ended */ - bool FPSfx::endOfBuffer() const { return !g_system->getMixer()->isSoundHandleActive(_handle) && (!_rewindableStream || _rewindableStream->endOfData()); } @@ -456,7 +440,6 @@ FPStream::FPStream(bool soundOn) { * * @remarks It calls CloseFile() if needed. */ - FPStream::~FPStream() { if (!_soundSupported) return; @@ -599,7 +582,6 @@ bool FPStream::play() { * @returns True is everything is OK, False otherwise * */ - bool FPStream::stop() { if (!_soundSupported) return true; @@ -666,7 +648,6 @@ void FPStream::setPause(bool pause) { * @param volume Volume to be set (0-63) * */ - void FPStream::setVolume(int volume) { if (volume > 63) volume = 63; @@ -694,7 +675,6 @@ void FPStream::setVolume(int volume) { * @param volumePtr Variable that will contain the current volume * */ - void FPStream::getVolume(int *volumePtr) { if (g_system->getMixer()->isSoundHandleActive(_handle)) *volumePtr = _lastVolume; diff --git a/engines/tony/tony.cpp b/engines/tony/tony.cpp index 86740c6fe5..43a2f639d9 100644 --- a/engines/tony/tony.cpp +++ b/engines/tony/tony.cpp @@ -732,6 +732,7 @@ uint32 TonyEngine::getTime() { bool TonyEngine::canLoadGameStateCurrently() { return GLOBALS._gfxEngine != NULL && GLOBALS._gfxEngine->canLoadSave(); } + bool TonyEngine::canSaveGameStateCurrently() { return GLOBALS._gfxEngine != NULL && GLOBALS._gfxEngine->canLoadSave(); } diff --git a/engines/tony/tony.h b/engines/tony/tony.h index 332b122923..750673061d 100644 --- a/engines/tony/tony.h +++ b/engines/tony/tony.h @@ -69,7 +69,7 @@ enum { struct TonyGameDescription; -#define MAX_SFX_CHANNELS 32 +#define MAX_SFX_CHANNELS 32 #define TONY_DAT_VER_MAJ 0 #define TONY_DAT_VER_MIN 3 diff --git a/engines/tony/tonychar.cpp b/engines/tony/tonychar.cpp index c7fa1e4a7b..46c018728e 100644 --- a/engines/tony/tonychar.cpp +++ b/engines/tony/tonychar.cpp @@ -120,7 +120,7 @@ void RMTony::init() { void RMTony::close() { // Deallocation of missing item -// _shadow.destroy(); + //_shadow.destroy(); } void RMTony::doFrame(CORO_PARAM, RMGfxTargetBuffer *bigBuf, int curLoc) { @@ -165,7 +165,6 @@ void RMTony::hide(bool bShowShadow) { _bShowShadow = bShowShadow; } - void RMTony::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) { CORO_BEGIN_CONTEXT; CORO_END_CONTEXT(_ctx); @@ -231,7 +230,6 @@ void RMTony::moveAndDoAction(CORO_PARAM, RMPoint dst, RMItem *item, int nAction, CORO_END_CODE; } - void RMTony::executeAction(int nAction, int nActionItem, int nParm) { uint32 pid; @@ -281,7 +279,6 @@ void RMTony::executeAction(int nAction, int nActionItem, int nParm) { } } - void RMTony::stopNoAction(CORO_PARAM) { CORO_BEGIN_CONTEXT; CORO_END_CONTEXT(_ctx); @@ -332,7 +329,6 @@ void RMTony::stop(CORO_PARAM) { CORO_END_CODE; } - int RMTony::getCurPattern() { int nPatt = RMCharacter::getCurPattern(); @@ -394,7 +390,6 @@ void RMTony::setPattern(int nPatt, bool bPlayP0) { RMCharacter::setPattern(nPatt, bPlayP0); } - void RMTony::take(int nWhere, int nPart) { if (nPart == 0) { switch (getCurPattern()) { @@ -469,7 +464,6 @@ void RMTony::take(int nWhere, int nPart) { } } - void RMTony::put(int nWhere, int nPart) { if (nPart == 0) { switch (getCurPattern()) { @@ -543,7 +537,6 @@ void RMTony::put(int nWhere, int nPart) { } } - bool RMTony::startTalkCalculate(CharacterTalkType nTalkType, int &headStartPat, int &bodyStartPat, int &headLoopPat, int &bodyLoopPat) { assert(!_bIsTalking); @@ -1132,7 +1125,6 @@ void RMTony::startTalk(CORO_PARAM, CharacterTalkType nTalkType) { CORO_END_CODE; } - bool RMTony::endTalkCalculate(int &headStandPat, int &headEndPat, int &bodyEndPat, int &finalPat, bool &bStatic) { bodyEndPat = 0; headEndPat = 0; diff --git a/engines/tony/window.cpp b/engines/tony/window.cpp index c9c450424f..61497a8066 100644 --- a/engines/tony/window.cpp +++ b/engines/tony/window.cpp @@ -35,7 +35,6 @@ namespace Tony { - /****************************************************************************\ * RMWindow Methods \****************************************************************************/ @@ -111,7 +110,7 @@ void RMWindow::repaint() { */ void RMWindow::wipeEffect(Common::Rect &rcBoundEllipse) { if ((rcBoundEllipse.left == 0) && (rcBoundEllipse.top == 0) && - (rcBoundEllipse.right == RM_SX) && (rcBoundEllipse.bottom == RM_SY)) { + (rcBoundEllipse.right == RM_SX) && (rcBoundEllipse.bottom == RM_SY)) { // Full screen clear wanted, so use shortcut method g_system->fillScreen(0); } else { diff --git a/engines/tony/window.h b/engines/tony/window.h index 2e8769707f..3874652f64 100644 --- a/engines/tony/window.h +++ b/engines/tony/window.h @@ -46,7 +46,6 @@ public: void grabScreenshot(byte *lpBuf, int dezoom = 1, uint16 *lpDestBuf = NULL); }; - class RMWindow { private: void plotSplices(const byte *lpBuf, const Common::Point ¢er, int x, int y); |