From e0ea40c3e3d88d7d985e75ae7cab7b86ad56e070 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 12 Feb 2018 22:10:24 -0500 Subject: XEEN: Added skeleton child engine for Swords of Xeen --- engines/xeen/detection.cpp | 7 +++- engines/xeen/detection_tables.h | 18 +++++++++ engines/xeen/files.cpp | 16 +++++--- engines/xeen/module.mk | 1 + engines/xeen/saves.cpp | 4 +- engines/xeen/swordsofxeen/swordsofxeen.cpp | 47 ++++++++++++++++++++++ engines/xeen/swordsofxeen/swordsofxeen.h | 63 ++++++++++++++++++++++++++++++ engines/xeen/xeen.cpp | 3 +- 8 files changed, 150 insertions(+), 9 deletions(-) create mode 100644 engines/xeen/swordsofxeen/swordsofxeen.cpp create mode 100644 engines/xeen/swordsofxeen/swordsofxeen.h (limited to 'engines/xeen') diff --git a/engines/xeen/detection.cpp b/engines/xeen/detection.cpp index f59f7c8b2c..0916c3965b 100644 --- a/engines/xeen/detection.cpp +++ b/engines/xeen/detection.cpp @@ -22,6 +22,7 @@ #include "xeen/xeen.h" #include "xeen/worldofxeen/worldofxeen.h" +#include "xeen/swordsofxeen/swordsofxeen.h" #include "base/plugins.h" #include "common/savefile.h" @@ -66,6 +67,7 @@ static const PlainGameDescriptor XeenGames[] = { { "clouds", "Clouds of Xeen" }, { "darkside", "Dark Side of Xeen" }, { "worldofxeen", "World of Xeen" }, + { "swordsofxeen", "Swords of Xeen" }, {0, 0} }; @@ -82,7 +84,7 @@ public: } virtual const char *getOriginalCopyright() const { - return "Xeen Engine (c) ???"; + return "Xeen Engine (c) 1992-1993 New World Computing, Inc."; } virtual bool hasFeature(MetaEngineFeature f) const; @@ -121,6 +123,9 @@ bool XeenMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGame case Xeen::GType_WorldOfXeen: *engine = new Xeen::WorldOfXeen::WorldOfXeenEngine(syst, gd); break; + case Xeen::GType_Swords: + *engine = new Xeen::SwordsOfXeen::SwordsOfXeenEngine(syst, gd); + break; default: error("Invalid game"); } diff --git a/engines/xeen/detection_tables.h b/engines/xeen/detection_tables.h index b9d8d6ebf1..31a79f3d90 100644 --- a/engines/xeen/detection_tables.h +++ b/engines/xeen/detection_tables.h @@ -80,6 +80,24 @@ static const XeenGameDescription gameDescriptions[] = { 0 }, + { + // Swords of Xeen (GOG) + { + "swordsofxeen", + nullptr, + { + {"swrd.cc", 0, "0d51c3457070cc7d1a596da9241924a5", 13026924 }, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformDOS, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + GType_Swords, + 0 + }, + { AD_TABLE_END_MARKER, 0, 0 } }; diff --git a/engines/xeen/files.cpp b/engines/xeen/files.cpp index 86fb3fc3e3..6380199f51 100644 --- a/engines/xeen/files.cpp +++ b/engines/xeen/files.cpp @@ -221,16 +221,22 @@ FileManager::FileManager(XeenEngine *vm) { Common::File f; _isDarkCc = vm->getGameID() == GType_DarkSide; - File::_xeenCc = (vm->getGameID() == GType_DarkSide) ? nullptr : - new CCArchive("xeen.cc", "xeen", true); - File::_darkCc = (vm->getGameID() == GType_Clouds) ? nullptr : - new CCArchive("dark.cc", "dark", true); + if (vm->getGameID() == GType_Swords) { + File::_xeenCc = nullptr; + File::_darkCc = new CCArchive("swrd.cc", "xeen", true); + } else { + File::_xeenCc = (vm->getGameID() == GType_DarkSide) ? nullptr : + new CCArchive("xeen.cc", "xeen", true); + File::_darkCc = (vm->getGameID() == GType_Clouds) ? nullptr : + new CCArchive("dark.cc", "dark", true); + } + if (Common::File::exists("intro.cc")) { CCArchive *introCc = new CCArchive("intro.cc", "intro", true); SearchMan.add("intro", introCc); } - File::_currentArchive = vm->getGameID() == GType_DarkSide ? + File::_currentArchive = vm->getGameID() == GType_DarkSide || vm->getGameID() == GType_Swords ? File::_darkCc : File::_xeenCc; assert(File::_currentArchive); } diff --git a/engines/xeen/module.mk b/engines/xeen/module.mk index c613b25965..c6b8f45b09 100644 --- a/engines/xeen/module.mk +++ b/engines/xeen/module.mk @@ -7,6 +7,7 @@ MODULE_OBJS := \ worldofxeen/worldofxeen_menu.o \ worldofxeen/worldofxeen.o \ worldofxeen/worldofxeen_resources.o \ + swordsofxeen/swordsofxeen.o \ character.o \ combat.o \ cutscenes.o \ diff --git a/engines/xeen/saves.cpp b/engines/xeen/saves.cpp index 40be1fe379..dbd3d8bc80 100644 --- a/engines/xeen/saves.cpp +++ b/engines/xeen/saves.cpp @@ -43,12 +43,12 @@ SavesManager::SavesManager(const Common::String &targetName): _targetName(target File::_darkSave = new SaveArchive(g_vm->_party); File::_darkSave->reset(File::_darkCc); } - if (g_vm->getGameID() != GType_DarkSide) { + if (g_vm->getGameID() != GType_DarkSide && g_vm->getGameID() != GType_Swords) { File::_xeenSave = new SaveArchive(g_vm->_party); File::_xeenSave->reset(File::_xeenCc); } - File::_currentSave = g_vm->getGameID() == GType_DarkSide ? + File::_currentSave = g_vm->getGameID() == GType_DarkSide || g_vm->getGameID() == GType_Swords ? File::_darkSave : File::_xeenSave; assert(File::_currentSave); diff --git a/engines/xeen/swordsofxeen/swordsofxeen.cpp b/engines/xeen/swordsofxeen/swordsofxeen.cpp new file mode 100644 index 0000000000..05998ce56a --- /dev/null +++ b/engines/xeen/swordsofxeen/swordsofxeen.cpp @@ -0,0 +1,47 @@ +/* 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 "xeen/swordsofxeen/swordsofxeen.h" + +namespace Xeen { +namespace SwordsOfXeen { + +SwordsOfXeenEngine::SwordsOfXeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) + : XeenEngine(syst, gameDesc) { +} + +void SwordsOfXeenEngine::outerGameLoop() { + // TODO: Implement Swords of Xeen main menu + + playGame(); +} + +void SwordsOfXeenEngine::death() { + error("TODO: Swords of Xeen death screen"); +} + +void SwordsOfXeenEngine::showCutscene(const Common::String &name, int status, uint score) { + _quitMode = QMODE_MENU; +} + +} // End of namespace SwordsOfXeen +} // End of namespace Xeen diff --git a/engines/xeen/swordsofxeen/swordsofxeen.h b/engines/xeen/swordsofxeen/swordsofxeen.h new file mode 100644 index 0000000000..784fba0849 --- /dev/null +++ b/engines/xeen/swordsofxeen/swordsofxeen.h @@ -0,0 +1,63 @@ +/* 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 XEEN_SWORDSOFXEEN_SWORDSOFXEEN_H +#define XEEN_SWORDSOFXEEN_SWORDSOFXEEN_H + +#include "xeen/xeen.h" +#include "xeen/worldofxeen/worldofxeen_cutscenes.h" + +namespace Xeen { +namespace SwordsOfXeen { + +/** + * Implements a descendant of the base Xeen engine to handle + * Swords of Xeen specific game code + */ +class SwordsOfXeenEngine: public XeenEngine { +protected: + /** + * Outer gameplay loop responsible for dispatching control to game-specific + * intros, main menus, or to play the actual game + */ + virtual void outerGameLoop(); + + /** + * Death cutscene + */ + virtual void death(); +public: + SwordsOfXeenEngine(OSystem *syst, const XeenGameDescription *gameDesc); + virtual ~SwordsOfXeenEngine() {} + + /** + * Show a cutscene + */ + virtual void showCutscene(const Common::String &name, int status, uint score); +}; + +#define SWORDS_VM (*(::Xeen::SwordsOfXeen::SwordsOfXeenEngine *)g_vm) + +} // End of namespace SwordsOfXeen +} // End of namespace Xeen + +#endif /* XEEN_SWORDSOFXEEN_SWORDSOFXEEN_H */ diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 9c33ab8cb1..3dfb0bc8e3 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -165,7 +165,8 @@ void XeenEngine::play() { _screen->loadBackground("back.raw"); _screen->loadPalette("mm4.pal"); - if (getGameID() != GType_WorldOfXeen && !_map->_loadDarkSide) { + if (getGameID() != GType_WorldOfXeen && getGameID() != GType_Swords + && !_map->_loadDarkSide) { _map->_loadDarkSide = true; _party->_mazeId = 29; _party->_mazeDirection = DIR_NORTH; -- cgit v1.2.3