diff options
author | Matthew Hoops | 2011-05-18 18:23:37 -0400 |
---|---|---|
committer | Matthew Hoops | 2011-05-18 18:23:37 -0400 |
commit | d4c92983920cfe3b25a22d91e12c750e591b917e (patch) | |
tree | c0b63318b9ba0e67528337cfaa21515def1c3962 /engines/agi | |
parent | 7e2edf16b3e2bf1d2b31999979a60802514df6cb (diff) | |
parent | cf107e24be28c7e6db65b5c7ffed120af4a7994b (diff) | |
download | scummvm-rg350-d4c92983920cfe3b25a22d91e12c750e591b917e.tar.gz scummvm-rg350-d4c92983920cfe3b25a22d91e12c750e591b917e.tar.bz2 scummvm-rg350-d4c92983920cfe3b25a22d91e12c750e591b917e.zip |
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'engines/agi')
64 files changed, 46 insertions, 239 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index a69d19f06c..78316588b0 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -18,14 +18,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/md5.h" #include "common/events.h" -#include "common/EventRecorder.h" #include "common/file.h" #include "common/memstream.h" #include "common/savefile.h" @@ -488,10 +484,16 @@ static const GameSettings agiSettings[] = { AgiBase::AgiBase(OSystem *syst, const AGIGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) { _noSaveLoadAllowed = false; + _rnd = new Common::RandomSource("agi"); + initFeatures(); initVersion(); } +AgiBase::~AgiBase() { + delete _rnd; +} + AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBase(syst, gameDesc) { // Setup mixer @@ -499,9 +501,6 @@ AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBas parseFeatures(); - _rnd = new Common::RandomSource(); - g_eventRec.registerRandomSource(*_rnd, "agi"); - DebugMan.addDebugChannel(kDebugLevelMain, "Main", "Generic debug level"); DebugMan.addDebugChannel(kDebugLevelResources, "Resources", "Resources debugging"); DebugMan.addDebugChannel(kDebugLevelSprites, "Sprites", "Sprites debugging"); @@ -652,10 +651,11 @@ void AgiEngine::initialize() { } AgiEngine::~AgiEngine() { - // If the engine hasn't been initialized yet via AgiEngine::initialize(), don't attempt to free any resources, - // as they haven't been allocated. Fixes bug #1742432 - AGI: Engine crashes if no game is detected + // If the engine hasn't been initialized yet via + // AgiEngine::initialize(), don't attempt to free any resources, as + // they haven't been allocated. Fixes bug #1742432 - AGI: Engine + // crashes if no game is detected if (_game.state == STATE_INIT) { - delete _rnd; // delete _rnd, as it is allocated in the constructor, not in initialize() return; } @@ -669,7 +669,6 @@ AgiEngine::~AgiEngine() { free(_game.sbufOrig); _gfx->deinitMachine(); delete _gfx; - delete _rnd; delete _console; free(_predictiveDictLine); diff --git a/engines/agi/agi.h b/engines/agi/agi.h index c71a0ebf64..a42148b1ef 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_H @@ -758,6 +755,7 @@ public: virtual void clearKeyQueue() = 0; AgiBase(OSystem *syst, const AGIGameDescription *gameDesc); + ~AgiBase(); virtual void clearImageStack() = 0; virtual void recordImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3, @@ -971,7 +969,7 @@ public: int showWords(); int loadWords(const char *); void unloadWords(); - int findWord(char *word, int *flen); + int findWord(const char *word, int *flen); void dictionaryWords(char *); // Motion diff --git a/engines/agi/checks.cpp b/engines/agi/checks.cpp index afede0b836..8d03ae67b9 100644 --- a/engines/agi/checks.cpp +++ b/engines/agi/checks.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/console.cpp b/engines/agi/console.cpp index f4b50c0909..d49bd57ea2 100644 --- a/engines/agi/console.cpp +++ b/engines/agi/console.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/console.h b/engines/agi/console.h index e79db42054..308b0f1d1f 100644 --- a/engines/agi/console.h +++ b/engines/agi/console.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_CONSOLE_H diff --git a/engines/agi/cycle.cpp b/engines/agi/cycle.cpp index 86c1b519a9..d86fb36709 100644 --- a/engines/agi/cycle.cpp +++ b/engines/agi/cycle.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp index fb92344de2..22d8adf92d 100644 --- a/engines/agi/detection.cpp +++ b/engines/agi/detection.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ // FIXME: Avoid using printf @@ -167,7 +164,7 @@ public: AgiMetaEngine() : AdvancedMetaEngine(detectionParams) {} virtual const char *getName() const { - return "AGI preAGI + v2 + v3 Engine"; + return "AGI preAGI + v2 + v3"; } virtual const char *getOriginalCopyright() const { return "Sierra AGI Engine (C) Sierra On-Line Software"; diff --git a/engines/agi/detection_tables.h b/engines/agi/detection_tables.h index 4689915007..cd3edf50c6 100644 --- a/engines/agi/detection_tables.h +++ b/engines/agi/detection_tables.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ namespace Agi { diff --git a/engines/agi/font.h b/engines/agi/font.h index 171106145c..c2516d3520 100644 --- a/engines/agi/font.h +++ b/engines/agi/font.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_FONT_H diff --git a/engines/agi/global.cpp b/engines/agi/global.cpp index ed8e9e8dbe..fdece0737e 100644 --- a/engines/agi/global.cpp +++ b/engines/agi/global.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp index f0d38761d0..5ceccd9e27 100644 --- a/engines/agi/graphics.cpp +++ b/engines/agi/graphics.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/file.h" diff --git a/engines/agi/graphics.h b/engines/agi/graphics.h index 60fbea2285..037dacd8de 100644 --- a/engines/agi/graphics.h +++ b/engines/agi/graphics.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_GRAPHICS_H diff --git a/engines/agi/id.cpp b/engines/agi/id.cpp index 2e12e45458..00f8407529 100644 --- a/engines/agi/id.cpp +++ b/engines/agi/id.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/inv.cpp b/engines/agi/inv.cpp index f1d9523887..a165a32b29 100644 --- a/engines/agi/inv.cpp +++ b/engines/agi/inv.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/keyboard.cpp b/engines/agi/keyboard.cpp index 95211f8e3c..f5810a6e8c 100644 --- a/engines/agi/keyboard.cpp +++ b/engines/agi/keyboard.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/keyboard.h b/engines/agi/keyboard.h index c4dadb5836..665ee6a62c 100644 --- a/engines/agi/keyboard.h +++ b/engines/agi/keyboard.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_KEYBOARD_H diff --git a/engines/agi/loader_v2.cpp b/engines/agi/loader_v2.cpp index 0141a61065..f5f8830b43 100644 --- a/engines/agi/loader_v2.cpp +++ b/engines/agi/loader_v2.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/textconsole.h" diff --git a/engines/agi/loader_v3.cpp b/engines/agi/loader_v3.cpp index 025e755c8b..29635f935b 100644 --- a/engines/agi/loader_v3.cpp +++ b/engines/agi/loader_v3.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/logic.cpp b/engines/agi/logic.cpp index cc61d3455a..22798ba831 100644 --- a/engines/agi/logic.cpp +++ b/engines/agi/logic.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/logic.h b/engines/agi/logic.h index d285aa1dfb..fecc2e3b8a 100644 --- a/engines/agi/logic.h +++ b/engines/agi/logic.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_LOGIC_H diff --git a/engines/agi/lzw.cpp b/engines/agi/lzw.cpp index 495d6458da..a00281bd49 100644 --- a/engines/agi/lzw.cpp +++ b/engines/agi/lzw.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ /*************************************************************************** diff --git a/engines/agi/lzw.h b/engines/agi/lzw.h index 5e1f74c819..e3fbafe584 100644 --- a/engines/agi/lzw.h +++ b/engines/agi/lzw.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_LZW_H diff --git a/engines/agi/menu.cpp b/engines/agi/menu.cpp index b62bcd9ad8..b504cd3e30 100644 --- a/engines/agi/menu.cpp +++ b/engines/agi/menu.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/menu.h b/engines/agi/menu.h index 724ec3877c..e659c71fab 100644 --- a/engines/agi/menu.h +++ b/engines/agi/menu.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_MENU_H diff --git a/engines/agi/motion.cpp b/engines/agi/motion.cpp index 7498aafb5d..261a7f3e61 100644 --- a/engines/agi/motion.cpp +++ b/engines/agi/motion.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/objects.cpp b/engines/agi/objects.cpp index bea53d7fa4..e04c9742f3 100644 --- a/engines/agi/objects.cpp +++ b/engines/agi/objects.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp index e1f99456e8..fb4c079a4a 100644 --- a/engines/agi/op_cmd.cpp +++ b/engines/agi/op_cmd.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "base/version.h" diff --git a/engines/agi/op_dbg.cpp b/engines/agi/op_dbg.cpp index f3b4815790..be73dbefae 100644 --- a/engines/agi/op_dbg.cpp +++ b/engines/agi/op_dbg.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/op_test.cpp b/engines/agi/op_test.cpp index f5234d4e6c..13b2d25023 100644 --- a/engines/agi/op_test.cpp +++ b/engines/agi/op_test.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ diff --git a/engines/agi/opcodes.h b/engines/agi/opcodes.h index 6b62f9ee99..b0d2051f0b 100644 --- a/engines/agi/opcodes.h +++ b/engines/agi/opcodes.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_OPCODES_H diff --git a/engines/agi/picture.cpp b/engines/agi/picture.cpp index 8951fc81df..47e40fb5f1 100644 --- a/engines/agi/picture.cpp +++ b/engines/agi/picture.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/picture.h b/engines/agi/picture.h index 31f8605cde..f2a6586b93 100644 --- a/engines/agi/picture.h +++ b/engines/agi/picture.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_PICTURE_H diff --git a/engines/agi/preagi.cpp b/engines/agi/preagi.cpp index c51c53e76e..c1a6cd33fe 100644 --- a/engines/agi/preagi.cpp +++ b/engines/agi/preagi.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/config-manager.h" @@ -45,8 +42,6 @@ PreAgiEngine::PreAgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : // Setup mixer syncSoundSettings(); - _rnd = new Common::RandomSource(); - DebugMan.addDebugChannel(kDebugLevelMain, "Main", "Generic debug level"); DebugMan.addDebugChannel(kDebugLevelResources, "Resources", "Resources debugging"); DebugMan.addDebugChannel(kDebugLevelSprites, "Sprites", "Sprites debugging"); diff --git a/engines/agi/preagi.h b/engines/agi/preagi.h index 58e08945b6..1a178497ad 100644 --- a/engines/agi/preagi.h +++ b/engines/agi/preagi.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_PREAGI_H diff --git a/engines/agi/preagi_common.cpp b/engines/agi/preagi_common.cpp index 5bc0c92ab8..d437dc08f2 100644 --- a/engines/agi/preagi_common.cpp +++ b/engines/agi/preagi_common.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/preagi.h" diff --git a/engines/agi/preagi_common.h b/engines/agi/preagi_common.h index 8b6dc0ee59..a557f69977 100644 --- a/engines/agi/preagi_common.h +++ b/engines/agi/preagi_common.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp index 64fc4e9ae5..21eb780916 100644 --- a/engines/agi/preagi_mickey.cpp +++ b/engines/agi/preagi_mickey.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/events.h" diff --git a/engines/agi/preagi_mickey.h b/engines/agi/preagi_mickey.h index 5ef12bfad2..62981375c6 100644 --- a/engines/agi/preagi_mickey.h +++ b/engines/agi/preagi_mickey.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_PREAGI_MICKEY_H diff --git a/engines/agi/preagi_troll.cpp b/engines/agi/preagi_troll.cpp index 76849949c7..445a9e34ff 100644 --- a/engines/agi/preagi_troll.cpp +++ b/engines/agi/preagi_troll.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/preagi.h" diff --git a/engines/agi/preagi_troll.h b/engines/agi/preagi_troll.h index f460758b2c..d9a995072b 100644 --- a/engines/agi/preagi_troll.h +++ b/engines/agi/preagi_troll.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_PREAGI_TROLL_H diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp index c92434c15f..1df31ff72a 100644 --- a/engines/agi/preagi_winnie.cpp +++ b/engines/agi/preagi_winnie.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/preagi.h" @@ -217,15 +214,9 @@ int Winnie::getObjInRoom(int iRoom) { return 0; } -#define setTakeDrop() {\ - if (getObjInRoom(_room))\ - fCanSel[IDI_WTP_SEL_TAKE] = true;\ - else\ - fCanSel[IDI_WTP_SEL_TAKE] = false;\ - if (_game.iObjHave)\ - fCanSel[IDI_WTP_SEL_DROP] = true;\ - else\ - fCanSel[IDI_WTP_SEL_DROP] = false;\ +void Winnie::setTakeDrop(int fCanSel[]) { + fCanSel[IDI_WTP_SEL_TAKE] = getObjInRoom(_room); + fCanSel[IDI_WTP_SEL_DROP] = _game.iObjHave; } void Winnie::setFlag(int iFlag) { @@ -281,7 +272,7 @@ int Winnie::parser(int pc, int index, uint8 *buffer) { fCanSel[IDI_WTP_SEL_EAST] = fCanSel[IDI_WTP_SEL_WEST] = true; // check if object in room or player carrying one - setTakeDrop(); + setTakeDrop(fCanSel); // check which rows have a menu option for (iSel = 0; iSel < IDI_WTP_MAX_OPTION; iSel++) { @@ -367,11 +358,11 @@ int Winnie::parser(int pc, int index, uint8 *buffer) { break; case IDI_WTP_SEL_TAKE: takeObj(_room); - setTakeDrop(); + setTakeDrop(fCanSel); break; case IDI_WTP_SEL_DROP: dropObj(_room); - setTakeDrop(); + setTakeDrop(fCanSel); break; } } @@ -796,13 +787,12 @@ void Winnie::getMenuMouseSel(int *iSel, int fCanSel[], int x, int y) { } } -#define makeSel() {\ - if (fCanSel[*iSel]) {\ - return;\ - } else {\ - keyHelp();\ - clrMenuSel(iSel, fCanSel);\ - }\ +void Winnie::makeSel(int *iSel, int fCanSel[]) { + if (fCanSel[*iSel]) + return; + + keyHelp(); + clrMenuSel(iSel, fCanSel); } void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) { @@ -844,22 +834,22 @@ void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) { // Click to move if (fCanSel[IDI_WTP_SEL_NORTH] && hotspotNorth.contains(event.mouse.x, event.mouse.y)) { *iSel = IDI_WTP_SEL_NORTH; - makeSel(); + makeSel(iSel, fCanSel); _vm->_gfx->setCursorPalette(false); return; } else if (fCanSel[IDI_WTP_SEL_SOUTH] && hotspotSouth.contains(event.mouse.x, event.mouse.y)) { *iSel = IDI_WTP_SEL_SOUTH; - makeSel(); + makeSel(iSel, fCanSel); _vm->_gfx->setCursorPalette(false); return; } else if (fCanSel[IDI_WTP_SEL_WEST] && hotspotWest.contains(event.mouse.x, event.mouse.y)) { *iSel = IDI_WTP_SEL_WEST; - makeSel(); + makeSel(iSel, fCanSel); _vm->_gfx->setCursorPalette(false); return; } else if (fCanSel[IDI_WTP_SEL_EAST] && hotspotEast.contains(event.mouse.x, event.mouse.y)) { *iSel = IDI_WTP_SEL_EAST; - makeSel(); + makeSel(iSel, fCanSel); _vm->_gfx->setCursorPalette(false); return; } else { @@ -944,31 +934,31 @@ void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) { break; case Common::KEYCODE_n: *iSel = IDI_WTP_SEL_NORTH; - makeSel(); + makeSel(iSel, fCanSel); break; case Common::KEYCODE_s: if (event.kbd.flags & Common::KBD_CTRL) { _vm->flipflag(fSoundOn); } else { *iSel = IDI_WTP_SEL_SOUTH; - makeSel(); + makeSel(iSel, fCanSel); } break; case Common::KEYCODE_e: *iSel = IDI_WTP_SEL_EAST; - makeSel(); + makeSel(iSel, fCanSel); break; case Common::KEYCODE_w: *iSel = IDI_WTP_SEL_WEST; - makeSel(); + makeSel(iSel, fCanSel); break; case Common::KEYCODE_t: *iSel = IDI_WTP_SEL_TAKE; - makeSel(); + makeSel(iSel, fCanSel); break; case Common::KEYCODE_d: *iSel = IDI_WTP_SEL_DROP; - makeSel(); + makeSel(iSel, fCanSel); break; case Common::KEYCODE_RETURN: switch (*iSel) { diff --git a/engines/agi/preagi_winnie.h b/engines/agi/preagi_winnie.h index 5a5472feb0..002eada65c 100644 --- a/engines/agi/preagi_winnie.h +++ b/engines/agi/preagi_winnie.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_PREAGI_WINNIE_H @@ -342,6 +339,8 @@ private: void saveGame(); void loadGame(); void dropObjRnd(); + void setTakeDrop(int[]); + void makeSel(int*, int[]); void wind(); void mist(); diff --git a/engines/agi/predictive.cpp b/engines/agi/predictive.cpp index 96ad78ace5..80e89f410b 100644 --- a/engines/agi/predictive.cpp +++ b/engines/agi/predictive.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp index c8df726fc7..deda186439 100644 --- a/engines/agi/saveload.cpp +++ b/engines/agi/saveload.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ // diff --git a/engines/agi/sound.cpp b/engines/agi/sound.cpp index b40cef67ef..746d4e9070 100644 --- a/engines/agi/sound.cpp +++ b/engines/agi/sound.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/sound.h b/engines/agi/sound.h index b858493cb8..0ee19878c4 100644 --- a/engines/agi/sound.h +++ b/engines/agi/sound.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_SOUND_H diff --git a/engines/agi/sound_2gs.cpp b/engines/agi/sound_2gs.cpp index f5758ed140..88feadd084 100644 --- a/engines/agi/sound_2gs.cpp +++ b/engines/agi/sound_2gs.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/config-manager.h" diff --git a/engines/agi/sound_2gs.h b/engines/agi/sound_2gs.h index 76f0642b7b..d9c7b8d2f1 100644 --- a/engines/agi/sound_2gs.h +++ b/engines/agi/sound_2gs.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_SOUND_2GS_H diff --git a/engines/agi/sound_coco3.cpp b/engines/agi/sound_coco3.cpp index 858c1c8515..281f2cb2d4 100644 --- a/engines/agi/sound_coco3.cpp +++ b/engines/agi/sound_coco3.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/sound_coco3.h b/engines/agi/sound_coco3.h index a1cc271871..7058b770f5 100644 --- a/engines/agi/sound_coco3.h +++ b/engines/agi/sound_coco3.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_SOUND_COCO3_H diff --git a/engines/agi/sound_midi.cpp b/engines/agi/sound_midi.cpp index 997c1edd6b..d2c99171e2 100644 --- a/engines/agi/sound_midi.cpp +++ b/engines/agi/sound_midi.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ // Code is based on: diff --git a/engines/agi/sound_midi.h b/engines/agi/sound_midi.h index 5733358fee..92a4002498 100644 --- a/engines/agi/sound_midi.h +++ b/engines/agi/sound_midi.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ // Music class diff --git a/engines/agi/sound_pcjr.cpp b/engines/agi/sound_pcjr.cpp index 35c960d260..319b7049ed 100644 --- a/engines/agi/sound_pcjr.cpp +++ b/engines/agi/sound_pcjr.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ /* Heavily based on code from NAGI diff --git a/engines/agi/sound_pcjr.h b/engines/agi/sound_pcjr.h index 3aad29d2ce..f50fd0aa82 100644 --- a/engines/agi/sound_pcjr.h +++ b/engines/agi/sound_pcjr.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_SOUND_PCJR_H diff --git a/engines/agi/sound_sarien.cpp b/engines/agi/sound_sarien.cpp index 6f2f3c5ad3..fc9a57791c 100644 --- a/engines/agi/sound_sarien.cpp +++ b/engines/agi/sound_sarien.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/random.h" diff --git a/engines/agi/sound_sarien.h b/engines/agi/sound_sarien.h index cea396255c..22bfff3395 100644 --- a/engines/agi/sound_sarien.h +++ b/engines/agi/sound_sarien.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_SOUND_SARIEN_H diff --git a/engines/agi/sprite.cpp b/engines/agi/sprite.cpp index e2b74e87bb..ea0b07f4da 100644 --- a/engines/agi/sprite.cpp +++ b/engines/agi/sprite.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/sprite.h b/engines/agi/sprite.h index 57fd0dacf2..68f0e32b86 100644 --- a/engines/agi/sprite.h +++ b/engines/agi/sprite.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_SPRITE_H diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp index f85c4c1cdd..fedfd29362 100644 --- a/engines/agi/text.cpp +++ b/engines/agi/text.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" @@ -92,8 +89,11 @@ void AgiEngine::printText2(int l, const char *msg, int foff, int xoff, int yoff, x1++; // DF: changed the len-1 to len... - if (x1 == len && m[len] != '\n') - y1++, x1 = foff = 0; + // FIXME: m[len] doesn't make sense and may read out of bounds? + if (x1 == len && m[len] != '\n') { + y1++; + x1 = foff = 0; + } } else { y1++; x1 = foff = 0; diff --git a/engines/agi/view.cpp b/engines/agi/view.cpp index fcca1e2a79..0d420caa81 100644 --- a/engines/agi/view.cpp +++ b/engines/agi/view.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/view.h b/engines/agi/view.h index 85f2d6eaf9..0ef443f8e5 100644 --- a/engines/agi/view.h +++ b/engines/agi/view.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_VIEW_H diff --git a/engines/agi/wagparser.cpp b/engines/agi/wagparser.cpp index fab3b5cf50..14159c0147 100644 --- a/engines/agi/wagparser.cpp +++ b/engines/agi/wagparser.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/file.h" diff --git a/engines/agi/wagparser.h b/engines/agi/wagparser.h index c16d4092e7..81cfecef1b 100644 --- a/engines/agi/wagparser.h +++ b/engines/agi/wagparser.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ namespace Agi { diff --git a/engines/agi/words.cpp b/engines/agi/words.cpp index d8596dec97..4b96fdf711 100644 --- a/engines/agi/words.cpp +++ b/engines/agi/words.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ // @@ -40,7 +37,7 @@ static uint32 wordsFlen; // length of word memory // Local implementation to avoid problems with strndup() used by // gcc 3.2 Cygwin (see #635984) // -static char *myStrndup(char *src, int n) { +static char *myStrndup(const char *src, int n) { char *tmp = strncpy((char *)malloc(n + 1), src, n); tmp[n] = 0; return tmp; @@ -89,11 +86,11 @@ void AgiEngine::unloadWords() { * * Thomas Akesson, November 2001 */ -int AgiEngine::findWord(char *word, int *flen) { +int AgiEngine::findWord(const char *word, int *flen) { int mchr = 0; // matched chars int len, fchr, id = -1; - uint8 *p = words; - uint8 *q = words + wordsFlen; + const uint8 *p = words; + const uint8 *q = words + wordsFlen; *flen = 0; debugC(2, kDebugLevelScripts, "find_word(%s)", word); |