From 06960d33e15bc80f9912fa92f11dd82388199bd6 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 17 Aug 2010 09:28:20 +0000 Subject: HUGO: Adding engine to the main tree svn-id: r52137 --- engines/hugo/detection.cpp | 234 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 234 insertions(+) create mode 100755 engines/hugo/detection.cpp (limited to 'engines/hugo/detection.cpp') diff --git a/engines/hugo/detection.cpp b/engines/hugo/detection.cpp new file mode 100755 index 0000000000..d780dda6d8 --- /dev/null +++ b/engines/hugo/detection.cpp @@ -0,0 +1,234 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ + +#include "engines/advancedDetector.h" + +#include "hugo/hugo.h" +#include "hugo/intro.h" + +namespace Hugo { + +struct HugoGameDescription { + ADGameDescription desc; + GameType gameType; +}; + +uint32 HugoEngine::getFeatures() const { + return _gameDescription->desc.flags; +} + +static const PlainGameDescriptor hugoGames[] = { + // Games + {"hugo1", "Hugo 1: Hugo's House of Horrors"}, + {"hugo2", "Hugo 2: Hugo's Mystery Adventure"}, + {"hugo3", "Hugo 3: Hugo's Amazon Adventure"}, + + {0, 0} +}; + +static const HugoGameDescription gameDescriptions[] = { + + // Hugo1 DOS + { + { + "hugo1", 0, + AD_ENTRY1s("house.art", "c9403b2fe539185c9fd569b6cc4ff5ca", 14811), + Common::EN_ANY, + Common::kPlatformPC, + ADGF_NO_FLAGS, + Common::GUIO_NONE + }, + kGameTypeHugo1 + }, + // Hugo1 Windows + { + { + "hugo1", 0, + AD_ENTRY1s("objects.dat", "3ba0f108f7690a05a34c56a02fbe644a", 126488), + Common::EN_ANY, + Common::kPlatformWindows, + GF_PACKED, + Common::GUIO_NONE + }, + kGameTypeHugo1 + }, + // Hugo2 DOS + { + { + "hugo2", 0, + AD_ENTRY1s("objects.dat", "88a718cc0ff2b3b25d49aaaa69d6d52c", 155240), + Common::EN_ANY, + Common::kPlatformPC, + GF_PACKED, + Common::GUIO_NONE + }, + kGameTypeHugo2 + }, + // Hugo2 Windows + { + { + "hugo2", 0, + AD_ENTRY1s("objects.dat", "5df4ffc851e66a544c0e95e4e084a806", 158480), + Common::EN_ANY, + Common::kPlatformWindows, + GF_PACKED, + Common::GUIO_NONE + }, + kGameTypeHugo2 + }, + // Hugo3 DOS + { + { + "hugo3", 0, + AD_ENTRY1s("objects.dat", "bb1b061538a445f2eb99b682c0f506cc", 136419), + Common::EN_ANY, + Common::kPlatformPC, + GF_PACKED, + Common::GUIO_NONE + }, + kGameTypeHugo3 + }, + // Hugo3 Windows + { + { + "hugo3", 0, + AD_ENTRY1s("objects.dat", "c9a8af7aa14cc907434eecee3ddd06d3", 136638), + Common::EN_ANY, + Common::kPlatformWindows, + GF_PACKED, + Common::GUIO_NONE + }, + kGameTypeHugo3 + }, + + {AD_TABLE_END_MARKER, kGameTypeNone} +}; + +static const ADParams detectionParams = { + // Pointer to ADGameDescription or its superset structure + (const byte *)gameDescriptions, + // Size of that superset structure + sizeof(HugoGameDescription), + // Number of bytes to compute MD5 sum for + 5000, + // List of all engine targets + hugoGames, + // Structure for autoupgrading obsolete targets + 0, + // Name of single gameid (optional) + 0, + // List of files for file-based fallback detection (optional) + 0, + // Flags + 0, + // Additional GUI options (for every game} + Common::GUIO_NONE, + // Maximum directory depth + 1, + // List of directory globs + 0 +}; + +class HugoMetaEngine : public AdvancedMetaEngine { +public: + HugoMetaEngine() : AdvancedMetaEngine(detectionParams) {} + + const char *getName() const { + return "Hugo Engine"; + } + + const char *getOriginalCopyright() const { + return "Hugo Engine (C) 1989-1997 David P. Gray"; + } + + bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const; + + bool hasFeature(MetaEngineFeature f) const; +}; + +bool HugoMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const { + if (gd) { + *engine = new HugoEngine(syst, (const HugoGameDescription *)gd); + ((HugoEngine *)*engine)->initGame((const HugoGameDescription *)gd); + ((HugoEngine *)*engine)->initGamePart((const HugoGameDescription *)gd); + } + return gd != 0; +} + +bool HugoMetaEngine::hasFeature(MetaEngineFeature f) const { + return false; +} + +} // End of namespace Hugo + +#if PLUGIN_ENABLED_DYNAMIC(HUGO) +REGISTER_PLUGIN_DYNAMIC(HUGO, PLUGIN_TYPE_ENGINE, Hugo::HugoMetaEngine); +#else +REGISTER_PLUGIN_STATIC(HUGO, PLUGIN_TYPE_ENGINE, Hugo::HugoMetaEngine); +#endif + +namespace Hugo { + +void HugoEngine::initGame(const HugoGameDescription *gd) { + _gameType = gd->gameType; + _platform = gd->desc.platform; + _packedFl = (getFeatures() & GF_PACKED); +} + +void HugoEngine::initGamePart(const HugoGameDescription *gd) { + char tmpStr[8]; + _gameVariant = _gameType - 1 + (_platform == Common::kPlatformWindows ? 0 : 3); + +//Generate filenames + if (gd->desc.platform == Common::kPlatformWindows) + sprintf(tmpStr, "%s%c", gd->desc.gameid, 'w'); + else + sprintf(tmpStr, "%s%c", gd->desc.gameid, 'd'); + + sprintf(_initFilename, "%s-00.SAV", tmpStr); + sprintf(_saveFilename, "%s-%s.SAV", tmpStr, "%d"); + + switch (_gameVariant) { + case 0: + _introHandler = new intro_1w(*this); + break; + case 1: + _introHandler = new intro_2w(*this); + break; + case 2: + _introHandler = new intro_3w(*this); + break; + case 3: + _introHandler = new intro_1d(*this); + break; + case 4: + _introHandler = new intro_2d(*this); + break; + case 5: + _introHandler = new intro_3d(*this); + break; + } +} +} // End of namespace Gob -- cgit v1.2.3 From c6a1a746df2fab01ab00d70d0e4588f72b0a1eba Mon Sep 17 00:00:00 2001 From: John Willis Date: Tue, 17 Aug 2010 09:52:34 +0000 Subject: Hugo: Fix very minor typo. svn-id: r52140 --- engines/hugo/detection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/hugo/detection.cpp') diff --git a/engines/hugo/detection.cpp b/engines/hugo/detection.cpp index d780dda6d8..cf10bbbe0f 100755 --- a/engines/hugo/detection.cpp +++ b/engines/hugo/detection.cpp @@ -231,4 +231,4 @@ void HugoEngine::initGamePart(const HugoGameDescription *gd) { break; } } -} // End of namespace Gob +} // End of namespace Hugo -- cgit v1.2.3 From 54c1a1463f2eadb8bf48c234f2474d395b7d62a6 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Tue, 17 Aug 2010 23:55:31 +0000 Subject: HUGO: Fix file permissions 755->644 svn-id: r52177 --- engines/hugo/detection.cpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 engines/hugo/detection.cpp (limited to 'engines/hugo/detection.cpp') diff --git a/engines/hugo/detection.cpp b/engines/hugo/detection.cpp old mode 100755 new mode 100644 -- cgit v1.2.3 From e81eab613374655022a592a055e7afe106765147 Mon Sep 17 00:00:00 2001 From: Arnaud Boutonné Date: Fri, 20 Aug 2010 16:35:20 +0000 Subject: Hugo : Style - Add parenthesis around condition when conditional operator is used, as mentioned in Code Formatting Conventions svn-id: r52230 --- engines/hugo/detection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/hugo/detection.cpp') diff --git a/engines/hugo/detection.cpp b/engines/hugo/detection.cpp index cf10bbbe0f..51a4ad324f 100644 --- a/engines/hugo/detection.cpp +++ b/engines/hugo/detection.cpp @@ -199,7 +199,7 @@ void HugoEngine::initGame(const HugoGameDescription *gd) { void HugoEngine::initGamePart(const HugoGameDescription *gd) { char tmpStr[8]; - _gameVariant = _gameType - 1 + (_platform == Common::kPlatformWindows ? 0 : 3); + _gameVariant = _gameType - 1 + ((_platform == Common::kPlatformWindows) ? 0 : 3); //Generate filenames if (gd->desc.platform == Common::kPlatformWindows) -- cgit v1.2.3 From ec9708694e886746af0d45d30bbf271c2061053f Mon Sep 17 00:00:00 2001 From: Arnaud Boutonné Date: Fri, 27 Aug 2010 09:48:53 +0000 Subject: HUGO: Hopefully fix GCC_PRINTF issue in util * Add a mask in each call of Warn(), Error() and Box() not using one * cleanup: use the same wording for 'End of namespace Hugo' in all files svn-id: r52406 --- engines/hugo/detection.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/hugo/detection.cpp') diff --git a/engines/hugo/detection.cpp b/engines/hugo/detection.cpp index 51a4ad324f..0967dcc07d 100644 --- a/engines/hugo/detection.cpp +++ b/engines/hugo/detection.cpp @@ -231,4 +231,5 @@ void HugoEngine::initGamePart(const HugoGameDescription *gd) { break; } } + } // End of namespace Hugo -- cgit v1.2.3 From a29ae442965bdef0b2a4a0e4df8638a37adcde82 Mon Sep 17 00:00:00 2001 From: Arnaud Boutonné Date: Sat, 4 Sep 2010 16:02:16 +0000 Subject: HUGO: Fix decryption in H2 DOS, plus some cleanup svn-id: r52525 --- engines/hugo/detection.cpp | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) (limited to 'engines/hugo/detection.cpp') diff --git a/engines/hugo/detection.cpp b/engines/hugo/detection.cpp index 0967dcc07d..d19eee0041 100644 --- a/engines/hugo/detection.cpp +++ b/engines/hugo/detection.cpp @@ -26,7 +26,6 @@ #include "engines/advancedDetector.h" #include "hugo/hugo.h" -#include "hugo/intro.h" namespace Hugo { @@ -44,7 +43,6 @@ static const PlainGameDescriptor hugoGames[] = { {"hugo1", "Hugo 1: Hugo's House of Horrors"}, {"hugo2", "Hugo 2: Hugo's Mystery Adventure"}, {"hugo3", "Hugo 3: Hugo's Amazon Adventure"}, - {0, 0} }; @@ -172,7 +170,6 @@ bool HugoMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGame if (gd) { *engine = new HugoEngine(syst, (const HugoGameDescription *)gd); ((HugoEngine *)*engine)->initGame((const HugoGameDescription *)gd); - ((HugoEngine *)*engine)->initGamePart((const HugoGameDescription *)gd); } return gd != 0; } @@ -192,13 +189,11 @@ REGISTER_PLUGIN_STATIC(HUGO, PLUGIN_TYPE_ENGINE, Hugo::HugoMetaEngine); namespace Hugo { void HugoEngine::initGame(const HugoGameDescription *gd) { + char tmpStr[8]; + _gameType = gd->gameType; _platform = gd->desc.platform; _packedFl = (getFeatures() & GF_PACKED); -} - -void HugoEngine::initGamePart(const HugoGameDescription *gd) { - char tmpStr[8]; _gameVariant = _gameType - 1 + ((_platform == Common::kPlatformWindows) ? 0 : 3); //Generate filenames @@ -209,27 +204,6 @@ void HugoEngine::initGamePart(const HugoGameDescription *gd) { sprintf(_initFilename, "%s-00.SAV", tmpStr); sprintf(_saveFilename, "%s-%s.SAV", tmpStr, "%d"); - - switch (_gameVariant) { - case 0: - _introHandler = new intro_1w(*this); - break; - case 1: - _introHandler = new intro_2w(*this); - break; - case 2: - _introHandler = new intro_3w(*this); - break; - case 3: - _introHandler = new intro_1d(*this); - break; - case 4: - _introHandler = new intro_2d(*this); - break; - case 5: - _introHandler = new intro_3d(*this); - break; - } } } // End of namespace Hugo -- cgit v1.2.3 From ed93a5895515efaff95b7a39e43b4525d254e47b Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sun, 10 Oct 2010 23:24:57 +0000 Subject: HUGO: Use _targetName for naming save files svn-id: r53145 --- engines/hugo/detection.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'engines/hugo/detection.cpp') diff --git a/engines/hugo/detection.cpp b/engines/hugo/detection.cpp index d19eee0041..0064a39434 100644 --- a/engines/hugo/detection.cpp +++ b/engines/hugo/detection.cpp @@ -189,21 +189,14 @@ REGISTER_PLUGIN_STATIC(HUGO, PLUGIN_TYPE_ENGINE, Hugo::HugoMetaEngine); namespace Hugo { void HugoEngine::initGame(const HugoGameDescription *gd) { - char tmpStr[8]; - _gameType = gd->gameType; _platform = gd->desc.platform; _packedFl = (getFeatures() & GF_PACKED); _gameVariant = _gameType - 1 + ((_platform == Common::kPlatformWindows) ? 0 : 3); -//Generate filenames - if (gd->desc.platform == Common::kPlatformWindows) - sprintf(tmpStr, "%s%c", gd->desc.gameid, 'w'); - else - sprintf(tmpStr, "%s%c", gd->desc.gameid, 'd'); - - sprintf(_initFilename, "%s-00.SAV", tmpStr); - sprintf(_saveFilename, "%s-%s.SAV", tmpStr, "%d"); + // Generate filenames + _initFilename = _targetName + "-00.SAV"; + _saveFilename = _targetName + "-%d.SAV"; } } // End of namespace Hugo -- cgit v1.2.3