aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2012-03-30 18:03:59 +0200
committerEugene Sandulenko2018-03-28 17:36:57 +0200
commit5757ffaff0f94e5dd18c3f1880cffaaa96c349f9 (patch)
tree6d5e28e23feb2e71e214f071b324fddc345bed8b
parentb0affe5bf2c7240afb8f16c9b9476a049941439f (diff)
downloadscummvm-rg350-5757ffaff0f94e5dd18c3f1880cffaaa96c349f9.tar.gz
scummvm-rg350-5757ffaff0f94e5dd18c3f1880cffaaa96c349f9.tar.bz2
scummvm-rg350-5757ffaff0f94e5dd18c3f1880cffaaa96c349f9.zip
LILLIPUT: Add skeletton
-rw-r--r--engines/lilliput/configure.engine3
-rw-r--r--engines/lilliput/console.cpp34
-rw-r--r--engines/lilliput/console.h49
-rw-r--r--engines/lilliput/detection.cpp237
-rw-r--r--engines/lilliput/lilliput.cpp113
-rw-r--r--engines/lilliput/lilliput.h111
-rw-r--r--engines/lilliput/module.mk17
7 files changed, 564 insertions, 0 deletions
diff --git a/engines/lilliput/configure.engine b/engines/lilliput/configure.engine
new file mode 100644
index 0000000000..f8cb842633
--- /dev/null
+++ b/engines/lilliput/configure.engine
@@ -0,0 +1,3 @@
+# This file is included from the main "configure" script
+# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
+add_engine lilliput "Lilliput engine" no
diff --git a/engines/lilliput/console.cpp b/engines/lilliput/console.cpp
new file mode 100644
index 0000000000..e7746a01bb
--- /dev/null
+++ b/engines/lilliput/console.cpp
@@ -0,0 +1,34 @@
+/* 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 "lilliput/console.h"
+#include "lilliput/lilliput.h"
+
+namespace Lilliput {
+
+LilliputConsole::LilliputConsole(LilliputEngine *vm) : GUI::Debugger(), _vm(vm) {
+}
+
+LilliputConsole::~LilliputConsole() {
+}
+
+} // End of namespace Lilliput
diff --git a/engines/lilliput/console.h b/engines/lilliput/console.h
new file mode 100644
index 0000000000..cd7edb3f42
--- /dev/null
+++ b/engines/lilliput/console.h
@@ -0,0 +1,49 @@
+/* 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 LILLIPUT_CONSOLE_H
+#define LILLIPUT_CONSOLE_H
+
+#include "gui/debugger.h"
+
+namespace Lilliput {
+
+class LilliputEngine;
+
+class LilliputConsole : public GUI::Debugger {
+public:
+ LilliputConsole(LilliputEngine *vm);
+ virtual ~LilliputConsole(void);
+
+private:
+ LilliputEngine *_vm;
+ bool Cmd_listScreens(int argc, const char **argv);
+ bool Cmd_listObjects(int argc, const char **argv);
+ bool Cmd_getObject(int argc, const char **argv);
+ bool Cmd_getAllObjects(int argc, const char **argv);
+ bool Cmd_gotoScreen(int argc, const char **argv);
+ bool Cmd_boundaries(int argc, const char **argv);
+};
+
+} // End of namespace Lilliput
+
+#endif
diff --git a/engines/lilliput/detection.cpp b/engines/lilliput/detection.cpp
new file mode 100644
index 0000000000..1925c71f88
--- /dev/null
+++ b/engines/lilliput/detection.cpp
@@ -0,0 +1,237 @@
+/* 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 "engines/advancedDetector.h"
+#include "common/system.h"
+#include "common/savefile.h"
+#include "common/textconsole.h"
+#include "graphics/thumbnail.h"
+#include "graphics/surface.h"
+
+#include "lilliput/lilliput.h"
+
+namespace Lilliput {
+
+struct LilliputGameDescription {
+ ADGameDescription desc;
+ GameType gameType;
+};
+
+uint32 LilliputEngine::getFeatures() const {
+ return _gameDescription->desc.flags;
+}
+
+const char *LilliputEngine::getGameId() const {
+ return _gameDescription->desc.gameId;
+}
+
+
+static const PlainGameDescriptor lilliputGames[] = {
+ // Games
+ {"robin", "Adventures of Robin Hood"},
+ {"rome", "Rome: Pathway to Power"},
+ {0, 0}
+};
+
+static const LilliputGameDescription gameDescriptions[] = {
+
+ // Robin Hood English
+ {
+ {
+ "robin", 0,
+ {
+ {"erules.prg", 0, "92aaf84693a8948497ad57864fa31c2a", 71010},
+ {"isomap.dta", 0, "bad97eae03a4db3e99565e39b0b3c06a", 16384},
+ AD_LISTEND
+ },
+ Common::EN_ANY,
+ Common::kPlatformDOS,
+ ADGF_NO_FLAGS,
+ GUIO0()
+ },
+ kGameTypeRobin
+ },
+
+ {AD_TABLE_END_MARKER, kGameTypeNone}
+};
+
+class LilliputMetaEngine : public AdvancedMetaEngine {
+public:
+ LilliputMetaEngine() : AdvancedMetaEngine(gameDescriptions, sizeof(LilliputGameDescription), lilliputGames) {
+ }
+
+ const char *getName() const {
+ return "Robin Hood";
+ }
+
+ const char *getOriginalCopyright() const {
+ return "Robin Hood Engine copyright S.L.Grand, Brainware, 1991-1992";
+ }
+
+ bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const;
+ bool hasFeature(MetaEngineFeature f) const;
+
+ int getMaximumSaveSlot() const;
+ SaveStateList listSaves(const char *target) const;
+ SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
+ void removeSaveState(const char *target, int slot) const;
+};
+
+bool LilliputMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const {
+ if (gd) {
+ *engine = new LilliputEngine(syst, (const LilliputGameDescription *)gd);
+ ((LilliputEngine *)*engine)->initGame((const LilliputGameDescription *)gd);
+ }
+ return gd != 0;
+}
+
+bool LilliputMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return
+ (f == kSupportsListSaves) ||
+ (f == kSupportsLoadingDuringStartup) ||
+ (f == kSupportsDeleteSave) ||
+ (f == kSavesSupportMetaInfo) ||
+ (f == kSavesSupportThumbnail) ||
+ (f == kSavesSupportCreationDate);
+}
+
+int LilliputMetaEngine::getMaximumSaveSlot() const { return 99; }
+
+SaveStateList LilliputMetaEngine::listSaves(const char *target) const {
+ Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
+ Common::StringArray filenames;
+ Common::String pattern = target;
+ pattern += "-??.SAV";
+
+ filenames = saveFileMan->listSavefiles(pattern);
+ sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
+
+ SaveStateList saveList;
+ char slot[3];
+ int slotNum = 0;
+ for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename) {
+ slot[0] = filename->c_str()[filename->size() - 6];
+ slot[1] = filename->c_str()[filename->size() - 5];
+ slot[2] = '\0';
+ // Obtain the last 2 digits of the filename (without extension), since they correspond to the save slot
+ slotNum = atoi(slot);
+ if (slotNum >= 0 && slotNum <= getMaximumSaveSlot()) {
+ Common::InSaveFile *file = saveFileMan->openForLoading(*filename);
+ if (file) {
+ int saveVersion = file->readByte();
+
+ if (saveVersion != kSavegameVersion) {
+ warning("Savegame of incompatible version");
+ delete file;
+ continue;
+ }
+
+ // read name
+ uint16 nameSize = file->readUint16BE();
+ if (nameSize >= 255) {
+ delete file;
+ continue;
+ }
+ char name[256];
+ file->read(name, nameSize);
+ name[nameSize] = 0;
+
+ saveList.push_back(SaveStateDescriptor(slotNum, name));
+ delete file;
+ }
+ }
+ }
+
+ return saveList;
+}
+
+SaveStateDescriptor LilliputMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
+ Common::String fileName = Common::String::format("%s-%02d.SAV", target, slot);
+ Common::InSaveFile *file = g_system->getSavefileManager()->openForLoading(fileName);
+
+ if (file) {
+ int saveVersion = file->readByte();
+
+ if (saveVersion != kSavegameVersion) {
+ warning("Savegame of incompatible version");
+ delete file;
+ return SaveStateDescriptor();
+ }
+
+ uint32 saveNameLength = file->readUint16BE();
+ char saveName[256];
+ file->read(saveName, saveNameLength);
+ saveName[saveNameLength] = 0;
+
+ SaveStateDescriptor desc(slot, saveName);
+
+ Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*file);
+ desc.setThumbnail(thumbnail);
+
+ desc.setDeletableFlag(true);
+ desc.setWriteProtectedFlag(false);
+
+ uint32 saveDate = file->readUint32BE();
+ uint16 saveTime = file->readUint16BE();
+
+ int day = (saveDate >> 24) & 0xFF;
+ int month = (saveDate >> 16) & 0xFF;
+ int year = saveDate & 0xFFFF;
+
+ desc.setSaveDate(year, month, day);
+
+ int hour = (saveTime >> 8) & 0xFF;
+ int minutes = saveTime & 0xFF;
+
+ desc.setSaveTime(hour, minutes);
+
+ // Slot 0 is used for the 'restart game' save in all Robin games, thus
+ // we prevent it from being deleted.
+ desc.setDeletableFlag(slot != 0);
+ desc.setWriteProtectedFlag(slot == 0);
+
+ delete file;
+ return desc;
+ }
+ return SaveStateDescriptor();
+}
+
+void LilliputMetaEngine::removeSaveState(const char *target, int slot) const {
+ Common::String fileName = Common::String::format("%s-%02d.SAV", target, slot);
+ g_system->getSavefileManager()->removeSavefile(fileName);
+}
+} // End of namespace Lilliput
+
+#if PLUGIN_ENABLED_DYNAMIC(LILLIPUT)
+REGISTER_PLUGIN_DYNAMIC(LILLIPUT, PLUGIN_TYPE_ENGINE, Lilliput::LilliputMetaEngine);
+#else
+REGISTER_PLUGIN_STATIC(LILLIPUT, PLUGIN_TYPE_ENGINE, Lilliput::LilliputMetaEngine);
+#endif
+
+namespace Lilliput {
+
+void LilliputEngine::initGame(const LilliputGameDescription *gd) {
+ _gameType = gd->gameType;
+ _platform = gd->desc.platform;
+}
+
+} // End of namespace Lilliput
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp
new file mode 100644
index 0000000000..befec749b7
--- /dev/null
+++ b/engines/lilliput/lilliput.cpp
@@ -0,0 +1,113 @@
+/* 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 "common/system.h"
+#include "common/random.h"
+#include "common/error.h"
+#include "common/events.h"
+#include "common/debug-channels.h"
+#include "common/config-manager.h"
+#include "common/textconsole.h"
+
+#include "lilliput/lilliput.h"
+
+#include "engines/util.h"
+
+namespace Lilliput {
+
+LilliputEngine *LilliputEngine::s_Engine = 0;
+
+LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd) : Engine(syst), _gameDescription(gd)
+{
+ _system = syst;
+ DebugMan.addDebugChannel(kDebugSchedule, "Schedule", "Script Schedule debug level");
+ DebugMan.addDebugChannel(kDebugEngine, "Engine", "Engine debug level");
+ DebugMan.addDebugChannel(kDebugDisplay, "Display", "Display debug level");
+ DebugMan.addDebugChannel(kDebugMouse, "Mouse", "Mouse debug level");
+ DebugMan.addDebugChannel(kDebugParser, "Parser", "Parser debug level");
+ DebugMan.addDebugChannel(kDebugFile, "File", "File IO debug level");
+ DebugMan.addDebugChannel(kDebugRoute, "Route", "Route debug level");
+ DebugMan.addDebugChannel(kDebugInventory, "Inventory", "Inventory debug level");
+ DebugMan.addDebugChannel(kDebugObject, "Object", "Object debug level");
+ DebugMan.addDebugChannel(kDebugMusic, "Music", "Music debug level");
+
+ _console = new LilliputConsole(this);
+ _rnd = 0;
+}
+
+LilliputEngine::~LilliputEngine() {
+
+ DebugMan.clearAllDebugChannels();
+ delete _console;
+ delete _rnd;
+}
+
+GUI::Debugger *LilliputEngine::getDebugger() {
+ return _console;
+}
+
+bool LilliputEngine::hasFeature(EngineFeature f) const {
+ return (f == kSupportsRTL) || (f == kSupportsLoadingDuringRuntime) || (f == kSupportsSavingDuringRuntime);
+}
+
+const char *LilliputEngine::getCopyrightString() const {
+ return "Copyright 1989-1997 David P Gray, All Rights Reserved.";
+}
+
+GameType LilliputEngine::getGameType() const {
+ return _gameType;
+}
+
+Common::Platform LilliputEngine::getPlatform() const {
+ return _platform;
+}
+
+Common::Error LilliputEngine::run() {
+ s_Engine = this;
+ initGraphics(320, 200);
+
+ // Setup mixer
+ syncSoundSettings();
+
+ return Common::kNoError;
+}
+
+void LilliputEngine::initialize() {
+ debugC(1, kDebugEngine, "initialize");
+
+ _rnd = new Common::RandomSource("robin");
+ _rnd->setSeed(42); // Kick random number generator
+}
+
+void LilliputEngine::syncSoundSettings() {
+ Engine::syncSoundSettings();
+
+// _sound->syncVolume();
+}
+
+Common::String LilliputEngine::getSavegameFilename(int slot) {
+ return _targetName + Common::String::format("-%02d.SAV", slot);
+}
+
+
+
+} // End of namespace Lilliput
diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h
new file mode 100644
index 0000000000..190bbfc9b6
--- /dev/null
+++ b/engines/lilliput/lilliput.h
@@ -0,0 +1,111 @@
+/* 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 LILLIPUT_LILLIPUT_H
+#define LILLIPUT_LILLIPUT_H
+
+#include "engines/engine.h"
+#include "common/file.h"
+#include "lilliput/console.h"
+
+namespace Common {
+class RandomSource;
+}
+
+/**
+ * This is the namespace of the Robin engine.
+ *
+ * Status of this engine: ???
+ *
+ * Games using this engine:
+ * - Adventures of Robin Hood
+ * - Rome: Pathway to Rome
+ */
+namespace Lilliput {
+
+static const int kSavegameVersion = 1;
+
+enum GameType {
+ kGameTypeNone = 0,
+ kGameTypeRobin,
+ kGameTypeRome
+};
+
+enum LilliputDebugChannels {
+ kDebugSchedule = 1 << 0,
+ kDebugEngine = 1 << 1,
+ kDebugDisplay = 1 << 2,
+ kDebugMouse = 1 << 3,
+ kDebugParser = 1 << 4,
+ kDebugFile = 1 << 5,
+ kDebugRoute = 1 << 6,
+ kDebugInventory = 1 << 7,
+ kDebugObject = 1 << 8,
+ kDebugMusic = 1 << 9
+};
+
+struct LilliputGameDescription;
+
+class LilliputEngine : public Engine {
+public:
+ LilliputEngine(OSystem *syst, const LilliputGameDescription *gd);
+ ~LilliputEngine();
+
+ OSystem *_system;
+
+ GUI::Debugger *getDebugger();
+
+ Common::RandomSource *_rnd;
+
+ const LilliputGameDescription *_gameDescription;
+ uint32 getFeatures() const;
+ const char *getGameId() const;
+
+ void initGame(const LilliputGameDescription *gd);
+
+ GameType getGameType() const;
+ Common::Platform getPlatform() const;
+
+ bool hasFeature(EngineFeature f) const;
+ const char *getCopyrightString() const;
+
+ Common::String getSavegameFilename(int slot);
+ void syncSoundSettings();
+
+protected:
+
+ // Engine APIs
+ Common::Error run();
+
+private:
+ static LilliputEngine *s_Engine;
+
+ LilliputConsole *_console;
+ GameType _gameType;
+ Common::Platform _platform;
+
+ void initialize();
+};
+
+} // End of namespace Lilliput
+
+#endif
diff --git a/engines/lilliput/module.mk b/engines/lilliput/module.mk
new file mode 100644
index 0000000000..0ec4403921
--- /dev/null
+++ b/engines/lilliput/module.mk
@@ -0,0 +1,17 @@
+MODULE := engines/lilliput
+
+MODULE_OBJS = \
+ console.o \
+ lilliput.o \
+ detection.o
+
+MODULE_DIRS += \
+ engines/lilliput
+
+# This module can be built as a plugin
+ifeq ($(ENABLE_LILLIPUT), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+
+# Include common rules
+include $(srcdir)/rules.mk