diff options
-rw-r--r-- | engines/gargoyle/detection.cpp | 15 | ||||
-rw-r--r-- | engines/gargoyle/gargoyle.cpp | 14 | ||||
-rw-r--r-- | engines/gargoyle/gargoyle.h | 12 | ||||
-rw-r--r-- | engines/gargoyle/glk.cpp (renamed from engines/gargoyle/glk/glk.cpp) | 5 | ||||
-rw-r--r-- | engines/gargoyle/glk.h (renamed from engines/gargoyle/glk/glk.h) | 9 | ||||
-rw-r--r-- | engines/gargoyle/glk_types.h (renamed from engines/gargoyle/glk/glk_types.h) | 0 | ||||
-rw-r--r-- | engines/gargoyle/interpreter.cpp | 28 | ||||
-rw-r--r-- | engines/gargoyle/interpreter.h | 55 | ||||
-rw-r--r-- | engines/gargoyle/module.mk | 5 | ||||
-rw-r--r-- | engines/gargoyle/scott/scott.cpp (renamed from engines/gargoyle/interps/scott/scott.cpp) | 4 | ||||
-rw-r--r-- | engines/gargoyle/scott/scott.h (renamed from engines/gargoyle/interps/scott/scott.h) | 6 |
11 files changed, 36 insertions, 117 deletions
diff --git a/engines/gargoyle/detection.cpp b/engines/gargoyle/detection.cpp index f10a70bdc6..93859e6a3a 100644 --- a/engines/gargoyle/detection.cpp +++ b/engines/gargoyle/detection.cpp @@ -58,16 +58,17 @@ InterpreterType GargoyleEngine::getInterpreterType() const { } // End of namespace Gargoyle -static const PlainGameDescriptor GargoyleGames[] = { - {"Gargoyle", "Gargoyle Games"}, +static const PlainGameDescriptor gargoyleGames[] = { + {"scott", "Scott Adams Games"}, {0, 0} }; #include "gargoyle/detection_tables.h" +#include "gargoyle/scott/scott.h" class GargoyleMetaEngine : public AdvancedMetaEngine { public: - GargoyleMetaEngine() : AdvancedMetaEngine(Gargoyle::gameDescriptions, sizeof(Gargoyle::GargoyleGameDescription), GargoyleGames) { + GargoyleMetaEngine() : AdvancedMetaEngine(Gargoyle::gameDescriptions, sizeof(Gargoyle::GargoyleGameDescription), gargoyleGames) { _maxScanDepth = 3; } @@ -105,7 +106,13 @@ bool Gargoyle::GargoyleEngine::hasFeature(EngineFeature f) const { bool GargoyleMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { const Gargoyle::GargoyleGameDescription *gd = (const Gargoyle::GargoyleGameDescription *)desc; - *engine = new Gargoyle::GargoyleEngine(syst, gd); + switch (gd->interpType) { + case Gargoyle::INTERPRETER_SCOTT: + *engine = new Gargoyle::Scott::Scott(syst, gd); + break; + default: + error("Unknown interpreter"); + } return gd != 0; } diff --git a/engines/gargoyle/gargoyle.cpp b/engines/gargoyle/gargoyle.cpp index b46f2fc377..3457f5fa63 100644 --- a/engines/gargoyle/gargoyle.cpp +++ b/engines/gargoyle/gargoyle.cpp @@ -28,16 +28,14 @@ #include "graphics/scaler.h" #include "graphics/thumbnail.h" #include "gargoyle/gargoyle.h" -#include "gargoyle/interps/scott/scott.h" namespace Gargoyle { GargoyleEngine::GargoyleEngine(OSystem *syst, const GargoyleGameDescription *gameDesc) : - _gameDescription(gameDesc), Engine(syst), _interpreter(nullptr) { + _gameDescription(gameDesc), Engine(syst) { } GargoyleEngine::~GargoyleEngine() { - delete _interpreter; } void GargoyleEngine::initialize() { @@ -48,19 +46,11 @@ void GargoyleEngine::initialize() { DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling"); initGraphics(640, 480, false); - - switch (getInterpreterType()) { - case INTERPRETER_SCOTT: - _interpreter = new Scott::Scott(); - break; - default: - error("Unknown interpreter type"); - } } Common::Error GargoyleEngine::run() { initialize(); - _interpreter->execute(); + main(); return Common::kNoError; } diff --git a/engines/gargoyle/gargoyle.h b/engines/gargoyle/gargoyle.h index 375d9ad0d7..09402487c2 100644 --- a/engines/gargoyle/gargoyle.h +++ b/engines/gargoyle/gargoyle.h @@ -28,7 +28,6 @@ #include "common/serializer.h" #include "engines/advancedDetector.h" #include "engines/engine.h" -#include "gargoyle/interpreter.h" namespace Gargoyle { @@ -57,20 +56,27 @@ struct GargoyleSavegameHeader { int _totalFrames; }; +/** + * Base class for the different interpreters + */ class GargoyleEngine : public Engine { private: /** * Handles basic initialization */ void initialize(); -private: +protected: const GargoyleGameDescription *_gameDescription; int _loadSaveSlot; - Interpreter *_interpreter; // Engine APIs virtual Common::Error run(); virtual bool hasFeature(EngineFeature f) const; + + /** + * Main game loop for the individual interpreters + */ + virtual void main() = 0; public: GargoyleEngine(OSystem *syst, const GargoyleGameDescription *gameDesc); virtual ~GargoyleEngine(); diff --git a/engines/gargoyle/glk/glk.cpp b/engines/gargoyle/glk.cpp index 26755a1d37..350b40f4ec 100644 --- a/engines/gargoyle/glk/glk.cpp +++ b/engines/gargoyle/glk.cpp @@ -20,11 +20,12 @@ * */ -#include "gargoyle/glk/glk.h" +#include "gargoyle/glk.h" namespace Gargoyle { -Glk::Glk() : Interpreter(), _gliFirstEvent(false) { +Glk::Glk(OSystem *syst, const GargoyleGameDescription *gameDesc) : + GargoyleEngine(syst, gameDesc), _gliFirstEvent(false) { } void Glk::glk_exit(void) { diff --git a/engines/gargoyle/glk/glk.h b/engines/gargoyle/glk.h index 11c8cba2cf..eab6f0be70 100644 --- a/engines/gargoyle/glk/glk.h +++ b/engines/gargoyle/glk.h @@ -23,16 +23,15 @@ #ifndef GARGOYLE_GLK_H #define GARGOYLE_GLK_H -#include "graphics/managed_surface.h" -#include "gargoyle/interpreter.h" -#include "gargoyle/glk/glk_types.h" +#include "gargoyle/gargoyle.h" +#include "gargoyle/glk_types.h" namespace Gargoyle { /** * Implements the GLK interface */ -class Glk : public Interpreter { +class Glk : public GargoyleEngine { private: bool _gliFirstEvent; private: @@ -46,7 +45,7 @@ public: /** * Constructor */ - Glk(); + Glk(OSystem *syst, const GargoyleGameDescription *gameDesc); void glk_exit(void); void glk_set_interrupt_handler(void(*func)(void)); diff --git a/engines/gargoyle/glk/glk_types.h b/engines/gargoyle/glk_types.h index a8227411df..a8227411df 100644 --- a/engines/gargoyle/glk/glk_types.h +++ b/engines/gargoyle/glk_types.h diff --git a/engines/gargoyle/interpreter.cpp b/engines/gargoyle/interpreter.cpp deleted file mode 100644 index 10cefd7cc6..0000000000 --- a/engines/gargoyle/interpreter.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "gargoyle/interpreter.h" - -namespace Gargoyle { - - -} // End of namespace Gargoyle diff --git a/engines/gargoyle/interpreter.h b/engines/gargoyle/interpreter.h deleted file mode 100644 index 748d4179fe..0000000000 --- a/engines/gargoyle/interpreter.h +++ /dev/null @@ -1,55 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef GARGOYLE_INTERPRETER_H -#define GARGOYLE_INTERPRETER_H - -#include "graphics/screen.h" - -namespace Gargoyle { - -/** - * Base class for specific interpreters - */ -class Interpreter { -protected: - Graphics::Screen _screen; -public: - /** - * Constructor - */ - Interpreter() {} - - /** - * Destructor - */ - virtual ~Interpreter() {} - - /** - * Main execution method - */ - virtual void execute() = 0; -}; - -} // End of namespace Gargoyle - -#endif diff --git a/engines/gargoyle/module.mk b/engines/gargoyle/module.mk index 6e11ba746f..c1a28676fb 100644 --- a/engines/gargoyle/module.mk +++ b/engines/gargoyle/module.mk @@ -4,9 +4,8 @@ MODULE_OBJS := \ detection.o \ events.o \ gargoyle.o \ - glk/glk.o \ - interpreter.o \ - interps/scott/scott.o + glk.o \ + scott/scott.o # This module can be built as a plugin ifeq ($(ENABLE_GARGOYLE), DYNAMIC_PLUGIN) diff --git a/engines/gargoyle/interps/scott/scott.cpp b/engines/gargoyle/scott/scott.cpp index b2ea5e29fb..9a1a6e324e 100644 --- a/engines/gargoyle/interps/scott/scott.cpp +++ b/engines/gargoyle/scott/scott.cpp @@ -20,12 +20,12 @@ * */ -#include "gargoyle/interps/scott/scott.h" +#include "gargoyle/scott/scott.h" namespace Gargoyle { namespace Scott { -void Scott::execute() { +void Scott::main() { event_t ev; do { glk_select(&ev); diff --git a/engines/gargoyle/interps/scott/scott.h b/engines/gargoyle/scott/scott.h index 7d87ca5809..0e7d85cc72 100644 --- a/engines/gargoyle/interps/scott/scott.h +++ b/engines/gargoyle/scott/scott.h @@ -28,7 +28,7 @@ */ #include "common/scummsys.h" -#include "gargoyle/glk/glk.h" +#include "gargoyle/glk.h" namespace Gargoyle { namespace Scott { @@ -92,12 +92,12 @@ public: /** * Constructor */ - Scott() : Glk() {} + Scott(OSystem *syst, const GargoyleGameDescription *gameDesc) : Glk(syst, gameDesc) {} /** * Execute the game */ - virtual void execute(); + virtual void main(); }; } // End of namespace Scott |