diff options
-rw-r--r-- | engines/glk/alan2/alan2.cpp | 8 | ||||
-rw-r--r-- | engines/glk/alan2/alan2.h | 3 | ||||
-rw-r--r-- | engines/glk/frotz/frotz.cpp | 4 | ||||
-rw-r--r-- | engines/glk/frotz/frotz.h | 2 | ||||
-rw-r--r-- | engines/glk/frotz/windows.cpp | 1 | ||||
-rw-r--r-- | engines/glk/glk.cpp | 11 | ||||
-rw-r--r-- | engines/glk/glk.h | 3 | ||||
-rw-r--r-- | engines/glk/glulxe/glulxe.cpp | 10 | ||||
-rw-r--r-- | engines/glk/glulxe/glulxe.h | 3 | ||||
-rw-r--r-- | engines/glk/magnetic/magnetic.cpp | 10 | ||||
-rw-r--r-- | engines/glk/magnetic/magnetic.h | 3 | ||||
-rw-r--r-- | engines/glk/scott/scott.cpp | 4 | ||||
-rw-r--r-- | engines/glk/scott/scott.h | 2 | ||||
-rw-r--r-- | engines/glk/tads/tads2/tads2.cpp | 2 | ||||
-rw-r--r-- | engines/glk/tads/tads2/tads2.h | 2 | ||||
-rw-r--r-- | engines/glk/tads/tads3/tads3.cpp | 2 | ||||
-rw-r--r-- | engines/glk/tads/tads3/tads3.h | 2 |
17 files changed, 31 insertions, 41 deletions
diff --git a/engines/glk/alan2/alan2.cpp b/engines/glk/alan2/alan2.cpp index f9dcb52903..60889f70a3 100644 --- a/engines/glk/alan2/alan2.cpp +++ b/engines/glk/alan2/alan2.cpp @@ -45,9 +45,7 @@ Alan2::Alan2(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, g dscrstkp = 0; } -void Alan2::runGame(Common::SeekableReadStream *gameFile) { - _gameFile = gameFile; - +void Alan2::runGame() { // TODO: Initialize these properly int tmp = 0; Common::String gameFileName; @@ -73,12 +71,12 @@ Common::Error Alan2::saveGameData(strid_t file, const Common::String &desc) { } bool Alan2::is_gamefile_valid() { - if (_gameFile->size() < 8) { + if (_gameFile.size() < 8) { GUIErrorMessage(_("This is too short to be a valid Alan2 file.")); return false; } - if (_gameFile->readUint32BE() != MKTAG(2, 8, 1, 0)) { + if (_gameFile.readUint32BE() != MKTAG(2, 8, 1, 0)) { GUIErrorMessage(_("This is not a valid Alan2 file.")); return false; } diff --git a/engines/glk/alan2/alan2.h b/engines/glk/alan2/alan2.h index e2fe6ae9cd..a6ded4304a 100644 --- a/engines/glk/alan2/alan2.h +++ b/engines/glk/alan2/alan2.h @@ -45,7 +45,6 @@ class SaveLoad; */ class Alan2 : public GlkAPI { public: - Common::SeekableReadStream *_gameFile; bool vm_exited_cleanly; private: /** @@ -61,7 +60,7 @@ public: /** * Run the game */ - void runGame(Common::SeekableReadStream *gameFile); + void runGame(); /** * Returns the running interpreter type diff --git a/engines/glk/frotz/frotz.cpp b/engines/glk/frotz/frotz.cpp index e837f65554..8ec3db7133 100644 --- a/engines/glk/frotz/frotz.cpp +++ b/engines/glk/frotz/frotz.cpp @@ -44,8 +44,8 @@ Screen *Frotz::createScreen() { return new FrotzScreen(); } -void Frotz::runGame(Common::SeekableReadStream *gameFile) { - story_fp = gameFile; +void Frotz::runGame() { + story_fp = &_gameFile; initialize(); // If save was selected from the launcher, handle loading it diff --git a/engines/glk/frotz/frotz.h b/engines/glk/frotz/frotz.h index 28902c5665..d05971a540 100644 --- a/engines/glk/frotz/frotz.h +++ b/engines/glk/frotz/frotz.h @@ -61,7 +61,7 @@ public: /** * Execute the game */ - virtual void runGame(Common::SeekableReadStream *gameFile) override; + virtual void runGame() override; /** * Load a savegame from the passed stream diff --git a/engines/glk/frotz/windows.cpp b/engines/glk/frotz/windows.cpp index e4179caeea..4fa291e868 100644 --- a/engines/glk/frotz/windows.cpp +++ b/engines/glk/frotz/windows.cpp @@ -52,7 +52,6 @@ winid_t Window::getWindow() { // Window doesn't exist, so create it // TODO: For now I'm assuming all the extra created windows will be graphics, since Glk requires // us to specify it at creation time. Not sure if it's true or not for all V6 games - winid_t parent = _windows->_lower; _win = g_vm->glk_window_open(g_vm->glk_window_get_root(), winmethod_Arbitrary | winmethod_Fixed, 0, wintype_Graphics, 0); } diff --git a/engines/glk/glk.cpp b/engines/glk/glk.cpp index 2525c0b1fa..e7d10fa29d 100644 --- a/engines/glk/glk.cpp +++ b/engines/glk/glk.cpp @@ -107,7 +107,6 @@ void GlkEngine::initGraphicsMode() { } Common::Error GlkEngine::run() { - Common::File f; Common::String filename = getFilename(); if (!Common::File::exists(filename)) return Common::kNoGameDataFoundError; @@ -119,7 +118,7 @@ Common::Error GlkEngine::run() { _blorb = new Blorb(filename, getInterpreterType()); SearchMan.add("blorb", _blorb, 99, false); - if (!f.open("game", *_blorb)) + if (!_gameFile.open("game", *_blorb)) return Common::kNoGameDataFoundError; } else { // Check for a secondary blorb file with the same filename @@ -127,20 +126,20 @@ Common::Error GlkEngine::run() { while (baseName.contains('.')) baseName.deleteLastChar(); - if (f.exists(baseName + ".blorb")) { + if (Common::File::exists(baseName + ".blorb")) { _blorb = new Blorb(baseName + ".blorb", getInterpreterType()); SearchMan.add("blorb", _blorb, 99, false); - } else if (f.exists(baseName + ".blb")) { + } else if (Common::File::exists(baseName + ".blb")) { _blorb = new Blorb(baseName + ".blb", getInterpreterType()); SearchMan.add("blorb", _blorb, 99, false); } // Open up the game file - if (!f.open(filename)) + if (!_gameFile.open(filename)) return Common::kNoGameDataFoundError; } - runGame(&f); + runGame(); return Common::kNoError; } diff --git a/engines/glk/glk.h b/engines/glk/glk.h index a2cc3e4981..2782353547 100644 --- a/engines/glk/glk.h +++ b/engines/glk/glk.h @@ -81,6 +81,7 @@ protected: const GlkGameDescription _gameDescription; Common::RandomSource _random; int _loadSaveSlot; + Common::File _gameFile; // Engine APIs virtual Common::Error run(); @@ -98,7 +99,7 @@ protected: /** * Main game loop for the individual interpreters */ - virtual void runGame(Common::SeekableReadStream *gameFile) = 0; + virtual void runGame() = 0; public: Blorb *_blorb; Clipboard *_clipboard; diff --git a/engines/glk/glulxe/glulxe.cpp b/engines/glk/glulxe/glulxe.cpp index aaa63b6141..40f4bdde57 100644 --- a/engines/glk/glulxe/glulxe.cpp +++ b/engines/glk/glulxe/glulxe.cpp @@ -31,9 +31,7 @@ Glulxe::Glulxe(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, vm_exited_cleanly(false) { } -void Glulxe::runGame(Common::SeekableReadStream *gameFile) { - _gameFile = gameFile; - +void Glulxe::runGame() { if (!is_gamefile_valid()) return; @@ -51,18 +49,18 @@ Common::Error Glulxe::saveGameData(strid_t file, const Common::String &desc) { } bool Glulxe::is_gamefile_valid() { - if (_gameFile->size() < 8) { + if (_gameFile.size() < 8) { GUIErrorMessage(_("This is too short to be a valid Glulx file.")); return false; } - if (_gameFile->readUint32BE() != MKTAG('G', 'l', 'u', 'l')) { + if (_gameFile.readUint32BE() != MKTAG('G', 'l', 'u', 'l')) { GUIErrorMessage(_("This is not a valid Glulx file.")); return false; } // We support version 2.0 through 3.1.* - uint version = _gameFile->readUint32BE(); + uint version = _gameFile.readUint32BE(); if (version < 0x20000) { GUIErrorMessage(_("This Glulx file is too old a version to execute.")); return false; diff --git a/engines/glk/glulxe/glulxe.h b/engines/glk/glulxe/glulxe.h index 3764ca4fe0..decdc298f7 100644 --- a/engines/glk/glulxe/glulxe.h +++ b/engines/glk/glulxe/glulxe.h @@ -34,7 +34,6 @@ namespace Glulxe { */ class Glulxe : public GlkAPI { public: - Common::SeekableReadStream *_gameFile; bool vm_exited_cleanly; private: /** @@ -50,7 +49,7 @@ public: /** * Run the game */ - void runGame(Common::SeekableReadStream *gameFile); + void runGame(); /** * Returns the running interpreter type diff --git a/engines/glk/magnetic/magnetic.cpp b/engines/glk/magnetic/magnetic.cpp index f3f3e79a86..9bfdc4825c 100644 --- a/engines/glk/magnetic/magnetic.cpp +++ b/engines/glk/magnetic/magnetic.cpp @@ -31,9 +31,7 @@ Magnetic::Magnetic(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(s vm_exited_cleanly(false) { } -void Magnetic::runGame(Common::SeekableReadStream *gameFile) { - _gameFile = gameFile; - +void Magnetic::runGame() { if (!is_gamefile_valid()) return; @@ -51,18 +49,18 @@ Common::Error Magnetic::saveGameData(strid_t file, const Common::String &desc) { } bool Magnetic::is_gamefile_valid() { - if (_gameFile->size() < 8) { + if (_gameFile.size() < 8) { GUIErrorMessage(_("This is too short to be a valid Glulx file.")); return false; } - if (_gameFile->readUint32BE() != MKTAG('G', 'l', 'u', 'l')) { + if (_gameFile.readUint32BE() != MKTAG('G', 'l', 'u', 'l')) { GUIErrorMessage(_("This is not a valid Glulx file.")); return false; } // We support version 2.0 through 3.1.* - uint version = _gameFile->readUint32BE(); + uint version = _gameFile.readUint32BE(); if (version < 0x20000) { GUIErrorMessage(_("This Glulx file is too old a version to execute.")); return false; diff --git a/engines/glk/magnetic/magnetic.h b/engines/glk/magnetic/magnetic.h index 6f30768d0c..024ef51e1e 100644 --- a/engines/glk/magnetic/magnetic.h +++ b/engines/glk/magnetic/magnetic.h @@ -34,7 +34,6 @@ namespace Magnetic { */ class Magnetic : public GlkAPI { public: - Common::SeekableReadStream *_gameFile; bool vm_exited_cleanly; private: /** @@ -50,7 +49,7 @@ public: /** * Run the game */ - void runGame(Common::SeekableReadStream *gameFile); + void runGame(); /** * Returns the running interpreter type diff --git a/engines/glk/scott/scott.cpp b/engines/glk/scott/scott.cpp index 640679c5f3..b918f8cda2 100644 --- a/engines/glk/scott/scott.cpp +++ b/engines/glk/scott/scott.cpp @@ -35,7 +35,7 @@ Scott::Scott(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, g Common::fill(&_roomSaved[0], &_roomSaved[16], 0); } -void Scott::runGame(Common::SeekableReadStream *gameFile) { +void Scott::runGame() { int vb, no; initialize(); @@ -70,7 +70,7 @@ void Scott::runGame(Common::SeekableReadStream *gameFile) { _saveSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1; // Load the game - loadDatabase(gameFile, (_options & DEBUGGING) ? 1 : 0); + loadDatabase(&_gameFile, (_options & DEBUGGING) ? 1 : 0); // Main game loop while (!shouldQuit()) { diff --git a/engines/glk/scott/scott.h b/engines/glk/scott/scott.h index b490fd6412..4739e9470a 100644 --- a/engines/glk/scott/scott.h +++ b/engines/glk/scott/scott.h @@ -174,7 +174,7 @@ public: /** * Execute the game */ - virtual void runGame(Common::SeekableReadStream *gameFile) override; + virtual void runGame() override; /** * Load a savegame from the passed stream diff --git a/engines/glk/tads/tads2/tads2.cpp b/engines/glk/tads/tads2/tads2.cpp index 79a36fa0ff..a772b44aed 100644 --- a/engines/glk/tads/tads2/tads2.cpp +++ b/engines/glk/tads/tads2/tads2.cpp @@ -30,7 +30,7 @@ TADS2::TADS2(OSystem *syst, const GlkGameDescription &gameDesc) : OS(syst, gameD cmap_init_default(); } -void TADS2::runGame(Common::SeekableReadStream *gameFile) { +void TADS2::runGame() { errcxdef errctx; errctx.errcxlgc = &errctx; errctx.errcxfp = nullptr; diff --git a/engines/glk/tads/tads2/tads2.h b/engines/glk/tads/tads2/tads2.h index f0c42b3574..2472929840 100644 --- a/engines/glk/tads/tads2/tads2.h +++ b/engines/glk/tads/tads2/tads2.h @@ -167,7 +167,7 @@ public: /** * Execute the game */ - virtual void runGame(Common::SeekableReadStream *gameFile) override; + virtual void runGame() override; /** * Returns the running interpreter type diff --git a/engines/glk/tads/tads3/tads3.cpp b/engines/glk/tads/tads3/tads3.cpp index 911e87fd2b..10fb602fe2 100644 --- a/engines/glk/tads/tads3/tads3.cpp +++ b/engines/glk/tads/tads3/tads3.cpp @@ -29,7 +29,7 @@ namespace TADS3 { TADS3::TADS3(OSystem *syst, const GlkGameDescription &gameDesc) : TADS(syst, gameDesc) { } -void TADS3::runGame(Common::SeekableReadStream *gameFile) { +void TADS3::runGame() { // TODO } diff --git a/engines/glk/tads/tads3/tads3.h b/engines/glk/tads/tads3/tads3.h index 2fc4961738..45a3f0933f 100644 --- a/engines/glk/tads/tads3/tads3.h +++ b/engines/glk/tads/tads3/tads3.h @@ -42,7 +42,7 @@ public: /** * Execute the game */ - virtual void runGame(Common::SeekableReadStream *gameFile) override; + virtual void runGame() override; /** * Returns the running interpreter type |