aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-04-19 18:48:48 +0200
committerEinar Johan Trøan Sømåen2012-06-02 12:12:17 +0200
commitec5f5c739e60ddde701b89fd7484faf867bb347f (patch)
treecb9c71f91e6f9c6f9894e4e8a3f78cbb278f05ed
parentd9983a6224dcc82d56a7b3d6d2aaad79def96766 (diff)
downloadscummvm-rg350-ec5f5c739e60ddde701b89fd7484faf867bb347f.tar.gz
scummvm-rg350-ec5f5c739e60ddde701b89fd7484faf867bb347f.tar.bz2
scummvm-rg350-ec5f5c739e60ddde701b89fd7484faf867bb347f.zip
WINTERMUTE: Add in the engine-shell from the ScummVM-wiki
-rw-r--r--engines/configure.engines1
-rw-r--r--engines/engines.mk5
-rw-r--r--engines/plugins_table.h3
-rw-r--r--engines/wintermute/detection.cpp117
-rw-r--r--engines/wintermute/module.mk16
-rw-r--r--engines/wintermute/wintermute.cpp108
-rw-r--r--engines/wintermute/wintermute.h65
7 files changed, 315 insertions, 0 deletions
diff --git a/engines/configure.engines b/engines/configure.engines
index 8eaee730cc..3809aca656 100644
--- a/engines/configure.engines
+++ b/engines/configure.engines
@@ -45,3 +45,4 @@ add_engine toon "Toonstruck" yes
add_engine touche "Touche: The Adventures of the Fifth Musketeer" yes
add_engine tsage "TsAGE" yes
add_engine tucker "Bud Tucker in Double Trouble" yes
+add_engine wintermute "Wintermute" yes
diff --git a/engines/engines.mk b/engines/engines.mk
index 9939506b86..d5d912f8b7 100644
--- a/engines/engines.mk
+++ b/engines/engines.mk
@@ -216,3 +216,8 @@ ifdef ENABLE_TUCKER
DEFINES += -DENABLE_TUCKER=$(ENABLE_TUCKER)
MODULES += engines/tucker
endif
+
+ifdef ENABLE_WINTERMUTE
+DEFINES += -DENABLE_WINTERMUTE=$(ENABLE_WINTERMUTE)
+MODULES += engines/wintermute
+endif
diff --git a/engines/plugins_table.h b/engines/plugins_table.h
index fac956755e..fb35969b0b 100644
--- a/engines/plugins_table.h
+++ b/engines/plugins_table.h
@@ -101,3 +101,6 @@ LINK_PLUGIN(TOUCHE)
#if PLUGIN_ENABLED_STATIC(TUCKER)
LINK_PLUGIN(TUCKER)
#endif
+#if PLUGIN_ENABLED_STATIC(WINTERMUTE)
+LINK_PLUGIN(WINTERMUTE)
+#endif
diff --git a/engines/wintermute/detection.cpp b/engines/wintermute/detection.cpp
new file mode 100644
index 0000000000..b3a756f6c3
--- /dev/null
+++ b/engines/wintermute/detection.cpp
@@ -0,0 +1,117 @@
+/* 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/wintermute/wintermute.h"
+
+#include "common/config-manager.h"
+#include "common/error.h"
+#include "common/fs.h"
+
+#include "engines/metaengine.h"
+
+static const PlainGameDescriptor WinterMute_setting[] = {
+ { "WinterMute", "WinterMute - Unspecified game" },
+ { 0, 0 }
+};
+
+class WinterMuteMetaEngine : public MetaEngine {
+public:
+ virtual const char *getName() const {
+ return "WinterMute Lite";
+ }
+
+ virtual const char *getOriginalCopyright() const {
+ return "Copyright (c) 2011 Jan Nedoma";
+ }
+
+ virtual GameList getSupportedGames() const {
+ GameList games;
+ const PlainGameDescriptor *g = WinterMute_setting;
+ while (g->gameid) {
+ games.push_back(*g);
+ g++;
+ }
+
+ return games;
+ }
+
+ virtual GameDescriptor findGame(const char *gameid) const {
+ const PlainGameDescriptor *g = WinterMute_setting;
+ while (g->gameid) {
+ if (0 == scumm_stricmp(gameid, g->gameid))
+ break;
+ g++;
+ }
+ return GameDescriptor(g->gameid, g->description);
+ }
+
+ virtual GameList detectGames(const Common::FSList &fslist) const {
+ GameList detectedGames;
+
+ // Iterate over all files in the given directory
+ for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
+ if (!file->isDirectory()) {
+ const char *gameName = file->getName().c_str();
+
+ if (0 == scumm_stricmp("README", gameName)) {
+ // You could check the contents of the file now if you need to.
+ detectedGames.push_back(WinterMute_setting[0]);
+ break;
+ }
+ }
+ }
+ return detectedGames;
+ }
+
+ virtual Common::Error createInstance(OSystem *syst, Engine **engine) const {
+ assert(syst);
+ assert(engine);
+
+ // Scan the target directory for files (error out if it does not exist)
+ Common::FSList fslist;
+ Common::FSNode dir(ConfMan.get("path"));
+ if (!dir.getChildren(fslist, Common::FSNode::kListAll)) {
+ return Common::kNoGameDataFoundError;
+ }
+
+ // Invoke the detector
+ Common::String gameid = ConfMan.get("gameid");
+ GameList detectedGames = detectGames(fslist);
+
+ for (uint i = 0; i < detectedGames.size(); i++) {
+ if (detectedGames[i].gameid() == gameid) {
+ // At this point you may want to perform additional sanity checks.
+ *engine = new WinterMute::WinterMuteEngine(syst);
+ return Common::kNoError;
+ }
+ }
+
+ // Failed to find any game data
+ return Common::kNoGameDataFoundError;
+ }
+};
+
+#if PLUGIN_ENABLED_DYNAMIC(WINTERMUTE)
+REGISTER_PLUGIN_DYNAMIC(WINTERMUTE, PLUGIN_TYPE_ENGINE, WinterMuteMetaEngine);
+#else
+REGISTER_PLUGIN_STATIC(WINTERMUTE, PLUGIN_TYPE_ENGINE, WinterMuteMetaEngine);
+#endif \ No newline at end of file
diff --git a/engines/wintermute/module.mk b/engines/wintermute/module.mk
new file mode 100644
index 0000000000..4096e8d8e6
--- /dev/null
+++ b/engines/wintermute/module.mk
@@ -0,0 +1,16 @@
+MODULE := engines/wintermute
+
+MODULE_OBJS := \
+ detection.o \
+ wintermute.o
+
+MODULE_DIRS += \
+ engines/wintermute
+
+# This module can be built as a plugin
+ifeq ($(ENABLE_WINTERMUTE), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+
+# Include common rules
+include $(srcdir)/rules.mk \ No newline at end of file
diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp
new file mode 100644
index 0000000000..393e6c4888
--- /dev/null
+++ b/engines/wintermute/wintermute.cpp
@@ -0,0 +1,108 @@
+/* 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/scummsys.h"
+
+#include "common/config-manager.h"
+#include "common/debug.h"
+#include "common/debug-channels.h"
+#include "common/error.h"
+#include "common/EventRecorder.h"
+#include "common/file.h"
+#include "common/fs.h"
+
+#include "engines/util.h"
+
+#include "WinterMute/WinterMute.h"
+
+namespace WinterMute {
+
+ WinterMuteEngine::WinterMuteEngine(OSystem *syst)
+ : Engine(syst) {
+ // Put your engine in a sane state, but do nothing big yet;
+ // in particular, do not load data from files; rather, if you
+ // need to do such things, do them from init().
+
+ // Do not initialize graphics here
+
+ // However this is the place to specify all default directories
+ const Common::FSNode gameDataDir(ConfMan.get("path"));
+ SearchMan.addSubDirectoryMatching(gameDataDir, "sound");
+
+ // Here is the right place to set up the engine specific debug channels
+ DebugMan.addDebugChannel(kWinterMuteDebugExample, "example", "this is just an example for a engine specific debug channel");
+ DebugMan.addDebugChannel(kWinterMuteDebugExample2, "example2", "also an example");
+
+ // Don't forget to register your random source
+ _rnd = new Common::RandomSource("WinterMute");
+
+ debug("WinterMuteEngine::WinterMuteEngine");
+ }
+
+ WinterMuteEngine::~WinterMuteEngine() {
+ debug("WinterMuteEngine::~WinterMuteEngine");
+
+ // Dispose your resources here
+ delete _rnd;
+
+ // Remove all of our debug levels here
+ DebugMan.clearAllDebugChannels();
+ }
+
+ Common::Error WinterMuteEngine::run() {
+ // Initialize graphics using following:
+ initGraphics(320, 200, false);
+
+ // You could use backend transactions directly as an alternative,
+ // but it isn't recommended, until you want to handle the error values
+ // from OSystem::endGFXTransaction yourself.
+ // This is just an example template:
+ //_system->beginGFXTransaction();
+ // // This setup the graphics mode according to users seetings
+ // initCommonGFX(false);
+ //
+ // // Specify dimensions of game graphics window.
+ // // In this example: 320x200
+ // _system->initSize(320, 200);
+ //FIXME: You really want to handle
+ //OSystem::kTransactionSizeChangeFailed here
+ //_system->endGFXTransaction();
+
+ // Create debugger console. It requires GFX to be initialized
+ _console = new Console(this);
+
+ // Additional setup.
+ debug("WinterMuteEngine::init");
+
+ // Your main even loop should be (invoked from) here.
+ debug("WinterMuteEngine::go: Hello, World!");
+
+ // This test will show up if -d1 and --debugflags=example are specified on the commandline
+ debugC(1, kWinterMuteDebugExample, "Example debug call");
+
+ // This test will show up if --debugflags=example or --debugflags=example2 or both of them and -d3 are specified on the commandline
+ debugC(3, kWinterMuteDebugExample | kWinterMuteDebugExample2, "Example debug call two");
+
+ return Common::kNoError;
+ }
+
+} // End of namespace WinterMute \ No newline at end of file
diff --git a/engines/wintermute/wintermute.h b/engines/wintermute/wintermute.h
new file mode 100644
index 0000000000..33ed2892ff
--- /dev/null
+++ b/engines/wintermute/wintermute.h
@@ -0,0 +1,65 @@
+/* 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 WINTERMUTE_H
+#define WINTERMUTE_H
+
+#include "common/random.h"
+#include "engines/engine.h"
+#include "gui/debugger.h"
+
+namespace WinterMute {
+
+ class Console;
+
+ // our engine debug channels
+ enum {
+ kWinterMuteDebugExample = 1 << 0,
+ kWinterMuteDebugExample2 = 1 << 1
+ // next new channel must be 1 << 2 (4)
+ // the current limitation is 32 debug channels (1 << 31 is the last one)
+ };
+
+ class WinterMuteEngine : public Engine {
+ public:
+ WinterMuteEngine(OSystem *syst);
+ ~WinterMuteEngine();
+
+ virtual Common::Error run();
+
+ private:
+ Console *_console;
+
+ // We need random numbers
+ Common::RandomSource *_rnd;
+ };
+
+ // Example console class
+ class Console : public GUI::Debugger {
+ public:
+ Console(WinterMuteEngine *vm) {}
+ virtual ~Console(void) {}
+ };
+
+} // End of namespace Wintermute
+
+#endif \ No newline at end of file