diff options
Diffstat (limited to 'engines/hopkins/talk.cpp')
-rw-r--r-- | engines/hopkins/talk.cpp | 494 |
1 files changed, 247 insertions, 247 deletions
diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index d6d86070e1..abcf36c93e 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -49,18 +49,18 @@ TalkManager::TalkManager(HopkinsEngine *vm) { void TalkManager::startAnimatedCharacterDialogue(const Common::String &filename) { Common::String spriteFilename; - _vm->_fontManager->hideText(5); - _vm->_fontManager->hideText(9); - _vm->_eventsManager->refreshScreenAndEvents(); - _vm->_graphicsManager->_scrollStatus = 1; + _vm->_fontMan->hideText(5); + _vm->_fontMan->hideText(9); + _vm->_events->refreshScreenAndEvents(); + _vm->_graphicsMan->_scrollStatus = 1; bool oldDisableInventFl = _vm->_globals->_disableInventFl; _vm->_globals->_disableInventFl = true; bool fileFoundFl = false; - _characterBuffer = _vm->_fileManager->searchCat(filename, RES_PER, fileFoundFl); - _characterSize = _vm->_fileManager->_catalogSize; + _characterBuffer = _vm->_fileIO->searchCat(filename, RES_PER, fileFoundFl); + _characterSize = _vm->_fileIO->_catalogSize; if (!fileFoundFl) { - _characterBuffer = _vm->_fileManager->loadFile(filename); - _characterSize = _vm->_fileManager->fileSize(filename); + _characterBuffer = _vm->_fileIO->loadFile(filename); + _characterSize = _vm->_fileIO->fileSize(filename); } _vm->_globals->_saveData->_data[svDialogField4] = 0; @@ -78,28 +78,28 @@ void TalkManager::startAnimatedCharacterDialogue(const Common::String &filename) _dialogueMesgId1 = READ_LE_INT16((uint16 *)_characterBuffer + 40); _paletteBufferIdx = 20 * READ_LE_INT16((uint16 *)_characterBuffer + 42) + 110; fileFoundFl = false; - _characterSprite = _vm->_fileManager->searchCat(spriteFilename, RES_SAN, fileFoundFl); + _characterSprite = _vm->_fileIO->searchCat(spriteFilename, RES_SAN, fileFoundFl); if (!fileFoundFl) { - _characterSprite = _vm->_objectsManager->loadSprite(spriteFilename); + _characterSprite = _vm->_objectsMan->loadSprite(spriteFilename); } else { - _characterSprite = _vm->_objectsManager->loadSprite("RES_SAN.RES"); + _characterSprite = _vm->_objectsMan->loadSprite("RES_SAN.RES"); } - _vm->_graphicsManager->backupScreen(); + _vm->_graphicsMan->backupScreen(); - if (!_vm->_graphicsManager->_lineNbr) - _vm->_graphicsManager->_scrollOffset = 0; - _vm->_graphicsManager->displayScreen(true); - _vm->_objectsManager->_charactersEnabledFl = true; + if (!_vm->_graphicsMan->_lineNbr) + _vm->_graphicsMan->_scrollOffset = 0; + _vm->_graphicsMan->displayScreen(true); + _vm->_objectsMan->_charactersEnabledFl = true; searchCharacterPalette(_paletteBufferIdx, false); startCharacterAnim0(_paletteBufferIdx, false); initCharacterAnim(); _dialogueMesgId2 = _dialogueMesgId1 + 1; _dialogueMesgId3 = _dialogueMesgId1 + 2; _dialogueMesgId4 = _dialogueMesgId1 + 3; - int oldMouseCursorId = _vm->_eventsManager->_mouseCursorId; - _vm->_eventsManager->_mouseCursorId = 4; - _vm->_eventsManager->changeMouseCursor(0); + int oldMouseCursorId = _vm->_events->_mouseCursorId; + _vm->_events->_mouseCursorId = 4; + _vm->_events->changeMouseCursor(0); if (!_vm->_globals->_introSpeechOffFl) { int answer = 0; int dlgAnswer; @@ -109,7 +109,7 @@ void TalkManager::startAnimatedCharacterDialogue(const Common::String &filename) answer = dialogAnswer(dlgAnswer, false); if (answer == -1) dlgAnswer = _dialogueMesgId4; - _vm->_eventsManager->refreshScreenAndEvents(); + _vm->_events->refreshScreenAndEvents(); } while (dlgAnswer != _dialogueMesgId4); } if (_vm->_globals->_introSpeechOffFl) { @@ -123,30 +123,30 @@ void TalkManager::startAnimatedCharacterDialogue(const Common::String &filename) _vm->_globals->_introSpeechOffFl = false; _characterBuffer = _vm->_globals->freeMemory(_characterBuffer); _characterSprite = _vm->_globals->freeMemory(_characterSprite); - _vm->_graphicsManager->displayScreen(false); + _vm->_graphicsMan->displayScreen(false); - _vm->_graphicsManager->restoreScreen(); + _vm->_graphicsMan->restoreScreen(); - _vm->_objectsManager->_charactersEnabledFl = false; - _vm->_eventsManager->_mouseCursorId = oldMouseCursorId; + _vm->_objectsMan->_charactersEnabledFl = false; + _vm->_events->_mouseCursorId = oldMouseCursorId; - _vm->_eventsManager->changeMouseCursor(oldMouseCursorId); - _vm->_graphicsManager->setColorPercentage(253, 100, 100, 100); + _vm->_events->changeMouseCursor(oldMouseCursorId); + _vm->_graphicsMan->setColorPercentage(253, 100, 100, 100); if (_vm->getIsDemo() == false) - _vm->_graphicsManager->setColorPercentage(254, 0, 0, 0); - - _vm->_graphicsManager->initColorTable(145, 150, _vm->_graphicsManager->_palette); - _vm->_graphicsManager->setPaletteVGA256(_vm->_graphicsManager->_palette); - _vm->_graphicsManager->lockScreen(); - _vm->_graphicsManager->copy16BitRect(_vm->_graphicsManager->_backBuffer, _vm->_eventsManager->_startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - _vm->_graphicsManager->unlockScreen(); - memcpy(_vm->_graphicsManager->_frontBuffer, _vm->_graphicsManager->_backBuffer, 614399); + _vm->_graphicsMan->setColorPercentage(254, 0, 0, 0); + + _vm->_graphicsMan->initColorTable(145, 150, _vm->_graphicsMan->_palette); + _vm->_graphicsMan->setPaletteVGA256(_vm->_graphicsMan->_palette); + _vm->_graphicsMan->lockScreen(); + _vm->_graphicsMan->copy16BitRect(_vm->_graphicsMan->_backBuffer, _vm->_events->_startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsMan->unlockScreen(); + memcpy(_vm->_graphicsMan->_frontBuffer, _vm->_graphicsMan->_backBuffer, 614399); _vm->_globals->_disableInventFl = oldDisableInventFl; - _vm->_graphicsManager->updateScreen(); + _vm->_graphicsMan->updateScreen(); for (int i = 0; i <= 4; i++) - _vm->_eventsManager->refreshScreenAndEvents(); - _vm->_graphicsManager->_scrollStatus = 0; + _vm->_events->refreshScreenAndEvents(); + _vm->_graphicsMan->_scrollStatus = 0; } void TalkManager::startStaticCharacterDialogue(const Common::String &filename) { @@ -154,11 +154,11 @@ void TalkManager::startStaticCharacterDialogue(const Common::String &filename) { bool oldDisableInventFl = _vm->_globals->_disableInventFl; _vm->_globals->_disableInventFl = true; bool fileFoundFl = false; - _characterBuffer = _vm->_fileManager->searchCat(filename, RES_PER, fileFoundFl); - _characterSize = _vm->_fileManager->_catalogSize; + _characterBuffer = _vm->_fileIO->searchCat(filename, RES_PER, fileFoundFl); + _characterSize = _vm->_fileIO->_catalogSize; if (!fileFoundFl) { - _characterBuffer = _vm->_fileManager->loadFile(filename); - _characterSize = _vm->_fileManager->fileSize(filename); + _characterBuffer = _vm->_fileIO->loadFile(filename); + _characterSize = _vm->_fileIO->fileSize(filename); } _vm->_globals->_saveData->_data[svDialogField4] = 0; @@ -187,9 +187,9 @@ void TalkManager::startStaticCharacterDialogue(const Common::String &filename) { _dialogueMesgId2 = _dialogueMesgId1 + 1; _dialogueMesgId3 = _dialogueMesgId1 + 2; _dialogueMesgId4 = _dialogueMesgId1 + 3; - int oldMouseCursorId = _vm->_eventsManager->_mouseCursorId; - _vm->_eventsManager->_mouseCursorId = 4; - _vm->_eventsManager->changeMouseCursor(0); + int oldMouseCursorId = _vm->_events->_mouseCursorId; + _vm->_events->_mouseCursorId = 4; + _vm->_events->changeMouseCursor(0); if (!_vm->_globals->_introSpeechOffFl) { int answer; @@ -211,11 +211,11 @@ void TalkManager::startStaticCharacterDialogue(const Common::String &filename) { } _characterBuffer = _vm->_globals->freeMemory(_characterBuffer); - _vm->_eventsManager->_mouseCursorId = oldMouseCursorId; + _vm->_events->_mouseCursorId = oldMouseCursorId; - _vm->_eventsManager->changeMouseCursor(oldMouseCursorId); - _vm->_graphicsManager->initColorTable(145, 150, _vm->_graphicsManager->_palette); - _vm->_graphicsManager->setPaletteVGA256(_vm->_graphicsManager->_palette); + _vm->_events->changeMouseCursor(oldMouseCursorId); + _vm->_graphicsMan->initColorTable(145, 150, _vm->_graphicsMan->_palette); + _vm->_graphicsMan->setPaletteVGA256(_vm->_graphicsMan->_palette); // TODO: The original re-enables the mouse cursor here _vm->_globals->_disableInventFl = oldDisableInventFl; } @@ -229,15 +229,15 @@ int TalkManager::dialogQuestion(bool animatedFl) { uint16 *bufPtr = (uint16 *)_characterBuffer + 48; int curVal = READ_LE_INT16(bufPtr); if (curVal != 0) - _vm->_objectsManager->setBobAnimation(curVal); + _vm->_objectsMan->setBobAnimation(curVal); if (curVal != 1) - _vm->_objectsManager->setBobAnimation(READ_LE_INT16(bufPtr + 1)); + _vm->_objectsMan->setBobAnimation(READ_LE_INT16(bufPtr + 1)); if (curVal != 2) - _vm->_objectsManager->setBobAnimation(READ_LE_INT16(bufPtr + 2)); + _vm->_objectsMan->setBobAnimation(READ_LE_INT16(bufPtr + 2)); if (curVal != 3) - _vm->_objectsManager->setBobAnimation(READ_LE_INT16(bufPtr + 3)); + _vm->_objectsMan->setBobAnimation(READ_LE_INT16(bufPtr + 3)); if (curVal != 4) - _vm->_objectsManager->setBobAnimation(READ_LE_INT16(bufPtr + 4)); + _vm->_objectsMan->setBobAnimation(READ_LE_INT16(bufPtr + 4)); } else { dialogWait(); } @@ -252,76 +252,76 @@ int TalkManager::dialogQuestion(bool animatedFl) { int sentence2PosY = sentence3PosY - 20 * sentence2LineNumb; int sentence1PosY = sentence2PosY - 20 * sentence1LineNumb; - _vm->_fontManager->initTextBuffers(5, _dialogueMesgId1, _questionsFilename, 5, sentence1PosY, 0, 65, 255); - _vm->_fontManager->initTextBuffers(6, _dialogueMesgId2, _questionsFilename, 5, sentence2PosY, 0, 65, 255); - _vm->_fontManager->initTextBuffers(7, _dialogueMesgId3, _questionsFilename, 5, sentence3PosY, 0, 65, 255); - _vm->_fontManager->initTextBuffers(8, _dialogueMesgId4, _questionsFilename, 5, sentence4PosY, 0, 65, 255); - _vm->_fontManager->showText(5); - _vm->_fontManager->showText(6); - _vm->_fontManager->showText(7); - _vm->_fontManager->showText(8); + _vm->_fontMan->initTextBuffers(5, _dialogueMesgId1, _questionsFilename, 5, sentence1PosY, 0, 65, 255); + _vm->_fontMan->initTextBuffers(6, _dialogueMesgId2, _questionsFilename, 5, sentence2PosY, 0, 65, 255); + _vm->_fontMan->initTextBuffers(7, _dialogueMesgId3, _questionsFilename, 5, sentence3PosY, 0, 65, 255); + _vm->_fontMan->initTextBuffers(8, _dialogueMesgId4, _questionsFilename, 5, sentence4PosY, 0, 65, 255); + _vm->_fontMan->showText(5); + _vm->_fontMan->showText(6); + _vm->_fontMan->showText(7); + _vm->_fontMan->showText(8); int retVal = -1; bool loopCond = false; do { - int mousePosY = _vm->_eventsManager->getMouseY(); + int mousePosY = _vm->_events->getMouseY(); if (sentence1PosY < mousePosY && mousePosY < (sentence2PosY - 1)) { - _vm->_fontManager->setOptimalColor(6, 7, 8, 5); + _vm->_fontMan->setOptimalColor(6, 7, 8, 5); retVal = _dialogueMesgId1; } if (sentence2PosY < mousePosY && mousePosY < (sentence3PosY - 1)) { - _vm->_fontManager->setOptimalColor(5, 7, 8, 6); + _vm->_fontMan->setOptimalColor(5, 7, 8, 6); retVal = _dialogueMesgId2; } if (sentence3PosY < mousePosY && mousePosY < (sentence4PosY - 1)) { - _vm->_fontManager->setOptimalColor(5, 6, 8, 7); + _vm->_fontMan->setOptimalColor(5, 6, 8, 7); retVal = _dialogueMesgId3; } if (sentence4PosY < mousePosY && mousePosY < 419) { - _vm->_fontManager->setOptimalColor(5, 6, 7, 8); + _vm->_fontMan->setOptimalColor(5, 6, 7, 8); retVal = _dialogueMesgId4; } - _vm->_eventsManager->refreshScreenAndEvents(); - if (_vm->_eventsManager->getMouseButton()) + _vm->_events->refreshScreenAndEvents(); + if (_vm->_events->getMouseButton()) loopCond = true; if (retVal == -1) loopCond = false; } while (!_vm->shouldQuit() && !loopCond); - _vm->_soundManager->mixVoice(retVal, 1); - _vm->_fontManager->hideText(5); - _vm->_fontManager->hideText(6); - _vm->_fontManager->hideText(7); - _vm->_fontManager->hideText(8); + _vm->_soundMan->mixVoice(retVal, 1); + _vm->_fontMan->hideText(5); + _vm->_fontMan->hideText(6); + _vm->_fontMan->hideText(7); + _vm->_fontMan->hideText(8); if (animatedFl) { uint16 *bufPtr = (uint16 *)_characterBuffer + 48; int curVal = READ_LE_INT16(bufPtr); if (curVal != 0) - _vm->_objectsManager->stopBobAnimation(curVal); + _vm->_objectsMan->stopBobAnimation(curVal); curVal = READ_LE_INT16(bufPtr + 1); if (curVal != 1) - _vm->_objectsManager->stopBobAnimation(curVal); + _vm->_objectsMan->stopBobAnimation(curVal); curVal = READ_LE_INT16(bufPtr + 2); if (curVal != 2) - _vm->_objectsManager->stopBobAnimation(curVal); + _vm->_objectsMan->stopBobAnimation(curVal); curVal = READ_LE_INT16(bufPtr + 3); if (curVal != 3) - _vm->_objectsManager->stopBobAnimation(curVal); + _vm->_objectsMan->stopBobAnimation(curVal); curVal = READ_LE_INT16(bufPtr + 4); if (curVal != 4) - _vm->_objectsManager->stopBobAnimation(curVal); + _vm->_objectsMan->stopBobAnimation(curVal); } else { dialogTalk(); } - _vm->_eventsManager->refreshScreenAndEvents(); + _vm->_events->refreshScreenAndEvents(); return retVal; } @@ -353,75 +353,75 @@ int TalkManager::dialogAnswer(int idx, bool animatedFl) { uint16 *bufPtr = (uint16 *)_characterBuffer + 43; int curVal = READ_LE_INT16(bufPtr); if (curVal) - _vm->_objectsManager->stopBobAnimation(curVal); + _vm->_objectsMan->stopBobAnimation(curVal); curVal = READ_LE_INT16(bufPtr + 1); if (curVal) - _vm->_objectsManager->stopBobAnimation(curVal); + _vm->_objectsMan->stopBobAnimation(curVal); curVal = READ_LE_INT16(bufPtr + 2); if (curVal) - _vm->_objectsManager->stopBobAnimation(curVal); + _vm->_objectsMan->stopBobAnimation(curVal); curVal = READ_LE_INT16(bufPtr + 3); if (curVal) - _vm->_objectsManager->stopBobAnimation(curVal); + _vm->_objectsMan->stopBobAnimation(curVal); curVal = READ_LE_INT16(bufPtr + 4); if (curVal) - _vm->_objectsManager->stopBobAnimation(curVal); + _vm->_objectsMan->stopBobAnimation(curVal); } else { dialogAnim(); } bool displayedTxtFl = false; - if (!_vm->_soundManager->_textOffFl) { - _vm->_fontManager->initTextBuffers(9, mesgId, _answersFilename, mesgPosX, mesgPosY, 5, mesgLength, 252); - _vm->_fontManager->showText(9); + if (!_vm->_soundMan->_textOffFl) { + _vm->_fontMan->initTextBuffers(9, mesgId, _answersFilename, mesgPosX, mesgPosY, 5, mesgLength, 252); + _vm->_fontMan->showText(9); displayedTxtFl = true; } - if (!_vm->_soundManager->mixVoice(mesgId, 1, displayedTxtFl)) { - _vm->_eventsManager->_curMouseButton = 0; - _vm->_eventsManager->_mouseButton = 0; + if (!_vm->_soundMan->mixVoice(mesgId, 1, displayedTxtFl)) { + _vm->_events->_curMouseButton = 0; + _vm->_events->_mouseButton = 0; if (_vm->getIsDemo()) { for (int i = 0; i < frameNumb; i++) { - _vm->_eventsManager->refreshScreenAndEvents(); + _vm->_events->refreshScreenAndEvents(); } } else { for (int i = 0; i < frameNumb; i++) { - _vm->_eventsManager->refreshScreenAndEvents(); - if (_vm->_eventsManager->_mouseButton || _vm->_eventsManager->_curMouseButton) + _vm->_events->refreshScreenAndEvents(); + if (_vm->_events->_mouseButton || _vm->_events->_curMouseButton) break; - if (_vm->_eventsManager->getMouseButton() && i + 1 > abs(frameNumb / 5)) + if (_vm->_events->getMouseButton() && i + 1 > abs(frameNumb / 5)) break; } } } - if (!_vm->_soundManager->_textOffFl) - _vm->_fontManager->hideText(9); + if (!_vm->_soundMan->_textOffFl) + _vm->_fontMan->hideText(9); if (animatedFl) { uint16 *bufPtr = (uint16 *)_characterBuffer + 43; int curVal = READ_LE_INT16(bufPtr); if (curVal) - _vm->_objectsManager->stopBobAnimation(curVal); + _vm->_objectsMan->stopBobAnimation(curVal); curVal = READ_LE_INT16(bufPtr + 1); if (curVal) - _vm->_objectsManager->stopBobAnimation(curVal); + _vm->_objectsMan->stopBobAnimation(curVal); curVal = READ_LE_INT16(bufPtr + 2); if (curVal) - _vm->_objectsManager->stopBobAnimation(curVal); + _vm->_objectsMan->stopBobAnimation(curVal); curVal = READ_LE_INT16(bufPtr + 3); if (curVal) - _vm->_objectsManager->stopBobAnimation(curVal); + _vm->_objectsMan->stopBobAnimation(curVal); curVal = READ_LE_INT16(bufPtr + 4); if (curVal) - _vm->_objectsManager->stopBobAnimation(curVal); + _vm->_objectsMan->stopBobAnimation(curVal); } else { dialogEndTalk(); } @@ -463,46 +463,46 @@ void TalkManager::searchCharacterPalette(int startIdx, bool dark) { else _characterPalette[761] = 255; - _vm->_graphicsManager->setPaletteVGA256(_characterPalette); - _vm->_graphicsManager->initColorTable(145, 150, _characterPalette); + _vm->_graphicsMan->setPaletteVGA256(_characterPalette); + _vm->_graphicsMan->initColorTable(145, 150, _characterPalette); } void TalkManager::dialogWait() { for (int idx = 26; idx <= 30; ++idx) { - if (_vm->_animationManager->_animBqe[idx]._enabledFl) + if (_vm->_animMan->_animBqe[idx]._enabledFl) displayBobDialogAnim(idx); } } void TalkManager::dialogTalk() { for (int idx = 26; idx <= 30; ++idx) { - if (_vm->_animationManager->_animBqe[idx]._enabledFl) - _vm->_objectsManager->hideBob(idx); + if (_vm->_animMan->_animBqe[idx]._enabledFl) + _vm->_objectsMan->hideBob(idx); } for (int idx = 26; idx <= 30; ++idx) { - if (_vm->_animationManager->_animBqe[idx]._enabledFl) - _vm->_objectsManager->resetBob(idx); + if (_vm->_animMan->_animBqe[idx]._enabledFl) + _vm->_objectsMan->resetBob(idx); } } void TalkManager::dialogEndTalk() { for (int idx = 21; idx <= 25; ++idx) { - if (_vm->_animationManager->_animBqe[idx]._enabledFl) - _vm->_objectsManager->hideBob(idx); + if (_vm->_animMan->_animBqe[idx]._enabledFl) + _vm->_objectsMan->hideBob(idx); } - _vm->_eventsManager->refreshScreenAndEvents(); - _vm->_eventsManager->refreshScreenAndEvents(); + _vm->_events->refreshScreenAndEvents(); + _vm->_events->refreshScreenAndEvents(); for (int idx = 21; idx <= 25; ++idx) { - if (_vm->_animationManager->_animBqe[idx]._enabledFl) - _vm->_objectsManager->resetBob(idx); + if (_vm->_animMan->_animBqe[idx]._enabledFl) + _vm->_objectsMan->resetBob(idx); } } int TalkManager::countBoxLines(int idx, const Common::String &file) { - _vm->_fontManager->_fontFixedWidth = 11; + _vm->_fontMan->_fontFixedWidth = 11; // Build up the filename Common::String filename; @@ -591,30 +591,30 @@ int TalkManager::countBoxLines(int idx, const Common::String &file) { void TalkManager::dialogAnim() { for (int idx = 21; idx <= 25; ++idx) { - if (_vm->_animationManager->_animBqe[idx]._enabledFl) + if (_vm->_animMan->_animBqe[idx]._enabledFl) displayBobDialogAnim(idx); } } void TalkManager::displayBobDialogAnim(int idx) { - _vm->_objectsManager->_priorityFl = true; - if (!_vm->_objectsManager->_bob[idx]._bobMode) { - _vm->_objectsManager->resetBob(idx); - byte *bqeData = _vm->_animationManager->_animBqe[idx]._data; + _vm->_objectsMan->_priorityFl = true; + if (!_vm->_objectsMan->_bob[idx]._bobMode) { + _vm->_objectsMan->resetBob(idx); + byte *bqeData = _vm->_animMan->_animBqe[idx]._data; int newMode = READ_LE_INT16(bqeData + 2); if (!newMode) newMode = 1; if (READ_LE_INT16(bqeData + 24)) { - _vm->_objectsManager->_bob[idx]._isSpriteFl = true; - _vm->_objectsManager->_bob[idx]._zoomFactor = 0; - _vm->_objectsManager->_bob[idx]._flipFl = false; - _vm->_objectsManager->_bob[idx]._animData = _vm->_animationManager->_animBqe[idx]._data; - _vm->_objectsManager->_bob[idx]._bobMode = 10; + _vm->_objectsMan->_bob[idx]._isSpriteFl = true; + _vm->_objectsMan->_bob[idx]._zoomFactor = 0; + _vm->_objectsMan->_bob[idx]._flipFl = false; + _vm->_objectsMan->_bob[idx]._animData = _vm->_animMan->_animBqe[idx]._data; + _vm->_objectsMan->_bob[idx]._bobMode = 10; bqeData = _characterSprite; - _vm->_objectsManager->_bob[idx]._spriteData = _characterSprite; - _vm->_objectsManager->_bob[idx]._bobModeChange = newMode; - _vm->_objectsManager->_bob[idx]._modeChangeCtr = -1; - _vm->_objectsManager->_bob[idx]._modeChangeUnused = 0; + _vm->_objectsMan->_bob[idx]._spriteData = _characterSprite; + _vm->_objectsMan->_bob[idx]._bobModeChange = newMode; + _vm->_objectsMan->_bob[idx]._modeChangeCtr = -1; + _vm->_objectsMan->_bob[idx]._modeChangeUnused = 0; } } } @@ -638,7 +638,7 @@ void TalkManager::startCharacterAnim0(int startIdx, bool readOnlyFl) { if (!READ_LE_INT16(&_characterAnim[2 * idx + 4])) break; if (_vm->_globals->_speed != 501) - _vm->_graphicsManager->fastDisplay(_characterSprite, _vm->_eventsManager->_startPos.x + READ_LE_INT16(&_characterAnim[2 * idx]), + _vm->_graphicsMan->fastDisplay(_characterSprite, _vm->_events->_startPos.x + READ_LE_INT16(&_characterAnim[2 * idx]), READ_LE_INT16(&_characterAnim[2 * idx + 2]), _characterAnim[2 * idx + 8]); idx += 5; } while (_vm->_globals->_speed != 501); @@ -694,8 +694,8 @@ void TalkManager::initCharacterAnim() { void TalkManager::clearCharacterAnim() { for (int idx = 21; idx <= 34; ++idx) { - _vm->_animationManager->_animBqe[idx]._data = _vm->_globals->freeMemory(_vm->_animationManager->_animBqe[idx]._data); - _vm->_animationManager->_animBqe[idx]._enabledFl = false; + _vm->_animMan->_animBqe[idx]._data = _vm->_globals->freeMemory(_vm->_animMan->_animBqe[idx]._data); + _vm->_animMan->_animBqe[idx]._enabledFl = false; } } @@ -712,25 +712,25 @@ bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int animId, if (READ_BE_UINT32(curPtr) == MKTAG('A', 'N', 'I', 'M') || READ_BE_UINT24(curPtr) == MKTAG24('F', 'I', 'N')) loopCond = true; if (bufIndx > bufferSize) { - _vm->_animationManager->_animBqe[idx]._enabledFl = false; - _vm->_animationManager->_animBqe[idx]._data = NULL; + _vm->_animMan->_animBqe[idx]._enabledFl = false; + _vm->_animMan->_animBqe[idx]._data = NULL; return false; } ++bufIndx; ++animLength; ++curPtr; } while (!loopCond); - _vm->_animationManager->_animBqe[idx]._data = _vm->_globals->allocMemory(animLength + 50); - _vm->_animationManager->_animBqe[idx]._enabledFl = true; - memcpy(_vm->_animationManager->_animBqe[idx]._data, (const byte *)(bufPerso + bufPos + 5), 20); + _vm->_animMan->_animBqe[idx]._data = _vm->_globals->allocMemory(animLength + 50); + _vm->_animMan->_animBqe[idx]._enabledFl = true; + memcpy(_vm->_animMan->_animBqe[idx]._data, (const byte *)(bufPerso + bufPos + 5), 20); int bqeVal = READ_LE_INT16(bufPos + bufPerso + 29); - WRITE_LE_UINT16(_vm->_animationManager->_animBqe[idx]._data + 20, READ_LE_INT16(bufPos + bufPerso + 25)); - WRITE_LE_UINT16(_vm->_animationManager->_animBqe[idx]._data + 22, READ_LE_INT16(bufPos + bufPerso + 27)); - WRITE_LE_UINT16(_vm->_animationManager->_animBqe[idx]._data + 24, bqeVal); - WRITE_LE_UINT16(_vm->_animationManager->_animBqe[idx]._data + 26, READ_LE_INT16(bufPos + bufPerso + 31)); - _vm->_animationManager->_animBqe[idx]._data[28] = bufPerso[bufPos + 33]; - _vm->_animationManager->_animBqe[idx]._data[29] = bufPerso[bufPos + 34]; - byte *bqeCurData = _vm->_animationManager->_animBqe[idx]._data + 20; + WRITE_LE_UINT16(_vm->_animMan->_animBqe[idx]._data + 20, READ_LE_INT16(bufPos + bufPerso + 25)); + WRITE_LE_UINT16(_vm->_animMan->_animBqe[idx]._data + 22, READ_LE_INT16(bufPos + bufPerso + 27)); + WRITE_LE_UINT16(_vm->_animMan->_animBqe[idx]._data + 24, bqeVal); + WRITE_LE_UINT16(_vm->_animMan->_animBqe[idx]._data + 26, READ_LE_INT16(bufPos + bufPerso + 31)); + _vm->_animMan->_animBqe[idx]._data[28] = bufPerso[bufPos + 33]; + _vm->_animMan->_animBqe[idx]._data[29] = bufPerso[bufPos + 34]; + byte *bqeCurData = _vm->_animMan->_animBqe[idx]._data + 20; const byte *curBufPerso = bufPos + bufPerso + 25; for (int i = 1; i < 5000; i++) { bqeCurData += 10; @@ -821,16 +821,16 @@ void TalkManager::handleAnswer(int zone, int verb) { innerLoopCond = false; int lastOpcodeResult = 1; do { - int opcodeType = _vm->_scriptManager->handleOpcode(ptr + 20 * lastOpcodeResult); + int opcodeType = _vm->_script->handleOpcode(ptr + 20 * lastOpcodeResult); if (_vm->shouldQuit()) return; if (opcodeType == 2) // GOTO - lastOpcodeResult = _vm->_scriptManager->handleGoto(ptr + 20 * lastOpcodeResult); + lastOpcodeResult = _vm->_script->handleGoto(ptr + 20 * lastOpcodeResult); else if (opcodeType == 3) // IF - lastOpcodeResult = _vm->_scriptManager->handleIf(ptr, lastOpcodeResult); + lastOpcodeResult = _vm->_script->handleIf(ptr, lastOpcodeResult); if (lastOpcodeResult == -1) error("Invalid IFF function"); @@ -844,8 +844,8 @@ void TalkManager::handleAnswer(int zone, int verb) { else if (opcodeType == 6) { // JUMP _vm->_globals->freeMemory(ptr); - zoneObj = _vm->_objectsManager->_jumpZone; - verbObj = _vm->_objectsManager->_jumpVerb; + zoneObj = _vm->_objectsMan->_jumpZone; + verbObj = _vm->_objectsMan->_jumpVerb; outerLoopFl = true; break; } @@ -862,26 +862,26 @@ void TalkManager::handleForestAnswser(int zone, int verb) { return; if (zone == 22 || zone == 23) { - _vm->_objectsManager->setFlipSprite(0, false); - _vm->_objectsManager->setSpriteIndex(0, 62); - _vm->_objectsManager->showSpecialActionAnimationWithFlip(_vm->_objectsManager->_forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 4, false); + _vm->_objectsMan->setFlipSprite(0, false); + _vm->_objectsMan->setSpriteIndex(0, 62); + _vm->_objectsMan->showSpecialActionAnimationWithFlip(_vm->_objectsMan->_forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 4, false); if (zone == 22) { - _vm->_objectsManager->lockAnimX(6, _vm->_objectsManager->getBobPosX(3)); - _vm->_objectsManager->lockAnimX(8, _vm->_objectsManager->getBobPosX(3)); + _vm->_objectsMan->lockAnimX(6, _vm->_objectsMan->getBobPosX(3)); + _vm->_objectsMan->lockAnimX(8, _vm->_objectsMan->getBobPosX(3)); } else { // zone == 23 - _vm->_objectsManager->lockAnimX(6, _vm->_objectsManager->getBobPosX(4)); - _vm->_objectsManager->lockAnimX(8, _vm->_objectsManager->getBobPosX(4)); + _vm->_objectsMan->lockAnimX(6, _vm->_objectsMan->getBobPosX(4)); + _vm->_objectsMan->lockAnimX(8, _vm->_objectsMan->getBobPosX(4)); } - _vm->_objectsManager->stopBobAnimation(3); - _vm->_objectsManager->stopBobAnimation(4); - _vm->_objectsManager->setBobAnimation(6); - _vm->_soundManager->playSample(1); - _vm->_objectsManager->showSpecialActionAnimation(_vm->_objectsManager->_forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 4); + _vm->_objectsMan->stopBobAnimation(3); + _vm->_objectsMan->stopBobAnimation(4); + _vm->_objectsMan->setBobAnimation(6); + _vm->_soundMan->playSample(1); + _vm->_objectsMan->showSpecialActionAnimation(_vm->_objectsMan->_forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 4); do - _vm->_eventsManager->refreshScreenAndEvents(); - while (_vm->_objectsManager->getBobAnimDataIdx(6) < 12); - _vm->_objectsManager->stopBobAnimation(6); - _vm->_objectsManager->setBobAnimation(8); + _vm->_events->refreshScreenAndEvents(); + while (_vm->_objectsMan->getBobAnimDataIdx(6) < 12); + _vm->_objectsMan->stopBobAnimation(6); + _vm->_objectsMan->setBobAnimation(8); switch (_vm->_globals->_screenId) { case 35: @@ -907,29 +907,29 @@ void TalkManager::handleForestAnswser(int zone, int verb) { break; } _vm->_globals->_saveData->_data[indx] = 2; - _vm->_linesManager->disableZone(22); - _vm->_linesManager->disableZone(23); + _vm->_linesMan->disableZone(22); + _vm->_linesMan->disableZone(23); } else if (zone == 20 || zone == 21) { - _vm->_objectsManager->setFlipSprite(0, true); - _vm->_objectsManager->setSpriteIndex(0, 62); - _vm->_objectsManager->showSpecialActionAnimationWithFlip(_vm->_objectsManager->_forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 4, true); + _vm->_objectsMan->setFlipSprite(0, true); + _vm->_objectsMan->setSpriteIndex(0, 62); + _vm->_objectsMan->showSpecialActionAnimationWithFlip(_vm->_objectsMan->_forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 4, true); if (zone == 20) { - _vm->_objectsManager->lockAnimX(5, _vm->_objectsManager->getBobPosX(1)); - _vm->_objectsManager->lockAnimX(7, _vm->_objectsManager->getBobPosX(1)); + _vm->_objectsMan->lockAnimX(5, _vm->_objectsMan->getBobPosX(1)); + _vm->_objectsMan->lockAnimX(7, _vm->_objectsMan->getBobPosX(1)); } else { // zone == 21 - _vm->_objectsManager->lockAnimX(5, _vm->_objectsManager->getBobPosX(2)); - _vm->_objectsManager->lockAnimX(7, _vm->_objectsManager->getBobPosX(2)); + _vm->_objectsMan->lockAnimX(5, _vm->_objectsMan->getBobPosX(2)); + _vm->_objectsMan->lockAnimX(7, _vm->_objectsMan->getBobPosX(2)); } - _vm->_objectsManager->stopBobAnimation(1); - _vm->_objectsManager->stopBobAnimation(2); - _vm->_objectsManager->setBobAnimation(5); - _vm->_soundManager->playSample(1); - _vm->_objectsManager->showSpecialActionAnimation(_vm->_objectsManager->_forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 4); + _vm->_objectsMan->stopBobAnimation(1); + _vm->_objectsMan->stopBobAnimation(2); + _vm->_objectsMan->setBobAnimation(5); + _vm->_soundMan->playSample(1); + _vm->_objectsMan->showSpecialActionAnimation(_vm->_objectsMan->_forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 4); do - _vm->_eventsManager->refreshScreenAndEvents(); - while (_vm->_objectsManager->getBobAnimDataIdx(5) < 12); - _vm->_objectsManager->stopBobAnimation(5); - _vm->_objectsManager->setBobAnimation(7); + _vm->_events->refreshScreenAndEvents(); + while (_vm->_objectsMan->getBobAnimDataIdx(5) < 12); + _vm->_objectsMan->stopBobAnimation(5); + _vm->_objectsMan->setBobAnimation(7); switch (_vm->_globals->_screenId) { case 35: indx = 200; @@ -954,32 +954,32 @@ void TalkManager::handleForestAnswser(int zone, int verb) { break; } _vm->_globals->_saveData->_data[indx] = 2; - _vm->_linesManager->disableZone(21); - _vm->_linesManager->disableZone(20); + _vm->_linesMan->disableZone(21); + _vm->_linesMan->disableZone(20); } } void TalkManager::animateObject(const Common::String &filename) { - _vm->_fontManager->hideText(5); - _vm->_fontManager->hideText(9); - _vm->_eventsManager->refreshScreenAndEvents(); - _vm->_graphicsManager->_scrollStatus = 1; - _vm->_linesManager->clearAllZones(); - _vm->_linesManager->resetLines(); - _vm->_objectsManager->resetHidingItems(); + _vm->_fontMan->hideText(5); + _vm->_fontMan->hideText(9); + _vm->_events->refreshScreenAndEvents(); + _vm->_graphicsMan->_scrollStatus = 1; + _vm->_linesMan->clearAllZones(); + _vm->_linesMan->resetLines(); + _vm->_objectsMan->resetHidingItems(); for (int i = 0; i <= 44; i++) - _vm->_linesManager->_bobZone[i] = 0; + _vm->_linesMan->_bobZone[i] = 0; - _vm->_objectsManager->_zoneNum = -1; - _vm->_eventsManager->_mouseCursorId = 4; - _vm->_eventsManager->changeMouseCursor(0); + _vm->_objectsMan->_zoneNum = -1; + _vm->_events->_mouseCursorId = 4; + _vm->_events->changeMouseCursor(0); bool fileFoundFl = false; - _characterBuffer = _vm->_fileManager->searchCat(filename, RES_PER, fileFoundFl); - _characterSize = _vm->_fileManager->_catalogSize; + _characterBuffer = _vm->_fileIO->searchCat(filename, RES_PER, fileFoundFl); + _characterSize = _vm->_fileIO->_catalogSize; if (!fileFoundFl) { - _characterBuffer = _vm->_fileManager->loadFile(filename); - _characterSize = _vm->_fileManager->fileSize(filename); + _characterBuffer = _vm->_fileIO->loadFile(filename); + _characterSize = _vm->_fileIO->fileSize(filename); } Common::String screenFilename; Common::String spriteFilename; @@ -992,47 +992,47 @@ void TalkManager::animateObject(const Common::String &filename) { curScreenFilename = Common::String::format("IM%d", _vm->_globals->_screenId); fileFoundFl = false; - _characterSprite = _vm->_fileManager->searchCat(spriteFilename, RES_SAN, fileFoundFl); + _characterSprite = _vm->_fileIO->searchCat(spriteFilename, RES_SAN, fileFoundFl); if (!fileFoundFl) - _characterSprite = _vm->_objectsManager->loadSprite(spriteFilename); + _characterSprite = _vm->_objectsMan->loadSprite(spriteFilename); else - _characterSprite = _vm->_objectsManager->loadSprite("RES_SAN.RES"); + _characterSprite = _vm->_objectsMan->loadSprite("RES_SAN.RES"); - _vm->_graphicsManager->backupScreen(); + _vm->_graphicsMan->backupScreen(); - if (!_vm->_graphicsManager->_lineNbr) - _vm->_graphicsManager->_scrollOffset = 0; - _vm->_graphicsManager->displayScreen(true); + if (!_vm->_graphicsMan->_lineNbr) + _vm->_graphicsMan->_scrollOffset = 0; + _vm->_graphicsMan->displayScreen(true); _paletteBufferIdx = 20 * READ_LE_INT16((uint16 *)_characterBuffer + 42) + 110; - _vm->_graphicsManager->displayScreen(true); - _vm->_objectsManager->_charactersEnabledFl = true; + _vm->_graphicsMan->displayScreen(true); + _vm->_objectsMan->_charactersEnabledFl = true; searchCharacterPalette(_paletteBufferIdx, true); startCharacterAnim0(_paletteBufferIdx, false); byte *oldAnswerBufferPtr = _vm->_globals->_answerBuffer; _vm->_globals->_answerBuffer = NULL; _vm->_globals->_freezeCharacterFl = true; - _vm->_objectsManager->loadLinkFile(screenFilename); - _vm->_objectsManager->_charactersEnabledFl = true; + _vm->_objectsMan->loadLinkFile(screenFilename); + _vm->_objectsMan->_charactersEnabledFl = true; _vm->_globals->_actionMoveTo = false; - _vm->_objectsManager->_zoneNum = -1; + _vm->_objectsMan->_zoneNum = -1; initCharacterAnim(); dialogAnim(); dialogWait(); - _vm->_graphicsManager->initScreen(screenFilename, 2, true); + _vm->_graphicsMan->initScreen(screenFilename, 2, true); _vm->_globals->_freezeCharacterFl = true; - _vm->_objectsManager->_forceZoneFl = true; - _vm->_objectsManager->_zoneNum = -1; + _vm->_objectsMan->_forceZoneFl = true; + _vm->_objectsMan->_zoneNum = -1; do { - int mouseButton = _vm->_eventsManager->getMouseButton(); + int mouseButton = _vm->_events->getMouseButton(); if (mouseButton == 1) - _vm->_objectsManager->handleLeftButton(); + _vm->_objectsMan->handleLeftButton(); else if (mouseButton == 2) - _vm->_objectsManager->handleRightButton(); + _vm->_objectsMan->handleRightButton(); - _vm->_linesManager->checkZone(); + _vm->_linesMan->checkZone(); if (_vm->_globals->_actionMoveTo) - _vm->_objectsManager->PARADISE(); - _vm->_eventsManager->refreshScreenAndEvents(); + _vm->_objectsMan->PARADISE(); + _vm->_events->refreshScreenAndEvents(); } while (!_vm->_globals->_exitId); dialogEndTalk(); dialogTalk(); @@ -1041,45 +1041,45 @@ void TalkManager::animateObject(const Common::String &filename) { _vm->_globals->_introSpeechOffFl = false; _characterBuffer = _vm->_globals->freeMemory(_characterBuffer); _characterSprite = _vm->_globals->freeMemory(_characterSprite); - _vm->_graphicsManager->displayScreen(false); - _vm->_linesManager->clearAllZones(); - _vm->_linesManager->resetLines(); - _vm->_objectsManager->resetHidingItems(); + _vm->_graphicsMan->displayScreen(false); + _vm->_linesMan->clearAllZones(); + _vm->_linesMan->resetLines(); + _vm->_objectsMan->resetHidingItems(); for (int i = 0; i <= 44; i++) - _vm->_linesManager->_bobZone[i] = 0; + _vm->_linesMan->_bobZone[i] = 0; _vm->_globals->freeMemory(_vm->_globals->_answerBuffer); _vm->_globals->_answerBuffer = oldAnswerBufferPtr; - _vm->_objectsManager->_disableFl = true; - _vm->_objectsManager->loadLinkFile(curScreenFilename); - _vm->_graphicsManager->initScreen(curScreenFilename, 2, true); - _vm->_objectsManager->_disableFl = false; + _vm->_objectsMan->_disableFl = true; + _vm->_objectsMan->loadLinkFile(curScreenFilename); + _vm->_graphicsMan->initScreen(curScreenFilename, 2, true); + _vm->_objectsMan->_disableFl = false; _vm->_globals->_freezeCharacterFl = false; if (_vm->_globals->_exitId == 101) _vm->_globals->_exitId = 0; - _vm->_graphicsManager->restoreScreen(); + _vm->_graphicsMan->restoreScreen(); - _vm->_objectsManager->_charactersEnabledFl = false; - _vm->_eventsManager->_mouseCursorId = 4; - _vm->_eventsManager->changeMouseCursor(4); - _vm->_graphicsManager->setColorPercentage(253, 100, 100, 100); + _vm->_objectsMan->_charactersEnabledFl = false; + _vm->_events->_mouseCursorId = 4; + _vm->_events->changeMouseCursor(4); + _vm->_graphicsMan->setColorPercentage(253, 100, 100, 100); if (!_vm->getIsDemo()) - _vm->_graphicsManager->setColorPercentage(254, 0, 0, 0); - - _vm->_graphicsManager->initColorTable(145, 150, _vm->_graphicsManager->_palette); - _vm->_graphicsManager->setPaletteVGA256(_vm->_graphicsManager->_palette); - _vm->_graphicsManager->lockScreen(); - _vm->_graphicsManager->copy16BitRect(_vm->_graphicsManager->_backBuffer, _vm->_eventsManager->_startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - _vm->_graphicsManager->unlockScreen(); - _vm->_graphicsManager->setPaletteVGA256(_vm->_graphicsManager->_palette); - memcpy(_vm->_graphicsManager->_frontBuffer, _vm->_graphicsManager->_backBuffer, 614399); + _vm->_graphicsMan->setColorPercentage(254, 0, 0, 0); + + _vm->_graphicsMan->initColorTable(145, 150, _vm->_graphicsMan->_palette); + _vm->_graphicsMan->setPaletteVGA256(_vm->_graphicsMan->_palette); + _vm->_graphicsMan->lockScreen(); + _vm->_graphicsMan->copy16BitRect(_vm->_graphicsMan->_backBuffer, _vm->_events->_startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); + _vm->_graphicsMan->unlockScreen(); + _vm->_graphicsMan->setPaletteVGA256(_vm->_graphicsMan->_palette); + memcpy(_vm->_graphicsMan->_frontBuffer, _vm->_graphicsMan->_backBuffer, 614399); _vm->_globals->_disableInventFl = false; - _vm->_graphicsManager->updateScreen(); + _vm->_graphicsMan->updateScreen(); for (int i = 0; i <= 4; i++) - _vm->_eventsManager->refreshScreenAndEvents(); - _vm->_graphicsManager->_scrollStatus = 0; + _vm->_events->refreshScreenAndEvents(); + _vm->_graphicsMan->_scrollStatus = 0; } } // End of namespace Hopkins |