diff options
Diffstat (limited to 'engines')
103 files changed, 679 insertions, 615 deletions
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp index 34e398de91..58d5fa9e67 100644 --- a/engines/adl/adl.cpp +++ b/engines/adl/adl.cpp @@ -55,6 +55,7 @@ AdlEngine::AdlEngine(OSystem *syst, const AdlGameDescription *gd) : _dumpFile(nullptr), _display(nullptr), _graphics(nullptr), + _textMode(false), _isRestarting(false), _isRestoring(false), _isQuitting(false), @@ -911,10 +912,6 @@ byte AdlEngine::convertKey(uint16 ascii) const { } Common::String AdlEngine::getLine() { - // Original engine uses a global here, which isn't reset between - // calls and may not match actual mode - bool textMode = false; - while (1) { Common::String line = inputString(APPLECHAR('?')); @@ -922,8 +919,8 @@ Common::String AdlEngine::getLine() { return ""; if ((byte)line[0] == ('\r' | 0x80)) { - textMode = !textMode; - _display->setMode(textMode ? DISPLAY_MODE_TEXT : DISPLAY_MODE_MIXED); + _textMode = !_textMode; + _display->setMode(_textMode ? DISPLAY_MODE_TEXT : DISPLAY_MODE_MIXED); continue; } diff --git a/engines/adl/adl.h b/engines/adl/adl.h index 75df3395d7..d71d40816e 100644 --- a/engines/adl/adl.h +++ b/engines/adl/adl.h @@ -348,6 +348,7 @@ protected: Display *_display; GraphicsMan *_graphics; + bool _textMode; // Opcodes typedef Common::Functor1<ScriptEnv &, int> Opcode; diff --git a/engines/adl/adl_v2.cpp b/engines/adl/adl_v2.cpp index 9653e2e40b..272e7801e7 100644 --- a/engines/adl/adl_v2.cpp +++ b/engines/adl/adl_v2.cpp @@ -37,6 +37,7 @@ AdlEngine_v2::~AdlEngine_v2() { AdlEngine_v2::AdlEngine_v2(OSystem *syst, const AdlGameDescription *gd) : AdlEngine(syst, gd), _linesPrinted(0), + _maxLines(4), _disk(nullptr), _itemRemoved(false), _roomOnScreen(0), @@ -151,9 +152,11 @@ void AdlEngine_v2::checkTextOverflow(char c) { ++_linesPrinted; - if (_linesPrinted < 4) - return; + if (_linesPrinted >= _maxLines) + handleTextOverflow(); +} +void AdlEngine_v2::handleTextOverflow() { _linesPrinted = 0; _display->updateTextScreen(); bell(); diff --git a/engines/adl/adl_v2.h b/engines/adl/adl_v2.h index f0af9eba22..5447974a2e 100644 --- a/engines/adl/adl_v2.h +++ b/engines/adl/adl_v2.h @@ -62,6 +62,7 @@ protected: int askForSlot(const Common::String &question); void checkTextOverflow(char c); + void handleTextOverflow(); int o2_isFirstTime(ScriptEnv &e); int o2_isRandomGT(ScriptEnv &e); @@ -85,7 +86,7 @@ protected: Common::String restoreInsert, restoreReplace; } _strings_v2; - uint _linesPrinted; + uint _linesPrinted, _maxLines; DiskImage *_disk; Common::Array<DataBlockPtr> _itemPics; bool _itemRemoved; diff --git a/engines/adl/adl_v4.cpp b/engines/adl/adl_v4.cpp index 8370bead6f..a5d2de264d 100644 --- a/engines/adl/adl_v4.cpp +++ b/engines/adl/adl_v4.cpp @@ -127,7 +127,7 @@ void AdlEngine_v4::loadState(Common::ReadStream &stream) { if (size != expectedSize) error("Variable count mismatch (expected %i; found %i)", expectedSize, size); - for (uint i = getRegion(1).vars.size(); i < size; ++i) + for (uint i = getRegion(1).vars.size(); i < _state.vars.size(); ++i) _state.vars[i] = stream.readByte(); if (stream.err() || stream.eos()) diff --git a/engines/adl/adl_v5.cpp b/engines/adl/adl_v5.cpp index be0c31a64c..011ef88848 100644 --- a/engines/adl/adl_v5.cpp +++ b/engines/adl/adl_v5.cpp @@ -85,12 +85,12 @@ void AdlEngine_v5::setupOpcodeTables() { Opcode(o5_dummy); Opcode(o5_setTextMode); // 0x0c - Opcode(o2_moveAllItems); + Opcode(o4_moveAllItems); Opcode(o1_quit); Opcode(o5_dummy); - Opcode(o2_save); + Opcode(o4_save); // 0x10 - Opcode(o2_restore); + Opcode(o4_restore); Opcode(o1_restart); Opcode(o5_setRegionRoom); Opcode(o5_dummy); @@ -154,13 +154,28 @@ int AdlEngine_v5::o5_setTextMode(ScriptEnv &e) { // 2: 24-line mode switch (e.arg(1)) { + case 1: + if (_linesPrinted != 0) { + _display->printChar(APPLECHAR(' ')); + handleTextOverflow(); + _display->moveCursorTo(Common::Point(0, 23)); + _maxLines = 4; + } + return 1; + case 2: + _textMode = true; + _display->setMode(DISPLAY_MODE_TEXT); + _display->home(); + _maxLines = 24; + _linesPrinted = 0; + return 1; case 3: // We re-use the restarting flag here, to simulate a long jump _isRestarting = true; return -1; + default: + error("Invalid text mode %d", e.arg(1)); } - - return 1; } int AdlEngine_v5::o5_setRegionRoom(ScriptEnv &e) { diff --git a/engines/adl/hires6.cpp b/engines/adl/hires6.cpp index 91ab16313b..01de061584 100644 --- a/engines/adl/hires6.cpp +++ b/engines/adl/hires6.cpp @@ -50,6 +50,8 @@ private: void showRoom(); Common::String formatVerbError(const Common::String &verb) const; Common::String formatNounError(const Common::String &verb, const Common::String &noun) const; + void loadState(Common::ReadStream &stream); + void saveState(Common::WriteStream &stream); // AdlEngine_v2 void printString(const Common::String &str); @@ -146,12 +148,9 @@ void HiRes6Engine::init() { _strings.lineFeeds = readStringAt(*stream, 0x408); - // Read opcode strings (TODO) _strings_v2.saveInsert = readStringAt(*stream, 0xad8); - readStringAt(*stream, 0xb95); // Confirm save - // _strings_v2.saveReplace + _strings_v2.saveReplace = readStringAt(*stream, 0xb95); _strings_v2.restoreInsert = readStringAt(*stream, 0xc07); - // _strings_v2.restoreReplace _strings.playAgain = readStringAt(*stream, 0xcdf, 0xff); _messageIds.cantGoThere = 249; @@ -275,6 +274,20 @@ Common::String HiRes6Engine::formatNounError(const Common::String &verb, const C return err; } +void HiRes6Engine::loadState(Common::ReadStream &stream) { + AdlEngine_v5::loadState(stream); + _state.moves = (getVar(39) << 8) | getVar(24); + setVar(39, 0); +} + +void HiRes6Engine::saveState(Common::WriteStream &stream) { + // Move counter is stuffed into variables, in order to save it + setVar(24, _state.moves & 0xff); + setVar(39, _state.moves >> 8); + AdlEngine_v5::saveState(stream); + setVar(39, 0); +} + void HiRes6Engine::printString(const Common::String &str) { Common::String s; uint found = 0; diff --git a/engines/director/archive.cpp b/engines/director/archive.cpp index c9b6cc1cfa..f426107ee3 100644 --- a/engines/director/archive.cpp +++ b/engines/director/archive.cpp @@ -441,14 +441,13 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff debugCN(2, kDebugLoading, "CAS*: %d [", casSize); for (uint i = 0; i < casSize; i++) { - uint32 index = casStream.readUint32(); + uint32 index = casStream.readUint32BE(); + debugCN(2, kDebugLoading, "%d ", index); Resource &res = resources[index]; res.index = index; res.castId = i + 1; _types[castTag][res.castId] = res; - - debugCN(2, kDebugLoading, "%d ", index); } debugC(2, kDebugLoading, "]"); } diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp index c26084ac6c..43c5bf2b4f 100644 --- a/engines/director/detection.cpp +++ b/engines/director/detection.cpp @@ -78,6 +78,7 @@ static const PlainGameDescriptor directorGames[] = { { "jewels", "Jewels of the Oracle" }, { "jman", "The Journeyman Project" }, { "majestic", "Majestic Part I: Alien Encounter" }, + { "mediaband", "Meet Mediaband" }, { "melements", "Masters of the Elements" }, { "spyclub", "Spy Club" }, { "amber", "AMBER: Journeys Beyond"}, diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h index 15bdf37968..95ddd25abe 100644 --- a/engines/director/detection_tables.h +++ b/engines/director/detection_tables.h @@ -291,6 +291,20 @@ static const DirectorGameDescription gameDescriptions[] = { 4 }, + { // Meet Mediaband + { + "mediaband", + "", + AD_ENTRY1s("MEDIABND.EXE", "0cfb9b4762e33ab56d656a0eb146a048", 717921), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_NO_FLAGS, + GUIO1(GUIO_NOASPECT) + }, + GID_GENERIC, + 4 + }, + { { // Masters of the Elements - English (from rootfather) diff --git a/engines/director/director.cpp b/engines/director/director.cpp index f26d873eff..05775791f6 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -45,6 +45,7 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam DebugMan.addDebugChannel(kDebugLoading, "loading", "Loading"); DebugMan.addDebugChannel(kDebugImages, "images", "Image drawing"); DebugMan.addDebugChannel(kDebugText, "text", "Text rendering"); + DebugMan.addDebugChannel(kDebugEvents, "events", "Event processing"); g_director = this; @@ -83,6 +84,7 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam const Common::FSNode gameDataDir(ConfMan.get("path")); SearchMan.addSubDirectoryMatching(gameDataDir, "data"); SearchMan.addSubDirectoryMatching(gameDataDir, "install"); + SearchMan.addSubDirectoryMatching(gameDataDir, "main"); // Meet Mediaband _colorDepth = 8; // 256-color _key = 0; @@ -137,13 +139,14 @@ Common::Error DirectorEngine::run() { //_mainArchive = new RIFFArchive(); //_mainArchive->openFile("bookshelf_example.mmm"); - if (getPlatform() == Common::kPlatformWindows) { - _sharedCastFile = "SHARDCST.MMM"; - } else { - if (getVersion() < 4) + if (getVersion() < 4) { + if (getPlatform() == Common::kPlatformWindows) { + _sharedCastFile = "SHARDCST.MMM"; + } else { _sharedCastFile = "Shared Cast"; - else - _sharedCastFile = "Shared.dir"; + } + } else { + _sharedCastFile = "Shared.dir"; } loadSharedCastsFrom(_sharedCastFile); diff --git a/engines/director/director.h b/engines/director/director.h index eeb9c6b8d5..805a51c610 100644 --- a/engines/director/director.h +++ b/engines/director/director.h @@ -57,7 +57,8 @@ enum { kDebugLingoCompile = 1 << 1, kDebugLoading = 1 << 2, kDebugImages = 1 << 3, - kDebugText = 1 << 4 + kDebugText = 1 << 4, + kDebugEvents = 1 << 5 }; extern byte defaultPalette[768]; diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp index d3132f93e5..759d40e819 100644 --- a/engines/director/lingo/lingo.cpp +++ b/engines/director/lingo/lingo.cpp @@ -247,7 +247,7 @@ void Lingo::executeScript(ScriptType type, uint16 id) { return; } - debugC(2, kDebugLingoExec, "Executing script type: %d, id: %d", type, id); + debugC(2, kDebugLingoExec, "Executing script type: %s, id: %d", scriptType2str(type), id); _currentScript = _scripts[type][id]; _pc = 0; @@ -294,6 +294,8 @@ void Lingo::processEvent(LEvent event, ScriptType st, int entityId) { if (entityId <= 0) return; + debugC(1, kDebugEvents, "Lingo::processEvent(%s, %s, %d)", _eventHandlerTypes[event], scriptType2str(st), entityId); + _currentEntityId = entityId; if (!_eventHandlerTypes.contains(event)) @@ -302,8 +304,8 @@ void Lingo::processEvent(LEvent event, ScriptType st, int entityId) { if (_handlers.contains(ENTITY_INDEX(event, entityId))) { call(_eventHandlerTypes[event], 0); // D4+ Events pop(); - } else if (_scripts[st].contains(entityId + 1)) { - executeScript(st, entityId + 1); // D3 list of scripts. + } else if (_scripts[st].contains(entityId)) { + executeScript(st, entityId); // D3 list of scripts. } else { debugC(8, kDebugLingoExec, "STUB: processEvent(%s) for %d", _eventHandlerTypes[event], entityId); } diff --git a/engines/director/score.cpp b/engines/director/score.cpp index 53d15469b4..2544a612c0 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -41,6 +41,24 @@ namespace Director { +const char *scriptTypes[] = { + "MovieScript", + "SpriteScript", + "FrameScript", + "CastScript" +}; + +const char *scriptType2str(ScriptType scr) { + if (scr < 0) + return "NoneScript"; + + if (scr > kMaxScriptType) + return "<unknown>"; + + return scriptTypes[scr]; +} + + Score::Score(DirectorEngine *vm, Archive *archive) { _vm = vm; _surface = new Graphics::ManagedSurface; @@ -863,8 +881,8 @@ void Score::update() { _surface->copyFrom(*_trailSurface); // Enter and exit from previous frame (Director 4) - _lingo->processEvent(kEventEnterFrame, kFrameScript, _frames[_currentFrame]->_actionId); - _lingo->processEvent(kEventExitFrame, kFrameScript, _frames[_currentFrame]->_actionId); + _lingo->processEvent(kEventEnterFrame, kFrameScript, _frames[_currentFrame]->_actionId - 1); + _lingo->processEvent(kEventExitFrame, kFrameScript, _frames[_currentFrame]->_actionId - 1); // TODO Director 6 - another order // TODO Director 6 step: send beginSprite event to any sprites whose span begin in the upcoming frame @@ -971,7 +989,7 @@ void Score::processEvents() { _lingo->processEvent(kEventMouseUp, kSpriteScript, _frames[_currentFrame]->_sprites[spriteId]->_scriptId); } else { // D3 doesn't have cast member or sprite scripts. Just Frame Scripts. - _lingo->processEvent(kEventMouseUp, kFrameScript, _frames[_currentFrame]->_sprites[spriteId]->_scriptId); + _lingo->processEvent(kEventMouseUp, kFrameScript, _frames[_currentFrame]->_sprites[spriteId]->_scriptId + 1); } } diff --git a/engines/director/score.h b/engines/director/score.h index 61d911800e..6db5e33988 100644 --- a/engines/director/score.h +++ b/engines/director/score.h @@ -52,6 +52,8 @@ enum ScriptType { kMaxScriptType = 3 }; +const char *scriptType2str(ScriptType scr); + class Score { public: Score(DirectorEngine *vm, Archive *); diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 561b74d354..a3a690be59 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -456,9 +456,6 @@ void Script::syncStringHeap(Common::Serializer &s) { s.syncBytes(buf, blockSize); buf += blockSize; - - if (_buf - buf == 0) - break; } while (1); } else if (getSciVersion() >= SCI_VERSION_1_1 && getSciVersion() <= SCI_VERSION_2_1_LATE){ diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 77c3d4e637..aaa1c8ccfe 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -2234,7 +2234,7 @@ bool ResourceManager::checkResourceDataForSignature(Resource *resource, const by if (signatureSize > resource->size) return false; - const uint32 signatureDWord = *((const uint32 *)signature); + const uint32 signatureDWord = READ_UINT32(signature); signature += 4; signatureSize -= 4; const uint32 searchLimit = resource->size - signatureSize + 1; diff --git a/engines/titanic/carry/arm.cpp b/engines/titanic/carry/arm.cpp index 5105ea81b4..129704cb83 100644 --- a/engines/titanic/carry/arm.cpp +++ b/engines/titanic/carry/arm.cpp @@ -35,55 +35,41 @@ BEGIN_MESSAGE_MAP(CArm, CCarry) ON_MESSAGE(MouseDragMoveMsg) END_MESSAGE_MAP() -CArm::CArm() : CCarry(), _string6("Key"), - _field138(0), _field158(0), _field16C(3), _field170(0), +CArm::CArm() : CCarry(), _heldItemName("Key"), + _puzzleUnused(0), _armUnlocked(false), _arboretumFrame(3), _unlockedFrame(0), _armRect(220, 208, 409, 350) { } void CArm::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeQuotedLine(_string6, indent); - file->writeNumberLine(_field138, indent); - file->writeNumberLine(_hookedRect.left, indent); - file->writeNumberLine(_hookedRect.top, indent); - file->writeNumberLine(_hookedRect.right, indent); - file->writeNumberLine(_hookedRect.bottom, indent); - - file->writeQuotedLine(_string7, indent); - file->writeNumberLine(_field158, indent); - file->writeNumberLine(_armRect.left, indent); - file->writeNumberLine(_armRect.top, indent); - file->writeNumberLine(_armRect.right, indent); - file->writeNumberLine(_armRect.bottom, indent); - file->writeNumberLine(_field16C, indent); - file->writeNumberLine(_field170, indent); + file->writeQuotedLine(_heldItemName, indent); + file->writeNumberLine(_puzzleUnused, indent); + file->writeRect(_hookedRect, indent); + file->writeQuotedLine(_hookedTarget, indent); + file->writeNumberLine(_armUnlocked, indent); + file->writeRect(_armRect, indent); + file->writeNumberLine(_arboretumFrame, indent); + file->writeNumberLine(_unlockedFrame, indent); CCarry::save(file, indent); } void CArm::load(SimpleFile *file) { file->readNumber(); - _string6 = file->readString(); - _field138 = file->readNumber(); - _hookedRect.left = file->readNumber(); - _hookedRect.top = file->readNumber(); - _hookedRect.right = file->readNumber(); - _hookedRect.bottom = file->readNumber(); - - _string7 = file->readString(); - _field158 = file->readNumber(); - _armRect.left = file->readNumber(); - _armRect.top = file->readNumber(); - _armRect.right = file->readNumber(); - _armRect.bottom = file->readNumber(); - _field16C = file->readNumber(); - _field170 = file->readNumber(); + _heldItemName = file->readString(); + _puzzleUnused = file->readNumber(); + _hookedRect = file->readRect(); + _hookedTarget = file->readString(); + _armUnlocked = file->readNumber(); + _armRect = file->readRect(); + _arboretumFrame = file->readNumber(); + _unlockedFrame = file->readNumber(); CCarry::load(file); } bool CArm::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) { - _field138 = 0; + _puzzleUnused = 0; _canTake = true; CString name = getName(); @@ -107,7 +93,7 @@ bool CArm::TranslateObjectMsg(CTranslateObjectMsg *msg) { } bool CArm::UseWithOtherMsg(CUseWithOtherMsg *msg) { - if (_string6 != "None") { + if (_heldItemName != "None") { CShowTextMsg textMsg(ARM_ALREADY_HOLDING); textMsg.execute("PET"); return false; @@ -116,8 +102,8 @@ bool CArm::UseWithOtherMsg(CUseWithOtherMsg *msg) { hookedMsg._rect.translate(_bounds.left, _bounds.top); hookedMsg.execute("GondolierLeftLever"); - if (hookedMsg._result) { - _string7 = "GondolierLeftLever"; + if (hookedMsg._isHooked) { + _hookedTarget = "GondolierLeftLever"; } else { petAddToInventory(); } @@ -126,11 +112,13 @@ bool CArm::UseWithOtherMsg(CUseWithOtherMsg *msg) { hookedMsg._rect.translate(_bounds.left, _bounds.top); hookedMsg.execute("GondolierRightLever"); - if (hookedMsg._result) { - _string7 = "GondolierRightLever"; + if (hookedMsg._isHooked) { + _hookedTarget = "GondolierRightLever"; } else { petAddToInventory(); } + } else { + petAddToInventory(); } return true; @@ -142,13 +130,13 @@ bool CArm::MouseDragStartMsg(CMouseDragStartMsg *msg) { textMsg.execute("PET"); } else if (checkStartDragging(msg)) { hideMouse(); - _tempPos = msg->_mousePos - _bounds; - setPosition(msg->_mousePos - _tempPos); + _centroid = msg->_mousePos - _bounds; + setPosition(msg->_mousePos - _centroid); - if (!_string7.empty()) { + if (!_hookedTarget.empty()) { CActMsg actMsg("Unhook"); - actMsg.execute(_string7); - _string7.clear(); + actMsg.execute(_hookedTarget); + _hookedTarget.clear(); } loadFrame(_visibleFrame); @@ -161,39 +149,39 @@ bool CArm::MouseDragStartMsg(CMouseDragStartMsg *msg) { bool CArm::MaitreDHappyMsg(CMaitreDHappyMsg *msg) { CGameObject *petItem; if (find(getName(), &petItem, FIND_PET)) { - if (!_field158) + if (!_armUnlocked) playSound("z#47.wav"); - if (_string6 == "Key" || _string6 == "AuditoryCentre") { - CGameObject *child = dynamic_cast<CGameObject *>(getFirstChild()); - if (child) { - child->setVisible(true); - petAddToInventory(); + if (_heldItemName == "Key" || _heldItemName == "AuditoryCentre") { + CGameObject *heldItem = dynamic_cast<CGameObject *>(getFirstChild()); + if (heldItem) { + heldItem->setVisible(true); + heldItem->petAddToInventory(); } - _visibleFrame = _field170; + _visibleFrame = _unlockedFrame; loadFrame(_visibleFrame); - _string6 = "None"; + _heldItemName = "None"; petInvChange(); } } - _field158 = 1; + _armUnlocked = true; _canTake = true; return true; } bool CArm::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { - if (_field158) { - if (_string6 == "Key" || _string6 == "AuditoryCentre") { + if (_armUnlocked) { + if (_heldItemName == "Key" || _heldItemName == "AuditoryCentre") { CCarry *child = dynamic_cast<CCarry *>(getFirstChild()); if (child) { - _visibleFrame = _field170; + _visibleFrame = _unlockedFrame; loadFrame(_visibleFrame); child->setVisible(true); child->petAddToInventory(); } - _string6 = "None"; + _heldItemName = "None"; } } @@ -201,11 +189,11 @@ bool CArm::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { } bool CArm::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { - setPosition(msg->_mousePos - _tempPos); + setPosition(msg->_mousePos - _centroid); - if (_string6 != "None" && compareViewNameTo("FrozenArboretum.Node 5.S")) { + if (_heldItemName == "None" && compareViewNameTo("FrozenArboretum.Node 5.S")) { loadFrame(_armRect.contains(msg->_mousePos) ? - _field16C : _visibleFrame); + _arboretumFrame : _visibleFrame); } return true; diff --git a/engines/titanic/carry/arm.h b/engines/titanic/carry/arm.h index fc8bba1f08..3eec4b6995 100644 --- a/engines/titanic/carry/arm.h +++ b/engines/titanic/carry/arm.h @@ -40,14 +40,14 @@ class CArm : public CCarry { bool PETGainedObjectMsg(CPETGainedObjectMsg *msg); bool MouseDragMoveMsg(CMouseDragMoveMsg *msg); private: - CString _string6; - int _field138; + CString _heldItemName; + int _puzzleUnused; Rect _hookedRect; - CString _string7; - int _field158; + CString _hookedTarget; + bool _armUnlocked; Rect _armRect; - int _field16C; - int _field170; + int _arboretumFrame; + int _unlockedFrame; public: CLASSDEF; CArm(); diff --git a/engines/titanic/carry/brain.cpp b/engines/titanic/carry/brain.cpp index b00f026718..7b2e8d0e45 100644 --- a/engines/titanic/carry/brain.cpp +++ b/engines/titanic/carry/brain.cpp @@ -122,7 +122,7 @@ bool CBrain::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { bool CBrain::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { if (!_field138) { if (getName() == "Perch") { - stateInc38(); + incParrotResponse(); _field138 = 1; } } diff --git a/engines/titanic/carry/carry.cpp b/engines/titanic/carry/carry.cpp index f6403b18b9..fd5b593fa3 100644 --- a/engines/titanic/carry/carry.cpp +++ b/engines/titanic/carry/carry.cpp @@ -44,30 +44,29 @@ BEGIN_MESSAGE_MAP(CCarry, CGameObject) ON_MESSAGE(PassOnDragStartMsg) END_MESSAGE_MAP() -CCarry::CCarry() : CGameObject(), _fieldDC(0), _canTake(true), - _field100(0), _field104(0), _field108(0), _field10C(0), - _itemFrame(0), _enterFrame(0), _enterFrameSet(false), _visibleFrame(0), - _string1("None"), - _fullViewName("NULL"), - _string3(g_vm->_strings[DOESNT_DO_ANYTHING]), - _string4(g_vm->_strings[DOESNT_WANT_THIS]) { +CCarry::CCarry() : CGameObject(), _unused5(0), _canTake(true), + _unusedR(0), _unusedG(0), _unusedB(0), _itemFrame(0), + _enterFrame(0), _enterFrameSet(false), _visibleFrame(0), + _npcUse("None"), _fullViewName("NULL"), + _doesNothingMsg(g_vm->_strings[DOESNT_DO_ANYTHING]), + _doesntWantMsg(g_vm->_strings[DOESNT_WANT_THIS]) { } void CCarry::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_npcUse, indent); file->writePoint(_origPos, indent); file->writeQuotedLine(_fullViewName, indent); - file->writeNumberLine(_fieldDC, indent); + file->writeNumberLine(_unused5, indent); file->writeNumberLine(_canTake, indent); - file->writeQuotedLine(_string3, indent); - file->writeQuotedLine(_string4, indent); - file->writePoint(_tempPos, indent); - file->writeNumberLine(_field104, indent); - file->writeNumberLine(_field108, indent); - file->writeNumberLine(_field10C, indent); + file->writeQuotedLine(_doesNothingMsg, indent); + file->writeQuotedLine(_doesntWantMsg, indent); + file->writePoint(_centroid, indent); + file->writeNumberLine(_unusedR, indent); + file->writeNumberLine(_unusedG, indent); + file->writeNumberLine(_unusedB, indent); file->writeNumberLine(_itemFrame, indent); - file->writeQuotedLine(_string5, indent); + file->writeQuotedLine(_unused6, indent); file->writeNumberLine(_enterFrame, indent); file->writeNumberLine(_enterFrameSet, indent); file->writeNumberLine(_visibleFrame, indent); @@ -77,19 +76,19 @@ void CCarry::save(SimpleFile *file, int indent) { void CCarry::load(SimpleFile *file) { file->readNumber(); - _string1 = file->readString(); + _npcUse = file->readString(); _origPos = file->readPoint(); _fullViewName = file->readString(); - _fieldDC = file->readNumber(); + _unused5 = file->readNumber(); _canTake = file->readNumber(); - _string3 = file->readString(); - _string4 = file->readString(); - _tempPos = file->readPoint(); - _field104 = file->readNumber(); - _field108 = file->readNumber(); - _field10C = file->readNumber(); + _doesNothingMsg = file->readString(); + _doesntWantMsg = file->readString(); + _centroid = file->readPoint(); + _unusedR = file->readNumber(); + _unusedG = file->readNumber(); + _unusedB = file->readNumber(); _itemFrame = file->readNumber(); - _string5 = file->readString(); + _unused6 = file->readString(); _enterFrame = file->readNumber(); _enterFrameSet = file->readNumber(); _visibleFrame = file->readNumber(); @@ -118,7 +117,7 @@ bool CCarry::MouseDragStartMsg(CMouseDragStartMsg *msg) { } bool CCarry::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { - setPosition(msg->_mousePos - _tempPos); + setPosition(msg->_mousePos - _centroid); return true; } @@ -167,7 +166,7 @@ bool CCarry::UseWithCharMsg(CUseWithCharMsg *msg) { carryMsg._item = this; carryMsg.execute(succubus); } else { - CShowTextMsg textMsg(_string4); + CShowTextMsg textMsg(_doesntWantMsg); textMsg.execute("PET"); petAddToInventory(); } @@ -180,7 +179,7 @@ bool CCarry::LeaveViewMsg(CLeaveViewMsg *msg) { } bool CCarry::UseWithOtherMsg(CUseWithOtherMsg *msg) { - CShowTextMsg textMsg(_string3); + CShowTextMsg textMsg(_doesNothingMsg); textMsg.execute("PET"); if (!compareViewNameTo(_fullViewName) || _bounds.top >= 360) { @@ -233,13 +232,13 @@ bool CCarry::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { loadFrame(_visibleFrame); if (msg->_value3) { - _tempPos.x = _bounds.width() / 2; - _tempPos.y = _bounds.height() / 2; + _centroid.x = _bounds.width() / 2; + _centroid.y = _bounds.height() / 2; } else { - _tempPos = msg->_mousePos - _bounds; + _centroid = msg->_mousePos - _bounds; } - setPosition(getMousePos() - _tempPos); + setPosition(getMousePos() - _centroid); return true; } diff --git a/engines/titanic/carry/carry.h b/engines/titanic/carry/carry.h index cb53df47a5..edfc8a7533 100644 --- a/engines/titanic/carry/carry.h +++ b/engines/titanic/carry/carry.h @@ -44,21 +44,18 @@ class CCarry : public CGameObject { bool EnterViewMsg(CEnterViewMsg *msg); bool PassOnDragStartMsg(CPassOnDragStartMsg *msg); protected: - int _fieldDC; - CString _string3; - CString _string4; - Point _tempPos; - int _field100; - int _field104; - int _field108; - int _field10C; + int _unused5; + CString _doesNothingMsg; + CString _doesntWantMsg; + Point _centroid; + int _unusedR, _unusedG, _unusedB; int _itemFrame; - CString _string5; + CString _unused6; int _enterFrame; bool _enterFrameSet; int _visibleFrame; public: - CString _string1; + CString _npcUse; bool _canTake; Point _origPos; CString _fullViewName; diff --git a/engines/titanic/carry/carry_parrot.cpp b/engines/titanic/carry/carry_parrot.cpp index 3a2f2c9368..4bb3a96bfb 100644 --- a/engines/titanic/carry/carry_parrot.cpp +++ b/engines/titanic/carry/carry_parrot.cpp @@ -113,7 +113,7 @@ bool CCarryParrot::MouseDragEndMsg(CMouseDragEndMsg *msg) { CTreeItem *perchedParrot = findUnder(getRoot(), "PerchedParrot"); detach(); addUnder(perchedParrot); - sound8(true); + stopSoundChannel(true); CPutParrotBackMsg backMsg(msg->_mousePos.x); backMsg.execute(perchedParrot); @@ -122,7 +122,7 @@ bool CCarryParrot::MouseDragEndMsg(CMouseDragEndMsg *msg) { _canTake = false; CParrot::_state = PARROT_ESCAPED; playSound("z#475.wav"); - sound8(true); + stopSoundChannel(true); moveUnder(findRoom()); CActMsg actMsg("Shut"); @@ -137,7 +137,7 @@ bool CCarryParrot::MouseDragEndMsg(CMouseDragEndMsg *msg) { setVisible(false); _canTake = false; playSound("z#475.wav"); - sound8(true); + stopSoundChannel(true); moveUnder(findRoom()); } } diff --git a/engines/titanic/carry/head_piece.cpp b/engines/titanic/carry/head_piece.cpp index 1ce1d5ba1e..fa025158a5 100644 --- a/engines/titanic/carry/head_piece.cpp +++ b/engines/titanic/carry/head_piece.cpp @@ -60,7 +60,7 @@ bool CHeadPiece::SenseWorkingMsg(CSenseWorkingMsg *msg) { bool CHeadPiece::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { _visibleFrame = 1; if (!_field13C) { - stateInc38(); + incParrotResponse(); _field13C = true; } diff --git a/engines/titanic/carry/magazine.cpp b/engines/titanic/carry/magazine.cpp index e68c63f8f9..94e853bda9 100644 --- a/engines/titanic/carry/magazine.cpp +++ b/engines/titanic/carry/magazine.cpp @@ -52,19 +52,18 @@ void CMagazine::load(SimpleFile *file) { } bool CMagazine::UseWithCharMsg(CUseWithCharMsg *msg) { + // WORKAROUND: Slight difference to original to ensure that when the + // magazine is used on an incorrect char, it's returned to inventory CDeskbot *deskbot = dynamic_cast<CDeskbot *>(msg->_character); - if (deskbot) { - if (deskbot->_deskbotActive) { - setVisible(false); - setPosition(Point(1000, 1000)); - CActMsg actMsg("2ndClassUpgrade"); - actMsg.execute("Deskbot"); - } - + if (deskbot && deskbot->_deskbotActive) { + setVisible(false); + setPosition(Point(1000, 1000)); + CActMsg actMsg("2ndClassUpgrade"); + actMsg.execute("Deskbot"); return true; - } else { - return CCarry::UseWithCharMsg(msg); } + + return CCarry::UseWithCharMsg(msg); } bool CMagazine::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { @@ -77,17 +76,20 @@ bool CMagazine::VisibleMsg(CVisibleMsg *msg) { } bool CMagazine::UseWithOtherMsg(CUseWithOtherMsg *msg) { + // WORKAROUND: Slight difference to original to ensure that when the + // magazine is used on an incorrect object, it's returned to inventory if (msg->_other->getName() == "SwitchOnDeskbot") { - // TODO: other _field108 if - if (false) { + CDeskbot *deskbot = dynamic_cast<CDeskbot *>(msg->_other); + if (deskbot && deskbot->_deskbotActive) { setVisible(false); setPosition(Point(1000, 1000)); CActMsg actMsg("2ndClassUpgrade"); actMsg.execute("Deskbot"); + return true; } } - return true; + return CCarry::UseWithOtherMsg(msg); } } // End of namespace Titanic diff --git a/engines/titanic/carry/mouth.cpp b/engines/titanic/carry/mouth.cpp index e48929a391..d750fc969e 100644 --- a/engines/titanic/carry/mouth.cpp +++ b/engines/titanic/carry/mouth.cpp @@ -70,7 +70,7 @@ bool CMouth::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { loadFrame(2); setVisible(true); if (!_field13C) { - stateInc38(); + incParrotResponse(); _field13C = true; } diff --git a/engines/titanic/core/background.cpp b/engines/titanic/core/background.cpp index 9f22f1e992..d6419f23db 100644 --- a/engines/titanic/core/background.cpp +++ b/engines/titanic/core/background.cpp @@ -58,7 +58,7 @@ void CBackground::load(SimpleFile *file) { bool CBackground::StatusChangeMsg(CStatusChangeMsg *msg) { setVisible(true); if (_isBlocking) { - playMovie(_startFrame, _endFrame, MOVIE_GAMESTATE); + playMovie(_startFrame, _endFrame, MOVIE_WAIT_FOR_FINISH); } else { playMovie(_startFrame, _endFrame, 0); } diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index af7020532c..549cadf085 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -56,26 +56,25 @@ void CGameObject::deinit() { CGameObject::CGameObject(): CNamedItem() { _bounds = Rect(0, 0, 15, 15); - _field34 = 0; - _field38 = 0; - _field3C = 0; + _unused1 = 0; + _unused2 = 0; + _unused3 = 0; _nonvisual = false; - _field44 = 0xF0; - _field48 = 0xF0; - _field4C = 0xFF; + _toggleR = 0xF0; + _toggleG = 0xF0; + _toggleB = 0xFF; _isPendingMail = false; _destRoomFlags = 0; _roomFlags = 0; _visible = true; - _field60 = 0; + _handleMouseFlag = false; _cursorId = CURSOR_ARROW; _initialFrame = 0; _frameNumber = -1; _text = nullptr; _textBorder = _textBorderRight = 0; - _field9C = 0; _surface = nullptr; - _fieldB8 = 0; + _unused4 = 0; } CGameObject::~CGameObject() { @@ -105,19 +104,19 @@ void CGameObject::save(SimpleFile *file, int indent) { file->writeNumberLine(getMovieFrame(), indent + 1); file->writeNumberLine(_cursorId, indent + 1); _movieClips.save(file, indent + 1); - file->writeNumberLine(_field60, indent + 1); + file->writeNumberLine(_handleMouseFlag, indent + 1); file->writeNumberLine(_nonvisual, indent + 1); file->writeQuotedLine(_resource, indent + 1); file->writeBounds(_bounds, indent + 1); - file->writeFloatLine(_field34, indent + 1); - file->writeFloatLine(_field38, indent + 1); - file->writeFloatLine(_field3C, indent + 1); + file->writeFloatLine(_unused1, indent + 1); + file->writeFloatLine(_unused2, indent + 1); + file->writeFloatLine(_unused3, indent + 1); - file->writeNumberLine(_field44, indent + 1); - file->writeNumberLine(_field48, indent + 1); - file->writeNumberLine(_field4C, indent + 1); - file->writeNumberLine(_fieldB8, indent + 1); + file->writeNumberLine(_toggleR, indent + 1); + file->writeNumberLine(_toggleG, indent + 1); + file->writeNumberLine(_toggleB, indent + 1); + file->writeNumberLine(_unused4, indent + 1); file->writeNumberLine(_visible, indent + 1); file->writeNumberLine(_isPendingMail, indent + 1); file->writeNumberLine(_destRoomFlags, indent + 1); @@ -153,7 +152,7 @@ void CGameObject::load(SimpleFile *file) { // Deliberate fall-through case 4: - _field60 = file->readNumber(); + _handleMouseFlag = file->readNumber(); // Deliberate fall-through case 3: @@ -166,13 +165,13 @@ void CGameObject::load(SimpleFile *file) { case 1: _bounds = file->readBounds(); - _field34 = file->readFloat(); - _field38 = file->readFloat(); - _field3C = file->readFloat(); - _field44 = file->readNumber(); - _field48 = file->readNumber(); - _field4C = file->readNumber(); - _fieldB8 = file->readNumber(); + _unused1 = file->readFloat(); + _unused2 = file->readFloat(); + _unused3 = file->readFloat(); + _toggleR = file->readNumber(); + _toggleG = file->readNumber(); + _toggleB = file->readNumber(); + _unused4 = file->readNumber(); _visible = file->readNumber() != 0; _isPendingMail = file->readNumber(); _destRoomFlags = file->readNumber(); @@ -543,15 +542,11 @@ void CGameObject::setGlobalSoundVolume(int mode, uint seconds, int handleIndex) } } -void CGameObject::sound8(bool flag) const { - getGameManager()->_sound.stopChannel(flag ? 3 : 0); +void CGameObject::stopSoundChannel(bool channel3) { + getGameManager()->_sound.stopChannel(channel3 ? 3 : 0); } void CGameObject::setVisible(bool val) { - if (_name.contains("ylinder")) { - warning("TODO"); - } - if (val != _visible) { _visible = val; makeDirty(); @@ -611,7 +606,7 @@ void CGameObject::playMovie(uint flags) { CGameObject *obj = (flags & MOVIE_NOTIFY_OBJECT) ? this : nullptr; if (_surface) { _surface->playMovie(flags, obj); - if (flags & MOVIE_GAMESTATE) + if (flags & MOVIE_WAIT_FOR_FINISH) getGameManager()->_gameState.addMovie(_surface->_movie); } } @@ -627,7 +622,7 @@ void CGameObject::playMovie(int startFrame, int endFrame, uint flags) { CGameObject *obj = (flags & MOVIE_NOTIFY_OBJECT) ? this : nullptr; if (_surface) { _surface->playMovie(startFrame, endFrame, flags, obj); - if (flags & MOVIE_GAMESTATE) + if (flags & MOVIE_WAIT_FOR_FINISH) getGameManager()->_gameState.addMovie(_surface->_movie); } } @@ -644,7 +639,7 @@ void CGameObject::playMovie(int startFrame, int endFrame, int initialFrame, uint CGameObject *obj = (flags & MOVIE_NOTIFY_OBJECT) ? this : nullptr; if (_surface) { _surface->playMovie(startFrame, endFrame, initialFrame, flags, obj); - if (flags & MOVIE_GAMESTATE) + if (flags & MOVIE_WAIT_FOR_FINISH) getGameManager()->_gameState.addMovie(_surface->_movie); } } @@ -1058,12 +1053,12 @@ bool CGameObject::stateGetParrotMet() const { return getGameManager()->_gameState.getParrotMet(); } -void CGameObject::stateInc38() { - getGameManager()->_gameState.inc38(); +void CGameObject::incParrotResponse() { + getGameManager()->_gameState.incParrotResponse(); } -int CGameObject::stateGet38() const { - return getGameManager()->_gameState._field38; +int CGameObject::getParrotResponse() const { + return getGameManager()->_gameState._parrotResponseIndex; } void CGameObject::quitGame() { @@ -1373,11 +1368,11 @@ void CGameObject::createCredits() { _credits->load(this, screenManager, _bounds); } -void CGameObject::fn10(int v1, int v2, int v3) { +void CGameObject::setToggleColor(byte r, byte g, byte b) { makeDirty(); - _field44 = v1; - _field48 = v2; - _field4C = v3; + _toggleR = r; + _toggleG = g; + _toggleB = b; } void CGameObject::movieSetAudioTiming(bool flag) { @@ -1429,8 +1424,8 @@ bool CGameObject::compareRoomFlags(RoomFlagsComparison compareType, uint flags1, } } -void CGameObject::setState1C(bool flag) { - getGameManager()->_gameState._field1C = flag; +void CGameObject::stateSetSoundMakerAllowed(bool flag) { + getGameManager()->_gameState._soundMakerAllowed = flag; } void CGameObject::addMail(uint destRoomFlags) { diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index a56095c60f..a1e2c35431 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -77,13 +77,11 @@ private: protected: static CCreditText *_credits; protected: - double _field34; - double _field38; - double _field3C; + double _unused1; + double _unused2; + double _unused3; bool _nonvisual; - int _field44; - int _field48; - int _field4C; + byte _toggleR, _toggleG, _toggleB; CMovieClipList _movieClips; int _initialFrame; CMovieRangeInfoList _movieRangeInfoList; @@ -91,11 +89,10 @@ protected: CTextControl *_text; uint _textBorder; uint _textBorderRight; - int _field9C; Common::Point _savedPos; CVideoSurface *_surface; CString _resource; - int _fieldB8; + int _unused4; protected: /** * Saves the current position the object is located at @@ -277,7 +274,10 @@ protected: */ void setGlobalSoundVolume(int mode, uint seconds, int handleIndex); - void sound8(bool flag) const; + /** + * Stops sound channel 3 or 0 + */ + void stopSoundChannel(bool channel3); /** * Adds a timer @@ -462,7 +462,11 @@ protected: */ void setPassengerClass(PassengerClass newClass); - void fn10(int v1, int v2, int v3); + /** + * Sets color RGB for toggles + * @remarks The color set isn't actually used anywhere + */ + void setToggleColor(byte r, byte g, byte b); /** * Gets the duration of a specified clip in milliseconds @@ -523,7 +527,7 @@ public: bool _isPendingMail; uint _destRoomFlags; uint _roomFlags; - int _field60; + bool _handleMouseFlag; CursorId _cursorId; bool _visible; public: @@ -987,7 +991,10 @@ public: /*--- CGameState Methods ---*/ - void setState1C(bool flag); + /** + * Sets whether a background sound maker is allowed for the rooms if available + */ + void stateSetSoundMakerAllowed(bool flag); /** * Change to the next season @@ -1009,8 +1016,15 @@ public: */ bool stateGetParrotMet() const; - void stateInc38(); - int stateGet38() const; + /** + * Moves the parrot to the next idle response + */ + void incParrotResponse(); + + /** + * Gets the index to use for parrot idle responses + */ + int getParrotResponse() const; /** * Gets the game state node changed counter diff --git a/engines/titanic/core/turn_on_turn_off.cpp b/engines/titanic/core/turn_on_turn_off.cpp index a6051c7c6f..3c1e623b6e 100644 --- a/engines/titanic/core/turn_on_turn_off.cpp +++ b/engines/titanic/core/turn_on_turn_off.cpp @@ -58,7 +58,7 @@ void CTurnOnTurnOff::load(SimpleFile *file) { bool CTurnOnTurnOff::TurnOn(CTurnOn *msg) { if (!_isOn) { if (_isBlocking) - playMovie(_startFrameOn, _endFrameOn, MOVIE_GAMESTATE); + playMovie(_startFrameOn, _endFrameOn, MOVIE_WAIT_FOR_FINISH); else playMovie(_startFrameOn, _endFrameOn, MOVIE_NOTIFY_OBJECT); _isOn = true; @@ -70,7 +70,7 @@ bool CTurnOnTurnOff::TurnOn(CTurnOn *msg) { bool CTurnOnTurnOff::TurnOff(CTurnOff *msg) { if (_isOn) { if (_isBlocking) - playMovie(_startFrameOff, _endFrameOff, MOVIE_GAMESTATE); + playMovie(_startFrameOff, _endFrameOff, MOVIE_WAIT_FOR_FINISH); else playMovie(_startFrameOff, _endFrameOff, MOVIE_NOTIFY_OBJECT); _isOn = false; diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index 9109bcc5b2..15d187e194 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -260,7 +260,7 @@ bool CViewItem::handleMouseMsg(CMouseMsg *msg, bool flag) { CGameObject *gameObject = dynamic_cast<CGameObject *>(treeItem); if (gameObject) { if (gameObject->checkPoint(msg->_mousePos, false, true) && - (!flag || !gameObject->_field60)) { + (!flag || !gameObject->_handleMouseFlag)) { if (gameObjects.size() < 256) gameObjects.push_back(gameObject); } diff --git a/engines/titanic/game/arboretum_gate.cpp b/engines/titanic/game/arboretum_gate.cpp index 2a79c31339..1b13b1a65e 100644 --- a/engines/titanic/game/arboretum_gate.cpp +++ b/engines/titanic/game/arboretum_gate.cpp @@ -275,27 +275,27 @@ bool CArboretumGate::TurnOff(CTurnOff *msg) { if (!_disabled) { switch (_seasonNum) { case SEASON_SUMMER: - playMovie(_startFrameSummerOff, _endFrameSummerOff, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playMovie(_startFrameSummerOff, _endFrameSummerOff, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); break; case SEASON_AUTUMN: if (_gotSpeechCentre) { - playMovie(_startFrameAutumnOff2, _endFrameAutumnOff2, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playMovie(_startFrameAutumnOff2, _endFrameAutumnOff2, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); } else { - playMovie(_startFrameAutumnOff1, _endFrameAutumnOff1, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playMovie(_startFrameAutumnOff1, _endFrameAutumnOff1, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); } break; case SEASON_WINTER: if (_gotSpeechCentre) { - playMovie(_startFrameWinterOff2, _endFrameWinterOff2, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playMovie(_startFrameWinterOff2, _endFrameWinterOff2, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); } else { - playMovie(_startFrameWinterOff1, _endFrameWinterOff1, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playMovie(_startFrameWinterOff1, _endFrameWinterOff1, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); } break; case SEASON_SPRING: - playMovie(_startFrameSpringOff, _endFrameSpringOff, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playMovie(_startFrameSpringOff, _endFrameSpringOff, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); break; default: @@ -318,27 +318,27 @@ bool CArboretumGate::TurnOn(CTurnOn *msg) { switch (_seasonNum) { case SEASON_SUMMER: - playMovie(_startFrameSummerOn, _endFrameSummerOn, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playMovie(_startFrameSummerOn, _endFrameSummerOn, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); break; case SEASON_AUTUMN: if (_gotSpeechCentre) { - playMovie(_startFrameAutumnOn2, _endFrameAutumnOn2, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playMovie(_startFrameAutumnOn2, _endFrameAutumnOn2, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); } else { - playMovie(_startFrameAutumnOn1, _endFrameAutumnOn1, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playMovie(_startFrameAutumnOn1, _endFrameAutumnOn1, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); } break; case SEASON_WINTER: if (_gotSpeechCentre) { - playMovie(_startFrameWinterOn2, _endFrameWinterOn2, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playMovie(_startFrameWinterOn2, _endFrameWinterOn2, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); } else { - playMovie(_startFrameWinterOn1, _endFrameWinterOn1, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playMovie(_startFrameWinterOn1, _endFrameWinterOn1, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); } break; case SEASON_SPRING: - playMovie(_startFrameSpringOn, _endFrameSpringOn, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playMovie(_startFrameSpringOn, _endFrameSpringOn, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); break; default: diff --git a/engines/titanic/game/captains_wheel.cpp b/engines/titanic/game/captains_wheel.cpp index 72d3cf70d9..7a21047908 100644 --- a/engines/titanic/game/captains_wheel.cpp +++ b/engines/titanic/game/captains_wheel.cpp @@ -80,7 +80,7 @@ bool CCaptainsWheel::LeaveViewMsg(CLeaveViewMsg *msg) { _fieldE0 = false; CTurnOff offMsg; offMsg.execute(this); - playMovie(162, 168, MOVIE_GAMESTATE); + playMovie(162, 168, MOVIE_WAIT_FOR_FINISH); } return true; @@ -91,11 +91,11 @@ bool CCaptainsWheel::ActMsg(CActMsg *msg) { if (_fieldE0) { CTurnOn onMsg; onMsg.execute("RatchetySound"); - playMovie(8, 142, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(8, 142, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } } else if (msg->_action == "Honk") { if (_fieldE0) { - playMovie(150, 160, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(150, 160, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } } else if (msg->_action == "Go") { if (!_fieldE0) { @@ -105,7 +105,7 @@ bool CCaptainsWheel::ActMsg(CActMsg *msg) { CTurnOff offMsg; offMsg.execute(this); - playMovie(162, 168, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(162, 168, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } } else if (msg->_action == "Cruise") { if (_fieldE0) { @@ -115,7 +115,7 @@ bool CCaptainsWheel::ActMsg(CActMsg *msg) { CTurnOff offMsg; offMsg.execute(this); - playMovie(162, 168, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(162, 168, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } } else if (msg->_action == "SetDestin") { playSound("a#44.wav"); diff --git a/engines/titanic/game/cdrom.cpp b/engines/titanic/game/cdrom.cpp index 0d1cd3a6f2..d8d31ecc1a 100644 --- a/engines/titanic/game/cdrom.cpp +++ b/engines/titanic/game/cdrom.cpp @@ -38,21 +38,21 @@ CCDROM::CCDROM() : CGameObject() { void CCDROM::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writePoint(_tempPos, indent); + file->writePoint(_centroid, indent); CGameObject::save(file, indent); } void CCDROM::load(SimpleFile *file) { file->readNumber(); - _tempPos = file->readPoint(); + _centroid = file->readPoint(); CGameObject::load(file); } bool CCDROM::MouseDragStartMsg(CMouseDragStartMsg *msg) { if (checkStartDragging(msg)) { hideMouse(); - _tempPos = msg->_mousePos - _bounds; - setPosition(msg->_mousePos - _tempPos); + _centroid = msg->_mousePos - _bounds; + setPosition(msg->_mousePos - _centroid); return true; } else { return false; @@ -77,7 +77,7 @@ bool CCDROM::MouseDragEndMsg(CMouseDragEndMsg *msg) { } bool CCDROM::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { - setPosition(msg->_mousePos - _tempPos); + setPosition(msg->_mousePos - _centroid); return true; } diff --git a/engines/titanic/game/cdrom.h b/engines/titanic/game/cdrom.h index 017914830c..12175f6450 100644 --- a/engines/titanic/game/cdrom.h +++ b/engines/titanic/game/cdrom.h @@ -36,7 +36,7 @@ class CCDROM : public CGameObject { bool MouseDragMoveMsg(CMouseDragMoveMsg *msg); bool ActMsg(CActMsg *msg); private: - Point _tempPos; + Point _centroid; public: CLASSDEF; CCDROM(); diff --git a/engines/titanic/game/chicken_dispensor.cpp b/engines/titanic/game/chicken_dispensor.cpp index 8a56f43fff..89873dcc4d 100644 --- a/engines/titanic/game/chicken_dispensor.cpp +++ b/engines/titanic/game/chicken_dispensor.cpp @@ -89,10 +89,10 @@ bool CChickenDispensor::StatusChangeMsg(CStatusChangeMsg *msg) { setVisible(true); if (_disabled) { - playMovie(0, 12, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(0, 12, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); playSound("z#400.wav"); } else { - playMovie(12, 16, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(12, 16, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } break; @@ -186,7 +186,7 @@ bool CChickenDispensor::MouseDragStartMsg(CMouseDragStartMsg *msg) { bool CChickenDispensor::TurnOff(CTurnOff *msg) { if (getMovieFrame() != 16) setVisible(false); - playMovie(16, 12, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(16, 12, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); _dispensed = false; return true; diff --git a/engines/titanic/game/code_wheel.cpp b/engines/titanic/game/code_wheel.cpp index 441fddec02..ebffd3b570 100644 --- a/engines/titanic/game/code_wheel.cpp +++ b/engines/titanic/game/code_wheel.cpp @@ -77,13 +77,13 @@ bool CodeWheel::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { _state = (_state + 1) % 15; playMovie(START_FRAMES[_state], END_FRAMES[_state], - MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); } else { if (_state == _field108) _field110 = true; playMovie(START_FRAMES[14 - _state] + 68, END_FRAMES[14 - _state] + 68, - MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); _state = (_state <= 0) ? 14 : _state - 1; } diff --git a/engines/titanic/game/computer_screen.cpp b/engines/titanic/game/computer_screen.cpp index 98bef6eb63..7d549d0497 100644 --- a/engines/titanic/game/computer_screen.cpp +++ b/engines/titanic/game/computer_screen.cpp @@ -47,10 +47,10 @@ void CComputerScreen::load(SimpleFile *file) { bool CComputerScreen::ActMsg(CActMsg *msg) { if (msg->_action == "newCD1" || msg->_action == "newCD2") { - playMovie(27, 53, MOVIE_GAMESTATE); - playMovie(19, 26, MOVIE_GAMESTATE); + playMovie(27, 53, MOVIE_WAIT_FOR_FINISH); + playMovie(19, 26, MOVIE_WAIT_FOR_FINISH); } else if (msg->_action == "newSTCD") { - playMovie(0, 18, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playMovie(0, 18, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); } return true; diff --git a/engines/titanic/game/end_sequence_control.cpp b/engines/titanic/game/end_sequence_control.cpp index 033a7752a3..0f3a97c3a2 100644 --- a/engines/titanic/game/end_sequence_control.cpp +++ b/engines/titanic/game/end_sequence_control.cpp @@ -77,7 +77,7 @@ bool CEndSequenceControl::EnterRoomMsg(CEnterRoomMsg *msg) { bool CEndSequenceControl::EnterViewMsg(CEnterViewMsg *msg) { movieSetAudioTiming(true); - playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); return true; } diff --git a/engines/titanic/game/fan_control.cpp b/engines/titanic/game/fan_control.cpp index ca664764ea..7ed22fd560 100644 --- a/engines/titanic/game/fan_control.cpp +++ b/engines/titanic/game/fan_control.cpp @@ -121,7 +121,7 @@ bool CFanControl::StatusChangeMsg(CStatusChangeMsg *msg) { // It's puret time incTransitions(); _starlingsDying = true; - playMovie(12, 18, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(12, 18, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } else { playMovie(12, 18, 0); } diff --git a/engines/titanic/game/games_console.cpp b/engines/titanic/game/games_console.cpp index 40311f70ee..6c13f4b862 100644 --- a/engines/titanic/game/games_console.cpp +++ b/engines/titanic/game/games_console.cpp @@ -56,7 +56,7 @@ bool CGamesConsole::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { bool CGamesConsole::LeaveViewMsg(CLeaveViewMsg *msg) { if (_active) { _active = false; - playMovie(23, 44, MOVIE_GAMESTATE); + playMovie(23, 44, MOVIE_WAIT_FOR_FINISH); } return true; diff --git a/engines/titanic/game/glass_smasher.cpp b/engines/titanic/game/glass_smasher.cpp index 2123f2dfd0..7de034c2ee 100644 --- a/engines/titanic/game/glass_smasher.cpp +++ b/engines/titanic/game/glass_smasher.cpp @@ -42,7 +42,7 @@ void CGlassSmasher::load(SimpleFile *file) { bool CGlassSmasher::StatusChangeMsg(CStatusChangeMsg *msg) { setVisible(true); playSound("b#40.wav"); - playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); return true; } diff --git a/engines/titanic/game/gondolier/gondolier_base.cpp b/engines/titanic/game/gondolier/gondolier_base.cpp index f3dc31c9f5..8b753ec264 100644 --- a/engines/titanic/game/gondolier/gondolier_base.cpp +++ b/engines/titanic/game/gondolier/gondolier_base.cpp @@ -28,45 +28,45 @@ BEGIN_MESSAGE_MAP(CGondolierBase, CGameObject) ON_MESSAGE(PuzzleSolvedMsg) END_MESSAGE_MAP() -int CGondolierBase::_v1; +bool CGondolierBase::_chestOpen; bool CGondolierBase::_puzzleSolved; int CGondolierBase::_volume1; int CGondolierBase::_v4; -int CGondolierBase::_v5; int CGondolierBase::_volume2; int CGondolierBase::_v7; -int CGondolierBase::_v8; -int CGondolierBase::_v9; -int CGondolierBase::_v10; +bool CGondolierBase::_rightSliderHooked; +bool CGondolierBase::_leftSliderHooked; +bool CGondolierBase::_priorLeftSliderHooked; +bool CGondolierBase::_priorRightSliderHooked; void CGondolierBase::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_v1, indent); + file->writeNumberLine(_chestOpen, indent); file->writeNumberLine(_puzzleSolved, indent); file->writeNumberLine(_volume1, indent); file->writeNumberLine(_v4, indent); - file->writeNumberLine(_v5, indent); + file->writeNumberLine(_rightSliderHooked, indent); file->writeNumberLine(_volume2, indent); file->writeNumberLine(_v7, indent); - file->writeNumberLine(_v8, indent); - file->writeNumberLine(_v9, indent); - file->writeNumberLine(_v10, indent); + file->writeNumberLine(_leftSliderHooked, indent); + file->writeNumberLine(_priorLeftSliderHooked, indent); + file->writeNumberLine(_priorRightSliderHooked, indent); CGameObject::save(file, indent); } void CGondolierBase::load(SimpleFile *file) { file->readNumber(); - _v1 = file->readNumber(); + _chestOpen = file->readNumber(); _puzzleSolved = file->readNumber(); _volume1 = file->readNumber(); _v4 = file->readNumber(); - _v5 = file->readNumber(); + _rightSliderHooked = file->readNumber(); _volume2 = file->readNumber(); _v7 = file->readNumber(); - _v8 = file->readNumber(); - _v9 = file->readNumber(); - _v10 = file->readNumber(); + _leftSliderHooked = file->readNumber(); + _priorLeftSliderHooked = file->readNumber(); + _priorRightSliderHooked = file->readNumber(); CGameObject::load(file); } diff --git a/engines/titanic/game/gondolier/gondolier_base.h b/engines/titanic/game/gondolier/gondolier_base.h index 06d77ba85f..3b5df9f371 100644 --- a/engines/titanic/game/gondolier/gondolier_base.h +++ b/engines/titanic/game/gondolier/gondolier_base.h @@ -31,16 +31,16 @@ class CGondolierBase : public CGameObject { DECLARE_MESSAGE_MAP; bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg); protected: - static int _v1; + static bool _chestOpen; static bool _puzzleSolved; static int _volume1; static int _v4; - static int _v5; static int _volume2; static int _v7; - static int _v8; - static int _v9; - static int _v10; + static bool _leftSliderHooked; + static bool _rightSliderHooked; + static bool _priorLeftSliderHooked; + static bool _priorRightSliderHooked; public: CLASSDEF; diff --git a/engines/titanic/game/gondolier/gondolier_chest.cpp b/engines/titanic/game/gondolier/gondolier_chest.cpp index cf6656732b..6058b582f7 100644 --- a/engines/titanic/game/gondolier/gondolier_chest.cpp +++ b/engines/titanic/game/gondolier/gondolier_chest.cpp @@ -41,13 +41,13 @@ void CGondolierChest::load(SimpleFile *file) { } bool CGondolierChest::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { - if (!_v1) + if (!_chestOpen) playMovie(0, 14, MOVIE_NOTIFY_OBJECT); else if (msg->_mousePos.y < 330) return false; - else if (!_v8 && !_v5) { + else if (!_leftSliderHooked && !_rightSliderHooked) { playMovie(14, 29, 0); - _v1 = 0; + _chestOpen = false; } return true; @@ -55,7 +55,7 @@ bool CGondolierChest::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { bool CGondolierChest::MovieEndMsg(CMovieEndMsg *msg) { if (msg->_endFrame == 14) - _v1 = 1; + _chestOpen = true; return true; } diff --git a/engines/titanic/game/gondolier/gondolier_mixer.cpp b/engines/titanic/game/gondolier/gondolier_mixer.cpp index fc71ddd357..205d1f42da 100644 --- a/engines/titanic/game/gondolier/gondolier_mixer.cpp +++ b/engines/titanic/game/gondolier/gondolier_mixer.cpp @@ -141,7 +141,7 @@ bool CGondolierMixer::SignalObject(CSignalObject *msg) { if (msg->_strValue == "Fly") { _v4 = CLIP(msg->_numValue, 0, 10); - if (!_v8) { + if (!_leftSliderHooked) { _v7 = 10 - _v4; CStatusChangeMsg statusMsg; statusMsg._newStatus = _v7; @@ -152,7 +152,7 @@ bool CGondolierMixer::SignalObject(CSignalObject *msg) { if (msg->_strValue == "Tos") { _v7 = CLIP(msg->_numValue, 0, 10); - if (!_v5) { + if (!_rightSliderHooked) { _v4 = 10 - _v7; CStatusChangeMsg statusMsg; statusMsg._newStatus = _v4; @@ -160,7 +160,7 @@ bool CGondolierMixer::SignalObject(CSignalObject *msg) { } } - if (!_v4 && !_v7 && _v5 && _v8) { + if (!_v4 && !_v7 && _rightSliderHooked && _leftSliderHooked) { _puzzleSolved = true; CStatusChangeMsg statusMsg; statusMsg._newStatus = 1; diff --git a/engines/titanic/game/gondolier/gondolier_slider.cpp b/engines/titanic/game/gondolier/gondolier_slider.cpp index e7ca61de9c..b5edac57d4 100644 --- a/engines/titanic/game/gondolier/gondolier_slider.cpp +++ b/engines/titanic/game/gondolier/gondolier_slider.cpp @@ -24,7 +24,10 @@ namespace Titanic { -static const int ARRAY[11] = { 0, 0, 1, 4, 9, 15, 21, 27, 32, 35, 36 }; +/** + * Y offsets within slider for each successive thumbnail position + */ +static const int Y_OFFSETS[11] = { 0, 0, 1, 4, 9, 15, 21, 27, 32, 35, 36 }; BEGIN_MESSAGE_MAP(CGondolierSlider, CGondolierBase) ON_MESSAGE(MouseButtonDownMsg) @@ -40,86 +43,66 @@ BEGIN_MESSAGE_MAP(CGondolierSlider, CGondolierBase) END_MESSAGE_MAP() CGondolierSlider::CGondolierSlider() : CGondolierBase(), - _fieldBC(0), _fieldC0(0), _fieldC4(0), _fieldC8(0), - _arrayIndex(0), _string1("NULL"), _fieldFC(0), _field118(0) { + _sliderIndex(0), _stringUnused("NULL"), _sliderNum(0), _dragging(false) { } void CGondolierSlider::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); - file->writeNumberLine(_fieldC0, indent); - file->writeNumberLine(_fieldC4, indent); - file->writeNumberLine(_fieldC8, indent); - file->writeNumberLine(_sliderRect1.left, indent); - file->writeNumberLine(_sliderRect1.top, indent); - file->writeNumberLine(_sliderRect1.right, indent); - file->writeNumberLine(_sliderRect1.bottom, indent); - file->writeNumberLine(_sliderRect2.left, indent); - file->writeNumberLine(_sliderRect2.top, indent); - file->writeNumberLine(_sliderRect2.right, indent); - file->writeNumberLine(_sliderRect2.bottom, indent); - file->writeNumberLine(_sliderRect1.left, indent); - file->writeQuotedLine(_string1, indent); - file->writeNumberLine(_fieldFC, indent); - file->writeQuotedLine(_string2, indent); - file->writeQuotedLine(_string3, indent); - file->writeNumberLine(_field118, indent); + file->writeRect(_rectUnused, indent); + file->writeRect(_thumbRect, indent); + file->writeRect(_defaultThumbRect, indent); + file->writeNumberLine(_sliderIndex, indent); + file->writeQuotedLine(_stringUnused, indent); + file->writeNumberLine(_sliderNum, indent); + file->writeQuotedLine(_armName, indent); + file->writeQuotedLine(_signalTarget, indent); + file->writeNumberLine(_dragging, indent); CGondolierBase::save(file, indent); } void CGondolierSlider::load(SimpleFile *file) { file->readNumber(); - _fieldBC = file->readNumber(); - _fieldC0 = file->readNumber(); - _fieldC4 = file->readNumber(); - _fieldC8 = file->readNumber(); - _sliderRect1.left = file->readNumber(); - _sliderRect1.top = file->readNumber(); - _sliderRect1.right = file->readNumber(); - _sliderRect1.bottom = file->readNumber(); - _sliderRect2.left = file->readNumber(); - _sliderRect2.top = file->readNumber(); - _sliderRect2.right = file->readNumber(); - _sliderRect2.bottom = file->readNumber(); - _arrayIndex = file->readNumber(); - _string1 = file->readString(); - _fieldFC = file->readNumber(); - _string2 = file->readString(); - _string3 = file->readString(); - _field118 = file->readNumber(); + _rectUnused = file->readRect(); + _thumbRect = file->readRect(); + _defaultThumbRect = file->readRect(); + _sliderIndex = file->readNumber(); + _stringUnused = file->readString(); + _sliderNum = file->readNumber(); + _armName = file->readString(); + _signalTarget = file->readString(); + _dragging = file->readNumber(); CGondolierBase::load(file); } bool CGondolierSlider::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { - if (!_v1) + if (!_chestOpen) return false; - if (_fieldFC ? _v5 : _v8) + if (_sliderNum ? _rightSliderHooked : _leftSliderHooked) return false; - return _sliderRect1.contains(msg->_mousePos); + return _thumbRect.contains(msg->_mousePos); } bool CGondolierSlider::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { - if (!(_fieldFC ? _v5 : _v8)) { + if (!(_sliderNum ? _rightSliderHooked : _leftSliderHooked)) { int minVal = 0x7FFFFFFF; int foundIndex = -1; - int yp = (_sliderRect2.top + _sliderRect2.bottom) / 2 + int yp = (_defaultThumbRect.top + _defaultThumbRect.bottom) / 2 + _bounds.top - msg->_mousePos.y; for (int idx = 0; idx < 11; ++idx) { - int yv = yp + ARRAY[idx]; - if (yv < 0) - yv = -yv; - if (yv < minVal) { - minVal = yv; + int yDiff = ABS(yp + Y_OFFSETS[idx]); + + if (yDiff < minVal) { + minVal = yDiff; foundIndex = idx; } } if (foundIndex >= 0) { - _arrayIndex = foundIndex; + _sliderIndex = foundIndex; CSignalObject signalMsg; signalMsg.execute(this); } @@ -135,70 +118,70 @@ bool CGondolierSlider::EnterViewMsg(CEnterViewMsg *msg) { } bool CGondolierSlider::MouseDragStartMsg(CMouseDragStartMsg *msg) { - if (!_v1) + if (!_chestOpen) return false; - if (_fieldFC ? _v5 : _v8) + if (_sliderNum ? _rightSliderHooked : _leftSliderHooked) return false; - _field118 = checkStartDragging(msg); - return _field118; + _dragging = checkStartDragging(msg); + return _dragging; } bool CGondolierSlider::StatusChangeMsg(CStatusChangeMsg *msg) { - _arrayIndex = CLIP(10 - msg->_newStatus, 0, 10); - _sliderRect1 = _sliderRect2; - _sliderRect1.translate(_bounds.left, _bounds.top); - _sliderRect1.translate(0, ARRAY[_arrayIndex]); + _sliderIndex = CLIP(10 - msg->_newStatus, 0, 10); + _thumbRect = _defaultThumbRect; + _thumbRect.translate(_bounds.left, _bounds.top); + _thumbRect.translate(0, Y_OFFSETS[_sliderIndex]); - loadFrame(_arrayIndex); + loadFrame(_sliderIndex); return true; } bool CGondolierSlider::MouseDragEndMsg(CMouseDragEndMsg *msg) { - _field118 = false; + _dragging = false; return true; } bool CGondolierSlider::IsHookedOnMsg(CIsHookedOnMsg *msg) { - if (_fieldFC ? _v5 : _v8) + if (_sliderNum ? _rightSliderHooked : _leftSliderHooked) return false; - if (!_sliderRect1.intersects(msg->_rect)) { - _string2 = CString(); - msg->_result = false; + if (!_thumbRect.intersects(msg->_rect)) { + _armName = CString(); + msg->_isHooked = false; } else { - _string2 = _string1; - if (_fieldFC) { - _v5 = _v9 = 1; + _armName = msg->_armName; + if (_sliderNum) { + _rightSliderHooked = _priorLeftSliderHooked = true; } else { - _v8 = _v10 = 1; + _leftSliderHooked = _priorRightSliderHooked = true; } - msg->_result = true; + msg->_isHooked = true; } return true; } bool CGondolierSlider::FrameMsg(CFrameMsg *msg) { - if (_fieldFC ? _v5 : _v8) { - if (_arrayIndex < 10) { - ++_arrayIndex; + if (_sliderNum ? _rightSliderHooked : _leftSliderHooked) { + if (_sliderIndex < 10) { + ++_sliderIndex; CSignalObject signalMsg; signalMsg.execute(this); int yp = 0; - if (_arrayIndex > 0) - yp = ARRAY[_arrayIndex] - ARRAY[_arrayIndex - 1]; + if (_sliderIndex > 0) + yp = Y_OFFSETS[_sliderIndex] - Y_OFFSETS[_sliderIndex - 1]; - if (!_string2.empty()) { + if (!_armName.empty()) { CTranslateObjectMsg transMsg; transMsg._delta = Point(0, yp); - transMsg.execute(_string2); + transMsg.execute(_armName); } } - } else if (_fieldFC ? _v10 : _v9) { - if (!_field118 && !_puzzleSolved && _arrayIndex > 0) { + } else if (_sliderNum ? _priorRightSliderHooked : _priorLeftSliderHooked) { + if (!_dragging && !_puzzleSolved && _sliderIndex > 0) { CSignalObject signalMsg; signalMsg.execute(this); } @@ -208,28 +191,28 @@ bool CGondolierSlider::FrameMsg(CFrameMsg *msg) { } bool CGondolierSlider::SignalObject(CSignalObject *msg) { - _arrayIndex = CLIP(_arrayIndex, 0, 10); - _sliderRect1 = _sliderRect2; - _sliderRect1.translate(_bounds.left, _bounds.top); - _sliderRect1.translate(0, ARRAY[_arrayIndex]); - loadFrame(_arrayIndex); + _sliderIndex = CLIP(_sliderIndex, 0, 10); + _thumbRect = _defaultThumbRect; + _thumbRect.translate(_bounds.left, _bounds.top); + _thumbRect.translate(0, Y_OFFSETS[_sliderIndex]); + loadFrame(_sliderIndex); CSignalObject signalMsg; - signalMsg._numValue = 10 - _arrayIndex; - signalMsg._strValue = _fieldFC ? "Fly" : "Tos"; - signalMsg.execute(_string3); + signalMsg._numValue = 10 - _sliderIndex; + signalMsg._strValue = _sliderNum ? "Fly" : "Tos"; + signalMsg.execute(_signalTarget); return true; } bool CGondolierSlider::ActMsg(CActMsg *msg) { if (msg->_action == "Unhook") { - if (_fieldFC) { - _v5 = _v9 = 0; - _v10 = _v8; + if (_sliderNum) { + _rightSliderHooked = _priorLeftSliderHooked = false; + _priorRightSliderHooked = _leftSliderHooked; } else { - _v8 = _v10 = 0; - _v9 = _v5; + _leftSliderHooked = _priorRightSliderHooked = false; + _priorLeftSliderHooked = _rightSliderHooked; } } diff --git a/engines/titanic/game/gondolier/gondolier_slider.h b/engines/titanic/game/gondolier/gondolier_slider.h index d1562f5b2d..0679c0d993 100644 --- a/engines/titanic/game/gondolier/gondolier_slider.h +++ b/engines/titanic/game/gondolier/gondolier_slider.h @@ -40,18 +40,15 @@ class CGondolierSlider : public CGondolierBase { bool SignalObject(CSignalObject *msg); bool ActMsg(CActMsg *msg); private: - int _fieldBC; - int _fieldC0; - int _fieldC4; - int _fieldC8; - Rect _sliderRect1; - Rect _sliderRect2; - int _arrayIndex; - CString _string1; - int _fieldFC; - CString _string2; - CString _string3; - bool _field118; + Rect _rectUnused; + Rect _thumbRect; + Rect _defaultThumbRect; + int _sliderIndex; + CString _stringUnused; + int _sliderNum; + CString _armName; + CString _signalTarget; + bool _dragging; public: CLASSDEF; CGondolierSlider(); diff --git a/engines/titanic/game/hammer_dispensor.cpp b/engines/titanic/game/hammer_dispensor.cpp index 2450868b14..82aeec12cb 100644 --- a/engines/titanic/game/hammer_dispensor.cpp +++ b/engines/titanic/game/hammer_dispensor.cpp @@ -77,9 +77,9 @@ bool CHammerDispensor::EnterViewMsg(CEnterViewMsg *msg) { bool CHammerDispensor::LeaveViewMsg(CLeaveViewMsg *msg) { if (_isOpen) - playMovie(32, 50, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(32, 50, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); else - playMovie(0, 7, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(0, 7, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); _panUp = true; _isOpen = false; diff --git a/engines/titanic/game/head_slot.cpp b/engines/titanic/game/head_slot.cpp index 06c366abd6..b0b7ee14be 100644 --- a/engines/titanic/game/head_slot.cpp +++ b/engines/titanic/game/head_slot.cpp @@ -101,13 +101,13 @@ bool CHeadSlot::EnterViewMsg(CEnterViewMsg *msg) { _cursorId = CURSOR_ARROW; if (_v1 == 1 || _string1 == "Working") { - playMovie(_fieldE0, _fieldE4, MOVIE_GAMESTATE); + playMovie(_fieldE0, _fieldE4, MOVIE_WAIT_FOR_FINISH); _fieldEC = true; } else if (_fieldBC) { - playMovie(_fieldE0, _fieldE8, MOVIE_GAMESTATE); + playMovie(_fieldE0, _fieldE8, MOVIE_WAIT_FOR_FINISH); _fieldEC = false; } else { - playMovie(0, _fieldDC, MOVIE_GAMESTATE); + playMovie(0, _fieldDC, MOVIE_WAIT_FOR_FINISH); } addTimer(5000 + getRandomNumber(3000)); @@ -120,11 +120,11 @@ bool CHeadSlot::LeaveViewMsg(CLeaveViewMsg *msg) { if (_fieldBC) { loadFrame(_fieldE0); - playMovie(_fieldE0, _fieldE8, MOVIE_GAMESTATE); + playMovie(_fieldE0, _fieldE8, MOVIE_WAIT_FOR_FINISH); _fieldEC = false; } else { loadFrame(_fieldDC); - playMovie(_fieldDC, _fieldE0, MOVIE_GAMESTATE); + playMovie(_fieldDC, _fieldE0, MOVIE_WAIT_FOR_FINISH); } _fieldEC = false; diff --git a/engines/titanic/game/head_smash_event.cpp b/engines/titanic/game/head_smash_event.cpp index 5ec3d299d5..dd5e516b0d 100644 --- a/engines/titanic/game/head_smash_event.cpp +++ b/engines/titanic/game/head_smash_event.cpp @@ -42,7 +42,7 @@ void CHeadSmashEvent::load(SimpleFile *file) { bool CHeadSmashEvent::ActMsg(CActMsg *msg) { if (msg->_action == "PlayToEnd") { setVisible(true); - playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } return true; diff --git a/engines/titanic/game/long_stick_dispenser.cpp b/engines/titanic/game/long_stick_dispenser.cpp index bf2dae53be..c340cae75b 100644 --- a/engines/titanic/game/long_stick_dispenser.cpp +++ b/engines/titanic/game/long_stick_dispenser.cpp @@ -109,9 +109,9 @@ bool CLongStickDispenser::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { bool CLongStickDispenser::LeaveViewMsg(CLeaveViewMsg *msg) { if (_fieldC0 == 1) { if (_fieldC4) { - playMovie(19, 38, MOVIE_GAMESTATE); + playMovie(19, 38, MOVIE_WAIT_FOR_FINISH); } else { - playMovie(0, 18, MOVIE_GAMESTATE); + playMovie(0, 18, MOVIE_WAIT_FOR_FINISH); _fieldBC = 1; } diff --git a/engines/titanic/game/nut_replacer.cpp b/engines/titanic/game/nut_replacer.cpp index 6b05d1d0e9..3b1247fd8c 100644 --- a/engines/titanic/game/nut_replacer.cpp +++ b/engines/titanic/game/nut_replacer.cpp @@ -41,7 +41,7 @@ void CNutReplacer::load(SimpleFile *file) { bool CNutReplacer::ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg) { setVisible(true); - playMovie(MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playMovie(MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); return true; } diff --git a/engines/titanic/game/parrot/parrot_nut_eater.cpp b/engines/titanic/game/parrot/parrot_nut_eater.cpp index b9697d7b61..7196d76ccb 100644 --- a/engines/titanic/game/parrot/parrot_nut_eater.cpp +++ b/engines/titanic/game/parrot/parrot_nut_eater.cpp @@ -67,7 +67,7 @@ bool CParrotNutEater::ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg) { bool CParrotNutEater::NutPuzzleMsg(CNutPuzzleMsg *msg) { if (msg->_value == "Jiggle") { setVisible(true); - playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); movieEvent(68); movieEvent(132); playSound("z#215.wav"); diff --git a/engines/titanic/game/phonograph.cpp b/engines/titanic/game/phonograph.cpp index 2b7bc98244..b86fa0b6e0 100644 --- a/engines/titanic/game/phonograph.cpp +++ b/engines/titanic/game/phonograph.cpp @@ -34,8 +34,8 @@ BEGIN_MESSAGE_MAP(CPhonograph, CMusicPlayer) END_MESSAGE_MAP() CPhonograph::CPhonograph() : CMusicPlayer(), - _isPlaying(false), _isRecording(false), _isDisabled(false), _fieldEC(0), - _fieldF0(0), _fieldF4(0) { + _isPlaying(false), _isRecording(false), _isDisabled(false), + _playUnpressedFrame(false), _playPressedFrame(false), _unused5(0) { } void CPhonograph::save(SimpleFile *file, int indent) { @@ -44,9 +44,9 @@ void CPhonograph::save(SimpleFile *file, int indent) { file->writeNumberLine(_isPlaying, indent); file->writeNumberLine(_isRecording, indent); file->writeNumberLine(_isDisabled, indent); - file->writeNumberLine(_fieldEC, indent); - file->writeNumberLine(_fieldF0, indent); - file->writeNumberLine(_fieldF4, indent); + file->writeNumberLine(_playUnpressedFrame, indent); + file->writeNumberLine(_playPressedFrame, indent); + file->writeNumberLine(_unused5, indent); CMusicPlayer::save(file, indent); } @@ -57,9 +57,9 @@ void CPhonograph::load(SimpleFile *file) { _isPlaying = file->readNumber(); _isRecording = file->readNumber(); _isDisabled = file->readNumber(); - _fieldEC = file->readNumber(); - _fieldF0 = file->readNumber(); - _fieldF4 = file->readNumber(); + _playUnpressedFrame = file->readNumber(); + _playPressedFrame = file->readNumber(); + _unused5 = file->readNumber(); CMusicPlayer::load(file); } @@ -98,7 +98,6 @@ bool CPhonograph::PhonographStopMsg(CPhonographStopMsg *msg) { if (!holderMsg._isPresent) return true; - _isPlaying = false; CQueryCylinderMsg cylinderMsg; cylinderMsg.execute(holderMsg._target); diff --git a/engines/titanic/game/phonograph.h b/engines/titanic/game/phonograph.h index 4cce6ecefd..6630a18f27 100644 --- a/engines/titanic/game/phonograph.h +++ b/engines/titanic/game/phonograph.h @@ -41,9 +41,9 @@ protected: bool _isPlaying; bool _isRecording; bool _isDisabled; - int _fieldEC; - int _fieldF0; - int _fieldF4; + int _playUnpressedFrame; + int _playPressedFrame; + int _unused5; public: CLASSDEF; CPhonograph(); diff --git a/engines/titanic/game/phonograph_lid.cpp b/engines/titanic/game/phonograph_lid.cpp index e4e5f4882c..cde9415e02 100644 --- a/engines/titanic/game/phonograph_lid.cpp +++ b/engines/titanic/game/phonograph_lid.cpp @@ -76,7 +76,7 @@ bool CPhonographLid::LockPhonographMsg(CLockPhonographMsg *msg) { bool CPhonographLid::LeaveViewMsg(CLeaveViewMsg *msg) { if (_open) { - playMovie(27, 55, MOVIE_GAMESTATE); + playMovie(27, 55, MOVIE_WAIT_FOR_FINISH); _open = false; } diff --git a/engines/titanic/game/play_on_act.cpp b/engines/titanic/game/play_on_act.cpp index 9c368c335d..ffed45c11f 100644 --- a/engines/titanic/game/play_on_act.cpp +++ b/engines/titanic/game/play_on_act.cpp @@ -45,7 +45,7 @@ bool CPlayOnAct::ActMsg(CActMsg *msg) { playMovie(0); } else if (msg->_action == "PlayToEnd") { setVisible(true); - playMovie(MOVIE_GAMESTATE); + playMovie(MOVIE_WAIT_FOR_FINISH); } return true; diff --git a/engines/titanic/game/port_hole.cpp b/engines/titanic/game/port_hole.cpp index 25807b1b1d..9111561588 100644 --- a/engines/titanic/game/port_hole.cpp +++ b/engines/titanic/game/port_hole.cpp @@ -79,7 +79,7 @@ bool CPortHole::MovieEndMsg(CMovieEndMsg *msg) { bool CPortHole::LeaveViewMsg(CLeaveViewMsg *msg) { if (_open) { playSound(_closeSoundName); - playMovie(14, 26, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(14, 26, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); _open = false; } diff --git a/engines/titanic/game/replacement_ear.cpp b/engines/titanic/game/replacement_ear.cpp index e8bd384207..d1274e92db 100644 --- a/engines/titanic/game/replacement_ear.cpp +++ b/engines/titanic/game/replacement_ear.cpp @@ -40,7 +40,7 @@ void CReplacementEar::load(SimpleFile *file) { bool CReplacementEar::VisibleMsg(CVisibleMsg *msg) { setVisible(true); - playMovie(MOVIE_GAMESTATE); + playMovie(MOVIE_WAIT_FOR_FINISH); playSound("z#64.wav"); return true; } diff --git a/engines/titanic/game/restaurant_cylinder_holder.cpp b/engines/titanic/game/restaurant_cylinder_holder.cpp index 8a2581b32b..eddd4d2288 100644 --- a/engines/titanic/game/restaurant_cylinder_holder.cpp +++ b/engines/titanic/game/restaurant_cylinder_holder.cpp @@ -70,11 +70,11 @@ bool CRestaurantCylinderHolder::EjectCylinderMsg(CEjectCylinderMsg *msg) { if (_isOpen) { playClip(hasCylinder ? "CloseHolder_Full" : "CloseHolder_Empty", - MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); _dropEnabled = true; } else { playClip(hasCylinder ? "OpenHolder_Full" : "OpenHolder_Empty", - MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } playSound(_ejectSoundName, 50); diff --git a/engines/titanic/game/restaurant_phonograph.cpp b/engines/titanic/game/restaurant_phonograph.cpp index a2c8892201..3b35514a52 100644 --- a/engines/titanic/game/restaurant_phonograph.cpp +++ b/engines/titanic/game/restaurant_phonograph.cpp @@ -36,11 +36,11 @@ BEGIN_MESSAGE_MAP(CRestaurantPhonograph, CPhonograph) END_MESSAGE_MAP() CRestaurantPhonograph::CRestaurantPhonograph() : CPhonograph(), - _fieldF8(1), _field114(0) {} + _isLocked(true), _field114(0) {} void CRestaurantPhonograph::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldF8, indent); + file->writeNumberLine(_isLocked, indent); file->writeQuotedLine(_ejectSoundName, indent); file->writeQuotedLine(_stopSoundName, indent); @@ -51,7 +51,7 @@ void CRestaurantPhonograph::save(SimpleFile *file, int indent) { void CRestaurantPhonograph::load(SimpleFile *file) { file->readNumber(); - _fieldF8 = file->readNumber(); + _isLocked = file->readNumber(); _ejectSoundName = file->readString(); _stopSoundName = file->readString(); _field114 = file->readNumber(); @@ -60,20 +60,22 @@ void CRestaurantPhonograph::load(SimpleFile *file) { } bool CRestaurantPhonograph::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { - if (!_fieldF8 && !_isPlaying) { + if (!_isLocked && !_isPlaying) { CQueryCylinderHolderMsg holderMsg; holderMsg.execute(this); if (!holderMsg._isOpen) { + // Start playing immediately CPhonographPlayMsg playMsg; playMsg.execute(this); } else if (holderMsg._isPresent) { + // Need to close the cylinder holder before playing CEjectCylinderMsg ejectMsg; - ejectMsg.execute(this); + ejectMsg.execute(this, nullptr, MSGFLAG_SCAN); _isDisabled = true; if (_field114) { - loadFrame(_fieldEC); + loadFrame(_playUnpressedFrame); playSound(_ejectSoundName); } } @@ -83,9 +85,11 @@ bool CRestaurantPhonograph::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { } bool CRestaurantPhonograph::PhonographPlayMsg(CPhonographPlayMsg *msg) { + CPhonograph::PhonographPlayMsg(msg); + if (_isPlaying) { if (findView() == getView() && (!_isDisabled || !_field114)) { - loadFrame(_fieldEC); + loadFrame(_playUnpressedFrame); playSound(_ejectSoundName); } @@ -94,7 +98,7 @@ bool CRestaurantPhonograph::PhonographPlayMsg(CPhonographPlayMsg *msg) { CRestaurantMusicChanged musicMsg(nameMsg._name); musicMsg.execute(findRoom()); } else { - loadFrame(_fieldF0); + loadFrame(_playPressedFrame); } return true; @@ -105,11 +109,11 @@ bool CRestaurantPhonograph::PhonographStopMsg(CPhonographStopMsg *msg) { CPhonograph::PhonographStopMsg(msg); if (_isPlaying) { - loadFrame(_fieldF0); + loadFrame(_playUnpressedFrame); + } else { + loadFrame(_playPressedFrame); if (flag) playSound(_stopSoundName); - } else { - loadFrame(_fieldEC); } return true; @@ -135,12 +139,12 @@ bool CRestaurantPhonograph::EjectCylinderMsg(CEjectCylinderMsg *msg) { } bool CRestaurantPhonograph::QueryPhonographState(CQueryPhonographState *msg) { - msg->_value = _fieldF8; + msg->_value = _isLocked; return true; } bool CRestaurantPhonograph::LockPhonographMsg(CLockPhonographMsg *msg) { - _fieldF8 = msg->_value; + _isLocked = msg->_value; return true; } diff --git a/engines/titanic/game/restaurant_phonograph.h b/engines/titanic/game/restaurant_phonograph.h index 8f72eaf58f..67248447ab 100644 --- a/engines/titanic/game/restaurant_phonograph.h +++ b/engines/titanic/game/restaurant_phonograph.h @@ -37,7 +37,7 @@ class CRestaurantPhonograph : public CPhonograph { bool QueryPhonographState(CQueryPhonographState *msg); bool LockPhonographMsg(CLockPhonographMsg *msg); private: - int _fieldF8; + bool _isLocked; CString _ejectSoundName; CString _stopSoundName; int _field114; diff --git a/engines/titanic/game/season_background.cpp b/engines/titanic/game/season_background.cpp index 20ad6aca1d..d663c405ce 100644 --- a/engines/titanic/game/season_background.cpp +++ b/engines/titanic/game/season_background.cpp @@ -65,39 +65,39 @@ bool CSeasonBackground::ChangeSeasonMsg(CChangeSeasonMsg *msg) { switch (_seasonNum) { case SEASON_SUMMER: - playMovie(0, 45, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(0, 45, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); _defaultFrame = 45; break; case SEASON_AUTUMN: if (_flag) { - playMovie(232, 278, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(232, 278, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); _defaultFrame = 278; } else { - playMovie(45, 91, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(45, 91, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); _defaultFrame = 91; } break; case SEASON_WINTER: if (_flag) { - playMovie(278, 326, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(278, 326, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); _defaultFrame = 326; } else { CStatusChangeMsg changeMsg; changeMsg._newStatus = 0; changeMsg.execute("PickUpSpeechCentre"); - playMovie(91, 139, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(91, 139, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); _defaultFrame = 139; } break; case SEASON_SPRING: if (_flag) { - playMovie(326, 417, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(326, 417, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); _defaultFrame = 417; } else { - playMovie(139, 228, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(139, 228, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); _defaultFrame = 228; } break; diff --git a/engines/titanic/game/sgt/armchair.cpp b/engines/titanic/game/sgt/armchair.cpp index 681b1ae61d..6c0e7fe0ca 100644 --- a/engines/titanic/game/sgt/armchair.cpp +++ b/engines/titanic/game/sgt/armchair.cpp @@ -55,7 +55,7 @@ bool CArmchair::TurnOn(CTurnOn *msg) { _endFrame = 10; } - playMovie(_startFrame, _endFrame, MOVIE_GAMESTATE); + playMovie(_startFrame, _endFrame, MOVIE_WAIT_FOR_FINISH); playSound("b#0.wav"); _statics->_armchair = "Open"; _isClosed = false; @@ -70,7 +70,7 @@ bool CArmchair::TurnOff(CTurnOff *msg) { _startFrame = 11; _endFrame = 21; _isClosed = true; - playMovie(11, 21, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playMovie(11, 21, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); playSound("b#0.wav"); } diff --git a/engines/titanic/game/sgt/basin.cpp b/engines/titanic/game/sgt/basin.cpp index ce34a49250..fe3216e002 100644 --- a/engines/titanic/game/sgt/basin.cpp +++ b/engines/titanic/game/sgt/basin.cpp @@ -48,7 +48,7 @@ bool CBasin::TurnOn(CTurnOn *msg) { _isClosed = false; _startFrame = 0; _endFrame = 6; - playMovie(0, 6, MOVIE_GAMESTATE); + playMovie(0, 6, MOVIE_WAIT_FOR_FINISH); playSound("b#13.wav"); } @@ -61,7 +61,7 @@ bool CBasin::TurnOff(CTurnOff *msg) { _isClosed = true; _startFrame = 8; _endFrame = 14; - playMovie(8, 14, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(8, 14, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); playSound("b#13.wav"); } diff --git a/engines/titanic/game/sgt/bedfoot.cpp b/engines/titanic/game/sgt/bedfoot.cpp index d84a73f0a5..8f90e0f100 100644 --- a/engines/titanic/game/sgt/bedfoot.cpp +++ b/engines/titanic/game/sgt/bedfoot.cpp @@ -53,7 +53,7 @@ bool CBedfoot::TurnOn(CTurnOn *msg) { playSound("b#4.wav"); } - playMovie(_startFrame, _endFrame, MOVIE_GAMESTATE); + playMovie(_startFrame, _endFrame, MOVIE_WAIT_FOR_FINISH); } else if (_statics->_bedfoot == "RestingUnderTV") { _isClosed = false; _startFrame = 8; @@ -65,7 +65,7 @@ bool CBedfoot::TurnOn(CTurnOn *msg) { playSound("192_436_bed hits floor.wav"); } - playMovie(_startFrame, _endFrame, MOVIE_GAMESTATE); + playMovie(_startFrame, _endFrame, MOVIE_WAIT_FOR_FINISH); } if (_statics->_bedfoot == "Open") @@ -94,7 +94,7 @@ bool CBedfoot::TurnOff(CTurnOff *msg) { _endFrame = 25; } - playMovie(_startFrame, _endFrame, MOVIE_GAMESTATE); + playMovie(_startFrame, _endFrame, MOVIE_WAIT_FOR_FINISH); playSound("b#7.wav"); } else if (_statics->_bedfoot == "NotOnWashstand" && _statics->_bedhead == "ClosedWrong") { @@ -109,14 +109,14 @@ bool CBedfoot::TurnOff(CTurnOff *msg) { _endFrame = 25; } - playMovie(_startFrame, _endFrame, MOVIE_GAMESTATE); + playMovie(_startFrame, _endFrame, MOVIE_WAIT_FOR_FINISH); playSound("b#7.wav"); } else if (_statics->_bedfoot == "RestingUTV" && _statics->_tv == "Closed") { _statics->_bedfoot = "Closed"; _startFrame = 25; _endFrame = 30; - playMovie(25, 30, MOVIE_GAMESTATE); + playMovie(25, 30, MOVIE_WAIT_FOR_FINISH); playSound("b#7.wav"); } diff --git a/engines/titanic/game/sgt/bedhead.cpp b/engines/titanic/game/sgt/bedhead.cpp index b42c1c1146..1356afea83 100644 --- a/engines/titanic/game/sgt/bedhead.cpp +++ b/engines/titanic/game/sgt/bedhead.cpp @@ -110,7 +110,7 @@ bool CBedhead::TurnOn(CTurnOn *msg) { setVisible(true); _statics->_bedhead = entry._name4; - playMovie(entry._startFrame, entry._endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(entry._startFrame, entry._endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); playSound("b#6.wav"); _isClosed = false; } @@ -157,7 +157,7 @@ bool CBedhead::TurnOff(CTurnOff *msg) { setVisible(true); _statics->_bedhead = entry._name4; - playMovie(entry._startFrame, entry._endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(entry._startFrame, entry._endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); playSound("193_436_bed fold up 1.wav"); _isClosed = false; } diff --git a/engines/titanic/game/sgt/chest_of_drawers.cpp b/engines/titanic/game/sgt/chest_of_drawers.cpp index 9e00d4fde7..648308fc8f 100644 --- a/engines/titanic/game/sgt/chest_of_drawers.cpp +++ b/engines/titanic/game/sgt/chest_of_drawers.cpp @@ -46,7 +46,7 @@ bool CChestOfDrawers::TurnOn(CTurnOn *msg) { _statics->_chestOfDrawers = "Open"; _startFrame = 1; _endFrame = 14; - playMovie(1, 14, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(1, 14, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); playSound("b#11.wav"); } @@ -62,7 +62,7 @@ bool CChestOfDrawers::TurnOff(CTurnOff *msg) { _startFrame = 14; _endFrame = 27; - playMovie(14, 27, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(14, 27, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); playSound("b#11.wav"); } diff --git a/engines/titanic/game/sgt/desk.cpp b/engines/titanic/game/sgt/desk.cpp index a31efe9e5d..1aea9a8ab3 100644 --- a/engines/titanic/game/sgt/desk.cpp +++ b/engines/titanic/game/sgt/desk.cpp @@ -47,7 +47,7 @@ bool CDesk::TurnOn(CTurnOn *msg) { _isClosed = false; _startFrame = 1; _endFrame = 26; - playMovie(1, 26, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(1, 26, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); playSound("b#12.wav"); } @@ -64,7 +64,7 @@ bool CDesk::TurnOff(CTurnOff *msg) { _isClosed = true; _startFrame = 26; _endFrame = 51; - playMovie(26, 51, MOVIE_GAMESTATE); + playMovie(26, 51, MOVIE_WAIT_FOR_FINISH); playSound("b#9.wav"); } diff --git a/engines/titanic/game/sgt/deskchair.cpp b/engines/titanic/game/sgt/deskchair.cpp index 2b25f57d03..23b6ad64d7 100644 --- a/engines/titanic/game/sgt/deskchair.cpp +++ b/engines/titanic/game/sgt/deskchair.cpp @@ -48,7 +48,7 @@ bool CDeskchair::TurnOn(CTurnOn *msg) { _isClosed = false; _startFrame = 0; _endFrame = 16; - playMovie(0, 16, MOVIE_GAMESTATE); + playMovie(0, 16, MOVIE_WAIT_FOR_FINISH); playSound("b#8.wav"); } @@ -61,7 +61,7 @@ bool CDeskchair::TurnOff(CTurnOff *msg) { _isClosed = true; _startFrame = 16; _endFrame = 32; - playMovie(16, 32, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(16, 32, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); playSound("b#2.wav"); } diff --git a/engines/titanic/game/sgt/drawer.cpp b/engines/titanic/game/sgt/drawer.cpp index 68752b3d2f..7288bbdc61 100644 --- a/engines/titanic/game/sgt/drawer.cpp +++ b/engines/titanic/game/sgt/drawer.cpp @@ -53,7 +53,7 @@ bool CDrawer::TurnOn(CTurnOn *msg) { _endFrame = 75; setVisible(true); _statics->_drawer = "Open"; - playMovie(_startFrame, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(_startFrame, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); playSound("b#10.wav"); } @@ -66,7 +66,7 @@ bool CDrawer::TurnOff(CTurnOff *msg) { _startFrame = 75; _endFrame = 100; _isClosed = true; - playMovie(_startFrame, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(_startFrame, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); playSound("b#10.wav"); } diff --git a/engines/titanic/game/sgt/sgt_doors.cpp b/engines/titanic/game/sgt/sgt_doors.cpp index 71eae9800c..2dabd21077 100644 --- a/engines/titanic/game/sgt/sgt_doors.cpp +++ b/engines/titanic/game/sgt/sgt_doors.cpp @@ -60,9 +60,9 @@ bool CSGTDoors::EnterViewMsg(CEnterViewMsg *msg) { if (pet->getRooms1CC() == 1) playMovie(START_FRAMES[roomNum], END_FRAMES[roomNum], - MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); else - playMovie(0, 12, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(0, 12, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } return true; @@ -89,9 +89,9 @@ bool CSGTDoors::LeaveRoomMsg(CLeaveRoomMsg *msg) { if (pet->getRooms1CC() == 1) playMovie(START_FRAMES[roomNum], END_FRAMES[roomNum], - MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); else - playMovie(12, 25, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(12, 25, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } return true; diff --git a/engines/titanic/game/sgt/sgt_navigation.cpp b/engines/titanic/game/sgt/sgt_navigation.cpp index 031226226f..d0b57ba1ec 100644 --- a/engines/titanic/game/sgt/sgt_navigation.cpp +++ b/engines/titanic/game/sgt/sgt_navigation.cpp @@ -71,9 +71,9 @@ bool CSGTNavigation::StatusChangeMsg(CStatusChangeMsg *msg) { int startVal = pet->getRooms1CC(); if (startVal > _statics->_changeViewNum) - playMovie(FRAMES[startVal], FRAMES[_statics->_changeViewNum], MOVIE_GAMESTATE); + playMovie(FRAMES[startVal], FRAMES[_statics->_changeViewNum], MOVIE_WAIT_FOR_FINISH); else - playMovie(FRAMES[startVal + 3], FRAMES[_statics->_changeViewNum + 3], MOVIE_GAMESTATE); + playMovie(FRAMES[startVal + 3], FRAMES[_statics->_changeViewNum + 3], MOVIE_WAIT_FOR_FINISH); _cursorId = _statics->_changeViewNum != 1 ? CURSOR_MOVE_FORWARD : CURSOR_INVALID; diff --git a/engines/titanic/game/sgt/sgt_tv.cpp b/engines/titanic/game/sgt/sgt_tv.cpp index ebec334781..5ce7c5b20e 100644 --- a/engines/titanic/game/sgt/sgt_tv.cpp +++ b/engines/titanic/game/sgt/sgt_tv.cpp @@ -46,7 +46,7 @@ bool CSGTTV::TurnOff(CTurnOff *msg) { _isClosed = true; _startFrame = 6; _endFrame = 12; - playMovie(6, 12, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(6, 12, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } return true; @@ -60,7 +60,7 @@ bool CSGTTV::TurnOn(CTurnOn *msg) { _isClosed = false; _startFrame = 1; _endFrame = 6; - playMovie(1, 6, MOVIE_GAMESTATE); + playMovie(1, 6, MOVIE_WAIT_FOR_FINISH); } return true; diff --git a/engines/titanic/game/sgt/toilet.cpp b/engines/titanic/game/sgt/toilet.cpp index 544cdda0c6..0f796c2b9d 100644 --- a/engines/titanic/game/sgt/toilet.cpp +++ b/engines/titanic/game/sgt/toilet.cpp @@ -50,7 +50,7 @@ bool CToilet::TurnOn(CTurnOn *msg) { _isClosed = false; _startFrame = 0; _endFrame = 11; - playMovie(0, 11, MOVIE_GAMESTATE); + playMovie(0, 11, MOVIE_WAIT_FOR_FINISH); playSound("b#1.wav"); } @@ -64,7 +64,7 @@ bool CToilet::TurnOff(CTurnOff *msg) { _isClosed = true; _startFrame = 11; _endFrame = 18; - playMovie(11, 18, MOVIE_GAMESTATE); + playMovie(11, 18, MOVIE_WAIT_FOR_FINISH); playSound("b#1.wav"); } diff --git a/engines/titanic/game/sgt/vase.cpp b/engines/titanic/game/sgt/vase.cpp index f9ee292be2..e7b427c28f 100644 --- a/engines/titanic/game/sgt/vase.cpp +++ b/engines/titanic/game/sgt/vase.cpp @@ -47,7 +47,7 @@ bool CVase::TurnOn(CTurnOn *msg) { _isClosed = false; _startFrame = 1; _endFrame = 12; - playMovie(1, 12, MOVIE_GAMESTATE); + playMovie(1, 12, MOVIE_WAIT_FOR_FINISH); } return true; @@ -61,7 +61,7 @@ bool CVase::TurnOff(CTurnOff *msg) { _isClosed = true; _startFrame = 12; _endFrame = 25; - playMovie(12, 25, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(12, 25, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } return true; diff --git a/engines/titanic/game/sgt/washstand.cpp b/engines/titanic/game/sgt/washstand.cpp index 5be722bec4..217e36c1e9 100644 --- a/engines/titanic/game/sgt/washstand.cpp +++ b/engines/titanic/game/sgt/washstand.cpp @@ -47,7 +47,7 @@ bool CWashstand::TurnOn(CTurnOn *msg) { _isClosed = false; _startFrame = 0; _endFrame = 14; - playMovie(0, 14, MOVIE_GAMESTATE); + playMovie(0, 14, MOVIE_WAIT_FOR_FINISH); playSound("b#14.wav"); } @@ -61,7 +61,7 @@ bool CWashstand::TurnOff(CTurnOff *msg) { _isClosed = true; _startFrame = 14; _endFrame = 28; - playMovie(14, 28, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playMovie(14, 28, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); playSound("b#14.wav"); } diff --git a/engines/titanic/game/starling_puret.cpp b/engines/titanic/game/starling_puret.cpp index 2f1909d963..f598f134ba 100644 --- a/engines/titanic/game/starling_puret.cpp +++ b/engines/titanic/game/starling_puret.cpp @@ -59,7 +59,7 @@ bool CStarlingPuret::EnterViewMsg(CEnterViewMsg *msg) { changeMsg._newStatus = 1; changeMsg.execute("PromDeckStarlings"); - playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); CSignalObject signalMsg; signalMsg._numValue = 4; signalMsg.execute("PromDeckStarlings"); diff --git a/engines/titanic/game/sub_glass.cpp b/engines/titanic/game/sub_glass.cpp index 041f49097d..48cc84815a 100644 --- a/engines/titanic/game/sub_glass.cpp +++ b/engines/titanic/game/sub_glass.cpp @@ -88,7 +88,7 @@ bool CSUBGlass::SignalObject(CSignalObject *msg) { setVisible(true); if (_signalStartFrame >= 0) { - playMovie(_signalStartFrame, _signalEndFrame, MOVIE_GAMESTATE); + playMovie(_signalStartFrame, _signalEndFrame, MOVIE_WAIT_FOR_FINISH); playSound("z#30.wav"); _fieldBC = false; } diff --git a/engines/titanic/game/sweet_bowl.cpp b/engines/titanic/game/sweet_bowl.cpp index 7a3832e7c2..a1d0dc2b01 100644 --- a/engines/titanic/game/sweet_bowl.cpp +++ b/engines/titanic/game/sweet_bowl.cpp @@ -55,7 +55,7 @@ bool CSweetBowl::EnterViewMsg(CEnterViewMsg *msg) { bool CSweetBowl::ActMsg(CActMsg *msg) { if (msg->_action == "Jiggle") { setVisible(true); - playMovie(MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playMovie(MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); playSound(getRandomNumber(1) == 1 ? "b#42.wav" : "b#43.wav"); } diff --git a/engines/titanic/game/throw_tv_down_well.cpp b/engines/titanic/game/throw_tv_down_well.cpp index be61f6e9ab..680fc7e29f 100644 --- a/engines/titanic/game/throw_tv_down_well.cpp +++ b/engines/titanic/game/throw_tv_down_well.cpp @@ -60,7 +60,7 @@ bool CThrowTVDownWell::ActMsg(CActMsg *msg) { } bool CThrowTVDownWell::EnterViewMsg(CEnterViewMsg *msg) { - playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); movieEvent(49); return true; } diff --git a/engines/titanic/game/transport/lift.cpp b/engines/titanic/game/transport/lift.cpp index a6f45bda98..8dfc55905a 100644 --- a/engines/titanic/game/transport/lift.cpp +++ b/engines/titanic/game/transport/lift.cpp @@ -120,20 +120,20 @@ bool CLift::StatusChangeMsg(CStatusChangeMsg *msg) { if (oldClass == newClass) { debugStr = CString::format("Same (%d-%d)", _startFrame, _endFrame); - playMovie(_startFrame, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(_startFrame, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } else if (oldClass == 1 && newClass == 2) { debugStr = CString::format("1 to 2 (%d-108, 108-%d)", _startFrame, _endFrame); - playMovie(_startFrame, 108, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); - playMovie(108, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(_startFrame, 108, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); + playMovie(108, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } else if (oldClass == 1 && newClass == 3) { debugStr = CString::format("1 to 3 (%d-108, 108-190, 190-%d)", _startFrame, _endFrame); - playMovie(_startFrame, 108, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); - playMovie(108, 190, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); - playMovie(190, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(_startFrame, 108, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); + playMovie(108, 190, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); + playMovie(190, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } else { debugStr = CString::format("2 to 3 (%d-190, 190-%d)", _startFrame, _endFrame); - playMovie(_startFrame, 190, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); - playMovie(190, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(_startFrame, 190, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); + playMovie(190, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } } @@ -144,20 +144,20 @@ bool CLift::StatusChangeMsg(CStatusChangeMsg *msg) { if (oldClass == newClass) { debugStr = CString::format("Same (%d-%d)", _startFrame, _endFrame); - playMovie(_startFrame, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(_startFrame, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } else if (oldClass == 3 && newClass == 2) { debugStr = CString::format("3 to 2 (%d-407, 407-%d)", _startFrame, _endFrame); - playMovie(_startFrame, 407, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); - playMovie(407, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(_startFrame, 407, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); + playMovie(407, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } else if (oldClass == 3 && newClass == 1) { debugStr = CString::format("3 to 1 (%d-407, 407-489, 489-%d)", _startFrame, _endFrame); - playMovie(_startFrame, 407, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); - playMovie(407, 489, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); - playMovie(489, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(_startFrame, 407, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); + playMovie(407, 489, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); + playMovie(489, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } else { debugStr = CString::format("2 to 1 (%d-489, 489-%d)", _startFrame, _endFrame); - playMovie(_startFrame, 489, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); - playMovie(489, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(_startFrame, 489, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); + playMovie(489, _endFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } } diff --git a/engines/titanic/game/transport/pellerator.cpp b/engines/titanic/game/transport/pellerator.cpp index 095202d176..0228f9bc8b 100644 --- a/engines/titanic/game/transport/pellerator.cpp +++ b/engines/titanic/game/transport/pellerator.cpp @@ -83,7 +83,7 @@ bool CPellerator::StatusChangeMsg(CStatusChangeMsg *msg) { playMovie(315, 323, 0); for (int idx = 0; idx < 3; ++idx) playMovie(299, 304, 0); - playMovie(305, 313, MOVIE_GAMESTATE); + playMovie(305, 313, MOVIE_WAIT_FOR_FINISH); break; case 2: @@ -95,7 +95,7 @@ bool CPellerator::StatusChangeMsg(CStatusChangeMsg *msg) { playMovie(153, 197, 0); for (int idx = 0; idx < 5; ++idx) playMovie(253, 263, 0); - playMovie(290, 293, MOVIE_GAMESTATE); + playMovie(290, 293, MOVIE_WAIT_FOR_FINISH); break; case 4: @@ -107,7 +107,7 @@ bool CPellerator::StatusChangeMsg(CStatusChangeMsg *msg) { playMovie(253, 263, 0); for (int idx = 0; idx < 7; ++idx) playMovie(336, 341, 0); - playMovie(342, 348, MOVIE_GAMESTATE); + playMovie(342, 348, MOVIE_WAIT_FOR_FINISH); break; case 5: @@ -130,7 +130,7 @@ bool CPellerator::StatusChangeMsg(CStatusChangeMsg *msg) { playMovie(315, 323, 0); for (int idx = 0; idx < 3; ++idx) playMovie(299, 304, 0); - playMovie(305, 313, MOVIE_GAMESTATE); + playMovie(305, 313, MOVIE_WAIT_FOR_FINISH); break; case 2: @@ -139,7 +139,7 @@ bool CPellerator::StatusChangeMsg(CStatusChangeMsg *msg) { playMovie(299, 304, 0); for (int idx = 0; idx < 15; ++idx) playMovie(245, 255, 0); - playMovie(264, 267, MOVIE_GAMESTATE); + playMovie(264, 267, MOVIE_WAIT_FOR_FINISH); ++_destination; break; @@ -149,7 +149,7 @@ bool CPellerator::StatusChangeMsg(CStatusChangeMsg *msg) { playMovie(245, 255, 0); for (int idx = 0; idx < 7; ++idx) playMovie(336, 341, 0); - playMovie(342, 348, MOVIE_GAMESTATE); + playMovie(342, 348, MOVIE_WAIT_FOR_FINISH); break; case 5: @@ -160,7 +160,7 @@ bool CPellerator::StatusChangeMsg(CStatusChangeMsg *msg) { playMovie(245, 255, 0); for (int idx = 0; idx < 3; ++idx) playMovie(299, 304, 0); - playMovie(305, 313, MOVIE_GAMESTATE); + playMovie(305, 313, MOVIE_WAIT_FOR_FINISH); break; default: @@ -184,7 +184,7 @@ bool CPellerator::StatusChangeMsg(CStatusChangeMsg *msg) { playMovie(351, 359, 0); for (int idx = 0; idx < 3; ++idx) playMovie(336, 341, 0); - playMovie(342, 348, MOVIE_GAMESTATE); + playMovie(342, 348, MOVIE_WAIT_FOR_FINISH); break; case 3: @@ -196,7 +196,7 @@ bool CPellerator::StatusChangeMsg(CStatusChangeMsg *msg) { playMovie(245, 255, 0); for (int idx = 0; idx < 3; ++idx) playMovie(336, 341, 0); - playMovie(342, 348, MOVIE_GAMESTATE); + playMovie(342, 348, MOVIE_WAIT_FOR_FINISH); --_destination; break; @@ -209,7 +209,7 @@ bool CPellerator::StatusChangeMsg(CStatusChangeMsg *msg) { playMovie(78, 149, 0); for (int idx = 0; idx < 5; ++idx) playMovie(245, 255, 0); - playMovie(264, 267, MOVIE_GAMESTATE); + playMovie(264, 267, MOVIE_WAIT_FOR_FINISH); break; case 5: @@ -221,7 +221,7 @@ bool CPellerator::StatusChangeMsg(CStatusChangeMsg *msg) { playMovie(78, 149, 0); for (int idx = 0; idx < 3; ++idx) playMovie(336, 341, 0); - playMovie(342, 348, MOVIE_GAMESTATE); + playMovie(342, 348, MOVIE_WAIT_FOR_FINISH); break; default: @@ -236,7 +236,7 @@ bool CPellerator::StatusChangeMsg(CStatusChangeMsg *msg) { playMovie(351, 359, 0); for (int idx = 0; idx < 3; ++idx) playMovie(336, 341, 0); - playMovie(342, 348, MOVIE_GAMESTATE); + playMovie(342, 348, MOVIE_WAIT_FOR_FINISH); break; case 3: @@ -245,7 +245,7 @@ bool CPellerator::StatusChangeMsg(CStatusChangeMsg *msg) { playMovie(253, 263, 0); for (int idx = 0; idx < 3; ++idx) playMovie(336, 341, 0); - playMovie(342, 348, MOVIE_GAMESTATE); + playMovie(342, 348, MOVIE_WAIT_FOR_FINISH); --_destination; break; @@ -255,7 +255,7 @@ bool CPellerator::StatusChangeMsg(CStatusChangeMsg *msg) { playMovie(299, 304, 0); for (int idx = 0; idx < 15; ++idx) playMovie(253, 263, 0); - playMovie(290, 293, MOVIE_GAMESTATE); + playMovie(290, 293, MOVIE_WAIT_FOR_FINISH); break; case 5: @@ -266,7 +266,7 @@ bool CPellerator::StatusChangeMsg(CStatusChangeMsg *msg) { playMovie(253, 263, 0); for (int idx = 0; idx < 3; ++idx) playMovie(336, 341, 0); - playMovie(342, 348, MOVIE_GAMESTATE); + playMovie(342, 348, MOVIE_WAIT_FOR_FINISH); break; default: diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 96aeda1b83..5f51498e93 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -276,7 +276,7 @@ void CGameManager::frameMessage(CRoomItem *room) { CFrameMsg frameMsg(g_vm->_events->getTicksCount()); frameMsg.execute(room, nullptr, MSGFLAG_SCAN); - if (!_soundMaker) { + if (_gameState._soundMakerAllowed && !_soundMaker) { // Check for a sound maker in the room _soundMaker = dynamic_cast<CBackgroundSoundMaker *>( _project->findByName("zBackgroundSoundMaker")); diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index 964d6e604a..7ddd16ab22 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -46,8 +46,8 @@ bool CGameStateMovieList::empty() { CGameState::CGameState(CGameManager *gameManager) : _gameManager(gameManager), _gameLocation(this), _passengerClass(NO_CLASS), _priorClass(NO_CLASS), _mode(GSMODE_NONE), _seasonNum(SEASON_SUMMER), - _petActive(false), _field1C(false), _quitGame(false), _parrotMet(false), - _nodeChangeCtr(0), _nodeEnterTicks(0), _field38(0) { + _petActive(false), _soundMakerAllowed(false), _quitGame(false), _parrotMet(false), + _nodeChangeCtr(0), _nodeEnterTicks(0), _parrotResponseIndex(0) { } void CGameState::save(SimpleFile *file) const { @@ -56,9 +56,9 @@ void CGameState::save(SimpleFile *file) const { file->writeNumber(_priorClass); file->writeNumber(_seasonNum); file->writeNumber(_parrotMet); - file->writeNumber(_field38); + file->writeNumber(_parrotResponseIndex); _gameLocation.save(file); - file->writeNumber(_field1C); + file->writeNumber(_soundMakerAllowed); } void CGameState::load(SimpleFile *file) { @@ -67,10 +67,10 @@ void CGameState::load(SimpleFile *file) { _priorClass = (PassengerClass)file->readNumber(); _seasonNum = (Season)file->readNumber(); _parrotMet = file->readNumber(); - _field38 = file->readNumber(); + _parrotResponseIndex = file->readNumber(); _gameLocation.load(file); - _field1C = file->readNumber(); + _soundMakerAllowed = file->readNumber(); _nodeChangeCtr = 0; _nodeEnterTicks = 0; } diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index 5d0f67c02c..547e8f8221 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -69,13 +69,13 @@ public: GameStateMode _mode; Season _seasonNum; bool _petActive; - bool _field1C; + bool _soundMakerAllowed; bool _quitGame; bool _parrotMet; uint _nodeChangeCtr; uint32 _nodeEnterTicks; Point _mousePos; - int _field38; + int _parrotResponseIndex; public: CGameState(CGameManager *gameManager); @@ -151,9 +151,21 @@ public: */ bool getParrotMet() const { return _parrotMet; } + /** + * Gets the counter for the number of times different nodes have + * been entered + */ int getNodeChangedCtr() const { return _nodeChangeCtr; } + + /** + * Gets the node enter ticks amount + */ uint32 getNodeEnterTicks() const { return _nodeEnterTicks; } - void inc38() { ++_field38; } + + /** + * Increments the index to use for parrot idle responses + */ + void incParrotResponse() { ++_parrotResponseIndex; } }; } // End of namespace Titanic diff --git a/engines/titanic/gfx/toggle_switch.cpp b/engines/titanic/gfx/toggle_switch.cpp index 815f96cb5a..dae9acba0e 100644 --- a/engines/titanic/gfx/toggle_switch.cpp +++ b/engines/titanic/gfx/toggle_switch.cpp @@ -52,9 +52,9 @@ void CToggleSwitch::load(SimpleFile *file) { bool CToggleSwitch::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { _pressed = !_pressed; if (_pressed) - fn10(0, 0, 0); + setToggleColor(0, 0, 0); else - fn10(0xff, 0xff, 0xff); + setToggleColor(0xff, 0xff, 0xff); return true; } diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index f70acdcfb2..e62c5e5dca 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -273,7 +273,7 @@ MESSAGE1(CGetChevRoomNum, int, roomNum, 0); MESSAGE2(CHoseConnectedMsg, bool, connected, true, CGameObject *, object, nullptr); MESSAGE0(CInitializeAnimMsg); MESSAGE1(CIsEarBowlPuzzleDone, int, value, 0); -MESSAGE3(CIsHookedOnMsg, Rect, rect, Rect(), bool, result, false, CString, string1, ""); +MESSAGE3(CIsHookedOnMsg, Rect, rect, Rect(), bool, isHooked, false, CString, armName, ""); MESSAGE1(CIsParrotPresentMsg, bool, value, false); MESSAGE1(CKeyCharMsg, int, key, 32); MESSAGE2(CLeaveNodeMsg, CNodeItem *, oldNode, nullptr, CNodeItem *, newNode, nullptr); diff --git a/engines/titanic/moves/enter_bridge.cpp b/engines/titanic/moves/enter_bridge.cpp index fb44fe2e02..a9fbb5aff1 100644 --- a/engines/titanic/moves/enter_bridge.cpp +++ b/engines/titanic/moves/enter_bridge.cpp @@ -45,7 +45,7 @@ bool CEnterBridge::EnterRoomMsg(CEnterRoomMsg *msg) { CActMsg actMsg("Disable"); actMsg.execute("ShipAnnouncements"); - setState1C(false); + stateSetSoundMakerAllowed(false); _flag = false; } diff --git a/engines/titanic/moves/enter_sec_class_state.cpp b/engines/titanic/moves/enter_sec_class_state.cpp index af2bc4ac00..9ea8ae732a 100644 --- a/engines/titanic/moves/enter_sec_class_state.cpp +++ b/engines/titanic/moves/enter_sec_class_state.cpp @@ -85,9 +85,9 @@ bool CEnterSecClassState::StatusChangeMsg(CStatusChangeMsg *msg) { if (msg->_newStatus != 3) { if (msg->_newStatus == 2 && _mode == 1) - playMovie(0, 10, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(0, 10, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); else if (msg->_newStatus == 1) - playMovie(11, 21, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(11, 21, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } _cursorId = msg->_newStatus == 2 ? CURSOR_MOVE_FORWARD : CURSOR_INVALID; diff --git a/engines/titanic/npcs/barbot.cpp b/engines/titanic/npcs/barbot.cpp index 58575d1c35..489ed39c4b 100644 --- a/engines/titanic/npcs/barbot.cpp +++ b/engines/titanic/npcs/barbot.cpp @@ -166,7 +166,7 @@ bool CBarbot::ActMsg(CActMsg *msg) { playRange(_frames[7]); playRange(_frames[8]); playRange(_frames[13]); - playRange(_frames[40], MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playRange(_frames[40], MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); _frameNum = _frames[40]._endFrame; } } else if (msg->_action == "GiveBackVisCentre") { @@ -316,7 +316,7 @@ bool CBarbot::TurnOn(CTurnOn *msg) { playRange(_frames[38], MOVIE_NOTIFY_OBJECT); playRange(_frames[58], MOVIE_NOTIFY_OBJECT); playRange(_frames[57], MOVIE_NOTIFY_OBJECT); - playRange(_frames[56], MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playRange(_frames[56], MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); _frameNum = _frames[56]._endFrame; } else { playRange(_frames[38]); @@ -363,13 +363,13 @@ bool CBarbot::TurnOff(CTurnOff *msg) { if (_visCenterOnCounter) { // Barbot will put away the vision center - playRange(_frames[28], MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playRange(_frames[28], MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); _frameNum = _frames[28]._endFrame; _visCenterOnCounter = false; _field134 = 1; } - playRange(_frames[29], MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playRange(_frames[29], MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); movieEvent(_frames[29]._startFrame); _frameNum = _frames[29]._endFrame; _fieldC4 = 0; @@ -560,7 +560,7 @@ bool CBarbot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) { _frameNum = _frames[27]._endFrame; } else if (!_gottenDrunk && _drunkFlag) { playRange(_frames[45], MOVIE_NOTIFY_OBJECT); - playRange(_frames[44], MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playRange(_frames[44], MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); _frameNum = _frames[44]._endFrame; } break; diff --git a/engines/titanic/npcs/bellbot.cpp b/engines/titanic/npcs/bellbot.cpp index 26c9b13e40..36c57fe467 100644 --- a/engines/titanic/npcs/bellbot.cpp +++ b/engines/titanic/npcs/bellbot.cpp @@ -89,7 +89,7 @@ bool CBellBot::OnSummonBotMsg(COnSummonBotMsg *msg) { _npcFlags &= ~NPCFLAG_MOVE_LOOP; } - playClip("Walk On", MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playClip("Walk On", MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); movieEvent(); _npcFlags |= NPCFLAG_MOVING; @@ -135,13 +135,13 @@ bool CBellBot::MovieEndMsg(CMovieEndMsg *msg) { } bool CBellBot::Use(CUse *msg) { - dynamic_cast<CCarry *>(msg->_item)->_string1 = "Bellbot"; + dynamic_cast<CCarry *>(msg->_item)->_npcUse = "Bellbot"; return true; } bool CBellBot::DismissBotMsg(CDismissBotMsg *msg) { if (_npcFlags & NPCFLAG_MOVING) { - playClip("Walk Off", MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playClip("Walk Off", MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); if (_npcFlags & NPCFLAG_START_IDLING) { _npcFlags &= ~NPCFLAG_START_IDLING; performAction(true); @@ -168,7 +168,7 @@ bool CBellBot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) { case 5: _npcFlags &= ~NPCFLAG_MOVE_START; - playClip("Walk Off", MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playClip("Walk Off", MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); movieEvent(); break; diff --git a/engines/titanic/npcs/bilge_succubus.cpp b/engines/titanic/npcs/bilge_succubus.cpp index 63d0006885..4db4d8d595 100644 --- a/engines/titanic/npcs/bilge_succubus.cpp +++ b/engines/titanic/npcs/bilge_succubus.cpp @@ -75,9 +75,9 @@ bool CBilgeSuccUBus::PETReceiveMsg(CPETReceiveMsg *msg) { if (_style) { if (_receiveStartFrame >= 0) - playMovie(_receiveStartFrame, _receiveEndFrame, MOVIE_GAMESTATE); + playMovie(_receiveStartFrame, _receiveEndFrame, MOVIE_WAIT_FOR_FINISH); if (_afterReceiveStartFrame >= 0) - playMovie(_afterReceiveStartFrame, _afterReceiveEndFrame, MOVIE_GAMESTATE); + playMovie(_afterReceiveStartFrame, _afterReceiveEndFrame, MOVIE_WAIT_FOR_FINISH); playSound("z#28.wav", 70); } else if (!_isOn) { @@ -94,7 +94,7 @@ bool CBilgeSuccUBus::PETReceiveMsg(CPETReceiveMsg *msg) { if (mailObject) { _mailP = mailObject; if (_receiveStartFrame >= 0) - playMovie(_receiveStartFrame, _receiveEndFrame, MOVIE_GAMESTATE); + playMovie(_receiveStartFrame, _receiveEndFrame, MOVIE_WAIT_FOR_FINISH); } else { petDisplayMessage(2, NOTHING_TO_DELIVER); } @@ -138,20 +138,20 @@ bool CBilgeSuccUBus::PETDeliverMsg(CPETDeliverMsg *msg) { playMovie(_sendStartFrame, _sendEndFrame, MOVIE_NOTIFY_OBJECT); if (_sneezing2StartFrame >= 0) { - playMovie(_trayOutStartFrame, _trayOutEndFrame, MOVIE_GAMESTATE); - playMovie(_sneezing1StartFrame, _sneezing1EndFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); - playMovie(_sneezing2StartFrame, _sneezing2EndFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(_trayOutStartFrame, _trayOutEndFrame, MOVIE_WAIT_FOR_FINISH); + playMovie(_sneezing1StartFrame, _sneezing1EndFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); + playMovie(_sneezing2StartFrame, _sneezing2EndFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); incTransitions(); } } else { startTalking(this, 230012); _sendAction = SA_EATEN; if (_sendStartFrame >= 0) - playMovie(_sendStartFrame, _sendEndFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(_sendStartFrame, _sendEndFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); if (_receiveStartFrame >= 0) - playMovie(_receiveStartFrame, _receiveEndFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(_receiveStartFrame, _receiveEndFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); if (_afterReceiveStartFrame >= 0) - playMovie(_afterReceiveStartFrame, _afterReceiveEndFrame, MOVIE_GAMESTATE); + playMovie(_afterReceiveStartFrame, _afterReceiveEndFrame, MOVIE_WAIT_FOR_FINISH); } } else { if (_isFeathers) { @@ -159,17 +159,17 @@ bool CBilgeSuccUBus::PETDeliverMsg(CPETDeliverMsg *msg) { _sendAction = SA_BILGE_FEATHERS; if (_sendStartFrame >= 0) - playMovie(_sendStartFrame, _sendEndFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(_sendStartFrame, _sendEndFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); if (_receiveStartFrame >= 0) - playMovie(_receiveStartFrame, _receiveEndFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(_receiveStartFrame, _receiveEndFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); if (_afterReceiveStartFrame >= 0) - playMovie(_afterReceiveStartFrame, _afterReceiveEndFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(_afterReceiveStartFrame, _afterReceiveEndFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } else { sendMail(petRoomFlags, roomFlags); startTalking(this, 230012); if (_sendStartFrame >= 0) { _sendAction = SA_BILGE_SENT; - playMovie(_sendStartFrame, _sendEndFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(_sendStartFrame, _sendEndFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } } } diff --git a/engines/titanic/npcs/deskbot.cpp b/engines/titanic/npcs/deskbot.cpp index 56f4d98f18..2b88160e47 100644 --- a/engines/titanic/npcs/deskbot.cpp +++ b/engines/titanic/npcs/deskbot.cpp @@ -306,7 +306,7 @@ bool CDeskbot::TurnOff(CTurnOff *msg) { performAction(1, findView()); _npcFlags = (_npcFlags & ~(NPCFLAG_SPEAKING | NPCFLAG_IDLING | NPCFLAG_START_IDLING)) | NPCFLAG_MOVE_LOOP; - playClip("Closing", MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playClip("Closing", MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); } return true; diff --git a/engines/titanic/npcs/doorbot.cpp b/engines/titanic/npcs/doorbot.cpp index 79e3dafed4..03d723a384 100644 --- a/engines/titanic/npcs/doorbot.cpp +++ b/engines/titanic/npcs/doorbot.cpp @@ -95,7 +95,7 @@ bool CDoorbot::MovieEndMsg(CMovieEndMsg *msg) { case 6: if (clipExistsByEnd("Cloak On", msg->_endFrame)) { petShow(); - setState1C(true); + stateSetSoundMakerAllowed(true); changeView("ServiceElevator.Node 1.S"); changeView("ServiceElevator.Node 1.N"); } @@ -129,7 +129,7 @@ bool CDoorbot::MovieEndMsg(CMovieEndMsg *msg) { _introMovieNum = 0; } else if (clipExistsByEnd("Cloak On", msg->_endFrame)) { petShow(); - setState1C(true); + stateSetSoundMakerAllowed(true); changeView("ServiceElevator.Node 1.S"); } else { CTrueTalkNPC::MovieEndMsg(msg); @@ -185,7 +185,7 @@ bool CDoorbot::OnSummonBotMsg(COnSummonBotMsg *msg) { } playClip(getRandomNumber(1) ? "Whizz On Left" : "Whizz On Right", - MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); movieEvent(); _npcFlags |= NPCFLAG_MOVE_END; @@ -200,7 +200,7 @@ bool CDoorbot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) { case 4: _npcFlags = (_npcFlags & ~NPCFLAG_IDLING) | NPCFLAG_SUMMON_BELLBOT; - playClip("Whizz Off Left", MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playClip("Whizz Off Left", MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); break; case 28: { @@ -387,7 +387,7 @@ bool CDoorbot::PutBotBackInHisBoxMsg(CPutBotBackInHisBoxMsg *msg) { bool CDoorbot::DismissBotMsg(CDismissBotMsg *msg) { if (_npcFlags & NPCFLAG_MOVE_END) { playClip(getRandomNumber(1) ? "Whizz Off Left" : "Whizz Off Right", - MOVIE_STOP_PREVIOUS | MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + MOVIE_STOP_PREVIOUS | MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); movieEvent(); if (_npcFlags & NPCFLAG_START_IDLING) { diff --git a/engines/titanic/npcs/maitre_d.cpp b/engines/titanic/npcs/maitre_d.cpp index 88eceab46b..6ac69d9079 100644 --- a/engines/titanic/npcs/maitre_d.cpp +++ b/engines/titanic/npcs/maitre_d.cpp @@ -40,25 +40,24 @@ BEGIN_MESSAGE_MAP(CMaitreD, CTrueTalkNPC) ON_MESSAGE(TriggerNPCEvent) END_MESSAGE_MAP() -int CMaitreD::_v1; - CMaitreD::CMaitreD() : CTrueTalkNPC(), - _string2("z#40.wav"), _string3("z#40.wav"), _field108(0), _field118(1), - _field11C(0), _field12C(0), _field130(1), _field134(0), _timerId(0) { + _priorMusicName("z#40.wav"), _musicName("z#40.wav"), _unused5(0), _hasMusic(true), + _musicSet(false), _fightFlag(false), _unused6(true), _savedFightFlag(false), + _timerId(0), _defeated(false) { } void CMaitreD::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_field108, indent); - file->writeQuotedLine(_string2, indent); - file->writeNumberLine(_field118, indent); - file->writeNumberLine(_field11C, indent); - file->writeQuotedLine(_string3, indent); - file->writeNumberLine(_field12C, indent); - file->writeNumberLine(_field130, indent); - - file->writeNumberLine(_v1, indent); - file->writeNumberLine(_field134, indent); + file->writeNumberLine(_unused5, indent); + file->writeQuotedLine(_priorMusicName, indent); + file->writeNumberLine(_hasMusic, indent); + file->writeNumberLine(_musicSet, indent); + file->writeQuotedLine(_musicName, indent); + file->writeNumberLine(_fightFlag, indent); + file->writeNumberLine(_unused6, indent); + + file->writeNumberLine(_defeated, indent); + file->writeNumberLine(_savedFightFlag, indent); file->writeNumberLine(_timerId, indent); CTrueTalkNPC::save(file, indent); @@ -66,16 +65,16 @@ void CMaitreD::save(SimpleFile *file, int indent) { void CMaitreD::load(SimpleFile *file) { file->readNumber(); - _field108 = file->readNumber(); - _string2 = file->readString(); - _field118 = file->readNumber(); - _field11C = file->readNumber(); - _string3 = file->readString(); - _field12C = file->readNumber(); - _field130 = file->readNumber(); - - _v1 = file->readNumber(); - _field134 = file->readNumber(); + _unused5 = file->readNumber(); + _priorMusicName = file->readString(); + _hasMusic = file->readNumber(); + _musicSet = file->readNumber(); + _musicName = file->readString(); + _fightFlag = file->readNumber(); + _unused6 = file->readNumber(); + + _defeated = file->readNumber(); + _savedFightFlag = file->readNumber(); _timerId = file->readNumber(); CTrueTalkNPC::load(file); @@ -83,10 +82,10 @@ void CMaitreD::load(SimpleFile *file) { bool CMaitreD::RestaurantMusicChanged(CRestaurantMusicChanged *msg) { if (msg->_value.empty()) { - _field118 = 0; + _hasMusic = false; } else { - _string3 = msg->_value; - _field118 = _field11C = 1; + _musicName = msg->_value; + _hasMusic = _musicSet = true; } return true; @@ -94,15 +93,15 @@ bool CMaitreD::RestaurantMusicChanged(CRestaurantMusicChanged *msg) { bool CMaitreD::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) { if (msg->_action == 8) { - _field12C = 1; + _fightFlag = true; stopAnimTimer(_timerId); _timerId = startAnimTimer("MD Fight", 3500, 0); } else if (msg->_action == 9) { stopAnimTimer(_timerId); _timerId = 0; } else if (msg->_action == 10) { - _field12C = 0; - _v1 = 1; + _fightFlag = false; + _defeated = true; stopAnimTimer(_timerId); _timerId = 0; @@ -115,12 +114,17 @@ bool CMaitreD::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) { bool CMaitreD::EnterViewMsg(CEnterViewMsg *msg) { setTalking(this, true, findView()); - _field12C = _field134; + _fightFlag = _savedFightFlag; + + if (_musicName != "STMusic" && (!_musicSet || _priorMusicName == _musicName)) + return true; - if (_string3 == "STMusic" && (!_field11C || _string2 == _string3)) + // WORKAROUND: It's possible in the original to not have a music handler set + // if you start and stop the phonograph, then save and restore the game + if (!CMusicRoom::_musicHandler) return true; - if (_string3.contains("nasty ambient")) + if (_musicName.contains("nasty ambient")) startTalking(this, 111, findView()); else if (!CMusicRoom::_musicHandler->checkInstrument(SNAKE)) startTalking(this, 114, findView()); @@ -135,16 +139,17 @@ bool CMaitreD::EnterViewMsg(CEnterViewMsg *msg) { happyMsg.execute("MaitreD Right Arm"); } + _priorMusicName = _musicName; return true; } bool CMaitreD::LeaveViewMsg(CLeaveViewMsg *msg) { - _field134 = _field12C; + _savedFightFlag = _fightFlag; performAction(true); stopAnimTimer(_timerId); _timerId = 0; - _field12C = 0; + _fightFlag = false; return true; } @@ -158,7 +163,7 @@ bool CMaitreD::NPCPlayTalkingAnimationMsg(CNPCPlayTalkingAnimationMsg *msg) { msg->_names = NAMES; CAnimateMaitreDMsg animMsg; - if (_field12C) + if (_fightFlag) animMsg._value = 0; animMsg.execute(this); } @@ -168,7 +173,7 @@ bool CMaitreD::NPCPlayTalkingAnimationMsg(CNPCPlayTalkingAnimationMsg *msg) { bool CMaitreD::TimerMsg(CTimerMsg *msg) { if (msg->_action == "MD Fight") { - if (_field12C && compareViewNameTo("1stClassRestaurant.MaitreD Node.N")) { + if (_fightFlag && compareViewNameTo("1stClassRestaurant.MaitreD Node.N")) { startTalking(this, 131, findView()); } } else { @@ -179,7 +184,7 @@ bool CMaitreD::TimerMsg(CTimerMsg *msg) { } bool CMaitreD::TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMsg *msg) { - if (_field12C) { + if (_fightFlag) { stopAnimTimer(_timerId); _timerId = 0; } @@ -189,7 +194,7 @@ bool CMaitreD::TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMsg *m } bool CMaitreD::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg) { - if (_field12C) { + if (_fightFlag) { stopAnimTimer(_timerId); _timerId = startAnimTimer("MD Fight", 3000 + getRandomNumber(3000)); } @@ -199,7 +204,7 @@ bool CMaitreD::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg) } bool CMaitreD::LoadSuccessMsg(CLoadSuccessMsg *msg) { - if (_field12C) { + if (_fightFlag) { _timerId = startAnimTimer("MD Fight", 3000 + getRandomNumber(3000)); } diff --git a/engines/titanic/npcs/maitre_d.h b/engines/titanic/npcs/maitre_d.h index 878c32cc0b..6677a587a8 100644 --- a/engines/titanic/npcs/maitre_d.h +++ b/engines/titanic/npcs/maitre_d.h @@ -41,17 +41,16 @@ class CMaitreD : public CTrueTalkNPC { bool TextInputMsg(CTextInputMsg *msg); bool TriggerNPCEvent(CTriggerNPCEvent *msg); private: - static int _v1; -private: - int _field108; - CString _string2; - int _field118; - int _field11C; - CString _string3; - int _field12C; - int _field130; - int _field134; + int _unused5; + CString _priorMusicName; + bool _hasMusic; + bool _musicSet; + CString _musicName; + bool _fightFlag; + bool _unused6; + bool _savedFightFlag; int _timerId; + bool _defeated; public: CLASSDEF; CMaitreD(); diff --git a/engines/titanic/npcs/parrot.cpp b/engines/titanic/npcs/parrot.cpp index b570bea6ae..223f6b4cf2 100644 --- a/engines/titanic/npcs/parrot.cpp +++ b/engines/titanic/npcs/parrot.cpp @@ -475,7 +475,7 @@ bool CParrot::NPCPlayIdleAnimationMsg(CNPCPlayIdleAnimationMsg *msg) { } } else { int id = -1; - switch (stateGet38()) { + switch (getParrotResponse()) { case 0: id = 280107; break; diff --git a/engines/titanic/npcs/succubus.cpp b/engines/titanic/npcs/succubus.cpp index 71272fad03..ef681f64b8 100644 --- a/engines/titanic/npcs/succubus.cpp +++ b/engines/titanic/npcs/succubus.cpp @@ -701,11 +701,11 @@ bool CSuccUBus::TurnOff(CTurnOff *msg) { if (_offStartFrame >= 0) { playSound("z#27.wav", 100); - playMovie(_offStartFrame, _offEndFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(_offStartFrame, _offEndFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } if (!_signalFlag && _endingStartFrame >= 0) - playMovie(_endingStartFrame, _endingEndFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playMovie(_endingStartFrame, _endingEndFrame, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); _isOn = false; performAction(true); diff --git a/engines/titanic/sound/music_room_instrument.cpp b/engines/titanic/sound/music_room_instrument.cpp index 5e7bd9bb8c..b92329850b 100644 --- a/engines/titanic/sound/music_room_instrument.cpp +++ b/engines/titanic/sound/music_room_instrument.cpp @@ -234,7 +234,7 @@ void CMusicRoomInstrument::update(int val) { double tempVal = 46.0 - ((double)(val - 14) * 1.43); int frameNum = _field4C; - int frameNum1 = (tempVal - frameNum) * 0.25; + int frameNum1 = (int)((tempVal - frameNum) * 0.25); _gameObjects[1]->playMovie(frameNum1, frameNum1, MOVIE_STOP_PREVIOUS); frameNum += frameNum1; diff --git a/engines/titanic/sound/titania_speech.cpp b/engines/titanic/sound/titania_speech.cpp index d0ff423342..7d3db080eb 100644 --- a/engines/titanic/sound/titania_speech.cpp +++ b/engines/titanic/sound/titania_speech.cpp @@ -59,7 +59,7 @@ bool CTitaniaSpeech::ActMsg(CActMsg *msg) { movieSetAudioTiming(true); loadSound("a#12.wav"); sleep(1000); - playMovie(0, 187, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playMovie(0, 187, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); movieEvent(0); break; @@ -78,7 +78,7 @@ bool CTitaniaSpeech::ActMsg(CActMsg *msg) { visibleMsg._visible = false; visibleMsg.execute("TitaniaStillControl"); loadSound("a#10.wav"); - playMovie(585, 706, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playMovie(585, 706, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); playSound("a#10.wav"); break; @@ -86,7 +86,7 @@ bool CTitaniaSpeech::ActMsg(CActMsg *msg) { visibleMsg._visible = false; visibleMsg.execute("TitaniaStillControl"); loadSound("a#9.wav"); - playMovie(707, 905, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playMovie(707, 905, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); playSound("a#9.wav"); break; @@ -94,7 +94,7 @@ bool CTitaniaSpeech::ActMsg(CActMsg *msg) { visibleMsg._visible = false; visibleMsg.execute("TitaniaStillControl"); loadSound("a#8.wav"); - playMovie(906, 938, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); + playMovie(906, 938, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); playSound("a#8.wav"); break; diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h index f45db3599e..d3442a12f7 100644 --- a/engines/titanic/support/avi_surface.h +++ b/engines/titanic/support/avi_surface.h @@ -34,8 +34,11 @@ class CSoundManager; class CVideoSurface; enum MovieFlag { - MOVIE_REPEAT = 1, MOVIE_STOP_PREVIOUS = 2, MOVIE_NOTIFY_OBJECT = 4, - MOVIE_REVERSE = 8, MOVIE_GAMESTATE = 0x10 + MOVIE_REPEAT = 1, // Repeat movie + MOVIE_STOP_PREVIOUS = 2, // Stop any prior movie playing on the object + MOVIE_NOTIFY_OBJECT = 4, // Notify the object when the movie finishes + MOVIE_REVERSE = 8, // Play the movie in reverse + MOVIE_WAIT_FOR_FINISH = 0x10 // Let finish before playing next movie for object }; class AVIDecoder : public Video::AVIDecoder { |