diff options
author | Strangerke | 2013-03-20 08:06:10 +0100 |
---|---|---|
committer | Strangerke | 2013-03-20 08:06:10 +0100 |
commit | 848841772f765b7b8a990d1dd1237d6189f23aaf (patch) | |
tree | ae6cc77058da91032f38c5cf1714459bad749d53 /engines/hopkins | |
parent | c5c7ced5ee2186ace50549ca9e14b70708de5b54 (diff) | |
download | scummvm-rg350-848841772f765b7b8a990d1dd1237d6189f23aaf.tar.gz scummvm-rg350-848841772f765b7b8a990d1dd1237d6189f23aaf.tar.bz2 scummvm-rg350-848841772f765b7b8a990d1dd1237d6189f23aaf.zip |
HOPKINS: Remove setParent() from SaveLoadManager and ScriptManager
Diffstat (limited to 'engines/hopkins')
-rw-r--r-- | engines/hopkins/anim.cpp | 12 | ||||
-rw-r--r-- | engines/hopkins/computer.cpp | 4 | ||||
-rw-r--r-- | engines/hopkins/dialogs.cpp | 12 | ||||
-rw-r--r-- | engines/hopkins/graphics.cpp | 6 | ||||
-rw-r--r-- | engines/hopkins/hopkins.cpp | 12 | ||||
-rw-r--r-- | engines/hopkins/hopkins.h | 4 | ||||
-rw-r--r-- | engines/hopkins/objects.cpp | 10 | ||||
-rw-r--r-- | engines/hopkins/saveload.cpp | 2 | ||||
-rw-r--r-- | engines/hopkins/saveload.h | 3 | ||||
-rw-r--r-- | engines/hopkins/script.cpp | 7 | ||||
-rw-r--r-- | engines/hopkins/script.h | 3 | ||||
-rw-r--r-- | engines/hopkins/talk.cpp | 18 |
12 files changed, 45 insertions, 48 deletions
diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 6ebeab36f8..7fc62f5f63 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -242,9 +242,9 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u memcpy(_vm->_graphicsManager->_oldPalette, _vm->_graphicsManager->_palette, 769); if (_vm->_graphicsManager->_lineNbr == SCREEN_WIDTH) - _vm->_saveLoadManager.saveFile("TEMP.SCR", _vm->_graphicsManager->_vesaScreen, 307200); + _vm->_saveLoadManager->saveFile("TEMP.SCR", _vm->_graphicsManager->_vesaScreen, 307200); else if (_vm->_graphicsManager->_lineNbr == (SCREEN_WIDTH * 2)) - _vm->_saveLoadManager.saveFile("TEMP.SCR", _vm->_graphicsManager->_vesaScreen, 614400); + _vm->_saveLoadManager->saveFile("TEMP.SCR", _vm->_graphicsManager->_vesaScreen, 614400); if (!_vm->_graphicsManager->_lineNbr) _vm->_graphicsManager->_scrollOffset = 0; @@ -388,7 +388,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 rate1, u } _vm->_graphicsManager->FADE_LINUX = 0; - _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager->_vesaScreen); + _vm->_saveLoadManager->load("TEMP.SCR", _vm->_graphicsManager->_vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); memcpy(_vm->_graphicsManager->_palette, _vm->_graphicsManager->_oldPalette, 769); @@ -621,9 +621,9 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui _vm->_eventsManager->refreshScreenAndEvents(); if (_vm->_graphicsManager->_lineNbr == SCREEN_WIDTH) - _vm->_saveLoadManager.saveFile("TEMP.SCR", _vm->_graphicsManager->_vesaScreen, 307200); + _vm->_saveLoadManager->saveFile("TEMP.SCR", _vm->_graphicsManager->_vesaScreen, 307200); else if (_vm->_graphicsManager->_lineNbr == (SCREEN_WIDTH * 2)) - _vm->_saveLoadManager.saveFile("TEMP.SCR", _vm->_graphicsManager->_vesaScreen, 614400); + _vm->_saveLoadManager->saveFile("TEMP.SCR", _vm->_graphicsManager->_vesaScreen, 614400); if (!_vm->_graphicsManager->_lineNbr) _vm->_graphicsManager->_scrollOffset = 0; } @@ -771,7 +771,7 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui f.close(); if (!NO_COUL) { - _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager->_vesaScreen); + _vm->_saveLoadManager->load("TEMP.SCR", _vm->_graphicsManager->_vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); _vm->_eventsManager->_mouseFl = true; diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index e6369b84f5..3e9c8811fc 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -582,7 +582,7 @@ void ComputerManager::displayGamesSubMenu() { */ void ComputerManager::loadHiscore() { byte *ptr = _vm->_globals->allocMemory(100); - _vm->_saveLoadManager.load("HISCORE.DAT", ptr); + _vm->_saveLoadManager->load("HISCORE.DAT", ptr); for (int scoreIndex = 0; scoreIndex < 6; ++scoreIndex) { for (int i = 0; i < 5; ++i) { @@ -992,7 +992,7 @@ void ComputerManager::saveScore() { ptr[curBufPtr + 15] = 0; } - _vm->_saveLoadManager.saveFile("HISCORE.DAT", ptr, 100); + _vm->_saveLoadManager->saveFile("HISCORE.DAT", ptr, 100); _vm->_globals->freeMemory(ptr); } diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp index 0e396cb7ae..e588b4df43 100644 --- a/engines/hopkins/dialogs.cpp +++ b/engines/hopkins/dialogs.cpp @@ -411,12 +411,12 @@ void DialogsManager::showInventory() { if (_vm->_eventsManager->_mouseCursorId == 8) break; - _vm->_scriptManager._tempObjectFl = true; + _vm->_scriptManager->_tempObjectFl = true; _vm->_globals->_saveData->_data[svLastObjectIndex] = _vm->_objectsManager->_curObjectIndex; _vm->_globals->_saveData->_data[svLastInventoryItem] = _vm->_globals->_inventory[newInventoryItem]; _vm->_globals->_saveData->_data[svLastInvMouseCursor] = _vm->_eventsManager->_mouseCursorId; _vm->_objectsManager->OPTI_OBJET(); - _vm->_scriptManager._tempObjectFl = false; + _vm->_scriptManager->_tempObjectFl = false; if (_vm->_soundManager._voiceOffFl) { do @@ -581,7 +581,7 @@ void DialogsManager::showLoadGame() { _vm->_objectsManager->_saveLoadY = 0; if (slotNumber != 7) { - _vm->_saveLoadManager.loadGame(slotNumber); + _vm->_saveLoadManager->loadGame(slotNumber); } _vm->_objectsManager->changeObject(14); @@ -614,7 +614,7 @@ void DialogsManager::showSaveGame() { Common::String saveName = Common::String::format("Save #%d", slotNumber); // Save the game - _vm->_saveLoadManager.saveGame(slotNumber, saveName); + _vm->_saveLoadManager->saveGame(slotNumber, saveName); } } @@ -658,9 +658,9 @@ void DialogsManager::showSaveLoad(SaveLoadMode mode) { for (int slotNumber = 1; slotNumber <= 6; ++slotNumber) { hopkinsSavegameHeader header; - if (_vm->_saveLoadManager.readSavegameHeader(slotNumber, header)) { + if (_vm->_saveLoadManager->readSavegameHeader(slotNumber, header)) { Graphics::Surface thumb8; - _vm->_saveLoadManager.convertThumb16To8(header._thumbnail, &thumb8); + _vm->_saveLoadManager->convertThumb16To8(header._thumbnail, &thumb8); byte *thumb = (byte *)thumb8.pixels; diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 41de90ebb3..9730fba51b 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1762,14 +1762,14 @@ void GraphicsManager::initScreen(const Common::String &file, int mode, bool init int dataOffset = 1; do { - int dataVal1 = _vm->_scriptManager.handleOpcode(ptr + 20 * dataOffset); + int dataVal1 = _vm->_scriptManager->handleOpcode(ptr + 20 * dataOffset); if (_vm->shouldQuit()) return; if (dataVal1 == 2) - dataOffset = _vm->_scriptManager.handleGoto((ptr + 20 * dataOffset)); + dataOffset = _vm->_scriptManager->handleGoto((ptr + 20 * dataOffset)); if (dataVal1 == 3) - dataOffset = _vm->_scriptManager.handleIf(ptr, dataOffset); + dataOffset = _vm->_scriptManager->handleIf(ptr, dataOffset); if (dataOffset == -1) error("Error, defective IFF"); if (dataVal1 == 1 || dataVal1 == 4) diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 4ed958ff0f..8b044ec61a 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -52,14 +52,16 @@ HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDe _linesManager = new LinesManager(this); _menuManager = new MenuManager(this); _objectsManager = new ObjectsManager(this); + _saveLoadManager = new SaveLoadManager(this); + _scriptManager = new ScriptManager(this); - _saveLoadManager.setParent(this); - _scriptManager.setParent(this); _soundManager.setParent(this); _talkManager.setParent(this); } HopkinsEngine::~HopkinsEngine() { + delete _scriptManager; + delete _saveLoadManager; delete _objectsManager; delete _menuManager; delete _linesManager; @@ -96,18 +98,18 @@ bool HopkinsEngine::canSaveGameStateCurrently() { * Load the savegame at the specified slot index */ Common::Error HopkinsEngine::loadGameState(int slot) { - return _saveLoadManager.loadGame(slot); + return _saveLoadManager->loadGame(slot); } /** * Save the game to the given slot index, and with the given name */ Common::Error HopkinsEngine::saveGameState(int slot, const Common::String &desc) { - return _saveLoadManager.saveGame(slot, desc); + return _saveLoadManager->saveGame(slot, desc); } Common::Error HopkinsEngine::run() { - _saveLoadManager.initSaves(); + _saveLoadManager->initSaves(); _globals->setConfig(); _fileManager->initCensorship(); diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 6b440db3cd..19f25d76ed 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -154,9 +154,9 @@ public: LinesManager *_linesManager; MenuManager *_menuManager; ObjectsManager *_objectsManager; + SaveLoadManager *_saveLoadManager; + ScriptManager *_scriptManager; - SaveLoadManager _saveLoadManager; - ScriptManager _scriptManager; SoundManager _soundManager; TalkManager _talkManager; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 8d3d1d7aec..f8c5f05687 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -2540,14 +2540,14 @@ void ObjectsManager::OPTI_OBJET() { error("File %s is not an INI file", file.c_str()); for (;;) { - int opcodeType = _vm->_scriptManager.handleOpcode(data + 20 * lastOpcodeResult); + int opcodeType = _vm->_scriptManager->handleOpcode(data + 20 * lastOpcodeResult); if (_vm->shouldQuit()) return; if (opcodeType == 2) - lastOpcodeResult = _vm->_scriptManager.handleGoto(data + 20 * lastOpcodeResult); + lastOpcodeResult = _vm->_scriptManager->handleGoto(data + 20 * lastOpcodeResult); else if (opcodeType == 3) - lastOpcodeResult = _vm->_scriptManager.handleIf(data, lastOpcodeResult); + lastOpcodeResult = _vm->_scriptManager->handleIf(data, lastOpcodeResult); if (lastOpcodeResult == -1) error("defective IFF function"); @@ -2580,7 +2580,7 @@ void ObjectsManager::handleSpecialGames() { oldPalette = _vm->_globals->allocMemory(1000); memcpy(oldPalette, _vm->_graphicsManager->_palette, 769); - _vm->_saveLoadManager.saveFile("TEMP1.SCR", _vm->_graphicsManager->_vesaScreen, 307200); + _vm->_saveLoadManager->saveFile("TEMP1.SCR", _vm->_graphicsManager->_vesaScreen, 307200); if (!_vm->_graphicsManager->_lineNbr) _vm->_graphicsManager->_scrollOffset = 0; @@ -2594,7 +2594,7 @@ void ObjectsManager::handleSpecialGames() { _vm->_soundManager._specialSoundNum = 0; _vm->_graphicsManager->NB_SCREEN(false); - _vm->_saveLoadManager.load("TEMP1.SCR", _vm->_graphicsManager->_vesaScreen); + _vm->_saveLoadManager->load("TEMP1.SCR", _vm->_graphicsManager->_vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP1.SCR"); PERSO_ON = false; diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 2697a6d59c..6bba86082d 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -38,7 +38,7 @@ namespace Hopkins { const char *SAVEGAME_STR = "HOPKINS"; #define SAVEGAME_STR_SIZE 13 -void SaveLoadManager::setParent(HopkinsEngine *vm) { +SaveLoadManager::SaveLoadManager(HopkinsEngine *vm) { _vm = vm; } diff --git a/engines/hopkins/saveload.h b/engines/hopkins/saveload.h index 8076519b89..221a445fd2 100644 --- a/engines/hopkins/saveload.h +++ b/engines/hopkins/saveload.h @@ -54,8 +54,7 @@ private: void syncSavegameData(Common::Serializer &s, int version); void syncCharacterLocation(Common::Serializer &s, CharacterLocation &item); public: - SaveLoadManager() {} - void setParent(HopkinsEngine *vm); + SaveLoadManager(HopkinsEngine *vm); void initSaves(); bool save(const Common::String &file, const void *buf, size_t n); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index d324eeefe4..b883616d68 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -35,12 +35,9 @@ namespace Hopkins { -ScriptManager::ScriptManager() { - _tempObjectFl = false; -} - -void ScriptManager::setParent(HopkinsEngine *vm) { +ScriptManager::ScriptManager(HopkinsEngine *vm) { _vm = vm; + _tempObjectFl = false; } int ScriptManager::handleOpcode(byte *dataP) { diff --git a/engines/hopkins/script.h b/engines/hopkins/script.h index 3eba8d5167..41da519410 100644 --- a/engines/hopkins/script.h +++ b/engines/hopkins/script.h @@ -38,8 +38,7 @@ private: public: bool _tempObjectFl; - ScriptManager(); - void setParent(HopkinsEngine *vm); + ScriptManager(HopkinsEngine *vm); int handleOpcode(byte *dataP); int handleIf(const byte *dataP, int offset); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index a8a843684d..6c6c5430fb 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -87,9 +87,9 @@ void TalkManager::startAnimatedCharacterDialogue(const Common::String &filename) } if (_vm->_graphicsManager->_lineNbr == SCREEN_WIDTH) - _vm->_saveLoadManager.saveFile("TEMP.SCR", _vm->_graphicsManager->_vesaScreen, 307200); + _vm->_saveLoadManager->saveFile("TEMP.SCR", _vm->_graphicsManager->_vesaScreen, 307200); else if (_vm->_graphicsManager->_lineNbr == (SCREEN_WIDTH * 2)) - _vm->_saveLoadManager.saveFile("TEMP.SCR", _vm->_graphicsManager->_vesaScreen, 614400); + _vm->_saveLoadManager->saveFile("TEMP.SCR", _vm->_graphicsManager->_vesaScreen, 614400); if (!_vm->_graphicsManager->_lineNbr) _vm->_graphicsManager->_scrollOffset = 0; @@ -129,7 +129,7 @@ void TalkManager::startAnimatedCharacterDialogue(const Common::String &filename) _characterSprite = _vm->_globals->freeMemory(_characterSprite); _vm->_graphicsManager->NB_SCREEN(false); - _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager->_vesaScreen); + _vm->_saveLoadManager->load("TEMP.SCR", _vm->_graphicsManager->_vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); _vm->_objectsManager->PERSO_ON = false; @@ -825,16 +825,16 @@ void TalkManager::REPONSE(int zone, int verb) { innerLoopCond = false; int lastOpcodeResult = 1; do { - int opcodeType = _vm->_scriptManager.handleOpcode(ptr + 20 * lastOpcodeResult); + int opcodeType = _vm->_scriptManager->handleOpcode(ptr + 20 * lastOpcodeResult); if (_vm->shouldQuit()) return; if (opcodeType == 2) // GOTO - lastOpcodeResult = _vm->_scriptManager.handleGoto(ptr + 20 * lastOpcodeResult); + lastOpcodeResult = _vm->_scriptManager->handleGoto(ptr + 20 * lastOpcodeResult); else if (opcodeType == 3) // IF - lastOpcodeResult = _vm->_scriptManager.handleIf(ptr, lastOpcodeResult); + lastOpcodeResult = _vm->_scriptManager->handleIf(ptr, lastOpcodeResult); if (lastOpcodeResult == -1) error("Invalid IFF function"); @@ -1001,9 +1001,9 @@ void TalkManager::animateObject(const Common::String &filename) { _characterSprite = _vm->_objectsManager->loadSprite("RES_SAN.RES"); if (_vm->_graphicsManager->_lineNbr == SCREEN_WIDTH) - _vm->_saveLoadManager.saveFile("TEMP.SCR", _vm->_graphicsManager->_vesaScreen, 307200); + _vm->_saveLoadManager->saveFile("TEMP.SCR", _vm->_graphicsManager->_vesaScreen, 307200); else if (_vm->_graphicsManager->_lineNbr == (SCREEN_WIDTH * 2)) - _vm->_saveLoadManager.saveFile("TEMP.SCR", _vm->_graphicsManager->_vesaScreen, 614400); + _vm->_saveLoadManager->saveFile("TEMP.SCR", _vm->_graphicsManager->_vesaScreen, 614400); if (!_vm->_graphicsManager->_lineNbr) _vm->_graphicsManager->_scrollOffset = 0; @@ -1063,7 +1063,7 @@ void TalkManager::animateObject(const Common::String &filename) { if (_vm->_globals->_exitId == 101) _vm->_globals->_exitId = 0; - _vm->_saveLoadManager.load("TEMP.SCR", _vm->_graphicsManager->_vesaScreen); + _vm->_saveLoadManager->load("TEMP.SCR", _vm->_graphicsManager->_vesaScreen); g_system->getSavefileManager()->removeSavefile("TEMP.SCR"); _vm->_objectsManager->PERSO_ON = false; |