diff options
Diffstat (limited to 'engines/tony')
47 files changed, 219 insertions, 521 deletions
diff --git a/engines/tony/configure.engine b/engines/tony/configure.engine new file mode 100644 index 0000000000..f85f45d158 --- /dev/null +++ b/engines/tony/configure.engine @@ -0,0 +1,3 @@ +# This file is included from the main "configure" script +# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] +add_engine tony "Tony Tough and the Night of Roasted Moths" yes "" "" "16bit" diff --git a/engines/tony/custom.cpp b/engines/tony/custom.cpp index f5c580c8c5..989702cd3c 100644 --- a/engines/tony/custom.cpp +++ b/engines/tony/custom.cpp @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ /* diff --git a/engines/tony/custom.h b/engines/tony/custom.h index 0f1061e8cd..9ba10be28a 100644 --- a/engines/tony/custom.h +++ b/engines/tony/custom.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/tony/debugger.cpp b/engines/tony/debugger.cpp index 84f05b0d25..e192c53d2b 100644 --- a/engines/tony/debugger.cpp +++ b/engines/tony/debugger.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -28,9 +28,9 @@ namespace Tony { Debugger::Debugger() : GUI::Debugger() { - DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit)); - DCmd_Register("scene", WRAP_METHOD(Debugger, Cmd_Scene)); - DCmd_Register("dirty_rects", WRAP_METHOD(Debugger, Cmd_DirtyRects)); + registerCmd("continue", WRAP_METHOD(Debugger, cmdExit)); + registerCmd("scene", WRAP_METHOD(Debugger, Cmd_Scene)); + registerCmd("dirty_rects", WRAP_METHOD(Debugger, Cmd_DirtyRects)); } static int strToInt(const char *s) { @@ -82,13 +82,13 @@ void DebugChangeScene(CORO_PARAM, const void *param) { */ bool Debugger::Cmd_Scene(int argc, const char **argv) { if (argc < 2) { - DebugPrintf("Usage: %s <scene number> [<x> <y>]\n", argv[0]); + debugPrintf("Usage: %s <scene number> [<x> <y>]\n", argv[0]); return true; } int sceneNumber = strToInt(argv[1]); if (sceneNumber >= g_vm->_theBoxes.getLocBoxesCount()) { - DebugPrintf("Invalid scene\n"); + debugPrintf("Invalid scene\n"); return true; } @@ -118,7 +118,7 @@ bool Debugger::Cmd_Scene(int argc, const char **argv) { */ bool Debugger::Cmd_DirtyRects(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Usage; %s [on | off]\n", argv[0]); + debugPrintf("Usage; %s [on | off]\n", argv[0]); return true; } else { g_vm->_window.showDirtyRects(strcmp(argv[1], "on") == 0); diff --git a/engines/tony/debugger.h b/engines/tony/debugger.h index 85ba9d75b6..1db1b460fc 100644 --- a/engines/tony/debugger.h +++ b/engines/tony/debugger.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/tony/detection.cpp b/engines/tony/detection.cpp index d355450153..9bb768d1ed 100644 --- a/engines/tony/detection.cpp +++ b/engines/tony/detection.cpp @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ #include "base/plugins.h" @@ -178,7 +177,7 @@ SaveStateDescriptor TonyMetaEngine::querySaveMetaInfos(const char *target, int s } #if PLUGIN_ENABLED_DYNAMIC(TONY) -REGISTER_PLUGIN_DYNAMIC(TONY, PLUGIN_TYPE_ENGINE, TonyMetaEngine); + REGISTER_PLUGIN_DYNAMIC(TONY, PLUGIN_TYPE_ENGINE, TonyMetaEngine); #else -REGISTER_PLUGIN_STATIC(TONY, PLUGIN_TYPE_ENGINE, TonyMetaEngine); + REGISTER_PLUGIN_STATIC(TONY, PLUGIN_TYPE_ENGINE, TonyMetaEngine); #endif diff --git a/engines/tony/detection_tables.h b/engines/tony/detection_tables.h index ca16495903..28dcaac752 100644 --- a/engines/tony/detection_tables.h +++ b/engines/tony/detection_tables.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -217,7 +217,7 @@ static const TonyGameDescription gameDescriptions[] = { // Tony Tough German "Shoe Box", reported in bug #3582420 { "tony", - 0, + 0, { {"roasted.mpr", 0, "06203dbbc85fdd1e6dc8fc211c1a6207", 135911071}, {"roasted.mpc", 0, "bc3471f098e591dc509dcad401a8d8a5", 389554}, @@ -230,6 +230,23 @@ static const TonyGameDescription gameDescriptions[] = { }, }, + { + // Tony Tough Russian, reported in bug #6589 + { + "tony", + 0, + { + {"roasted.mpr", 0, "06203dbbc85fdd1e6dc8fc211c1a6207", 135911071}, + {"roasted.mpc", 0, "377d6e24adeedc6c5c09c31b92231218", 391536}, + AD_LISTEND + }, + Common::RU_RUS, + Common::kPlatformWindows, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + }, + { AD_TABLE_END_MARKER } }; diff --git a/engines/tony/font.cpp b/engines/tony/font.cpp index 1729052d42..850aff17be 100644 --- a/engines/tony/font.cpp +++ b/engines/tony/font.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/tony/font.h b/engines/tony/font.h index 9ef50b99ec..d52547a58d 100644 --- a/engines/tony/font.h +++ b/engines/tony/font.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -347,6 +347,7 @@ public: virtual ~RMDialogChoice(); // Initialization and closure + using RMGfxWoodyBuffer::init; void init(); void close(); diff --git a/engines/tony/game.cpp b/engines/tony/game.cpp index ca7c07ad8c..c102242dfd 100644 --- a/engines/tony/game.cpp +++ b/engines/tony/game.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -140,8 +140,6 @@ void RMOptionButton::setActiveState(bool bState) { \****************************************************************************/ RMOptionSlide::RMOptionSlide(const RMPoint &pt, int nRange, int nStartValue, int slideSize) { - RMResRaw *raw; - _pos = pt; _nSlideSize = slideSize; _nMax = nRange; @@ -154,6 +152,7 @@ RMOptionSlide::RMOptionSlide(const RMPoint &pt, int nRange, int nStartValue, int _sliderSingle = NULL; // Sliders + RMResRaw *raw; INIT_GFX16_FROMRAW(20029, _sliderCenter); INIT_GFX16_FROMRAW(20030, _sliderLeft); INIT_GFX16_FROMRAW(20031, _sliderRight); @@ -966,6 +965,8 @@ void RMOptionScreen::changeState(CORO_PARAM, OptionScreenState newState) { void RMOptionScreen::doFrame(CORO_PARAM, RMInput *input) { CORO_BEGIN_CONTEXT; bool bLeftClick, bRightClick; + RMResRaw *raw; + RMPoint mousePos; bool bRefresh; int i; diff --git a/engines/tony/game.h b/engines/tony/game.h index fdf62a2a5d..cda07de889 100644 --- a/engines/tony/game.h +++ b/engines/tony/game.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -300,6 +300,7 @@ public: RMOptionScreen(); virtual ~RMOptionScreen(); + using RMGfxWoodyBuffer::init; void init(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool &result); void initLoadMenuOnly(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool bAlternateGfx, bool &result); void initSaveMenuOnly(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool bAlternateGfx, bool &result); diff --git a/engines/tony/gfxcore.cpp b/engines/tony/gfxcore.cpp index 3433ad3024..9254d59df6 100644 --- a/engines/tony/gfxcore.cpp +++ b/engines/tony/gfxcore.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -821,27 +821,24 @@ void RMGfxSourceBuffer8RLE::setAlreadyCompressed() { } void RMGfxSourceBuffer8RLE::compressRLE() { - byte *startline; byte *cur; byte curdata; byte *src; - byte *startsrc; - int rep; // Perform RLE compression for lines cur = _megaRLEBuf; src = _buf; for (int y = 0; y < _dimy; y++) { // Save the beginning of the line - startline = cur; + byte *startline = cur; // Leave space for the length of the line cur += 2; // It starts from the empty space curdata = 0; - rep = 0; - startsrc = src; + int rep = 0; + byte *startsrc = src; for (int x = 0; x < _dimx;) { if ((curdata == 0 && *src == 0) || (curdata == 1 && *src == _alphaBlendColor) || (curdata == 2 && (*src != _alphaBlendColor && *src != 0))) { diff --git a/engines/tony/gfxcore.h b/engines/tony/gfxcore.h index 9e8f5225c0..c9081506d7 100644 --- a/engines/tony/gfxcore.h +++ b/engines/tony/gfxcore.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -71,7 +71,7 @@ public: int getDimy(); // Creation - virtual void create(int dimx, int dimy, int nBpp); + void create(int dimx, int dimy, int nBpp); virtual void destroy(); // These are valid only if the buffer is locked diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 7bb25f59b9..efbf63a6f5 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -352,11 +352,10 @@ void RMGfxEngine::initCustomDll() { } void RMGfxEngine::itemIrq(uint32 dwItem, int nPattern, int nStatus) { - RMItem *item; assert(GLOBALS._gfxEngine); if (GLOBALS._gfxEngine->_bLocationLoaded) { - item = GLOBALS._gfxEngine->_loc.getItemFromCode(dwItem); + RMItem *item = GLOBALS._gfxEngine->_loc.getItemFromCode(dwItem); if (item != NULL) { if (nPattern != -1) { item->setPattern(nPattern, true); @@ -452,8 +451,8 @@ void RMGfxEngine::unloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) { void RMGfxEngine::init() { // Screen loading - RMResRaw *raw; RMGfxSourceBuffer16 *load = NULL; + RMResRaw *raw; INIT_GFX16_FROMRAW(20038, load); _bigBuf.addPrim(new RMGfxPrimitive(load)); _bigBuf.drawOT(Common::nullContext); @@ -722,9 +721,7 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) { if (_ctx->ver >= 5) { // Version 5 - bool bStat = false; - - bStat = _ctx->f->readByte(); + bool bStat = _ctx->f->readByte(); _tony.setShepherdess(bStat); bStat = _ctx->f->readByte(); _inter.setPerorate(bStat); diff --git a/engines/tony/gfxengine.h b/engines/tony/gfxengine.h index ab32a01972..927593a5d3 100644 --- a/engines/tony/gfxengine.h +++ b/engines/tony/gfxengine.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/tony/globals.cpp b/engines/tony/globals.cpp index 8e4ae240a0..ca2b6e72dc 100644 --- a/engines/tony/globals.cpp +++ b/engines/tony/globals.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/tony/globals.h b/engines/tony/globals.h index 0ff243b374..1cff57fd16 100644 --- a/engines/tony/globals.h +++ b/engines/tony/globals.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/tony/input.cpp b/engines/tony/input.cpp index e84da04d97..787fb21f21 100644 --- a/engines/tony/input.cpp +++ b/engines/tony/input.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/tony/input.h b/engines/tony/input.h index 274aa8c491..31acb68eb6 100644 --- a/engines/tony/input.h +++ b/engines/tony/input.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/tony/inventory.cpp b/engines/tony/inventory.cpp index 6b023d5990..974be8b04d 100644 --- a/engines/tony/inventory.cpp +++ b/engines/tony/inventory.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -457,8 +457,6 @@ bool RMInventory::rightRelease(const RMPoint &mpos, RMTonyAction &curAction) { #define INVSPEED 20 void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpos, bool bCanOpen) { - bool bNeedRedraw = false; - if (_state != CLOSED) { // Clean up the OT list g_system->lockMutex(_csModifyInterface); @@ -466,6 +464,8 @@ void RMInventory::doFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo // DoFrame makes all the objects currently in the inventory be displayed // @@@ Maybe we should do all takeable objects? Please does not help + bool bNeedRedraw = false; + for (int i = 0; i < _nInv; i++) { if (_items[_inv[i]]._icon.doFrame(this, false) && (i >= _curPos && i <= _curPos + 7)) bNeedRedraw = true; @@ -698,9 +698,8 @@ int RMInventory::loadState(byte *state) { state += 4; } - int x; for (int i = 0; i < 256; i++) { - x = READ_LE_UINT32(state); + int x = READ_LE_UINT32(state); state += 4; if (i < _nItems) { diff --git a/engines/tony/inventory.h b/engines/tony/inventory.h index 1d660d51cd..5528e6589c 100644 --- a/engines/tony/inventory.h +++ b/engines/tony/inventory.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -101,6 +101,7 @@ public: /** * Initialization and closing */ + using RMGfxWoodyBuffer::init; void init(); void close(); void reset(); @@ -209,6 +210,7 @@ public: /** * Initialization */ + using RMGfxSourceBuffer8RLEByte::init; void init(); void close(); diff --git a/engines/tony/loc.cpp b/engines/tony/loc.cpp index 5beac842f9..09a00deed1 100644 --- a/engines/tony/loc.cpp +++ b/engines/tony/loc.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -892,12 +892,12 @@ void RMWipe::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) { /* Returns path along the vector path path[] */ /****************************************************************************/ -short RMCharacter::findPath(short source, short destination) { +bool 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 - short minCost, error = 0; + bool error = false; RMBoxLoc *cur; g_system->lockMutex(_csMove); @@ -925,13 +925,13 @@ short RMCharacter::findPath(short source, short destination) { // Find the shortest path while (!finish) { - minCost = 32000; // Reset the minimum cost - error = 1; // Possible error + short minCost = 32000; // Reset the minimum cost + error = true; // 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 = false; // Failure de-bunked int j = 0; while (((box[i]._adj[j]) != 1) && (j < cur->_numbBox)) j++; @@ -1851,10 +1851,9 @@ void RMGameBoxes::loadState(byte *state) { assert(nloc <= _nLocBoxes); - int nbox; // For each location, read the number of boxes and their status for (int i = 1; i <= nloc; i++) { - nbox = READ_LE_UINT32(state); + int nbox = READ_LE_UINT32(state); state += 4; for (int j = 0; j < nbox ; j++) { diff --git a/engines/tony/loc.h b/engines/tony/loc.h index 1306316136..ac65a4a0bd 100644 --- a/engines/tony/loc.h +++ b/engines/tony/loc.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -395,7 +395,7 @@ private: private: int inWhichBox(const RMPoint &pt); - short findPath(short source, short destination); + bool findPath(short source, short destination); RMPoint searching(char UP, char DOWN, char RIGHT, char LEFT, RMPoint point); RMPoint nearestPoint(const RMPoint &punto); diff --git a/engines/tony/mpal/expr.cpp b/engines/tony/mpal/expr.cpp index 7dc640ba7c..1fdf637062 100644 --- a/engines/tony/mpal/expr.cpp +++ b/engines/tony/mpal/expr.cpp @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ /* * This code is based on original Tony Tough source code diff --git a/engines/tony/mpal/expr.h b/engines/tony/mpal/expr.h index 256d09bb9b..6ac1963356 100644 --- a/engines/tony/mpal/expr.h +++ b/engines/tony/mpal/expr.h @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ /* * This code is based on original Tony Tough source code diff --git a/engines/tony/mpal/loadmpc.cpp b/engines/tony/mpal/loadmpc.cpp index 4eb84d1406..8d030f1e52 100644 --- a/engines/tony/mpal/loadmpc.cpp +++ b/engines/tony/mpal/loadmpc.cpp @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ /* * This code is based on original Tony Tough source code @@ -139,8 +138,6 @@ static void FreeScript(LpMpalScript lpmsScript) { * @returns Pointer to the buffer after the item, or NULL on failure. */ static const byte *parseDialog(const byte *lpBuf, LpMpalDialog lpmdDialog) { - byte *lpLock; - lpmdDialog->_nObj = READ_LE_UINT32(lpBuf); lpBuf += 4; @@ -156,7 +153,7 @@ static const byte *parseDialog(const byte *lpBuf, LpMpalDialog lpmdDialog) { lpmdDialog->_periodNums[i] = READ_LE_UINT16(lpBuf); lpBuf += 2; lpmdDialog->_periods[i] = globalAllocate(GMEM_MOVEABLE | GMEM_ZEROINIT, *lpBuf + 1); - lpLock = (byte *)globalLock(lpmdDialog->_periods[i]); + byte *lpLock = (byte *)globalLock(lpmdDialog->_periods[i]); Common::copy(lpBuf + 1, lpBuf + 1 + *lpBuf, lpLock); globalUnlock(lpmdDialog->_periods[i]); lpBuf += (*lpBuf) + 1; diff --git a/engines/tony/mpal/loadmpc.h b/engines/tony/mpal/loadmpc.h index 20956288aa..479cf5f99b 100644 --- a/engines/tony/mpal/loadmpc.h +++ b/engines/tony/mpal/loadmpc.h @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ /* * This code is based on original Tony Tough source code diff --git a/engines/tony/mpal/lzo.cpp b/engines/tony/mpal/lzo.cpp index a04a769528..314d6f3ed5 100644 --- a/engines/tony/mpal/lzo.cpp +++ b/engines/tony/mpal/lzo.cpp @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ /* minilzo.c -- mini subset of the LZO real-time data compression library @@ -70,15 +69,9 @@ namespace Tony { namespace MPAL { #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 M2_MAX_OFFSET 0x0800 -#define LZO1X /** * Decompresses an LZO compressed resource @@ -87,425 +80,142 @@ 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; -#if defined(COPY_DICT) - uint32 m_off; - const byte *dict_end; -#else register const byte *m_pos; -#endif const byte * const ip_end = in + in_len; -#if defined(HAVE_ANY_OP) - byte * const op_end = out + *out_len; -#endif -#if defined(LZO1Z) - 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) - { + 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); + assert(t > 0); + do + *op++ = *ip++; + while (--t > 0); goto first_literal_run; } - while (TEST_IP && TEST_OP) - { + while (TEST_IP) { t = *ip++; if (t >= 16) goto match; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { + if (t == 0) { + 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) - { + assert(t > 0); + + *op++ = *ip++; + *op++ = *ip++; + *op++ = *ip++; + do *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 !defined(LZO_UNALIGNED_OK_4) - } - 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); - } -#endif + while (--t > 0); first_literal_run: - 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; -#else - m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2); -#endif - 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; -#else + 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; -#endif + + *op++ = *m_pos++; + *op++ = *m_pos++; + *op++ = *m_pos; + goto match_done; do { match: - if (t >= 64) - { -#if defined(COPY_DICT) -#if defined(LZO1X) - 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; -#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; -#endif -#else -#if defined(LZO1X) + if (t >= 64) { 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; -#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); + assert(t > 0); goto copy_match; -#endif - } - else if (t >= 32) - { + } else if (t >= 32) { t &= 31; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { + if (t == 0) { + 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; -#else - 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; - } -#elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) - m_pos = op - 1; - m_pos -= UA_GET16(ip) >> 2; -#else m_pos = op - 1; m_pos -= (ip[0] >> 2) + (ip[1] << 6); -#endif -#endif ip += 2; - } - else if (t >= 16) - { -#if defined(COPY_DICT) - m_off = (t & 8) << 11; -#else + } else if (t >= 16) { m_pos = op; m_pos -= (t & 8) << 11; -#endif t &= 7; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { + if (t == 0) { + 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); -#else - m_off += (ip[0] >> 2) + (ip[1] << 6); -#endif - ip += 2; - if (m_off == 0) - goto eof_found; - m_off += 0x4000; -#if defined(LZO1Z) - last_m_off = m_off; -#endif -#else -#if defined(LZO1Z) - 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; -#else m_pos -= (ip[0] >> 2) + (ip[1] << 6); -#endif ip += 2; if (m_pos == op) goto eof_found; m_pos -= 0x4000; -#if defined(LZO1Z) - last_m_off = pd((const byte *)op, m_pos); -#endif -#endif - } - else - { -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = 1 + (t << 6) + (*ip++ >> 2); - last_m_off = m_off; -#else - m_off = 1 + (t >> 2) + (*ip++ << 2); -#endif - 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; -#else + } else { 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; -#endif + *op++ = *m_pos++; + *op++ = *m_pos; goto match_done; } -#if defined(COPY_DICT) - - 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); -#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 -#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); -#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 + assert(t > 0); { 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; -#else t = ip[-2] & 3; -#endif if (t == 0) break; match_next: - assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+1); -#if 0 - do *op++ = *ip++; while (--t > 0); -#else + assert(t > 0); + assert(t < 4); *op++ = *ip++; - if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } -#endif + if (t > 1) { + *op++ = *ip++; + if (t > 2) + *op++ = *ip++; + } t = *ip++; - } while (TEST_IP && TEST_OP); + } while (TEST_IP); } -#if defined(HAVE_TEST_IP) || defined(HAVE_TEST_OP) - *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)); -#if defined(HAVE_NEED_IP) -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; -#endif - -#if defined(LZO_TEST_OVERRUN_LOOKBEHIND) -lookbehind_overrun: - *out_len = pd(op, out); - return LZO_E_LOOKBEHIND_OVERRUN; -#endif } } // end of namespace MPAL - } // end of namespace Tony diff --git a/engines/tony/mpal/lzo.h b/engines/tony/mpal/lzo.h index ebb1c4b516..172900f053 100644 --- a/engines/tony/mpal/lzo.h +++ b/engines/tony/mpal/lzo.h @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ /* minilzo.c -- mini subset of the LZO real-time data compression library @@ -76,36 +75,15 @@ namespace MPAL { * normal events. */ #define LZO_E_OK 0 -#define LZO_E_ERROR (-1) -#define LZO_E_OUT_OF_MEMORY (-2) /* [lzo_alloc_func_t failure] */ -#define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */ #define LZO_E_INPUT_OVERRUN (-4) -#define LZO_E_OUTPUT_OVERRUN (-5) -#define LZO_E_LOOKBEHIND_OVERRUN (-6) -#define LZO_E_EOF_NOT_FOUND (-7) #define LZO_E_INPUT_NOT_CONSUMED (-8) -#define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */ -#define LZO_E_INVALID_ARGUMENT (-10) - -#define LZO1X_999_MEM_COMPRESS ((uint32) (14 * 16384L * sizeof(uint16))) /** * Decompresses an LZO compressed resource */ int lzo1x_decompress(const byte *src, uint32 src_len, byte *dst, uint32 *dst_len); -/** - * Comrpess a data block into an LZO stream - */ -int lzo1x_1_compress(const byte *src, uint32 src_len, byte *dst, uint32 *dst_len, void *wrkmem); - -/** - * better compression ratio at the cost of more memory and time - */ -int lzo1x_999_compress(const byte *src, uint32 src_len, byte *dst, uint32 *dst_len, void *wrkmem); - } // end of namespace MPAL - } // end of namespace Tony #endif /* already included */ diff --git a/engines/tony/mpal/memory.cpp b/engines/tony/mpal/memory.cpp index 9737fe0abf..4076f710de 100644 --- a/engines/tony/mpal/memory.cpp +++ b/engines/tony/mpal/memory.cpp @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ #include "common/algorithm.h" diff --git a/engines/tony/mpal/memory.h b/engines/tony/mpal/memory.h index 9c21cc20e6..7739fdfa48 100644 --- a/engines/tony/mpal/memory.h +++ b/engines/tony/mpal/memory.h @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ #ifndef TONY_MPAL_MEMORY diff --git a/engines/tony/mpal/mpal.cpp b/engines/tony/mpal/mpal.cpp index 7010c238b5..c813b354b0 100644 --- a/engines/tony/mpal/mpal.cpp +++ b/engines/tony/mpal/mpal.cpp @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ /* * This code is based on original Tony Tough source code @@ -963,7 +962,7 @@ void LocationPollThread(CORO_PARAM, const void *param) { // Ok, we can perform the action. For convenience, we do it in a new process _ctx->newItem = (LpMpalItem)globalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizeof(MpalItem)); - if (_ctx->newItem == false) { + if (!_ctx->newItem) { globalDestroy(_ctx->myThreads); globalDestroy(_ctx->myActions); @@ -1519,13 +1518,12 @@ void mpalFree() { * * @param wQueryType Type of query. The list is in the QueryTypes enum. * @returns 4 bytes depending on the type of query - * @remarks This is the specialised version of the original single mpalQuery + * @remarks This is the specialized version of the original single mpalQuery * method that returns numeric results. */ uint32 mpalQueryDWORD(uint16 wQueryType, ...) { Common::String buf; uint32 dwRet = 0; - char *n; va_list v; va_start(v, wQueryType); @@ -1626,7 +1624,7 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) { */ lockVar(); int x = GETARG(uint32); - n = GETARG(char *); + char *n = GETARG(char *); buf = Common::String::format("Status.%u", x); if (varGetValue(buf.c_str()) <= 0) n[0]='\0'; @@ -1716,11 +1714,10 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) { * * @param wQueryType Type of query. The list is in the QueryTypes enum. * @returns 4 bytes depending on the type of query - * @remarks This is the specialised version of the original single mpalQuery + * @remarks This is the specialized version of the original single mpalQuery * method that returns a pointer or handle. */ MpalHandle mpalQueryHANDLE(uint16 wQueryType, ...) { - char *n; Common::String buf; va_list v; va_start(v, wQueryType); @@ -1798,12 +1795,9 @@ MpalHandle mpalQueryHANDLE(uint16 wQueryType, ...) { error("mpalQuery(MPQ_ITEM_IS_ACTIVE, uint32 nItem) used incorrect variant"); } else if (wQueryType == MPQ_ITEM_NAME) { - /* - * uint32 mpalQuery(MPQ_ITEM_NAME, uint32 nItem, char *lpszName); - */ lockVar(); int x = GETARG(uint32); - n = GETARG(char *); + char *n = GETARG(char *); buf = Common::String::format("Status.%u", x); if (varGetValue(buf.c_str()) <= 0) n[0] = '\0'; @@ -1873,7 +1867,7 @@ MpalHandle mpalQueryHANDLE(uint16 wQueryType, ...) { * * @param wQueryType Type of query. The list is in the QueryTypes enum. * @returns 4 bytes depending on the type of query - * @remarks This is the specialised version of the original single mpalQuery + * @remarks This is the specialized version of the original single mpalQuery * method that needs to run within a co-routine context. */ void mpalQueryCORO(CORO_PARAM, uint16 wQueryType, uint32 *dwRet) { @@ -1935,7 +1929,7 @@ bool mpalExecuteScript(int nScript) { // !!! New process management if (CoroScheduler.createProcess(ScriptThread, &s, sizeof(LpMpalScript)) == CORO_INVALID_PID_VALUE) - return false; + return false; return true; } diff --git a/engines/tony/mpal/mpal.h b/engines/tony/mpal/mpal.h index 2d22ee8faf..af24c46697 100644 --- a/engines/tony/mpal/mpal.h +++ b/engines/tony/mpal/mpal.h @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ /* * This code is based on original Tony Tough source code @@ -392,7 +391,7 @@ void mpalFree(); * * @param wQueryType Type of query. The list is in the QueryTypes enum. * @returns 4 bytes depending on the type of query - * @remarks This is the specialised version of the original single mpalQuery + * @remarks This is the specialized version of the original single mpalQuery * method that returns numeric results. */ uint32 mpalQueryDWORD(uint16 wQueryType, ...); @@ -403,7 +402,7 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...); * * @param wQueryType Type of query. The list is in the QueryTypes enum. * @returns 4 bytes depending on the type of query - * @remarks This is the specialised version of the original single mpalQuery + * @remarks This is the specialized version of the original single mpalQuery * method that returns a pointer or handle. */ MpalHandle mpalQueryHANDLE(uint16 wQueryType, ...); @@ -414,7 +413,7 @@ MpalHandle mpalQueryHANDLE(uint16 wQueryType, ...); * * @param wQueryType Type of query. The list is in the QueryTypes enum. * @returns 4 bytes depending on the type of query - * @remarks This is the specialised version of the original single mpalQuery + * @remarks This is the specialized version of the original single mpalQuery * method that needs to run within a co-routine context. */ void mpalQueryCORO(CORO_PARAM, uint16 wQueryType, uint32 *dwRet); diff --git a/engines/tony/mpal/mpaldll.h b/engines/tony/mpal/mpaldll.h index 92ddf8fc5a..68969497c1 100644 --- a/engines/tony/mpal/mpaldll.h +++ b/engines/tony/mpal/mpaldll.h @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ /* * This code is based on original Tony Tough source code diff --git a/engines/tony/mpal/mpalutils.cpp b/engines/tony/mpal/mpalutils.cpp index 0919aed5ac..84c8a68919 100644 --- a/engines/tony/mpal/mpalutils.cpp +++ b/engines/tony/mpal/mpalutils.cpp @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ #include "tony/mpal/mpalutils.h" diff --git a/engines/tony/mpal/mpalutils.h b/engines/tony/mpal/mpalutils.h index f351f22196..9ef534c632 100644 --- a/engines/tony/mpal/mpalutils.h +++ b/engines/tony/mpal/mpalutils.h @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ #ifndef TONY_MPAL_MPALUTILS diff --git a/engines/tony/resid.h b/engines/tony/resid.h index 0d601b7dd6..93c008144a 100644 --- a/engines/tony/resid.h +++ b/engines/tony/resid.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/tony/sound.cpp b/engines/tony/sound.cpp index 547f31906e..2a4eb826f3 100644 --- a/engines/tony/sound.cpp +++ b/engines/tony/sound.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -88,7 +88,7 @@ FPSound::~FPSound() { bool FPSound::createStream(FPStream **streamPtr) { (*streamPtr) = new FPStream(_soundSupported); - return (*streamPtr != NULL); + return true; } /** diff --git a/engines/tony/sound.h b/engines/tony/sound.h index 7422de02b3..446dc68d80 100644 --- a/engines/tony/sound.h +++ b/engines/tony/sound.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/tony/tony.cpp b/engines/tony/tony.cpp index 43a2f639d9..2857bb93f8 100644 --- a/engines/tony/tony.cpp +++ b/engines/tony/tony.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/tony/tony.h b/engines/tony/tony.h index 750673061d..40a5184c31 100644 --- a/engines/tony/tony.h +++ b/engines/tony/tony.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -31,6 +31,7 @@ #include "common/random.h" #include "common/util.h" #include "engines/engine.h" +#include "gui/debugger.h" #include "tony/mpal/mpal.h" #include "tony/mpal/memory.h" @@ -108,6 +109,7 @@ public: Common::List<FPSfx *> _activeSfx; Globals _globals; Debugger *_debugger; + GUI::Debugger *getDebugger() { return _debugger; } int16 _cTableDialog[256]; int16 _lTableDialog[256]; diff --git a/engines/tony/tonychar.cpp b/engines/tony/tonychar.cpp index 46c018728e..224d923142 100644 --- a/engines/tony/tonychar.cpp +++ b/engines/tony/tonychar.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/tony/tonychar.h b/engines/tony/tonychar.h index d9f18f61ec..5c5be9ca4e 100644 --- a/engines/tony/tonychar.h +++ b/engines/tony/tonychar.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/tony/utils.cpp b/engines/tony/utils.cpp index 81060146b7..d70073542f 100644 --- a/engines/tony/utils.cpp +++ b/engines/tony/utils.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/tony/utils.h b/engines/tony/utils.h index 9f13e5f19b..eb2f3c74d3 100644 --- a/engines/tony/utils.h +++ b/engines/tony/utils.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/tony/window.cpp b/engines/tony/window.cpp index a732862854..5c50a50a57 100644 --- a/engines/tony/window.cpp +++ b/engines/tony/window.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -40,7 +40,7 @@ namespace Tony { \****************************************************************************/ RMWindow::RMWindow() { - _showDirtyRects = false; + reset(); } RMWindow::~RMWindow() { @@ -55,11 +55,21 @@ RMWindow::~RMWindow() { void RMWindow::init() { Graphics::PixelFormat pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); initGraphics(RM_SX, RM_SY, true, &pixelFormat); + + reset(); +} +/** + * Reset the variables + */ +void RMWindow::reset() { + _showDirtyRects = false; _bGrabScreenshot = false; _bGrabThumbnail = false; _bGrabMovie = false; _wiping = false; + + _wThumbBuf = nullptr; } void RMWindow::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { diff --git a/engines/tony/window.h b/engines/tony/window.h index 3874652f64..df1932071c 100644 --- a/engines/tony/window.h +++ b/engines/tony/window.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -72,6 +72,7 @@ public: * Initialization */ void init(); + void reset(); void close(); /** |