diff options
23 files changed, 328 insertions, 275 deletions
diff --git a/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp b/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp index 6b0074862e..93c779ea5f 100644 --- a/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp +++ b/backends/mixer/doublebuffersdl/doublebuffersdl-mixer.cpp @@ -23,7 +23,7 @@ * */ -#if defined(MACOSX) || defined(GP2X) +#if defined(MACOSX) || defined(GP2X) || defined(CAANOO) || defined(GP2XWIZ) #include "backends/mixer/doublebuffersdl/doublebuffersdl-mixer.h" diff --git a/backends/platform/gph/gph-backend.cpp b/backends/platform/gph/gph-backend.cpp index 0432974246..fddcd03d85 100644 --- a/backends/platform/gph/gph-backend.cpp +++ b/backends/platform/gph/gph-backend.cpp @@ -26,23 +26,22 @@ #include "backends/platform/sdl/sdl-sys.h" // #include "backends/platform/gph/gph-options.h" -#include "backends/platform/gph/gph-sdl.h" +#include "backends/mixer/doublebuffersdl/doublebuffersdl-mixer.h" #include "backends/platform/gph/gph-hw.h" +#include "backends/platform/gph/gph-sdl.h" #include "backends/plugins/posix/posix-provider.h" +#include "backends/saves/default/default-saves.h" +#include "backends/timer/default/default-timer.h" + #include "base/main.h" #include "common/archive.h" #include "common/config-manager.h" #include "common/debug.h" #include "common/events.h" -#include "common/util.h" - #include "common/file.h" -#include "base/main.h" - -#include "backends/saves/default/default-saves.h" +#include "common/util.h" -#include "backends/timer/default/default-timer.h" #include "audio/mixer_intern.h" #include <stdio.h> @@ -67,6 +66,14 @@ void OSystem_GPH::initBackend() { _graphicsManager = new GPHGraphicsManager(_eventSource); } + // Create the mixer manager + if (_mixer == 0) { + _mixerManager = new DoubleBufferSDLMixerManager(); + + // Setup and start mixer + _mixerManager->init(); + } + /* Setup default save path to be workingdir/saves */ char savePath[PATH_MAX+1]; diff --git a/backends/platform/gph/gph-sdl.h b/backends/platform/gph/gph-sdl.h index 51c609d29e..68a641eed7 100644 --- a/backends/platform/gph/gph-sdl.h +++ b/backends/platform/gph/gph-sdl.h @@ -32,7 +32,6 @@ #include "backends/events/gph/gph-events.h" #define __GP2XWIZ__ -#define MIXER_DOUBLE_BUFFERING 1 #ifndef PATH_MAX #define PATH_MAX 255 diff --git a/backends/platform/openpandora/op-backend.cpp b/backends/platform/openpandora/op-backend.cpp index 5b333929c9..4c29636e40 100644 --- a/backends/platform/openpandora/op-backend.cpp +++ b/backends/platform/openpandora/op-backend.cpp @@ -26,20 +26,17 @@ #include "backends/platform/openpandora/op-sdl.h" #include "base/main.h" +#include "backends/mixer/doublebuffersdl/doublebuffersdl-mixer.h" #include "backends/saves/default/default-saves.h" +#include "backends/timer/default/default-timer.h" #include "common/archive.h" #include "common/config-manager.h" #include "common/debug.h" #include "common/events.h" -#include "common/util.h" - #include "common/file.h" -#include "base/main.h" - -#include "backends/saves/default/default-saves.h" +#include "common/util.h" -#include "backends/timer/default/default-timer.h" #include "audio/mixer_intern.h" #include <stdio.h> @@ -78,6 +75,14 @@ void OSystem_OP::initBackend() { // } // + // Create the mixer manager + if (_mixer == 0) { + _mixerManager = new DoubleBufferSDLMixerManager(); + + // Setup and start mixer + _mixerManager->init(); + } + /* Setup default save path to be workingdir/saves */ char savePath[PATH_MAX+1]; diff --git a/backends/platform/openpandora/op-sdl.h b/backends/platform/openpandora/op-sdl.h index 93c82ca397..9d92472b17 100644 --- a/backends/platform/openpandora/op-sdl.h +++ b/backends/platform/openpandora/op-sdl.h @@ -32,7 +32,6 @@ #include "backends/graphics/openpandora/op-graphics.h" #define __OPENPANDORA__ -#define MIXER_DOUBLE_BUFFERING 1 #ifndef PATH_MAX #define PATH_MAX 255 diff --git a/backends/platform/symbian/AdaptAllMMPs.pl b/backends/platform/symbian/AdaptAllMMPs.pl index 921f384c65..84f42d2a0b 100644 --- a/backends/platform/symbian/AdaptAllMMPs.pl +++ b/backends/platform/symbian/AdaptAllMMPs.pl @@ -111,7 +111,8 @@ ParseModule("_base", "base", \@section_empty); # now in ./TRG/ScummVM_TRG.mmp, ParseModule("_base", "common", \@section_empty); ParseModule("_base", "gui", \@section_empty, \@excludes_gui); ParseModule("_base", "graphics", \@section_empty, \@excludes_graphics); -ParseModule("_base", "sound", \@section_empty, \@excludes_snd); +ParseModule("_base", "audio", \@section_empty, \@excludes_snd); +ParseModule("_base", "video", \@section_empty); chdir("engines/"); ParseModule("_scumm", "scumm", \@sections_scumm, \@excludes_scumm ); diff --git a/backends/platform/symbian/src/portdefs.h b/backends/platform/symbian/src/portdefs.h index 1c5de2d43c..e8a620475e 100644 --- a/backends/platform/symbian/src/portdefs.h +++ b/backends/platform/symbian/src/portdefs.h @@ -35,6 +35,11 @@ #include <e32std.h> #include <math.h> +/* define pi */ +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif /* M_PI */ + #define DISABLE_COMMAND_LINE #if defined(USE_TREMOR) && !defined(USE_VORBIS) diff --git a/common/stream.cpp b/common/stream.cpp index c0783b2352..1be3fbffea 100644 --- a/common/stream.cpp +++ b/common/stream.cpp @@ -205,7 +205,6 @@ uint32 SubReadStream::read(void *dataPtr, uint32 dataSize) { } dataSize = _parentStream->read(dataPtr, dataSize); - _eos |= _parentStream->eos(); _pos += dataSize; return dataSize; diff --git a/common/substream.h b/common/substream.h index dc49ce9ecf..4d90ec5ced 100644 --- a/common/substream.h +++ b/common/substream.h @@ -59,7 +59,7 @@ public: delete _parentStream; } - virtual bool eos() const { return _eos; } + virtual bool eos() const { return _eos | _parentStream->eos(); } virtual bool err() const { return _parentStream->err(); } virtual void clearErr() { _eos = false; _parentStream->clearErr(); } virtual uint32 read(void *dataPtr, uint32 dataSize); diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index d77e536d5b..57c5c48975 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -530,7 +530,7 @@ void StripManager::start(int stripNum, EventHandler *owner, StripCallback *callb _stripNum = stripNum; _callbackObject = callback; - _sceneNumber = _globals->_sceneManager._scene->_sceneNumber; + _sceneNumber = _globals->_sceneManager._scene->_screenNumber; _sceneBounds = _globals->_sceneManager._scene->_sceneBounds; _script.clear(); @@ -631,7 +631,7 @@ void StripManager::remove() { if (_activeSpeaker) _activeSpeaker->remove(); - if (_sceneNumber != _globals->_sceneManager._scene->_sceneNumber) { + if (_sceneNumber != _globals->_sceneManager._scene->_screenNumber) { _globals->_sceneManager._scene->_sceneBounds = _sceneBounds; _globals->_sceneManager._scene->loadScene(_sceneNumber); } @@ -695,7 +695,7 @@ void StripManager::signal() { _activeSpeaker->remove(); _activeSpeaker = speakerP; - if ((_activeSpeaker->_newSceneNumber == -1) && (_globals->_sceneManager._scene->_sceneNumber != _sceneNumber)) { + if ((_activeSpeaker->_newSceneNumber == -1) && (_globals->_sceneManager._scene->_screenNumber != _sceneNumber)) { _globals->_sceneManager._scene->_sceneBounds = _sceneBounds; _globals->_sceneManager._scene->loadScene(_sceneNumber); } diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 2d0a69f89c..ba4c5923bc 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -2388,8 +2388,8 @@ void SceneObjectList::draw() { // Handle updating object priority if (!(obj->_flags & OBJFLAG_FIXED_PRIORITY)) { - obj->_priority = MIN((int)obj->_position.y - 1, - (int)_globals->_sceneManager._scene->_backgroundBounds.bottom); + obj->_priority = MIN((int)obj->_position.y, + (int)_globals->_sceneManager._scene->_backgroundBounds.bottom - 1); } if ((_globals->_paneRefreshFlag[paneNum] != 0) || !_globals->_paneRegions[paneNum].empty()) { diff --git a/engines/tsage/core.h b/engines/tsage/core.h index 6508d1576a..c18984fd45 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -728,6 +728,7 @@ public: } SynchronisedList<SceneObject *>::iterator begin() { return _objList.begin(); } SynchronisedList<SceneObject *>::iterator end() { return _objList.end(); } + int size() const { return _objList.size(); } bool contains(SceneObject *sceneObj) { return tSage::contains(_objList, sceneObj); } void push_back(SceneObject *sceneObj) { _objList.push_back(sceneObj); } void push_front(SceneObject *sceneObj) { _objList.push_front(sceneObj); } diff --git a/engines/tsage/dialogs.cpp b/engines/tsage/dialogs.cpp index 21970cee24..688f266133 100644 --- a/engines/tsage/dialogs.cpp +++ b/engines/tsage/dialogs.cpp @@ -464,6 +464,7 @@ void InventoryDialog::execute() { GfxElement *hiliteObj; bool lookFlag = false; + _gfxManager.activate(); while (!_vm->getEventManager()->shouldQuit()) { // Get events @@ -511,9 +512,7 @@ void InventoryDialog::execute() { _globals->_events.setCursor(CURSOR_WALK); } - _gfxManager.activate(); hiliteObj->draw(); - _gfxManager.deactivate(); } else if (hiliteObj) { // Inventory item selected InvObject *invObject = static_cast<GfxInvImage *>(hiliteObj)->_invObject; @@ -525,6 +524,8 @@ void InventoryDialog::execute() { } } } + + _gfxManager.deactivate(); } /*--------------------------------------------------------------------------*/ diff --git a/engines/tsage/ringworld_scenes1.cpp b/engines/tsage/ringworld_scenes1.cpp index c8d10e1708..3495df0271 100644 --- a/engines/tsage/ringworld_scenes1.cpp +++ b/engines/tsage/ringworld_scenes1.cpp @@ -2424,7 +2424,7 @@ void Scene60::signal() { void Scene60::process(Event &event) { Scene::process(event); - if (_sceneNumber == 60) { + if (_screenNumber == 60) { if (_gfxButton.process(event)) _globals->_sceneManager.changeScene(50); } diff --git a/engines/tsage/ringworld_scenes10.cpp b/engines/tsage/ringworld_scenes10.cpp index 4d413a09fb..5e0cabde6a 100644 --- a/engines/tsage/ringworld_scenes10.cpp +++ b/engines/tsage/ringworld_scenes10.cpp @@ -785,7 +785,7 @@ void Scene9400::dispatch() { void Scene9400::postInit(SceneObjectList *OwnerList) { Scene::postInit(); - _sceneNumber = 9400; + _screenNumber = 9400; setZoomPercents(0, 100, 200, 100); _globals->_player.postInit(); _object1.postInit(0); diff --git a/engines/tsage/ringworld_scenes2.cpp b/engines/tsage/ringworld_scenes2.cpp index 9d941d3242..3e3686e2d5 100644 --- a/engines/tsage/ringworld_scenes2.cpp +++ b/engines/tsage/ringworld_scenes2.cpp @@ -112,28 +112,23 @@ void Scene1000::Action3::signal() { setDelay(240); break; case 5: { - // Intro.txt file presence is used to allow user option to skip the introduction - _globals->_player.enableControl(); - Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading("Intro.txt"); - if (!in) { - // File not present, so create it - Common::OutSaveFile *out = g_system->getSavefileManager()->openForSaving("Intro.txt"); - out->finalize(); - delete out; - setDelay(1); - } else { - delete in; + // WORKAROUND: At this point, the original used the presence of a file called 'Intro.txt' + // to determine whether the introduction has been played the first time the game was started. + // In ScummVM, we don't like creating any files that aren't explicitly savegames, so the + // game startup will always show the Start Play / Introduction buttons, even when the game + // is played for the first time - // Prompt user for whether to start play or watch introduction - if (MessageDialog::show2(WATCH_INTRO_MSG, START_PLAY_BTN_STRING, INTRODUCTION_BTN_STRING) == 0) { - _actionIndex = 20; - _globals->_soundHandler.proc1(this); - } else { - setDelay(1); - } + // Prompt user for whether to start play or watch introduction + _globals->_player.enableControl(); - _globals->_player.disableControl(); + if (MessageDialog::show2(WATCH_INTRO_MSG, START_PLAY_BTN_STRING, INTRODUCTION_BTN_STRING) == 0) { + _actionIndex = 20; + _globals->_soundHandler.proc1(this); + } else { + setDelay(1); } + + _globals->_player.disableControl(); break; } case 6: { diff --git a/engines/tsage/ringworld_scenes3.cpp b/engines/tsage/ringworld_scenes3.cpp index 1571f18f84..bd276a8fee 100644 --- a/engines/tsage/ringworld_scenes3.cpp +++ b/engines/tsage/ringworld_scenes3.cpp @@ -5068,7 +5068,7 @@ void Scene2320::Action3::signal() { break; } case 3: - scene->_hotspot6.setPriority2(scene->_hotspot6._priority - 1); + _globals->_player.setPriority2(scene->_hotspot6._priority - 1); _globals->_player._strip = 3; setDelay(10); break; @@ -5798,7 +5798,7 @@ void Scene2320::postInit(SceneObjectList *OwnerList) { _globals->_sceneItems.push_back(&_hotspot8); } - _area1.setup(2100, 2, 1, 2100); + _area1.setup(2153, 2, 1, 2100); _area1._pt = Common::Point(200, 31); _area2.setup(2153, 3, 1, 2150); _area2._pt = Common::Point(200, 50); diff --git a/engines/tsage/ringworld_scenes5.cpp b/engines/tsage/ringworld_scenes5.cpp index b424a403db..576ab027e6 100644 --- a/engines/tsage/ringworld_scenes5.cpp +++ b/engines/tsage/ringworld_scenes5.cpp @@ -57,28 +57,28 @@ void Scene4000::Action1::signal() { break; } case 1: { - scene->_hotspot9.postInit(); - scene->_hotspot9.setVisage(4001); - scene->_hotspot9.animate(ANIM_MODE_1, NULL); - scene->_hotspot9.setObjectWrapper(new SceneObjectWrapper()); - scene->_hotspot9.setPosition(Common::Point(314, 132)); + scene->_guardRock.postInit(); + scene->_guardRock.setVisage(4001); + scene->_guardRock.animate(ANIM_MODE_1, NULL); + scene->_guardRock.setObjectWrapper(new SceneObjectWrapper()); + scene->_guardRock.setPosition(Common::Point(314, 132)); - ADD_PLAYER_MOVER_NULL(scene->_hotspot9, 288, 167); + ADD_PLAYER_MOVER_NULL(scene->_guardRock, 288, 167); - scene->_hotspot4.postInit(); - scene->_hotspot4.setVisage(4006); - scene->_hotspot4.animate(ANIM_MODE_1, NULL); - scene->_hotspot4.setStrip(1); - scene->_hotspot4.setPosition(Common::Point(207, 136)); + scene->_olo.postInit(); + scene->_olo.setVisage(4006); + scene->_olo.animate(ANIM_MODE_1, NULL); + scene->_olo.setStrip(1); + scene->_olo.setPosition(Common::Point(207, 136)); - ADD_PLAYER_MOVER_NULL(scene->_hotspot4, 220, 151); + ADD_PLAYER_MOVER_NULL(scene->_olo, 220, 151); - scene->_hotspot7.postInit(); - scene->_hotspot7.setVisage(2701); - scene->_hotspot7.animate(ANIM_MODE_1, NULL); - scene->_hotspot7.setObjectWrapper(new SceneObjectWrapper()); - scene->_hotspot7._moveDiff = Common::Point(4, 2); - scene->_hotspot7.setPosition(Common::Point(300, 135)); + scene->_miranda.postInit(); + scene->_miranda.setVisage(2701); + scene->_miranda.animate(ANIM_MODE_1, NULL); + scene->_miranda.setObjectWrapper(new SceneObjectWrapper()); + scene->_miranda._moveDiff = Common::Point(4, 2); + scene->_miranda.setPosition(Common::Point(300, 135)); ADD_PLAYER_MOVER_NULL(_globals->_player, 266, 169); break; @@ -89,13 +89,13 @@ void Scene4000::Action1::signal() { case 3: { Common::Point pt1(30, 86); PlayerMover *mover1 = new PlayerMover(); - scene->_hotspot7.addMover(mover1, &pt1, this); + scene->_miranda.addMover(mover1, &pt1, this); ADD_PLAYER_MOVER_NULL(scene->_hotspot5, 3, 86); break; } case 4: - ADD_MOVER(scene->_hotspot7, -30, 86); + ADD_MOVER(scene->_miranda, -30, 86); ADD_MOVER(scene->_hotspot5, -40, 86); break; case 5: @@ -105,7 +105,7 @@ void Scene4000::Action1::signal() { scene->_stripManager.start(4430, this); break; case 6: - ADD_PLAYER_MOVER_THIS(scene->_hotspot4, 277, 175); + ADD_PLAYER_MOVER_THIS(scene->_olo, 277, 175); ADD_PLAYER_MOVER_NULL(_globals->_player, 258, 187); break; case 7: @@ -135,19 +135,19 @@ void Scene4000::Action2::signal() { scene->_hotspot5._moveDiff.x = 5; scene->_hotspot5.setPosition(Common::Point(-8, 88)); - scene->_hotspot3.setAction(&scene->_sequenceManager3, NULL, 4003, &scene->_hotspot5, NULL); - scene->_hotspot7.setAction(&scene->_sequenceManager2, NULL, 4002, &scene->_hotspot7, NULL); + scene->_lander.setAction(&scene->_sequenceManager3, NULL, 4003, &scene->_hotspot5, NULL); + scene->_miranda.setAction(&scene->_sequenceManager2, NULL, 4002, &scene->_miranda, NULL); break; case 1: _globals->_player.disableControl(); - scene->_hotspot3.remove(); - ADD_MOVER(scene->_hotspot9, scene->_hotspot5._position.x + 30, scene->_hotspot5._position.y - 10); + scene->_lander.remove(); + ADD_MOVER(scene->_guardRock, scene->_hotspot5._position.x + 30, scene->_hotspot5._position.y - 10); break; case 2: - _globals->_player.checkAngle(&scene->_hotspot9); - scene->_hotspot5.checkAngle(&scene->_hotspot9); - scene->_hotspot7.checkAngle(&scene->_hotspot9); + _globals->_player.checkAngle(&scene->_guardRock); + scene->_hotspot5.checkAngle(&scene->_guardRock); + scene->_miranda.checkAngle(&scene->_guardRock); scene->_stripManager.start(4000, this); break; case 3: @@ -166,9 +166,9 @@ void Scene4000::Action2::signal() { scene->_stripManager.start(4010, this); break; case 6: - ADD_PLAYER_MOVER_NULL(scene->_hotspot9, 230, 149); + ADD_PLAYER_MOVER_NULL(scene->_guardRock, 230, 149); ADD_PLAYER_MOVER(210, 136); - ADD_PLAYER_MOVER_NULL(scene->_hotspot7, 210, 133); + ADD_PLAYER_MOVER_NULL(scene->_miranda, 210, 133); break; case 7: _globals->_sceneManager.changeScene(4045); @@ -210,11 +210,11 @@ void Scene4000::Action4::signal() { _globals->_player.animate(ANIM_MODE_4, 2, 1, this); break; case 2: - scene->_hotspot6.postInit(); - scene->_hotspot6.setVisage(4000); - scene->_hotspot6.setStrip(7); - scene->_hotspot6.setFrame(3); - scene->_hotspot6.setPosition(Common::Point(268, 44)); + scene->_rope.postInit(); + scene->_rope.setVisage(4000); + scene->_rope.setStrip(7); + scene->_rope.setFrame(3); + scene->_rope.setPosition(Common::Point(268, 44)); _globals->_inventory._rope._sceneNumber = 4000; _globals->_events.setCursor(CURSOR_USE); @@ -270,22 +270,22 @@ void Scene4000::Action6::signal() { setAction(&scene->_sequenceManager1, this, 4001, &_globals->_player, NULL); if (!_globals->getFlag(36)) - scene->_hotspot7.setAction(&scene->_sequenceManager2, NULL, 4002, &scene->_hotspot7, NULL); + scene->_miranda.setAction(&scene->_sequenceManager2, NULL, 4002, &scene->_miranda, NULL); break; case 2: _globals->_player.disableControl(); - ADD_MOVER(scene->_hotspot9, _globals->_player._position.x + 30, _globals->_player._position.y - 5); + ADD_MOVER(scene->_guardRock, _globals->_player._position.x + 30, _globals->_player._position.y - 5); break; case 3: scene->_stripManager.start(_globals->getFlag(35) ? 4500 : 4502, this); break; case 4: _globals->clearFlag(35); - ADD_MOVER_NULL(scene->_hotspot9, 292, 138); + ADD_MOVER_NULL(scene->_guardRock, 292, 138); ADD_PLAYER_MOVER(283, 147); if (!_globals->getFlag(36)) { - ADD_PLAYER_MOVER_NULL(scene->_hotspot7, 280, 150); + ADD_PLAYER_MOVER_NULL(scene->_miranda, 280, 150); } break; case 5: @@ -301,7 +301,7 @@ void Scene4000::Action7::signal() { case 0: _globals->_player.disableControl(); - scene->_hotspot6.setFrame(1); + scene->_rope.setFrame(1); ADD_MOVER(_globals->_player, 247, 53); break; case 1: @@ -325,7 +325,7 @@ void Scene4000::Action8::signal() { case 0: _globals->_player.disableControl(); if (_globals->getFlag(41)) - scene->_hotspot6.setFrame(2); + scene->_rope.setFrame(2); ADD_MOVER(_globals->_player, 289, 53); break; @@ -343,9 +343,9 @@ void Scene4000::Action8::signal() { break; case 3: _globals->_soundHandler.startSound(170); - scene->_hotspot27.setVisage(4000); - scene->_hotspot27.setStrip(6); - scene->_hotspot27.animate(ANIM_MODE_2, NULL); + scene->_smoke2.setVisage(4000); + scene->_smoke2.setStrip(6); + scene->_smoke2.animate(ANIM_MODE_2, NULL); setDelay(60); break; case 4: @@ -388,7 +388,7 @@ void Scene4000::Action11::signal() { switch (_actionIndex++) { case 0: _globals->_player.disableControl(); - ADD_MOVER(scene->_hotspot3, -30, 70); + ADD_MOVER(scene->_lander, -30, 70); break; case 1: setDelay(60); @@ -403,23 +403,23 @@ void Scene4000::Action11::signal() { setAction(&scene->_sequenceManager1, this, 4001, &_globals->_player, NULL); - scene->_hotspot7.setPosition(Common::Point(-210, 139)); - scene->_hotspot7.setAction(&scene->_sequenceManager2, NULL, 4002, &scene->_hotspot7, NULL); - scene->_hotspot3.setAction(&scene->_sequenceManager3, NULL, 4003, &scene->_hotspot5, NULL); + scene->_miranda.setPosition(Common::Point(-210, 139)); + scene->_miranda.setAction(&scene->_sequenceManager2, NULL, 4002, &scene->_miranda, NULL); + scene->_lander.setAction(&scene->_sequenceManager3, NULL, 4003, &scene->_hotspot5, NULL); break; case 3: scene->_stripManager.start(8000, this); break; case 4: - ADD_MOVER(scene->_hotspot4, 263, 187); - scene->_hotspot4.animate(ANIM_MODE_1, NULL); + ADD_MOVER(scene->_olo, 263, 187); + scene->_olo.animate(ANIM_MODE_1, NULL); break; case 5: scene->_soundHandler1.proc3(); scene->_hotspot11.remove(); ADD_MOVER(_globals->_player, 340, 163); - ADD_MOVER_NULL(scene->_hotspot7, 340, 169); + ADD_MOVER_NULL(scene->_miranda, 340, 169); ADD_MOVER_NULL(scene->_hotspot5, 340, 165); break; case 6: @@ -444,7 +444,7 @@ void Scene4000::Action12::signal() { _globals->setFlag(32); if (scene->_stripManager._field2E8 == 275) { _globals->setFlag(82); - ADD_MOVER_NULL(scene->_hotspot9, 292, 138); + ADD_MOVER_NULL(scene->_guardRock, 292, 138); ADD_PLAYER_MOVER(283, 147); } else { setDelay(30); @@ -454,11 +454,11 @@ void Scene4000::Action12::signal() { if (scene->_stripManager._field2E8 == 275) { _globals->_sceneManager.changeScene(4100); } else { - ADD_PLAYER_MOVER_THIS(scene->_hotspot9, 300, 132); + ADD_PLAYER_MOVER_THIS(scene->_guardRock, 300, 132); } break; case 4: - scene->_hotspot9.hide(); + scene->_guardRock.hide(); scene->_stripManager.start(4020, this); break; case 5: @@ -480,7 +480,7 @@ void Scene4000::Action13::signal() { case 1: scene->_soundHandler2.startSound(151); scene->_soundHandler2.proc5(true); - ADD_MOVER(scene->_hotspot3, -30, 70); + ADD_MOVER(scene->_lander, -30, 70); break; case 2: scene->_soundHandler2.proc4(); @@ -491,7 +491,7 @@ void Scene4000::Action13::signal() { /*--------------------------------------------------------------------------*/ -void Scene4000::Hotspot7::doAction(int action) { +void Scene4000::Miranda::doAction(int action) { Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene; switch (action) { @@ -577,7 +577,7 @@ void Scene4000::Hotspot8::doAction(int action) { } } -void Scene4000::Hotspot9::doAction(int action) { +void Scene4000::GuardRock::doAction(int action) { switch (action) { case OBJECT_STUNNER: SceneItem::display2(4000, 28); @@ -594,7 +594,7 @@ void Scene4000::Hotspot9::doAction(int action) { } } -void Scene4000::Hotspot10::doAction(int action) { +void Scene4000::Ladder::doAction(int action) { Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene; switch (action) { @@ -608,7 +608,7 @@ void Scene4000::Hotspot10::doAction(int action) { scene->setAction(&scene->_sequenceManager1, scene, 4005, &_globals->_player, NULL); } else { scene->_sceneMode = 4004; - scene->setAction(&scene->_sequenceManager1, scene, 4004, &_globals->_player, &scene->_hotspot10, NULL); + scene->setAction(&scene->_sequenceManager1, scene, 4004, &_globals->_player, &scene->_ladder, NULL); } break; default: @@ -617,7 +617,7 @@ void Scene4000::Hotspot10::doAction(int action) { } } -void Scene4000::Hotspot12::doAction(int action) { +void Scene4000::TheTech::doAction(int action) { Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene; switch (action) { @@ -635,7 +635,7 @@ void Scene4000::Hotspot12::doAction(int action) { SceneItem::display2(4000, 37); else { _globals->_player.disableControl(); - if (_globals->_sceneObjects->contains(&scene->_hotspot7)) + if (_globals->_sceneObjects->contains(&scene->_miranda)) _globals->clearFlag(96); scene->_sceneMode = 4012; @@ -683,12 +683,12 @@ void Scene4000::Hotspot::doAction(int action) { case OBJECT_LADDER: _globals->_player.disableControl(); - scene->_hotspot10.postInit(); - scene->_hotspot10.setVisage(4000); - scene->_hotspot10.setStrip(5); - scene->_hotspot10.setPosition(Common::Point(245, 147)); - scene->_hotspot10.hide(); - _globals->_sceneItems.push_front(&scene->_hotspot10); + scene->_ladder.postInit(); + scene->_ladder.setVisage(4000); + scene->_ladder.setStrip(5); + scene->_ladder.setPosition(Common::Point(245, 147)); + scene->_ladder.hide(); + _globals->_sceneItems.push_front(&scene->_ladder); if (_globals->_sceneObjects->contains(&scene->_hotspot8)) { scene->_hotspot8.setAction(NULL); @@ -696,7 +696,7 @@ void Scene4000::Hotspot::doAction(int action) { } scene->_sceneMode = 4004; - scene->setAction(&scene->_sequenceManager1, scene, 4011, &_globals->_player, &scene->_hotspot10, NULL); + scene->setAction(&scene->_sequenceManager1, scene, 4011, &_globals->_player, &scene->_ladder, NULL); break; default: SceneHotspot::doAction(action); @@ -786,10 +786,10 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _stripManager.addSpeaker(&_speakerSText); _stripManager.addSpeaker(&_speakerMText); - _speakerCHFText._npc = &_hotspot9; + _speakerCHFText._npc = &_guardRock; _speakerSText._npc = &_hotspot5; - _speakerMText._npc = &_hotspot7; - _speakerPText._npc = &_hotspot4; + _speakerMText._npc = &_miranda; + _speakerPText._npc = &_olo; _speakerQText._npc = &_globals->_player; _hotspot13.setBounds(Rect(263, 41, 278, 55)); @@ -808,20 +808,20 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _hotspot20._sceneRegionId = 18; _hotspot25._sceneRegionId = 17; - _hotspot1.postInit(); - _hotspot1.setVisage(4000); - _hotspot1.setPriority2(1); - _hotspot1.setFrame(2); - _hotspot1.setPosition(Common::Point(242, 59)); - _hotspot1.animate(ANIM_MODE_2, NULL); - - _hotspot27.postInit(); - _hotspot27.setVisage(4000); - _hotspot27.setStrip(2); - _hotspot27.setPriority2(1); - _hotspot27.setFrame(2); - _hotspot27.setPosition(Common::Point(299, 59)); - _hotspot27.animate(ANIM_MODE_2, NULL); + _smoke1.postInit(); + _smoke1.setVisage(4000); + _smoke1.setPriority2(1); + _smoke1.setFrame(2); + _smoke1.setPosition(Common::Point(242, 59)); + _smoke1.animate(ANIM_MODE_2, NULL); + + _smoke2.postInit(); + _smoke2.setVisage(4000); + _smoke2.setStrip(2); + _smoke2.setPriority2(1); + _smoke2.setFrame(2); + _smoke2.setPosition(Common::Point(299, 59)); + _smoke2.animate(ANIM_MODE_2, NULL); if (_globals->_inventory._ladder._sceneNumber != 4000) { _hotspot8.postInit(); @@ -833,12 +833,12 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _hotspot8.setAction(&_action9); } - _hotspot12.postInit(); - _hotspot12.setVisage(4000); - _hotspot12.setStrip(3); - _hotspot12.setFrame(3); - _hotspot12.setPriority2(200); - _hotspot12.setPosition(Common::Point(281, 176)); + _theTech.postInit(); + _theTech.setVisage(4000); + _theTech.setStrip(3); + _theTech.setFrame(3); + _theTech.setPriority2(200); + _theTech.setPosition(Common::Point(281, 176)); if (_globals->getFlag(34)) { _soundHandler1.startSound(156); @@ -860,14 +860,14 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _globals->_player.setPosition(Common::Point(-28, 86)); if (!_globals->getFlag(36) && !_globals->getFlag(43)) { - _hotspot7.postInit(); - _hotspot7.setVisage(2701); - _hotspot7.animate(ANIM_MODE_1, NULL); - _hotspot7.setObjectWrapper(new SceneObjectWrapper()); - _hotspot7._moveDiff = Common::Point(4, 2); - _hotspot7.setPosition(Common::Point(-210, 139)); - - _globals->_sceneItems.push_back(&_hotspot7); + _miranda.postInit(); + _miranda.setVisage(2701); + _miranda.animate(ANIM_MODE_1, NULL); + _miranda.setObjectWrapper(new SceneObjectWrapper()); + _miranda._moveDiff = Common::Point(4, 2); + _miranda.setPosition(Common::Point(-210, 139)); + + _globals->_sceneItems.push_back(&_miranda); } switch (_globals->_sceneManager._previousScene) { @@ -875,11 +875,11 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _globals->_soundHandler.startSound(155); if (_globals->_inventory._ale._sceneNumber == 1) { - _hotspot9.postInit(); - _hotspot9.setVisage(4001); - _hotspot9.animate(ANIM_MODE_1, NULL); - _hotspot9.setObjectWrapper(new SceneObjectWrapper()); - _hotspot9.setPosition(Common::Point(314, 132)); + _guardRock.postInit(); + _guardRock.setVisage(4001); + _guardRock.animate(ANIM_MODE_1, NULL); + _guardRock.setObjectWrapper(new SceneObjectWrapper()); + _guardRock.setPosition(Common::Point(314, 132)); setAction(&_action6); } else { @@ -888,7 +888,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { setAction(&_sequenceManager1, this, 4001, &_globals->_player, NULL); if (!_globals->getFlag(36) && !_globals->getFlag(43)) - _hotspot7.setAction(&_sequenceManager2, NULL, 4002, &_hotspot7, NULL); + _miranda.setAction(&_sequenceManager2, NULL, 4002, &_miranda, NULL); } if (_globals->getFlag(42)) @@ -898,13 +898,13 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { break; case 4010: - _hotspot7.setPosition(Common::Point(-210, 139)); + _miranda.setPosition(Common::Point(-210, 139)); - _hotspot9.postInit(); - _hotspot9.setVisage(4001); - _hotspot9.animate(ANIM_MODE_1, NULL); - _hotspot9.setObjectWrapper(new SceneObjectWrapper()); - _hotspot9.setPosition(Common::Point(314, 132)); + _guardRock.postInit(); + _guardRock.setVisage(4001); + _guardRock.animate(ANIM_MODE_1, NULL); + _guardRock.setObjectWrapper(new SceneObjectWrapper()); + _guardRock.setPosition(Common::Point(314, 132)); _hotspot2.postInit(); _hotspot2.setVisage(4018); @@ -923,14 +923,14 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _globals->_player.setPosition(Common::Point(260, 185)); if (!_globals->getFlag(36) && !_globals->getFlag(43)) - _hotspot7.setPosition(Common::Point(246, 146)); + _miranda.setPosition(Common::Point(246, 146)); if (_globals->getFlag(96)) { - _hotspot4.postInit(); - _hotspot4.setVisage(4006); - _hotspot4.animate(ANIM_MODE_1, NULL); - _hotspot4.setObjectWrapper(new SceneObjectWrapper()); - _hotspot4.setPosition(Common::Point(290, 163)); + _olo.postInit(); + _olo.setVisage(4006); + _olo.animate(ANIM_MODE_1, NULL); + _olo.setObjectWrapper(new SceneObjectWrapper()); + _olo.setPosition(Common::Point(290, 163)); } if (_globals->_stripNum == 4025) { @@ -947,15 +947,15 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _globals->_player.disableControl(); if (!_globals->getFlag(96)) { - _hotspot4.postInit(); - _hotspot4.setVisage(4006); - _hotspot4.animate(ANIM_MODE_1, NULL); - _hotspot4.setObjectWrapper(new SceneObjectWrapper()); - _hotspot4.setPosition(Common::Point(195, 128)); + _olo.postInit(); + _olo.setVisage(4006); + _olo.animate(ANIM_MODE_1, NULL); + _olo.setObjectWrapper(new SceneObjectWrapper()); + _olo.setPosition(Common::Point(195, 128)); Common::Point pt(268, 157); PlayerMover *mover = new PlayerMover(); - _hotspot4.addMover(mover, &pt, NULL); + _olo.addMover(mover, &pt, NULL); } _sceneMode = 4003; @@ -963,7 +963,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { } else if (_globals->getFlag(96)) { _globals->_player.disableControl(); _sceneMode = 4013; - setAction(&_sequenceManager1, this, 4013, &_hotspot4, NULL); + setAction(&_sequenceManager1, this, 4013, &_olo, NULL); } _globals->clearFlag(96); @@ -982,16 +982,16 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _globals->_player.setPosition(Common::Point(208, 153)); if (!_globals->getFlag(36) && !_globals->getFlag(43)) - _hotspot7.setPosition(Common::Point(246, 146)); + _miranda.setPosition(Common::Point(246, 146)); if (_globals->getFlag(39)) { _globals->clearFlag(39); - _hotspot4.postInit(); - _hotspot4.setVisage(4006); - _hotspot4.animate(ANIM_MODE_1, NULL); - _hotspot4.setObjectWrapper(new SceneObjectWrapper()); - _hotspot4.setPosition(Common::Point(219, 150)); + _olo.postInit(); + _olo.setVisage(4006); + _olo.animate(ANIM_MODE_1, NULL); + _olo.setObjectWrapper(new SceneObjectWrapper()); + _olo.setPosition(Common::Point(219, 150)); _globals->_player.disableControl(); setAction(&_sequenceManager1, this, 4010, &_globals->_player, NULL); @@ -1000,12 +1000,12 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { if (_globals->_stripNum == 4000) { _globals->_stripNum = 0; - _hotspot9.postInit(); - _hotspot9.setVisage(4001); - _hotspot9.animate(ANIM_MODE_1, NULL); - _hotspot9.setObjectWrapper(new SceneObjectWrapper()); - _hotspot9.setPosition(Common::Point(231, 159)); - _hotspot9.setStrip(4); + _guardRock.postInit(); + _guardRock.setVisage(4001); + _guardRock.animate(ANIM_MODE_1, NULL); + _guardRock.setObjectWrapper(new SceneObjectWrapper()); + _guardRock.setPosition(Common::Point(231, 159)); + _guardRock.setStrip(4); setAction(&_action12); } @@ -1045,29 +1045,29 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { } if (!_globals->getFlag(36) && !_globals->getFlag(43)) - _hotspot7.setPosition(Common::Point(246, 146)); + _miranda.setPosition(Common::Point(246, 146)); break; default: _globals->_soundHandler.startSound(155); - _hotspot3.postInit(); - _hotspot3.setVisage(4002); - _hotspot3._moveDiff = Common::Point(10, 10); - _hotspot3.setPosition(Common::Point(-100, 80)); - _hotspot3.changeZoom(-1); - _hotspot3.setPosition(Common::Point(130, -1)); - _hotspot3.animate(ANIM_MODE_2, NULL); + _lander.postInit(); + _lander.setVisage(4002); + _lander._moveDiff = Common::Point(10, 10); + _lander.setPosition(Common::Point(-100, 80)); + _lander.changeZoom(-1); + _lander.setPosition(Common::Point(130, -1)); + _lander.animate(ANIM_MODE_2, NULL); if (_globals->_stripNum == 9000) { - _hotspot4.postInit(); - _hotspot4.setVisage(4006); - _hotspot4.setPosition(Common::Point(235, 153)); + _olo.postInit(); + _olo.setVisage(4006); + _olo.setPosition(Common::Point(235, 153)); - _hotspot9.postInit(); - _hotspot9.setVisage(4001); - _hotspot9.setStrip(3); - _hotspot9.setPosition(Common::Point(255, 153)); + _guardRock.postInit(); + _guardRock.setVisage(4001); + _guardRock.setStrip(3); + _guardRock.setPosition(Common::Point(255, 153)); setAction(&_action11); _globals->_inventory._ladder._sceneNumber = 4100; @@ -1090,32 +1090,32 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _hotspot2.setPosition(Common::Point(182, 146)); _hotspot2.setAction(&_action10); } - - _hotspot7.setPosition(Common::Point(-210, 139)); + _miranda.setPosition(Common::Point(-210, 139)); setAction(&_action13); } + break; } if (_globals->_inventory._ladder._sceneNumber == 4000) { - _hotspot10.postInit(); - _hotspot10.setVisage(4000); - _hotspot10.setStrip(5); - _hotspot10.setPosition(Common::Point(245, 147)); + _ladder.postInit(); + _ladder.setVisage(4000); + _ladder.setStrip(5); + _ladder.setPosition(Common::Point(245, 147)); - _globals->_sceneItems.push_back(&_hotspot10); + _globals->_sceneItems.push_back(&_ladder); } if (_globals->_inventory._rope._sceneNumber == 4000) { - _hotspot6.postInit(); - _hotspot6.setVisage(4000); - _hotspot6.setStrip(7); - _hotspot6.setPriority2(1); - _hotspot6.setPosition(Common::Point(268, 44)); + _rope.postInit(); + _rope.setVisage(4000); + _rope.setStrip(7); + _rope.setPriority2(1); + _rope.setPosition(Common::Point(268, 44)); } _globals->_sceneItems.addItems(&_hotspot8, &_hotspot17, &_hotspot18, &_hotspot14, &_hotspot15, - &_hotspot16, &_hotspot12, &_hotspot13, &_hotspot21, &_hotspot20, &_hotspot22, &_hotspot23, + &_hotspot16, &_theTech, &_hotspot13, &_hotspot21, &_hotspot20, &_hotspot22, &_hotspot23, &_hotspot24, &_hotspot25, &_hotspot19, &_hotspot26, NULL); } @@ -1154,21 +1154,21 @@ void Scene4000::signal() { break; case 4010: _globals->setFlag(38); - _hotspot4.remove(); + _olo.remove(); break; case 4012: - _globals->_player.checkAngle(&_hotspot12); + _globals->_player.checkAngle(&_theTech); _globals->_sceneManager.changeScene(4025); break; case 4013: _globals->_player.enableControl(); - _hotspot4.remove(); + _olo.remove(); break; case 4014: _globals->_sceneManager.changeScene(4250); break; case 4015: - ADD_MOVER_NULL(_hotspot7, 0, _hotspot7._position.y - 5); + ADD_MOVER_NULL(_miranda, 0, _miranda._position.y - 5); break; } } @@ -1192,19 +1192,19 @@ void Scene4000::dispatch() { _hotspot5.setPriority2(94); } - if (_globals->_sceneObjects->contains(&_hotspot7)) { - if (!_hotspot7._mover) - _hotspot7.checkAngle(&_globals->_player); + if (_globals->_sceneObjects->contains(&_miranda)) { + if (!_miranda._mover) + _miranda.checkAngle(&_globals->_player); if (!_action && _globals->_player.getRegionIndex() == 23) { - ADD_MOVER_NULL(_hotspot7, 204, 186); + ADD_MOVER_NULL(_miranda, 204, 186); } - if ((_hotspot7.getRegionIndex() == 10) || (_hotspot7.getRegionIndex() == 6)) - _hotspot7.setPriority2(200); - if (_hotspot7.getRegionIndex() == 11) - _hotspot7.setPriority2(-1); - if (_hotspot7.getRegionIndex() == 5) - _hotspot7.setPriority2(94); + if ((_miranda.getRegionIndex() == 10) || (_miranda.getRegionIndex() == 6)) + _miranda.setPriority2(200); + if (_miranda.getRegionIndex() == 11) + _miranda.setPriority2(-1); + if (_miranda.getRegionIndex() == 5) + _miranda.setPriority2(94); } if (!_action) { @@ -1225,13 +1225,13 @@ void Scene4000::dispatch() { if ((_globals->_player._position.x > 5) && (_globals->_player._position.y < 100)) { _globals->_player.disableControl(); - if (!_globals->_sceneObjects->contains(&_hotspot7) || (_hotspot7._position.y <= 100)) { + if (!_globals->_sceneObjects->contains(&_miranda) || (_miranda._position.y <= 100)) { _sceneMode = 4008; setAction(&_sequenceManager1, this, 4008, &_globals->_player, NULL); } else { _sceneMode = 4015; _globals->_player.addMover(NULL); - setAction(&_sequenceManager1, this, 4015, &_globals->_player, &_hotspot7, NULL); + setAction(&_sequenceManager1, this, 4015, &_globals->_player, &_miranda, NULL); } } } @@ -2364,7 +2364,8 @@ void Scene4100::Action3::signal() { scene->_stripManager.start(4505, this); break; case 2: - scene->setAction(&scene->_action2); + setAction(&scene->_action2, this); + break; case 3: scene->_stripManager.start(4510, this); break; @@ -2374,6 +2375,8 @@ void Scene4100::Action3::signal() { case 5: _globals->_sceneManager.changeScene(4150); break; + default: + break; } } @@ -2417,14 +2420,14 @@ void Scene4100::Action5::signal() { case 1: if (_globals->_inventory._ladder._sceneNumber == 4100) { _globals->_inventory._ladder._sceneNumber = 1; - scene->_hotspot6.remove(); + scene->_ladder.remove(); } else { - scene->_hotspot6.postInit(); - scene->_hotspot6.setVisage(4101); - scene->_hotspot6.setPosition(Common::Point(49, 144)); + scene->_ladder.postInit(); + scene->_ladder.setVisage(4101); + scene->_ladder.setPosition(Common::Point(49, 144)); _globals->_inventory._ladder._sceneNumber = 4100; - _globals->_sceneItems.push_front(&scene->_hotspot6); + _globals->_sceneItems.push_front(&scene->_ladder); } _globals->_player.enableControl(); @@ -2456,20 +2459,26 @@ void Scene4100::Hotspot1::doAction(int action) { Scene4100 *scene = (Scene4100 *)_globals->_sceneManager._scene; switch (action) { - case CURSOR_LOOK: - SceneItem::display2(4100, _globals->getFlag(42) ? 24 : 12); - break; case OBJECT_STUNNER: SceneItem::display2(4100, 16); break; + case OBJECT_ALE: + _globals->_player.disableControl(); + scene->setAction(&scene->_action3); + break; + case CURSOR_LOOK: + SceneItem::display2(4100, _globals->getFlag(42) ? 24 : 12); + break; case CURSOR_USE: SceneItem::display2(4100, 22); break; case CURSOR_TALK: if (_globals->_inventory._peg._sceneNumber == 1) { _globals->_player.disableControl(); + scene->_sceneMode = 4109; scene->setAction(&scene->_sequenceManager, scene, 4109, NULL); } else if (_globals->getFlag(42)) { + scene->_sceneMode = 4102; scene->setAction(&scene->_sequenceManager, scene, 4102, NULL); } else { if (_globals->getFlag(33)) @@ -2502,7 +2511,7 @@ void Scene4100::Hotspot2::doAction(int action) { } } -void Scene4100::Hotspot5::doAction(int action) { +void Scene4100::Miranda::doAction(int action) { Scene4100 *scene = (Scene4100 *)_globals->_sceneManager._scene; switch (action) { @@ -2519,7 +2528,7 @@ void Scene4100::Hotspot5::doAction(int action) { } } -void Scene4100::Hotspot6::doAction(int action) { +void Scene4100::Ladder::doAction(int action) { Scene4100 *scene = (Scene4100 *)_globals->_sceneManager._scene; switch (action) { @@ -2612,26 +2621,26 @@ void Scene4100::postInit(SceneObjectList *OwnerList) { _hotspot4.setStrip2(2); _hotspot4.setPosition(Common::Point(152, 167)); - if (_globals->getFlag(36)) { + if (!_globals->getFlag(36)) { _hotspot1.setVisage(4105); _hotspot1.setStrip(1); _hotspot1.setFrame(4); } else if (!_globals->getFlag(43)) { - _hotspot5.postInit(); - _hotspot5.setVisage(4102); - _hotspot5.setStrip2(3); - _hotspot5.setFrame(2); - _hotspot5.setPosition(Common::Point(65, 188)); + _miranda.postInit(); + _miranda.setVisage(4102); + _miranda.setStrip2(3); + _miranda.setFrame(2); + _miranda.setPosition(Common::Point(65, 188)); - _globals->_sceneItems.push_back(&_hotspot5); + _globals->_sceneItems.push_back(&_miranda); } if (_globals->_inventory._ladder._sceneNumber == 4100) { - _hotspot6.postInit(); - _hotspot6.setVisage(4101); - _hotspot6.setPosition(Common::Point(49, 144)); + _ladder.postInit(); + _ladder.setVisage(4101); + _ladder.setPosition(Common::Point(49, 144)); - _globals->_sceneItems.push_back(&_hotspot6); + _globals->_sceneItems.push_back(&_ladder); } _hotspot14.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); diff --git a/engines/tsage/ringworld_scenes5.h b/engines/tsage/ringworld_scenes5.h index b1b85c9c59..ee943a847f 100644 --- a/engines/tsage/ringworld_scenes5.h +++ b/engines/tsage/ringworld_scenes5.h @@ -89,7 +89,7 @@ class Scene4000 : public Scene { }; /* Hotspots */ - class Hotspot7 : public SceneObject { + class Miranda : public SceneObject { public: virtual void doAction(int action); }; @@ -103,15 +103,15 @@ class Scene4000 : public Scene { } virtual void doAction(int action); }; - class Hotspot9 : public SceneObject { + class GuardRock : public SceneObject { public: virtual void doAction(int action); }; - class Hotspot10 : public SceneObject { + class Ladder : public SceneObject { public: virtual void doAction(int action); }; - class Hotspot12 : public SceneObject { + class TheTech : public SceneObject { public: virtual void doAction(int action); }; @@ -151,13 +151,13 @@ public: SpeakerCHFR _speakerCHFR; SpeakerQL _speakerQL; SpeakerCHFText _speakerCHFText; - SceneObject _hotspot1, _hotspot2, _hotspot3, _hotspot4, _hotspot5, _hotspot6; - Hotspot7 _hotspot7; + SceneObject _smoke1, _hotspot2, _lander, _olo, _hotspot5, _rope; + Miranda _miranda; Hotspot8 _hotspot8; - Hotspot9 _hotspot9; - Hotspot10 _hotspot10; + GuardRock _guardRock; + Ladder _ladder; DisplayHotspot _hotspot11; - Hotspot12 _hotspot12; + TheTech _theTech; Hotspot13 _hotspot13; Hotspot _hotspot14, _hotspot15, _hotspot16; Hotspot17 _hotspot17; @@ -165,7 +165,7 @@ public: DisplayHotspot _hotspot19, _hotspot20, _hotspot21, _hotspot22; Hotspot23 _hotspot23; DisplayHotspot _hotspot24, _hotspot25, _hotspot26; - SceneObject _hotspot27; + SceneObject _smoke2; Action1 _action1; Action2 _action2; Action3 _action3; @@ -395,11 +395,11 @@ class Scene4100 : public Scene { public: virtual void doAction(int action); }; - class Hotspot5 : public SceneObject { + class Miranda : public SceneObject { public: virtual void doAction(int action); }; - class Hotspot6 : public SceneObject { + class Ladder : public SceneObject { public: virtual void doAction(int action); }; @@ -425,8 +425,8 @@ public: Hotspot1 _hotspot1; Hotspot2 _hotspot2; DisplayHotspot _hotspot3, _hotspot4; - Hotspot5 _hotspot5; - Hotspot6 _hotspot6; + Miranda _miranda; + Ladder _ladder; DisplayHotspot _hotspot7, _hotspot8, _hotspot9, _hotspot10; DisplayHotspot _hotspot11, _hotspot12, _hotspot13; Hotspot14 _hotspot14; diff --git a/engines/tsage/saveload.cpp b/engines/tsage/saveload.cpp index 594d30fa3c..8b07767f22 100644 --- a/engines/tsage/saveload.cpp +++ b/engines/tsage/saveload.cpp @@ -151,13 +151,13 @@ Common::Error Saver::save(int slot, const Common::String &saveName) { } Common::Error Saver::restore(int slot) { - assert(!getMacroSaveFlag()); + assert(!getMacroRestoreFlag()); // Signal any objects registered for notification _loadNotifiers.notify(false); // Set fields - _macroSaveFlag = true; + _macroRestoreFlag = true; _saveSlot = slot; _unresolvedPtrs.clear(); @@ -335,7 +335,7 @@ bool Saver::savegamesExist() const { */ int Saver::blockIndexOf(SavedObject *p) { int objIndex = 1; - SynchronisedList<SavedObject *>::iterator iObj; + Common::List<SavedObject *>::iterator iObj; for (iObj = _objList.begin(); iObj != _objList.end(); ++iObj, ++objIndex) { SavedObject *iObjP = *iObj; @@ -347,6 +347,25 @@ int Saver::blockIndexOf(SavedObject *p) { } /** + * Returns the number of objects in the object list registry + */ +int Saver::getObjectCount() const { + return _objList.size(); +} + +/** + * List any currently active objects + */ +void Saver::listObjects() { + Common::List<SavedObject *>::iterator i; + int count = 1; + + for (i = _objList.begin(); i != _objList.end(); ++i, ++count) + debug("%d - %s", count, (*i)->getClassName().c_str()); + debugN("\n"); +} + +/** * Returns the pointer associated with the specified object index */ void Saver::resolveLoadPointers() { @@ -358,12 +377,14 @@ void Saver::resolveLoadPointers() { int objIndex = 1; for (SynchronisedList<SavedObject *>::iterator iObj = _objList.begin(); iObj != _objList.end(); ++iObj, ++objIndex) { Common::List<SavedObjectRef>::iterator iPtr; + SavedObject *pObj = *iObj; for (iPtr = _unresolvedPtrs.begin(); iPtr != _unresolvedPtrs.end(); ) { SavedObjectRef &r = *iPtr; if (r._objIndex == objIndex) { // Found an unresolved pointer to this object - *r._savedObject = *iObj; + SavedObject **objPP = r._savedObject; + *objPP = pObj; iPtr = _unresolvedPtrs.erase(iPtr); } else { ++iPtr; diff --git a/engines/tsage/saveload.h b/engines/tsage/saveload.h index 945d144ae5..c45271b8fc 100644 --- a/engines/tsage/saveload.h +++ b/engines/tsage/saveload.h @@ -54,8 +54,8 @@ struct tSageSavegameHeader { // FIXME: workaround to supress spurious strict-alias warnings on older GCC // versions. this should be resolved with the savegame rewrite #define SYNC_POINTER(x) do { \ - SavedObject *y = (SavedObject *)x; \ - s.syncPointer(&y); \ + SavedObject **y = (SavedObject **)((void *)&x); \ + s.syncPointer(y); \ } while (false) #define SYNC_ENUM(FIELD, TYPE) int v_##FIELD = (int)FIELD; s.syncAsUint16LE(v_##FIELD); \ @@ -176,7 +176,7 @@ typedef SavedObject *(*SavedObjectFactory)(const Common::String &className); class Saver { private: - SynchronisedList<SavedObject *> _objList; + Common::List<SavedObject *> _objList; FunctionList<bool> _saveNotifiers; FunctionList<bool> _loadNotifiers; Common::List<SaveListener *> _listeners; @@ -212,6 +212,8 @@ public: bool getMacroSaveFlag() const { return _macroSaveFlag; } bool getMacroRestoreFlag() const { return _macroRestoreFlag; } int blockIndexOf(SavedObject *p); + int getObjectCount() const; + void listObjects(); }; extern Saver *_saver; diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index 748e8662fd..8454c7ebd4 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -27,6 +27,7 @@ #include "tsage/globals.h" #include "tsage/ringworld_logic.h" #include "tsage/tsage.h" +#include "tsage/saveload.h" namespace tSage { @@ -39,6 +40,7 @@ SceneManager::SceneManager() { _fadeMode = FADEMODE_GRADUAL; _scrollerRect = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); _saver->addListener(this); + _objectCount = 0; } SceneManager::~SceneManager() { @@ -107,6 +109,12 @@ void SceneManager::sceneChange() { // Free any regions disposeRegions(); + // Ensure that the same number of objects are registered now as when the scene started + if (_objectCount > 0) { + assert(_objectCount == _saver->getObjectCount()); + } + _objectCount = _saver->getObjectCount(); + // Instantiate and set the new scene _scene = getNewScene(); _scene->postInit(); @@ -240,7 +248,7 @@ Scene::~Scene() { void Scene::synchronise(Serialiser &s) { s.syncAsSint32LE(_field12); - s.syncAsSint32LE(_sceneNumber); + s.syncAsSint32LE(_screenNumber); s.syncAsSint32LE(_activeScreenNumber); s.syncAsSint32LE(_sceneMode); _backgroundBounds.synchronise(s); @@ -273,7 +281,7 @@ void Scene::dispatch() { void Scene::loadScene(int sceneNum) { warning("loadScene(%d)", sceneNum); - _sceneNumber = sceneNum; + _screenNumber = sceneNum; if (_globals->_scenePalette.loadPalette(sceneNum)) _globals->_sceneManager._hasPalette = true; diff --git a/engines/tsage/scenes.h b/engines/tsage/scenes.h index 1a6f92745d..0ac906728f 100644 --- a/engines/tsage/scenes.h +++ b/engines/tsage/scenes.h @@ -39,7 +39,7 @@ private: void drawAltObjects(); public: int _field12; - int _sceneNumber; + int _screenNumber; int _activeScreenNumber; int _sceneMode; StripManager _stripManager; @@ -88,6 +88,7 @@ public: int _sceneLoadCount; Rect _scrollerRect; SceneObjectList _altSceneObjects; + int _objectCount; public: SceneManager(); virtual ~SceneManager(); |