diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hopkins/dialogs.cpp | 8 | ||||
-rw-r--r-- | engines/hopkins/dialogs.h | 16 | ||||
-rw-r--r-- | engines/hopkins/hopkins.cpp | 8 | ||||
-rw-r--r-- | engines/hopkins/objects.cpp | 11 |
4 files changed, 27 insertions, 16 deletions
diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index e0f544d66b..281f3ddb99 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -60,7 +60,14 @@ void DialogsManager::clearAll() { _inventBuf2 = g_PTRNUL; } +void DialogsManager::loadIcons() { + _inventoryIcons = _vm->_fileManager->loadFile("ICONE.SPR"); +} + void DialogsManager::drawInvent(Common::Point oldBorder, int oldBorderSpriteIndex, Common::Point newBorder, int newBorderSpriteIndex) { + if (!_vm->_dialogsManager->_inventDisplayedFl) + return; + _vm->_graphicsManager->restoreSurfaceRect(_vm->_graphicsManager->_vesaBuffer, _inventWin1, _inventX, _inventY, _inventWidth, _inventHeight); if (oldBorder.x && oldBorder.y) _vm->_graphicsManager->Sprite_Vesa(_vm->_graphicsManager->_vesaBuffer, _vm->_dialogsManager->_inventBuf2, oldBorder.x + 300, oldBorder.y + 300, oldBorderSpriteIndex + 1); @@ -68,6 +75,7 @@ void DialogsManager::drawInvent(Common::Point oldBorder, int oldBorderSpriteInde _vm->_graphicsManager->Sprite_Vesa(_vm->_graphicsManager->_vesaBuffer, _vm->_dialogsManager->_inventBuf2, newBorder.x + 300, newBorder.y + 300, newBorderSpriteIndex); _vm->_graphicsManager->addDirtyRect(_vm->_dialogsManager->_inventX, _vm->_dialogsManager->_inventY, _vm->_dialogsManager->_inventX + _vm->_dialogsManager->_inventWidth, _vm->_dialogsManager->_inventY + _vm->_dialogsManager->_inventHeight); } + void DialogsManager::showOptionsDialog() { _vm->_eventsManager->changeMouseCursor(0); _vm->_eventsManager->refreshScreenAndEvents(); diff --git a/engines/hopkins/dialogs.h b/engines/hopkins/dialogs.h index 73b4bb489b..8196e0bbc5 100644 --- a/engines/hopkins/dialogs.h +++ b/engines/hopkins/dialogs.h @@ -40,19 +40,19 @@ enum SaveLoadMode { MODE_SAVE = 1, MODE_LOAD = 2 }; class DialogsManager { private: byte *_inventWin1; + byte *_inventBuf2; + byte *_inventoryIcons; + bool _inventDisplayedFl; + bool _removeInventFl; + int _inventX, _inventY; + int _inventWidth, _inventHeight; HopkinsEngine *_vm; void showSaveLoad(SaveLoadMode mode); int searchSavegames(); public: - byte *_inventBuf2; - bool _removeInventFl; - bool _inventDisplayedFl; bool _inventFl; - int _inventX, _inventY; - int _inventWidth, _inventHeight; - byte *_inventoryIcons; DialogsManager(HopkinsEngine *vm); ~DialogsManager(); @@ -65,6 +65,10 @@ public: void clearAll(); void drawInvent(Common::Point oldBorder, int oldBorderSpriteIndex, Common::Point newBorder, int newBorderSpriteIndex); + void loadIcons(); + + void disableInvent() { _removeInventFl = true; } + void enableInvent() { _removeInventFl = false; } }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 0c1f628933..2d4425e3ff 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -1593,7 +1593,7 @@ void HopkinsEngine::initializeSystem() { _eventsManager->initMouseData(); _fontManager->initData(); - _dialogsManager->_inventoryIcons = _fileManager->loadFile("ICONE.SPR"); + _dialogsManager->loadIcons(); _objectsManager->_headSprites = _fileManager->loadFile("TETE.SPR"); _eventsManager->setMouseOn(); @@ -2059,7 +2059,7 @@ void HopkinsEngine::playUnderwaterBaseCutscene() { void HopkinsEngine::playEnding() { _globals->PERSO = _globals->freeMemory(_globals->PERSO); - _dialogsManager->_removeInventFl = true; + _dialogsManager->disableInvent(); _globals->_disableInventFl = true; _graphicsManager->_scrollOffset = 0; _globals->_cityMapEnabledFl = false; @@ -2169,7 +2169,7 @@ void HopkinsEngine::playEnding() { displayCredits(); _globals->iRegul = 0; _globals->_exitId = 300; - _dialogsManager->_removeInventFl = false; + _dialogsManager->enableInvent(); _globals->_disableInventFl = false; } else { _soundManager->_specialSoundNum = 200; @@ -2197,7 +2197,7 @@ void HopkinsEngine::playEnding() { _soundManager->playSound(16); _globals->iRegul = 1; _soundManager->_specialSoundNum = 0; - _dialogsManager->_removeInventFl = false; + _dialogsManager->enableInvent(); _globals->_disableInventFl = false; _animationManager->playAnim("JOUR4A.anm", 12, 12, 1000); _globals->iRegul = 0; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index d753d57fab..84ea104dc4 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -408,9 +408,8 @@ void ObjectsManager::displaySprite() { } _vm->_globals->_sortedDisplayCount = 0; - if (_vm->_dialogsManager->_inventDisplayedFl) { - _vm->_dialogsManager->drawInvent(_oldBorderPos, _oldBorderSpriteIndex, _borderPos, _borderSpriteIndex); - } + + _vm->_dialogsManager->drawInvent(_oldBorderPos, _oldBorderSpriteIndex, _borderPos, _borderSpriteIndex); if (_saveLoadFl) { _vm->_graphicsManager->restoreSurfaceRect(_vm->_graphicsManager->_vesaBuffer, _saveLoadSprite, _vm->_eventsManager->_startPos.x + 183, 60, 274, 353); @@ -3613,7 +3612,7 @@ void ObjectsManager::handleForest(int screenId, int minX, int maxX, int minY, in if (_vm->_globals->_saveData->_data[savegameIdx]) { if (_vm->_globals->_saveData->_data[savegameIdx] == 1) { if (((idx == 1 || idx == 2) && getBobAnimDataIdx(idx) == 26) || ((idx == 3 || idx == 4) && getBobAnimDataIdx(idx) == 27)) { - _vm->_dialogsManager->_removeInventFl = true; + _vm->_dialogsManager->disableInvent(); _vm->_soundManager->playSample(1); _vm->_globals->_saveData->_data[savegameIdx] = 4; } @@ -3654,7 +3653,7 @@ void ObjectsManager::PERSONAGE(const Common::String &backgroundFile, const Commo const Common::String &animFile, const Common::String &s4, int soundNum, bool initializeScreen) { _vm->_dialogsManager->_inventFl = false; _vm->_eventsManager->_gameKey = KEY_NONE; - _vm->_dialogsManager->_removeInventFl = false; + _vm->_dialogsManager->enableInvent(); _vm->_graphicsManager->_scrollOffset = 0; _vm->_globals->_cityMapEnabledFl = false; _vm->_globals->iRegul = 1; @@ -3744,7 +3743,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm _vm->_eventsManager->_gameKey = KEY_NONE; _verb = 4; _vm->_graphicsManager->_scrollOffset = 0; - _vm->_dialogsManager->_removeInventFl = false; + _vm->_dialogsManager->enableInvent(); _vm->_globals->_cityMapEnabledFl = false; _vm->_graphicsManager->_noFadingFl = false; _vm->_globals->_freezeCharacterFl = false; |