diff options
43 files changed, 2499 insertions, 2110 deletions
diff --git a/audio/softsynth/mt32.cpp b/audio/softsynth/mt32.cpp index 29f5e3577c..2a90b583f3 100644 --- a/audio/softsynth/mt32.cpp +++ b/audio/softsynth/mt32.cpp @@ -460,9 +460,6 @@ bool MT32EmuMusicPlugin::checkDevice(MidiDriver::DeviceHandle) const { } Common::Error MT32EmuMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const { - if (ConfMan.hasKey("extrapath")) - SearchMan.addDirectory("extrapath", ConfMan.get("extrapath")); - *mididriver = new MidiDriver_MT32(g_system->getMixer()); return Common::kNoError; diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index c240727069..bc80d8ad6a 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -392,10 +392,15 @@ Common::String OSystem_SDL::getSystemLanguage() const { } #else // WIN32 // Activating current locale settings - const char *locale = setlocale(LC_ALL, ""); + const Common::String locale = setlocale(LC_ALL, ""); + + // Restore default C locale to prevent issues with + // portability of sscanf(), atof(), etc. + // See bug #3615148 + setlocale(LC_ALL, "C"); // Detect the language from the locale - if (!locale) { + if (locale.empty()) { return ModularBackend::getSystemLanguage(); } else { int length = 0; @@ -404,14 +409,14 @@ Common::String OSystem_SDL::getSystemLanguage() const { // ".UTF-8" or the like. We do this, since // our translation languages are usually // specified without any charset information. - for (int i = 0; locale[i]; ++i, ++length) { + for (int size = locale.size(); length < size; ++length) { // TODO: Check whether "@" should really be checked // here. - if (locale[i] == '.' || locale[i] == ' ' || locale[i] == '@') + if (locale[length] == '.' || locale[length] == ' ' || locale[length] == '@') break; } - return Common::String(locale, length); + return Common::String(locale.c_str(), length); } #endif // WIN32 #else // USE_DETECTLANG diff --git a/common/recorderfile.cpp b/common/recorderfile.cpp index d08bc599f1..7c438cbf69 100644 --- a/common/recorderfile.cpp +++ b/common/recorderfile.cpp @@ -45,6 +45,8 @@ PlaybackFile::PlaybackFile() : _tmpRecordFile(_tmpBuffer, kRecordBuffSize), _tmp _recordCount = 0; _eventsSize = 0; memset(_tmpBuffer, 1, kRecordBuffSize); + + _playbackParseState = kFileStateCheckFormat; } PlaybackFile::~PlaybackFile() { diff --git a/common/zlib.cpp b/common/zlib.cpp index 920338e57e..f1a298a9f1 100644 --- a/common/zlib.cpp +++ b/common/zlib.cpp @@ -27,6 +27,7 @@ #include "common/ptr.h" #include "common/util.h" #include "common/stream.h" +#include "common/textconsole.h" #if defined(USE_ZLIB) #ifdef __SYMBIAN32__ @@ -158,10 +159,11 @@ protected: uint32 _pos; uint32 _origSize; bool _eos; + bool _shownBackwardSeekingWarning; public: - GZipReadStream(SeekableReadStream *w, uint32 knownSize = 0) : _wrapped(w), _stream() { + GZipReadStream(SeekableReadStream *w, uint32 knownSize = 0) : _wrapped(w), _stream(), _shownBackwardSeekingWarning(false) { assert(w != 0); // Verify file header is correct @@ -241,13 +243,17 @@ public: } bool seek(int32 offset, int whence = SEEK_SET) { int32 newPos = 0; - assert(whence != SEEK_END); // SEEK_END not supported switch (whence) { case SEEK_SET: newPos = offset; break; case SEEK_CUR: newPos = _pos + offset; + break; + case SEEK_END: + // NOTE: This can be an expensive operation (see below). + newPos = size() + offset; + break; } assert(newPos >= 0); @@ -256,9 +262,15 @@ public: // To search backward, we have to restart the whole decompression // from the start of the file. A rather wasteful operation, best // to avoid it. :/ -#if DEBUG - warning("Backward seeking in GZipReadStream detected"); -#endif + + if (!_shownBackwardSeekingWarning) { + // We only throw this warning once per stream, to avoid + // getting the console swarmed with warnings when consecutive + // seeks are made. + warning("Backward seeking in GZipReadStream detected"); + _shownBackwardSeekingWarning = true; + } + _pos = 0; _wrapped->seek(0, SEEK_SET); _zlibErr = inflateReset(&_stream); diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index ef03c51107..e373ab58c3 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -43,6 +43,21 @@ AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription * _rnd->setSeed(time.tm_sec + time.tm_min + time.tm_hour); _showDebugLines = false; + _clock = nullptr; + _graphics = nullptr; + _parser = nullptr; + _pingo = nullptr; + _dialogs = nullptr; + _background = nullptr; + _sequence = nullptr; + _timer = nullptr; + _animation = nullptr; + _menu = nullptr; + _closing = nullptr; + _sound = nullptr; + + _platform = gd->desc.platform; + initVariables(); } @@ -130,6 +145,7 @@ void AvalancheEngine::initVariables() { _thinkThing = true; _seeScroll = false; _currentMouse = 177; + _holdLeftMouse = false; } Common::ErrorCode AvalancheEngine::initialize() { diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 3cc342ca8c..b6e168f830 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -55,7 +55,9 @@ class RandomSource; namespace Avalanche { -struct AvalancheGameDescription; +struct AvalancheGameDescription { + ADGameDescription desc; +}; static const int kSavegameVersion = 1; diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp index 428e71f35a..048b0fe148 100644 --- a/engines/avalanche/detection.cpp +++ b/engines/avalanche/detection.cpp @@ -35,10 +35,6 @@ namespace Avalanche { -struct AvalancheGameDescription { - ADGameDescription desc; -}; - uint32 AvalancheEngine::getFeatures() const { return _gameDescription->desc.flags; } diff --git a/engines/cine/sound.cpp b/engines/cine/sound.cpp index 0df926675e..de6f91d8c3 100644 --- a/engines/cine/sound.cpp +++ b/engines/cine/sound.cpp @@ -309,9 +309,7 @@ void AdLibSoundDriver::setupChannel(int channel, const byte *data, int instrumen volume = 0; } volume += volume / 4; - if (volume > 127) { - volume = 127; - } + _channelsVolumeTable[channel] = volume; setupInstrument(data, channel); } diff --git a/engines/fullpipe/behavior.cpp b/engines/fullpipe/behavior.cpp index c1fe835b81..c7b526d2c1 100644 --- a/engines/fullpipe/behavior.cpp +++ b/engines/fullpipe/behavior.cpp @@ -179,6 +179,12 @@ void BehaviorManager::updateStaticAniBehavior(StaticANIObject *ani, int delay, B } } +bool BehaviorManager::setBehaviorEnabled(StaticANIObject *obj, int aniId, int quId, int flag) { + warning("STUB: BehaviorManager::setBehaviorEnabled()"); + + return true; +} + void BehaviorInfo::clear() { _ani = 0; _staticsId = 0; diff --git a/engines/fullpipe/behavior.h b/engines/fullpipe/behavior.h index 83a548f486..4fd1454351 100644 --- a/engines/fullpipe/behavior.h +++ b/engines/fullpipe/behavior.h @@ -77,6 +77,8 @@ class BehaviorManager : public CObject { void updateBehaviors(); void updateBehavior(BehaviorInfo *behaviorInfo, BehaviorEntry *entry); void updateStaticAniBehavior(StaticANIObject *ani, int delay, BehaviorEntry *beh); + + bool setBehaviorEnabled(StaticANIObject *obj, int aniId, int quId, int flag); }; } // End of namespace Fullpipe diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h index 2cf7425de4..c0034e444d 100644 --- a/engines/fullpipe/constants.h +++ b/engines/fullpipe/constants.h @@ -26,6 +26,8 @@ namespace Fullpipe { #define ANI_BOOT_1 4231 +#define ANI_DOMINO_3 2732 +#define ANI_EGGEATER 334 #define ANI_IN1MAN 5110 #define ANI_INV_MAP 5321 #define ANI_LIFTBUTTON 2751 @@ -98,11 +100,17 @@ namespace Fullpipe { #define PIC_SC1_LADDER 1091 #define PIC_SC1_OSK 1018 #define PIC_SC1_OSK2 2932 +#define PIC_SC3_DOMIN 5182 #define PIC_SCD_SEL 734 +#define QU_EGTR_MD2_SHOW 4698 +#define QU_EGTR_MD1_SHOW 4697 +#define QU_EGTR_SLIMSHOW 4883 #define QU_IN2_DO 5144 #define QU_INTR_FINISH 5138 #define QU_INTR_GETUPMAN 5136 #define QU_INTR_STARTINTRO 5133 +#define QU_SC3_ENTERLIFT 2779 +#define QU_SC3_EXITLIFT 2808 #define SC_1 301 #define SC_10 653 #define SC_11 654 @@ -158,6 +166,9 @@ namespace Fullpipe { #define SND_CMN_031 3516 #define SND_CMN_070 5199 #define SND_INTR_019 5220 +#define ST_EGTR_MID1 2863 +#define ST_EGTR_MID2 2869 +#define ST_EGTR_SLIM 336 #define ST_IN1MAN_SLEEP 5112 #define ST_LBN_0N 2832 #define ST_LBN_0P 2833 diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index 22e4f1d8f4..7f1c9baa9b 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -210,7 +210,7 @@ public: int _objectIdAtCursor; void setCursor(int id); - void updateCursorsCommon(); + void updateCursorCommon(); int getObjectState(const char *objname); void setObjectState(const char *name, int state); @@ -231,6 +231,7 @@ public: void getAllInventory(); int lift_getButtonIdP(int objid); + void lift_sub5(Scene *sc, int qu1, int qu2); public: diff --git a/engines/fullpipe/input.cpp b/engines/fullpipe/input.cpp index ee826fd359..e98920c78a 100644 --- a/engines/fullpipe/input.cpp +++ b/engines/fullpipe/input.cpp @@ -211,7 +211,7 @@ void FullpipeEngine::winArcade() { } -void FullpipeEngine::updateCursorsCommon() { +void FullpipeEngine::updateCursorCommon() { GameObject *ani = _currentScene->getStaticANIObjectAtPos(_mouseVirtX, _mouseVirtY); GameObject *pic = _currentScene->getPictureObjectAtPos(_mouseVirtX, _mouseVirtY); diff --git a/engines/fullpipe/lift.cpp b/engines/fullpipe/lift.cpp index 25dd2613fe..8fa6cf744d 100644 --- a/engines/fullpipe/lift.cpp +++ b/engines/fullpipe/lift.cpp @@ -64,4 +64,8 @@ int FullpipeEngine::lift_getButtonIdP(int objid) { } } +void FullpipeEngine::lift_sub5(Scene *sc, int qu1, int qu2) { + warning("STUB: FullpipeEngine::lift_sub5()"); +} + } // End of namespace Fullpipe diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index aa7d02a405..8fecd8304e 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -113,7 +113,8 @@ void MctlCompound::initMovGraph2() { } void MctlCompound::freeItems() { - warning("STUB: MctlCompound::freeItems()"); + for (uint i = 0; i < _motionControllers.size(); i++) + _motionControllers[i]->_motionControllerObj->freeItems(); } MessageQueue *MctlCompound::method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { @@ -850,7 +851,7 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int Common::Array<MovGraphLink *> tempLinkList; double minPath = findMinPath(&linkInfoSource, &linkInfoDest, &tempLinkList); - debug(0, "MovGraph2::doWalkTo(): path: %lf parts: %d", minPath, tempLinkList.size()); + debug(0, "MovGraph2::doWalkTo(): path: %g parts: %d", minPath, tempLinkList.size()); if (minPath < 0.0 || ((linkInfoSource.node != linkInfoDest.node || !linkInfoSource.node) && !tempLinkList.size())) return 0; @@ -1002,7 +1003,7 @@ int MovGraph2::findLink(Common::Array<MovGraphLink *> *linkList, int idx, Common } } node3 = node1; - } else if (idx != linkList->size() - 1) { + } else if (idx != (int)(linkList->size() - 1)) { MovGraphLink *lnk = (*linkList)[idx + 1]; if (lnk->_movGraphNode1 == node1 || lnk->_movGraphNode1 == node1) { @@ -1067,7 +1068,7 @@ MovGraphLink *MovGraph2::findLink1(int x, int y, int idx, int fuzzyMatch) { MovGraphLink *MovGraph2::findLink2(int x, int y) { double mindist = 1.0e20; - MovGraphLink *res; + MovGraphLink *res = 0; for (ObList::iterator i = _links.begin(); i != _links.end(); ++i) { assert(((CObject *)*i)->_objtype == kObjTypeMovGraphLink); diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp index 1793ffdc3a..fdc28e8092 100644 --- a/engines/fullpipe/scenes.cpp +++ b/engines/fullpipe/scenes.cpp @@ -53,6 +53,11 @@ void scene01_fixEntrance(); void scene01_initScene(Scene *sc, int entrance); int sceneHandler01(ExCommand *cmd); +void scene03_setEaterState(); +int scene03_updateCursor(); +void scene03_initScene(Scene *sc); +int sceneHandler03(ExCommand *cmd); + void sceneDbgMenu_initScene(Scene *sc); int sceneHandlerDbgMenu(ExCommand *cmd); @@ -71,6 +76,9 @@ Vars::Vars() { scene01_picSc01Osk = 0; scene01_picSc01Osk2 = 0; + scene03_eggeater = 0; + scene03_domino = 0; + selector = 0; } @@ -210,6 +218,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { addMessageHandler(sceneHandler02, 2); _updateCursorCallback = defaultUpdateCursor; break; +#endif case SC_3: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_3"); @@ -219,10 +228,11 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { scene->initObjectCursors("SC_3"); setSceneMusicParameters(sceneVar); addMessageHandler(sceneHandler03, 2); - j_Scene_sc03_sub_40F160(scene); + scene03_setEaterState(); _updateCursorCallback = scene03_updateCursor; break; +#if 0 case SC_4: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_4"); scene->preloadMovements(sceneVar); @@ -1384,7 +1394,7 @@ int MovGraph_messageHandler(ExCommand *cmd) { } int defaultUpdateCursor() { - g_fullpipe->updateCursorsCommon(); + g_fullpipe->updateCursorCommon(); return g_fullpipe->_cursorId; } @@ -1455,7 +1465,7 @@ int sceneHandlerIntro(ExCommand *ex) { return 0; case 33: - // fall trhough + // fall through break; default: @@ -1556,6 +1566,46 @@ int sceneHandler01(ExCommand *cmd) { return res; } +void scene03_initScene(Scene *sc) { + g_vars->scene03_eggeater = sc->getStaticANIObject1ById(ANI_EGGEATER, -1); + g_vars->scene03_domino = sc->getStaticANIObject1ById(ANI_DOMINO_3, -1); + + GameVar *v = g_fullpipe->_gameLoader->_gameVar->getSubVarByName("OBJSTATES")->getSubVarByName(sO_GulpedEggs); + + g_vars->swallowedEgg1 = v->getSubVarByName(sO_Egg1); + g_vars->swallowedEgg2 = v->getSubVarByName(sO_Egg2); + g_vars->swallowedEgg3 = v->getSubVarByName(sO_Egg3); + + setElevatorButton(sO_Level2, ST_LBN_2N); + + g_fullpipe->lift_sub5(sc, QU_SC3_ENTERLIFT, QU_SC3_EXITLIFT); +} + +void scene03_setEaterState() { + if (g_fullpipe->getObjectState(sO_EggGulperGaveCoin) == g_fullpipe->getObjectEnumState(sO_EggGulperGaveCoin, sO_Yes)) { + g_fullpipe->_behaviorManager->setBehaviorEnabled(g_vars->scene03_eggeater, ST_EGTR_SLIM, QU_EGTR_SLIMSHOW, 0); + g_fullpipe->_behaviorManager->setBehaviorEnabled(g_vars->scene03_eggeater, ST_EGTR_MID1, QU_EGTR_MD1_SHOW, 0); + g_fullpipe->_behaviorManager->setBehaviorEnabled(g_vars->scene03_eggeater, ST_EGTR_MID2, QU_EGTR_MD2_SHOW, 0); + } +} + +int scene03_updateCursor() { + g_fullpipe->updateCursorCommon(); + + if (g_fullpipe->_cursorId == PIC_CSR_DEFAULT && g_fullpipe->_objectIdAtCursor == PIC_SC3_DOMIN && g_vars->scene03_domino) { + if (g_vars->scene03_domino->_flags & 4) + g_fullpipe->_cursorId = PIC_CSR_ITN; + } + + return g_fullpipe->_cursorId; +} + +int sceneHandler03(ExCommand *ex) { + warning("STUB: sceneHandler03()"); + + return 0; +} + void sceneDbgMenu_initScene(Scene *sc) { g_vars->selector = sc->getPictureObjectById(PIC_SCD_SEL, 0); getGameLoaderInteractionController()->disableFlag24(); diff --git a/engines/fullpipe/scenes.h b/engines/fullpipe/scenes.h index 9100fa6a0c..9d1dbd5e55 100644 --- a/engines/fullpipe/scenes.h +++ b/engines/fullpipe/scenes.h @@ -28,7 +28,7 @@ namespace Fullpipe { class StaticANIObject; class Vars { - public: +public: Vars(); GameVar *swallowedEgg1; @@ -45,6 +45,9 @@ class Vars { PictureObject *scene01_picSc01Osk; PictureObject *scene01_picSc01Osk2; + StaticANIObject *scene03_eggeater; + StaticANIObject *scene03_domino; + PictureObject *selector; }; diff --git a/engines/made/made.cpp b/engines/made/made.cpp index 3843040961..3e192cb04c 100644 --- a/engines/made/made.cpp +++ b/engines/made/made.cpp @@ -85,7 +85,7 @@ MadeEngine::MadeEngine(OSystem *syst, const MadeGameDescription *gameDesc) : Eng _script = new ScriptInterpreter(this); - _music = new MusicPlayer(); + _music = nullptr; // Set default sound frequency switch (getGameID()) { @@ -102,8 +102,6 @@ MadeEngine::MadeEngine(OSystem *syst, const MadeGameDescription *gameDesc) : Eng // Return to Zork sets it itself via a script funtion break; } - - syncSoundSettings(); } MadeEngine::~MadeEngine() { @@ -277,6 +275,8 @@ void MadeEngine::handleEvents() { } Common::Error MadeEngine::run() { + _music = new MusicPlayer(); + syncSoundSettings(); // Initialize backend initGraphics(320, 200, false); diff --git a/engines/neverhood/klaymen.cpp b/engines/neverhood/klaymen.cpp index a942bcae8c..e1a0d72d50 100644 --- a/engines/neverhood/klaymen.cpp +++ b/engines/neverhood/klaymen.cpp @@ -300,7 +300,7 @@ void Klaymen::stSitIdleTeleporterBlink() { void Klaymen::stSitIdleTeleporterBlinkSecond() { _busyStatus = 0; _acceptInput = true; - startAnimation(0x5C24C018, 0, -1); + startAnimation(0x582EC138, 0, -1); SetUpdateHandler(&Klaymen::upSitIdleTeleporter); SetMessageHandler(&Klaymen::hmLowLevel); SetSpriteUpdate(NULL); diff --git a/engines/neverhood/screen.h b/engines/neverhood/screen.h index c778066152..a9b5af02f6 100644 --- a/engines/neverhood/screen.h +++ b/engines/neverhood/screen.h @@ -79,7 +79,6 @@ public: void drawSurface2(const Graphics::Surface *surface, NDrawRect &drawRect, NRect &clipRect, bool transparent, byte version, const Graphics::Surface *shadowSurface = NULL); void drawSurface3(const Graphics::Surface *surface, int16 x, int16 y, NDrawRect &drawRect, NRect &clipRect, bool transparent, byte version); - void drawShadowSurface(const Graphics::Surface *surface, const Graphics::Surface *shadowSurface, int16 x, int16 y, NDrawRect &drawRect, NRect &clipRect); void drawDoubleSurface2(const Graphics::Surface *surface, NDrawRect &drawRect); void drawUnk(const Graphics::Surface *surface, NDrawRect &drawRect, NDrawRect &sysRect, NRect &clipRect, bool transparent, byte version); void drawSurfaceClipRects(const Graphics::Surface *surface, NDrawRect &drawRect, NRect *clipRects, uint clipRectsCount, bool transparent, byte version); diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index 3f36d56420..dca1870cb7 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -218,7 +218,7 @@ void Palette::rotate(uint first, uint last, bool forward) { -void Gfx::setPalette(Palette pal) { +void Gfx::setPalette(Palette &pal) { byte sysPal[256*3]; uint n = pal.fillRGB(sysPal); diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h index 55c1c0c04e..550f9d1dd9 100644 --- a/engines/parallaction/graphics.h +++ b/engines/parallaction/graphics.h @@ -465,7 +465,7 @@ public: void invertBackground(const Common::Rect& r); // palette - void setPalette(Palette palette); + void setPalette(Palette &palette); void setBlackPalette(); void animatePalette(); diff --git a/engines/parallaction/sound_br.cpp b/engines/parallaction/sound_br.cpp index 4a643aaf1d..ea769de9e8 100644 --- a/engines/parallaction/sound_br.cpp +++ b/engines/parallaction/sound_br.cpp @@ -207,6 +207,7 @@ public: void play(Common::SeekableReadStream *stream); virtual void pause(bool p); + virtual void pause() { assert(0); } // overridden virtual void setVolume(int volume); virtual void onTimer(); diff --git a/engines/parallaction/sound_ns.cpp b/engines/parallaction/sound_ns.cpp index 0ee3d73556..ed3031e94e 100644 --- a/engines/parallaction/sound_ns.cpp +++ b/engines/parallaction/sound_ns.cpp @@ -43,6 +43,7 @@ public: void play(Common::SeekableReadStream *stream); void pause(bool p); + virtual void pause() { assert(0); } // overridden virtual void onTimer(); private: diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp index 36d2841b07..6616a0ee13 100644 --- a/engines/sci/engine/script.cpp +++ b/engines/sci/engine/script.cpp @@ -136,7 +136,7 @@ void Script::load(int script_nr, ResourceManager *resMan) { memcpy(_buf, script->data, script->size); // Check scripts for matching signatures and patch those, if found - matchSignatureAndPatch(_nr, _buf, script->size); + patcherProcessScript(_nr, _buf, script->size); if (getSciVersion() >= SCI_VERSION_1_1 && getSciVersion() <= SCI_VERSION_2_1) { Resource *heap = resMan->findResource(ResourceId(kResourceTypeHeap, _nr), 0); diff --git a/engines/sci/engine/script.h b/engines/sci/engine/script.h index 7dde7f4be6..56a9004226 100644 --- a/engines/sci/engine/script.h +++ b/engines/sci/engine/script.h @@ -30,7 +30,7 @@ namespace Sci { struct EngineState; class ResourceManager; -struct SciScriptSignature; +struct SciScriptPatcherEntry; enum ScriptObjectTypes { SCI_OBJ_TERMINATOR, @@ -98,9 +98,10 @@ public: void freeScript(); void load(int script_nr, ResourceManager *resMan); - void matchSignatureAndPatch(uint16 scriptNr, byte *scriptData, const uint32 scriptSize); - int32 findSignature(const SciScriptSignature *signature, const byte *scriptData, const uint32 scriptSize, bool isMacSci11); - void applyPatch(const uint16 *patch, byte *scriptData, const uint32 scriptSize, int32 signatureOffset, bool isMacSci11); + void patcherProcessScript(uint16 scriptNr, byte *scriptData, const uint32 scriptSize); + void patcherInitSignature(SciScriptPatcherEntry *patchTable, bool isMacSci11); + int32 patcherFindSignature(const SciScriptPatcherEntry *patchEntry, const byte *scriptData, const uint32 scriptSize, bool isMacSci11); + void patcherApplyPatch(const SciScriptPatcherEntry *patchEntry, byte *scriptData, const uint32 scriptSize, int32 signatureOffset, bool isMacSci11); virtual bool isValidOffset(uint16 offset) const; virtual SegmentRef dereference(reg_t pointer); diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp index cb80ba79f7..ac42764e5b 100644 --- a/engines/sci/engine/script_patches.cpp +++ b/engines/sci/engine/script_patches.cpp @@ -21,6 +21,7 @@ */ #include "sci/sci.h" +#include "sci/engine/kernel.h" #include "sci/engine/script.h" #include "sci/engine/state.h" #include "sci/engine/features.h" @@ -34,41 +35,83 @@ namespace Sci { #define SIG_COMMANDMASK 0xF000 #define SIG_VALUEMASK 0x0FFF #define SIG_BYTEMASK 0x00FF +#define SIG_MAGICDWORD 0xF000 #define SIG_ADDTOOFFSET 0xE000 +#define SIG_SELECTOR16 0x9000 +#define SIG_SELECTOR8 0x8000 #define SIG_UINT16 0x1000 +#define SIG_BYTE 0x0000 -#define PATCH_END 0xFFFF -#define PATCH_COMMANDMASK 0xF000 -#define PATCH_VALUEMASK 0x0FFF -#define PATCH_BYTEMASK 0x00FF -#define PATCH_ADDTOOFFSET 0xE000 +#define PATCH_END SIG_END +#define PATCH_COMMANDMASK SIG_COMMANDMASK +#define PATCH_VALUEMASK SIG_VALUEMASK +#define PATCH_BYTEMASK SIG_BYTEMASK +#define PATCH_ADDTOOFFSET SIG_ADDTOOFFSET #define PATCH_GETORIGINALBYTE 0xD000 #define PATCH_GETORIGINALBYTEADJUST 0xC000 -#define PATCH_ADJUSTWORD 0xB000 -#define PATCH_ADJUSTWORD_NEG 0xA000 -#define PATCH_UINT16 0x1000 +#define PATCH_SELECTOR16 SIG_SELECTOR16 +#define PATCH_SELECTOR8 SIG_SELECTOR8 +#define PATCH_UINT16 SIG_UINT16 +#define PATCH_BYTE SIG_BYTE -#define PATCH_MAGICDWORD(a, b, c, d) CONSTANT_LE_32(a | (b << 8) | (c << 16) | (d << 24)) +// defines maximum scratch area for getting original bytes from unpatched script data #define PATCH_VALUELIMIT 4096 -struct SciScriptSignature { +struct SciScriptPatcherEntry { uint16 scriptNr; const char *description; int16 applyCount; uint32 magicDWord; int magicOffset; - const uint16 *data; - const uint16 *patch; + const uint16 *signatureData; + const uint16 *patchData; }; #define SCI_SIGNATUREENTRY_TERMINATOR { 0, NULL, 0, 0, 0, NULL, NULL } -// signatures are built like this: -// - first a counter of the bytes that follow -// - then the actual bytes that need to get matched -// - then another counter of bytes (0 for EOS) -// - if not EOS, an adjust offset and the actual bytes -// - rinse and repeat +struct SciScriptPatcherSelector { + const char *name; + int16 id; +}; + +SciScriptPatcherSelector selectorTable[] = { + "cycles", -1, // system selector + "seconds", -1, // system selector + "init", -1, // system selector + "dispose", -1, // system selector + "new", -1, // system selector + "curEvent", -1, // system selector + "disable", -1, // system selector + "show", -1, // system selector + "x", -1, // system selector + "cel", -1, // system selector + "setMotion", -1, // system selector + "deskSarg", -1, // Gabriel Knight + "localize", -1, // Freddy Pharkas + "put", -1, // Police Quest 1 VGA + "solvePuzzle", -1, // Quest For Glory 3 + "timesShownID", -1, // Space Quest 1 VGA + NULL, -1 +}; + +enum ScriptPatcherSelectors { + SELECTOR_cycles = 0, + SELECTOR_seconds, + SELECTOR_init, + SELECTOR_dispose, + SELECTOR_new, + SELECTOR_curEvent, + SELECTOR_disable, + SELECTOR_show, + SELECTOR_x, + SELECTOR_cel, + SELECTOR_setMotion, + SELECTOR_deskSarg, + SELECTOR_localize, + SELECTOR_put, + SELECTOR_solvePuzzle, + SELECTOR_timesShownID +}; // =========================================================================== // Conquests of Camelot @@ -91,7 +134,7 @@ struct SciScriptSignature { // Responsible method: fawaz::handleEvent // Fixes bug #3614969 const uint16 camelotSignaturePeepingTom[] = { - 0x72, SIG_UINT16 + 0x7e, 0x07, // lofsa fawaz <-- start of proper initializion code + 0x72, SIG_MAGICDWORD, SIG_UINT16 + 0x7e, 0x07, // lofsa fawaz <-- start of proper initializion code 0xa1, 0xb9, // sag b9h SIG_ADDTOOFFSET +571, // skip 571 bytes 0x39, 0x7a, // pushi 7a <-- initialization code when walking automatically @@ -113,9 +156,9 @@ const uint16 camelotPatchPeepingTom[] = { PATCH_END }; -// script, description, magic DWORD, adjust -const SciScriptSignature camelotSignatures[] = { - { 62, "fix peepingTom Sierra bug", 1, PATCH_MAGICDWORD(0x7e, 0x07, 0xa1, 0xb9), -1, camelotSignaturePeepingTom, camelotPatchPeepingTom }, +// script, description, signature patch +SciScriptPatcherEntry camelotSignatures[] = { + { 62, "fix peepingTom Sierra bug", 1, 0, 0, camelotSignaturePeepingTom, camelotPatchPeepingTom }, SCI_SIGNATUREENTRY_TERMINATOR }; @@ -124,7 +167,10 @@ const SciScriptSignature camelotSignatures[] = { // boundaries of room 660. Normally a textbox is supposed to get on screen // but the call is wrong, so not only do we get an error message the script // is also hanging because the cue won't get sent out -// This also happens in sierra sci - refer to bug #3038387 +// This also happens in sierra sci +// Applies to at least: PC-CD +// Responsible method: stayAndHelp::changeState +// Fixes bug: #3038387 const uint16 ecoquest1SignatureStayAndHelp[] = { 0x3f, 0x01, // link 01 0x87, 0x01, // lap param[1] @@ -136,12 +182,13 @@ const uint16 ecoquest1SignatureStayAndHelp[] = { 0x31, 0x1c, // bnt [next state] 0x76, // push0 0x45, 0x01, 0x00, // callb export1 from script 0 (switching control off) + SIG_MAGICDWORD, 0x38, SIG_UINT16 + 0x22, 0x01, // pushi 0122 0x78, // push1 0x76, // push0 0x81, 0x00, // lag global[0] 0x4a, 0x06, // send 06 - call ego::setMotion(0) - 0x39, 0x6e, // pushi 6e (selector init) + 0x39, SIG_SELECTOR8 + SELECTOR_init, // pushi "init" 0x39, 0x04, // pushi 04 0x76, // push0 0x76, // push0 @@ -165,7 +212,7 @@ const uint16 ecoquest1PatchStayAndHelp[] = { 0x76, // push0 0x81, 0x00, // lag global[0] 0x4a, 0x06, // send 06 - call ego::setMotion(0) - 0x39, 0x6e, // pushi 6e (selector init) + 0x39, PATCH_SELECTOR8 + SELECTOR_init, // pushi "init" 0x39, 0x06, // pushi 06 0x39, 0x02, // pushi 02 (additional 2 bytes) 0x76, // push0 @@ -178,9 +225,9 @@ const uint16 ecoquest1PatchStayAndHelp[] = { PATCH_END }; -// script, description, magic DWORD, adjust -const SciScriptSignature ecoquest1Signatures[] = { - { 660, "CD: bad messagebox and freeze", 1, PATCH_MAGICDWORD(0x38, 0x22, 0x01, 0x78), -17, ecoquest1SignatureStayAndHelp, ecoquest1PatchStayAndHelp }, +// script, description, signature patch +SciScriptPatcherEntry ecoquest1Signatures[] = { + { 660, "CD: bad messagebox and freeze", 1, 0, 0, ecoquest1SignatureStayAndHelp, ecoquest1PatchStayAndHelp }, SCI_SIGNATUREENTRY_TERMINATOR }; @@ -195,6 +242,7 @@ const uint16 ecoquest2SignatureEcorder[] = { 0x39, 0x0a, // pushi 0a 0x5b, 0x04, 0x1e, // lea temp[1e] 0x36, // push + SIG_MAGICDWORD, 0x39, 0x64, // pushi 64 0x39, 0x7d, // pushi 7d 0x39, 0x32, // pushi 32 @@ -249,6 +297,7 @@ const uint16 ecoquest2SignatureEcorderTutorial[] = { 0x39, 0x0a, // pushi 0a 0x5b, 0x04, 0x1f, // lea temp[1f] 0x36, // push + SIG_MAGICDWORD, 0x39, 0x64, // pushi 64 0x39, 0x7d, // pushi 7d 0x39, 0x32, // pushi 32 @@ -267,42 +316,42 @@ const uint16 ecoquest2SignatureEcorderTutorial[] = { }; const uint16 ecoquest2PatchEcorderTutorial[] = { - 0x31, 0x23, // bnt [next state] (save 1 byte) + 0x31, 0x23, // bnt [next state] (save 1 byte) // The parameter count below should be 7, but we're out of bytes // to patch! A workaround has been added because of this - 0x78, // push1 (parameter count) - //0x39, 0x07, // pushi 07 (parameter count) - 0x39, 0x0b, // push (FillBoxAny) - 0x39, 0x1d, // pushi 29d - 0x39, 0x73, // pushi 115d - 0x39, 0x5e, // pushi 94d - 0x38, 0xd7, 0x00, // pushi 215d - 0x78, // push1 (visual screen) - 0x39, 0x17, // pushi 17 (color) - 0x43, 0x6c, 0x0e, // call kGraph + 0x78, // push1 (parameter count) + //0x39, 0x07, // pushi 07 (parameter count) + 0x39, 0x0b, // push (FillBoxAny) + 0x39, 0x1d, // pushi 29d + 0x39, 0x73, // pushi 115d + 0x39, 0x5e, // pushi 94d + 0x38, PATCH_UINT16 + 0xd7, 0x00, // pushi 215d + 0x78, // push1 (visual screen) + 0x39, 0x17, // pushi 17 (color) + 0x43, 0x6c, 0x0e, // call kGraph // The parameter count below should be 5, but we're out of bytes // to patch! A workaround has been added because of this - 0x78, // push1 (parameter count) - //0x39, 0x05, // pushi 05 (parameter count) - 0x39, 0x0c, // pushi 12d (UpdateBox) - 0x39, 0x1d, // pushi 29d - 0x39, 0x73, // pushi 115d - 0x39, 0x5e, // pushi 94d - 0x38, 0xd7, 0x00, // pushi 215d - 0x43, 0x6c, 0x0a, // call kGraph + 0x78, // push1 (parameter count) + //0x39, 0x05, // pushi 05 (parameter count) + 0x39, 0x0c, // pushi 12d (UpdateBox) + 0x39, 0x1d, // pushi 29d + 0x39, 0x73, // pushi 115d + 0x39, 0x5e, // pushi 94d + 0x38, PATCH_UINT16 + 0xd7, 0x00, // pushi 215d + 0x43, 0x6c, 0x0a, // call kGraph // We are out of bytes to patch at this point, // so we skip 494 (0x1EE) bytes to reuse this code: // ldi 1e // aTop 20 // jmp 030e (jump to end) - 0x32, 0xee, 0x01, // skip 494 (0x1EE) bytes + 0x32, PATCH_UINT16 + 0xee, 0x01, // skip 494 (0x1EE) bytes PATCH_END }; -// script, description, magic DWORD, adjust -const SciScriptSignature ecoquest2Signatures[] = { - { 50, "initial text not removed on ecorder", 1, PATCH_MAGICDWORD(0x39, 0x64, 0x39, 0x7d), -8, ecoquest2SignatureEcorder, ecoquest2PatchEcorder }, - { 333, "initial text not removed on ecorder tutorial",1, PATCH_MAGICDWORD(0x39, 0x64, 0x39, 0x7d), -9, ecoquest2SignatureEcorderTutorial, ecoquest2PatchEcorderTutorial }, +// script, description, signature patch +SciScriptPatcherEntry ecoquest2Signatures[] = { + { 50, "initial text not removed on ecorder", 1, 0, 0, ecoquest2SignatureEcorder, ecoquest2PatchEcorder }, + { 333, "initial text not removed on ecorder tutorial",1, 0, 0, ecoquest2SignatureEcorderTutorial, ecoquest2PatchEcorderTutorial }, SCI_SIGNATUREENTRY_TERMINATOR }; @@ -317,6 +366,7 @@ const uint16 fanmadeSignatureInfiniteLoop[] = { 0x39, 0x00, // pushi 00 0x87, 0x01, // lap 01 0x4b, 0x04, // send 04 + SIG_MAGICDWORD, 0x18, // not 0x30, SIG_UINT16 + 0x2f, 0x00, // bnt 002f [06a5] --> jmp ffbc [0664] --> BUG! infinite loop SIG_END @@ -328,9 +378,9 @@ const uint16 fanmadePatchInfiniteLoop[] = { PATCH_END }; -// script, description, magic DWORD, adjust -const SciScriptSignature fanmadeSignatures[] = { - { 999, "infinite loop on typo", 1, PATCH_MAGICDWORD(0x18, 0x30, 0x2f, 0x00), -9, fanmadeSignatureInfiniteLoop, fanmadePatchInfiniteLoop }, +// script, description, signature patch +SciScriptPatcherEntry fanmadeSignatures[] = { + { 999, "infinite loop on typo", 1, 0, 0, fanmadeSignatureInfiniteLoop, fanmadePatchInfiniteLoop }, SCI_SIGNATUREENTRY_TERMINATOR }; @@ -342,13 +392,16 @@ const SciScriptSignature fanmadeSignatures[] = { // was already playing in the sound driver. In our case we would also stop // the sample from playing, so we patch it out // The "score" code is already buggy and sets volume to 0 when playing +// Applies to at least: English PC-CD +// Responsible method: unknown const uint16 freddypharkasSignatureScoreDisposal[] = { - 0x67, 0x32, // pTos 32 (selector theAudCount) - 0x78, // push1 - 0x39, 0x0d, // pushi 0d - 0x43, 0x75, 0x02, // call kDoAudio - 0x1c, // ne? - 0x31, // bnt (-> to skip disposal) + 0x67, 0x32, // pTos 32 (selector theAudCount) + 0x78, // push1 + SIG_MAGICDWORD, + 0x39, 0x0d, // pushi 0d + 0x43, 0x75, 0x02, // call kDoAudio + 0x1c, // ne? + 0x31, // bnt (-> to skip disposal) SIG_END }; @@ -365,9 +418,12 @@ const uint16 freddypharkasPatchScoreDisposal[] = { // in IconBar::disable doing endless loops even in sierra sci, because there // is no enabled icon left. We remove disabling of icon 8 (which is help), // this fixes the issue. +// Applies to at least: English PC-CD +// Responsible method: rm235::init and sEnterFrom500::changeState const uint16 freddypharkasSignatureCanisterHang[] = { - 0x38, SIG_UINT16 + 0xf1, 0x00, // pushi f1 (selector disable) + 0x38, SIG_SELECTOR16 + SELECTOR_disable, // pushi disable 0x7a, // push2 + SIG_MAGICDWORD, 0x39, 0x07, // pushi 07 0x39, 0x08, // pushi 08 0x81, 0x45, // lag 45 @@ -377,11 +433,11 @@ const uint16 freddypharkasSignatureCanisterHang[] = { const uint16 freddypharkasPatchCanisterHang[] = { PATCH_ADDTOOFFSET | +3, - 0x78, // push1 + 0x78, // push1 PATCH_ADDTOOFFSET | +2, - 0x33, 0x00, // ldi 00 (waste 2 bytes) + 0x33, 0x00, // ldi 00 (waste 2 bytes) PATCH_ADDTOOFFSET | +3, - 0x06, // send 06 - call IconBar::disable(7) + 0x06, // send 06 - call IconBar::disable(7) PATCH_END }; @@ -393,35 +449,41 @@ const uint16 freddypharkasPatchCanisterHang[] = { // ego, sometimes clicks also won't get registered. Strangely it's not nearly // as bad as in our sci, but these differences may be caused by timing. // We just reuse the active event, thus removing the duplicate kGetEvent call. +// Applies to at least: English PC-CD, German Floppy, English Mac +// Responsible method: lowerLadder::doit and highLadder::doit const uint16 freddypharkasSignatureLadderEvent[] = { - 0x39, 0x6d, // pushi 6d (selector new) + 0x39, SIG_MAGICDWORD, + SIG_SELECTOR8 + SELECTOR_new, // pushi new 0x76, // push0 - 0x38, SIG_UINT16 + 0xf5, 0x00, // pushi f5 (selector curEvent) + 0x38, SIG_SELECTOR16 + SELECTOR_curEvent, // pushi curEvent 0x76, // push0 0x81, 0x50, // lag global[50] 0x4a, 0x04, // send 04 - read User::curEvent 0x4a, 0x04, // send 04 - call curEvent::new 0xa5, 0x00, // sat temp[0] - 0x38, SIG_UINT16 + 0x94, 0x00, // pushi 94 (selector localize) + 0x38, SIG_SELECTOR16 + SELECTOR_localize, 0x76, // push0 0x4a, 0x04, // send 04 - call curEvent::localize SIG_END }; const uint16 freddypharkasPatchLadderEvent[] = { - 0x34, 0x00, 0x00, // ldi 0000 (waste 3 bytes, overwrites first 2 pushes) + 0x34, 0x00, 0x00, // ldi 0000 (waste 3 bytes, overwrites first 2 pushes) PATCH_ADDTOOFFSET | +8, - 0xa5, 0x00, // sat temp[0] (waste 2 bytes, overwrites 2nd send) + 0xa5, 0x00, // sat temp[0] (waste 2 bytes, overwrites 2nd send) PATCH_ADDTOOFFSET | +2, - 0x34, 0x00, 0x00, // ldi 0000 - 0x34, 0x00, 0x00, // ldi 0000 (waste 6 bytes, overwrites last 3 opcodes) + 0x34, 0x00, 0x00, // ldi 0000 + 0x34, 0x00, 0x00, // ldi 0000 (waste 6 bytes, overwrites last 3 opcodes) PATCH_END }; // In the Macintosh version of Freddy Pharkas, kRespondsTo is broken for // property selectors. They hacked the script to work around the issue, // so we revert the script back to using the values of the DOS script. +// Applies to at least: English Mac +// Responsible method: unknown const uint16 freddypharkasSignatureMacInventory[] = { + SIG_MAGICDWORD, 0x39, 0x23, // pushi 23 0x39, 0x74, // pushi 74 0x78, // push1 @@ -437,28 +499,31 @@ const uint16 freddypharkasPatchMacInventory[] = { PATCH_END }; -// script, description, magic DWORD, adjust -const SciScriptSignature freddypharkasSignatures[] = { - { 0, "CD: score early disposal", 1, PATCH_MAGICDWORD(0x39, 0x0d, 0x43, 0x75), -3, freddypharkasSignatureScoreDisposal, freddypharkasPatchScoreDisposal }, - { 15, "Mac: broken inventory", 1, PATCH_MAGICDWORD(0x39, 0x23, 0x39, 0x74), 0, freddypharkasSignatureMacInventory, freddypharkasPatchMacInventory }, - { 235, "CD: canister pickup hang", 3, PATCH_MAGICDWORD(0x39, 0x07, 0x39, 0x08), -4, freddypharkasSignatureCanisterHang, freddypharkasPatchCanisterHang }, - { 320, "ladder event issue", 2, PATCH_MAGICDWORD(0x6d, 0x76, 0x38, 0xf5), -1, freddypharkasSignatureLadderEvent, freddypharkasPatchLadderEvent }, +// script, description, signature patch +SciScriptPatcherEntry freddypharkasSignatures[] = { + { 0, "CD: score early disposal", 1, 0, 0, freddypharkasSignatureScoreDisposal, freddypharkasPatchScoreDisposal }, + { 15, "Mac: broken inventory", 1, 0, 0, freddypharkasSignatureMacInventory, freddypharkasPatchMacInventory }, + { 235, "CD: canister pickup hang", 3, 0, 0, freddypharkasSignatureCanisterHang, freddypharkasPatchCanisterHang }, + { 320, "ladder event issue", 2, 0, 0, freddypharkasSignatureLadderEvent, freddypharkasPatchLadderEvent }, SCI_SIGNATUREENTRY_TERMINATOR }; // =========================================================================== // daySixBeignet::changeState (4) is called when the cop goes out and sets cycles to 220. // this is not enough time to get to the door, so we patch that to 23 seconds +// Applies to at least: English PC-CD, German PC-CD, English Mac +// Responsible method: daySixBeignet::changeState const uint16 gk1SignatureDay6PoliceBeignet[] = { 0x35, 0x04, // ldi 04 0x1a, // eq? 0x30, SIG_ADDTOOFFSET +2, // bnt [next state check] - 0x38, SIG_UINT16 + 0x93, 0x00, // pushi 93 (selector dispose) + 0x38, SIG_SELECTOR16 + SELECTOR_dispose, // pushi dispose 0x76, // push0 0x72, SIG_ADDTOOFFSET +2, // lofsa deskSarg - 0x4a, 0x04, 0x00, // send 04 + 0x4a, SIG_UINT16 + 0x04, 0x00, // send 04 + SIG_MAGICDWORD, 0x34, SIG_UINT16 + 0xdc, 0x00, // ldi 220 - 0x65, 0x1a, // aTop cycles + 0x65, SIG_ADDTOOFFSET +1, // aTop cycles (1a for PC, 1c for Mac) 0x32, // jmp [end] SIG_END }; @@ -466,18 +531,21 @@ const uint16 gk1SignatureDay6PoliceBeignet[] = { const uint16 gk1PatchDay6PoliceBeignet[] = { PATCH_ADDTOOFFSET +16, 0x34, PATCH_UINT16 + 0x17, 0x00, // ldi 23 - 0x65, 0x1c, // aTop seconds + 0x65, PATCH_GETORIGINALBYTEADJUST +20, +2, // aTop seconds (1c for PC, 1e for Mac) PATCH_END }; // sargSleeping::changeState (8) is called when the cop falls asleep and sets cycles to 220. // this is not enough time to get to the door, so we patch it to 42 seconds +// Applies to at least: English PC-CD, German PC-CD, English Mac +// Responsible method: sargSleeping::changeState const uint16 gk1SignatureDay6PoliceSleep[] = { 0x35, 0x08, // ldi 08 0x1a, // eq? 0x31, SIG_ADDTOOFFSET +1, // bnt [next state check] + SIG_MAGICDWORD, 0x34, SIG_UINT16 + 0xdc, 0x00, // ldi 220 - 0x65, 0x1a, // aTop cycles + 0x65, SIG_ADDTOOFFSET +1, // aTop cycles (1a for PC, 1c for Mac) 0x32, // jmp [end] 0 }; @@ -485,14 +553,18 @@ const uint16 gk1SignatureDay6PoliceSleep[] = { const uint16 gk1PatchDay6PoliceSleep[] = { PATCH_ADDTOOFFSET +5, 0x34, SIG_UINT16 + 0x2a, 0x00, // ldi 42 - 0x65, 0x1c, // aTop seconds + 0x65, PATCH_GETORIGINALBYTEADJUST +9, +2, // aTop seconds (1c for PC, 1e for Mac) PATCH_END }; // startOfDay5::changeState (20h) - when gabriel goes to the phone the script will hang +// Applies to at least: English PC-CD, German PC-CD, English Mac +// Responsible method: startOfDay5::changeState const uint16 gk1SignatureDay5PhoneFreeze[] = { + 0x4a, + SIG_MAGICDWORD, SIG_UINT16 + 0x0c, 0x00, // send 0c 0x35, 0x03, // ldi 03 - 0x65, 0x1a, // aTop cycles + 0x65, SIG_ADDTOOFFSET +1, // aTop cycles 0x32, SIG_ADDTOOFFSET +2, // jmp [end] 0x3c, // dup 0x35, 0x21, // ldi 21 @@ -500,8 +572,9 @@ const uint16 gk1SignatureDay5PhoneFreeze[] = { }; const uint16 gk1PatchDay5PhoneFreeze[] = { - 0x35, 0x06, // ldi 06 - 0x65, 0x20, // aTop ticks + PATCH_ADDTOOFFSET +3, + 0x35, 0x06, // ldi 01 + 0x65, PATCH_GETORIGINALBYTEADJUST +6, +6, // aTop ticks PATCH_END }; @@ -513,7 +586,11 @@ const uint16 gk1PatchDay5PhoneFreeze[] = { // comparison between a number an an object. In the CD version, the checks are // in the correct order, thus the comparison is correct, thus we use the code // from the CD version in the floppy one. +// Applies to at least: English Floppy +// Responsible method: Interrogation::dispose +// TODO: Check, if English Mac is affected too and if this patch applies const uint16 gk1SignatureInterrogationBug[] = { + SIG_MAGICDWORD, 0x65, 0x4c, // aTop 4c 0x67, 0x50, // pTos 50 0x34, SIG_UINT16 + 0x10, 0x27, // ldi 2710 @@ -527,12 +604,12 @@ const uint16 gk1SignatureInterrogationBug[] = { 0x31, 0x15, // bnt 15 [05b9] 0x39, 0x0e, // pushi 0e 0x76, // push0 - 0x4a, 0x04, 0x00, // send 0004 + 0x4a, SIG_UINT16 + 0x04, 0x00, // send 0004 0xa5, 0x00, // sat 00 - 0x38, SIG_UINT16 + 0x93, 0x00, // pushi 0093 + 0x38, SIG_SELECTOR16 + SELECTOR_dispose, // pushi dispose 0x76, // push0 0x63, 0x50, // pToa 50 - 0x4a, 0x04, 0x00, // send 0004 + 0x4a, SIG_UINT16 + 0x04, 0x00, // send 0004 0x85, 0x00, // lat 00 0x65, 0x50, // aTop 50 SIG_END @@ -546,7 +623,7 @@ const uint16 gk1PatchInterrogationBug[] = { 0x76, // push0 0x4a, 0x04, 0x00, // send 0004 0xa5, 0x00, // sat 00 - 0x38, PATCH_UINT16 + 0x93, 0x00, // pushi 0093 + 0x38, SIG_SELECTOR16 + SELECTOR_dispose, // pushi dispose 0x76, // push0 0x63, 0x50, // pToa 50 0x4a, 0x04, 0x00, // send 0004 @@ -563,12 +640,12 @@ const uint16 gk1PatchInterrogationBug[] = { PATCH_END }; -// script, description, magic DWORD, adjust -const SciScriptSignature gk1Signatures[] = { - { 51, "interrogation bug", 1, PATCH_MAGICDWORD(0x65, 0x4c, 0x67, 0x50), 0, gk1SignatureInterrogationBug, gk1PatchInterrogationBug }, - { 212, "day 5 phone freeze", 1, PATCH_MAGICDWORD(0x35, 0x03, 0x65, 0x1a), 0, gk1SignatureDay5PhoneFreeze, gk1PatchDay5PhoneFreeze }, - { 230, "day 6 police beignet timer issue", 1, PATCH_MAGICDWORD(0x34, 0xdc, 0x00, 0x65), -16, gk1SignatureDay6PoliceBeignet, gk1PatchDay6PoliceBeignet }, - { 230, "day 6 police sleep timer issue", 1, PATCH_MAGICDWORD(0x34, 0xdc, 0x00, 0x65), -5, gk1SignatureDay6PoliceSleep, gk1PatchDay6PoliceSleep }, +// script, description, signature patch +SciScriptPatcherEntry gk1Signatures[] = { + { 51, "interrogation bug", 1, 0, 0, gk1SignatureInterrogationBug, gk1PatchInterrogationBug }, + { 212, "day 5 phone freeze", 1, 0, 0, gk1SignatureDay5PhoneFreeze, gk1PatchDay5PhoneFreeze }, + { 230, "day 6 police beignet timer issue", 1, 0, 0, gk1SignatureDay6PoliceBeignet, gk1PatchDay6PoliceBeignet }, + { 230, "day 6 police sleep timer issue", 1, 0, 0, gk1SignatureDay6PoliceSleep, gk1PatchDay6PoliceSleep }, SCI_SIGNATUREENTRY_TERMINATOR }; @@ -579,6 +656,7 @@ const SciScriptSignature gk1Signatures[] = { // the volume to max. We fix the export, so volume won't get modified in // those cases. const uint16 kq5SignatureCdHarpyVolume[] = { + SIG_MAGICDWORD, 0x80, SIG_UINT16 + 0x91, 0x01, // lag global[191h] 0x18, // not 0x30, SIG_UINT16 + 0x2c, 0x00, // bnt [jump further] (jumping, if global 191h is 1) @@ -641,6 +719,7 @@ const uint16 kq5SignatureWitchCageInit[] = { SIG_UINT16 + 0x00, 0x00, // bottom SIG_UINT16 + 0x00, 0x00, // right SIG_UINT16 + 0x00, 0x00, // extra property #1 + SIG_MAGICDWORD, SIG_UINT16 + 0x7a, 0x00, // extra property #2 SIG_UINT16 + 0xc8, 0x00, // extra property #3 SIG_UINT16 + 0xa3, 0x00, // extra property #4 @@ -670,6 +749,7 @@ const uint16 kq5PatchWitchCageInit[] = { // compatibilty between the DOS and Windows CD versions of KQ5. // TODO: Investigate these side effects more closely. const uint16 kq5SignatureWinGMSignals[] = { + SIG_MAGICDWORD, 0x80, SIG_UINT16 + 0x90, 0x01, // lag 0x190 0x18, // not 0x30, SIG_UINT16 + 0x1b, 0x00, // bnt +0x001B @@ -682,17 +762,17 @@ const uint16 kq5PatchWinGMSignals[] = { PATCH_END }; -// script, description, magic DWORD, adjust -const SciScriptSignature kq5Signatures[] = { - { 0, "CD: harpy volume change", 1, PATCH_MAGICDWORD(0x80, 0x91, 0x01, 0x18), 0, kq5SignatureCdHarpyVolume, kq5PatchCdHarpyVolume }, - { 200, "CD: witch cage init", 1, PATCH_MAGICDWORD(0x7a, 0x00, 0xc8, 0x00), -10, kq5SignatureWitchCageInit, kq5PatchWitchCageInit }, +// script, description, signature patch +SciScriptPatcherEntry kq5Signatures[] = { + { 0, "CD: harpy volume change", 1, 0, 0, kq5SignatureCdHarpyVolume, kq5PatchCdHarpyVolume }, + { 200, "CD: witch cage init", 1, 0, 0, kq5SignatureWitchCageInit, kq5PatchWitchCageInit }, SCI_SIGNATUREENTRY_TERMINATOR }; -const SciScriptSignature kq5WinGMSignatures[] = { - { 0, "CD: harpy volume change", 1, PATCH_MAGICDWORD(0x80, 0x91, 0x01, 0x18), 0, kq5SignatureCdHarpyVolume, kq5PatchCdHarpyVolume }, - { 200, "CD: witch cage init", 1, PATCH_MAGICDWORD(0x7a, 0x00, 0xc8, 0x00), -10, kq5SignatureWitchCageInit, kq5PatchWitchCageInit }, - { 124, "Win: GM Music signal checks", 4, PATCH_MAGICDWORD(0x80, 0x90, 0x01, 0x18), 0, kq5SignatureWinGMSignals, kq5PatchWinGMSignals }, +SciScriptPatcherEntry kq5WinGMSignatures[] = { + { 0, "CD: harpy volume change", 1, 0, 0, kq5SignatureCdHarpyVolume, kq5PatchCdHarpyVolume }, + { 200, "CD: witch cage init", 1, 0, 0, kq5SignatureWitchCageInit, kq5PatchWitchCageInit }, + { 124, "Win: GM Music signal checks", 4, 0, 0, kq5SignatureWinGMSignals, kq5PatchWinGMSignals }, SCI_SIGNATUREENTRY_TERMINATOR }; @@ -706,6 +786,7 @@ const SciScriptSignature kq5WinGMSignatures[] = { // constantly restarting (since it's being looped anyway), thus the normal // game speech can work while the baby cry sound is heard. Fixes bug #3034579. const uint16 kq6SignatureDuplicateBabyCry[] = { + SIG_MAGICDWORD, 0x83, 0x00, // lal 00 0x31, 0x1e, // bnt 1e [07f4] 0x78, // push1 @@ -724,9 +805,9 @@ const uint16 kq6PatchDuplicateBabyCry[] = { // grow the stack, because it's calling itself per switch. // Which means after a while ScummVM will bomb out because the stack frame // will be too large. This patch fixes the buggy script. -// This patch applies to at least CD, English floppy, German floppy +// Applies to at least: PC-CD, English PC floppy, German PC floppy, English Mac // Responsible method: KqInv::showSelf -// Fixes bug #3293954 +// Fixes bug: #3293954 const uint16 kq6SignatureInventoryStackFix[] = { 0x67, 0x30, // pTos state 0x34, SIG_UINT16 + 0x00, 0x20, // ldi 2000 @@ -734,12 +815,13 @@ const uint16 kq6SignatureInventoryStackFix[] = { 0x18, // not 0x31, 0x04, // bnt [not first refresh] 0x35, 0x00, // ldi 00 + SIG_MAGICDWORD, 0x65, 0x1e, // aTop curIcon 0x67, 0x30, // pTos state 0x34, SIG_UINT16 + 0xff, 0xdf, // ldi dfff 0x12, // and 0x65, 0x30, // aTop state - 0x38, SIG_ADDTOOFFSET + 2, // pushi "show" ("show" may be e100h for KQ6CD, xxxxh for KQ6 floppy) + 0x38, SIG_SELECTOR16 + SELECTOR_show, // pushi "show" ("show" is e1h for KQ6CD) 0x78, // push1 0x87, 0x00, // lap param[0] 0x31, 0x04, // bnt [use global for show] @@ -764,7 +846,6 @@ const uint16 kq6PatchInventoryStackFix[] = { 0x2f, 0x02, // bt [not first refresh] - saves 3 bytes in total 0x65, 0x1e, // aTop curIcon 0x00, // neg (either 2000 or 0000 in acc, this will create dfff or ffff) - saves 2 bytes -// 0x34, PATCH_UINT16 + 0xff, 0xdf, // ldi dfff 0x12, // and 0x65, 0x30, // aTop state 0x38, // pushi "show" @@ -789,10 +870,10 @@ const uint16 kq6PatchInventoryStackFix[] = { PATCH_END }; -// script, description, magic DWORD, adjust -const SciScriptSignature kq6Signatures[] = { - { 481, "duplicate baby cry", 1, PATCH_MAGICDWORD(0x83, 0x00, 0x31, 0x1e), 0, kq6SignatureDuplicateBabyCry, kq6PatchDuplicateBabyCry }, - { 907, "inventory stack fix", 1, PATCH_MAGICDWORD(0x65, 0x1e, 0x67, 0x30), -11, kq6SignatureInventoryStackFix, kq6PatchInventoryStackFix }, +// script, description, signature patch +SciScriptPatcherEntry kq6Signatures[] = { + { 481, "duplicate baby cry", 1, 0, 0, kq6SignatureDuplicateBabyCry, kq6PatchDuplicateBabyCry }, + { 907, "inventory stack fix", 1, 0, 0, kq6SignatureInventoryStackFix, kq6PatchInventoryStackFix }, SCI_SIGNATUREENTRY_TERMINATOR }; @@ -805,7 +886,10 @@ const SciScriptSignature kq6Signatures[] = { // the function is undefined, thus kStrCat() that is called inside the function // reads a random pointer and crashes. We patch all of the 5 function calls // (one for each letter typed from "R", "O", "B", "I", "N") so that they are -// the same as the English version. Fixes bug #3048054. +// the same as the English version. +// Applies to at least: German floppy +// Responsible method: unknown +// Fixes bug: #3048054 const uint16 longbowSignatureShowHandCode[] = { 0x78, // push1 0x78, // push1 @@ -815,9 +899,10 @@ const uint16 longbowSignatureShowHandCode[] = { 0x02, // perform the call above with 2 parameters 0x36, // push 0x40, SIG_ADDTOOFFSET +2, // call + SIG_MAGICDWORD, 0x02, // perform the call above with 2 parameters - 0x38, SIG_UINT16 + 0x1c, 0x01, // pushi 011c (setMotion) - 0x39, 0x04, // pushi 04 (x) + 0x38, SIG_SELECTOR16 + SELECTOR_setMotion, // pushi "setMotion" (0x11c in Longbow German) + 0x39, SIG_SELECTOR8 + SELECTOR_x, // pushi "x" (0x04 in Longbow German) 0x51, 0x1e, // class MoveTo SIG_END }; @@ -832,9 +917,9 @@ const uint16 longbowPatchShowHandCode[] = { PATCH_END }; -// script, description, magic DWORD, adjust -const SciScriptSignature longbowSignatures[] = { - { 210, "hand code crash", 5, PATCH_MAGICDWORD(0x02, 0x38, 0x1c, 0x01), -14, longbowSignatureShowHandCode, longbowPatchShowHandCode }, +// script, description, signature patch +SciScriptPatcherEntry longbowSignatures[] = { + { 210, "hand code crash", 5, 0, 0, longbowSignatureShowHandCode, longbowPatchShowHandCode }, SCI_SIGNATUREENTRY_TERMINATOR }; @@ -852,11 +937,12 @@ const SciScriptSignature longbowSignatures[] = { // "worked" in SSCI, but ScummVM/SCI doesn't allow that. // That's why those points weren't granted here at all. // We patch the script to use global 90, which seems to be unused in the whole game. +// Applies to at least: English floppy // Responsible method: rm63Script::handleEvent -// Fixes bug #3614419 +// Fixes bug: #3614419 const uint16 larry2SignatureWearParachutePoints[] = { 0x35, 0x01, // ldi 01 - 0xa1, 0x8e, // sag 8e + 0xa1, SIG_MAGICDWORD, 0x8e, // sag 8e 0x80, SIG_UINT16 + 0xe0, 0x01, // lag 1e0 0x18, // not 0x30, SIG_UINT16 + 0x0f, 0x00, // bnt [don't give points] @@ -873,9 +959,9 @@ const uint16 larry2PatchWearParachutePoints[] = { PATCH_END }; -// script, description, magic DWORD, adjust -const SciScriptSignature larry2Signatures[] = { - { 63, "plane: no points for wearing plane", 1, PATCH_MAGICDWORD(0x8e, 0x80, 0xe0, 0x01), -3, larry2SignatureWearParachutePoints, larry2PatchWearParachutePoints }, +// script, description, signature patch +SciScriptPatcherEntry larry2Signatures[] = { + { 63, "plane: no points for wearing plane", 1, 0, 0, larry2SignatureWearParachutePoints, larry2PatchWearParachutePoints }, SCI_SIGNATUREENTRY_TERMINATOR }; @@ -887,7 +973,10 @@ const SciScriptSignature larry2Signatures[] = { // doesn't happen anymore. We would otherwise get a crash // calling for invalid views (this happens of course also // in sierra sci) +// Applies to at least: German PC-CD +// Responsible method: unknown const uint16 larry6SignatureDeathDialog[] = { + SIG_MAGICDWORD, 0x3e, SIG_UINT16 + 0x33, 0x01, // link 0133 (offset 0x20) 0x35, 0xff, // ldi ff 0xa3, 0x00, // sal 00 @@ -921,18 +1010,21 @@ const uint16 larry6PatchDeathDialog[] = { PATCH_END }; -// script, description, magic DWORD, adjust -const SciScriptSignature larry6Signatures[] = { - { 82, "death dialog memory corruption", 1, PATCH_MAGICDWORD(0x3e, 0x33, 0x01, 0x35), 0, larry6SignatureDeathDialog, larry6PatchDeathDialog }, +// script, description, signature patch +SciScriptPatcherEntry larry6Signatures[] = { + { 82, "death dialog memory corruption", 1, 0, 0, larry6SignatureDeathDialog, larry6PatchDeathDialog }, SCI_SIGNATUREENTRY_TERMINATOR }; // =========================================================================== // rm560::doit was supposed to close the painting, when Heimlich enters the -// room. The code is buggy, so it actually closes the painting, when heimlich +// room. The code is buggy. It actually closes the painting, when heimlich // is not in the room. We fix that. +// Applies to at least: English floppy +// Responsible method: rm560::doit const uint16 laurabow2SignaturePaintingClosing[] = { 0x4a, 0x04, // send 04 - read aHeimlich::room + SIG_MAGICDWORD, 0x36, // push 0x81, 0x0b, // lag global[11d] -> current room 0x1c, // ne? @@ -951,9 +1043,9 @@ const uint16 laurabow2PatchPaintingClosing[] = { PATCH_END }; -// script, description, magic DWORD, adjust -const SciScriptSignature laurabow2Signatures[] = { - { 560, "painting closing immediately", 1, PATCH_MAGICDWORD(0x36, 0x81, 0x0b, 0x1c), -2, laurabow2SignaturePaintingClosing, laurabow2PatchPaintingClosing }, +// script, description, signature patch +SciScriptPatcherEntry laurabow2Signatures[] = { + { 560, "painting closing immediately", 1, 0, 0, laurabow2SignaturePaintingClosing, laurabow2PatchPaintingClosing }, SCI_SIGNATUREENTRY_TERMINATOR }; @@ -964,7 +1056,7 @@ const SciScriptSignature laurabow2Signatures[] = { // We set the savedgame-id directly right after restoring in kRestoreGame. const uint16 mothergoose256SignatureReplay[] = { 0x36, // push - 0x35, 0x20, // ldi 20 + 0x35, SIG_MAGICDWORD, 0x20, // ldi 20 0x04, // sub 0xa1, 0xb3, // sag global[b3] SIG_END @@ -979,9 +1071,9 @@ const uint16 mothergoose256PatchReplay[] = { // when saving, it also checks if the savegame ID is below 13. // we change this to check if below 113 instead const uint16 mothergoose256SignatureSaveLimit[] = { - 0x89, 0xb3, // lsg global[b3] - 0x35, 0x0d, // ldi 0d - 0x20, // ge? + 0x89, SIG_MAGICDWORD, 0xb3, // lsg global[b3] + 0x35, 0x0d, // ldi 0d + 0x20, // ge? SIG_END }; @@ -991,11 +1083,11 @@ const uint16 mothergoose256PatchSaveLimit[] = { PATCH_END }; -// script, description, magic DWORD, adjust -const SciScriptSignature mothergoose256Signatures[] = { - { 0, "replay save issue", 1, PATCH_MAGICDWORD(0x20, 0x04, 0xa1, 0xb3), -2, mothergoose256SignatureReplay, mothergoose256PatchReplay }, - { 0, "save limit dialog (SCI1.1)", 1, PATCH_MAGICDWORD(0xb3, 0x35, 0x0d, 0x20), -1, mothergoose256SignatureSaveLimit, mothergoose256PatchSaveLimit }, - { 994, "save limit dialog (SCI1)", 1, PATCH_MAGICDWORD(0xb3, 0x35, 0x0d, 0x20), -1, mothergoose256SignatureSaveLimit, mothergoose256PatchSaveLimit }, +// script, description, signature patch +SciScriptPatcherEntry mothergoose256Signatures[] = { + { 0, "replay save issue", 1, 0, 0, mothergoose256SignatureReplay, mothergoose256PatchReplay }, + { 0, "save limit dialog (SCI1.1)", 1, 0, 0, mothergoose256SignatureSaveLimit, mothergoose256PatchSaveLimit }, + { 994, "save limit dialog (SCI1)", 1, 0, 0, mothergoose256SignatureSaveLimit, mothergoose256PatchSaveLimit }, SCI_SIGNATUREENTRY_TERMINATOR }; @@ -1009,14 +1101,16 @@ const SciScriptSignature mothergoose256Signatures[] = { // SSCI. // This patch changes the code, so that the gun is actually given away // when the 2 seconds have passed and the locker got closed. +// Applies to at least: English floppy // Responsible method: putGun::changeState (script 341) -// Fixes bug #3036933 / #3303802 +// Fixes bug: #3036933 / #3303802 const uint16 pq1vgaSignaturePutGunInLockerBug[] = { 0x35, 0x00, // ldi 00 0x1a, // eq? 0x31, 0x25, // bnt [next state check] SIG_ADDTOOFFSET +22, // [skip 22 bytes] - 0x38, SIG_UINT16 + 0x5f, 0x01, // pushi 15fh + SIG_MAGICDWORD, + 0x38, SIG_SELECTOR16 + SELECTOR_put, // pushi "put" 0x78, // push1 0x76, // push0 0x81, 0x00, // lag 00 @@ -1028,7 +1122,7 @@ const uint16 pq1vgaSignaturePutGunInLockerBug[] = { 0x35, 0x01, // ldi 01 0x1a, // eq? 0x31, 0x08, // bnt [end of method] - 0x39, 0x6f, // pushi 6fh + 0x39, SIG_SELECTOR8 + SELECTOR_dispose, // pushi "dispose" 0x76, // push0 0x72, SIG_UINT16 + 0x88, 0x00, // lofsa 0088 0x4a, 0x04, // send 04 - locker::dispose @@ -1046,7 +1140,7 @@ const uint16 pq1vgaPatchPutGunInLockerBug[] = { 0x35, 0x01, // ldi 01 0x1a, // eq? 0x31, 0x11, // bnt [end of method] - 0x38, SIG_UINT16 + 0x5f, 0x01, // pushi 15fh + 0x38, PATCH_SELECTOR16 + SELECTOR_put, // pushi "put" 0x78, // push1 0x76, // push0 0x81, 0x00, // lag 00 @@ -1054,9 +1148,9 @@ const uint16 pq1vgaPatchPutGunInLockerBug[] = { PATCH_END }; -// script, description, magic DWORD, adjust -const SciScriptSignature pq1vgaSignatures[] = { - { 341, "put gun in locker bug", 1, PATCH_MAGICDWORD(0x38, 0x5f, 0x01, 0x78), -27, pq1vgaSignaturePutGunInLockerBug, pq1vgaPatchPutGunInLockerBug }, +// script, description, signature patch +SciScriptPatcherEntry pq1vgaSignatures[] = { + { 341, "put gun in locker bug", 1, 0, 0, pq1vgaSignaturePutGunInLockerBug, pq1vgaPatchPutGunInLockerBug }, SCI_SIGNATUREENTRY_TERMINATOR }; @@ -1069,8 +1163,11 @@ const SciScriptSignature pq1vgaSignatures[] = { // not nearly as bad as in our sci, but these differences may be caused by // timing. // We just reuse the active event, thus removing the duplicate kGetEvent call. +// Applies to at least: English floppy +// Responsible method: pointBox::doit const uint16 qfg1vgaSignatureFightEvents[] = { - 0x39, 0x6d, // pushi 6d (selector new) + 0x39, SIG_MAGICDWORD, + SIG_SELECTOR8 + SELECTOR_new, // pushi "new" 0x76, // push0 0x51, 0x07, // class Event 0x4a, 0x04, // send 04 - call Event::new @@ -1090,7 +1187,7 @@ const uint16 qfg1vgaSignatureFightEvents[] = { }; const uint16 qfg1vgaPatchFightEvents[] = { - 0x38, PATCH_UINT16 + 0x5a, 0x01, // pushi 15a (selector curEvent) + 0x38, PATCH_SELECTOR16 + SELECTOR_curEvent, // pushi 15a (selector curEvent) 0x76, // push0 0x81, 0x50, // lag global[50] 0x4a, 0x04, // send 04 - read User::curEvent -> needs one byte more than previous code @@ -1119,6 +1216,7 @@ const uint16 qfg1vgaPatchFightEvents[] = { // Patch 1: Increase temp space const uint16 qfg1vgaSignatureTempSpace[] = { + SIG_MAGICDWORD, 0x3f, 0xba, // link 0xba 0x87, 0x00, // lap 0 SIG_END @@ -1131,6 +1229,7 @@ const uint16 qfg1vgaPatchTempSpace[] = { // Patch 2: Move the pointer used for the window header a little bit const uint16 qfg1vgaSignatureDialogHeader[] = { + SIG_MAGICDWORD, 0x5b, 0x04, 0x80, // lea temp[0x80] 0x36, // push SIG_END @@ -1151,6 +1250,7 @@ const uint16 qfg1vgaPatchDialogHeader[] = { // to 85, 165, which is not an edge case thus the freeze is avoided. // Fixes bug #3585189. const uint16 qfg1vgaSignatureMoveToCrusher[] = { + SIG_MAGICDWORD, 0x51, 0x1f, // class Motion 0x36, // push 0x39, 0x4f, // pushi 4f (79 - x) @@ -1169,6 +1269,7 @@ const uint16 qfg1vgaPatchMoveToCrusher[] = { // spot when sneaking. In GuardsTrumpet::changeState, we change the final // location where Ego is moved from 111, 111 to 114, 114. Fixes bug #3604939. const uint16 qfg1vgaSignatureMoveToCastleGate[] = { + SIG_MAGICDWORD, 0x51, 0x1f, // class MoveTo 0x36, // push 0x39, 0x6f, // pushi 6f (111 - x) @@ -1186,9 +1287,11 @@ const uint16 qfg1vgaPatchMoveToCastleGate[] = { // Typo in the original Sierra scripts // Looking at a cheetaur resulted in a text about a Saurus Rex // The code treats both monster types the same. +// Applies to at least: English floppy // Responsible method: smallMonster::doVerb // Fixes bug #3604943. const uint16 qfg1vgaSignatureCheetaurDescription[] = { + SIG_MAGICDWORD, 0x34, SIG_UINT16 + 0xb8, 0x01, // ldi 01b8 0x1a, // eq? 0x31, 0x16, // bnt 16 @@ -1216,6 +1319,7 @@ const uint16 qfg1vgaPatchCheetaurDescription[] = { // Local 5 of that room is a timer, that closes the door (object door11). // Setting it to 1 during happyFace::changeState(0) stops door11::doit from // calling goTo6::init, so the whole issue is stopped from happening. +// Applies to at least: English floppy // Responsible method: happyFace::changeState, door11::doit // Fixes bug #3585793 const uint16 qfg1vgaSignatureFunnyRoomFix[] = { @@ -1225,6 +1329,7 @@ const uint16 qfg1vgaSignatureFunnyRoomFix[] = { 0x35, 0x00, // ldi 00 0x1a, // eq? 0x30, SIG_UINT16 + 0x25, 0x00, // bnt 0025 [-> next state] + SIG_MAGICDWORD, 0x35, 0x01, // ldi 01 0xa3, 0x4e, // sal 4e SIG_END @@ -1240,16 +1345,16 @@ const uint16 qfg1vgaPatchFunnyRoomFix[] = { PATCH_END }; -// script, description, magic DWORD, adjust -const SciScriptSignature qfg1vgaSignatures[] = { - { 215, "fight event issue", 1, PATCH_MAGICDWORD(0x6d, 0x76, 0x51, 0x07), -1, qfg1vgaSignatureFightEvents, qfg1vgaPatchFightEvents }, - { 216, "weapon master event issue", 1, PATCH_MAGICDWORD(0x6d, 0x76, 0x51, 0x07), -1, qfg1vgaSignatureFightEvents, qfg1vgaPatchFightEvents }, - { 814, "window text temp space", 1, PATCH_MAGICDWORD(0x3f, 0xba, 0x87, 0x00), 0, qfg1vgaSignatureTempSpace, qfg1vgaPatchTempSpace }, - { 814, "dialog header offset", 3, PATCH_MAGICDWORD(0x5b, 0x04, 0x80, 0x36), 0, qfg1vgaSignatureDialogHeader, qfg1vgaPatchDialogHeader }, - { 331, "moving to crusher", 1, PATCH_MAGICDWORD(0x51, 0x1f, 0x36, 0x39), 0, qfg1vgaSignatureMoveToCrusher, qfg1vgaPatchMoveToCrusher }, - { 41, "moving to castle gate", 1, PATCH_MAGICDWORD(0x51, 0x1f, 0x36, 0x39), 0, qfg1vgaSignatureMoveToCastleGate, qfg1vgaPatchMoveToCastleGate }, - { 210, "cheetaur description fixed", 1, PATCH_MAGICDWORD(0x34, 0xb8, 0x01, 0x1a), 0, qfg1vgaSignatureCheetaurDescription, qfg1vgaPatchCheetaurDescription }, - { 96, "funny room script bug fixed", 1, PATCH_MAGICDWORD(0x35, 0x01, 0xa3, 0x4e), -10, qfg1vgaSignatureFunnyRoomFix, qfg1vgaPatchFunnyRoomFix }, +// script, description, signature patch +SciScriptPatcherEntry qfg1vgaSignatures[] = { + { 215, "fight event issue", 1, 0, 0, qfg1vgaSignatureFightEvents, qfg1vgaPatchFightEvents }, + { 216, "weapon master event issue", 1, 0, 0, qfg1vgaSignatureFightEvents, qfg1vgaPatchFightEvents }, + { 814, "window text temp space", 1, 0, 0, qfg1vgaSignatureTempSpace, qfg1vgaPatchTempSpace }, + { 814, "dialog header offset", 3, 0, 0, qfg1vgaSignatureDialogHeader, qfg1vgaPatchDialogHeader }, + { 331, "moving to crusher", 1, 0, 0, qfg1vgaSignatureMoveToCrusher, qfg1vgaPatchMoveToCrusher }, + { 41, "moving to castle gate", 1, 0, 0, qfg1vgaSignatureMoveToCastleGate, qfg1vgaPatchMoveToCastleGate }, + { 210, "cheetaur description fixed", 1, 0, 0, qfg1vgaSignatureCheetaurDescription, qfg1vgaPatchCheetaurDescription }, + { 96, "funny room script bug fixed", 1, 0, 0, qfg1vgaSignatureFunnyRoomFix, qfg1vgaPatchFunnyRoomFix }, SCI_SIGNATUREENTRY_TERMINATOR }; @@ -1268,7 +1373,7 @@ const SciScriptSignature qfg1vgaSignatures[] = { // crashes because of these constant quick object reallocations. Fixes bug // #3037996. const uint16 qfg2SignatureImportDialog[] = { - 0x63, 0x20, // pToa text + 0x63, SIG_MAGICDWORD, 0x20, // pToa text 0x30, SIG_UINT16 + 0x0b, 0x00, // bnt [next state] 0x7a, // push2 0x39, 0x03, // pushi 03 @@ -1285,16 +1390,16 @@ const uint16 qfg2PatchImportDialog[] = { PATCH_END }; -// script, description, magic DWORD, adjust -const SciScriptSignature qfg2Signatures[] = { - { 944, "import dialog continuous calls", 1, PATCH_MAGICDWORD(0x20, 0x30, 0x0b, 0x00), -1, qfg2SignatureImportDialog, qfg2PatchImportDialog }, +// script, description, signature patch +SciScriptPatcherEntry qfg2Signatures[] = { + { 944, "import dialog continuous calls", 1, 0, 0, qfg2SignatureImportDialog, qfg2PatchImportDialog }, SCI_SIGNATUREENTRY_TERMINATOR }; // =========================================================================== // Patch for the import screen in QFG3, same as the one for QFG2 above const uint16 qfg3SignatureImportDialog[] = { - 0x63, 0x2a, // pToa text + 0x63, SIG_MAGICDWORD, 0x2a, // pToa text 0x31, 0x0b, // bnt [next state] 0x7a, // push2 0x39, 0x03, // pushi 03 @@ -1326,8 +1431,10 @@ const uint16 qfg3PatchImportDialog[] = { // hero::solvePuzzle (0xfffc) which does a ret afterwards without going to // Teller::doChild. We jump to this call of hero::solvePuzzle to get that same // behaviour. - +// Applies to at least: English, German, Italian, French, Spanish Floppy +// Responsible method: unknown const uint16 qfg3SignatureWooDialog[] = { + SIG_MAGICDWORD, 0x67, 0x12, // pTos 12 (query) 0x35, 0xb6, // ldi b6 0x1a, // eq? @@ -1336,7 +1443,7 @@ const uint16 qfg3SignatureWooDialog[] = { 0x35, 0x9b, // ldi 9b 0x1a, // eq? 0x31, 0x0c, // bnt 0c - 0x38, SIG_UINT16 + 0x97, 0x02, // pushi 0297 + 0x38, SIG_SELECTOR16 + SELECTOR_solvePuzzle, // pushi 0297 0x7a, // push2 0x38, SIG_UINT16 + 0x0c, 0x01, // pushi 010c 0x7a, // push2 @@ -1353,10 +1460,10 @@ const uint16 qfg3PatchWooDialog[] = { PATCH_END }; -// script, description, magic DWORD, adjust -const SciScriptSignature qfg3Signatures[] = { - { 944, "import dialog continuous calls", 1, PATCH_MAGICDWORD(0x2a, 0x31, 0x0b, 0x7a), -1, qfg3SignatureImportDialog, qfg3PatchImportDialog }, - { 440, "dialog crash when asking about Woo", 1, PATCH_MAGICDWORD(0x67, 0x12, 0x35, 0xb5), -26, qfg3SignatureWooDialog, qfg3PatchWooDialog }, +// script, description, signature patch +SciScriptPatcherEntry qfg3Signatures[] = { + { 944, "import dialog continuous calls", 1, 0, 0, qfg3SignatureImportDialog, qfg3PatchImportDialog }, + { 440, "dialog crash when asking about Woo", 1, 0, 0, qfg3SignatureWooDialog, qfg3PatchWooDialog }, SCI_SIGNATUREENTRY_TERMINATOR }; @@ -1369,19 +1476,10 @@ const SciScriptSignature qfg3Signatures[] = { // but I think just patching it out is cleaner (bug #3037938) const uint16 sq4FloppySignatureEndlessFlight[] = { 0x39, 0x04, // pushi 04 (selector x) + SIG_MAGICDWORD, 0x78, // push1 0x67, 0x08, // pTos 08 (property x) - 0x63, 0x44, // pToa 44 (invalid property) - 0x02, // add - SIG_END -}; - -// Similar to the above, for the German version (bug #3110215) -const uint16 sq4FloppySignatureEndlessFlightGerman[] = { - 0x39, 0x04, // pushi 04 (selector x) - 0x78, // push1 - 0x67, 0x08, // pTos 08 (property x) - 0x63, 0x4c, // pToa 4c (invalid property) + 0x63, SIG_ADDTOOFFSET + 1, // pToa (invalid property) - 44h for English floppy, 4ch for German floppy 0x02, // add SIG_END }; @@ -1399,6 +1497,7 @@ const uint16 sq4FloppyPatchEndlessFlight[] = { // This is patched to add the "Both" text resource (i.e. we end up with // "Speech", "Text" and "Both") const uint16 sq4CdSignatureTextOptionsButton[] = { + SIG_MAGICDWORD, 0x35, 0x01, // ldi 0x01 0xa1, 0x53, // sag 0x53 0x39, 0x03, // pushi 0x03 @@ -1418,6 +1517,7 @@ const uint16 sq4CdPatchTextOptionsButton[] = { // (e.g. the two guys from Andromeda) shown when dying/quitting. // Fixes bug #3538418. const uint16 sq4CdSignatureBabbleIcon[] = { + SIG_MAGICDWORD, 0x89, 0x5a, // lsg 5a 0x35, 0x02, // ldi 02 0x1a, // eq? @@ -1438,6 +1538,7 @@ const uint16 sq4CdPatchBabbleIcon[] = { // Refer to the patch above for additional details. // iconTextSwitch::doit (called when the text options button is clicked) const uint16 sq4CdSignatureTextOptions[] = { + SIG_MAGICDWORD, 0x89, 0x5a, // lsg 0x5a (load global 90 to stack) 0x3c, // dup 0x35, 0x01, // ldi 0x01 @@ -1453,7 +1554,7 @@ const uint16 sq4CdSignatureTextOptions[] = { 0x35, 0x01, // ldi 0x01 0xa1, 0x5a, // sag 0x5a (save acc to global 90) 0x3a, // toss - 0x38, SIG_UINT16 + 0xd9, 0x00, // pushi 0x00d9 + 0x38, SIG_SELECTOR16 + SELECTOR_show, // pushi 0x00d9 0x76, // push0 0x54, 0x04, // self 0x04 0x48, // ret @@ -1479,13 +1580,12 @@ const uint16 sq4CdPatchTextOptions[] = { PATCH_END }; -// script, description, magic DWORD, adjust -const SciScriptSignature sq4Signatures[] = { - { 298, "Floppy: endless flight", 1, PATCH_MAGICDWORD(0x67, 0x08, 0x63, 0x44), -3, sq4FloppySignatureEndlessFlight, sq4FloppyPatchEndlessFlight }, - { 298, "Floppy (German): endless flight", 1, PATCH_MAGICDWORD(0x67, 0x08, 0x63, 0x4c), -3, sq4FloppySignatureEndlessFlightGerman, sq4FloppyPatchEndlessFlight }, - { 818, "CD: Speech and subtitles option", 1, PATCH_MAGICDWORD(0x89, 0x5a, 0x3c, 0x35), 0, sq4CdSignatureTextOptions, sq4CdPatchTextOptions }, - { 0, "CD: Babble icon speech and subtitles fix", 1, PATCH_MAGICDWORD(0x89, 0x5a, 0x35, 0x02), 0, sq4CdSignatureBabbleIcon, sq4CdPatchBabbleIcon }, - { 818, "CD: Speech and subtitles option button", 1, PATCH_MAGICDWORD(0x35, 0x01, 0xa1, 0x53), 0, sq4CdSignatureTextOptionsButton, sq4CdPatchTextOptionsButton }, +// script, description, signature patch +SciScriptPatcherEntry sq4Signatures[] = { + { 298, "Floppy: endless flight", 1, 0, 0, sq4FloppySignatureEndlessFlight, sq4FloppyPatchEndlessFlight }, + { 818, "CD: Speech and subtitles option", 1, 0, 0, sq4CdSignatureTextOptions, sq4CdPatchTextOptions }, + { 0, "CD: Babble icon speech and subtitles fix", 1, 0, 0, sq4CdSignatureBabbleIcon, sq4CdPatchBabbleIcon }, + { 818, "CD: Speech and subtitles option button", 1, 0, 0, sq4CdSignatureTextOptionsButton, sq4CdPatchTextOptionsButton }, SCI_SIGNATUREENTRY_TERMINATOR }; @@ -1501,7 +1601,8 @@ const SciScriptSignature sq4Signatures[] = { // We simply set the correct starting cel number to fix the bug. // Responsible method: robotIntoShip::changeState(9) const uint16 sq1vgaSignatureUlenceFlatsTimepodGfxGlitch[] = { - 0x39, 0x07, // pushi 07 (ship::cel) + 0x39, + SIG_MAGICDWORD, SIG_SELECTOR8 + SELECTOR_cel, // pushi "cel" 0x78, // push1 0x39, 0x0a, // pushi 0x0a (set ship::cel to 10) 0x38, SIG_UINT16 + 0xa0, 0x00, // pushi 0x00a0 (ship::setLoop) @@ -1515,9 +1616,10 @@ const uint16 sq1vgaPatchUlenceFlatsTimepodGfxGlitch[] = { }; const uint16 sq1vgaSignatureEgoShowsCard[] = { - 0x38, SIG_UINT16 + 0x46, 0x02, // push 0x246 (set up send frame to set timesShownID) + SIG_MAGICDWORD, + 0x38, SIG_SELECTOR16 + SELECTOR_timesShownID, // push "timesShownID" 0x78, // push1 - 0x38, SIG_UINT16 + 0x46, 0x02, // push 0x246 (set up send frame to get timesShownID) + 0x38, SIG_SELECTOR16 + SELECTOR_timesShownID, // push "timesShownID" 0x76, // push0 0x51, 0x7c, // class DeltaurRegion 0x4a, 0x04, // send 0x04 (get timesShownID) @@ -1536,7 +1638,7 @@ const uint16 sq1vgaSignatureEgoShowsCard[] = { // Note that this script patch is merely a reordering of the // instructions in the original script. const uint16 sq1vgaPatchEgoShowsCard[] = { - 0x38, PATCH_UINT16 + 0x46, 0x02, // push 0x246 (set up send frame to get timesShownID) + 0x38, PATCH_SELECTOR16 + SELECTOR_timesShownID, // push "timesShownID" 0x76, // push0 0x51, 0x7c, // class DeltaurRegion 0x4a, 0x04, // send 0x04 (get timesShownID) @@ -1544,7 +1646,7 @@ const uint16 sq1vgaPatchEgoShowsCard[] = { 0x35, 0x01, // ldi 1 0x02, // add 0x36, // push (this push corresponds to the wrong one above) - 0x38, PATCH_UINT16 + 0x46, 0x02, // push 0x246 (set up send frame to set timesShownID) + 0x38, PATCH_SELECTOR16 + SELECTOR_timesShownID, // push "timesShownID" 0x78, // push1 0x36, // push 0x51, 0x7c, // class DeltaurRegion @@ -1555,18 +1657,19 @@ const uint16 sq1vgaPatchEgoShowsCard[] = { }; -// script, description, magic DWORD, adjust -const SciScriptSignature sq1vgaSignatures[] = { - { 45, "Ulence Flats: timepod graphic glitch", 1, PATCH_MAGICDWORD( 0x07, 0x78, 0x39, 0x0a ), -1, sq1vgaSignatureUlenceFlatsTimepodGfxGlitch, sq1vgaPatchUlenceFlatsTimepodGfxGlitch }, - { 58, "Sarien armory droid zapping ego first time", 1, PATCH_MAGICDWORD( 0x72, 0x88, 0x15, 0x36 ), -70, sq1vgaSignatureEgoShowsCard, sq1vgaPatchEgoShowsCard }, - +// script, description, signature patch +SciScriptPatcherEntry sq1vgaSignatures[] = { + { 45, "Ulence Flats: timepod graphic glitch", 1, 0, 0, sq1vgaSignatureUlenceFlatsTimepodGfxGlitch, sq1vgaPatchUlenceFlatsTimepodGfxGlitch }, + { 58, "Sarien armory droid zapping ego first time", 1, 0, 0, sq1vgaSignatureEgoShowsCard, sq1vgaPatchEgoShowsCard }, SCI_SIGNATUREENTRY_TERMINATOR}; // will actually patch previously found signature area -void Script::applyPatch(const uint16 *patch, byte *scriptData, const uint32 scriptSize, int32 signatureOffset, const bool isMacSci11) { +void Script::patcherApplyPatch(const SciScriptPatcherEntry *patchEntry, byte *scriptData, const uint32 scriptSize, int32 signatureOffset, const bool isMacSci11) { + const uint16 *patchData = patchEntry->patchData; byte orgData[PATCH_VALUELIMIT]; int32 offset = signatureOffset; - uint16 patchWord = *patch; + uint16 patchWord = *patchEntry->patchData; + uint16 patchSelector = 0; // Copy over original bytes from script uint32 orgDataSize = scriptSize - offset; @@ -1575,8 +1678,9 @@ void Script::applyPatch(const uint16 *patch, byte *scriptData, const uint32 scri memcpy(&orgData, &scriptData[offset], orgDataSize); while (patchWord != PATCH_END) { + uint16 patchCommand = patchWord & PATCH_COMMANDMASK; uint16 patchValue = patchWord & PATCH_VALUEMASK; - switch (patchWord & PATCH_COMMANDMASK) { + switch (patchCommand) { case PATCH_ADDTOOFFSET: { // add value to offset offset += patchValue; @@ -1585,7 +1689,7 @@ void Script::applyPatch(const uint16 *patch, byte *scriptData, const uint32 scri case PATCH_GETORIGINALBYTE: { // get original byte from script if (patchValue >= orgDataSize) - error("patching: can not get requested original byte from script"); + error("Script-Patcher: can not get requested original byte from script"); scriptData[offset] = orgData[patchValue]; offset++; break; @@ -1593,38 +1697,37 @@ void Script::applyPatch(const uint16 *patch, byte *scriptData, const uint32 scri case PATCH_GETORIGINALBYTEADJUST: { // get original byte from script and adjust it if (patchValue >= orgDataSize) - error("patching: can not get requested original byte from script"); + error("Script-Patcher: can not get requested original byte from script"); byte orgByte = orgData[patchValue]; int16 adjustValue; - patch++; adjustValue = (int16)(*patch); + patchData++; adjustValue = (int16)(*patchData); scriptData[offset] = orgByte + adjustValue; offset++; break; } - case PATCH_ADJUSTWORD: { - // Adjust word right before current position - byte *adjustPtr = &scriptData[offset - 2]; - uint16 adjustWord = READ_LE_UINT16(adjustPtr); - adjustWord += patchValue; - WRITE_LE_UINT16(adjustPtr, adjustWord); - break; - } - case PATCH_ADJUSTWORD_NEG: { - // Adjust word right before current position (negative way) - byte *adjustPtr = &scriptData[offset - 2]; - uint16 adjustWord = READ_LE_UINT16(adjustPtr); - adjustWord -= patchValue; - WRITE_LE_UINT16(adjustPtr, adjustWord); - break; - } - case PATCH_UINT16: { - byte byte1 = patchValue & PATCH_BYTEMASK; + case PATCH_UINT16: + case PATCH_SELECTOR16: { + byte byte1; byte byte2; - patch++; patchWord = *patch; - if (patchWord & PATCH_COMMANDMASK) { - error("Patch inconsistent"); + + switch (patchCommand) { + case PATCH_UINT16: { + byte1 = patchValue & PATCH_BYTEMASK; + patchData++; patchWord = *patchData; + if (patchWord & PATCH_COMMANDMASK) + error("Script-Patcher: Patch inconsistent"); + byte2 = patchWord & PATCH_BYTEMASK; + break; + } + case PATCH_SELECTOR16: { + patchSelector = selectorTable[patchValue].id; + byte1 = patchSelector & 0xFF; + byte2 = patchSelector >> 8; + break; + } + default: + byte1 = 0; byte2 = 0; } - byte2 = patchWord & PATCH_BYTEMASK; if (!isMacSci11) { scriptData[offset++] = byte1; scriptData[offset++] = byte2; @@ -1635,49 +1738,74 @@ void Script::applyPatch(const uint16 *patch, byte *scriptData, const uint32 scri } break; } - default: + case PATCH_SELECTOR8: { + patchSelector = selectorTable[patchValue].id; + if (patchSelector & 0xFF00) + error("Script-Patcher: 8 bit selector required, game uses 16 bit selector"); + scriptData[offset] = patchSelector & 0xFF; + offset++; + break; + } + case PATCH_BYTE: scriptData[offset] = patchValue & PATCH_BYTEMASK; offset++; } - patch++; - patchWord = *patch; + patchData++; + patchWord = *patchData; } } // will return -1 if no match was found, otherwise an offset to the start of the signature match -int32 Script::findSignature(const SciScriptSignature *signature, const byte *scriptData, const uint32 scriptSize, const bool isMacSci11) { +int32 Script::patcherFindSignature(const SciScriptPatcherEntry *patchEntry, const byte *scriptData, const uint32 scriptSize, const bool isMacSci11) { if (scriptSize < 4) // we need to find a DWORD, so less than 4 bytes is not okay return -1; - const uint32 magicDWord = signature->magicDWord; // is platform-specific BE/LE form, so that the later match will work + const uint32 magicDWord = patchEntry->magicDWord; // is platform-specific BE/LE form, so that the later match will work const uint32 searchLimit = scriptSize - 3; uint32 DWordOffset = 0; // first search for the magic DWORD while (DWordOffset < searchLimit) { if (magicDWord == READ_UINT32(scriptData + DWordOffset)) { // magic DWORD found, check if actual signature matches - uint32 offset = DWordOffset + signature->magicOffset; + uint32 offset = DWordOffset + patchEntry->magicOffset; uint32 byteOffset = offset; - const uint16 *signatureData = signature->data; - + const uint16 *signatureData = patchEntry->signatureData; + uint16 sigSelector = 0; + uint16 sigWord = *signatureData; while (sigWord != SIG_END) { - uint16 sigValue = sigWord & PATCH_VALUEMASK; - switch (sigWord & SIG_COMMANDMASK) { + uint16 sigCommand = sigWord & SIG_COMMANDMASK; + uint16 sigValue = sigWord & SIG_VALUEMASK; + switch (sigCommand) { case SIG_ADDTOOFFSET: { // add value to offset byteOffset += sigValue; break; } - case PATCH_UINT16: { + case SIG_UINT16: + case SIG_SELECTOR16: { if ((byteOffset + 1) < scriptSize) { - byte byte1 = sigValue & SIG_BYTEMASK; + byte byte1; byte byte2; - signatureData++; sigWord = *signatureData; - if (sigWord & SIG_COMMANDMASK) { - error("Patch inconsistent"); + + switch (sigCommand) { + case SIG_UINT16: { + byte1 = sigValue & SIG_BYTEMASK; + signatureData++; sigWord = *signatureData; + if (sigWord & SIG_COMMANDMASK) + error("Script-Patcher: signature inconsistent\nFaulty patch: '%s'", patchEntry->description); + byte2 = sigWord & SIG_BYTEMASK; + break; + } + case SIG_SELECTOR16: { + sigSelector = selectorTable[sigValue].id; + byte1 = sigSelector & 0xFF; + byte2 = sigSelector >> 8; + break; + } + default: + byte1 = 0; byte2 = 0; } - byte2 = sigWord & SIG_BYTEMASK; if (!isMacSci11) { if ((scriptData[byteOffset] != byte1) || (scriptData[byteOffset + 1] != byte2)) sigWord = SIG_MISMATCH; @@ -1692,15 +1820,27 @@ int32 Script::findSignature(const SciScriptSignature *signature, const byte *scr } break; } - default: + case SIG_SELECTOR8: { + if (byteOffset < scriptSize) { + sigSelector = selectorTable[sigValue].id; + if (sigSelector & 0xFF00) + error("Script-Patcher: 8 bit selector required, game uses 16 bit selector\nFaulty patch: '%s'", patchEntry->description); + if (scriptData[byteOffset] != (sigSelector & 0xFF)) + sigWord = SIG_MISMATCH; + byteOffset++; + } else { + sigWord = SIG_MISMATCH; // out of bounds + } + break; + } + case SIG_BYTE: if (byteOffset < scriptSize) { if (scriptData[byteOffset] != sigWord) sigWord = SIG_MISMATCH; + byteOffset++; } else { - // out of bounds - sigWord = SIG_MISMATCH; + sigWord = SIG_MISMATCH; // out of bounds } - byteOffset++; } if (sigWord == SIG_MISMATCH) @@ -1719,8 +1859,139 @@ int32 Script::findSignature(const SciScriptSignature *signature, const byte *scr return -1; } -void Script::matchSignatureAndPatch(uint16 scriptNr, byte *scriptData, const uint32 scriptSize) { - const SciScriptSignature *signatureTable = NULL; +// This method calculates the magic DWORD for each entry in the signature table +// and it also initializes the selector table for selectors used in the signatures/patches of the current game +void Script::patcherInitSignature(SciScriptPatcherEntry *patchTable, bool isMacSci11) { + SciScriptPatcherEntry *curEntry = patchTable; + SciScriptPatcherSelector *curSelector = NULL; + int step; + int magicOffset; + byte magicDWord[4]; + int magicDWordLeft = 0; + const uint16 *curData; + uint16 curWord; + uint16 curCommand; + uint32 curValue; + byte byte1; + byte byte2; + + while (curEntry->signatureData) { + // process signature + memset(magicDWord, 0, sizeof(magicDWord)); + + for (step = 0; step < 2; step++) { + switch (step) { + case 0: curData = curEntry->signatureData; break; + case 1: curData = curEntry->patchData; break; + } + + curWord = *curData; + magicOffset = 0; + while (curWord != SIG_END) { + curCommand = curWord & SIG_COMMANDMASK; + curValue = curWord & SIG_VALUEMASK; + switch (curCommand) { + case SIG_MAGICDWORD: { + if (step == 0) { + if ((curEntry->magicDWord) || (magicDWordLeft)) + error("Script-Patcher: Magic-DWORD specified multiple times in signature\nFaulty patch: '%s'", curEntry->description); + magicDWordLeft = 4; + curEntry->magicOffset = magicOffset; + } + break; + } + case SIG_ADDTOOFFSET: { + magicOffset -= curValue; + if (magicDWordLeft) + error("Script-Patcher: Magic-DWORD contains AddToOffset command\nFaulty patch: '%s'", curEntry->description); + break; + } + case SIG_UINT16: + case SIG_SELECTOR16: { + // UINT16 or 1 + switch (curCommand) { + case SIG_UINT16: { + curData++; curWord = *curData; + if (curWord & SIG_COMMANDMASK) + error("Script-Patcher: signature entry inconsistent\nFaulty patch: '%s'", curEntry->description); + if (!isMacSci11) { + byte1 = curValue; + byte2 = curWord & SIG_BYTEMASK; + } else { + byte1 = curWord & SIG_BYTEMASK; + byte2 = curValue; + } + break; + } + case SIG_SELECTOR16: { + curSelector = &selectorTable[curValue]; + if (curSelector->id == -1) + curSelector->id = g_sci->getKernel()->findSelector(curSelector->name); + if (!isMacSci11) { + byte1 = curSelector->id & 0x00FF; + byte2 = curSelector->id >> 8; + } else { + byte1 = curSelector->id >> 8; + byte2 = curSelector->id & 0x00FF; + } + break; + } + } + magicOffset -= 2; + if (magicDWordLeft) { + // Remember current word for Magic DWORD + magicDWord[4 - magicDWordLeft] = byte1; + magicDWordLeft--; + if (magicDWordLeft) { + magicDWord[4 - magicDWordLeft] = byte2; + magicDWordLeft--; + } + if (!magicDWordLeft) { + curEntry->magicDWord = READ_LE_UINT32(magicDWord); + } + } + break; + } + case SIG_BYTE: + case SIG_SELECTOR8: { + if (curCommand == SIG_SELECTOR8) { + curSelector = &selectorTable[curValue]; + if (curSelector->id == -1) { + curSelector->id = g_sci->getKernel()->findSelector(curSelector->name); + if (curSelector->id != -1) { + if (curSelector->id & 0xFF00) + error("Script-Patcher: 8 bit selector required, game uses 16 bit selector\nFaulty patch: '%s'", curEntry->description); + } + } + curValue = curSelector->id; + } + magicOffset--; + if (magicDWordLeft) { + // Remember current byte for Magic DWORD + magicDWord[4 - magicDWordLeft] = (byte)curValue; + magicDWordLeft--; + if (!magicDWordLeft) { + curEntry->magicDWord = READ_LE_UINT32(magicDWord); + } + } + } + } + curData++; + curWord = *curData; + } + } + if (magicDWordLeft) + error("Script-Patcher: Magic-DWORD beyond End-Of-Signature\nFaulty patch: '%s'", curEntry->description); + if (!curEntry->magicDWord) + error("Script-Patcher: Magic-DWORD not specified in signature\nFaulty patch: '%s'", curEntry->description); + + curEntry++; + } +} + +void Script::patcherProcessScript(uint16 scriptNr, byte *scriptData, const uint32 scriptSize) { + SciScriptPatcherEntry *signatureTable = NULL; + switch (g_sci->getGameId()) { case GID_CAMELOT: signatureTable = camelotSignatures; @@ -1789,17 +2060,22 @@ void Script::matchSignatureAndPatch(uint16 scriptNr, byte *scriptData, const uin if (signatureTable) { bool isMacSci11 = (g_sci->getPlatform() == Common::kPlatformMacintosh && getSciVersion() >= SCI_VERSION_1_1); + + if (!signatureTable->magicDWord) { + // signature table needs to get initialized (Magic DWORD set, selector table set) + patcherInitSignature(signatureTable, isMacSci11); + } - while (signatureTable->data) { + while (signatureTable->signatureData) { if (scriptNr == signatureTable->scriptNr) { int32 foundOffset = 0; int16 applyCount = signatureTable->applyCount; do { - foundOffset = findSignature(signatureTable, scriptData, scriptSize, isMacSci11); + foundOffset = patcherFindSignature(signatureTable, scriptData, scriptSize, isMacSci11); if (foundOffset != -1) { // found, so apply the patch - debugC(kDebugLevelScriptPatcher, "matched and patched %s on script %d offset %d", signatureTable->description, scriptNr, foundOffset); - applyPatch(signatureTable->patch, scriptData, scriptSize, foundOffset, isMacSci11); + debugC(kDebugLevelScriptPatcher, "Script-Patcher: '%s' on script %d offset %d", signatureTable->description, scriptNr, foundOffset); + patcherApplyPatch(signatureTable, scriptData, scriptSize, foundOffset, isMacSci11); } applyCount--; } while ((foundOffset != -1) && (applyCount)); diff --git a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp index af4f8775f4..26e248fbca 100644 --- a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp +++ b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp @@ -443,11 +443,13 @@ ImuseDigiSndMgr::SoundDesc *ImuseDigiSndMgr::openSound(int32 soundId, const char } else if (soundName[0] == 0) { if (sound->bundle->decompressSampleByIndex(soundId, 0, 0x2000, &ptr, 0, header_outside) == 0 || ptr == NULL) { closeSound(sound); + free(ptr); return NULL; } } else { if (sound->bundle->decompressSampleByName(soundName, 0, 0x2000, &ptr, header_outside) == 0 || ptr == NULL) { closeSound(sound); + free(ptr); return NULL; } } diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index ee015e3315..32810626e7 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -1070,9 +1070,16 @@ bool GfxButton::process(Event &event) { GfxDialog::GfxDialog() { _savedArea = NULL; _defaultButton = NULL; + + // For Return to Ringworld 2, backup palette when showing a dialog + if (g_vm->getGameID() == GType_Ringworld2) + g_system->getPaletteManager()->grabPalette(&_savedPalette[0], 0, 256); } GfxDialog::~GfxDialog() { + if (g_vm->getGameID() == GType_Ringworld2) + g_system->getPaletteManager()->setPalette(&_savedPalette[0], 0, 256); + remove(); } diff --git a/engines/tsage/graphics.h b/engines/tsage/graphics.h index 8d9c4d31b1..497cd76ad6 100644 --- a/engines/tsage/graphics.h +++ b/engines/tsage/graphics.h @@ -320,6 +320,7 @@ public: GfxElementList _elements; GfxButton *_defaultButton; GfxSurface *_savedArea; + byte _savedPalette[256 * 3]; public: GfxDialog(); virtual ~GfxDialog(); diff --git a/engines/tsage/ringworld2/ringworld2_dialogs.cpp b/engines/tsage/ringworld2/ringworld2_dialogs.cpp index 4ebbdd602d..7c97aa041c 100644 --- a/engines/tsage/ringworld2/ringworld2_dialogs.cpp +++ b/engines/tsage/ringworld2/ringworld2_dialogs.cpp @@ -344,7 +344,7 @@ CharacterDialog::CharacterDialog() { /*--------------------------------------------------------------------------*/ void HelpDialog::show() { - // Set the palette and change the cursor + // change the cursor R2_GLOBALS._events.setCursor(CURSOR_ARROW); // Create the dialog and draw it diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index e37f64e049..e5d8b0702b 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -180,7 +180,7 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Spill Mountains: Balloon Launch Platform return new Scene2350(); case 2400: - // Spill Mountains: Large empty room + // Spill Mountains: Unused large empty room return new Scene2400(); case 2425: // Spill Mountains: The Hall of Records @@ -204,7 +204,7 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Spill Mountains: Inside crevasse return new Scene2455(); case 2500: - // Spill Mountains: Large Cave + // Spill Mountains: Large Ledge return new Scene2500(); case 2525: // Spill Mountains: Furnace room diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index b5173bbf59..aabcd261c7 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -1508,7 +1508,7 @@ void Scene180::Action1::signal() { /*--------------------------------------------------------------------------*/ Scene180::Scene180(): SceneExt() { - _helpDisabled = 0; + _helpEnabled = false; _frameInc = 0; _frameNumber = R2_GLOBALS._events.getFrameNumber(); _fontNumber = R2_GLOBALS.gfxManager()._font._fontNumber; @@ -1555,7 +1555,7 @@ void Scene180::synchronize(Serializer &s) { SceneExt::synchronize(s); s.syncAsSint16LE(_frameNumber); - s.syncAsSint16LE(_helpDisabled); + s.syncAsSint16LE(_helpEnabled); s.syncAsSint16LE(_frameInc); s.syncAsSint16LE(_fontNumber); s.syncAsSint16LE(_fontHeight); @@ -1570,7 +1570,7 @@ void Scene180::signal() { break; case 1: - _helpDisabled = 1; + _helpEnabled = true; R2_GLOBALS._sceneManager._hasPalette = true; _animationPlayer._paletteMode = ANIMPALMODE_NONE; _animationPlayer._isActive = true; @@ -1608,7 +1608,7 @@ void Scene180::signal() { case 30: case 43: case 47: - _helpDisabled = 0; + _helpEnabled = false; R2_GLOBALS._screenSurface.fillRect(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 0); _palette.loadPalette(0); _palette.loadPalette(9998); @@ -1622,7 +1622,7 @@ void Scene180::signal() { R2_GLOBALS._scene180Mode = 2; _animationPlayer.load(2); - _helpDisabled = 1; + _helpEnabled = true; R2_GLOBALS._scenePalette.addFader(_animationPlayer._subData._palData, 256, 6, NULL); R2_GLOBALS._sound1.play(2); break; @@ -1659,7 +1659,7 @@ void Scene180::signal() { break; case 11: - _helpDisabled = 1; + _helpEnabled = true; _door.postInit(); _shipDisplay.postInit(); setAction(&_sequenceManager, this, 4000, &_door, &_shipDisplay, NULL); @@ -1706,21 +1706,21 @@ void Scene180::signal() { break; case 27: - _helpDisabled = 0; + _helpEnabled = false; _door.remove(); _shipDisplay.remove(); setSceneDelay(2); break; case 28: - _helpDisabled = 0; + _helpEnabled = false; _palette.loadPalette(0); _palette.loadPalette(9998); R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 100, this); break; case 29: - _helpDisabled = 1; + _helpEnabled = true; _animationPlayer._paletteMode = ANIMPALMODE_REPLACE_PALETTE; _animationPlayer._isActive = true; _animationPlayer._objectMode = ANIMOBJMODE_42; @@ -1749,7 +1749,7 @@ void Scene180::signal() { break; case 32: - _helpDisabled = 1; + _helpEnabled = true; _teal.postInit(); _teal.setPosition(Common::Point(161, 97)); @@ -1799,7 +1799,7 @@ void Scene180::signal() { break; case 37: - _helpDisabled = 0; + _helpEnabled = false; _dutyOfficer.remove(); _palette.loadPalette(9998); R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 8, this); @@ -1839,7 +1839,7 @@ void Scene180::signal() { break; case 41: - _helpDisabled = 1; + _helpEnabled = true; _animationPlayer._isActive = true; break; @@ -1859,12 +1859,12 @@ void Scene180::signal() { break; case 45: - _helpDisabled = 1; + _helpEnabled = true; _stripManager.start(28, this); break; case 48: - _helpDisabled = 1; + _helpEnabled = true; _animationPlayer._paletteMode = ANIMPALMODE_NONE; _animationPlayer._isActive = true; _animationPlayer._objectMode = ANIMOBJMODE_1; @@ -1887,7 +1887,7 @@ void Scene180::signal() { case 50: R2_GLOBALS._scene180Mode = 0; - _helpDisabled = 0; + _helpEnabled = false; // WORKAROUND: The original changed to scene 100 here, Quinn's Bedroom, // but instead we're changing to the previously unused scene 50, which shows @@ -1904,8 +1904,8 @@ void Scene180::setSceneDelay(int v) { void Scene180::process(Event &event) { if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_ESCAPE)) { - event.handled = 1; - if (!_helpDisabled) { + event.handled = true; + if (_helpEnabled) { if (R2_GLOBALS._scenePalette._listeners.size() == 0) HelpDialog::show(); } @@ -2911,11 +2911,11 @@ void Scene300::Action4::signal() { Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene; if (!R2_GLOBALS._playStream.isPlaying()) { - scene->_object7.setStrip2(R2_GLOBALS._randomSource.getRandomNumber(2)); - scene->_object7.setFrame(1); + scene->_mirandaScreen.setStrip2(R2_GLOBALS._randomSource.getRandomNumber(2)); + scene->_mirandaScreen.setFrame(1); - scene->_object9.setStrip2(3); - scene->_object9.setFrame(1); + scene->_quinnScreen.setStrip2(3); + scene->_quinnScreen.setFrame(1); } setDelay(60 + R2_GLOBALS._randomSource.getRandomNumber(479)); @@ -3246,29 +3246,29 @@ void Scene300::postInit(SceneObjectList *OwnerList) { _rotation->_countdown = 1; if (R2_GLOBALS.getFlag(51) && !R2_GLOBALS.getFlag(25)) { - _object1.postInit(); - _object1.setup(301, 7, 2); - _object1.setPosition(Common::Point(65, 24)); + _atmosphereLeftWindow.postInit(); + _atmosphereLeftWindow.setup(301, 7, 2); + _atmosphereLeftWindow.setPosition(Common::Point(65, 24)); - _object2.postInit(); - _object2.setup(301, 8, 2); - _object2.setPosition(Common::Point(254, 24)); + _atmosphereRightWindow.postInit(); + _atmosphereRightWindow.setup(301, 8, 2); + _atmosphereRightWindow.setPosition(Common::Point(254, 24)); } _doorway.postInit(); _doorway.setVisage(300); _doorway.setPosition(Common::Point(159, 79)); - _object3.postInit(); - _object3.setup(300, 4, 1); - _object3.setPosition(Common::Point(84, 48)); - _object3.animate(ANIM_MODE_2, NULL); - _object3._numFrames = 5; + _leftVerticalBarsAnim.postInit(); + _leftVerticalBarsAnim.setup(300, 4, 1); + _leftVerticalBarsAnim.setPosition(Common::Point(84, 48)); + _leftVerticalBarsAnim.animate(ANIM_MODE_2, NULL); + _leftVerticalBarsAnim._numFrames = 5; - _object4.postInit(); - _object4.setup(300, 5, 1); - _object4.setPosition(Common::Point(236, 48)); - _object4.animate(ANIM_MODE_2, NULL); + _rightVerticalBarsAnim.postInit(); + _rightVerticalBarsAnim.setup(300, 5, 1); + _rightVerticalBarsAnim.setPosition(Common::Point(236, 48)); + _rightVerticalBarsAnim.animate(ANIM_MODE_2, NULL); _protocolDisplay.postInit(); _protocolDisplay.setup(300, 6, 1); @@ -3276,32 +3276,32 @@ void Scene300::postInit(SceneObjectList *OwnerList) { _protocolDisplay.animate(ANIM_MODE_7, 0, NULL); _protocolDisplay._numFrames = 5; - _object6.postInit(); - _object6.setup(300, 7, 1); - _object6.setPosition(Common::Point(214, 37)); - _object6.animate(ANIM_MODE_2, NULL); - _object6._numFrames = 3; - - _object7.postInit(); - _object7.setup(301, 1, 1); - _object7.setPosition(Common::Point(39, 97)); - _object7.fixPriority(124); - _object7.animate(ANIM_MODE_2, NULL); - _object7._numFrames = 5; - _object7.setAction(&_action4); - - _object8.postInit(); - _object8.setup(300, 8, 1); - _object8.setPosition(Common::Point(105, 37)); - _object8.animate(ANIM_MODE_2, NULL); - _object8._numFrames = 5; - - _object9.postInit(); - _object9.setup(301, 6, 1); - _object9.setPosition(Common::Point(274, 116)); - _object9.fixPriority(143); - _object9.animate(ANIM_MODE_2, NULL); - _object9._numFrames = 5; + _rightTextDisplay.postInit(); + _rightTextDisplay.setup(300, 7, 1); + _rightTextDisplay.setPosition(Common::Point(214, 37)); + _rightTextDisplay.animate(ANIM_MODE_2, NULL); + _rightTextDisplay._numFrames = 3; + + _mirandaScreen.postInit(); + _mirandaScreen.setup(301, 1, 1); + _mirandaScreen.setPosition(Common::Point(39, 97)); + _mirandaScreen.fixPriority(124); + _mirandaScreen.animate(ANIM_MODE_2, NULL); + _mirandaScreen._numFrames = 5; + _mirandaScreen.setAction(&_action4); + + _leftTextDisplay.postInit(); + _leftTextDisplay.setup(300, 8, 1); + _leftTextDisplay.setPosition(Common::Point(105, 37)); + _leftTextDisplay.animate(ANIM_MODE_2, NULL); + _leftTextDisplay._numFrames = 5; + + _quinnScreen.postInit(); + _quinnScreen.setup(301, 6, 1); + _quinnScreen.setPosition(Common::Point(274, 116)); + _quinnScreen.fixPriority(143); + _quinnScreen.animate(ANIM_MODE_2, NULL); + _quinnScreen._numFrames = 5; _quinnWorkstation1.setDetails(Rect(243, 148, 315, 167), 300, 30, 31, 32, 1, NULL); _mirandaWorkstation1.setDetails(Rect(4, 128, 69, 167), 300, 33, 31, 35, 1, NULL); @@ -5724,7 +5724,7 @@ bool Scene600::Doorway::startAction(CursorType action, Event &event) { } if ((R2_GLOBALS.getFlag(9)) && (R2_INVENTORY.getObjectScene(R2_COM_SCANNER) == 600)) - SceneItem::display(600, 31, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(600, 31, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); else { R2_GLOBALS._player.disableControl(); scene->_sceneMode = 601; @@ -5742,7 +5742,7 @@ bool Scene600::Laser::startAction(CursorType action, Event &event) { // If laser is destroyed if (R2_GLOBALS.getFlag(6)) { if (R2_GLOBALS.getFlag(8)) { - SceneItem::display(600, 29, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(600, 29, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); return true; } else { R2_GLOBALS._player.disableControl(); @@ -5758,7 +5758,7 @@ bool Scene600::Laser::startAction(CursorType action, Event &event) { break; case R2_AEROSOL: if (R2_GLOBALS.getFlag(5)) { - SceneItem::display(600, 28, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(600, 28, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); return true; } else { R2_GLOBALS._player.disableControl(); @@ -6459,7 +6459,7 @@ void Scene700::signal() { _sceneMode = 2; R2_GLOBALS._player.setStrip(4); if (R2_GLOBALS._player._position.x != 164) { - SceneItem::display(700, 36, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(700, 36, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); R2_GLOBALS._player.enableControl(); } else { R2_GLOBALS._sound2.play(19); @@ -6890,14 +6890,12 @@ void Scene800::signal() { Scene825::Button::Button(): SceneObject() { _buttonId = 0; - _v2 = 0; _buttonDown = false; } void Scene825::Button::synchronize(Serializer &s) { SceneObject::synchronize(s); s.syncAsSint16LE(_buttonId); - s.syncAsSint16LE(_v2); s.syncAsSint16LE(_buttonDown); } @@ -6931,7 +6929,6 @@ bool Scene825::Button::startAction(CursorType action, Event &event) { void Scene825::Button::setButton(int buttonId) { SceneObject::postInit(); - _v2 = buttonId; _buttonDown = 0; _sceneText._color1 = 92; _sceneText._color2 = 0; @@ -7560,11 +7557,11 @@ bool Scene900::Button::startAction(CursorType action, Event &event) { return true; break; case 8: - SceneItem::display(5, 11, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(5, 11, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); return true; break; case 9: - SceneItem::display(5, 12, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(5, 12, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); return true; break; default: @@ -7589,7 +7586,7 @@ bool Scene900::Button::startAction(CursorType action, Event &event) { } } else if (action == CURSOR_LOOK) { SceneItem::display(900, ((_buttonId == 2) && (scene->_controlsScreenNumber == 2)) ? 21 : _buttonId + 11, - SET_WIDTH, 280, SET_X, 160, SET_POS_MODE, 1, SET_Y, 20, SET_EXT_BGCOLOR, 7, -999); + SET_WIDTH, 280, SET_X, 160, SET_POS_MODE, 1, SET_Y, 20, SET_EXT_BGCOLOR, 7, LIST_END); return true; } else { return SceneActor::startAction(action, event); diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index 00c2bb3961..2013b041c7 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -210,7 +210,7 @@ public: ASoundExt _sound1; int _frameNumber; - int _helpDisabled; + bool _helpEnabled; int _frameInc; int _fontNumber, _fontHeight; public: @@ -400,8 +400,8 @@ public: QuinnWorkstation _quinnWorkstation1, _quinnWorkstation2; SeekerWorkstation _seekerWorkstation; MirandaWorkstation _mirandaWorkstation1, _mirandaWorkstation2; - SceneActor _object1, _object2, _object3, _object4, _protocolDisplay; - SceneActor _object6, _object7, _object8, _object9; + SceneActor _atmosphereLeftWindow, _atmosphereRightWindow, _leftVerticalBarsAnim, _rightVerticalBarsAnim, _protocolDisplay; + SceneActor _rightTextDisplay, _mirandaScreen, _leftTextDisplay, _quinnScreen; SceneActor _teal, _soldier, _object12; Doorway _doorway; Miranda _miranda; @@ -806,7 +806,7 @@ class Scene825: public SceneExt { /* Objects */ class Button: public SceneObject { public: - int _buttonId, _v2; + int _buttonId; bool _buttonDown; SceneText _sceneText; public: diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index e9dcb9b586..3d99ecd035 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -878,7 +878,7 @@ void Scene1100::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player._moveDiff = Common::Point(16, 2); _rightLandslide.setup2(1104, 2, 1, 175, 125, 102, 1); - _object2.setup2(1102, 5, 1, 216, 167, 1, 0); + _purplePlant.setup2(1102, 5, 1, 216, 167, 1, 0); _leftImpacts.postInit(); _leftImpacts.setup(1113, 2, 1); @@ -1852,10 +1852,10 @@ void Scene1200::process(Event &event) { if (R2_GLOBALS._scientistConvIndex >= 4) R2_GLOBALS._sceneManager.changeScene(3250); else - SceneItem::display(1200, 6, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + SceneItem::display(1200, 6, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END); break; default: - SceneItem::display(1200, 5, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + SceneItem::display(1200, 5, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END); break; } event.handled = true; @@ -1868,7 +1868,7 @@ void Scene1200::process(Event &event) { switch (cellPos.x) { case 3: // It was your cell. - SceneItem::display(1200, 8, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1200, 8, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); break; case 9: R2_GLOBALS._sceneManager.changeScene(3240); @@ -1878,7 +1878,7 @@ void Scene1200::process(Event &event) { R2_GLOBALS._sceneManager.changeScene(3210); else // A vent grill - SceneItem::display(1200, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1200, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); break; case 17: switch (cellPos.y) { @@ -1893,7 +1893,7 @@ void Scene1200::process(Event &event) { break; default: // A vent grill - SceneItem::display(1200, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1200, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); break; } break; @@ -1901,14 +1901,14 @@ void Scene1200::process(Event &event) { R2_GLOBALS._sceneManager.changeScene(3245); break; default: - SceneItem::display(1200, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1200, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); break; } } if (cellId > 36) { // "An anti-pest laser" event.handled = true; - SceneItem::display(1200, 9, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1200, 9, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); } break; case CURSOR_TALK: @@ -6906,49 +6906,49 @@ void Scene1500::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.hide(); R2_GLOBALS._player.disableControl(); - _actor2.postInit(); - _actor2.setup(1401, 1, 1); - _actor2._effect = 5; - _actor2.fixPriority(10); - _actor2._field9C = _field312; + _starshipShadow.postInit(); + _starshipShadow.setup(1401, 1, 1); + _starshipShadow._effect = 5; + _starshipShadow.fixPriority(10); + _starshipShadow._field9C = _field312; - _actor1.postInit(); - _actor1.setup(1400, 1, 1); - _actor1._moveDiff = Common::Point(1, 1); - _actor1._linkedActor = &_actor2; + _starship.postInit(); + _starship.setup(1400, 1, 1); + _starship._moveDiff = Common::Point(1, 1); + _starship._linkedActor = &_starshipShadow; if (R2_GLOBALS._sceneManager._previousScene != 1010) { - _actor4.postInit(); - _actor4.setup(1401, 2, 1); - _actor4._effect = 5; - _actor4.fixPriority(10); - _actor4._field9C = _field312; + _smallShipShadow.postInit(); + _smallShipShadow.setup(1401, 2, 1); + _smallShipShadow._effect = 5; + _smallShipShadow.fixPriority(10); + _smallShipShadow._field9C = _field312; - _actor3.postInit(); - _actor3._moveRate = 30; - _actor3._moveDiff = Common::Point(1, 1); - _actor3._linkedActor = &_actor4; + _smallShip.postInit(); + _smallShip._moveRate = 30; + _smallShip._moveDiff = Common::Point(1, 1); + _smallShip._linkedActor = &_smallShipShadow; } if (R2_GLOBALS._sceneManager._previousScene == 300) { - _actor1.setPosition(Common::Point(189, 139), 5); + _starship.setPosition(Common::Point(189, 139), 5); - _actor3.setup(1400, 1, 2); - _actor3.setPosition(Common::Point(148, 108), 0); + _smallShip.setup(1400, 1, 2); + _smallShip.setPosition(Common::Point(148, 108), 0); _sceneMode = 20; R2_GLOBALS._sound1.play(110); } else if (R2_GLOBALS._sceneManager._previousScene == 1550) { - _actor1.setPosition(Common::Point(189, 139), 5); + _starship.setPosition(Common::Point(189, 139), 5); - _actor3.setup(1400, 2, 1); - _actor3.changeZoom(-1); - _actor3.setPosition(Common::Point(298, 258), 5); + _smallShip.setup(1400, 2, 1); + _smallShip.changeZoom(-1); + _smallShip.setPosition(Common::Point(298, 258), 5); _sceneMode = 10; R2_GLOBALS._sound1.play(106); } else { - _actor1.setPosition(Common::Point(289, 239), -30); + _starship.setPosition(Common::Point(289, 239), -30); _sceneMode = 0; R2_GLOBALS._sound1.play(102); } @@ -6970,8 +6970,8 @@ void Scene1500::signal() { setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL); // No break on purpose case 1: - if (_actor1._yDiff < 50) { - _actor1.setPosition(Common::Point(289, 239), _actor1._yDiff + 1); + if (_starship._yDiff < 50) { + _starship.setPosition(Common::Point(289, 239), _starship._yDiff + 1); _sceneMode = 1; } setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL); @@ -6979,12 +6979,12 @@ void Scene1500::signal() { case 2: { Common::Point pt(189, 139); NpcMover *mover = new NpcMover(); - _actor1.addMover(mover, &pt, this); + _starship.addMover(mover, &pt, this); } break; case 3: - if (_actor1._yDiff > 5) { - _actor1.setPosition(Common::Point(189, 139), _actor1._yDiff - 1); + if (_starship._yDiff > 5) { + _starship.setPosition(Common::Point(189, 139), _starship._yDiff - 1); _sceneMode = 3; } setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL); @@ -7003,7 +7003,7 @@ void Scene1500::signal() { case 11: { Common::Point pt(148, 108); NpcMover *mover = new NpcMover(); - _actor3.addMover(mover, &pt, this); + _smallShip.addMover(mover, &pt, this); } break; case 12: @@ -7012,13 +7012,13 @@ void Scene1500::signal() { case 21: { Common::Point pt(-2, -42); NpcMover *mover = new NpcMover(); - _actor3.addMover(mover, &pt, NULL); + _smallShip.addMover(mover, &pt, NULL); signal(); } break; case 22: - if (_actor1._yDiff < 50) { - _actor1.setPosition(Common::Point(189, 139), _actor1._yDiff + 1); + if (_starship._yDiff < 50) { + _starship.setPosition(Common::Point(189, 139), _starship._yDiff + 1); _sceneMode = 22; } setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL); @@ -7026,7 +7026,7 @@ void Scene1500::signal() { case 23: { Common::Point pt(-13, -61); NpcMover *mover = new NpcMover(); - _actor1.addMover(mover, &pt, this); + _starship.addMover(mover, &pt, this); } break; case 24: @@ -7039,9 +7039,9 @@ void Scene1500::signal() { void Scene1500::dispatch() { if (_sceneMode > 10) { - float yDiff = sqrt((float) (_actor3._position.x * _actor3._position.x) + (_actor3._position.y * _actor3._position.y)); + float yDiff = sqrt((float) (_smallShip._position.x * _smallShip._position.x) + (_smallShip._position.y * _smallShip._position.y)); if (yDiff > 6) - _actor3.setPosition(_actor3._position, (int) yDiff); + _smallShip.setPosition(_smallShip._position, (int) yDiff); } Scene::dispatch(); @@ -7128,15 +7128,15 @@ void Scene1530::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player._moveRate = 30; R2_GLOBALS._player._moveDiff = Common::Point(4, 1); - _actor2.postInit(); - _actor2.setup(1516, 7, 1); - _actor2.setPosition(Common::Point(121, 41)); - _actor2.animate(ANIM_MODE_2, NULL); + _leftReactor.postInit(); + _leftReactor.setup(1516, 7, 1); + _leftReactor.setPosition(Common::Point(121, 41)); + _leftReactor.animate(ANIM_MODE_2, NULL); - _actor3.postInit(); - _actor3.setup(1516, 8, 1); - _actor3.setPosition(Common::Point(107, 116)); - _actor3.animate(ANIM_MODE_2, NULL); + _rightReactor.postInit(); + _rightReactor.setup(1516, 8, 1); + _rightReactor.setPosition(Common::Point(107, 116)); + _rightReactor.animate(ANIM_MODE_2, NULL); R2_GLOBALS._player.disableControl(); Common::Point pt(480, 75); @@ -7146,14 +7146,14 @@ void Scene1530::postInit(SceneObjectList *OwnerList) { _sceneMode = 1; } else { - _actor1.postInit(); - _actor1._effect = 1; + _seeker.postInit(); + _seeker._effect = 1; R2_GLOBALS._player.postInit(); R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); R2_GLOBALS._player.disableControl(); - setAction(&_sequenceManager, this, 1530, &R2_GLOBALS._player, &_actor1, NULL); + setAction(&_sequenceManager, this, 1530, &R2_GLOBALS._player, &_seeker, NULL); _sceneMode = 2; } @@ -7186,8 +7186,8 @@ void Scene1530::dispatch() { int16 x = R2_GLOBALS._player._position.x; int16 y = R2_GLOBALS._player._position.y; - _actor2.setPosition(Common::Point(x - 39, y - 85)); - _actor3.setPosition(Common::Point(x - 53, y - 9)); + _leftReactor.setPosition(Common::Point(x - 39, y - 85)); + _rightReactor.setPosition(Common::Point(x - 53, y - 9)); Scene::dispatch(); } @@ -7227,13 +7227,13 @@ bool Scene1550::Junk::startAction(CursorType action, Event &event) { if (_visage == 1561) { switch (_frame) { case 2: - SceneItem::display(1550, 23, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1550, 23, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); break; case 3: - SceneItem::display(1550, 26, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1550, 26, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); break; case 4: - SceneItem::display(1550, 35, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1550, 35, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); break; default: break; @@ -7241,13 +7241,13 @@ bool Scene1550::Junk::startAction(CursorType action, Event &event) { } else { switch ((((_strip - 1) * 5) + _frame) % 3) { case 0: - SceneItem::display(1550, 62, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1550, 62, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); break; case 1: - SceneItem::display(1550, 53, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1550, 53, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); break; case 2: - SceneItem::display(1550, 76, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1550, 76, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); break; default: break; @@ -7291,11 +7291,11 @@ bool Scene1550::ShipComponent::startAction(CursorType action, Event &event) { break; case CURSOR_LOOK: if (_componentId == 8) - SceneItem::display(1550, 75, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1550, 75, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); else if (_frame == 1) - SceneItem::display(1550, 70, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1550, 70, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); else - SceneItem::display(1550, 71, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1550, 71, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); return true; break; case R2_FUEL_CELL: @@ -7661,7 +7661,7 @@ bool Scene1550::Actor9::startAction(CursorType action, Event &event) { return true; break; case CURSOR_LOOK: - SceneItem::display(1550, 41, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1550, 41, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); return true; break; default: @@ -7748,7 +7748,7 @@ bool Scene1550::Actor13::startAction(CursorType action, Event &event) { scene->_sceneMode = 1564; scene->setAction(&scene->_sequenceManager1, scene, 1564, &R2_GLOBALS._player, NULL); } else - SceneItem::display(1550, 64, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1550, 64, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); return true; break; case CURSOR_LOOK: @@ -7756,9 +7756,9 @@ bool Scene1550::Actor13::startAction(CursorType action, Event &event) { return SceneActor::startAction(action, event); if (R2_INVENTORY.getObjectScene(R2_BATTERY) == 1550) { - SceneItem::display(1550, 74, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1550, 74, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); } else - SceneItem::display(1550, 64, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1550, 64, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); return true; break; default: @@ -8214,7 +8214,7 @@ void Scene1550::signal() { R2_GLOBALS._player.enableControl(); break; case 1585: - SceneItem::display(1550, 66, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1550, 66, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); R2_GLOBALS._player.enableControl(); break; case 1586: @@ -9733,16 +9733,16 @@ void Scene1580::synchronize(Serializer &s) { s.syncAsSint16LE(_field412); } -bool Scene1580::Hotspot1::startAction(CursorType action, Event &event) { +bool Scene1580::JoystickPlug::startAction(CursorType action, Event &event) { Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene; if (action == R2_JOYSTICK) { R2_INVENTORY.setObjectScene(R2_JOYSTICK, 1580); - R2_GLOBALS._sceneItems.remove(&scene->_item1); - scene->_actor2.postInit(); - scene->_actor2.setup(1580, 1, 4); - scene->_actor2.setPosition(Common::Point(159, 163)); - scene->_actor2.setDetails(1550, 78, -1, -1, 2, (SceneItem *) NULL); + R2_GLOBALS._sceneItems.remove(&scene->_joystickPlug); + scene->_joystick.postInit(); + scene->_joystick.setup(1580, 1, 4); + scene->_joystick.setPosition(Common::Point(159, 163)); + scene->_joystick.setDetails(1550, 78, -1, -1, 2, (SceneItem *) NULL); scene->_arrActor[5].remove(); @@ -9752,28 +9752,28 @@ bool Scene1580::Hotspot1::startAction(CursorType action, Event &event) { return SceneHotspot::startAction(action, event); } -bool Scene1580::Hotspot2::startAction(CursorType action, Event &event) { +bool Scene1580::ScreenSlot::startAction(CursorType action, Event &event) { Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene; if (action == R2_DIAGNOSTICS_DISPLAY) { R2_INVENTORY.setObjectScene(R2_DIAGNOSTICS_DISPLAY, 1580); R2_GLOBALS._player.disableControl(); - R2_GLOBALS._sceneItems.remove(&scene->_item2); + R2_GLOBALS._sceneItems.remove(&scene->_screenSlot); - scene->_actor3.postInit(); - scene->_actor3.setup(1580, 1, 1); - scene->_actor3.setPosition(Common::Point(124, 108)); - scene->_actor3.fixPriority(10); + scene->_screen.postInit(); + scene->_screen.setup(1580, 1, 1); + scene->_screen.setPosition(Common::Point(124, 108)); + scene->_screen.fixPriority(10); if (R2_INVENTORY.getObjectScene(R2_JOYSTICK) == 1580) - scene->_actor3.setDetails(1550, 14, -1, -1, 5, &scene->_actor2); + scene->_screen.setDetails(1550, 14, -1, -1, 5, &scene->_joystick); else - scene->_actor3.setDetails(1550, 14, -1, -1, 2, (SceneItem *)NULL); + scene->_screen.setDetails(1550, 14, -1, -1, 2, (SceneItem *)NULL); - scene->_actor1.postInit(); - scene->_actor1.setup(1580, 3, 1); - scene->_actor1.setPosition(Common::Point(124, 109)); - scene->_actor1.fixPriority(20); + scene->_screenDisplay.postInit(); + scene->_screenDisplay.setup(1580, 3, 1); + scene->_screenDisplay.setPosition(Common::Point(124, 109)); + scene->_screenDisplay.fixPriority(20); scene->_field412 = 1; scene->_sceneMode = 10; scene->setAction(&scene->_sequenceManager, scene, 1, &R2_GLOBALS._player, NULL); @@ -9784,7 +9784,7 @@ bool Scene1580::Hotspot2::startAction(CursorType action, Event &event) { return SceneHotspot::startAction(action, event); } -bool Scene1580::Actor2::startAction(CursorType action, Event &event) { +bool Scene1580::Joystick::startAction(CursorType action, Event &event) { if ( (action == CURSOR_USE) && (R2_INVENTORY.getObjectScene(R2_DIAGNOSTICS_DISPLAY) == 1580) && (R2_INVENTORY.getObjectScene(R2_FUEL_CELL) == 0) && (R2_INVENTORY.getObjectScene(R2_GUIDANCE_MODULE) == 0) && (R2_INVENTORY.getObjectScene(R2_RADAR_MECHANISM) == 0) && (R2_INVENTORY.getObjectScene(R2_GYROSCOPE) == 0) @@ -9804,13 +9804,13 @@ bool Scene1580::Actor2::startAction(CursorType action, Event &event) { return SceneActor::startAction(action, event); } -bool Scene1580::Actor3::startAction(CursorType action, Event &event) { +bool Scene1580::Screen::startAction(CursorType action, Event &event) { if ((action == CURSOR_USE) && (R2_INVENTORY.getObjectScene(R2_BROKEN_DISPLAY) == 1580)) { Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene; R2_INVENTORY.setObjectScene(R2_BROKEN_DISPLAY, R2_GLOBALS._player._characterIndex); - scene->_item2.setDetails(Rect(69, 29, 177, 108), 1550, 82, -1, -1, 2, NULL); - scene->_actor1.remove(); + scene->_screenSlot.setDetails(Rect(69, 29, 177, 108), 1550, 82, -1, -1, 2, NULL); + scene->_screenDisplay.remove(); remove(); return true; } @@ -9818,21 +9818,21 @@ bool Scene1580::Actor3::startAction(CursorType action, Event &event) { return SceneActor::startAction(action, event); } -bool Scene1580::Actor4::startAction(CursorType action, Event &event) { +bool Scene1580::StorageCompartment::startAction(CursorType action, Event &event) { if (action != CURSOR_USE) return SceneActor::startAction(action, event); Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene; R2_GLOBALS._player.disableControl(); - R2_GLOBALS._sceneItems.remove(&scene->_actor4); + R2_GLOBALS._sceneItems.remove(&scene->_storageCompartment); scene->_sceneMode = 0; animate(ANIM_MODE_5, scene); return true; } -bool Scene1580::Actor5::startAction(CursorType action, Event &event) { +bool Scene1580::HatchButton::startAction(CursorType action, Event &event) { if (action != CURSOR_USE) return SceneActor::startAction(action, event); @@ -9846,7 +9846,7 @@ bool Scene1580::Actor5::startAction(CursorType action, Event &event) { return true; } -bool Scene1580::Actor6::startAction(CursorType action, Event &event) { +bool Scene1580::ThrusterValve::startAction(CursorType action, Event &event) { Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene; switch (action) { @@ -9878,7 +9878,7 @@ bool Scene1580::Actor6::startAction(CursorType action, Event &event) { return SceneActor::startAction(action, event); } -bool Scene1580::Actor7::startAction(CursorType action, Event &event) { +bool Scene1580::Ignitor::startAction(CursorType action, Event &event) { Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene; switch (action) { @@ -9925,89 +9925,90 @@ void Scene1580::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.disableControl(); if (R2_INVENTORY.getObjectScene(R2_JOYSTICK) == 1580) { - _actor2.postInit(); - _actor2.setup(1580, 1, 4); - _actor2.setPosition(Common::Point(159, 163)); - _actor2.setDetails(1550, 78, -1, -1, 1, (SceneItem *) NULL); + _joystick.postInit(); + _joystick.setup(1580, 1, 4); + _joystick.setPosition(Common::Point(159, 163)); + _joystick.setDetails(1550, 78, -1, -1, 1, (SceneItem *) NULL); } else { - _item1.setDetails(Rect(141, 148, 179, 167), 1550, 79, -1, -1, 1, NULL); + _joystickPlug.setDetails(Rect(141, 148, 179, 167), 1550, 79, -1, -1, 1, NULL); } if (R2_INVENTORY.getObjectScene(R2_BROKEN_DISPLAY) == 1580) { - _actor3.postInit(); - _actor3.setup(1580, 1, 1); - _actor3.setPosition(Common::Point(124, 108)); - _actor3.fixPriority(10); - _actor3.setDetails(1550, 13, -1, -1, 1, (SceneItem *) NULL); - - _actor1.postInit(); - _actor1.setup(1580, 1, 3); - _actor1.setPosition(Common::Point(124, 96)); - _actor1.fixPriority(20); + _screen.postInit(); + _screen.setup(1580, 1, 1); + _screen.setPosition(Common::Point(124, 108)); + _screen.fixPriority(10); + _screen.setDetails(1550, 13, -1, -1, 1, (SceneItem *) NULL); + + _screenDisplay.postInit(); + _screenDisplay.setup(1580, 1, 3); + _screenDisplay.setPosition(Common::Point(124, 96)); + _screenDisplay.fixPriority(20); } else if (R2_INVENTORY.getObjectScene(R2_DIAGNOSTICS_DISPLAY) == 1580) { - _actor3.postInit(); - _actor3.setup(1580, 1, 1); - _actor3.setPosition(Common::Point(124, 108)); - _actor3.fixPriority(10); - _actor3.setDetails(1550, 14, -1, -1, 1, (SceneItem *) NULL); - - _actor1.postInit(); - _actor1.setup(1580, 3, 1); - _actor1.setPosition(Common::Point(124, 109)); - _actor1.fixPriority(20); + _screen.postInit(); + _screen.setup(1580, 1, 1); + _screen.setPosition(Common::Point(124, 108)); + _screen.fixPriority(10); + _screen.setDetails(1550, 14, -1, -1, 1, (SceneItem *) NULL); + + _screenDisplay.postInit(); + _screenDisplay.setup(1580, 3, 1); + _screenDisplay.setPosition(Common::Point(124, 109)); + _screenDisplay.fixPriority(20); + _screenDisplay.setZoom(200); _sceneMode = 10; } else { - _item2.setDetails(Rect(69, 29, 177, 108), 1550, 82, -1, -1, 1, NULL); + _screenSlot.setDetails(Rect(69, 29, 177, 108), 1550, 82, -1, -1, 1, NULL); } - _actor4.postInit(); + _storageCompartment.postInit(); if (R2_GLOBALS.getFlag(58) == 0) { - _actor4.setup(1580, 5, 1); - _actor4.setDetails(1550, 80, -1, -1, 1, (SceneItem *) NULL); + _storageCompartment.setup(1580, 5, 1); + _storageCompartment.setDetails(1550, 80, -1, -1, 1, (SceneItem *) NULL); } else { - _actor4.setup(1580, 5, 6); + _storageCompartment.setup(1580, 5, 6); } - _actor4.setPosition(Common::Point(216, 108)); - _actor4.fixPriority(100); + _storageCompartment.setPosition(Common::Point(216, 108)); + _storageCompartment.fixPriority(100); - _actor5.postInit(); - _actor5.setup(1580, 4, 1); - _actor5.setPosition(Common::Point(291, 147)); - _actor5.fixPriority(100); - _actor5.setDetails(1550, 81, -1, -1, 1, (SceneItem *) NULL); + _hatchButton.postInit(); + _hatchButton.setup(1580, 4, 1); + _hatchButton.setPosition(Common::Point(291, 147)); + _hatchButton.fixPriority(100); + _hatchButton.setDetails(1550, 81, -1, -1, 1, (SceneItem *) NULL); if (R2_INVENTORY.getObjectScene(R2_THRUSTER_VALVE) == 1580) { - _actor6.postInit(); - _actor6.setup(1580, 6, 2); - _actor6.setPosition(Common::Point(222, 108)); - _actor6.fixPriority(50); - _actor6.setDetails(1550, 32, -1, 34, 1, (SceneItem *) NULL); + _thrusterValve.postInit(); + _thrusterValve.setup(1580, 6, 2); + _thrusterValve.setPosition(Common::Point(222, 108)); + _thrusterValve.fixPriority(50); + _thrusterValve.setDetails(1550, 32, -1, 34, 1, (SceneItem *) NULL); } if (R2_INVENTORY.getObjectScene(R2_IGNITOR) == 1580) { - _actor7.postInit(); - _actor7.setup(1580, 6, 1); - _actor7.setPosition(Common::Point(195, 108)); - _actor7.fixPriority(50); - _actor7.setDetails(1550, 38, -1, 34, 1, (SceneItem *) NULL); + _ignitor.postInit(); + _ignitor.setup(1580, 6, 1); + _ignitor.setPosition(Common::Point(195, 108)); + _ignitor.fixPriority(50); + _ignitor.setDetails(1550, 38, -1, 34, 1, (SceneItem *) NULL); } R2_GLOBALS._player.postInit(); R2_GLOBALS._player.hide(); setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL); - _item3.setDetails(Rect(0, 0, 320, 200), 1550, 50, -1, -1, 1, NULL); + _background.setDetails(Rect(0, 0, 320, 200), 1550, 50, -1, -1, 1, NULL); } void Scene1580::signal() { switch (_sceneMode++) { case 10: - _actor1.animate(ANIM_MODE_5, this); + _screenDisplay.animate(ANIM_MODE_5, this); break; case 11: - _actor1.setup(1580, 1, 2); - _actor1.setPosition(Common::Point(124, 94)); + _screenDisplay.setup(1580, 1, 2); + _screenDisplay.setPosition(Common::Point(124, 94)); if (R2_INVENTORY.getObjectScene(R2_GYROSCOPE) != 0) { _arrActor[0].postInit(); @@ -10086,8 +10087,8 @@ bool Scene1625::Wire::startAction(CursorType action, Event &event) { R2_GLOBALS._player.disableControl(); scene->_sceneMode = 1631; - scene->_actor3.postInit(); - scene->setAction(&scene->_sequenceManager, scene, 1631, &scene->_actor3, &scene->_wire, NULL); + scene->_mirandaMouth.postInit(); + scene->setAction(&scene->_sequenceManager, scene, 1631, &scene->_mirandaMouth, &scene->_wire, NULL); return true; } @@ -10118,10 +10119,10 @@ void Scene1625::postInit(SceneObjectList *OwnerList) { _wire.setPosition(Common::Point(206, 133)); _wire.setDetails(1625, 0, -1, -1, 1, (SceneItem *) NULL); - _actor5.postInit(); - _actor5.setup(1625, 8, 1); - _actor5.setPosition(Common::Point(190, 131)); - _actor5.setDetails(1625, 6, -1, 2, 1, (SceneItem *) NULL); + _wristRestraints.postInit(); + _wristRestraints.setup(1625, 8, 1); + _wristRestraints.setPosition(Common::Point(190, 131)); + _wristRestraints.setDetails(1625, 6, -1, 2, 1, (SceneItem *) NULL); if (R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] == 1625) { if (!R2_GLOBALS.getFlag(83)) { @@ -10133,18 +10134,18 @@ void Scene1625::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.enableControl(); R2_GLOBALS._player._canWalk = false; } else { - _actor1.postInit(); - _actor1.fixPriority(10); + _teal.postInit(); + _teal.fixPriority(10); - _actor6.postInit(); + _tealRightArm.postInit(); R2_GLOBALS._player.disableControl(); _sceneMode = 1625; - setAction(&_sequenceManager, this, 1625, &_actor1, &_actor6, NULL); + setAction(&_sequenceManager, this, 1625, &_teal, &_tealRightArm, NULL); } R2_GLOBALS._sound1.play(245); - _item1.setDetails(Rect(0, 0, 320, 200), 1625, 12, -1, -1, 1, NULL); + _background.setDetails(Rect(0, 0, 320, 200), 1625, 12, -1, -1, 1, NULL); R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] = 1625; R2_GLOBALS._player._characterScene[R2_MIRANDA] = 1625; } @@ -10179,11 +10180,11 @@ void Scene1625::signal() { switch (_stripManager._exitMode) { case 1: _sceneMode = 1627; - setAction(&_sequenceManager, this, 1627, &_actor3, &_glass, NULL); + setAction(&_sequenceManager, this, 1627, &_mirandaMouth, &_glass, NULL); break; case 2: _sceneMode = 1629; - setAction(&_sequenceManager, this, 1629, &_tealHead, &_actor5, NULL); + setAction(&_sequenceManager, this, 1629, &_tealHead, &_wristRestraints, NULL); break; case 4: R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] = 3150; @@ -10194,7 +10195,7 @@ void Scene1625::signal() { case 5: _sceneMode = 1628; _tealHead.remove(); - setAction(&_sequenceManager, this, 1628, &_actor3, &_glass, NULL); + setAction(&_sequenceManager, this, 1628, &_mirandaMouth, &_glass, NULL); break; case 6: _glass.postInit(); @@ -10208,20 +10209,20 @@ void Scene1625::signal() { break; case 8: _sceneMode = 1635; - setAction(&_sequenceManager, this, 1635, &_actor3, &_actor5, NULL); + setAction(&_sequenceManager, this, 1635, &_mirandaMouth, &_wristRestraints, NULL); break; case 9: _glass.postInit(); _glass.setDetails(1625, -1, -1, -1, 2, (SceneItem *) NULL); _sceneMode = 1634; - setAction(&_sequenceManager, this, 1634, &_actor3, &_actor5, NULL); + setAction(&_sequenceManager, this, 1634, &_mirandaMouth, &_wristRestraints, NULL); break; case 3: // No break on purpose default: _sceneMode = 1630; _tealHead.remove(); - setAction(&_sequenceManager, this, 1630, &_actor1, &_actor6, NULL); + setAction(&_sequenceManager, this, 1630, &_teal, &_tealRightArm, NULL); break; } _field412 = _stripManager._field2E8; @@ -10240,18 +10241,18 @@ void Scene1625::signal() { _tealHead.setPosition(Common::Point(68, 68)); _tealHead.show(); - _actor3.postInit(); - _actor3.setup(1627, 3, 1); - _actor3.setPosition(Common::Point(196, 65)); + _mirandaMouth.postInit(); + _mirandaMouth.setup(1627, 3, 1); + _mirandaMouth.setPosition(Common::Point(196, 65)); _sceneMode = 99; R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); _stripManager.start(832, this); break; case 1627: - _actor3.setup(1627, 3, 1); - _actor3.setPosition(Common::Point(196, 65)); - _actor3.show(); + _mirandaMouth.setup(1627, 3, 1); + _mirandaMouth.setPosition(Common::Point(196, 65)); + _mirandaMouth.show(); _sceneMode = 99; R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); @@ -10263,9 +10264,9 @@ void Scene1625::signal() { _tealHead.setup(1627, 1, 1); _tealHead.setPosition(Common::Point(68, 68)); - _actor3.setup(1627, 3, 1); - _actor3.setPosition(Common::Point(196, 65)); - _actor3.show(); + _mirandaMouth.setup(1627, 3, 1); + _mirandaMouth.setPosition(Common::Point(196, 65)); + _mirandaMouth.show(); _sceneMode = 99; R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); @@ -10285,21 +10286,21 @@ void Scene1625::signal() { R2_GLOBALS._player._canWalk = true; break; case 1631: - _actor3.setup(1627, 3, 1); - _actor3.setPosition(Common::Point(196, 65)); - _actor3.show(); + _mirandaMouth.setup(1627, 3, 1); + _mirandaMouth.setPosition(Common::Point(196, 65)); + _mirandaMouth.show(); _wire.remove(); - _actor1.postInit(); - _actor1.fixPriority(10); + _teal.postInit(); + _teal.fixPriority(10); - _actor6.postInit(); + _tealRightArm.postInit(); R2_INVENTORY.setObjectScene(R2_SUPERCONDUCTOR_WIRE, 3); _sceneMode = 14; - setAction(&_sequenceManager, this, 1625, &_actor1, &_actor6, NULL); + setAction(&_sequenceManager, this, 1625, &_teal, &_tealRightArm, NULL); break; case 1632: _tealHead.setup(1627, 1, 1); @@ -10322,9 +10323,9 @@ void Scene1625::signal() { _stripManager.start(836, this); break; case 1635: - _actor3.setup(1627, 3, 1); - _actor3.setPosition(Common::Point(196, 65)); - _actor3.show(); + _mirandaMouth.setup(1627, 3, 1); + _mirandaMouth.setPosition(Common::Point(196, 65)); + _mirandaMouth.show(); _sceneMode = 99; R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); @@ -11398,7 +11399,7 @@ void Scene1800::postInit(SceneObjectList *OwnerList) { _locationMode = 0; scalePalette(65, 65, 65); - _exit1.setDetails(Rect(0, 160, 319, 168), EXITCURSOR_S, 1800); + _southExit.setDetails(Rect(0, 160, 319, 168), EXITCURSOR_S, 1800); _background.setDetails(Rect(0, 0, 320, 200), -1, -1, -1, -1, 1, NULL); _lever.postInit(); @@ -11518,29 +11519,29 @@ void Scene1800::postInit(SceneObjectList *OwnerList) { } } - _actor1.postInit(); - _actor1.fixPriority(10); + _playerShadow.postInit(); + _playerShadow.fixPriority(10); if (R2_GLOBALS._player._characterIndex == R2_QUINN) - _actor1.setVisage(1111); + _playerShadow.setVisage(1111); else - _actor1.setVisage(1110); + _playerShadow.setVisage(1110); - _actor1._effect = 5; - _actor1._field9C = _field312; + _playerShadow._effect = 5; + _playerShadow._field9C = _field312; - R2_GLOBALS._player._linkedActor = &_actor1; + R2_GLOBALS._player._linkedActor = &_playerShadow; - _actor3.postInit(); - _actor3.fixPriority(10); + _companionShadow.postInit(); + _companionShadow.fixPriority(10); if (R2_GLOBALS._player._characterIndex == R2_QUINN) - _actor3.setVisage(1110); + _companionShadow.setVisage(1110); else - _actor3.setVisage(1111); + _companionShadow.setVisage(1111); - _actor3._effect = 5; - _actor3._field9C = _field312; + _companionShadow._effect = 5; + _companionShadow._field9C = _field312; - _companion._linkedActor = &_actor3; + _companion._linkedActor = &_companionShadow; R2_GLOBALS._player._characterScene[R2_QUINN] = 1800; R2_GLOBALS._player._characterScene[R2_SEEKER] = 1800; @@ -11551,7 +11552,7 @@ void Scene1800::postInit(SceneObjectList *OwnerList) { // Original was calling _item3.setDetails(Rect(1800, 11, 24, 23), 25, -1, -1, -1, 1, NULL); // This is *wrong*. The following statement is a wild guess based on good common sense _item3.setDetails(11, 1800, 23, 24, 25); - _item4.setDetails(Rect(0, 0, 320, 200), 1800, 17, -1, 19, 1, NULL); + _secBackground.setDetails(Rect(0, 0, 320, 200), 1800, 17, -1, 19, 1, NULL); R2_GLOBALS._player.disableControl(); if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 1800) { @@ -11782,9 +11783,9 @@ bool Scene1850::Robot::startAction(CursorType action, Event &event) { break; case CURSOR_LOOK: if (R2_GLOBALS.getFlag(34)) - SceneItem::display(1850, 2, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1850, 2, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); else - SceneItem::display(1850, 1, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1850, 1, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); return true; break; @@ -11849,7 +11850,7 @@ bool Scene1850::Actor6::startAction(CursorType action, Event &event) { Scene1850 *scene = (Scene1850 *)R2_GLOBALS._sceneManager._scene; if (R2_GLOBALS.getFlag(32)) { - SceneItem::display(3240, 4, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(3240, 4, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); return true; } @@ -12838,23 +12839,23 @@ void Scene1900::postInit(SceneObjectList *OwnerList) { _rightDoor.setDetails(1900, 0, 1, -1, 1, (SceneItem *) NULL); if (R2_GLOBALS._sceneManager._previousScene != 1875) { - _object1.postInit(); - _object1.setup(1945, 6, 1); - _object1.setPosition(Common::Point(96, 109)); - _object1.fixPriority(80); + _leftDoorFrame.postInit(); + _leftDoorFrame.setup(1945, 6, 1); + _leftDoorFrame.setPosition(Common::Point(96, 109)); + _leftDoorFrame.fixPriority(80); - _object2.postInit(); - _object2.setup(1945, 6, 2); - _object2.setPosition(Common::Point(223, 109)); - _object2.fixPriority(80); + _rightDoorFrame.postInit(); + _rightDoorFrame.setup(1945, 6, 2); + _rightDoorFrame.setPosition(Common::Point(223, 109)); + _rightDoorFrame.fixPriority(80); } if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 1875) { R2_GLOBALS._player._characterIndex = R2_QUINN; - _actor1.postInit(); + _companion.postInit(); _sceneMode = 20; R2_GLOBALS._player.setAction(&_sequenceManager1, NULL, 1901, &R2_GLOBALS._player, &_leftDoor, NULL); - _actor1.setAction(&_sequenceManager2, this, 1900, &_actor1, &_rightDoor, NULL); + _companion.setAction(&_sequenceManager2, this, 1900, &_companion, &_rightDoor, NULL); } else if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 1925) { if (R2_GLOBALS.getFlag(29)) { R2_GLOBALS.clearFlag(29); @@ -12873,24 +12874,24 @@ void Scene1900::postInit(SceneObjectList *OwnerList) { } if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) { - _actor1.postInit(); - _actor1.setPosition(Common::Point(30, 110)); + _companion.postInit(); + _companion.setPosition(Common::Point(30, 110)); R2_GLOBALS._walkRegions.disableRegion(1); - _actor1.setup(2008, 3, 1); - _actor1.setDetails(9001, 0, -1, -1, 1, (SceneItem *) NULL); + _companion.setup(2008, 3, 1); + _companion.setDetails(9001, 0, -1, -1, 1, (SceneItem *) NULL); } R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 1900; } else { if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) { - _actor1.postInit(); - _actor1.setPosition(Common::Point(30, 110)); + _companion.postInit(); + _companion.setPosition(Common::Point(30, 110)); R2_GLOBALS._walkRegions.disableRegion(1); if (R2_GLOBALS._player._characterIndex == R2_QUINN) { - _actor1.setup(20, 3, 1); - _actor1.setDetails(9002, 1, -1, -1, 1, (SceneItem *) NULL); + _companion.setup(20, 3, 1); + _companion.setDetails(9002, 1, -1, -1, 1, (SceneItem *) NULL); } else { - _actor1.setup(2008, 3, 1); - _actor1.setDetails(9001, 0, -1, -1, 1, (SceneItem *) NULL); + _companion.setup(2008, 3, 1); + _companion.setDetails(9001, 0, -1, -1, 1, (SceneItem *) NULL); } } @@ -12953,7 +12954,7 @@ void Scene1900::signal() { break; case 22: _sceneMode = 1910; - _actor1.setAction(&_sequenceManager2, this, 1910, &_actor1, NULL); + _companion.setAction(&_sequenceManager2, this, 1910, &_companion, NULL); break; case 1904: R2_GLOBALS._scene1925CurrLevel = -3; @@ -12984,7 +12985,7 @@ void Scene1900::signal() { *--------------------------------------------------------------------------*/ Scene1925::Scene1925() { - _field9B8 = 0; + _newSceneMode = 0; for (int i = 0; i < 5; i++) _levelResNum[i] = 0; } @@ -12992,7 +12993,7 @@ Scene1925::Scene1925() { void Scene1925::synchronize(Serializer &s) { SceneExt::synchronize(s); - s.syncAsSint16LE(_field9B8); + s.syncAsSint16LE(_newSceneMode); for (int i = 0; i < 5; i++) s.syncAsSint16LE(_levelResNum[i]); } @@ -13014,7 +13015,8 @@ bool Scene1925::Button::startAction(CursorType action, Event &event) { scene->_sceneMode = 1930; R2_GLOBALS._player.disableControl(CURSOR_WALK); - scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, NULL); + scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, + &scene->_door, NULL); return true; } @@ -13028,9 +13030,10 @@ bool Scene1925::Ladder::startAction(CursorType action, Event &event) { scene->_sceneMode = 0; if ((R2_GLOBALS._player._position.x == 110) && (R2_GLOBALS._player._position.y == 100)) { - scene->_exit3._enabled = false; + scene->_westExit._enabled = false; scene->_sceneMode = 1925; - scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, NULL); + scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, + &R2_GLOBALS._player, &scene->_door, NULL); return true; } @@ -13065,10 +13068,11 @@ void Scene1925::ExitUp::changeScene() { scene->_sceneMode = 0; if ((R2_GLOBALS._player._position.x == 110) && (R2_GLOBALS._player._position.y == 100)) { - scene->_exit3._enabled = false; - scene->_field9B8 = 1927; + scene->_westExit._enabled = false; + scene->_newSceneMode = 1927; scene->_sceneMode = 1925; - scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, NULL); + scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, + &R2_GLOBALS._player, &scene->_door, NULL); return; } @@ -13087,7 +13091,7 @@ void Scene1925::ExitUp::changeScene() { } } -void Scene1925::Exit2::changeScene() { +void Scene1925::ExitDown::changeScene() { Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene; _moving = false; @@ -13095,10 +13099,11 @@ void Scene1925::Exit2::changeScene() { scene->_sceneMode = 0; if ((R2_GLOBALS._player._position.x == 110) && (R2_GLOBALS._player._position.y == 100)) { - scene->_exit3._enabled = false; - scene->_field9B8 = 1926; + scene->_westExit._enabled = false; + scene->_newSceneMode = 1926; scene->_sceneMode = 1925; - scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, NULL); + scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, + &R2_GLOBALS._player, &scene->_door, NULL); return; } @@ -13116,7 +13121,7 @@ void Scene1925::Exit2::changeScene() { scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL); } -void Scene1925::Exit3::changeScene() { +void Scene1925::WestExit::changeScene() { Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene; _moving = false; @@ -13125,7 +13130,7 @@ void Scene1925::Exit3::changeScene() { scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL); } -void Scene1925::Exit4::changeScene() { +void Scene1925::EastExit::changeScene() { Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene; _moving = false; @@ -13156,8 +13161,8 @@ void Scene1925::changeLevel(bool upFlag) { case 3: loadScene(_levelResNum[4]); _button.setDetails(Rect(133, 68, 140, 77), 1925, 3, -1, 5, 2, NULL); - _actor1.setDetails(1925, 0, 1, 2, 2, (SceneItem *) NULL); - _actor1.show(); + _door.setDetails(1925, 0, 1, 2, 2, (SceneItem *) NULL); + _door.show(); break; case 512: R2_GLOBALS._scene1925CurrLevel = 508; @@ -13165,8 +13170,8 @@ void Scene1925::changeLevel(bool upFlag) { default: loadScene(_levelResNum[(R2_GLOBALS._scene1925CurrLevel % 4)]); R2_GLOBALS._sceneItems.remove(&_button); - R2_GLOBALS._sceneItems.remove(&_actor1); - _actor1.hide(); + R2_GLOBALS._sceneItems.remove(&_door); + _door.hide(); break; } @@ -13196,32 +13201,33 @@ void Scene1925::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.disableControl(); R2_GLOBALS._player._characterScene[R2_SEEKER] = 1925; R2_GLOBALS._player._characterIndex = R2_SEEKER; + switch (R2_GLOBALS._scene1925CurrLevel) { case -2: - _exit4.setDetails(Rect(203, 44, 247, 111), EXITCURSOR_E, 1925); + _eastExit.setDetails(Rect(203, 44, 247, 111), EXITCURSOR_E, 1925); _ladder.setDetails(Rect(31, 3, 45, 167), 1925, 6, -1, 8, 1, NULL); break; case 3: - _actor1.setDetails(1925, 0, 1, 2, 1, (SceneItem *) NULL); + _door.setDetails(1925, 0, 1, 2, 1, (SceneItem *) NULL); _button.setDetails(Rect(133, 68, 140, 77), 1925, 3, -1, 5, 1, NULL); // No break on purpose case -3: - _exit3.setDetails(Rect(83, 38, 128, 101), EXITCURSOR_W, 1925); + _westExit.setDetails(Rect(83, 38, 128, 101), EXITCURSOR_W, 1925); // No break on purpose default: _exitUp.setDetails(Rect(128, 0, 186, 10), EXITCURSOR_N, 1925); - _exit2.setDetails(Rect(128, 160, 190, 167), EXITCURSOR_S, 1925); + _exitDown.setDetails(Rect(128, 160, 190, 167), EXITCURSOR_S, 1925); _ladder.setDetails(Rect(141, 11, 167, 159), 1925, 6, -1, -1, 1, NULL); break; } - _actor1.postInit(); - _actor1.setup(1925, 5, 1); - _actor1.setPosition(Common::Point(128, 35)); - _actor1.hide(); + _door.postInit(); + _door.setup(1925, 5, 1); + _door.setPosition(Common::Point(128, 35)); + _door.hide(); if (R2_GLOBALS._scene1925CurrLevel == 3) - _actor1.show(); + _door.show(); R2_GLOBALS._player.enableControl(CURSOR_USE); switch (R2_GLOBALS._scene1925CurrLevel) { @@ -13231,7 +13237,7 @@ void Scene1925::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.setPosition(Common::Point(224, 109)); break; case -3: - _actor1.hide(); + _door.hide(); R2_GLOBALS._player.setup(20, 5, 1); R2_GLOBALS._player.setPosition(Common::Point(110, 100)); break; @@ -13246,9 +13252,9 @@ void Scene1925::postInit(SceneObjectList *OwnerList) { } R2_GLOBALS._player._canWalk = false; - _field9B8 = 0; + _newSceneMode = 0; R2_GLOBALS._sceneManager._previousScene = 1925; - _item1.setDetails(Rect(27, 0, 292, 200), 1925, 9, -1, -1, 1, NULL); + _background.setDetails(Rect(27, 0, 292, 200), 1925, 9, -1, -1, 1, NULL); } void Scene1925::remove() { @@ -13284,10 +13290,10 @@ void Scene1925::signal() { changeLevel(true); break; case 1925: - _exit3._enabled = false; - if (_field9B8 != 0) { - _sceneMode = _field9B8; - _field9B8 = 0; + _westExit._enabled = false; + if (_newSceneMode != 0) { + _sceneMode = _newSceneMode; + _newSceneMode = 0; setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL); } // No break on purpose @@ -13482,14 +13488,14 @@ void Scene1945::postInit(SceneObjectList *OwnerList) { else _gunpowder.hide(); - _actor1.postInit(); - _actor1.setup(1945, 8, 1); - _actor1.setPosition(Common::Point(253, 169)); - _actor1.fixPriority(130); + _coveringIce.postInit(); + _coveringIce.setup(1945, 8, 1); + _coveringIce.setPosition(Common::Point(253, 169)); + _coveringIce.fixPriority(130); - _actor2.postInit(); - _actor2.setup(1945, 3, 1); - _actor2.hide(); + _alcoholLamp.postInit(); + _alcoholLamp.setup(1945, 3, 1); + _alcoholLamp.hide(); } else { _corridorExit._enabled = true; } @@ -13518,8 +13524,8 @@ void Scene1945::postInit(SceneObjectList *OwnerList) { _nextSceneMode2 = 0; _ice.setDetails(11, 1945, 3, -1, 5); - _item1.setDetails(Rect(238, 144, 274, 167), 1945, 0, -1, 2, 1, NULL); - _item2.setDetails(Rect(27, 3, 292, 167), 1945, 3, -1, -1, 1, NULL); + _hole.setDetails(Rect(238, 144, 274, 167), 1945, 0, -1, 2, 1, NULL); + _ice2.setDetails(Rect(27, 3, 292, 167), 1945, 3, -1, -1, 1, NULL); } void Scene1945::remove() { @@ -13532,7 +13538,7 @@ void Scene1945::signal() { case 1940: if (_nextSceneMode1 == 1943) { _sceneMode = _nextSceneMode1; - setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, &_actor2, NULL); + setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, &_alcoholLamp, NULL); } else { _sceneMode = 1946; setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, NULL); @@ -13559,7 +13565,7 @@ void Scene1945::signal() { R2_GLOBALS._sound1.fadeOut2(NULL); R2_INVENTORY.setObjectScene(_lampUsed, 0); _sceneMode = 1948; - setAction(&_sequenceManager1, this, _sceneMode, &_gunpowder, &_actor2, &_actor1, NULL); + setAction(&_sequenceManager1, this, _sceneMode, &_gunpowder, &_alcoholLamp, &_coveringIce, NULL); R2_GLOBALS._player.setAction(&_sequenceManager2, NULL, 1941, &R2_GLOBALS._player, NULL); return; case 1944: @@ -13579,7 +13585,7 @@ void Scene1945::signal() { if (_nextSceneMode1 == 1943) { _sceneMode = _nextSceneMode1; _nextSceneMode1 = 1948; - setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, &_actor2, NULL); + setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, &_alcoholLamp, NULL); } else { _sceneMode = 1941; setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, NULL); @@ -13598,7 +13604,7 @@ void Scene1945::signal() { if (_nextSceneMode2 == 1943) { _nextSceneMode1 = _nextSceneMode2; _nextSceneMode2 = 0; - setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, &_actor2, NULL); + setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, &_alcoholLamp, NULL); } else { _nextSceneMode1 = 0; setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, NULL); @@ -13827,7 +13833,7 @@ void Scene1950::Vampire::signal() { setStrip(1); NpcMover *mover = new NpcMover(); - addMover(mover, &scene->_field418, scene); + addMover(mover, &scene->_vampireDestPos, scene); } break; case 20: { @@ -13914,14 +13920,14 @@ void Scene1950::Vampire::signal() { else scene->_westExit._enabled = true; - scene->_field416 = 0; + scene->_vampireActive = false; break; case 22: - SceneItem::display(1950, 18, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1950, 18, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); R2_GLOBALS._player.enableControl(CURSOR_WALK); break; case 23: - SceneItem::display(1950, 25, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1950, 25, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); scene->_sceneMode = R2_GLOBALS._flubMazeEntryDirection; scene->setAction(&scene->_sequenceManager, scene, 1960, &R2_GLOBALS._player, NULL); break; @@ -13978,7 +13984,7 @@ void Scene1950::UpExit::changeScene() { R2_GLOBALS._flubMazeEntryDirection = 2; scene->_sceneMode = 12; - if (scene->_field412 == 0) { + if (!scene->_upExitStyle) { if (R2_GLOBALS.getFlag(36)) scene->setAction(&scene->_sequenceManager, scene, 1953, &R2_GLOBALS._player, NULL); else @@ -13999,7 +14005,7 @@ void Scene1950::EastExit::changeScene() { R2_GLOBALS._flubMazeEntryDirection = 3; scene->_sceneMode = 13; - if (scene->_field416 != 0) + if (scene->_vampireActive) R2_GLOBALS._player.animate(ANIM_MODE_9); Common::Point pt(340, 160); @@ -14050,16 +14056,16 @@ void Scene1950::WestExit::changeScene() { R2_GLOBALS._player.addMover(mover, &pt, scene); } else { if (!R2_GLOBALS.getFlag(36)) - SceneItem::display(1950, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1950, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); if ((R2_INVENTORY.getObjectScene(R2_SAPPHIRE_BLUE) == 1950) || (R2_INVENTORY.getObjectScene(R2_ANCIENT_SCROLLS) == 1950)) - SceneItem::display(1950, 34, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1950, 34, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); scene->_sceneMode = 0; Common::Point pt(30, 160); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, scene); } } else { - if (scene->_field416 != 0) + if (scene->_vampireActive) R2_GLOBALS._player.animate(ANIM_MODE_9); scene->_sceneMode = 16; @@ -14089,7 +14095,7 @@ void Scene1950::DoorExit::changeScene() { scene->_sceneMode = 1975; scene->setAction(&scene->_sequenceManager, scene, 1975, &R2_GLOBALS._player, NULL); } else { - SceneItem::display(1950, 22, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1950, 22, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); R2_GLOBALS._flubMazeEntryDirection = 0; scene->_sceneMode = 0; Common::Point pt(250, 150); @@ -14102,21 +14108,21 @@ void Scene1950::DoorExit::changeScene() { /*--------------------------------------------------------------------------*/ Scene1950::Scene1950() { - _field412 = 0; - _field414 = 0; - _field416 = 0; - _field418 = Common::Point(0, 0); + _upExitStyle = false; + _removeFlag = false; + _vampireActive = false; + _vampireDestPos = Common::Point(0, 0); _vampireIndex = 0; } void Scene1950::synchronize(Serializer &s) { SceneExt::synchronize(s); - s.syncAsSint16LE(_field412); - s.syncAsSint16LE(_field414); - s.syncAsSint16LE(_field416); - s.syncAsSint16LE(_field418.x); - s.syncAsSint16LE(_field418.y); + s.syncAsSint16LE(_upExitStyle); + s.syncAsSint16LE(_removeFlag); + s.syncAsSint16LE(_vampireActive); + s.syncAsSint16LE(_vampireDestPos.x); + s.syncAsSint16LE(_vampireDestPos.y); s.syncAsSint16LE(_vampireIndex); } @@ -14145,7 +14151,7 @@ void Scene1950::initArea() { _westExit._moving = false; _shaftExit._moving = false; _doorExit._moving = false; - _field412 = 0; + _upExitStyle = false; switch (R2_GLOBALS._flubMazeArea - 1) { case 0: @@ -14372,7 +14378,7 @@ void Scene1950::initArea() { // No break on purpose case 67: loadScene(1985); - _field412 = 1; + _upExitStyle = true; break; default: break; @@ -14819,7 +14825,7 @@ void Scene1950::enterArea() { _door.remove(); _scrolls.remove(); - _field416 = 0; + _vampireActive = false; _vampireIndex = 0; // Certain areas have a vampire in them @@ -14905,7 +14911,7 @@ void Scene1950::enterArea() { _vampire.setPosition(Common::Point(160, 130)); _vampire.animate(ANIM_MODE_2, NULL); _vampire.setDetails(1950, 12, -1, 14, 2, (SceneItem *) NULL); - _field416 = 1; + _vampireActive = true; } } if ((R2_GLOBALS._flubMazeArea == 1) && (R2_INVENTORY.getObjectScene(R2_SCRITH_KEY) != 0)) { @@ -14935,13 +14941,13 @@ void Scene1950::enterArea() { _cube.setPosition(Common::Point(193, 158)); _cube.setDetails(1950, 3, 4, 5, 2, (SceneItem *) NULL); - _actor7.postInit(); - _actor7.setVisage(1970); - _actor7.setStrip(3); - _actor7.animate(ANIM_MODE_2, NULL); - _actor7._numFrames = 6; - _actor7.setPosition(Common::Point(194, 158)); - _actor7.fixPriority(159); + _pulsingLights.postInit(); + _pulsingLights.setVisage(1970); + _pulsingLights.setStrip(3); + _pulsingLights.animate(ANIM_MODE_2, NULL); + _pulsingLights._numFrames = 6; + _pulsingLights.setPosition(Common::Point(194, 158)); + _pulsingLights.fixPriority(159); _keypad.setDetails(Rect(188, 124, 199, 133), 1950, 27, 28, -1, 2, NULL); @@ -14981,12 +14987,12 @@ void Scene1950::enterArea() { else _scrolls.setFrame(1); - _field414 = 1; - } else if (_field414 != 0) { + _removeFlag = true; + } else if (_removeFlag) { _cube.remove(); _containmentField.remove(); _gem.remove(); - _actor7.remove(); + _pulsingLights.remove(); _scrolls.remove(); R2_GLOBALS._sceneItems.remove(&_background); @@ -15019,7 +15025,7 @@ void Scene1950::enterArea() { break; case 3: // Entering from the left - if (_field416 == 0) { + if (!_vampireActive) { _sceneMode = R2_GLOBALS._flubMazeEntryDirection; R2_GLOBALS._player.setPosition(Common::Point(-20, 160)); Common::Point pt(30, 160); @@ -15028,13 +15034,13 @@ void Scene1950::enterArea() { } else { _sceneMode = 18; _eastExit._enabled = false; - _field418 = Common::Point(60, 152); + _vampireDestPos = Common::Point(60, 152); R2_GLOBALS._player.enableControl(CURSOR_USE); R2_GLOBALS._player._canWalk = false; _vampire.setStrip(2); NpcMover *mover = new NpcMover(); - _vampire.addMover(mover, &_field418, this); + _vampire.addMover(mover, &_vampireDestPos, this); R2_GLOBALS._player.setPosition(Common::Point(-20, 160)); Common::Point pt2(30, 160); @@ -15044,7 +15050,7 @@ void Scene1950::enterArea() { break; case 4: _sceneMode = R2_GLOBALS._flubMazeEntryDirection; - if (_field412 == 0) { + if (!_upExitStyle) { if (R2_GLOBALS.getFlag(36)) setAction(&_sequenceManager, this, 1955, &R2_GLOBALS._player, NULL); else @@ -15066,7 +15072,7 @@ void Scene1950::enterArea() { break; case 6: // Entering from the right - if (_field416 == 0) { + if (!_vampireActive) { _sceneMode = R2_GLOBALS._flubMazeEntryDirection; if (R2_GLOBALS._flubMazeArea == 1) { setAction(&_sequenceManager, this, 1961, &R2_GLOBALS._player, NULL); @@ -15079,14 +15085,14 @@ void Scene1950::enterArea() { } else { _sceneMode = 17; _westExit._enabled = false; - _field418 = Common::Point(259, 152); + _vampireDestPos = Common::Point(259, 152); R2_GLOBALS._player.enableControl(CURSOR_USE); R2_GLOBALS._player._canWalk = false; _vampire.setStrip(1); NpcMover *mover = new NpcMover(); - _vampire.addMover(mover, &_field418, this); + _vampire.addMover(mover, &_vampireDestPos, this); R2_GLOBALS._player.setPosition(Common::Point(340, 160)); Common::Point pt2(289, 160); @@ -15181,9 +15187,9 @@ void Scene1950::doButtonPress(int indx) { } void Scene1950::postInit(SceneObjectList *OwnerList) { - _field412 = 0; - _field414 = 0; - _field416 = 0; + _upExitStyle = false; + _removeFlag = false; + _vampireActive = false; _vampireIndex = 0; if (R2_GLOBALS._sceneManager._previousScene == 300) R2_GLOBALS._flubMazeArea = 103; @@ -15280,7 +15286,7 @@ void Scene1950::signal() { case 17: { _sceneMode = 13; R2_GLOBALS._flubMazeEntryDirection = 3; - _field416 = 0; + _vampireActive = false; R2_GLOBALS._player.disableControl(CURSOR_WALK); R2_GLOBALS._player._canWalk = true; R2_GLOBALS._player.setVisage(22); @@ -15296,7 +15302,7 @@ void Scene1950::signal() { case 18: { _sceneMode = 16; R2_GLOBALS._flubMazeEntryDirection = 6; - _field416 = 0; + _vampireActive = false; R2_GLOBALS._player.disableControl(CURSOR_WALK); R2_GLOBALS._player._canWalk = true; R2_GLOBALS._player.setVisage(22); @@ -15320,7 +15326,7 @@ void Scene1950::signal() { R2_GLOBALS._sceneManager.changeScene(1945); break; case 1958: - SceneItem::display(1950, 24, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1950, 24, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); R2_GLOBALS._player.enableControl(CURSOR_WALK); _doorExit._enabled = true; break; @@ -15339,7 +15345,7 @@ void Scene1950::signal() { // No break on purpose case 1965: if (!R2_GLOBALS.getFlag(37)) { - SceneItem::display(1950, 26, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1950, 26, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); } R2_GLOBALS._player.enableControl(); break; diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index 5825320a2c..a663fbe5bc 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -117,7 +117,7 @@ public: SceneActor _runningGuy2; SceneActor _runningGuy3; BackgroundSceneObject _rightLandslide; - BackgroundSceneObject _object2; + BackgroundSceneObject _purplePlant; Seeker _seeker; Trooper _trooper; Chief _chief; @@ -386,10 +386,10 @@ public: class Scene1500 : public SceneExt { public: - SceneActor _actor1; - SceneActor _actor2; - SceneActor _actor3; - SceneActor _actor4; + SceneActor _starship; + SceneActor _starshipShadow; + SceneActor _smallShip; + SceneActor _smallShipShadow; SequenceManager _sequenceManager; virtual void postInit(SceneObjectList *OwnerList = NULL); @@ -410,9 +410,9 @@ class Scene1530 : public SceneExt { public: SpeakerQuinn _quinnSpeaker; SpeakerSeeker _seekerSpeaker; - SceneActor _actor1; - SceneActor _actor2; - SceneActor _actor3; + SceneActor _seeker; + SceneActor _leftReactor; + SceneActor _rightReactor; SequenceManager _sequenceManager; @@ -629,54 +629,55 @@ public: }; class Scene1580 : public SceneExt { - class Hotspot1 : public NamedHotspot { + class JoystickPlug : public NamedHotspot { public: virtual bool startAction(CursorType action, Event &event); }; - class Hotspot2 : public NamedHotspot { + class ScreenSlot : public NamedHotspot { public: virtual bool startAction(CursorType action, Event &event); }; - class Actor2 : public SceneActor { + class Joystick : public SceneActor { public: virtual bool startAction(CursorType action, Event &event); }; - class Actor3 : public SceneActor { + class Screen : public SceneActor { public: virtual bool startAction(CursorType action, Event &event); }; - class Actor4 : public SceneActor { + class StorageCompartment : public SceneActor { public: virtual bool startAction(CursorType action, Event &event); }; - class Actor5 : public SceneActor { + class HatchButton : public SceneActor { public: virtual bool startAction(CursorType action, Event &event); }; - class Actor6 : public SceneActor { + class ThrusterValve : public SceneActor { public: virtual bool startAction(CursorType action, Event &event); }; - class Actor7 : public SceneActor { + class Ignitor : public SceneActor { public: virtual bool startAction(CursorType action, Event &event); }; public: + //CHECKME: Useless variable? int _field412; SpeakerQuinn _quinnSpeaker; SpeakerSeeker _seekerSpeaker; - Hotspot1 _item1; - Hotspot2 _item2; - NamedHotspot _item3; - SceneActor _actor1; + JoystickPlug _joystickPlug; + ScreenSlot _screenSlot; + NamedHotspot _background; + SceneActor _screenDisplay; SceneActor _arrActor[8]; - Actor2 _actor2; - Actor3 _actor3; - Actor4 _actor4; - Actor5 _actor5; - Actor6 _actor6; - Actor7 _actor7; + Joystick _joystick; + Screen _screen; + StorageCompartment _storageCompartment; + HatchButton _hatchButton; + ThrusterValve _thrusterValve; + Ignitor _ignitor; SequenceManager _sequenceManager; Scene1580(); @@ -692,17 +693,18 @@ class Scene1625 : public SceneExt { virtual bool startAction(CursorType action, Event &event); }; public: + //CHECKME: Useless variable int _field412; SpeakerMiranda1625 _mirandaSpeaker; SpeakerTeal1625 _tealSpeaker; SpeakerSoldier1625 _soldierSpeaker; - NamedHotspot _item1; - SceneActor _actor1; + NamedHotspot _background; + SceneActor _teal; SceneActor _tealHead; - SceneActor _actor3; + SceneActor _mirandaMouth; SceneActor _glass; - SceneActor _actor5; - SceneActor _actor6; + SceneActor _wristRestraints; + SceneActor _tealRightArm; Wire _wire; SequenceManager _sequenceManager; @@ -870,18 +872,18 @@ public: NamedHotspot _item1; NamedHotspot _item2; NamedHotspot _item3; - NamedHotspot _item4; + NamedHotspot _secBackground; Background _background; - SceneActor _actor1; + SceneActor _playerShadow; SceneActor _companion; - SceneActor _actor3; + SceneActor _companionShadow; SceneActor _leftStaircase; SceneActor _rightStaircase; Lever _lever; Doors _doors; PassengerDoor _leftDoor; PassengerDoor _rightDoor; - Exit1 _exit1; + Exit1 _southExit; SequenceManager _sequenceManager; Scene1800(); @@ -996,9 +998,9 @@ public: SpeakerSeeker1900 _seekerSpeaker; NamedHotspot _background; NamedHotspot _elevator; - SceneActor _actor1; - BackgroundSceneObject _object1; - BackgroundSceneObject _object2; + SceneActor _companion; + BackgroundSceneObject _leftDoorFrame; + BackgroundSceneObject _rightDoorFrame; LiftDoor _leftDoor, _rightDoor; WestExit _westExit; EastExit _eastExit; @@ -1024,30 +1026,30 @@ class Scene1925 : public SceneExt { public: virtual void changeScene(); }; - class Exit2 : public SceneExit { + class ExitDown : public SceneExit { public: virtual void changeScene(); }; - class Exit3 : public SceneExit { + class WestExit : public SceneExit { public: virtual void changeScene(); }; - class Exit4 : public SceneExit { + class EastExit : public SceneExit { public: virtual void changeScene(); }; public: - NamedHotspot _item1; + NamedHotspot _background; Button _button; Ladder _ladder; - SceneActor _actor1; + SceneActor _door; ExitUp _exitUp; - Exit2 _exit2; - Exit3 _exit3; - Exit4 _exit4; + ExitDown _exitDown; + WestExit _westExit; + EastExit _eastExit; SequenceManager _sequenceManager; - int _field9B8; + int _newSceneMode; int _levelResNum[5]; Scene1925(); @@ -1083,12 +1085,12 @@ class Scene1945 : public SceneExt { virtual void changeScene(); }; public: - NamedHotspot _item1; - NamedHotspot _item2; + NamedHotspot _hole; + NamedHotspot _ice2; Ice _ice; Ladder _ladder; - SceneActor _actor1; - SceneActor _actor2; + SceneActor _coveringIce; + SceneActor _alcoholLamp; Gunpowder _gunpowder; ExitUp _exitUp; CorridorExit _corridorExit; @@ -1223,7 +1225,7 @@ public: SceneActor _containmentField; Gem _gem; SceneActor _cube; - SceneActor _actor7; + SceneActor _pulsingLights; Vampire _vampire; KeypadWindow _KeypadWindow; NorthExit _northExit; @@ -1236,10 +1238,10 @@ public: DoorExit _doorExit; SequenceManager _sequenceManager; - int _field412; - int _field414; - int _field416; - Common::Point _field418; + bool _upExitStyle; + bool _removeFlag; + bool _vampireActive; + Common::Point _vampireDestPos; int _vampireIndex; Scene1950(); diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp index 7c04d190d1..42df9d6a6a 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp @@ -132,25 +132,28 @@ void Scene2000::initPlayer() { } for (int i = 0; i < 11; i++) { if (R2_GLOBALS._spillLocation[R2_GLOBALS._player._characterIndex] == R2_GLOBALS._spillLocation[3 + i]) - _objList1[i].show(); + _persons[i].show(); } - if ((R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) && (R2_GLOBALS._spillLocation[R2_QUINN] == R2_GLOBALS._spillLocation[R2_SEEKER])) { - _object1.postInit(); + if ((R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) + && (R2_GLOBALS._spillLocation[R2_QUINN] == R2_GLOBALS._spillLocation[R2_SEEKER])) { + _companion.postInit(); if (R2_GLOBALS._player._characterIndex == R2_QUINN) { - _object1.setup(20, 5, 1); - _object1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); + // Seeker is in room with Quinn + _companion.setup(20, 5, 1); + _companion.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); } else { - _object1.setup(2008, 5, 1); - _object1.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL); + // Quinn is in room with Seeker + _companion.setup(2008, 5, 1); + _companion.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL); } if (_westExit._enabled) { if (_eastExit._enabled) - _object1.setPosition(Common::Point(180, 128)); + _companion.setPosition(Common::Point(180, 128)); else - _object1.setPosition(Common::Point(75, 128)); + _companion.setPosition(Common::Point(75, 128)); } else - _object1.setPosition(Common::Point(300, 128)); + _companion.setPosition(Common::Point(300, 128)); } } @@ -174,9 +177,9 @@ void Scene2000::initExits() { _doorExit._moving = false; for (int i = 0; i < 11; i++) - _objList1[i].hide(); + _persons[i].hide(); - _object1.remove(); + _companion.remove(); switch (R2_GLOBALS._spillLocation[R2_GLOBALS._player._characterIndex]) { case 3: @@ -393,11 +396,11 @@ void Scene2000::Action1::signal() { _actionIndex = 1; Common::Point pt(-20, 127); NpcMover *mover = new NpcMover(); - scene->_objList1[_state].addMover(mover, &pt, scene); + scene->_persons[_state].addMover(mover, &pt, scene); break; } case 1: - scene->_objList1[_state].setPosition(Common::Point(340, 127)); + scene->_persons[_state].setPosition(Common::Point(340, 127)); --R2_GLOBALS._spillLocation[4 + _state]; _actionIndex = 0; switch (_state - 1) { @@ -426,9 +429,9 @@ void Scene2000::Action1::signal() { } if (R2_GLOBALS._spillLocation[3 + _state] == R2_GLOBALS._spillLocation[R2_GLOBALS._player._characterIndex]) - scene->_objList1[_state].show(); + scene->_persons[_state].show(); else - scene->_objList1[_state].hide(); + scene->_persons[_state].hide(); signal(); break; @@ -436,11 +439,11 @@ void Scene2000::Action1::signal() { _actionIndex = 6; Common::Point pt(340, 127); NpcMover *mover = new NpcMover(); - scene->_objList1[_state].addMover(mover, &pt, this); + scene->_persons[_state].addMover(mover, &pt, this); break; } case 6: - scene->_objList1[_state].setPosition(Common::Point(-20, 127)); + scene->_persons[_state].setPosition(Common::Point(-20, 127)); ++R2_GLOBALS._spillLocation[3 + _state]; _actionIndex = 5; switch (_state - 1) { @@ -469,33 +472,33 @@ void Scene2000::Action1::signal() { } if (R2_GLOBALS._spillLocation[3 + _state] == R2_GLOBALS._spillLocation[R2_GLOBALS._player._characterIndex]) - scene->_objList1[_state].show(); + scene->_persons[_state].show(); else - scene->_objList1[_state].hide(); + scene->_persons[_state].hide(); signal(); break; case 10: { Common::Point pt(290, 127); NpcMover *mover = new NpcMover(); - scene->_objList1[_state].addMover(mover, &pt, this); + scene->_persons[_state].addMover(mover, &pt, this); _actionIndex = 11; break; } case 11: if (_state == 1) - scene->_objList1[0].setStrip(1); + scene->_persons[0].setStrip(1); else if (_state == 5) - scene->_objList1[4].setStrip(1); + scene->_persons[4].setStrip(1); setDelay(600); _actionIndex = 12; break; case 12: if (_state == 1) - scene->_objList1[0].setStrip(2); + scene->_persons[0].setStrip(2); else if (_state == 5) - scene->_objList1[4].setStrip(2); - scene->_objList1[_state].setStrip(1); + scene->_persons[4].setStrip(2); + scene->_persons[_state].setStrip(1); _actionIndex = 5; signal(); break; @@ -503,29 +506,29 @@ void Scene2000::Action1::signal() { if ((R2_GLOBALS._spillLocation[3 + _state] == 13) || (R2_GLOBALS._spillLocation[3 + _state] == 22) || (R2_GLOBALS._spillLocation[3 + _state] == 27)) { Common::Point pt(30, 127); NpcMover *mover = new NpcMover(); - scene->_objList1[_state].addMover(mover, &pt, this); + scene->_persons[_state].addMover(mover, &pt, this); _actionIndex = 16; } else { Common::Point pt(120, 127); NpcMover *mover = new NpcMover(); - scene->_objList1[_state].addMover(mover, &pt, this); + scene->_persons[_state].addMover(mover, &pt, this); _actionIndex = 16; } break; case 16: if (_state == 1) - scene->_objList1[2].setStrip(2); + scene->_persons[2].setStrip(2); else if (_state == 8) - scene->_objList1[9].setStrip(2); + scene->_persons[9].setStrip(2); setDelay(600); _actionIndex = 17; break; case 17: if (_state == 1) - scene->_objList1[2].setStrip(1); + scene->_persons[2].setStrip(1); else if (_state == 8) - scene->_objList1[9].setStrip(1); - scene->_objList1[_state].setStrip(2); + scene->_persons[9].setStrip(1); + scene->_persons[_state].setStrip(2); _actionIndex = 0; break; case 99: @@ -806,57 +809,57 @@ void Scene2000::postInit(SceneObjectList *OwnerList) { _action5._state = 3; for (int i = 0; i < 11; i++) - _objList1[i].postInit(); + _persons[i].postInit(); - _objList1[0].setVisage(2000); - _objList1[0].setStrip(2); - _objList1[0].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL); + _persons[0].setVisage(2000); + _persons[0].setStrip(2); + _persons[0].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL); - _objList1[1].setVisage(2001); - _objList1[1].setStrip(2); - _objList1[1].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL); + _persons[1].setVisage(2001); + _persons[1].setStrip(2); + _persons[1].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL); - _objList1[2].setVisage(2003); - _objList1[2].setStrip(1); - _objList1[2].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL); + _persons[2].setVisage(2003); + _persons[2].setStrip(1); + _persons[2].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL); - _objList1[3].setVisage(2007); - _objList1[3].setStrip(2); - _objList1[3].setDetails(2001, 12, -1, -1, 1, (SceneItem *)NULL); + _persons[3].setVisage(2007); + _persons[3].setStrip(2); + _persons[3].setDetails(2001, 12, -1, -1, 1, (SceneItem *)NULL); - _objList1[4].setVisage(2004); - _objList1[4].setStrip(2); - _objList1[4].setDetails(2001, 19, -1, -1, 1, (SceneItem *)NULL); + _persons[4].setVisage(2004); + _persons[4].setStrip(2); + _persons[4].setDetails(2001, 19, -1, -1, 1, (SceneItem *)NULL); - _objList1[5].setVisage(2003); - _objList1[5].setStrip(2); - _objList1[5].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL); + _persons[5].setVisage(2003); + _persons[5].setStrip(2); + _persons[5].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL); - _objList1[6].setVisage(2000); - _objList1[6].setStrip(1); - _objList1[6].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL); + _persons[6].setVisage(2000); + _persons[6].setStrip(1); + _persons[6].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL); - _objList1[7].setVisage(2000); - _objList1[7].setStrip(2); - _objList1[7].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL); + _persons[7].setVisage(2000); + _persons[7].setStrip(2); + _persons[7].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL); - _objList1[8].setVisage(2000); - _objList1[8].setStrip(2); - _objList1[8].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL); + _persons[8].setVisage(2000); + _persons[8].setStrip(2); + _persons[8].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL); - _objList1[9].setVisage(2006); - _objList1[9].setStrip(1); - _objList1[9].setDetails(2001, 6, -1, -1, 1, (SceneItem *)NULL); + _persons[9].setVisage(2006); + _persons[9].setStrip(1); + _persons[9].setDetails(2001, 6, -1, -1, 1, (SceneItem *)NULL); - _objList1[10].setVisage(2007); - _objList1[10].setStrip(1); - _objList1[10].setDetails(2001, 12, -1, -1, 1, (SceneItem *)NULL); + _persons[10].setVisage(2007); + _persons[10].setStrip(1); + _persons[10].setDetails(2001, 12, -1, -1, 1, (SceneItem *)NULL); for (int i = 0; i < 11; i++) { - _objList1[i].animate(ANIM_MODE_1, NULL); - _objList1[i]._moveDiff.x = 3; - _objList1[i]._moveRate = 8; - _objList1[i].hide(); + _persons[i].animate(ANIM_MODE_1, NULL); + _persons[i]._moveDiff.x = 3; + _persons[i]._moveRate = 8; + _persons[i].hide(); switch (i - 1) { case 0: if (R2_GLOBALS._spillLocation[3 + i] == 1) @@ -899,28 +902,28 @@ void Scene2000::postInit(SceneObjectList *OwnerList) { case 22: case 27: case 30: - _objList1[i].setPosition(Common::Point(265, 127)); + _persons[i].setPosition(Common::Point(265, 127)); break; case 5: case 12: case 17: case 21: case 26: - _objList1[i].setPosition(Common::Point(55, 127)); + _persons[i].setPosition(Common::Point(55, 127)); break; default: - _objList1[i].setPosition(Common::Point(160, 127)); + _persons[i].setPosition(Common::Point(160, 127)); break; } } - _objList1[1].setAction(&_action2); - _objList1[3].setAction(&_action5); - _objList1[5].setAction(&_action4); - _objList1[8].setAction(&_action1); + _persons[1].setAction(&_action2); + _persons[3].setAction(&_action5); + _persons[5].setAction(&_action4); + _persons[8].setAction(&_action1); initPlayer(); - _item1.setDetails(Rect(0, 0, 320, 200), 2000, 0, -1, 23, 1, NULL); + _background.setDetails(Rect(0, 0, 320, 200), 2000, 0, -1, 23, 1, NULL); SceneExt::postInit(); } @@ -1036,20 +1039,20 @@ void Scene2000::synchronize(Serializer &s) { * *--------------------------------------------------------------------------*/ -bool Scene2350::Actor2::startAction(CursorType action, Event &event) { +bool Scene2350::Companion::startAction(CursorType action, Event &event) { if (action != R2_SENSOR_PROBE) return(SceneActor::startAction(action, event)); return true; } -bool Scene2350::Actor3::startAction(CursorType action, Event &event) { +bool Scene2350::Balloon::startAction(CursorType action, Event &event) { Scene2350 *scene = (Scene2350 *)R2_GLOBALS._sceneManager._scene; if ((action == R2_REBREATHER_TANK) && (R2_GLOBALS.getFlag(74))) { R2_GLOBALS._player.disableControl(); - scene->_actor1.postInit(); + scene->_person.postInit(); scene->_sceneMode = 2355; - scene->setAction(&scene->_sequenceManager, scene, 2355, &R2_GLOBALS._player, &scene->_actor1, NULL); + scene->setAction(&scene->_sequenceManager, scene, 2355, &R2_GLOBALS._player, &scene->_person, NULL); return true; } @@ -1106,33 +1109,33 @@ void Scene2350::postInit(SceneObjectList *OwnerList) { } if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) { - _actor2.postInit(); + _companion.postInit(); if (R2_GLOBALS._player._characterIndex == R2_QUINN) { - _actor2.setup(20, 5, 1); - _actor2.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); + _companion.setup(20, 5, 1); + _companion.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); } else { - _actor2.setup(2008, 5, 1); - _actor2.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL); + _companion.setup(2008, 5, 1); + _companion.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL); } - _actor2.setPosition(Common::Point(135, 128)); + _companion.setPosition(Common::Point(135, 128)); } - _actor3.postInit(); - _actor4.postInit(); + _balloon.postInit(); + _harness.postInit(); if (R2_INVENTORY.getObjectScene(R2_REBREATHER_TANK) == 2350) { - _actor3.hide(); - _actor4.hide(); + _balloon.hide(); + _harness.hide(); } else { - _actor3.setup(2350, 0, 1); - _actor3.setPosition(Common::Point(197, 101)); - _actor3.setDetails(2000, 12, -1, -1, 1, (SceneItem *)NULL); - _actor3.fixPriority(10); - _actor4.setup(2350, 1, 2); - _actor4.setPosition(Common::Point(199, 129)); - _actor4.setDetails(2000, 12, -1, -1, 1, (SceneItem *)NULL); - _actor4.fixPriority(10); - } - _item1.setDetails(Rect(0, 0, 320, 200), 2000, 9, -1, -1, 1, NULL); + _balloon.setup(2350, 0, 1); + _balloon.setPosition(Common::Point(197, 101)); + _balloon.setDetails(2000, 12, -1, -1, 1, (SceneItem *)NULL); + _balloon.fixPriority(10); + _harness.setup(2350, 1, 2); + _harness.setPosition(Common::Point(199, 129)); + _harness.setDetails(2000, 12, -1, -1, 1, (SceneItem *)NULL); + _harness.fixPriority(10); + } + _background.setDetails(Rect(0, 0, 320, 200), 2000, 9, -1, -1, 1, NULL); R2_GLOBALS._player.disableControl(); if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2000) { @@ -1214,7 +1217,7 @@ void Scene2350::process(Event &event) { * *--------------------------------------------------------------------------*/ -void Scene2400::Exit1::changeScene() { +void Scene2400::WestExit::changeScene() { Scene2400 *scene = (Scene2400 *)R2_GLOBALS._sceneManager._scene; R2_GLOBALS._player.disableControl(); @@ -1226,7 +1229,7 @@ void Scene2400::Exit1::changeScene() { } -void Scene2400::Exit2::changeScene() { +void Scene2400::EastExit::changeScene() { Scene2400 *scene = (Scene2400 *)R2_GLOBALS._sceneManager._scene; R2_GLOBALS._player.disableControl(); @@ -1240,10 +1243,10 @@ void Scene2400::Exit2::changeScene() { void Scene2400::postInit(SceneObjectList *OwnerList) { loadScene(2400); SceneExt::postInit(); - _exit1.setDetails(Rect(0, 125, 14, 165), EXITCURSOR_W, 2000); - _exit1.setDest(Common::Point(14, 150)); - _exit2.setDetails(Rect(305, 125, 320, 165), EXITCURSOR_E, 2000); - _exit2.setDest(Common::Point(315, 150)); + _westExit.setDetails(Rect(0, 125, 14, 165), EXITCURSOR_W, 2000); + _westExit.setDest(Common::Point(14, 150)); + _eastExit.setDetails(Rect(305, 125, 320, 165), EXITCURSOR_E, 2000); + _eastExit.setDest(Common::Point(315, 150)); R2_GLOBALS._player.postInit(); R2_GLOBALS._player.disableControl(); @@ -1330,7 +1333,7 @@ bool Scene2425::Crevasse::startAction(CursorType action, Event &event) { } } -bool Scene2425::Item4::startAction(CursorType action, Event &event) { +bool Scene2425::Background::startAction(CursorType action, Event &event) { if (action != R2_CURSOR_ROPE) return NamedHotspot::startAction(action, event); else { @@ -1433,7 +1436,7 @@ void Scene2425::postInit(SceneObjectList *OwnerList) { g_globals->_sceneItems.push_back(&_pictographs2); _crevasse.setDetails(12, 2425, 7, -1, 9); - _item4.setDetails(Rect(0, 0, 320, 200), 2425, 0, -1, -1, 1, NULL); + _background.setDetails(Rect(0, 0, 320, 200), 2425, 0, -1, -1, 1, NULL); R2_GLOBALS._player.disableControl(); switch (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex]) { @@ -1492,7 +1495,7 @@ void Scene2425::signal() { * *--------------------------------------------------------------------------*/ -bool Scene2430::Actor1::startAction(CursorType action, Event &event) { +bool Scene2430::Companion::startAction(CursorType action, Event &event) { return SceneActor::startAction(action, event); } @@ -1565,33 +1568,31 @@ void Scene2430::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.setPosition(Common::Point(100, 200)); if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) { - _actor1.postInit(); + _companion.postInit(); if (R2_GLOBALS._player._characterIndex == R2_QUINN) { - _actor1.setup(20, 5, 1); - _actor1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); + _companion.setup(20, 5, 1); + _companion.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); } else { - _actor1.setup(2008, 5, 1); - _actor1.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL); + _companion.setup(2008, 5, 1); + _companion.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL); } - _actor1.setPosition(Common::Point(189, 137)); + _companion.setPosition(Common::Point(189, 137)); R2_GLOBALS._walkRegions.disableRegion(4); } - _item2.setDetails(Rect(11, 30, 37, 45), 2430, 3, -1, 5, 1, NULL); - _item3.setDetails(Rect(9, 58, 63, 92), 2430, 6, -1, -1, 1, NULL); - _item4.setDetails(Rect(20, 89, 127, 107), 2430, 9, -1, 11, 1, NULL); - _item5.setDetails(Rect(49, 7, 60, 27), 2430, 12, 13, 14, 1, NULL); - _item6.setDetails(Rect(69, 10, 95, 72), 2430, 15, -1, 14, 1, NULL); - _item10.setDetails(Rect(198, 4, 222, 146), 2430, 30, 31, 32, 1, NULL); - _item7.setDetails(Rect(155, 40, 304, 120), 2430, 21, -1, 23, 1, NULL); - _item8.setDetails(Rect(249, 3, 261, 39), 2430, 24, 25, -1, 1, NULL); - _item9.setDetails(Rect(279, 13, 305, 34), 2430, 33, -1, 18, 1, NULL); - // CHECKME: initialized for the 2nd time?? - _item2.setDetails(Rect(11, 30, 37, 45), 2430, 33, -1, 18, 1, NULL); - _item11.setDetails(Rect(116, 104, 148, 111), 2430, 39, -1, -1, 1, NULL); - _item12.setDetails(Rect(66, 77, 84, 83), 2430, 39, -1, -1, 1, NULL); - _item13.setDetails(Rect(117, 118, 201, 141), 2430, 9, -1, 11, 1, NULL); - _item1.setDetails(Rect(0, 0, 320, 200), 2430, 0, -1, -1, 1, NULL); + _furnishings.setDetails(Rect(9, 58, 63, 92), 2430, 6, -1, -1, 1, NULL); + _rug1.setDetails(Rect(20, 89, 127, 107), 2430, 9, -1, 11, 1, NULL); + _mirror.setDetails(Rect(49, 7, 60, 27), 2430, 12, 13, 14, 1, NULL); + _garments.setDetails(Rect(69, 10, 95, 72), 2430, 15, -1, 14, 1, NULL); + _post.setDetails(Rect(198, 4, 222, 146), 2430, 30, 31, 32, 1, NULL); + _bed.setDetails(Rect(155, 40, 304, 120), 2430, 21, -1, 23, 1, NULL); + _towel.setDetails(Rect(249, 3, 261, 39), 2430, 24, 25, -1, 1, NULL); + _bottles1.setDetails(Rect(279, 13, 305, 34), 2430, 33, -1, 18, 1, NULL); + _bottles2.setDetails(Rect(11, 30, 37, 45), 2430, 33, -1, 18, 1, NULL); + _clothesPile1.setDetails(Rect(116, 104, 148, 111), 2430, 39, -1, -1, 1, NULL); + _clothesPile2.setDetails(Rect(66, 77, 84, 83), 2430, 39, -1, -1, 1, NULL); + _rug2.setDetails(Rect(117, 118, 201, 141), 2430, 9, -1, 11, 1, NULL); + _background.setDetails(Rect(0, 0, 320, 200), 2430, 0, -1, -1, 1, NULL); if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2000) { R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2430; @@ -1781,6 +1782,7 @@ void Scene2435::signal() { _sceneMode = 20; R2_GLOBALS._events.setCursor(CURSOR_ARROW); _stripManager.start(709, this); + break; default: R2_GLOBALS._player.enableControl(); break; @@ -1792,7 +1794,7 @@ void Scene2435::signal() { * *--------------------------------------------------------------------------*/ -bool Scene2440::Actor1::startAction(CursorType action, Event &event) { +bool Scene2440::Companion::startAction(CursorType action, Event &event) { return SceneActor::startAction(action, event); } @@ -1847,24 +1849,24 @@ void Scene2440::postInit(SceneObjectList *OwnerList) { } R2_GLOBALS._player.setPosition(Common::Point(210, 200)); if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) { - _actor1.postInit(); + _companion.postInit(); if (R2_GLOBALS._player._characterIndex == R2_QUINN) { - _actor1.setup(20, 5, 1); - _actor1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); + _companion.setup(20, 5, 1); + _companion.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); } else { - _actor1.setup(2008, 5, 1); - _actor1.setDetails(9002, 0, 5, 3, 1, (SceneItem *)NULL); + _companion.setup(2008, 5, 1); + _companion.setDetails(9002, 0, 5, 3, 1, (SceneItem *)NULL); } - _actor1.setPosition(Common::Point(38, 119)); + _companion.setPosition(Common::Point(38, 119)); } - _item2.setDetails(Rect(125, 25, 142, 73), 2430, 15, -1, 14, 1, NULL); - _item3.setDetails(Rect(124, 78, 237, 120), 2430, 36, -1, 38, 1, NULL); - _item4.setDetails(Rect(250, 3, 265, 133), 2430, 30, 31, 32, 1, NULL); - _item5.setDetails(Rect(91, 117, 203, 140), 2430, 9, -1, 11, 1, NULL); - _item6.setDetails(Rect(48, 78, 103, 112), 2430, 6, -1, -1, 1, NULL); - _item7.setDetails(Rect(48, 31, 73, 52), 2430, 33, -1, 18, 1, NULL); - _item1.setDetails(Rect(0, 0, 320, 200), 2430, 0, -1, -1, 1, NULL); + _garments.setDetails(Rect(125, 25, 142, 73), 2430, 15, -1, 14, 1, NULL); + _bedspread.setDetails(Rect(124, 78, 237, 120), 2430, 36, -1, 38, 1, NULL); + _post.setDetails(Rect(250, 3, 265, 133), 2430, 30, 31, 32, 1, NULL); + _rug.setDetails(Rect(91, 117, 203, 140), 2430, 9, -1, 11, 1, NULL); + _furnishings.setDetails(Rect(48, 78, 103, 112), 2430, 6, -1, -1, 1, NULL); + _bottles.setDetails(Rect(48, 31, 73, 52), 2430, 33, -1, 18, 1, NULL); + _background.setDetails(Rect(0, 0, 320, 200), 2430, 0, -1, -1, 1, NULL); R2_GLOBALS._player.disableControl(); @@ -1969,7 +1971,7 @@ void Scene2450::Exit1::changeScene() { R2_GLOBALS._player.addMover(mover, &pt, scene); } else { _moving = false; - SceneItem::display(2450, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(2450, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); Common::Point pt(60, 140); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, NULL); @@ -2392,7 +2394,7 @@ void Scene2455::signal() { } /*-------------------------------------------------------------------------- - * Scene 2500 - Spill Mountains: Large Cave + * Scene 2500 - Spill Mountains: Large Ledge * *--------------------------------------------------------------------------*/ @@ -2438,19 +2440,19 @@ void Scene2500::postInit(SceneObjectList *OwnerList) { } if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) { - _actor1.postInit(); + _companion.postInit(); if (R2_GLOBALS._player._characterIndex == R2_QUINN) { - _actor1.setup(21, 3, 1); - _actor1.setDetails(9002, 1, -1, -1, 1, (SceneItem *)NULL); + _companion.setup(21, 3, 1); + _companion.setDetails(9002, 1, -1, -1, 1, (SceneItem *)NULL); } else { - _actor1.setup(2008, 3, 1); - _actor1.changeZoom(50); - _actor1.setDetails(9001, 0, -1, -1, 1, (SceneItem *)NULL); + _companion.setup(2008, 3, 1); + _companion.changeZoom(50); + _companion.setDetails(9001, 0, -1, -1, 1, (SceneItem *)NULL); } - _actor1.setPosition(Common::Point(141, 94)); + _companion.setPosition(Common::Point(141, 94)); } - _item1.setDetails(Rect(0, 0, 320, 200), 2430, 0, -1, -1, 1, NULL); + _background.setDetails(Rect(0, 0, 320, 200), 2430, 0, -1, -1, 1, NULL); R2_GLOBALS._player.disableControl(); if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2000) { @@ -2461,9 +2463,9 @@ void Scene2500::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.addMover(mover, &pt, this); } else if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 3100) { _sceneMode = 2500; - _actor2.postInit(); - _actor3.postInit(); - setAction(&_sequenceManager, this, 2500, &R2_GLOBALS._player, &_actor2, &_actor3, NULL); + _quinn.postInit(); + _ship.postInit(); + setAction(&_sequenceManager, this, 2500, &R2_GLOBALS._player, &_quinn, &_ship, NULL); } else { R2_GLOBALS._player.setPosition(Common::Point(160, 150)); R2_GLOBALS._player.setStrip(3); @@ -2480,7 +2482,7 @@ void Scene2500::signal() { case 20: R2_GLOBALS._player.disableControl(); _sceneMode = 2501; - setAction(&_sequenceManager, this, 2501, &R2_GLOBALS._player, &_actor2, &_actor3, NULL); + setAction(&_sequenceManager, this, 2501, &R2_GLOBALS._player, &_quinn, &_ship, NULL); break; case 2500: _sceneMode = 20; @@ -2501,7 +2503,7 @@ void Scene2500::signal() { * *--------------------------------------------------------------------------*/ -bool Scene2525::Item5::startAction(CursorType action, Event &event) { +bool Scene2525::StopCock::startAction(CursorType action, Event &event) { Scene2525 *scene = (Scene2525 *)R2_GLOBALS._sceneManager._scene; if ((action == R2_REBREATHER_TANK) && (!R2_GLOBALS.getFlag(74))) { @@ -2525,7 +2527,7 @@ bool Scene2525::GlassDome::startAction(CursorType action, Event &event) { scene->_sceneMode = 2525; scene->setAction(&scene->_sequenceManager, scene, 2525, &R2_GLOBALS._player, &scene->_glassDome, NULL); } else { - SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); } return true; } @@ -2559,12 +2561,12 @@ void Scene2525::postInit(SceneObjectList *OwnerList) { _glassDome.setDetails(2525, 27, -1, -1, 1, (SceneItem *)NULL); } - _actor2.postInit(); - _actor2.setup(2525, 1, 1); - _actor2.setPosition(Common::Point(183, 114)); - _actor2.setDetails(2525, 15, -1, -1, 1, (SceneItem *)NULL); - _actor2.animate(ANIM_MODE_2, NULL); - _actor2._numFrames = 3; + _compressor.postInit(); + _compressor.setup(2525, 1, 1); + _compressor.setPosition(Common::Point(183, 114)); + _compressor.setDetails(2525, 15, -1, -1, 1, (SceneItem *)NULL); + _compressor.animate(ANIM_MODE_2, NULL); + _compressor._numFrames = 3; R2_GLOBALS._player.postInit(); R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); @@ -2577,24 +2579,24 @@ void Scene2525::postInit(SceneObjectList *OwnerList) { } if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) { - _actor1.postInit(); + _companion.postInit(); if (R2_GLOBALS._player._characterIndex == R2_QUINN) { - _actor1.setup(20, 5, 1); - _actor1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); + _companion.setup(20, 5, 1); + _companion.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); } else { - _actor1.setup(2008, 5, 1); - _actor1.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL); + _companion.setup(2008, 5, 1); + _companion.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL); } - _actor1.setPosition(Common::Point(209, 162)); + _companion.setPosition(Common::Point(209, 162)); R2_GLOBALS._walkRegions.disableRegion(4); } - _item5.setDetails(Rect(125, 73, 140, 86), 2525, 6, -1, -1, 1, NULL); - _item3.setDetails(Rect(137, 11, 163, 72), 2525, 12, -1, -1, 1, NULL); - _item4.setDetails(Rect(204, 20, 234, 78), 2525, 12, -1, -1, 1, NULL); - _item2.setDetails(Rect(102, 62, 230, 134), 2525, 0, -1, -1, 1, NULL); - _item1.setDetails(Rect(0, 0, 320, 200), 2525, 24, -1, -1, 1, NULL); + _stopcock.setDetails(Rect(125, 73, 140, 86), 2525, 6, -1, -1, 1, NULL); + _pipes1.setDetails(Rect(137, 11, 163, 72), 2525, 12, -1, -1, 1, NULL); + _pipes2.setDetails(Rect(204, 20, 234, 78), 2525, 12, -1, -1, 1, NULL); + _machine.setDetails(Rect(102, 62, 230, 134), 2525, 0, -1, -1, 1, NULL); + _background.setDetails(Rect(0, 0, 320, 200), 2525, 24, -1, -1, 1, NULL); R2_GLOBALS._player.disableControl(); @@ -2653,7 +2655,7 @@ bool Scene2530::Flask::startAction(CursorType action, Event &event) { scene->_sceneMode = 2530; scene->setAction(&scene->_sequenceManager, scene, 2530, &R2_GLOBALS._player, &scene->_flask, NULL); } else { - SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); } return true; @@ -2667,7 +2669,7 @@ bool Scene2530::Crank::startAction(CursorType action, Event &event) { if (R2_GLOBALS._player._characterIndex == R2_QUINN) { if (R2_GLOBALS.getFlag(73)) - SceneItem::display(2530, 35, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(2530, 35, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); else { R2_GLOBALS._player.disableControl(); scene->_sceneMode = 2532; @@ -2739,20 +2741,20 @@ void Scene2530::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.setPosition(Common::Point(100, 200)); if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) { - _actor1.postInit(); + _companion.postInit(); if (R2_GLOBALS._player._characterIndex == R2_QUINN) { - _actor1.setup(20, 5, 1); - _actor1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); + _companion.setup(20, 5, 1); + _companion.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); } else { - _actor1.setup(2008, 5, 1); - _actor1.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL); + _companion.setup(2008, 5, 1); + _companion.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL); } - _actor1.setPosition(Common::Point(20, 130)); + _companion.setPosition(Common::Point(20, 130)); R2_GLOBALS._walkRegions.disableRegion(1); } - _item2.setDetails(Rect(108, 90, 135, 205), 2530, 22, -1, -1, 1, NULL); - _item5.setDetails(Rect(115, 112, 206, 130), 2530, 25, -1, 27, 1, NULL); + _crank2.setDetails(Rect(108, 90, 135, 205), 2530, 22, -1, -1, 1, NULL); + _rope.setDetails(Rect(115, 112, 206, 130), 2530, 25, -1, 27, 1, NULL); _shelf.setDetails(Rect(256, 64, 311, 85), 2530, 31, -1, 33, 1, NULL); _background.setDetails(Rect(0, 0, 320, 200), 2530, 0, 1, -1, 1, NULL); @@ -2814,7 +2816,7 @@ bool Scene2535::RebreatherTank::startAction(CursorType action, Event &event) { scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_rebreatherTank, NULL); } else { - SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); } return true; @@ -2831,7 +2833,7 @@ bool Scene2535::TannerMask::startAction(CursorType action, Event &event) { scene->_sceneMode = 2535; scene->setAction(&scene->_sequenceManager, scene, 2535, &R2_GLOBALS._player, &scene->_tannerMask, NULL); } else { - SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); } return true; @@ -3024,7 +3026,7 @@ void Scene2600::signal() { *--------------------------------------------------------------------------*/ Scene2700::Scene2700(): SceneExt() { - _field412 = _field414 = _field416 = 0; + _areaMode = _moveMode = _stripNumber = 0; _walkRect1.set(70, 122, 90, 132); _walkRect2.set(150, 122, 160, 132); @@ -3037,9 +3039,9 @@ Scene2700::Scene2700(): SceneExt() { void Scene2700::synchronize(Serializer &s) { SceneExt::synchronize(s); - s.syncAsSint16LE(_field412); - s.syncAsSint16LE(_field414); - s.syncAsSint16LE(_field416); + s.syncAsSint16LE(_areaMode); + s.syncAsSint16LE(_moveMode); + s.syncAsSint16LE(_stripNumber); } void Scene2700::Action1::signal() { @@ -3076,8 +3078,8 @@ void Scene2700::Area1::process(Event &event) { Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene; R2_GLOBALS._player.disableControl(); scene->_sceneMode = 10; - scene->_field414 = 2703; - switch (scene->_field412) { + scene->_moveMode = 2703; + switch (scene->_areaMode) { case 0: // No break on purpose case 6: @@ -3126,8 +3128,8 @@ void Scene2700::Area2::process(Event &event) { Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene; R2_GLOBALS._player.disableControl(); scene->_sceneMode = 10; - scene->_field414 = 2704; - switch (scene->_field412) { + scene->_moveMode = 2704; + switch (scene->_areaMode) { case 0: { Common::Point pt(140, 162); NpcMover *mover = new NpcMover(); @@ -3226,10 +3228,10 @@ void Scene2700::postInit(SceneObjectList *OwnerList) { if (R2_GLOBALS._sceneManager._previousScene == 2750) { _sceneMode = 2702; - _field412 = 5; + _areaMode = 5; setAction(&_sequenceManager, this, 2702, &R2_GLOBALS._player, NULL); } else { - _field412 = 0; + _areaMode = 0; if (R2_GLOBALS._sceneManager._previousScene == 3900) { _sceneMode = 2701; setAction(&_sequenceManager, this, 2701, &R2_GLOBALS._player, NULL); @@ -3244,26 +3246,26 @@ void Scene2700::postInit(SceneObjectList *OwnerList) { void Scene2700::signal() { switch (_sceneMode) { case 10: - switch (_field414) { + switch (_moveMode) { case 1: - switch (_field412) { + switch (_areaMode) { case 0: case 2: case 4: case 6: - _field412 = 3; + _areaMode = 3; R2_GLOBALS._player.setAction(&_sequenceManager, this, 2705, &R2_GLOBALS._player, NULL); break; case 3: { - _sceneMode = _field414; - _field412 = 1; + _sceneMode = _moveMode; + _areaMode = 1; Common::Point pt(80, 127); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); break; } case 5: - _field412 = 4; + _areaMode = 4; R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL); break; default: // includes case 1 @@ -3271,24 +3273,24 @@ void Scene2700::signal() { } break; case 2: - switch (_field412) { + switch (_areaMode) { case 0: case 1: case 6: - _field412 = 3; + _areaMode = 3; R2_GLOBALS._player.setAction(&_sequenceManager, this, 2706, &R2_GLOBALS._player, NULL); break; case 3: case 4: { - _sceneMode = _field414; - _field412 = 2; + _sceneMode = _moveMode; + _areaMode = 2; Common::Point pt(155, 127); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); break; } case 5: - _field412 = 4; + _areaMode = 4; R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL); break; default: // includes case 2 @@ -3296,21 +3298,21 @@ void Scene2700::signal() { } break; case 3: - switch (_field412) { + switch (_areaMode) { case 0: case 1: case 2: case 4: case 6: { - _sceneMode = _field414; - _field412 = 3; + _sceneMode = _moveMode; + _areaMode = 3; Common::Point pt(115, 152); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); break; } case 5: - _field412 = 4; + _areaMode = 4; R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL); break; default: // includes case 3 @@ -3318,21 +3320,21 @@ void Scene2700::signal() { } break; case 4: - switch (_field412) { + switch (_areaMode) { case 0: case 1: case 6: - _field412 = 3; + _areaMode = 3; R2_GLOBALS._player.setAction(&_sequenceManager, this, 2706, &R2_GLOBALS._player, NULL); break; case 2: case 3: - _field412 = 4; + _areaMode = 4; R2_GLOBALS._player.setAction(&_sequenceManager, this, 2709, &R2_GLOBALS._player, NULL); break; case 4: case 5: - _sceneMode = _field414; + _sceneMode = _moveMode; R2_GLOBALS._player.setAction(&_sequenceManager, this, 2704, &R2_GLOBALS._player, NULL); break; default: @@ -3340,21 +3342,21 @@ void Scene2700::signal() { } break; case 5: - switch (_field412) { + switch (_areaMode) { case 0: case 1: case 6: - _field412 = 3; + _areaMode = 3; R2_GLOBALS._player.setAction(&_sequenceManager, this, 2706, &R2_GLOBALS._player, NULL); break; case 2: case 3: - _field412 = 4; + _areaMode = 4; R2_GLOBALS._player.setAction(&_sequenceManager, this, 2709, &R2_GLOBALS._player, NULL); break; case 4: { - _sceneMode = _field414; - _field412 = 5; + _sceneMode = _moveMode; + _areaMode = 5; Common::Point pt(285, 132); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); @@ -3365,11 +3367,11 @@ void Scene2700::signal() { } break; case 6: - switch (_field412) { + switch (_areaMode) { case 0: case 3: { - _sceneMode = _field414; - _field412 = 6; + _sceneMode = _moveMode; + _areaMode = 6; Common::Point pt(250, 162); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); @@ -3378,11 +3380,11 @@ void Scene2700::signal() { case 1: case 2: case 4: - _field412 = 3; + _areaMode = 3; R2_GLOBALS._player.setAction(&_sequenceManager, this, 2707, &R2_GLOBALS._player, NULL); break; case 5: - _field412 = 4; + _areaMode = 4; R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL); break; default: @@ -3390,21 +3392,21 @@ void Scene2700::signal() { } break; case 2703: - switch (_field412) { + switch (_areaMode) { case 0: case 3: case 6: - _sceneMode = _field414; + _sceneMode = _moveMode; setAction(&_sequenceManager, this, 2703, &R2_GLOBALS._player, NULL); break; case 1: case 2: case 4: - _field412 = 3; + _areaMode = 3; R2_GLOBALS._player.setAction(&_sequenceManager, this, 2707, &R2_GLOBALS._player, NULL); break; case 5: - _field412 = 4; + _areaMode = 4; R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL); break; default: @@ -3412,21 +3414,21 @@ void Scene2700::signal() { } break; case 2704: - switch (_field412) { + switch (_areaMode) { case 0: case 1: case 6: - _field412 = 3; + _areaMode = 3; R2_GLOBALS._player.setAction(&_sequenceManager, this, 2706, &R2_GLOBALS._player, NULL); break; case 2: case 3: - _field412 = 4; + _areaMode = 4; R2_GLOBALS._player.setAction(&_sequenceManager, this, 2709, &R2_GLOBALS._player, NULL); break; case 4: case 5: - _sceneMode = _field414; + _sceneMode = _moveMode; R2_GLOBALS._player.setAction(&_sequenceManager, this, 2704, &R2_GLOBALS._player, NULL); break; default: @@ -3434,23 +3436,23 @@ void Scene2700::signal() { } break; case 2710: - switch (_field412) { + switch (_areaMode) { case 0: case 1: case 3: - _field412 = 3; + _areaMode = 3; R2_GLOBALS._player.setAction(&_sequenceManager, this, 2707, &R2_GLOBALS._player, NULL); break; case 2: case 5: { - _sceneMode = _field414; + _sceneMode = _moveMode; Common::Point pt(164, 160); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); break; } case 4: - _field412 = 4; + _areaMode = 4; R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL); break; default: @@ -3464,7 +3466,7 @@ void Scene2700::signal() { case 11: R2_INVENTORY.setObjectScene(R2_FLUTE, 0); R2_GLOBALS._player.disableControl(); - _field412 = 0; + _areaMode = 0; _sceneMode = 2700; setAction(&_sequenceManager, this, 2700, &_nej, NULL); break; @@ -3472,22 +3474,22 @@ void Scene2700::signal() { R2_GLOBALS._sound1.play(234); R2_GLOBALS._events.setCursor(CURSOR_WALK); _sceneMode = 2711; - _stripManager.start(_field416, this); + _stripManager.start(_stripNumber, this); break; case 13: R2_GLOBALS._events.setCursor(CURSOR_WALK); _sceneMode = 2712; - _stripManager.start(_field416, this); + _stripManager.start(_stripNumber, this); break; case 14: R2_GLOBALS._events.setCursor(CURSOR_WALK); _sceneMode = 2713; - _stripManager.start(_field416, this); + _stripManager.start(_stripNumber, this); break; case 15: R2_GLOBALS._events.setCursor(CURSOR_WALK); _sceneMode = 11; - _stripManager.start(_field416, this); + _stripManager.start(_stripNumber, this); break; case 2700: _nej.remove(); @@ -3501,26 +3503,26 @@ void Scene2700::signal() { break; case 2710: // Start of Nej assault - _field416 = 1200; + _stripNumber = 1200; _sceneMode = 12; _nej.postInit(); setAction(&_sequenceManager, this, 2710, &R2_GLOBALS._player, &_nej, NULL); break; case 2711: R2_GLOBALS._player.disableControl(); - _field416 = 1201; + _stripNumber = 1201; _sceneMode = 13; setAction(&_sequenceManager, this, 2711, &R2_GLOBALS._player, &_nej, NULL); break; case 2712: R2_GLOBALS._player.disableControl(); - _field416 = 1202; + _stripNumber = 1202; _sceneMode = 14; setAction(&_sequenceManager, this, 2712, &R2_GLOBALS._player, &_nej, NULL); break; case 2713: R2_GLOBALS._player.disableControl(); - _field416 = 1203; + _stripNumber = 1203; _sceneMode = 15; setAction(&_sequenceManager, this, 2713, &R2_GLOBALS._player, &_nej, NULL); break; @@ -3534,11 +3536,11 @@ void Scene2700::process(Event &event) { if (R2_GLOBALS._events.getCursor() == R2_FLUTE) { if (R2_GLOBALS._player._bounds.contains(event.mousePos)) { _sceneMode = 10; - _field414 = 2710; + _moveMode = 2710; R2_GLOBALS._player.disableControl(); R2_GLOBALS._events.setCursor(CURSOR_WALK); - switch (_field412) { + switch (_areaMode) { case 0: { _sceneMode = 2710; Common::Point pt(164, 160); @@ -3586,7 +3588,7 @@ void Scene2700::process(Event &event) { break; } } else { - SceneItem::display(2700, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(2700, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); } event.handled = true; @@ -3595,37 +3597,37 @@ void Scene2700::process(Event &event) { if (!_walkRect1.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; - _field414 = 1; + _moveMode = 1; } } else if (_walkRect2.contains(event.mousePos)) { if (!_walkRect2.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; - _field414 = 2; + _moveMode = 2; } } else if (_walkRect3.contains(event.mousePos)) { if (!_walkRect3.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; - _field414 = 3; + _moveMode = 3; } } else if (_walkRect4.contains(event.mousePos)) { if (!_walkRect4.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; - _field414 = 4; + _moveMode = 4; } } else if (_walkRect5.contains(event.mousePos)) { if (!_walkRect5.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; - _field414 = 5; + _moveMode = 5; } } else if (_walkRect6.contains(event.mousePos)) { if (!_walkRect6.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; - _field414 = 6; + _moveMode = 6; } } else { event.handled = true; @@ -3633,9 +3635,9 @@ void Scene2700::process(Event &event) { } if (_sceneMode == 10) { R2_GLOBALS._player.disableControl(); - switch (_field412) { + switch (_areaMode) { case 0: - if (_field414 >= 6) { + if (_moveMode >= 6) { Common::Point pt(205, 162); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); @@ -3658,11 +3660,11 @@ void Scene2700::process(Event &event) { break; } case 3: - if (_field414 == 1) { + if (_moveMode == 1) { Common::Point pt(80, 137); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); - } else if (_field414 == 6) { + } else if (_moveMode == 6) { Common::Point pt(140, 162); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); @@ -3673,7 +3675,7 @@ void Scene2700::process(Event &event) { } break; case 4: - if (_field414 == 5) { + if (_moveMode == 5) { Common::Point pt(235, 132); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); @@ -3710,15 +3712,15 @@ void Scene2700::process(Event &event) { *--------------------------------------------------------------------------*/ Scene2750::Scene2750(): SceneExt() { - _field412 = _field414 = _field416 = 0; + _areaMode = _moveMode = _stripNumber = 0; } void Scene2750::synchronize(Serializer &s) { SceneExt::synchronize(s); - s.syncAsSint16LE(_field412); - s.syncAsSint16LE(_field414); - s.syncAsSint16LE(_field416); + s.syncAsSint16LE(_areaMode); + s.syncAsSint16LE(_moveMode); + s.syncAsSint16LE(_stripNumber); } void Scene2750::Action1::signal() { @@ -3728,20 +3730,20 @@ void Scene2750::Action1::signal() { case 1: setDelay(60 + R2_GLOBALS._randomSource.getRandomNumber(240)); _actionIndex = 2; - scene->_actor5.show(); - scene->_actor5.animate(ANIM_MODE_8, 1, NULL); + scene->_bird2.show(); + scene->_bird2.animate(ANIM_MODE_8, 1, NULL); break; case 2: setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(600)); _actionIndex = 0; - scene->_actor5.show(); - scene->_actor3.animate(ANIM_MODE_2, NULL); + scene->_bird2.show(); + scene->_bird1.animate(ANIM_MODE_2, NULL); break; default: setDelay(30); _actionIndex = 1; - scene->_actor3.animate(ANIM_MODE_6, NULL); - scene->_actor4.animate(ANIM_MODE_8, 1, NULL); + scene->_bird1.animate(ANIM_MODE_6, NULL); + scene->_folliage1.animate(ANIM_MODE_8, 1, NULL); break; } } @@ -3750,20 +3752,20 @@ void Scene2750::Action2::signal() { Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300)); - scene->_actor6.animate(ANIM_MODE_8, 1, NULL); + scene->_folliage2.animate(ANIM_MODE_8, 1, NULL); } void Scene2750::Action3::signal() { Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; - if (scene->_actor7._position.x <= 320) { + if (scene->_folliage3._position.x <= 320) { setDelay(1800 + R2_GLOBALS._randomSource.getRandomNumber(600)); } else { setDelay(60); - scene->_actor7.setPosition(Common::Point(-10, 25)); + scene->_folliage3.setPosition(Common::Point(-10, 25)); Common::Point pt(330, 45); NpcMover *mover = new NpcMover(); - scene->_actor7.addMover(mover, &pt, NULL); + scene->_folliage3.addMover(mover, &pt, NULL); } } @@ -3771,28 +3773,28 @@ void Scene2750::Action4::signal() { Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300)); - scene->_actor8.animate(ANIM_MODE_8, 1, NULL); + scene->_folliage4.animate(ANIM_MODE_8, 1, NULL); } void Scene2750::Action5::signal() { Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300)); - scene->_actor9.animate(ANIM_MODE_8, 1, NULL); + scene->_folliage5.animate(ANIM_MODE_8, 1, NULL); } void Scene2750::Action6::signal() { Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300)); - scene->_actor10.animate(ANIM_MODE_8, 1, NULL); + scene->_folliage6.animate(ANIM_MODE_8, 1, NULL); } void Scene2750::Action7::signal() { Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300)); - scene->_actor11.animate(ANIM_MODE_8, 1, NULL); + scene->_folliage7.animate(ANIM_MODE_8, 1, NULL); } void Scene2750::Area1::process(Event &event) { @@ -3801,8 +3803,8 @@ void Scene2750::Area1::process(Event &event) { Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; R2_GLOBALS._player.disableControl(); scene->_sceneMode = 10; - scene->_field414 = 2752; - switch (scene->_field412) { + scene->_moveMode = 2752; + switch (scene->_areaMode) { case 1: { scene->_sceneMode = 2752; scene->setAction(&scene->_sequenceManager, scene, 2752, &R2_GLOBALS._player, NULL); @@ -3832,8 +3834,8 @@ void Scene2750::Area2::process(Event &event) { Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; R2_GLOBALS._player.disableControl(); scene->_sceneMode = 10; - scene->_field414 = 2753; - switch (scene->_field412) { + scene->_moveMode = 2753; + switch (scene->_areaMode) { case 1: { Common::Point pt(140, 142); NpcMover *mover = new NpcMover(); @@ -3864,73 +3866,73 @@ void Scene2750::postInit(SceneObjectList *OwnerList) { _area1.setDetails(Rect(0, 90, 20, 135), EXITCURSOR_W); _area2.setDetails(Rect(300, 90, 320, 135), EXITCURSOR_E); - _rect1.set(30, 127, 155, 147); - _rect2.set(130, 142, 210, 167); - _rect3.set(-1, 137, 290, 147); + _walkRect1.set(30, 127, 155, 147); + _walkRect2.set(130, 142, 210, 167); + _walkRect3.set(-1, 137, 290, 147); if (R2_INVENTORY.getObjectScene(R2_FLUTE) == 0) { R2_GLOBALS._sound1.changeSound(235); - _actor2.postInit(); - _actor2.setup(2751, 1, 1); - _actor2.setPosition(Common::Point(104, 158)); - _actor2.animate(ANIM_MODE_2, NULL); - } - - _actor3.postInit(); - _actor3.setup(2750, 1, 1); - _actor3.setPosition(Common::Point(188, 34)); - _actor3.animate(ANIM_MODE_2, NULL); - _actor3._numFrames = 16; - - _actor4.postInit(); - _actor4.setup(2700, 4, 1); - _actor4.setPosition(Common::Point(188, 37)); - _actor4.fixPriority(26); - - _actor5.postInit(); - _actor5.setup(2750, 2, 1); - _actor5.setPosition(Common::Point(188, 34)); - _actor5.hide(); - - _actor3.setAction(&_action1); - - _actor6.postInit(); - _actor6.setup(2750, 3, 1); - _actor6.setPosition(Common::Point(9, 167)); - _actor6.fixPriority(252); - _actor6.setAction(&_action2); - - _actor7.postInit(); - _actor7.setup(2750, 4, 1); - _actor7.setPosition(Common::Point(-10, 25)); - _actor7.animate(ANIM_MODE_1, NULL); - _actor7.setStrip2(4); - _actor7._moveRate = 20; - _actor7.setAction(&_action3); - - _actor8.postInit(); - _actor8.fixPriority(26); - _actor8.setup(2750, 5, 1); - _actor8.setPosition(Common::Point(258, 33)); - _actor8.setAction(&_action4); - - _actor9.postInit(); - _actor9.fixPriority(26); - _actor9.setup(2750, 6, 1); - _actor9.setPosition(Common::Point(61, 38)); - _actor9.setAction(&_action5); - - _actor10.postInit(); - _actor10.fixPriority(26); - _actor10.setup(2750, 7, 1); - _actor10.setPosition(Common::Point(69, 37)); - _actor10.setAction(&_action6); - - _actor11.postInit(); - _actor11.fixPriority(26); - _actor11.setup(2750, 8, 1); - _actor11.setPosition(Common::Point(80, 35)); - _actor11.setAction(&_action7); + _fire.postInit(); + _fire.setup(2751, 1, 1); + _fire.setPosition(Common::Point(104, 158)); + _fire.animate(ANIM_MODE_2, NULL); + } + + _bird1.postInit(); + _bird1.setup(2750, 1, 1); + _bird1.setPosition(Common::Point(188, 34)); + _bird1.animate(ANIM_MODE_2, NULL); + _bird1._numFrames = 16; + + _folliage1.postInit(); + _folliage1.setup(2700, 4, 1); + _folliage1.setPosition(Common::Point(188, 37)); + _folliage1.fixPriority(26); + + _bird2.postInit(); + _bird2.setup(2750, 2, 1); + _bird2.setPosition(Common::Point(188, 34)); + _bird2.hide(); + + _bird1.setAction(&_action1); + + _folliage2.postInit(); + _folliage2.setup(2750, 3, 1); + _folliage2.setPosition(Common::Point(9, 167)); + _folliage2.fixPriority(252); + _folliage2.setAction(&_action2); + + _folliage3.postInit(); + _folliage3.setup(2750, 4, 1); + _folliage3.setPosition(Common::Point(-10, 25)); + _folliage3.animate(ANIM_MODE_1, NULL); + _folliage3.setStrip2(4); + _folliage3._moveRate = 20; + _folliage3.setAction(&_action3); + + _folliage4.postInit(); + _folliage4.fixPriority(26); + _folliage4.setup(2750, 5, 1); + _folliage4.setPosition(Common::Point(258, 33)); + _folliage4.setAction(&_action4); + + _folliage5.postInit(); + _folliage5.fixPriority(26); + _folliage5.setup(2750, 6, 1); + _folliage5.setPosition(Common::Point(61, 38)); + _folliage5.setAction(&_action5); + + _folliage6.postInit(); + _folliage6.fixPriority(26); + _folliage6.setup(2750, 7, 1); + _folliage6.setPosition(Common::Point(69, 37)); + _folliage6.setAction(&_action6); + + _folliage7.postInit(); + _folliage7.fixPriority(26); + _folliage7.setup(2750, 8, 1); + _folliage7.setPosition(Common::Point(80, 35)); + _folliage7.setAction(&_action7); _ghoulHome1.setDetails(Rect(29, 50, 35, 56), 2750, 3, -1, 5, 1, NULL); _ghoulHome2.setDetails(Rect(47, 36, 54, 42), 2750, 3, -1, 5, 1, NULL); @@ -3963,20 +3965,20 @@ void Scene2750::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.animate(ANIM_MODE_NONE, NULL); R2_GLOBALS._player.setPosition(Common::Point(81, 165)); R2_GLOBALS._events.setCursor(CURSOR_WALK); - _field416 = 1204; + _stripNumber = 1204; _sceneMode = 11; - _stripManager.start(_field416, this); + _stripManager.start(_stripNumber, this); } else { _sceneMode = 2750; - _field412 = 1; + _areaMode = 1; R2_GLOBALS._player.setAction(&_sequenceManager, this, 2750, &R2_GLOBALS._player, NULL); } } else if (R2_GLOBALS._sceneManager._previousScene == 2800) { _sceneMode = 2751; - _field412 = 3; + _areaMode = 3; R2_GLOBALS._player.setAction(&_sequenceManager, this, 2751, &R2_GLOBALS._player, NULL); } else { - _field412 = 1; + _areaMode = 1; R2_GLOBALS._player.setPosition(Common::Point(90, 137)); R2_GLOBALS._player.setStrip(3); R2_GLOBALS._player.enableControl(); @@ -3985,19 +3987,19 @@ void Scene2750::postInit(SceneObjectList *OwnerList) { void Scene2750::signal() { switch (_sceneMode) { case 10: - switch (_field414) { + switch (_moveMode) { case 1: - switch (_field412) { + switch (_areaMode) { case 2: { - _sceneMode = _field414; - _field412 = 1; + _sceneMode = _moveMode; + _areaMode = 1; Common::Point pt(90, 137); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); } break; case 3: { - _field412 = 2; + _areaMode = 2; Common::Point pt(140, 142); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); @@ -4008,25 +4010,25 @@ void Scene2750::signal() { } break; case 2: { - _sceneMode = _field414; - _field412 = 2; + _sceneMode = _moveMode; + _areaMode = 2; Common::Point pt(170, 162); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); } break; case 3: - switch (_field412) { + switch (_areaMode) { case 1: { - _field412 = 2; + _areaMode = 2; Common::Point pt(210, 142); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); } break; case 2: { - _sceneMode = _field414; - _field412 = 3; + _sceneMode = _moveMode; + _areaMode = 3; Common::Point pt(270, 142); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); @@ -4037,20 +4039,20 @@ void Scene2750::signal() { } break; case 2752: - switch (_field412) { + switch (_areaMode) { case 1: - _sceneMode = _field414; + _sceneMode = _moveMode; setAction(&_sequenceManager, this, 2752, &R2_GLOBALS._player, NULL); break; case 2: { - _field412 = 1; + _areaMode = 1; Common::Point pt(20, 132); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); } break; case 3: { - _field412 = 2; + _areaMode = 2; Common::Point pt(140, 142); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); @@ -4061,23 +4063,23 @@ void Scene2750::signal() { } break; case 2753: - switch (_field412) { + switch (_areaMode) { case 1: { - _field412 = 2; + _areaMode = 2; Common::Point pt(210, 142); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); } break; case 2: { - _field412 = 3; + _areaMode = 3; Common::Point pt(300, 132); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); } break; case 3: - _sceneMode = _field414; + _sceneMode = _moveMode; setAction(&_sequenceManager, this, 2753, &R2_GLOBALS._player, NULL); break; default: @@ -4103,24 +4105,25 @@ void Scene2750::signal() { } void Scene2750::process(Event &event) { - if ((R2_GLOBALS._player._canWalk) && (event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == R2_NEGATOR_GUN)) { - if (_rect1.contains(event.mousePos)) { - if (!_rect1.contains(R2_GLOBALS._player._position)) { + if ((R2_GLOBALS._player._canWalk) && (event.eventType == EVENT_BUTTON_DOWN) + && (R2_GLOBALS._events.getCursor() == R2_NEGATOR_GUN)) { + if (_walkRect1.contains(event.mousePos)) { + if (!_walkRect1.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; - _field414 = 1; + _moveMode = 1; } - } else if (_rect2.contains(event.mousePos)) { - if (!_rect2.contains(R2_GLOBALS._player._position)) { + } else if (_walkRect2.contains(event.mousePos)) { + if (!_walkRect2.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; - _field414 = 2; + _moveMode = 2; } - } else if (_rect3.contains(event.mousePos)) { - if (!_rect3.contains(R2_GLOBALS._player._position)) { + } else if (_walkRect3.contains(event.mousePos)) { + if (!_walkRect3.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; - _field414 = 3; + _moveMode = 3; } } else { event.handled = true; @@ -4129,7 +4132,7 @@ void Scene2750::process(Event &event) { if (_sceneMode == 10) { R2_GLOBALS._player.disableControl(); - switch (_field412) { + switch (_areaMode) { case 1: { Common::Point pt(140, 142); NpcMover *mover = new NpcMover(); @@ -4137,7 +4140,7 @@ void Scene2750::process(Event &event) { } break; case 2: - if (_field414 == 1) { + if (_moveMode == 1) { Common::Point pt(140, 142); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); @@ -4167,13 +4170,13 @@ void Scene2750::process(Event &event) { *--------------------------------------------------------------------------*/ Scene2800::Scene2800(): SceneExt() { - _field412 = 0; + _stripNumber = 0; } void Scene2800::synchronize(Serializer &s) { SceneExt::synchronize(s); - s.syncAsSint16LE(_field412); + s.syncAsSint16LE(_stripNumber); } bool Scene2800::Outpost::startAction(CursorType action, Event &event) { @@ -4195,16 +4198,16 @@ bool Scene2800::Guard::startAction(CursorType action, Event &event) { R2_GLOBALS._player.disableControl(); R2_GLOBALS._events.setCursor(CURSOR_WALK); R2_GLOBALS.setFlag(47); - scene->_field412 = 1205; + scene->_stripNumber = 1205; scene->_sceneMode = 2803; - scene->_stripManager.start(scene->_field412, scene); + scene->_stripManager.start(scene->_stripNumber, scene); return true; } else if (action == R2_SONIC_STUNNER) { R2_GLOBALS._events.setCursor(CURSOR_ARROW); R2_GLOBALS._player.disableControl(); R2_GLOBALS.setFlag(47); scene->_sceneMode = 10; - scene->setAction(&scene->_sequenceManager, scene, 2802, &R2_GLOBALS._player, &scene->_actor2, &scene->_guard, NULL); + scene->setAction(&scene->_sequenceManager, scene, 2802, &R2_GLOBALS._player, &scene->_nej, &scene->_guard, NULL); return true; } else return SceneActor::startAction(action, event); @@ -4217,10 +4220,10 @@ void Scene2800::Action1::signal() { setDelay(120); Common::Point pt(330, 25); NpcMover *mover = new NpcMover(); - scene->_object1.addMover(mover, &pt, NULL); + scene->_bird.addMover(mover, &pt, NULL); } else { setDelay(1800 + R2_GLOBALS._randomSource.getRandomNumber(600)); - scene->_object1.setPosition(Common::Point(-10, 45)); + scene->_bird.setPosition(Common::Point(-10, 45)); } } @@ -4361,8 +4364,8 @@ void Scene2800::Action2::signal() { } case 13: R2_GLOBALS._events.setCursor(CURSOR_WALK); - scene->_field412 = 1207; - scene->_stripManager.start(scene->_field412, this); + scene->_stripNumber = 1207; + scene->_stripManager.start(scene->_stripNumber, this); break; case 14: { R2_GLOBALS._player.disableControl(); @@ -4428,20 +4431,20 @@ void Scene2800::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._sound2.stop(); SceneExt::postInit(); - _object1.postInit(); - _object1.setup(2750, 4, 1); - _object1.setPosition(Common::Point(-10, 25)); - _object1.animate(ANIM_MODE_1, NULL); - _object1.setStrip2(4); - _object1._moveRate = 20; - _object1.setAction(&_action1); - - _actor3.postInit(); - _actor3.setup(2802, 1, 1); - _actor3.setPosition(Common::Point(116, 80)); - _actor3.fixPriority(111); - _actor3.animate(ANIM_MODE_2, NULL); - _actor3._numFrames = 6; + _bird.postInit(); + _bird.setup(2750, 4, 1); + _bird.setPosition(Common::Point(-10, 25)); + _bird.animate(ANIM_MODE_1, NULL); + _bird.setStrip2(4); + _bird._moveRate = 20; + _bird.setAction(&_action1); + + _lightBar.postInit(); + _lightBar.setup(2802, 1, 1); + _lightBar.setPosition(Common::Point(116, 80)); + _lightBar.fixPriority(111); + _lightBar.animate(ANIM_MODE_2, NULL); + _lightBar._numFrames = 6; if (!R2_GLOBALS.getFlag(47)) { _guard.postInit(); @@ -4455,7 +4458,7 @@ void Scene2800::postInit(SceneObjectList *OwnerList) { _guard.setDetails(2800, -1, -1, -1, 1, (SceneItem *)NULL); } - _item1.setDetails(Rect(0, 0, 320, 200), 2800, -1, -1, -1, 1, NULL); + _background.setDetails(Rect(0, 0, 320, 200), 2800, -1, -1, -1, 1, NULL); _stripManager.setColors(60, 255); _stripManager.setFontNumber(3); @@ -4468,12 +4471,12 @@ void Scene2800::postInit(SceneObjectList *OwnerList) { if (R2_GLOBALS.getFlag(47)) { _outpost.setDetails(Rect(76, 45, 155, 90), 2800, 3, -1, -1, 2, NULL); } else { - _actor2.postInit(); - _actor2.setup(2752, 5, 1); - _actor2.animate(ANIM_MODE_NONE, NULL); - _actor2.changeZoom(100); - _actor2._moveDiff = Common::Point(2, 1); - _actor2.setPosition(Common::Point(101, 148)); + _nej.postInit(); + _nej.setup(2752, 5, 1); + _nej.animate(ANIM_MODE_NONE, NULL); + _nej.changeZoom(100); + _nej._moveDiff = Common::Point(2, 1); + _nej.setPosition(Common::Point(101, 148)); } } @@ -4495,7 +4498,8 @@ void Scene2800::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.enableControl(); } else { _sceneMode = 2801; - R2_GLOBALS._player.setAction(&_sequenceManager, this, 2801, &R2_GLOBALS._player, &_actor2, &_guard, NULL); + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2801, &R2_GLOBALS._player, + &_nej, &_guard, NULL); } } @@ -4504,13 +4508,13 @@ void Scene2800::signal() { case 10: R2_GLOBALS._sound1.play(238); R2_GLOBALS._events.setCursor(CURSOR_WALK); - _field412 = 1206; + _stripNumber = 1206; _sceneMode = 2804; - _stripManager.start(_field412, this); + _stripManager.start(_stripNumber, this); break; case 11: - _actor2.remove(); - _object1.setAction(NULL); + _nej.remove(); + _bird.setAction(NULL); R2_GLOBALS._player.enableControl(CURSOR_WALK); R2_GLOBALS._player._moveDiff = Common::Point(3, 2); _outpost.setDetails(Rect(76, 45, 155, 90), 2800, 3, -1, -1, 2, NULL); @@ -4530,15 +4534,15 @@ void Scene2800::signal() { case 2803: R2_GLOBALS._player.disableControl(); _sceneMode = 10; - setAction(&_sequenceManager, this, 2803, &R2_GLOBALS._player, &_actor2, &_guard, NULL); + setAction(&_sequenceManager, this, 2803, &R2_GLOBALS._player, &_nej, &_guard, NULL); break; case 2804: R2_GLOBALS._player.disableControl(); _sceneMode = 11; - setAction(&_sequenceManager, this, 2804, &R2_GLOBALS._player, &_actor2, NULL); + setAction(&_sequenceManager, this, 2804, &R2_GLOBALS._player, &_nej, NULL); break; case 2805: - _object1.remove(); + _bird.remove(); setAction(&_action2); break; default: @@ -4613,8 +4617,8 @@ bool Scene2900::KnobLeft::startAction(CursorType action, Event &event) { switch (action) { case CURSOR_USE: - if (scene->_field416 || scene->_altitudeChanging || - scene->_field425 != scene->_field426) { + if (scene->_majorMinorFlag || scene->_altitudeChanging || + scene->_xAmount != scene->_xComparison) { // Let your altitude stablize first SceneItem::display2(2900, 17); } else if (R2_GLOBALS._balloonAltitude / 48 == 0) { @@ -4625,7 +4629,7 @@ bool Scene2900::KnobLeft::startAction(CursorType action, Event &event) { R2_GLOBALS._sound2.fadeSound(282); scene->_altitudeChanging = true; scene->_altitudeMajorChange = -1; - scene->_field426 = 100 - ((R2_GLOBALS._balloonAltitude / 48) - 1) * 25; + scene->_xComparison = 100 - ((R2_GLOBALS._balloonAltitude / 48) - 1) * 25; } break; @@ -4650,8 +4654,8 @@ bool Scene2900::KnobRight::startAction(CursorType action, Event &event) { switch (action) { case CURSOR_USE: - if (scene->_field416 || scene->_altitudeChanging || - scene->_field425 != scene->_field426) { + if (scene->_majorMinorFlag || scene->_altitudeChanging || + scene->_xAmount != scene->_xComparison) { // Let your altitude stablize first SceneItem::display2(2900, 17); } else if (R2_GLOBALS._balloonAltitude / 48 >= 3) { @@ -4662,7 +4666,7 @@ bool Scene2900::KnobRight::startAction(CursorType action, Event &event) { R2_GLOBALS._sound2.fadeSound(212); scene->_altitudeChanging = true; scene->_altitudeMajorChange = 1; - scene->_field426 = 100 - ((R2_GLOBALS._balloonAltitude / 48) + 1) * 25; + scene->_xComparison = 100 - ((R2_GLOBALS._balloonAltitude / 48) + 1) * 25; } break; @@ -4700,22 +4704,22 @@ void Scene2900::Action1::signal() { Scene2900 *scene = (Scene2900 *)R2_GLOBALS._sceneManager._scene; setDelay(3); - if (!scene->_field416 && !scene->_altitudeChanging) { - scene->_field427 = 2; - scene->_field412 = 0; - } else if (scene->_field416) { + if (!scene->_majorMinorFlag && !scene->_altitudeChanging) { + scene->_fadeCounter = 2; + scene->_controlsActiveChanging = false; + } else if (scene->_majorMinorFlag) { R2_GLOBALS._sound2.fadeOut2(NULL); - } else if (scene->_field427 == 0) { + } else if (scene->_fadeCounter == 0) { R2_GLOBALS._sound2.fadeOut2(NULL); - } else if (scene->_field412 == 0) { + } else if (!scene->_controlsActiveChanging) { scene->_knobLeftContent.hide(); scene->_knobRightContent.hide(); - scene->_field412 = 1; + scene->_controlsActiveChanging = true; } else { - --scene->_field427; + --scene->_fadeCounter; scene->_knobLeftContent.show(); scene->_knobRightContent.show(); - scene->_field412 = 0; + scene->_controlsActiveChanging = false; } } @@ -4723,10 +4727,6 @@ void Scene2900::Action1::signal() { Scene2900::Map::Map() { _mapWidth = _mapHeight = 0; - _field4 = 0; - _field6 = 0; - _field8 = 0; - _fieldA = 0; _resNum = 0; _xV = _yV = 0; _bounds = Rect(40, 0, 280, 150); @@ -4932,37 +4932,37 @@ void Scene2900::Map::moveLine(int xpSrc, int ypSrc, int xpDest, int ypDest, int /*------------------------------------------------------------------------*/ Scene2900::Scene2900(): SceneExt() { - _field412 = 0; + _controlsActiveChanging = false; _altitudeChanging = false; - _field416 = false; + _majorMinorFlag = false; _balloonLocation = Common::Point(550, 550); - _field41C = 0; + _altitudeMinorChange = 0; _altitudeMajorChange = 0; _balloonScreenPos = Common::Point(160, 100); _newAltitude = 0; - _field425 = 100; - _field426 = 100; - _field427 = 0; - _field8F8 = false; + _xAmount = 100; + _xComparison = 100; + _fadeCounter = 0; + _paletteReloadNeeded = false; } void Scene2900::synchronize(Serializer &s) { SceneExt::synchronize(s); - s.syncAsSint16LE(_field412); + s.syncAsSint16LE(_controlsActiveChanging); s.syncAsSint16LE(_altitudeChanging); - s.syncAsSint16LE(_field416); - s.syncAsSint16LE(_field41C); + s.syncAsSint16LE(_majorMinorFlag); + s.syncAsSint16LE(_altitudeMinorChange); s.syncAsSint16LE(_altitudeMajorChange); s.syncAsSint16LE(_balloonLocation.x); s.syncAsSint16LE(_balloonLocation.y); s.syncAsSint16LE(_balloonScreenPos.x); s.syncAsSint16LE(_balloonScreenPos.y); s.syncAsSint16LE(_newAltitude); - s.syncAsSint16LE(_field425); - s.syncAsSint16LE(_field426); - s.syncAsSint16LE(_field427); - s.syncAsSint16LE(_field8F8); + s.syncAsSint16LE(_xAmount); + s.syncAsSint16LE(_xComparison); + s.syncAsSint16LE(_fadeCounter); + s.syncAsSint16LE(_paletteReloadNeeded); _map.synchronize(s); } @@ -5059,16 +5059,16 @@ void Scene2900::postInit(SceneObjectList *OwnerList) { if (_balloonLocation.y <= 100) _balloonScreenPos.y = _balloonLocation.y; - _field425 = _field426 = 100 - (R2_GLOBALS._balloonAltitude / 48) * 25; + _xAmount = _xComparison = 100 - (R2_GLOBALS._balloonAltitude / 48) * 25; _map.setPosition(Common::Point(_balloonLocation.x - 120, _balloonLocation.y - 100)); _sceneMode = 11; - R2_GLOBALS._player.changeZoom(_field425); + R2_GLOBALS._player.changeZoom(_xAmount); R2_GLOBALS._player.setPosition(_balloonScreenPos); R2_GLOBALS._player.enableControl(); R2_GLOBALS._player._canWalk = false; - _altimeterContent.setPosition(Common::Point(109 - _field425, 189)); + _altimeterContent.setPosition(Common::Point(109 - _xAmount, 189)); } R2_GLOBALS._sound1.play(211); @@ -5109,51 +5109,51 @@ void Scene2900::dispatch() { if (_sceneMode == 11) { _balloonLocation.x += balloonData[R2_GLOBALS._balloonAltitude].x; _balloonLocation.y += balloonData[R2_GLOBALS._balloonAltitude].y; - _field41C = balloonData[R2_GLOBALS._balloonAltitude].v3; + _altitudeMinorChange = balloonData[R2_GLOBALS._balloonAltitude].v3; - if (_field41C == 0) { - _field416 = false; + if (_altitudeMinorChange == 0) { + _majorMinorFlag = false; } else { - _field416 = true; + _majorMinorFlag = true; _altitudeChanging = false; - _field426 = 100 - ((R2_GLOBALS._balloonAltitude / 48) + _field41C) * 25; + _xComparison = 100 - ((R2_GLOBALS._balloonAltitude / 48) + _altitudeMinorChange) * 25; } // Zooming/altitude balloon change - if (_field425 == _field426) { - _field416 = false; + if (_xAmount == _xComparison) { + _majorMinorFlag = false; } else { - if (!_field416) { - _field425 = _field425 - _altitudeMajorChange; + if (!_majorMinorFlag) { + _xAmount = _xAmount - _altitudeMajorChange; } else { - _field425 = _field425 - _field41C; + _xAmount = _xAmount - _altitudeMinorChange; } - if (_field41C == -1 || _altitudeMajorChange == -1) { + if (_altitudeMinorChange == -1 || _altitudeMajorChange == -1) { if (_altimeterContent._frame == 1) { _altimeterContent.setFrame2(10); } else { _altimeterContent.setFrame2(_altimeterContent._frame - 1); } - } else if (_field41C == -1 || _altitudeMajorChange == 1) { + } else if (_altitudeMinorChange == -1 || _altitudeMajorChange == 1) { if (_altimeterContent._frame == 10) _altimeterContent.setFrame2(1); else _altimeterContent.setFrame2(_altimeterContent._frame + 1); } - _altimeterContent.setPosition(Common::Point(109 - _field425, 189)); - R2_GLOBALS._player.changeZoom(_field425); + _altimeterContent.setPosition(Common::Point(109 - _xAmount, 189)); + R2_GLOBALS._player.changeZoom(_xAmount); } - if (!_field8F8) { + if (!_paletteReloadNeeded) { R2_GLOBALS._scenePalette.loadPalette(2950); R2_GLOBALS._scenePalette.refresh(); } R2_GLOBALS._balloonPosition = _map.setPosition( - Common::Point(_balloonLocation.x - 120, _balloonLocation.y - 100), !_field8F8); - _field8F8 = true; + Common::Point(_balloonLocation.x - 120, _balloonLocation.y - 100), !_paletteReloadNeeded); + _paletteReloadNeeded = true; if (_balloonLocation.x <= 120) _balloonScreenPos.x = _balloonLocation.x + 40; @@ -5165,7 +5165,7 @@ void Scene2900::dispatch() { R2_GLOBALS._player.setPosition(_balloonScreenPos); - if ((_balloonLocation.x % 100) == 50 && (_balloonLocation.y % 100) == 50 && !_field416) { + if ((_balloonLocation.x % 100) == 50 && (_balloonLocation.y % 100) == 50 && !_majorMinorFlag) { // At an altitude change point, so calculate new altitude _newAltitude = R2_GLOBALS._balloonAltitude; if (_altitudeChanging) { diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.h b/engines/tsage/ringworld2/ringworld2_scenes2.h index f90126b5a1..1d0cfc41f8 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.h +++ b/engines/tsage/ringworld2/ringworld2_scenes2.h @@ -69,9 +69,9 @@ public: bool _exitingFlag; int _mazePlayerMode; - NamedHotspot _item1; - SceneActor _object1; - SceneActor _objList1[11]; + NamedHotspot _background; + SceneActor _companion; + SceneActor _persons[11]; WestExit _westExit; EastExit _eastExit; SouthExit _southExit; @@ -92,10 +92,10 @@ public: }; class Scene2350 : public SceneExt { - class Actor2 : public SceneActor { + class Companion : public SceneActor { virtual bool startAction(CursorType action, Event &event); }; - class Actor3 : public SceneActor { + class Balloon : public SceneActor { virtual bool startAction(CursorType action, Event &event); }; @@ -106,14 +106,13 @@ class Scene2350 : public SceneExt { virtual void changeScene(); }; public: - SpeakerQuinn _quinnSpeaker; SpeakerPharisha _pharishaSpeaker; - NamedHotspot _item1; - SceneActor _actor1; - Actor2 _actor2; - Actor3 _actor3; - Actor3 _actor4; + NamedHotspot _background; + SceneActor _person; + Companion _companion; + Balloon _balloon; + Balloon _harness; ExitUp _exitUp; ExitWest _exitWest; SequenceManager _sequenceManager; @@ -125,15 +124,15 @@ public: }; class Scene2400 : public SceneExt { - class Exit1 : public SceneExit { + class WestExit : public SceneExit { virtual void changeScene(); }; - class Exit2 : public SceneExit { + class EastExit : public SceneExit { virtual void changeScene(); }; public: - Exit1 _exit1; - Exit2 _exit2; + WestExit _westExit; + EastExit _eastExit; SequenceManager _sequenceManager; virtual void postInit(SceneObjectList *OwnerList = NULL); @@ -153,7 +152,7 @@ class Scene2425 : public SceneExt { public: virtual bool startAction(CursorType action, Event &event); }; - class Item4 : public NamedHotspot { + class Background : public NamedHotspot { public: virtual bool startAction(CursorType action, Event &event); }; @@ -175,7 +174,7 @@ public: RopeDest1 _ropeDest1; RopeDest2 _ropeDest2; Crevasse _crevasse; - Item4 _item4; + Background _background; Rope _rope; Pictographs _pictographs1; Pictographs _pictographs2; @@ -188,7 +187,7 @@ public: }; class Scene2430 : public SceneExt { - class Actor1 : public SceneActor { + class Companion : public SceneActor { public: bool startAction(CursorType action, Event &event); }; @@ -206,20 +205,20 @@ class Scene2430 : public SceneExt { virtual void changeScene(); }; public: - NamedHotspot _item1; - NamedHotspot _item2; - NamedHotspot _item3; - NamedHotspot _item4; - NamedHotspot _item5; - NamedHotspot _item6; - NamedHotspot _item7; - NamedHotspot _item8; - NamedHotspot _item9; - NamedHotspot _item10; - NamedHotspot _item11; - NamedHotspot _item12; - NamedHotspot _item13; - Actor1 _actor1; + NamedHotspot _background; + NamedHotspot _bottles2; + NamedHotspot _furnishings; + NamedHotspot _rug1; + NamedHotspot _mirror; + NamedHotspot _garments; + NamedHotspot _bed; + NamedHotspot _towel; + NamedHotspot _bottles1; + NamedHotspot _post; + NamedHotspot _clothesPile1; + NamedHotspot _clothesPile2; + NamedHotspot _rug2; + Companion _companion; GunPowder _gunPowder; OilLamp _oilLamp; Exit1 _exit1; @@ -261,7 +260,7 @@ public: }; class Scene2440 : public SceneExt { - class Actor1 : public SceneActor { + class Companion : public SceneActor { public: bool startAction(CursorType action, Event &event); }; @@ -275,14 +274,14 @@ class Scene2440 : public SceneExt { virtual void changeScene(); }; public: - NamedHotspot _item1; - NamedHotspot _item2; - NamedHotspot _item3; - NamedHotspot _item4; - NamedHotspot _item5; - NamedHotspot _item6; - NamedHotspot _item7; - Actor1 _actor1; + NamedHotspot _background; + NamedHotspot _garments; + NamedHotspot _bedspread; + NamedHotspot _post; + NamedHotspot _rug; + NamedHotspot _furnishings; + NamedHotspot _bottles; + Companion _companion; OilLamp _oilLamp; Exit1 _exit1; SequenceManager _sequenceManager; @@ -373,10 +372,10 @@ public: SpeakerSeeker _seekerSpeaker; SpeakerMiranda _mirandaSpeaker; SpeakerWebbster2500 _webbsterSpeaker; - NamedHotspot _item1; - SceneActor _actor1; - SceneActor _actor2; - SceneActor _actor3; + NamedHotspot _background; + SceneActor _companion; + SceneActor _quinn; + SceneActor _ship; Exit1 _exit1; SequenceManager _sequenceManager; @@ -385,7 +384,7 @@ public: }; class Scene2525 : public SceneExt { - class Item5 : public NamedHotspot { + class StopCock : public NamedHotspot { public: virtual bool startAction(CursorType action, Event &event); }; @@ -400,13 +399,13 @@ class Scene2525 : public SceneExt { virtual void changeScene(); }; public: - NamedHotspot _item1; - NamedHotspot _item2; - NamedHotspot _item3; - NamedHotspot _item4; - Item5 _item5; - SceneActor _actor1; - SceneActor _actor2; + NamedHotspot _background; + NamedHotspot _machine; + NamedHotspot _pipes1; + NamedHotspot _pipes2; + StopCock _stopcock; + SceneActor _companion; + SceneActor _compressor; GlassDome _glassDome; Exit1 _exit1; SequenceManager _sequenceManager; @@ -432,11 +431,11 @@ class Scene2530 : public SceneExt { }; public: NamedHotspot _background; - NamedHotspot _item2; + NamedHotspot _crank2; NamedHotspot _shelf; NamedHotspot _item4; - NamedHotspot _item5; - SceneActor _actor1; + NamedHotspot _rope; + SceneActor _companion; Flask _flask; Crank _crank; Exit1 _exit1; @@ -540,7 +539,7 @@ public: Rect _walkRect1, _walkRect2, _walkRect3; Rect _walkRect4, _walkRect5, _walkRect6; SequenceManager _sequenceManager; - int _field412, _field414, _field416; + int _areaMode, _moveMode, _stripNumber; Scene2700(); virtual void synchronize(Serializer &s); @@ -596,16 +595,16 @@ public: NamedHotspot _ghoulHome3; NamedHotspot _ghoulHome4; SceneActor _nej; - SceneActor _actor2; - SceneActor _actor3; - SceneActor _actor4; - SceneActor _actor5; - SceneActor _actor6; - SceneActor _actor7; - SceneActor _actor8; - SceneActor _actor9; - SceneActor _actor10; - SceneActor _actor11; + SceneActor _fire; + SceneActor _bird1; + SceneActor _folliage1; + SceneActor _bird2; + SceneActor _folliage2; + SceneActor _folliage3; + SceneActor _folliage4; + SceneActor _folliage5; + SceneActor _folliage6; + SceneActor _folliage7; Action1 _action1; Action2 _action2; Action3 _action3; @@ -615,9 +614,9 @@ public: Action7 _action7; Area1 _area1; Area2 _area2; - Rect _rect1, _rect2, _rect3; + Rect _walkRect1, _walkRect2, _walkRect3; SequenceManager _sequenceManager; - int _field412, _field414, _field416; + int _areaMode, _moveMode, _stripNumber; Scene2750(); virtual void synchronize(Serializer &s); @@ -651,16 +650,16 @@ public: SpeakerQuinn2800 _quinnSpeaker; SpeakerNej2800 _nejSpeaker; SpeakerGuard2800 _guardSpeaker; - NamedHotspot _item1; + NamedHotspot _background; Outpost _outpost; Guard _guard; - SceneActor _actor2; - SceneActor _actor3; - SceneObject _object1; + SceneActor _nej; + SceneActor _lightBar; + SceneObject _bird; Action1 _action1; Action2 _action2; SequenceManager _sequenceManager; - int _field412; + int _stripNumber; Scene2800(); virtual void synchronize(Serializer &s); @@ -710,10 +709,6 @@ class Scene2900 : public SceneExt { void drawBlock(const byte *data, int xp, int yp, const Rect &r1, const Rect &r2); public: int _mapWidth, _mapHeight; - int _field4; - int _field6; - int _field8; - int _fieldA; int _resNum; int _xV, _yV; Rect _bounds; @@ -741,18 +736,18 @@ public: Map _map; SceneText _skipText; - int _field412; + bool _controlsActiveChanging; bool _altitudeChanging; - bool _field416; - int _field41C; + bool _majorMinorFlag; + int _altitudeMinorChange; int _altitudeMajorChange; Common::Point _balloonLocation; Common::Point _balloonScreenPos; int _newAltitude; - int _field425; - int _field426; - int _field427; - bool _field8F8; + int _xAmount; + int _xComparison; + int _fadeCounter; + bool _paletteReloadNeeded; Scene2900(); virtual void synchronize(Serializer &s); diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 68131f9b7a..788b8c77dd 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -35,13 +35,13 @@ namespace Ringworld2 { *--------------------------------------------------------------------------*/ Scene3100::Scene3100() { - _field412 = 0; + _fadeSound = false; } void Scene3100::synchronize(Serializer &s) { SceneExt::synchronize(s); - s.syncAsSint16LE(_field412); + s.syncAsSint16LE(_fadeSound); } bool Scene3100::Guard::startAction(CursorType action, Event &event) { @@ -84,20 +84,21 @@ void Scene3100::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player._characterIndex = R2_QUINN; R2_GLOBALS._player.disableControl(); - _actor1.postInit(); - _item2.setDetails(Rect(212, 97, 320, 114), 3100, 3, -1, -1, 1, NULL); - _item1.setDetails(Rect(0, 0, 480, 200), 3100, 0, -1, -1, 1, NULL); - _field412 = 0; + _hammerHead.postInit(); + _hammerHead2.setDetails(Rect(212, 97, 320, 114), 3100, 3, -1, -1, 1, NULL); + _background.setDetails(Rect(0, 0, 480, 200), 3100, 0, -1, -1, 1, NULL); + _fadeSound = false; if (R2_GLOBALS._sceneManager._previousScene == 1000) { if (R2_GLOBALS._player._oldCharacterScene[R2_QUINN] == 3100) { _sceneMode = 3102; - _actor3.postInit(); - _actor4.postInit(); - _actor5.postInit(); + _ghoul.postInit(); + _technicians.postInit(); + _deadBodies.postInit(); R2_GLOBALS._sound1.play(274); _sound1.fadeSound(130); - setAction(&_sequenceManager, this, 3102, &_actor1, &R2_GLOBALS._player, &_actor3, &_actor4, &_actor5, NULL); + setAction(&_sequenceManager, this, 3102, &_hammerHead, &R2_GLOBALS._player, + &_ghoul, &_technicians, &_deadBodies, NULL); } else { _guard.postInit(); _guard.setup(3110, 5, 1); @@ -105,27 +106,28 @@ void Scene3100::postInit(SceneObjectList *OwnerList) { _guard.setPosition(Common::Point(10, 149)); _guard.setDetails(3100, 6, -1, -1, 2, (SceneItem *)NULL); - _actor4.postInit(); - _actor4.setup(3103, 1, 1); - _actor4.setPosition(Common::Point(278, 113)); - _actor4.setDetails(3100, 9, -1, -1, 2, (SceneItem *)NULL); - _actor4.animate(ANIM_MODE_2, NULL); + _technicians.postInit(); + _technicians.setup(3103, 1, 1); + _technicians.setPosition(Common::Point(278, 113)); + _technicians.setDetails(3100, 9, -1, -1, 2, (SceneItem *)NULL); + _technicians.animate(ANIM_MODE_2, NULL); - _field412 = 1; - _actor1.setDetails(3100, 3, -1, -1, 2, (SceneItem *)NULL); + _fadeSound = true; + _hammerHead.setDetails(3100, 3, -1, -1, 2, (SceneItem *)NULL); R2_GLOBALS._sound1.play(243); R2_GLOBALS._sound2.play(130); _sceneMode = 3100; - setAction(&_sequenceManager, this, 3100, &R2_GLOBALS._player, &_actor1, NULL); + setAction(&_sequenceManager, this, 3100, &R2_GLOBALS._player, &_hammerHead, NULL); } } else if (R2_GLOBALS._sceneManager._previousScene == 3255) { _sceneMode = 3101; - _actor2.postInit(); - _actor3.postInit(); - _field412 = 1; + _miranda.postInit(); + _ghoul.postInit(); + _fadeSound = true; - setAction(&_sequenceManager, this, 3101, &R2_GLOBALS._player, &_actor1, &_actor2, &_actor3, NULL); + setAction(&_sequenceManager, this, 3101, &R2_GLOBALS._player, &_hammerHead, + &_miranda, &_ghoul, NULL); } else { _guard.postInit(); _guard.setup(3110, 5, 1); @@ -133,16 +135,16 @@ void Scene3100::postInit(SceneObjectList *OwnerList) { _guard.setPosition(Common::Point(10, 149)); _guard.setDetails(3100, 6, -1, -1, 2, (SceneItem *)NULL); - _actor4.postInit(); - _actor4.setup(3103, 1, 1); - _actor4.setPosition(Common::Point(278, 113)); - _actor4.setDetails(3100, 9, -1, -1, 2, (SceneItem *)NULL); - _actor4.animate(ANIM_MODE_2, NULL); + _technicians.postInit(); + _technicians.setup(3103, 1, 1); + _technicians.setPosition(Common::Point(278, 113)); + _technicians.setDetails(3100, 9, -1, -1, 2, (SceneItem *)NULL); + _technicians.animate(ANIM_MODE_2, NULL); - _actor1.postInit(); - _actor1.setup(3104, 4, 1); - _actor1.setPosition(Common::Point(143, 104)); - _actor1.setDetails(3100, 3, -1, -1, 2, (SceneItem *)NULL); + _hammerHead.postInit(); + _hammerHead.setup(3104, 4, 1); + _hammerHead.setPosition(Common::Point(143, 104)); + _hammerHead.setDetails(3100, 3, -1, -1, 2, (SceneItem *)NULL); R2_GLOBALS._player.setup(3110, 3, 1); R2_GLOBALS._player.changeZoom(50); @@ -189,13 +191,13 @@ void Scene3100::signal() { } void Scene3100::dispatch() { - if ((_sceneMode == 3100) && (_field412 != 0) && (R2_GLOBALS._player._position.y == 104)) { - _field412 = 0; + if ((_sceneMode == 3100) && _fadeSound && (R2_GLOBALS._player._position.y == 104)) { + _fadeSound = false; R2_GLOBALS._sound2.fadeOut2(NULL); } - if ((_sceneMode == 3101) && (_field412 != 0) && (R2_GLOBALS._player._position.y < 104)) { - _field412 = 0; + if ((_sceneMode == 3101) && _fadeSound && (R2_GLOBALS._player._position.y < 104)) { + _fadeSound = false; _sound1.fadeSound(130); } @@ -208,13 +210,13 @@ void Scene3100::dispatch() { *--------------------------------------------------------------------------*/ Scene3125::Scene3125() { - _field412 = 0; + _soundPlayed = false; } void Scene3125::synchronize(Serializer &s) { SceneExt::synchronize(s); - s.syncAsSint16LE(_field412); + s.syncAsSint16LE(_soundPlayed); } bool Scene3125::Background::startAction(CursorType action, Event &event) { @@ -223,15 +225,15 @@ bool Scene3125::Background::startAction(CursorType action, Event &event) { switch (action) { case CURSOR_USE: if (_useLineNum != -1) - SceneItem::display(_resNum, _useLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + SceneItem::display(_resNum, _useLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END); break; case CURSOR_LOOK: if (_lookLineNum != -1) - SceneItem::display(_resNum, _lookLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + SceneItem::display(_resNum, _lookLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END); break; case CURSOR_TALK: if (_talkLineNum != -1) - SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END); break; default: return scene->display(action, event); @@ -248,13 +250,13 @@ bool Scene3125::Table::startAction(CursorType action, Event &event) { case CURSOR_USE: R2_GLOBALS._player.disableControl(); scene->_sceneMode = 3125; - scene->setAction(&scene->_sequenceManager1, scene, 3125, &R2_GLOBALS._player, NULL); + scene->setAction(&scene->_sequenceManager, scene, 3125, &R2_GLOBALS._player, NULL); break; case CURSOR_LOOK: - SceneItem::display(3125, 15, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + SceneItem::display(3125, 15, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END); break; case CURSOR_TALK: - SceneItem::display(3125, 13, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + SceneItem::display(3125, 13, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END); break; default: return SceneHotspot::startAction(action, event); @@ -272,15 +274,15 @@ bool Scene3125::Computer::startAction(CursorType action, Event &event) { R2_GLOBALS._player.disableControl(); scene->_ghoul4.postInit(); scene->_sceneMode = 3126; - scene->setAction(&scene->_sequenceManager1, scene, 3126, &R2_GLOBALS._player, + scene->setAction(&scene->_sequenceManager, scene, 3126, &R2_GLOBALS._player, &scene->_ghoul1, &scene->_ghoul2, &scene->_ghoul3, &scene->_door, &scene->_ghoul4, NULL); break; case CURSOR_LOOK: - SceneItem::display(3125, 9, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + SceneItem::display(3125, 9, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END); break; case CURSOR_TALK: - SceneItem::display(3125, 13, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + SceneItem::display(3125, 13, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END); break; default: return SceneHotspot::startAction(action, event); @@ -298,14 +300,14 @@ bool Scene3125::Door::startAction(CursorType action, Event &event) { R2_GLOBALS._player.disableControl(); scene->_sceneMode = 3176; - scene->setAction(&scene->_sequenceManager1, scene, 3176, &R2_GLOBALS._player, &scene->_door, NULL); + scene->setAction(&scene->_sequenceManager, scene, 3176, &R2_GLOBALS._player, &scene->_door, NULL); return true; } void Scene3125::postInit(SceneObjectList *OwnerList) { loadScene(3125); SceneExt::postInit(); - _field412 = 0; + _soundPlayed = false; _door.postInit(); _door.setup(3175, 1, 1); @@ -336,7 +338,7 @@ void Scene3125::postInit(SceneObjectList *OwnerList) { if (R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] == 3250) { _sceneMode = 3175; - setAction(&_sequenceManager1, this, 3175, &R2_GLOBALS._player, &_door, NULL); + setAction(&_sequenceManager, this, 3175, &R2_GLOBALS._player, &_door, NULL); } else { R2_GLOBALS._player.setup(30, 5, 1); R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); @@ -349,9 +351,9 @@ void Scene3125::postInit(SceneObjectList *OwnerList) { void Scene3125::signal() { switch (_sceneMode) { case 3125: - SceneItem::display(3125, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + SceneItem::display(3125, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END); _sceneMode = 3127; - setAction(&_sequenceManager1, this, 3127, &R2_GLOBALS._player, NULL); + setAction(&_sequenceManager, this, 3127, &R2_GLOBALS._player, NULL); break; case 3126: R2_GLOBALS.setFlag(79); @@ -366,9 +368,9 @@ void Scene3125::signal() { } void Scene3125::dispatch() { - if ((_sceneMode == 3126) && (_ghoul1._frame == 2) && (_field412 == 0)) { - _field412 = 1; + if ((_sceneMode == 3126) && (_ghoul1._frame == 2) && !_soundPlayed) { R2_GLOBALS._sound1.play(265); + _soundPlayed = true; } Scene::dispatch(); } @@ -399,7 +401,7 @@ bool Scene3150::LightFixture::startAction(CursorType action, Event &event) { scene->_sceneMode = 3155; scene->setAction(&scene->_sequenceManager, scene, 3155, &R2_GLOBALS._player, &scene->_bulbOrWire, NULL); } else { - SceneItem::display(3150, 42, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(3150, 42, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); } return true; default: @@ -434,7 +436,7 @@ bool Scene3150::Toilet::startAction(CursorType action, Event &event) { scene->_sceneMode = 3159; scene->setAction(&scene->_sequenceManager, scene, 3159, &R2_GLOBALS._player, &scene->_foodTray, NULL); } else { - SceneItem::display(3150, 42, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(3150, 42, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); } return true; default: @@ -475,7 +477,7 @@ bool Scene3150::FoodTray::startAction(CursorType action, Event &event) { return true; } -bool Scene3150::Actor6::startAction(CursorType action, Event &event) { +bool Scene3150::ToiletFlush::startAction(CursorType action, Event &event) { Scene3150 *scene = (Scene3150 *)R2_GLOBALS._sceneManager._scene; if (action == CURSOR_USE) { @@ -490,7 +492,7 @@ bool Scene3150::Actor6::startAction(CursorType action, Event &event) { scene->setAction(&scene->_sequenceManager, scene, 3152, &R2_GLOBALS._player, &scene->_water, NULL); } } else { - SceneItem::display(3150, 42, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(3150, 42, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); } } else { R2_GLOBALS._player.disableControl(); @@ -804,25 +806,25 @@ void Scene3150::dispatch() { * *--------------------------------------------------------------------------*/ -bool Scene3175::Item1::startAction(CursorType action, Event &event) { +bool Scene3175::RoomItem::startAction(CursorType action, Event &event) { Scene3175 *scene = (Scene3175 *)R2_GLOBALS._sceneManager._scene; switch (action) { case CURSOR_USE: if (_useLineNum != -1) { - SceneItem::display(_resNum, _useLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + SceneItem::display(_resNum, _useLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END); return true; } break; case CURSOR_LOOK: if (_lookLineNum != -1) { - SceneItem::display(_resNum, _lookLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + SceneItem::display(_resNum, _lookLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END); return true; } break; case CURSOR_TALK: if (_talkLineNum != -1) { - SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END); return true; } break; @@ -839,19 +841,19 @@ bool Scene3175::Corpse::startAction(CursorType action, Event &event) { switch (action) { case CURSOR_USE: if (_useLineNum != -1) { - SceneItem::display(_resNum, _useLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + SceneItem::display(_resNum, _useLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END); return true; } break; case CURSOR_LOOK: if (_lookLineNum != -1) { - SceneItem::display(_resNum, _lookLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + SceneItem::display(_resNum, _lookLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END); return true; } break; case CURSOR_TALK: if (_talkLineNum != -1) { - SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END); return true; } break; @@ -873,11 +875,11 @@ bool Scene3175::Door::startAction(CursorType action, Event &event) { return true; break; case CURSOR_LOOK: - SceneItem::display(3175, 9, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + SceneItem::display(3175, 9, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END); return true; break; case CURSOR_TALK: - SceneItem::display(3175, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + SceneItem::display(3175, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END); return true; break; default: @@ -895,17 +897,17 @@ void Scene3175::postInit(SceneObjectList *OwnerList) { _door.setPosition(Common::Point(35, 72)); _door.setDetails(3175, 9, 10, -1, 1, (SceneItem *)NULL); - _actor2.postInit(); - _actor2.setup(3175, 2, 1); - _actor2.setPosition(Common::Point(87, 148)); + _computer.postInit(); + _computer.setup(3175, 2, 1); + _computer.setPosition(Common::Point(87, 148)); _corpse.postInit(); _corpse.setup(3175, 3, 1); _corpse.setPosition(Common::Point(199, 117)); _corpse.setDetails(3175, 15, 16, 17, 1, (SceneItem *)NULL); - _item2.setDetails(12, 3175, 3, 1, 5); - _item3.setDetails(11, 3175, 6, 7, 8); + _table.setDetails(12, 3175, 3, 1, 5); + _autopsies.setDetails(11, 3175, 6, 7, 8); _background.setDetails(Rect(0, 0, 320, 200), 3175, 0, 1, 2, 1, NULL); R2_GLOBALS._player.postInit(); @@ -948,11 +950,12 @@ void Scene3200::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.hide(); R2_GLOBALS._player.disableControl(); - _actor1.postInit(); - _actor3.postInit(); - _actor2.postInit(); + _rocko.postInit(); + _jocko.postInit(); + _socko.postInit(); - setAction(&_sequenceManager, this, 3200 + R2_GLOBALS._randomSource.getRandomNumber(1), &_actor1, &_actor2, &_actor3, NULL); + setAction(&_sequenceManager, this, 3200 + R2_GLOBALS._randomSource.getRandomNumber(1), + &_rocko, &_jocko, &_socko, NULL); } void Scene3200::signal() { @@ -976,10 +979,11 @@ void Scene3210::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.hide(); R2_GLOBALS._player.disableControl(); - _actor1.postInit(); - _actor2.postInit(); + _captain.postInit(); + _private.postInit(); - setAction(&_sequenceManager, this, 3210 + R2_GLOBALS._randomSource.getRandomNumber(1), &_actor1, &_actor2, NULL); + setAction(&_sequenceManager, this, 3210 + R2_GLOBALS._randomSource.getRandomNumber(1), + &_captain, &_private, NULL); } void Scene3210::signal() { @@ -1003,10 +1007,11 @@ void Scene3220::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.hide(); R2_GLOBALS._player.disableControl(); - _actor1.postInit(); - _actor2.postInit(); + _rocko.postInit(); + _jocko.postInit(); - setAction(&_sequenceManager, this, 3220 + R2_GLOBALS._randomSource.getRandomNumber(1), &_actor1, &_actor2, NULL); + setAction(&_sequenceManager, this, 3220 + R2_GLOBALS._randomSource.getRandomNumber(1), + &_rocko, &_jocko, NULL); } void Scene3220::signal() { @@ -1030,11 +1035,12 @@ void Scene3230::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.hide(); R2_GLOBALS._player.disableControl(); - _actor1.postInit(); - _actor2.postInit(); - _actor3.postInit(); + _rocko.postInit(); + _jocko.postInit(); + _ghoul.postInit(); - setAction(&_sequenceManager, this, 3230 + R2_GLOBALS._randomSource.getRandomNumber(1), &_actor1, &_actor2, &_actor3, NULL); + setAction(&_sequenceManager, this, 3230 + R2_GLOBALS._randomSource.getRandomNumber(1), + &_rocko, &_jocko, &_ghoul, NULL); } void Scene3230::signal() { @@ -1059,10 +1065,11 @@ void Scene3240::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.hide(); R2_GLOBALS._player.disableControl(); - _actor1.postInit(); - _actor2.postInit(); + _teal.postInit(); + _webbster.postInit(); - setAction(&_sequenceManager, this, 3240 + R2_GLOBALS._randomSource.getRandomNumber(1), &_actor1, &_actor2, NULL); + setAction(&_sequenceManager, this, 3240 + R2_GLOBALS._randomSource.getRandomNumber(1), + &_teal, &_webbster, NULL); } void Scene3240::signal() { @@ -1086,17 +1093,18 @@ void Scene3245::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.hide(); R2_GLOBALS._player.disableControl(); - _actor1.postInit(); - _actor2.postInit(); + _ralf.postInit(); + _tomko.postInit(); if (R2_GLOBALS._scientistConvIndex < 4) ++R2_GLOBALS._scientistConvIndex; if (R2_GLOBALS._scientistConvIndex >= 4) { - SceneItem::display(1200, 7, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(1200, 7, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); signal(); } else { - setAction(&_sequenceManager, this, 3244 + R2_GLOBALS._scientistConvIndex, &_actor1, &_actor2, NULL); + setAction(&_sequenceManager, this, 3244 + R2_GLOBALS._scientistConvIndex, + &_ralf, &_tomko, NULL); } } @@ -1115,19 +1123,19 @@ bool Scene3250::Item::startAction(CursorType action, Event &event) { switch (action) { case CURSOR_USE: if (_useLineNum != -1) { - SceneItem::display(_resNum, _useLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + SceneItem::display(_resNum, _useLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END); return true; } break; case CURSOR_LOOK: if (_lookLineNum != -1) { - SceneItem::display(_resNum, _lookLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + SceneItem::display(_resNum, _lookLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END); return true; } break; case CURSOR_TALK: if (_talkLineNum != -1) { - SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END); return true; } break; @@ -1202,9 +1210,9 @@ void Scene3250::postInit(SceneObjectList *OwnerList) { switch (R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA]) { case 1200: _sceneMode = 3250; - _actor4.postInit(); + _grate.postInit(); R2_GLOBALS._player._effect = 0; - setAction(&_sequenceManager, this, 3250, &R2_GLOBALS._player, &_actor4, NULL); + setAction(&_sequenceManager, this, 3250, &R2_GLOBALS._player, &_grate, NULL); break; case 3125: if (R2_GLOBALS.getFlag(79)) { @@ -1295,10 +1303,10 @@ void Scene3255::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._sound1.play(267); R2_GLOBALS._sound2.play(268); _sceneMode = 3257; - _actor3.postInit(); + _door.postInit(); _quinn.postInit(); _quinn._effect = 1; - setAction(&_sequenceManager, this, 3257, &R2_GLOBALS._player, &_quinn, &_actor3, NULL); + setAction(&_sequenceManager, this, 3257, &R2_GLOBALS._player, &_quinn, &_door, NULL); } else { _teal.postInit(); _teal.setup(303, 1, 1); @@ -1320,7 +1328,7 @@ void Scene3255::signal() { _ghoul2.postInit(); _ghoul3.postInit(); setAction(&_sequenceManager, this, 3258, &R2_GLOBALS._player, &_quinn, - &_actor3, &_ghoul1, &_ghoul2, &_ghoul3, NULL); + &_door, &_ghoul1, &_ghoul2, &_ghoul3, NULL); break; case 3256: R2_GLOBALS._sceneManager.changeScene(3250); @@ -1334,7 +1342,7 @@ void Scene3255::signal() { R2_GLOBALS._sceneManager.changeScene(3100); break; default: - SceneItem::display(3255, 0, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + SceneItem::display(3255, 0, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); _sceneMode = 3256; setAction(&_sequenceManager, this, 3256, &R2_GLOBALS._player, NULL); } @@ -1542,7 +1550,7 @@ void Scene3260::signal() { case 3272: _sceneMode = 3273; R2_GLOBALS._events.setCursor(CURSOR_WALK); - SceneItem::display(3260, 15, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + SceneItem::display(3260, 15, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END); R2_GLOBALS._player.disableControl(); R2_INVENTORY.setObjectScene(R2_TOOLBOX, 3); R2_INVENTORY.setObjectScene(R2_LASER_HACKSAW, 3); @@ -1600,9 +1608,9 @@ void Scene3275::postInit(SceneObjectList *OwnerList) { _cellExit.setDetails(Rect(398, 60, 439, 118), SHADECURSOR_UP, 3150); _cellExit.setDest(Common::Point(418, 128)); - _actor1.postInit(); - _actor1.setup(3275, 1, 7); - _actor1.setPosition(Common::Point(419, 119)); + _doorFrame.postInit(); + _doorFrame.setup(3275, 1, 7); + _doorFrame.setPosition(Common::Point(419, 119)); _door.postInit(); _door.setup(3275, 2, 1); @@ -1673,27 +1681,27 @@ void Scene3350::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.hide(); R2_GLOBALS._player.disableControl(); - _actor1.postInit(); - _actor1.hide(); - _actor2.postInit(); - _actor2.hide(); - _actor3.postInit(); - _actor3.hide(); - _actor4.postInit(); - _actor4.hide(); - _actor9.postInit(); - _actor9.hide(); - _actor8.postInit(); - _actor8.hide(); - _actor5.postInit(); - _actor5.hide(); - _actor6.postInit(); - _actor6.hide(); - _actor7.postInit(); - _actor7.hide(); + _miranda.postInit(); + _miranda.hide(); + _seeker.postInit(); + _seeker.hide(); + _webbster.postInit(); + _webbster.hide(); + _seatedPeople.postInit(); + _seatedPeople.hide(); + _shipFront.postInit(); + _shipFront.hide(); + _canopy.postInit(); + _canopy.hide(); + _ship.postInit(); + _ship.hide(); + _landedShip.postInit(); + _landedShip.hide(); + _shipShadow.postInit(); + _shipShadow.hide(); _sceneMode = 3350; - setAction(&_sequenceManager, this, _sceneMode, &_actor5, &_actor6, &_actor7, NULL); + setAction(&_sequenceManager, this, _sceneMode, &_ship, &_landedShip, &_shipShadow, NULL); } void Scene3350::remove() { @@ -1705,11 +1713,12 @@ void Scene3350::signal() { switch (_sceneMode) { case 3350: _sceneMode = 3351; - setAction(&_sequenceManager, this, 3351, &_actor4, &_actor9, &_actor8, NULL); + setAction(&_sequenceManager, this, 3351, &_seatedPeople, &_shipFront, &_canopy, NULL); break; case 3351: _sceneMode = 3352; - setAction(&_sequenceManager, this, 3352, &_actor4, &R2_GLOBALS._player, &_actor1, &_actor2, &_actor3, NULL); + setAction(&_sequenceManager, this, 3352, &_seeker, &R2_GLOBALS._player, + &_miranda, &_seeker, &_webbster, NULL); break; case 3352: R2_GLOBALS._sceneManager.changeScene(3395); @@ -1728,8 +1737,7 @@ void Scene3350::signal() { void Scene3375::synchronize(Serializer &s) { SceneExt::synchronize(s); - s.syncAsSint16LE(_field1488); - s.syncAsSint16LE(_field1492); + s.syncAsSint16LE(_newSceneMode); for (int i = 0; i < 4; ++i) s.syncAsSint16LE(_sceneAreas[i]); } @@ -1922,7 +1930,7 @@ void Scene3375::DownExit::changeScene() { R2_GLOBALS._player.disableControl(CURSOR_ARROW); scene->_sceneMode = 3377; - scene->_field1488 = 3381; + scene->_newSceneMode = 3381; if (R2_GLOBALS._walkwaySceneNumber != 0) { R2_GLOBALS._walkRegions.enableRegion(2); @@ -1944,7 +1952,7 @@ void Scene3375::RightExit::changeScene() { R2_GLOBALS._player.disableControl(CURSOR_ARROW); scene->_sceneMode = 3378; - scene->_field1488 = 3380; + scene->_newSceneMode = 3380; if (R2_GLOBALS._walkwaySceneNumber != 0) { R2_GLOBALS._walkRegions.enableRegion(2); @@ -1958,7 +1966,7 @@ void Scene3375::RightExit::changeScene() { } Scene3375::Scene3375() { - _field1488 = _field1492 = 0; + _newSceneMode = 0; _sceneAreas[0] = 3376; _sceneAreas[1] = 3377; @@ -2172,8 +2180,9 @@ void Scene3375::signal() { case 3377: // No break on purpose case 3378: - _sceneMode = _field1488; - _field1488 = 0; + _sceneMode = _newSceneMode; + _newSceneMode = 0; + _companion1._effect = 6; _companion1._shade = 4; _companion2._effect = 6; @@ -2231,13 +2240,13 @@ void Scene3375::dispatch() { *--------------------------------------------------------------------------*/ Scene3385::Scene3385() { - _field11B2 = 0; + _playerStrip = 0; } void Scene3385::synchronize(Serializer &s) { SceneExt::synchronize(s); - s.syncAsSint16LE(_field11B2); + s.syncAsSint16LE(_playerStrip); } bool Scene3385::Companion1::startAction(CursorType action, Event &event) { @@ -2342,9 +2351,9 @@ void Scene3385::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player._characterScene[R2_MIRANDA] = 3385; if (R2_GLOBALS._sceneManager._previousScene == 3375) - _field11B2 = 3; + _playerStrip = 3; else - _field11B2 = 4; + _playerStrip = 4; setZoomPercents(102, 40, 200, 160); R2_GLOBALS._player.postInit(); @@ -2357,11 +2366,11 @@ void Scene3385::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.changeZoom(-1); if (R2_GLOBALS._player._characterIndex == R2_SEEKER) - R2_GLOBALS._player.setup(20, _field11B2, 1); + R2_GLOBALS._player.setup(20, _playerStrip, 1); else if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) - R2_GLOBALS._player.setup(30, _field11B2, 1); + R2_GLOBALS._player.setup(30, _playerStrip, 1); else - R2_GLOBALS._player.setup(10, _field11B2, 1); + R2_GLOBALS._player.setup(10, _playerStrip, 1); R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); R2_GLOBALS._player.disableControl(); @@ -2377,9 +2386,9 @@ void Scene3385::postInit(SceneObjectList *OwnerList) { _companion1.changeZoom(-1); _companion1._effect = 1; if (R2_GLOBALS._player._characterIndex == R2_SEEKER) - _companion1.setup(10, _field11B2, 1); + _companion1.setup(10, _playerStrip, 1); else - _companion1.setup(20, _field11B2, 1); + _companion1.setup(20, _playerStrip, 1); _companion1.animate(ANIM_MODE_1, NULL); _companion1.setDetails(3385, -1, -1, -1, 1, (SceneItem *) NULL); @@ -2388,9 +2397,9 @@ void Scene3385::postInit(SceneObjectList *OwnerList) { _companion2.changeZoom(-1); _companion2._effect = 1; if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) - _companion2.setup(10, _field11B2, 1); + _companion2.setup(10, _playerStrip, 1); else - _companion2.setup(30, _field11B2, 1); + _companion2.setup(30, _playerStrip, 1); _companion2.animate(ANIM_MODE_1, NULL); _companion2.setDetails(3385, -1, -1, -1, 1, (SceneItem *) NULL); @@ -2398,7 +2407,7 @@ void Scene3385::postInit(SceneObjectList *OwnerList) { _webbster._moveDiff = Common::Point(3, 2); _webbster.changeZoom(-1); _webbster._effect = 1; - _webbster.setup(40, _field11B2, 1); + _webbster.setup(40, _playerStrip, 1); _webbster.animate(ANIM_MODE_1, NULL); _webbster.setDetails(3385, 15, -1, -1, 1, (SceneItem *) NULL); @@ -2468,13 +2477,13 @@ void Scene3385::signal() { *--------------------------------------------------------------------------*/ Scene3395::Scene3395() { - _field142E = 0; + _playerStrip = 0; } void Scene3395::synchronize(Serializer &s) { SceneExt::synchronize(s); - s.syncAsSint16LE(_field142E); + s.syncAsSint16LE(_playerStrip); } bool Scene3395::Companion1::startAction(CursorType action, Event &event) { @@ -2565,9 +2574,9 @@ void Scene3395::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player._characterScene[R2_MIRANDA] = 3395; if (R2_GLOBALS._sceneManager._previousScene == 3385) - _field142E = 3; + _playerStrip = 3; else - _field142E = 4; + _playerStrip = 4; setZoomPercents(51, 40, 200, 137); R2_GLOBALS._player.postInit(); @@ -2580,11 +2589,11 @@ void Scene3395::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.changeZoom(-1); if (R2_GLOBALS._player._characterIndex == R2_SEEKER) - R2_GLOBALS._player.setup(20, _field142E, 1); + R2_GLOBALS._player.setup(20, _playerStrip, 1); else if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) - R2_GLOBALS._player.setup(30, _field142E, 1); + R2_GLOBALS._player.setup(30, _playerStrip, 1); else - R2_GLOBALS._player.setup(10, _field142E, 1); + R2_GLOBALS._player.setup(10, _playerStrip, 1); R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); R2_GLOBALS._player.disableControl(); @@ -2600,9 +2609,9 @@ void Scene3395::postInit(SceneObjectList *OwnerList) { _companion1.changeZoom(-1); _companion1._effect = 1; if (R2_GLOBALS._player._characterIndex == R2_SEEKER) - _companion1.setup(10, _field142E, 1); + _companion1.setup(10, _playerStrip, 1); else - _companion1.setup(20, _field142E, 1); + _companion1.setup(20, _playerStrip, 1); _companion1.animate(ANIM_MODE_1, NULL); _companion1.setDetails(3395, -1, -1, -1, 1, (SceneItem *) NULL); @@ -2611,9 +2620,9 @@ void Scene3395::postInit(SceneObjectList *OwnerList) { _companion2.changeZoom(-1); _companion2._effect = 1; if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) - _companion2.setup(10, _field142E, 1); + _companion2.setup(10, _playerStrip, 1); else - _companion2.setup(30, _field142E, 1); + _companion2.setup(30, _playerStrip, 1); _companion2.animate(ANIM_MODE_1, NULL); _companion2.setDetails(3395, -1, -1, -1, 1, (SceneItem *) NULL); @@ -2621,7 +2630,7 @@ void Scene3395::postInit(SceneObjectList *OwnerList) { _webbster._moveDiff = Common::Point(3, 2); _webbster.changeZoom(-1); _webbster._effect = 1; - _webbster.setup(40, _field142E, 1); + _webbster.setup(40, _playerStrip, 1); _webbster.animate(ANIM_MODE_1, NULL); _webbster.setDetails(3395, 18, -1, -1, 1, (SceneItem *) NULL); @@ -2691,13 +2700,13 @@ void Scene3395::signal() { *--------------------------------------------------------------------------*/ Scene3400::Scene3400() { - _field157C = 0; + _soundFaded = false; } void Scene3400::synchronize(Serializer &s) { SceneExt::synchronize(s); - s.syncAsSint16LE(_field157C); + s.syncAsSint16LE(_soundFaded); } void Scene3400::postInit(SceneObjectList *OwnerList) { @@ -2705,7 +2714,7 @@ void Scene3400::postInit(SceneObjectList *OwnerList) { _sceneBounds = Rect(160, 0, 480, 200); loadScene(3400); - _field157C = 0; + _soundFaded = false; R2_GLOBALS._v558B6.set(60, 0, 260, 200); SceneExt::postInit(); R2_GLOBALS._sound1.play(317); @@ -2834,9 +2843,9 @@ void Scene3400::signal() { case 3307: case 3404: case 3408: - if (_field157C == 0) { + if (!_soundFaded) { R2_GLOBALS._sound2.fadeOut2(NULL); - _field157C = 1; + _soundFaded = true; } else { _sceneMode = 3308; _stripManager.start(3308, this); @@ -3035,7 +3044,7 @@ void Scene3500::Action1::signal() { switch(_actionIndex++) { case 0: R2_GLOBALS._player.disableControl(); - scene->_field1286 = 0; + scene->_directionChangesEnabled = false; if (scene->_field1270 != 0) { scene->_field1270 = 0; scene->_mazeChangeAmount = 0; @@ -3175,7 +3184,7 @@ void Scene3500::Action1::signal() { case 8: { R2_GLOBALS._player.enableControl(); R2_GLOBALS._player._canWalk = false; - scene->_field1286 = 1; + scene->_directionChangesEnabled = true; if ((scene->_actor1._frame % 2) == 0) { scene->_actor1._frameChange = _field1E; scene->_actor1.setFrame(scene->_actor1.changeFrame()); @@ -3276,214 +3285,6 @@ void Scene3500::Action2::synchronize(Serializer &s) { s.syncAsSint16LE(_field1E); } -/*--------------------------------------------------------------------------*/ - -Scene3500::Item4::Item4() { - _field34 = 0; -} - -void Scene3500::Item4::synchronize(Serializer &s) { - NamedHotspot::synchronize(s); - - s.syncAsSint16LE(_field34); -} - -/*--------------------------------------------------------------------------*/ - -Scene3500::Actor7::Actor7() { - _fieldA4 = 0; - _fieldA6 = 0; - _fieldA8 = 0; - _fieldAA = 0; - _fieldAC = 0; - _fieldAE = 0; -} - -void Scene3500::Actor7::synchronize(Serializer &s) { - SceneActor::synchronize(s); - - s.syncAsSint16LE(_fieldA4); - s.syncAsSint16LE(_fieldA6); - s.syncAsSint16LE(_fieldA8); - s.syncAsSint16LE(_fieldAA); - s.syncAsSint16LE(_fieldAC); - s.syncAsSint16LE(_fieldAE); -} - -void Scene3500::Actor7::sub109466(int arg1, int arg2, int arg3, int arg4, int arg5) { - _fieldAE = 0; - _fieldA4 = arg1; - _fieldA6 = arg2; - _fieldA8 = arg3; - _fieldAA = arg4; - _fieldAC = _fieldAA / _fieldA8; - - postInit(); - setup(1050, 3, 1); - fixPriority(255); - sub109663(arg5); -} - -void Scene3500::Actor7::sub1094ED() { - Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene; - - scene->_field1270 = _position.x - _fieldA4; -} - -void Scene3500::Actor7::sub109663(int arg1){ - sub109693(Common::Point(_fieldA4 + arg1, _fieldA6 - (_fieldAC * arg1))); -} - -void Scene3500::Actor7::sub109693(Common::Point Pt) { - setPosition(Pt); -} - -/*--------------------------------------------------------------------------*/ - -int Scene3500::MazeUI3500::cellFromX(int x) { - return (_cellSize.x / 2) + x - (x % _cellSize.x); -} - -int Scene3500::MazeUI3500::cellFromY(int y) { - return (_cellSize.y / 2) + y - (y % _cellSize.y) - 1; -} - -int Scene3500::MazeUI3500::getCellFromMapXY(Common::Point pt) { - int cellX = pt.x / _cellSize.x; - int cellY = pt.y / _cellSize.y; - - if ((cellX >= 0) && (cellY >= 0) && (cellX < _mapCells.x) && (cellY < _mapCells.y)) { - return (int16)READ_LE_UINT16(_mapData + (_mapCells.x * cellY + cellX) * 2); - } else - return -1; -} - -bool Scene3500::MazeUI3500::setMazePosition2(Common::Point &p) { - bool retVal = setMazePosition(p); - p = _mapOffset; - - return retVal; -} - -Scene3500::Scene3500() { - _fieldAF8 = 0; - _fieldB9E = 0; - _rotation = NULL; - _mazeChangeAmount = 0; - _field1270 = 0; - _field1272 = 0; - _field1274 = 0; - _mazeDirection = MAZEDIR_NONE; - _field1278 = 0; - _mazePosition.x = 0; - _mazePosition.y = 0; - _field127E = 0; - _field1280 = 0; - _field1282 = 0; - _field1284 = 0; - _field1286 = 0; -} - -void Scene3500::synchronize(Serializer &s) { - SceneExt::synchronize(s); - SYNC_POINTER(_rotation); - - s.syncAsSint16LE(_fieldAF8); - s.syncAsSint16LE(_fieldB9E); - s.syncAsSint16LE(_mazeChangeAmount); - s.syncAsSint16LE(_field1270); - s.syncAsSint16LE(_field1272); - s.syncAsSint16LE(_field1274); - s.syncAsSint16LE(_mazeDirection); - s.syncAsSint16LE(_field1278); - s.syncAsSint16LE(_mazePosition.x); - s.syncAsSint16LE(_mazePosition.y); - s.syncAsSint16LE(_field127E); - s.syncAsSint16LE(_field1280); - s.syncAsSint16LE(_field1282); - s.syncAsSint16LE(_field1284); - s.syncAsSint16LE(_field1286); -} - -void Scene3500::sub107F71(int arg1) { - switch (arg1) { - case -1: - _actor7.sub1094ED(); - if (_field1270 != 0) { - _field1270--; - _actor7.sub109663(_field1270); - } - if (_action1._field24 != 0) - _field1270 = 0; - break; - case 1: - _actor7.sub1094ED(); - if (_field1270 < 16) { - ++_field1270; - _actor7.sub109663(_field1270); - } - if (_action1._field24 != 0) - _field1270 = 0; - break; - case 88: - if ((_action == 0) || (_action1._field24 == 0)) { - // The original makes a second useless check on action, skipped - _action2.sub10831F(2); - if ((_action) && ((_action2.getActionIndex() != 0) || (_action2._field1E != 2))) { - _action2.signal(); - } else { - _actor9.setAction(&_action2, &_actor9, NULL); - } - } - break; - case 96: - if ((_action) && (_action1._field24 != 0) && (_action2._field1E != 1)) { - _field1278 = 0; - _action1.sub108732(0); - } else if ((_action) && (_field1278 == 0) && (_action1._field24 != 0)) { - _field1278 = arg1; - } else if ((_action) && (_action1._field24 == 0)) { - _action1.sub108670(1); - _action1.signal(); - } else if (_action == 0) { - _action1.sub108670(1); - setAction(&_action1, &_actor1, NULL); - } - break; - case 104: - if ((_action == 0) || (_action1._field24 == 0)) { - _action2.sub10831F(-1); - if ((_action) && ((_action2.getActionIndex() != 0) || (_action2._field1E != -1))) { - _action2.signal(); - } else { - _actor9.setAction(&_action2, &_actor9, NULL); - } - } - break; - case 112: - if ((_action) && (_action1._field24 != 0) && (_action2._field1E != -1)) { - _field1278 = 0; - _action1.sub108732(0); - } else if ((_action) && (_field1278 == 0) && (_action1._field24 != 0)) { - _field1278 = arg1; - } else if ((_action) && (_action1._field24 == 0)) { - _action1.sub108670(-1); - _action1.signal(); - } else if (_action == 0) { - _action1.sub108670(-1); - setAction(&_action1, &_actor1, NULL); - } - break; - default: - _field1270 = arg1; - _actor7.sub109663(arg1); - if (_action1._field24 != 0) { - _field1270 = 0; - } - break; - } -} - void Scene3500::Action2::sub10831F(int arg1) { Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene; @@ -3557,25 +3358,83 @@ void Scene3500::Action2::signal() { } } -bool Scene3500::Item4::startAction(CursorType action, Event &event) { +/*--------------------------------------------------------------------------*/ + +Scene3500::DirectionButton::DirectionButton() { + _movementId = 0; +} + +void Scene3500::DirectionButton::synchronize(Serializer &s) { + NamedHotspot::synchronize(s); + + s.syncAsSint16LE(_movementId); +} + +bool Scene3500::DirectionButton::startAction(CursorType action, Event &event) { Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene; - if (scene->_field1286 == 0) + if (!scene->_directionChangesEnabled) { return true; - - if (scene->_field1286 != 4) + } else if (action == CURSOR_USE) { + R2_GLOBALS._sound2.play(14, nullptr, 63); + scene->doMovement(_movementId); + return true; + } else { return SceneHotspot::startAction(action, event); + } +} - R2_GLOBALS._sound2.play(14); - scene->sub107F71(_field34); +/*--------------------------------------------------------------------------*/ - return true; +Scene3500::Actor7::Actor7() { + _fieldA8 = 0; + _fieldAA = 0; + _fieldAC = 0; + _fieldAE = 0; +} + +void Scene3500::Actor7::synchronize(Serializer &s) { + SceneActor::synchronize(s); + + s.syncAsSint16LE(_pos.x); + s.syncAsSint16LE(_pos.y); + s.syncAsSint16LE(_fieldA8); + s.syncAsSint16LE(_fieldAA); + s.syncAsSint16LE(_fieldAC); + s.syncAsSint16LE(_fieldAE); +} + +void Scene3500::Actor7::sub109466(int xp, int yp, int arg3, int arg4, int arg5) { + _fieldAE = 0; + _pos = Common::Point(xp, yp); + _fieldA8 = arg3; + _fieldAA = arg4; + _fieldAC = _fieldAA / _fieldA8; + + postInit(); + setup(1050, 3, 1); + fixPriority(255); + sub109663(arg5); +} + +void Scene3500::Actor7::sub1094ED() { + Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene; + + scene->_field1270 = _position.x - _pos.x; +} + +void Scene3500::Actor7::sub109663(int arg1){ + changePosition(Common::Point(_pos.x + arg1, _pos.y - (_fieldAC * arg1))); +} + +void Scene3500::Actor7::changePosition(const Common::Point &pt) { + setPosition(pt); } void Scene3500::Actor7::process(Event &event) { Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene; - if (scene->_field1286 == 0) + if (!scene->_directionChangesEnabled) return; if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == CURSOR_USE) && (_bounds.contains(event.mousePos))) { @@ -3597,26 +3456,95 @@ void Scene3500::Actor7::process(Event &event) { event.handled = true; int cx = event.mousePos.y - _fieldAE + 1; - if (_fieldA6 >= cx) { - if (_fieldA6 - _fieldAA <= cx) - sub109693(Common::Point(((_fieldA6 - cx) / 2) + _fieldA4 + ((_fieldA6 - cx) % 2), cx)); + if (_pos.y >= cx) { + if (_pos.y - _fieldAA <= cx) + changePosition(Common::Point(((_pos.y - cx) / 2) + _pos.x + ((_pos.y - cx) % 2), cx)); else - sub109693(Common::Point(_fieldA4 + _fieldA8, _fieldA6 - _fieldAA)); + changePosition(Common::Point(_pos.x + _fieldA8, _pos.y - _fieldAA)); } else { - sub109693(Common::Point(_fieldA4, _fieldA6)); + changePosition(Common::Point(_pos.x, _pos.y)); } } bool Scene3500::Actor7::startAction(CursorType action, Event &event) { Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene; - if (scene->_field1286 == 0) + if (!scene->_directionChangesEnabled) { return true; - - if (scene->_field1286 == 4) + } else if (action == CURSOR_USE) { return false; + } else { + return SceneActor::startAction(action, event); + } +} - return SceneActor::startAction(action, event); +/*--------------------------------------------------------------------------*/ + +int Scene3500::MazeUI3500::cellFromX(int x) { + return (_cellSize.x / 2) + x - (x % _cellSize.x); +} + +int Scene3500::MazeUI3500::cellFromY(int y) { + return (_cellSize.y / 2) + y - (y % _cellSize.y) - 1; +} + +int Scene3500::MazeUI3500::getCellFromMapXY(Common::Point pt) { + int cellX = pt.x / _cellSize.x; + int cellY = pt.y / _cellSize.y; + + if ((cellX >= 0) && (cellY >= 0) && (cellX < _mapCells.x) && (cellY < _mapCells.y)) { + return (int16)READ_LE_UINT16(_mapData + (_mapCells.x * cellY + cellX) * 2); + } else + return -1; +} + +bool Scene3500::MazeUI3500::setMazePosition2(Common::Point &p) { + bool retVal = setMazePosition(p); + p = _mapOffset; + + return retVal; +} + +/*--------------------------------------------------------------------------*/ + +Scene3500::Scene3500() { + _fieldAF8 = 0; + _fieldB9E = 0; + _rotation = NULL; + _mazeChangeAmount = 0; + _field1270 = 0; + _field1272 = 0; + _field1274 = 0; + _mazeDirection = MAZEDIR_NONE; + _field1278 = 0; + _mazePosition.x = 0; + _mazePosition.y = 0; + _field127E = 0; + _field1280 = 0; + _field1282 = 0; + _field1284 = 0; + _directionChangesEnabled = false; +} + +void Scene3500::synchronize(Serializer &s) { + SceneExt::synchronize(s); + SYNC_POINTER(_rotation); + + s.syncAsSint16LE(_fieldAF8); + s.syncAsSint16LE(_fieldB9E); + s.syncAsSint16LE(_mazeChangeAmount); + s.syncAsSint16LE(_field1270); + s.syncAsSint16LE(_field1272); + s.syncAsSint16LE(_field1274); + s.syncAsSint16LE(_mazeDirection); + s.syncAsSint16LE(_field1278); + s.syncAsSint16LE(_mazePosition.x); + s.syncAsSint16LE(_mazePosition.y); + s.syncAsSint16LE(_field127E); + s.syncAsSint16LE(_field1280); + s.syncAsSint16LE(_field1282); + s.syncAsSint16LE(_field1284); + s.syncAsSint16LE(_directionChangesEnabled); } void Scene3500::postInit(SceneObjectList *OwnerList) { @@ -3664,17 +3592,17 @@ void Scene3500::postInit(SceneObjectList *OwnerList) { _actor7.setDetails(3500, 6, 7, -1, 1, (SceneItem *)NULL); R2_GLOBALS._sound1.play(276); - _item4._field34 = 88; - _item4.setDetails(88, 3500, 18, 10, -1); + _pitchDown._movementId = 88; + _pitchDown.setDetails(88, 3500, 18, 10, -1); - _item5._field34 = 112; - _item5.setDetails(112, 3500, 9, 10, -1); + _turnLeft._movementId = 112; + _turnLeft.setDetails(112, 3500, 9, 10, -1); - _item6._field34 = 104; - _item6.setDetails(104, 3500, 15, 10, -1); + _pitchUp._movementId = 104; + _pitchUp.setDetails(104, 3500, 15, 10, -1); - _item7._field34 = 96; - _item7.setDetails(96, 3500, 12, 10, -1); + _turnRight._movementId = 96; + _turnRight.setDetails(96, 3500, 12, 10, -1); _actor8.postInit(); _actor8.setup(1050, 1, 1); @@ -3731,7 +3659,7 @@ void Scene3500::postInit(SceneObjectList *OwnerList) { _action1._field24 = 0; _mazeUI.draw(); - _field1286 = 1; + _directionChangesEnabled = true; R2_GLOBALS._player.postInit(); R2_GLOBALS._player.hide(); @@ -3740,6 +3668,85 @@ void Scene3500::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player._canWalk = false; } +void Scene3500::doMovement(int id) { + switch (id) { + case -1: + _actor7.sub1094ED(); + if (_field1270 != 0) { + _field1270--; + _actor7.sub109663(_field1270); + } + if (_action1._field24 != 0) + _field1270 = 0; + break; + case 1: + _actor7.sub1094ED(); + if (_field1270 < 16) { + ++_field1270; + _actor7.sub109663(_field1270); + } + if (_action1._field24 != 0) + _field1270 = 0; + break; + case 88: + if ((_action == 0) || (_action1._field24 == 0)) { + // The original makes a second useless check on action, skipped + _action2.sub10831F(2); + if ((_action) && ((_action2.getActionIndex() != 0) || (_action2._field1E != 2))) { + _action2.signal(); + } else { + _actor9.setAction(&_action2, &_actor9, NULL); + } + } + break; + case 96: + if ((_action) && (_action1._field24 != 0) && (_action2._field1E != 1)) { + _field1278 = 0; + _action1.sub108732(0); + } else if ((_action) && (_field1278 == 0) && (_action1._field24 != 0)) { + _field1278 = id; + } else if ((_action) && (_action1._field24 == 0)) { + _action1.sub108670(1); + _action1.signal(); + } else if (_action == 0) { + _action1.sub108670(1); + setAction(&_action1, &_actor1, NULL); + } + break; + case 104: + if ((_action == 0) || (_action1._field24 == 0)) { + _action2.sub10831F(-1); + if ((_action) && ((_action2.getActionIndex() != 0) || (_action2._field1E != -1))) { + _action2.signal(); + } else { + _actor9.setAction(&_action2, &_actor9, NULL); + } + } + break; + case 112: + if ((_action) && (_action1._field24 != 0) && (_action2._field1E != -1)) { + _field1278 = 0; + _action1.sub108732(0); + } else if ((_action) && (_field1278 == 0) && (_action1._field24 != 0)) { + _field1278 = id; + } else if ((_action) && (_action1._field24 == 0)) { + _action1.sub108670(-1); + _action1.signal(); + } else if (_action == 0) { + _action1.sub108670(-1); + setAction(&_action1, &_actor1, NULL); + } + break; + default: + _field1270 = id; + _actor7.sub109663(id); + if (_action1._field24 != 0) { + _field1270 = 0; + } + break; + } +} + void Scene3500::remove() { R2_GLOBALS._sound2.fadeOut2(NULL); SceneExt::remove(); @@ -3748,69 +3755,69 @@ void Scene3500::remove() { void Scene3500::signal() { R2_GLOBALS._player.enableControl(CURSOR_USE); R2_GLOBALS._player._canWalk = false; - _field1286 = 1; + _directionChangesEnabled = true; } void Scene3500::process(Event &event) { - if (_field1286 == 0) + if (!_directionChangesEnabled) return; if (event.eventType == EVENT_KEYPRESS) { switch (event.kbd.keycode) { case Common::KEYCODE_KP7: R2_GLOBALS._sound2.play(338); - sub107F71(16); + doMovement(16); event.handled = true; break; case Common::KEYCODE_UP: case Common::KEYCODE_KP8: R2_GLOBALS._sound2.play(14, NULL, 63); - sub107F71(88); + doMovement(88); event.handled = true; break; case Common::KEYCODE_KP9: if (_field1270 < 16) R2_GLOBALS._sound2.play(338); - sub107F71(1); + doMovement(1); event.handled = true; break; case Common::KEYCODE_KP4: case Common::KEYCODE_LEFT: R2_GLOBALS._sound2.play(14, NULL, 63); - sub107F71(112); + doMovement(112); event.handled = true; break; case Common::KEYCODE_KP6: case Common::KEYCODE_RIGHT: R2_GLOBALS._sound2.play(14, NULL, 63); - sub107F71(96); + doMovement(96); event.handled = true; break; case Common::KEYCODE_KP1: R2_GLOBALS._sound2.play(338); - sub107F71(0); + doMovement(0); event.handled = true; break; case Common::KEYCODE_KP2: case Common::KEYCODE_DOWN: R2_GLOBALS._sound2.play(14, NULL, 63); - sub107F71(104); + doMovement(104); event.handled = true; break; case Common::KEYCODE_KP3: if (_field1270 != 0) R2_GLOBALS._sound2.play(338); - sub107F71(-1); + doMovement(-1); event.handled = true; break; case Common::KEYCODE_KP0: R2_GLOBALS._sound2.play(338); - sub107F71(8); + doMovement(8); event.handled = true; break; case Common::KEYCODE_KP_PERIOD: R2_GLOBALS._sound2.play(338); - sub107F71(4); + doMovement(4); event.handled = true; break; default: @@ -3822,16 +3829,16 @@ void Scene3500::process(Event &event) { _actor7.process(event); if (!event.handled) - _item4.process(event); + _pitchDown.process(event); if (!event.handled) - _item5.process(event); + _turnLeft.process(event); if (!event.handled) - _item6.process(event); + _pitchUp.process(event); if (!event.handled) - _item7.process(event); + _turnRight.process(event); Scene::process(event); } @@ -3848,7 +3855,7 @@ void Scene3500::dispatch() { if ((_field1278 != 0) && (_action1._field24 == 0)) { oldField1278 = _field1278; _field1278 = 0; - sub107F71(oldField1278); + doMovement(oldField1278); } if (!_rotation) @@ -4240,19 +4247,15 @@ void Scene3500::dispatch() { *--------------------------------------------------------------------------*/ Scene3600::Scene3600() { - _field2548 = 0; - _field254A = 0; - _field254C = 0; - _field254E = 0; + _tealDead = false; + _lightEntered = false; _ghoulTeleported = false; } void Scene3600::synchronize(Serializer &s) { SceneExt::synchronize(s); - s.syncAsSint16LE(_field2548); - s.syncAsSint16LE(_field254A); - s.syncAsSint16LE(_field254C); - s.syncAsSint16LE(_field254E); + s.syncAsSint16LE(_tealDead); + s.syncAsSint16LE(_lightEntered); s.syncAsSint16LE(_ghoulTeleported); } @@ -4279,7 +4282,7 @@ void Scene3600::Action3600::signal() { case 1: if (_field1E == 0) { _field1E = 1; - scene->_actor2.setAction(NULL); + scene->_steppingDisk.setAction(NULL); R2_GLOBALS._sound2.play(330, NULL, 0); R2_GLOBALS._sound2.fade(127, 5, 10, false, NULL); } @@ -4329,7 +4332,7 @@ void Scene3600::Action2::signal() { } } -bool Scene3600::Item5::startAction(CursorType action, Event &event) { +bool Scene3600::LightShaft::startAction(CursorType action, Event &event) { Scene3600 *scene = (Scene3600 *)R2_GLOBALS._sceneManager._scene; if ((action != CURSOR_USE) || (scene->_action1._field1E == 0)) @@ -4340,10 +4343,10 @@ bool Scene3600::Item5::startAction(CursorType action, Event &event) { R2_GLOBALS._player.disableControl(); scene->_sceneMode = 3624; - scene->_actor10.setStrip2(-1); - scene->_actor11.setStrip2(-1); - scene->_actor12.setStrip2(-1); - scene->_actor4.setStrip2(-1); + scene->_quinn.setStrip2(-1); + scene->_seeker.setStrip2(-1); + scene->_miranda.setStrip2(-1); + scene->_webbster.setStrip2(-1); if (R2_GLOBALS._player._characterIndex == R2_SEEKER) R2_GLOBALS._player.setAction(&scene->_sequenceManager3, scene, 3611, &R2_GLOBALS._player, NULL); @@ -4366,14 +4369,14 @@ bool Scene3600::Protector::startAction(CursorType action, Event &event) { scene->_protectorSpeaker._displayMode = 1; if (!R2_GLOBALS._player._mover) R2_GLOBALS._player.addMover(NULL); - if (!scene->_actor10._mover) - scene->_actor10.addMover(NULL); - if (!scene->_actor11._mover) - scene->_actor11.addMover(NULL); - if (!scene->_actor12._mover) - scene->_actor12.addMover(NULL); - if (!scene->_actor4._mover) - scene->_actor4.addMover(NULL); + if (!scene->_quinn._mover) + scene->_quinn.addMover(NULL); + if (!scene->_seeker._mover) + scene->_seeker.addMover(NULL); + if (!scene->_miranda._mover) + scene->_miranda.addMover(NULL); + if (!scene->_webbster._mover) + scene->_webbster.addMover(NULL); setup(3127, 2, 1); scene->_sceneMode = 3327; @@ -4413,14 +4416,13 @@ void Scene3600::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._scrollFollower = &R2_GLOBALS._player; R2_GLOBALS._v558B6.set(60, 0, 260, 200); } else { - R2_GLOBALS._scrollFollower = &_actor2; + R2_GLOBALS._scrollFollower = &_steppingDisk; _sceneBounds = Rect(160, 0, 480, 200); R2_GLOBALS._v558B6.set(25, 0, 260, 200); } loadScene(3600); SceneExt::postInit(); - _field254C = 0; _stripManager.setColors(60, 255); _stripManager.setFontNumber(3); @@ -4435,62 +4437,61 @@ void Scene3600::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player._characterScene[R2_SEEKER] = 3600; R2_GLOBALS._player._characterScene[R2_MIRANDA] = 3600; - _item2.setDetails(33, 3600, 6, -1, -1); - _item3.setDetails(Rect(3, 3, 22, 45), 3600, 9, -1, -1, 1, NULL); - _item4.setDetails(Rect(449, 3, 475, 45), 3600, 9, -1, -1, 1, NULL); + _console.setDetails(33, 3600, 6, -1, -1); + _tapestry1.setDetails(Rect(3, 3, 22, 45), 3600, 9, -1, -1, 1, NULL); + _tapestry2.setDetails(Rect(449, 3, 475, 45), 3600, 9, -1, -1, 1, NULL); - _actor10.postInit(); - _actor10._moveDiff = Common::Point(3, 2); - _actor10.changeZoom(-1); - _actor10._effect = 1; + _quinn.postInit(); + _quinn._moveDiff = Common::Point(3, 2); + _quinn.changeZoom(-1); + _quinn._effect = 1; if (R2_GLOBALS._player._characterIndex != 1) - _actor10.setDetails(9001, 0, -1, -1, 1, (SceneItem *) NULL); + _quinn.setDetails(9001, 0, -1, -1, 1, (SceneItem *) NULL); - _actor11.postInit(); - _actor11._numFrames = 7; - _actor11._moveDiff = Common::Point(5, 3); - _actor11.changeZoom(-1); - _actor11._effect = 1; + _seeker.postInit(); + _seeker._numFrames = 7; + _seeker._moveDiff = Common::Point(5, 3); + _seeker.changeZoom(-1); + _seeker._effect = 1; if (R2_GLOBALS._player._characterIndex != 2) - _actor11.setDetails(9002, 1, -1, -1, 1, (SceneItem *) NULL); + _seeker.setDetails(9002, 1, -1, -1, 1, (SceneItem *) NULL); - _actor12.postInit(); - _actor12._moveDiff = Common::Point(3, 2); - _actor12.changeZoom(-1); - _actor12._effect = 1; + _miranda.postInit(); + _miranda._moveDiff = Common::Point(3, 2); + _miranda.changeZoom(-1); + _miranda._effect = 1; if (R2_GLOBALS._player._characterIndex != 3) - _actor12.setDetails(9003, 1, -1, -1, 1, (SceneItem *) NULL); + _miranda.setDetails(9003, 1, -1, -1, 1, (SceneItem *) NULL); R2_GLOBALS._player.postInit(); R2_GLOBALS._player.changeZoom(-1); R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); R2_GLOBALS._player.disableControl(); - _actor4.postInit(); - _actor4._numFrames = 7; - _actor4._moveDiff = Common::Point(5, 3); - _actor4.changeZoom(-1); - _actor4._effect = 1; - _actor4.setDetails(3600, 27, -1, -1, 1, (SceneItem *) NULL); + _webbster.postInit(); + _webbster._numFrames = 7; + _webbster._moveDiff = Common::Point(5, 3); + _webbster.changeZoom(-1); + _webbster._effect = 1; + _webbster.setDetails(3600, 27, -1, -1, 1, (SceneItem *) NULL); - _actor5.postInit(); - _actor5._numFrames = 7; - _actor5._moveDiff = Common::Point(3, 2); - _actor5.changeZoom(-1); - _actor5._effect = 1; - _actor5.setDetails(3600, 12, -1, -1, 1, (SceneItem *) NULL); + _teal.postInit(); + _teal._numFrames = 7; + _teal._moveDiff = Common::Point(3, 2); + _teal.changeZoom(-1); + _teal._effect = 1; + _teal.setDetails(3600, 12, -1, -1, 1, (SceneItem *) NULL); _palette1.loadPalette(0); _palette1.loadPalette(3601); if (R2_GLOBALS._sceneManager._previousScene == 3600) { - _item5._sceneRegionId = 200; - _item5.setDetails(3600, 30, -1, -1, 5, &_actor4); - _field254A = 1; - _field2548 = 1; + _lightShaft._sceneRegionId = 200; + _lightShaft.setDetails(3600, 30, -1, -1, 5, &_webbster); + _tealDead = true; R2_GLOBALS._walkRegions.disableRegion(2); R2_GLOBALS._walkRegions.disableRegion(7); @@ -4498,46 +4499,46 @@ void Scene3600::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._walkRegions.disableRegion(15); R2_GLOBALS._walkRegions.disableRegion(16); - _actor10.setup(10, 5, 11); - _actor10.animate(ANIM_MODE_1, NULL); + _quinn.setup(10, 5, 11); + _quinn.animate(ANIM_MODE_1, NULL); - _actor11.setup(20, 5, 11); - _actor11.animate(ANIM_MODE_1, NULL); + _seeker.setup(20, 5, 11); + _seeker.animate(ANIM_MODE_1, NULL); - _actor12.setup(30, 5, 11); - _actor12.animate(ANIM_MODE_1, NULL); + _miranda.setup(30, 5, 11); + _miranda.animate(ANIM_MODE_1, NULL); if (R2_GLOBALS._player._characterIndex == R2_SEEKER) { - _actor10.setPosition(Common::Point(76, 148)); - _actor11.setPosition(Common::Point(134, 148)); - _actor12.setPosition(Common::Point(100, 148)); + _quinn.setPosition(Common::Point(76, 148)); + _seeker.setPosition(Common::Point(134, 148)); + _miranda.setPosition(Common::Point(100, 148)); R2_GLOBALS._player._moveDiff = Common::Point(5, 3); - R2_GLOBALS._player.setup(20, _actor11._strip, 1); - R2_GLOBALS._player.setPosition(_actor11._position); - _actor11.hide(); + R2_GLOBALS._player.setup(20, _seeker._strip, 1); + R2_GLOBALS._player.setPosition(_seeker._position); + _seeker.hide(); } else if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) { - _actor10.setPosition(Common::Point(110, 148)); - _actor11.setPosition(Common::Point(76, 148)); - _actor12.setPosition(Common::Point(134, 148)); + _quinn.setPosition(Common::Point(110, 148)); + _seeker.setPosition(Common::Point(76, 148)); + _miranda.setPosition(Common::Point(134, 148)); R2_GLOBALS._player._moveDiff = Common::Point(3, 2); - R2_GLOBALS._player.setup(30, _actor12._strip, 1); - R2_GLOBALS._player.setPosition(_actor12._position); - _actor12.hide(); + R2_GLOBALS._player.setup(30, _miranda._strip, 1); + R2_GLOBALS._player.setPosition(_miranda._position); + _miranda.hide(); } else { - _actor10.setPosition(Common::Point(134, 148)); - _actor11.setPosition(Common::Point(76, 148)); - _actor12.setPosition(Common::Point(110, 148)); + _quinn.setPosition(Common::Point(134, 148)); + _seeker.setPosition(Common::Point(76, 148)); + _miranda.setPosition(Common::Point(110, 148)); R2_GLOBALS._player._moveDiff = Common::Point(3, 2); - R2_GLOBALS._player.setup(10, _actor10._strip, 1); - R2_GLOBALS._player.setPosition(_actor10._position); - _actor10.hide(); + R2_GLOBALS._player.setup(10, _quinn._strip, 1); + R2_GLOBALS._player.setPosition(_quinn._position); + _quinn.hide(); } - _actor4.setPosition(Common::Point(47, 149)); - _actor4.setup(40, 1, 11); - _actor4.animate(ANIM_MODE_1, NULL); + _webbster.setPosition(Common::Point(47, 149)); + _webbster.setup(40, 1, 11); + _webbster.animate(ANIM_MODE_1, NULL); - _actor5.setPosition(Common::Point(367, 148)); - _actor5.setup(3601, 7, 5); + _teal.setPosition(Common::Point(367, 148)); + _teal.setup(3601, 7, 5); if (!R2_GLOBALS.getFlag(71)) { _protector.postInit(); @@ -4551,65 +4552,64 @@ void Scene3600::postInit(SceneObjectList *OwnerList) { } R2_GLOBALS._sound2.play(330); - _actor3.postInit(); - _actor3.setPosition(Common::Point(84, 156)); - _actor3.fixPriority(158); - _actor3.setup(3601, 5, 1); - _actor3.animate(ANIM_MODE_2, NULL); + _consoleLights.postInit(); + _consoleLights.setPosition(Common::Point(84, 156)); + _consoleLights.fixPriority(158); + _consoleLights.setup(3601, 5, 1); + _consoleLights.animate(ANIM_MODE_2, NULL); _action1._field1E = 1; _action1._field20 = 0; _action1.setActionIndex(1); - _actor3.setAction(&_action1); + _consoleLights.setAction(&_action1); _sceneMode = 3623; g_globals->_events.setCursor(CURSOR_ARROW); R2_GLOBALS._player.enableControl(CURSOR_WALK); } else { - _field254A = 0; - _field2548 = 0; + _tealDead = false; R2_GLOBALS._walkRegions.disableRegion(17); R2_GLOBALS._walkRegions.disableRegion(18); - _actor10.setPosition(Common::Point(393, 148)); - _actor11.setPosition(Common::Point(364, 153)); - _actor12.setPosition(Common::Point(413, 164)); + _quinn.setPosition(Common::Point(393, 148)); + _seeker.setPosition(Common::Point(364, 153)); + _miranda.setPosition(Common::Point(413, 164)); R2_GLOBALS._player.hide(); - _actor4.setPosition(Common::Point(373, 164)); + _webbster.setPosition(Common::Point(373, 164)); - _actor5.setup(3403, 8, 11); - _actor5.setPosition(Common::Point(403, 155)); + _teal.setup(3403, 8, 11); + _teal.setPosition(Common::Point(403, 155)); _protector.setup(3403, 7, 1); _protector.setPosition(Common::Point(405, 155)); - _actor2.postInit(); - _actor2.setup(3600, 2, 1); - _actor2.setPosition(Common::Point(403, 161)); - _actor2.fixPriority(149); - _actor2.changeZoom(-1); + _steppingDisk.postInit(); + _steppingDisk.setup(3600, 2, 1); + _steppingDisk.setPosition(Common::Point(403, 161)); + _steppingDisk.fixPriority(149); + _steppingDisk.changeZoom(-1); _action1._field1E = 0; _action1._field20 = 90; _sceneMode = 3600; - setAction(&_sequenceManager1, this, 3600, &_actor11, &_actor10, &_actor12, &_actor4, &_actor5, &_actor2, NULL); - _field254E = 0; + setAction(&_sequenceManager1, this, 3600, &_seeker, &_quinn, &_miranda, + &_webbster, &_teal, &_steppingDisk, NULL); } - _field254E = 0; + _lightEntered = false; _ghoulTeleported = R2_GLOBALS.getFlag(71); R2_GLOBALS._sound1.play(326); - _item1.setDetails(Rect(0, 0, 480, 200), 3600, 0, -1, -1, 1, NULL); + _background.setDetails(Rect(0, 0, 480, 200), 3600, 0, -1, -1, 1, NULL); } void Scene3600::remove() { - _actor3.animate(ANIM_MODE_NONE, NULL); - _actor3.setAction(NULL); + _consoleLights.animate(ANIM_MODE_NONE, NULL); + _consoleLights.setAction(NULL); R2_GLOBALS._sound2.fadeOut2(NULL); R2_GLOBALS._sound1.fadeOut2(NULL); R2_GLOBALS._scrollFollower = &R2_GLOBALS._player; @@ -4621,27 +4621,29 @@ void Scene3600::signal() { case 3320: // TODO: warning("STUB: sub_1D227()"); R2_GLOBALS._walkRegions.disableRegion(14); - R2_GLOBALS._scrollFollower = &_actor11; + R2_GLOBALS._scrollFollower = &_seeker; _tealSpeaker._object1.hide(); - _actor5.show(); - _actor5.setStrip(2); + _teal.show(); + _teal.setStrip(2); if (R2_GLOBALS._player._characterIndex == R2_SEEKER) _sceneMode = 3602; else if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) _sceneMode = 3603; else _sceneMode = 3601; - setAction(&_sequenceManager1, this, _sceneMode, &_actor11, &_actor10, &_actor12, &_actor4, &_actor5, NULL); + setAction(&_sequenceManager1, this, _sceneMode, &_seeker, &_quinn, + &_miranda, &_webbster, &_teal, NULL); break; case 3321: warning("STUB: sub_1D227()"); R2_GLOBALS._scrollFollower = &R2_GLOBALS._player; _tealSpeaker.proc16(); - _actor5.show(); - _actor5.setStrip(1); - _actor3.postInit(); + _teal.show(); + _teal.setStrip(1); + _consoleLights.postInit(); _sceneMode = 3604; - setAction(&_sequenceManager1, this, _sceneMode, &_actor5, &_actor3, &_actor10, &_actor11, &_actor12, &_actor4, NULL); + setAction(&_sequenceManager1, this, _sceneMode, &_teal, &_consoleLights, + &_quinn, &_seeker, &_miranda, &_webbster, NULL); break; case 3322: warning("STUB: sub_1D227()"); @@ -4649,13 +4651,13 @@ void Scene3600::signal() { _quinnSpeaker._displayMode = 1; _tealSpeaker.proc16(); _tealSpeaker._displayMode = 7; - R2_GLOBALS._scrollFollower = &_actor5; + R2_GLOBALS._scrollFollower = &_teal; _sceneMode = 3605; - setAction(&_sequenceManager1, this, _sceneMode, &_actor5, &_protector, &_actor2, NULL); + setAction(&_sequenceManager1, this, _sceneMode, &_teal, &_protector, &_steppingDisk, NULL); break; case 3323: - if (_field254A == 0) - _field254A = 1; + if (!_tealDead) + _tealDead = true; else { warning("STUB: sub_1D227()"); _protectorSpeaker.proc16(); @@ -4679,7 +4681,7 @@ void Scene3600::signal() { R2_GLOBALS._walkRegions.disableRegion(15); R2_GLOBALS._walkRegions.disableRegion(16); - _actor3.setAction(&_action1); + _consoleLights.setAction(&_action1); } break; case 3324: @@ -4689,7 +4691,6 @@ void Scene3600::signal() { R2_GLOBALS._player.enableControl(CURSOR_WALK); _protector.fixPriority(-1); _sceneMode = 3623; - _field2548 = 1; break; case 3327: g_globals->_events.setCursor(CURSOR_ARROW); @@ -4698,24 +4699,24 @@ void Scene3600::signal() { break; case 3450: R2_GLOBALS._sound1.stop(); - _actor1.hide(); - _actor6.hide(); + _protector3400.hide(); + _door3400.hide(); _sceneBounds = Rect(40, 0, SCREEN_WIDTH + 40, SCREEN_HEIGHT); setZoomPercents(142, 80, 167, 105); loadScene(3600); R2_GLOBALS._uiElements.show(); - _item5._sceneRegionId = 200; - _item5.setDetails(3600, 30, -1, -1, 5, &_actor4); - - _actor3.show(); - _actor10.show(); - _actor11.show(); - _actor12.show(); - _actor4.show(); - _actor5.show(); + _lightShaft._sceneRegionId = 200; + _lightShaft.setDetails(3600, 30, -1, -1, 5, &_webbster); + + _consoleLights.show(); + _quinn.show(); + _seeker.show(); + _miranda.show(); + _webbster.show(); + _teal.show(); - _actor5.setPosition(Common::Point(298, 151)); + _teal.setPosition(Common::Point(298, 151)); _protector.postInit(); _protector._state = 0; @@ -4727,32 +4728,32 @@ void Scene3600::signal() { _protector.addMover(NULL); _protector.animate(ANIM_MODE_NONE); _protector.hide(); - _protector.setDetails(3600, 15, -1, 17, 5, &_item5); + _protector.setDetails(3600, 15, -1, 17, 5, &_lightShaft); - _actor2.setup(3600, 2, 1); - _actor2.setPosition(Common::Point(403, 161)); - _actor2.fixPriority(149); - _actor2.changeZoom(-1); - _actor2.show(); + _steppingDisk.setup(3600, 2, 1); + _steppingDisk.setPosition(Common::Point(403, 161)); + _steppingDisk.fixPriority(149); + _steppingDisk.changeZoom(-1); + _steppingDisk.show(); _quinnSpeaker._displayMode = 2; _tealSpeaker._displayMode = 2; if (R2_GLOBALS._player._characterIndex == R2_SEEKER) { R2_GLOBALS._player._moveDiff = Common::Point(5, 3); - R2_GLOBALS._player.setup(20, _actor11._strip, 1); - R2_GLOBALS._player.setPosition(_actor11._position); - _actor11.hide(); + R2_GLOBALS._player.setup(20, _seeker._strip, 1); + R2_GLOBALS._player.setPosition(_seeker._position); + _seeker.hide(); } else if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) { R2_GLOBALS._player._moveDiff = Common::Point(3, 2); - R2_GLOBALS._player.setup(30, _actor12._strip, 1); - R2_GLOBALS._player.setPosition(_actor12._position); - _actor12.hide(); + R2_GLOBALS._player.setup(30, _miranda._strip, 1); + R2_GLOBALS._player.setPosition(_miranda._position); + _miranda.hide(); } else { R2_GLOBALS._player._moveDiff = Common::Point(3, 2); - R2_GLOBALS._player.setup(10, _actor10._strip, 1); - R2_GLOBALS._player.setPosition(_actor10._position); - _actor10.hide(); + R2_GLOBALS._player.setup(10, _quinn._strip, 1); + R2_GLOBALS._player.setPosition(_quinn._position); + _quinn.hide(); } R2_GLOBALS._player.show(); R2_GLOBALS._sound1.play(326); @@ -4782,40 +4783,41 @@ void Scene3600::signal() { R2_GLOBALS._walkRegions.enableRegion(2); R2_GLOBALS._walkRegions.enableRegion(7); - _actor2.hide(); - _actor3.hide(); + _steppingDisk.hide(); + _consoleLights.hide(); R2_GLOBALS._player.hide(); - _actor10.hide(); - _actor11.hide(); - _actor12.hide(); - _actor4.hide(); - _actor5.hide(); + _quinn.hide(); + _seeker.hide(); + _miranda.hide(); + _webbster.hide(); + _teal.hide(); _sceneBounds = Rect(60, 0, SCREEN_WIDTH + 60, SCREEN_HEIGHT); setZoomPercents(51, 46, 180, 200); loadScene(3400); R2_GLOBALS._uiElements.show(); - _actor1.postInit(); + _protector3400.postInit(); - _actor2.setup(3403, 1, 1); - _actor2.setPosition(Common::Point(190, 103)); - _actor2.fixPriority(89); - _actor2.show(); + _steppingDisk.setup(3403, 1, 1); + _steppingDisk.setPosition(Common::Point(190, 103)); + _steppingDisk.fixPriority(89); + _steppingDisk.show(); - _actor6.postInit(); - _actor6.setup(3400, 1, 6); - _actor6.setPosition(Common::Point(236, 51)); - _actor6.fixPriority(51); - R2_GLOBALS._scrollFollower = &_actor6; + _door3400.postInit(); + _door3400.setup(3400, 1, 6); + _door3400.setPosition(Common::Point(236, 51)); + _door3400.fixPriority(51); + R2_GLOBALS._scrollFollower = &_door3400; R2_GLOBALS._sound1.play(323); _sceneMode = 3450; - setAction(&_sequenceManager1, this, 3450, &_actor1, &_actor6, NULL); + setAction(&_sequenceManager1, this, 3450, &_protector3400, &_door3400, NULL); break; case 3605: _protector.setup(3258, 4, 1); - _protector.setAction(&_sequenceManager1, this, 3606, &_actor5, &_protector, &_actor2, NULL); + _protector.setAction(&_sequenceManager1, this, 3606, &_teal, &_protector, + &_steppingDisk, NULL); _sceneMode = 3323; _stripManager.start(3323, this); @@ -4834,11 +4836,11 @@ void Scene3600::signal() { break; case 3624: R2_GLOBALS._player.disableControl(); - if ((_field254E != 0) && (_actor10._position.x == 229) && (_actor10._position.y == 154) && (_actor11._position.x == 181) && (_actor11._position.y == 154) && (_actor12._position.x == 207) && (_actor12._position.y == 154) && (_actor4._position.x == 155) && (_actor4._position.y == 154)) { + if (_lightEntered && (_quinn._position.x == 229) && (_quinn._position.y == 154) && (_seeker._position.x == 181) && (_seeker._position.y == 154) && (_miranda._position.x == 207) && (_miranda._position.y == 154) && (_webbster._position.x == 155) && (_webbster._position.y == 154)) { R2_GLOBALS._sound2.stop(); R2_GLOBALS._sound2.play(331); _sceneMode = 3625; - setAction(&_sequenceManager1, this, 3625, &_actor10, &_actor11, &_actor12, &_actor4, NULL); + setAction(&_sequenceManager1, this, 3625, &_quinn, &_seeker, &_miranda, &_webbster, NULL); } break; case 3625: @@ -4863,8 +4865,9 @@ void Scene3600::signal() { } void Scene3600::process(Event &event) { - if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == CURSOR_ARROW) && (event.mousePos.x > 237) && (!R2_GLOBALS.getFlag(71))) { - SceneItem::display(3600, 17, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7 -999); + if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == CURSOR_ARROW) + && (event.mousePos.x > 237) && (!R2_GLOBALS.getFlag(71))) { + SceneItem::display(3600, 17, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); event.handled = true; } Scene::process(event); @@ -4872,7 +4875,7 @@ void Scene3600::process(Event &event) { void Scene3600::dispatch() { if ((R2_GLOBALS._player.getRegionIndex() == 200) && (_action1._field1E != 0) - && (_field254E == 0)) { + && !_lightEntered) { R2_GLOBALS._sound2.fadeOut2(NULL); if (_protector._mover) _protector.addMover(NULL); @@ -4882,8 +4885,7 @@ void Scene3600::dispatch() { if (R2_GLOBALS._player._mover) R2_GLOBALS._player.addMover(NULL); - _field254C = 0; - _field254E = 1; + _lightEntered = true; R2_GLOBALS._walkRegions.enableRegion(2); R2_GLOBALS._walkRegions.enableRegion(7); @@ -4891,27 +4893,27 @@ void Scene3600::dispatch() { _sceneMode = 3624; - _actor10.setStrip(-1); - _actor11.setStrip(-1); - _actor12.setStrip(-1); - _actor4.setStrip(-1); + _quinn.setStrip(-1); + _seeker.setStrip(-1); + _miranda.setStrip(-1); + _webbster.setStrip(-1); R2_GLOBALS._player.hide(); if (R2_GLOBALS._player._characterIndex == R2_SEEKER) { - _actor11.setPosition(R2_GLOBALS._player._position); - _actor11.show(); + _seeker.setPosition(R2_GLOBALS._player._position); + _seeker.show(); } else if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) { - _actor12.setPosition(R2_GLOBALS._player._position); - _actor12.show(); + _miranda.setPosition(R2_GLOBALS._player._position); + _miranda.show(); } else { - _actor10.setPosition(R2_GLOBALS._player._position); - _actor10.show(); + _quinn.setPosition(R2_GLOBALS._player._position); + _quinn.show(); } - _actor10.setAction(&_sequenceManager2, this, 3610, &_actor10, NULL); - _actor11.setAction(&_sequenceManager3, this, 3611, &_actor11, NULL); - _actor12.setAction(&_sequenceManager4, this, 3612, &_actor12, NULL); - _actor4.setAction(&_sequenceManager1, this, 3613, &_actor4, NULL); + _quinn.setAction(&_sequenceManager2, this, 3610, &_quinn, NULL); + _seeker.setAction(&_sequenceManager3, this, 3611, &_seeker, NULL); + _miranda.setAction(&_sequenceManager4, this, 3612, &_miranda, NULL); + _webbster.setAction(&_sequenceManager1, this, 3613, &_webbster, NULL); } if ((_protector.getRegionIndex() == 200) && (_action1._field1E != 0) && !_ghoulTeleported) { @@ -4922,14 +4924,14 @@ void Scene3600::dispatch() { if (R2_GLOBALS._player._mover) R2_GLOBALS._player.addMover(NULL); - if (_actor10._mover) - _actor10.addMover(NULL); - if (_actor11._mover) - _actor11.addMover(NULL); - if (_actor12._mover) - _actor12.addMover(NULL); - if (_actor4._mover) - _actor4.addMover(NULL); + if (_quinn._mover) + _quinn.addMover(NULL); + if (_seeker._mover) + _seeker.addMover(NULL); + if (_miranda._mover) + _miranda.addMover(NULL); + if (_webbster._mover) + _webbster.addMover(NULL); } Scene::dispatch(); @@ -4969,14 +4971,14 @@ void Scene3700::postInit(SceneObjectList *OwnerList) { _webbster._moveDiff = Common::Point(5, 3); _webbster.hide(); - _actor5.postInit(); + _teleportPad.postInit(); R2_GLOBALS._player.disableControl(); R2_GLOBALS._sound1.play(332); _sceneMode = 3700; setAction(&_sequenceManager, this, 3700, &_quinn, &_seeker, &_miranda, - &_webbster, &_actor5, NULL); + &_webbster, &_teleportPad, NULL); } void Scene3700::remove() { @@ -5202,20 +5204,21 @@ void Scene3800::enterArea() { R2_GLOBALS._player.setStrip(3); R2_GLOBALS._player.changeZoom(-1); R2_GLOBALS._player._moveDiff = Common::Point(3, 2); - _actor1.postInit(); - _actor1.fixPriority(10); - _actor1.changeZoom(-1); - _actor1.setVisage(1110); - _actor1._effect = 5; - _actor1._field9C = this->_field312; - R2_GLOBALS._player._linkedActor = &_actor1; + _balloonQuinn.postInit(); + _balloonQuinn.fixPriority(10); + _balloonQuinn.changeZoom(-1); + _balloonQuinn.setVisage(1110); + _balloonQuinn._effect = 5; + _balloonQuinn._field9C = this->_field312; + R2_GLOBALS._player._linkedActor = &_balloonQuinn; switch (R2_GLOBALS._sceneManager._previousScene) { case 2600: - _object1.postInit(); - _object2.postInit(); - _actor1.hide(); + _balloon.postInit(); + _harness.postInit(); + _balloonQuinn.hide(); _sceneMode = 3800; - setAction(&_sequenceManager1, this, 3800, &R2_GLOBALS._player, &_object1, &_object2, NULL); + setAction(&_sequenceManager1, this, 3800, &R2_GLOBALS._player, + &_balloon, &_harness, NULL); break; case 3900: _sceneMode = 15; @@ -5315,7 +5318,7 @@ void Scene3800::postInit(SceneObjectList *OwnerList) { _westExit.setDetails(Rect(0, 87, 14, 168), EXITCURSOR_W, 3800); _westExit.setDest(Common::Point(7, 145)); - _rect1.set(0, 0, 320, 87); + _skylineRect.set(0, 0, 320, 87); _background.setDetails(Rect(0, 0, 320, 200), 3800, 0, 1, 2, 1, (SceneItem *) NULL); enterArea(); @@ -5358,9 +5361,9 @@ void Scene3800::signal() { g_globals->_sceneManager.changeScene(3900); break; case 3800: - _actor1.show(); - _object1.remove(); - _object2.remove(); + _balloonQuinn.show(); + _balloon.remove(); + _harness.remove(); R2_GLOBALS._player.enableControl(); break; case 3805: @@ -5384,18 +5387,19 @@ void Scene3800::signal() { } void Scene3800::process(Event &event) { - if ((R2_GLOBALS._player._uiEnabled) && (event.eventType == EVENT_BUTTON_DOWN) && (_rect1.contains(event.mousePos))) { + if ((R2_GLOBALS._player._uiEnabled) && (event.eventType == EVENT_BUTTON_DOWN) + && (_skylineRect.contains(event.mousePos))) { event.handled = true; switch (R2_GLOBALS._events.getCursor()) { - case R2_NEGATOR_GUN: + case CURSOR_WALK: R2_GLOBALS._player.addMover(NULL); R2_GLOBALS._player.updateAngle(event.mousePos); break; - case R2_STEPPING_DISKS: - SceneItem::display(3800, 5, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + case CURSOR_LOOK: + SceneItem::display(3800, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); break; - case R2_ATTRACTOR_UNIT: - SceneItem::display(3800, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + case CURSOR_USE: + SceneItem::display(3800, 5, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); break; default: event.handled = false; @@ -5510,13 +5514,13 @@ void Scene3900::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.changeZoom(-1); R2_GLOBALS._player._moveDiff = Common::Point(3, 2); - _actor1.postInit(); - _actor1.fixPriority(10); - _actor1.changeZoom(-1); - _actor1.setVisage(1110); - _actor1._effect = 5; - _actor1._field9C = _field312; - R2_GLOBALS._player._linkedActor = &_actor1; + _linkedQuinn.postInit(); + _linkedQuinn.fixPriority(10); + _linkedQuinn.changeZoom(-1); + _linkedQuinn.setVisage(1110); + _linkedQuinn._effect = 5; + _linkedQuinn._field9C = _field312; + R2_GLOBALS._player._linkedActor = &_linkedQuinn; if ((R2_GLOBALS._desertPreviousDirection == 2) && (R2_GLOBALS._sceneManager._previousScene != 2700)) { // loadScene(3825); @@ -5532,8 +5536,8 @@ void Scene3900::postInit(SceneObjectList *OwnerList) { _westExit._enabled = false; - _exit5.setDetails(Rect(0, 87, 29, 168), EXITCURSOR_W, 3900); - _exit5.setDest(Common::Point(24, 135)); + _westEnterForest.setDetails(Rect(0, 87, 29, 168), EXITCURSOR_W, 3900); + _westEnterForest.setDest(Common::Point(24, 135)); } else { // loadScene(3820); R2_GLOBALS._desertCorrectDirection = 2; @@ -5548,12 +5552,12 @@ void Scene3900::postInit(SceneObjectList *OwnerList) { _westExit._insideArea = false; _westExit._moving = false; - _exit5.setDetails(Rect(290, 87, 320, 168), EXITCURSOR_E, 3900); - _exit5.setDest(Common::Point(295, 135)); + _westEnterForest.setDetails(Rect(290, 87, 320, 168), EXITCURSOR_E, 3900); + _westEnterForest.setDest(Common::Point(295, 135)); } - _exit5._enabled = true; - _exit5._insideArea = false; - _exit5._moving = false; + _westEnterForest._enabled = true; + _westEnterForest._insideArea = false; + _westEnterForest._moving = false; scalePalette(65, 65, 65); @@ -5569,8 +5573,8 @@ void Scene3900::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._uiElements.draw(); - _rect1.set(0, 0, 320, 87); - _item1.setDetails(Rect(0, 0, 320, 200), 3800, 0, 1, 2, 1, (SceneItem *)NULL); + _skylineRect.set(0, 0, 320, 87); + _background.setDetails(Rect(0, 0, 320, 200), 3800, 0, 1, 2, 1, (SceneItem *)NULL); if (R2_GLOBALS._sceneManager._previousScene == 3800) { _sceneMode = 11; switch (R2_GLOBALS._desertPreviousDirection) { @@ -5655,18 +5659,19 @@ void Scene3900::signal() { } void Scene3900::process(Event &event) { - if ((R2_GLOBALS._player._uiEnabled) && (event.eventType == EVENT_BUTTON_DOWN) && (_rect1.contains(event.mousePos))) { + if ((R2_GLOBALS._player._uiEnabled) && (event.eventType == EVENT_BUTTON_DOWN) + && (_skylineRect.contains(event.mousePos))) { event.handled = true; switch (R2_GLOBALS._events.getCursor()) { - case R2_NEGATOR_GUN: + case CURSOR_WALK: R2_GLOBALS._player.addMover(NULL); R2_GLOBALS._player.updateAngle(event.mousePos); break; - case R2_STEPPING_DISKS: - SceneItem::display(3800, 5, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + case CURSOR_USE: + SceneItem::display(3800, 5, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); break; - case R2_ATTRACTOR_UNIT: - SceneItem::display(3800, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + case CURSOR_LOOK: + SceneItem::display(3800, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END); break; default: event.handled = false; diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.h b/engines/tsage/ringworld2/ringworld2_scenes3.h index 6c7a594b12..48236ee300 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -45,15 +45,15 @@ class Scene3100 : public SceneExt { virtual bool startAction(CursorType action, Event &event); }; public: - int _field412; + bool _fadeSound; SpeakerGuard _guardSpeaker; - NamedHotspot _item1; - NamedHotspot _item2; - SceneActor _actor1; - SceneActor _actor2; - SceneActor _actor3; - SceneActor _actor4; - SceneActor _actor5; + NamedHotspot _background; + NamedHotspot _hammerHead2; + SceneActor _hammerHead; + SceneActor _miranda; + SceneActor _ghoul; + SceneActor _technicians; + SceneActor _deadBodies; Guard _guard; ASoundExt _sound1; SequenceManager _sequenceManager; @@ -84,7 +84,7 @@ class Scene3125 : public SceneExt { virtual bool startAction(CursorType action, Event &event); }; public: - int _field412; + bool _soundPlayed; Background _background; Door _door; Table _table; @@ -93,9 +93,7 @@ public: SceneActor _ghoul2; SceneActor _ghoul3; SceneActor _ghoul4; - SequenceManager _sequenceManager1; - // Second sequence manager... Unused? - SequenceManager _sequenceManager2; + SequenceManager _sequenceManager; Scene3125(); virtual void postInit(SceneObjectList *OwnerList = NULL); @@ -119,7 +117,7 @@ class Scene3150 : public SceneExt { class FoodTray : public SceneActor { virtual bool startAction(CursorType action, Event &event); }; - class Actor6 : public SceneActor { + class ToiletFlush : public SceneActor { virtual bool startAction(CursorType action, Event &event); }; class AirVent : public SceneActor { @@ -146,7 +144,7 @@ public: SceneActor _bulbOrWire; Water _water; FoodTray _foodTray; - Actor6 _toiletFlush; + ToiletFlush _toiletFlush; AirVent _airVent; DoorExit _doorExit; VentExit _ventExit; @@ -158,7 +156,7 @@ public: }; class Scene3175 : public SceneExt { - class Item1 : public NamedHotspot { + class RoomItem : public NamedHotspot { public: virtual bool startAction(CursorType action, Event &event); }; @@ -170,11 +168,11 @@ class Scene3175 : public SceneExt { virtual bool startAction(CursorType action, Event &event); }; public: - Item1 _background; - Item1 _item2; - Item1 _item3; + RoomItem _background; + RoomItem _table; + RoomItem _autopsies; Door _door; - SceneActor _actor2; + SceneActor _computer; Corpse _corpse; SequenceManager _sequenceManager; @@ -187,9 +185,9 @@ public: SpeakerRocko3200 _rockoSpeaker; SpeakerJocko3200 _jockoSpeaker; SpeakerSocko3200 _sockoSpeaker; - SceneActor _actor1; - SceneActor _actor2; - SceneActor _actor3; + SceneActor _rocko; + SceneActor _jocko; + SceneActor _socko; SequenceManager _sequenceManager; virtual void postInit(SceneObjectList *OwnerList = NULL); @@ -200,8 +198,8 @@ class Scene3210 : public SceneExt { public: SpeakerCaptain3210 _captainSpeaker; SpeakerPrivate3210 _privateSpeaker; - SceneActor _actor1; - SceneActor _actor2; + SceneActor _captain; + SceneActor _private; SequenceManager _sequenceManager; virtual void postInit(SceneObjectList *OwnerList = NULL); @@ -212,8 +210,8 @@ class Scene3220 : public SceneExt { public: SpeakerRocko3220 _rockoSpeaker; SpeakerJocko3220 _jockoSpeaker; - SceneActor _actor1; - SceneActor _actor2; + SceneActor _rocko; + SceneActor _jocko; SequenceManager _sequenceManager; virtual void postInit(SceneObjectList *OwnerList = NULL); @@ -224,9 +222,9 @@ class Scene3230 : public SceneExt { public: SpeakerRocko3230 _rockoSpeaker; SpeakerJocko3230 _jockoSpeaker; - SceneActor _actor1; - SceneActor _actor2; - SceneActor _actor3; + SceneActor _rocko; + SceneActor _jocko; + SceneActor _ghoul; SequenceManager _sequenceManager; virtual void postInit(SceneObjectList *OwnerList = NULL); @@ -238,8 +236,8 @@ public: SpeakerTeal3240 _tealSpeaker; SpeakerWebbster3240 _webbsterSpeaker; SpeakerMiranda _mirandaSpeaker; - SceneActor _actor1; - SceneActor _actor2; + SceneActor _teal; + SceneActor _webbster; SequenceManager _sequenceManager; virtual void postInit(SceneObjectList *OwnerList = NULL); @@ -250,8 +248,8 @@ class Scene3245 : public SceneExt { public: SpeakerRalf3245 _ralfSpeaker; SpeakerTomko3245 _tomkoSpeaker; - SceneActor _actor1; - SceneActor _actor2; + SceneActor _ralf; + SceneActor _tomko; SequenceManager _sequenceManager; virtual void postInit(SceneObjectList *OwnerList = NULL); @@ -275,7 +273,7 @@ public: Door _leftDoor; Door _topDoor; Door _rightDoor; - Door _actor4; + Door _grate; SceneActor _ghoul1; SceneActor _ghoul2; SceneActor _ghoul3; @@ -290,7 +288,7 @@ class Scene3255 : public SceneExt { public: SceneActor _teal; SceneActor _guard; - SceneActor _actor3; + SceneActor _door; SceneActor _quinn; SceneActor _ghoul1; SceneActor _ghoul2; @@ -366,7 +364,7 @@ public: NamedHotspot _emptyCell2; NamedHotspot _securityBeams1; NamedHotspot _securityBeams2; - SceneActor _actor1; + SceneActor _doorFrame; Door _door; CellExit _cellExit; SequenceManager _sequenceManager; @@ -377,15 +375,15 @@ public: class Scene3350 : public SceneExt { public: - SceneActor _actor1; - SceneActor _actor2; - SceneActor _actor3; - SceneActor _actor4; - SceneActor _actor5; - SceneActor _actor6; - SceneActor _actor7; - SceneActor _actor8; - SceneActor _actor9; + SceneActor _miranda; + SceneActor _seeker; + SceneActor _webbster; + SceneActor _seatedPeople; + SceneActor _ship; + SceneActor _landedShip; + SceneActor _shipShadow; + SceneActor _canopy; + SceneActor _shipFront; SequenceManager _sequenceManager; PaletteRotation *_rotation; @@ -439,9 +437,8 @@ public: DownExit _downExit; RightExit _rightExit; SequenceManager _sequenceManager; - int _field1488; + int _newSceneMode; int _sceneAreas[4]; - int _field1492; Scene3375(); virtual void postInit(SceneObjectList *OwnerList = NULL); @@ -489,7 +486,7 @@ public: Action1 _action1; SequenceManager _sequenceManager; - int _field11B2; + int _playerStrip; Scene3385(); virtual void postInit(SceneObjectList *OwnerList = NULL); @@ -531,7 +528,7 @@ public: Action1 _action1; SequenceManager _sequenceManager; - int _field142E; + int _playerStrip; Scene3395(); virtual void postInit(SceneObjectList *OwnerList = NULL); @@ -556,7 +553,7 @@ public: SceneActor _actor7; SceneActor _actor8; SequenceManager _sequenceManager; - int16 _field157C; + bool _soundFaded; Scene3400(); virtual void postInit(SceneObjectList *OwnerList = NULL); @@ -591,11 +588,11 @@ class Scene3500 : public SceneExt { virtual void signal(); }; - class Item4 : public NamedHotspot { + class DirectionButton : public NamedHotspot { public: - int _field34; + int _movementId; - Item4(); + DirectionButton(); virtual void synchronize(Serializer &s); virtual bool startAction(CursorType action, Event &event); @@ -603,8 +600,7 @@ class Scene3500 : public SceneExt { class Actor7 : public SceneActor { public: - int _fieldA4; - int _fieldA6; + Common::Point _pos; int _fieldA8; int _fieldAA; int _fieldAC; @@ -613,10 +609,10 @@ class Scene3500 : public SceneExt { Actor7(); virtual void synchronize(Serializer &s); - void sub109466(int arg1, int arg2, int arg3, int arg4, int arg5); + void sub109466(int xp, int yp, int arg3, int arg4, int arg5); void sub1094ED(); void sub109663(int arg1); - void sub109693(Common::Point Pt); + void changePosition(const Common::Point &pt); virtual void process(Event &event); virtual bool startAction(CursorType action, Event &event); @@ -640,10 +636,10 @@ public: NamedHotspot _item1; NamedHotspot _item2; NamedHotspot _item3; - Item4 _item4; - Item4 _item5; - Item4 _item6; - Item4 _item7; + DirectionButton _pitchDown; + DirectionButton _turnLeft; + DirectionButton _pitchUp; + DirectionButton _turnRight; // Glyph of vessel on top of the maze ui SceneActor _actor1; SceneActor _actor2; @@ -672,10 +668,10 @@ public: int _field1280; int _field1282; int _field1284; - int _field1286; + bool _directionChangesEnabled; Scene3500(); - void sub107F71(int arg1); + void doMovement(int id); virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void remove(); @@ -699,7 +695,7 @@ class Scene3600 : public SceneExt { virtual void signal(); }; - class Item5 : public NamedHotspot { + class LightShaft : public NamedHotspot { public: virtual bool startAction(CursorType action, Event &event); }; @@ -715,23 +711,20 @@ public: SpeakerMiranda3600 _mirandaSpeaker; SpeakerTeal3600 _tealSpeaker; SpeakerProtector3600 _protectorSpeaker; - NamedHotspot _item1; - NamedHotspot _item2; - NamedHotspot _item3; - NamedHotspot _item4; - Item5 _item5; - SceneActor _actor1; - SceneActor _actor2; - SceneActor _actor3; - SceneActor _actor4; - SceneActor _actor5; - SceneActor _actor6; - SceneActor _actor7; - SceneActor _actor8; - SceneActor _actor9; - SceneActor _actor10; - SceneActor _actor11; - SceneActor _actor12; + NamedHotspot _background; + NamedHotspot _console; + NamedHotspot _tapestry1; + NamedHotspot _tapestry2; + LightShaft _lightShaft; + SceneActor _protector3400; + SceneActor _steppingDisk; + SceneActor _consoleLights; + SceneActor _webbster; + SceneActor _teal; + SceneActor _door3400; + SceneActor _quinn; + SceneActor _seeker; + SceneActor _miranda; Protector _protector; SequenceManager _sequenceManager1; SequenceManager _sequenceManager2; @@ -739,10 +732,8 @@ public: SequenceManager _sequenceManager4; ScenePalette _palette1; - int _field2548; - int _field254A; - int _field254C; - int _field254E; + bool _tealDead; + bool _lightEntered; bool _ghoulTeleported; Scene3600(); @@ -763,7 +754,7 @@ public: SceneActor _seeker; SceneActor _miranda; SceneActor _webbster; - SceneActor _actor5; + SceneActor _teleportPad; SequenceManager _sequenceManager; virtual void postInit(SceneObjectList *OwnerList = NULL); @@ -793,15 +784,15 @@ class Scene3800 : public SceneExt { }; public: - SceneObject _object1; - SceneObject _object2; - SceneActor _actor1; + SceneObject _balloon; + SceneObject _harness; + SceneActor _balloonQuinn; NamedHotspot _background; NorthExit _northExit; EastExit _eastExit; SouthExit _southExit; WestExit _westExit; - Rect _rect1; + Rect _skylineRect; SequenceManager _sequenceManager1; int _desertDirection; @@ -842,14 +833,14 @@ class Scene3900 : public SceneExt { virtual void changeScene(); }; public: - SceneActor _actor1; - NamedHotspot _item1; + SceneActor _linkedQuinn; + NamedHotspot _background; NorthExit _northExit; EastExit _eastExit; SouthExit _southExit; WestExit _westExit; - Exit5 _exit5; - Rect _rect1; + Exit5 _westEnterForest; + Rect _skylineRect; virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void signal(); diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index fee97f2e25..a6bfc39e2a 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -322,7 +322,7 @@ void SpeakerCaptain3210::proc15() { Scene3210 *scene = (Scene3210 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { - _object2 = &scene->_actor1; + _object2 = &scene->_captain; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); @@ -475,7 +475,7 @@ void SpeakerJocko3200::proc15() { Scene3200 *scene = (Scene3200 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { - _object2 = &scene->_actor2; + _object2 = &scene->_jocko; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); @@ -498,7 +498,7 @@ void SpeakerJocko3220::proc15() { Scene3220 *scene = (Scene3220 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { - _object2 = &scene->_actor2; + _object2 = &scene->_jocko; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); @@ -521,7 +521,7 @@ void SpeakerJocko3230::proc15() { Scene3230 *scene = (Scene3230 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { - _object2 = &scene->_actor2; + _object2 = &scene->_jocko; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); @@ -600,7 +600,7 @@ void SpeakerMiranda1625::proc15() { if (!_object2) { Scene1625 *scene = (Scene1625 *)R2_GLOBALS._sceneManager._scene; - _object2 = &scene->_actor3; + _object2 = &scene->_mirandaMouth; _object2->hide(); _object1.postInit(); _object1.setPosition(Common::Point(196, 65)); @@ -841,7 +841,7 @@ void SpeakerMiranda3600::proc15() { if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) _object2 = &R2_GLOBALS._player; else - _object2 = &scene->_actor12; + _object2 = &scene->_miranda; _object2->hide(); _object1.postInit(); @@ -1015,10 +1015,10 @@ void SpeakerNej2750::proc15() { void SpeakerNej2800::proc15() { int v = _speakerMode; - Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + Scene2800 *scene = (Scene2800 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { - _object2 = &scene->_actor2; + _object2 = &scene->_nej; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); @@ -1095,7 +1095,7 @@ void SpeakerPrivate3210::proc15() { Scene3210 *scene = (Scene3210 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { - _object2 = &scene->_actor2; + _object2 = &scene->_private; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); @@ -1730,7 +1730,7 @@ void SpeakerQuinn3600::proc15() { if (R2_GLOBALS._player._characterIndex == R2_QUINN) _object2 = &R2_GLOBALS._player; else - _object2 = &scene->_actor10; + _object2 = &scene->_quinn; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); @@ -1877,7 +1877,7 @@ void SpeakerRalf3245::proc15() { Scene3245 *scene = (Scene3245 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { - _object2 = &scene->_actor1; + _object2 = &scene->_ralf; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); @@ -1929,7 +1929,7 @@ void SpeakerRocko3200::proc15() { Scene3200 *scene = (Scene3200 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { - _object2 = &scene->_actor1; + _object2 = &scene->_rocko; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); @@ -1952,7 +1952,7 @@ void SpeakerRocko3220::proc15() { Scene3220 *scene = (Scene3220 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { - _object2 = &scene->_actor1; + _object2 = &scene->_rocko; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); @@ -1975,7 +1975,7 @@ void SpeakerRocko3230::proc15() { Scene3230 *scene = (Scene3230 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { - _object2 = &scene->_actor1; + _object2 = &scene->_rocko; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); @@ -2151,7 +2151,7 @@ void SpeakerSeeker1900::proc15() { } else { assert(R2_GLOBALS._sceneManager._sceneNumber == 1900); Scene1900 *scene = (Scene1900 *)R2_GLOBALS._sceneManager._scene; - _object2 = &scene->_actor1; + _object2 = &scene->_companion; } _object2->hide(); @@ -2441,7 +2441,7 @@ void SpeakerSeeker3600::proc15() { if (R2_GLOBALS._player._characterIndex == R2_SEEKER) _object2 = &R2_GLOBALS._player; else - _object2 = &scene->_actor11; + _object2 = &scene->_seeker; _object2->hide(); _object1.postInit(); @@ -2577,7 +2577,7 @@ void SpeakerSocko3200::proc15() { Scene3200 *scene = (Scene3200 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { - _object2 = &scene->_actor3; + _object2 = &scene->_socko; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); @@ -2743,7 +2743,7 @@ void SpeakerTeal3240::proc15() { Scene3240 *scene = (Scene3240 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { - _object2 = &scene->_actor1; + _object2 = &scene->_teal; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); @@ -2824,7 +2824,7 @@ void SpeakerTeal3600::proc15() { int v = _speakerMode; if (!_object2) { - _object2 = &scene->_actor5; + _object2 = &scene->_teal; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); @@ -2895,7 +2895,7 @@ void SpeakerTomko3245::proc15() { Scene3245 *scene = (Scene3245 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { - _object2 = &scene->_actor2; + _object2 = &scene->_tomko; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); @@ -2988,7 +2988,7 @@ void SpeakerWebbster3240::proc15() { Scene3240 *scene = (Scene3240 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { - _object2 = &scene->_actor2; + _object2 = &scene->_webbster; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp index 195ba5ca03..0946b6c419 100644 --- a/engines/tsage/sound.cpp +++ b/engines/tsage/sound.cpp @@ -969,7 +969,7 @@ void SoundManager::sfRethinkVoiceTypes() { int entryIndex = -1; for (uint idx = 0; idx < vtStruct->_entries.size(); ++idx) { if (vtStruct->_entries[idx]._voiceNum == foundIndex) { - foundIndex = true; + foundMatch = true; if (!vtStruct->_entries[idx]._type0._sound2) { entryIndex = idx; break; @@ -2621,6 +2621,7 @@ bool PlayStream::play(int voiceNum, EventHandler *endAction) { g_vm->_mixer->playStream(Audio::Mixer::kSpeechSoundType, &_soundHandle, _audioStream, DisposeAfterUse::YES); _voiceNum = voiceNum; + _endAction = endAction; return true; } @@ -2705,13 +2706,8 @@ SoundDriver::SoundDriver() { const byte adlib_group_data[] = { 1, 1, 9, 1, 0xff }; -const byte v440B0[9] = { 0, 1, 2, 6, 7, 8, 12, 13, 14 }; - -const byte v440B9[9] = { 3, 4, 5, 9, 10, 11, 15, 16, 17 }; - -const byte v440C2[18] = { - 0, 1, 2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 16, 17, 18, 19, 20, 21 -}; +const byte adlib_operator1_offset[] = { 0, 1, 2, 8, 9, 10, 16, 17, 18 }; +const byte adlib_operator2_offset[] = { 3, 4, 5, 11, 12, 13, 19, 20, 21 }; const byte v44134[64] = { 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, @@ -2842,10 +2838,10 @@ void AdlibSoundDriver::playSound(const byte *channelData, int dataOffset, int pr _v4409E[channel] = dataP + offset - _patchData; // Set sustain/release - int portNum = v440C2[v440B0[channel]] + 0x80; + int portNum = adlib_operator1_offset[channel] + 0x80; write(portNum, (_portContents[portNum] & 0xF0) | 0xF); - portNum = v440C2[v440B9[channel]] + 0x80; + portNum = adlib_operator2_offset[channel] + 0x80; write(portNum, (_portContents[portNum] & 0xF0) | 0xF); if (_channelVoiced[channel]) @@ -2902,10 +2898,10 @@ void AdlibSoundDriver::updateChannelVolume(int channelNum) { int level1 = !_v44082[channelNum] ? 63 - _v44070[channelNum] : 63 - v44134[volume * _v44070[channelNum] / 63]; - int portNum = v440C2[v440B0[channelNum]] + 0x40; + int portNum = adlib_operator1_offset[channelNum] + 0x40; write(portNum, (_portContents[portNum] & 0x80) | level1); - portNum = v440C2[v440B9[channelNum]] + 0x40; + portNum = adlib_operator2_offset[channelNum] + 0x40; write(portNum, (_portContents[portNum] & 0x80) | level2); } @@ -2922,7 +2918,7 @@ void AdlibSoundDriver::clearVoice(int channel) { void AdlibSoundDriver::updateChannel(int channel) { const byte *dataP = _patchData + _v4409E[channel]; - int portOffset = v440C2[v440B0[channel]]; + int portOffset = adlib_operator1_offset[channel]; int portNum = portOffset + 0x20; int portValue = 0; @@ -2945,7 +2941,7 @@ void AdlibSoundDriver::updateChannel(int channel) { write(0x80 + portOffset, *(dataP + 14) | (*(dataP + 13) << 4)); write(0xE0 + portOffset, (_portContents[0xE0 + portOffset] & 0xFC) | *(dataP + 15)); - portOffset = v440C2[v440B9[channel]]; + portOffset = adlib_operator2_offset[channel]; portNum = portOffset + 0x20; portValue = 0; if (*(dataP + 17)) @@ -3103,10 +3099,12 @@ void SoundBlasterDriver::playSound(const byte *channelData, int dataOffset, int updateVoice(channel); // Set the new channel data - _channelData = channelData + dataOffset; + _channelData = channelData + dataOffset + 18; // Make a copy of the buffer int dataSize = g_vm->_memoryManager.getSize(channelData); + dataSize -= 18; + byte *soundData = (byte *)malloc(dataSize - dataOffset); Common::copy(_channelData, _channelData + (dataSize - dataOffset), soundData); diff --git a/gui/predictivedialog.cpp b/gui/predictivedialog.cpp index ef94ec6d50..5d45a3060e 100644 --- a/gui/predictivedialog.cpp +++ b/gui/predictivedialog.cpp @@ -752,7 +752,8 @@ bool PredictiveDialog::matchWord() { char tmp[kMaxLineLen]; strncpy(tmp, _unitedDict.dictLine[line], kMaxLineLen); tmp[kMaxLineLen - 1] = 0; - char *tok = strtok(tmp, " "); + char *tok; + strtok(tmp, " "); tok = strtok(NULL, " "); _currentWord = Common::String(tok, _currentCode.size()); return true; |