diff options
author | Walter van Niftrik | 2009-08-30 01:37:27 +0000 |
---|---|---|
committer | Walter van Niftrik | 2009-08-30 01:37:27 +0000 |
commit | fff023794f1f177fd4634d0153a6208a5bb2d8f4 (patch) | |
tree | a308e65f23bdfed5474fda6ae07e8d45d7251705 | |
parent | 212965f978ac8f782dad1bdc02f60477a1d60894 (diff) | |
download | scummvm-rg350-fff023794f1f177fd4634d0153a6208a5bb2d8f4.tar.gz scummvm-rg350-fff023794f1f177fd4634d0153a6208a5bb2d8f4.tar.bz2 scummvm-rg350-fff023794f1f177fd4634d0153a6208a5bb2d8f4.zip |
SCI: Cleanup
svn-id: r43811
-rw-r--r-- | engines/sci/console.cpp | 3 | ||||
-rw-r--r-- | engines/sci/decompressor.cpp | 1 | ||||
-rw-r--r-- | engines/sci/resource.cpp | 2 | ||||
-rw-r--r-- | engines/sci/resource.h | 17 | ||||
-rw-r--r-- | engines/sci/sci.cpp | 49 | ||||
-rw-r--r-- | engines/sci/sci.h | 21 |
6 files changed, 55 insertions, 38 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index be72cbe9e9..d63eca23e4 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -381,8 +381,7 @@ const char *selector_name(EngineState *s, int selector) { } bool Console::cmdGetVersion(int argc, const char **argv) { - DebugPrintf("Resource file version: %s\n", versionNames[_vm->getresourceManager()->sciVersion()]); - DebugPrintf("Emulated interpreter version: %s\n", versionNames[_vm->getVersion()]); + DebugPrintf("Emulated interpreter version: %s\n", ((SciEngine *)g_engine)->getSciVersionDesc(_vm->getVersion()).c_str()); return true; } diff --git a/engines/sci/decompressor.cpp b/engines/sci/decompressor.cpp index 17dfc43e68..4731c87427 100644 --- a/engines/sci/decompressor.cpp +++ b/engines/sci/decompressor.cpp @@ -31,6 +31,7 @@ #include "sci/decompressor.h" #include "sci/sci.h" +#include "sci/resource.h" namespace Sci { int Decompressor::unpack(Common::ReadStream *src, byte *dest, uint32 nPacked, uint32 nUnpacked) { diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 7a41a526ac..52e7a7c74e 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -520,7 +520,7 @@ void ResourceManager::init() { _sciVersion = detectSciVersion(); if (_sciVersion != SCI_VERSION_AUTODETECT) - debug("resourceManager: Detected %s", versionNames[_sciVersion]); + debug("resourceManager: Detected %s", ((SciEngine *)g_engine)->getSciVersionDesc(_sciVersion).c_str()); else warning("resourceManager: Couldn't determine SCI version"); diff --git a/engines/sci/resource.h b/engines/sci/resource.h index 6e200e55b5..d7aa5d954b 100644 --- a/engines/sci/resource.h +++ b/engines/sci/resource.h @@ -37,6 +37,7 @@ #include "gfx/gfx_resource.h" // for ViewType #include "sci/decompressor.h" +#include "sci/sci.h" namespace Common { class ReadStream; @@ -47,22 +48,6 @@ namespace Sci { /** The maximum allowed size for a compressed or decompressed resource */ #define SCI_MAX_RESOURCE_SIZE 0x0400000 -/** SCI versions */ -enum SciVersion { - SCI_VERSION_AUTODETECT, - SCI_VERSION_0_EARLY, // Early KQ4, 1988 xmas card - SCI_VERSION_0_LATE, // KQ4, LSL2, LSL3, SQ3 etc - SCI_VERSION_01, // KQ1 and multilingual games (S.old.*) - SCI_VERSION_1_EGA, // EGA with parser, QFG2 - SCI_VERSION_1_EARLY, // KQ5. (EGA/VGA) - SCI_VERSION_1_MIDDLE, // LSL1, JONESCD. (EGA?/VGA) - SCI_VERSION_1_LATE, // ECO1, LSL5. (EGA/VGA) - SCI_VERSION_1_1, // KQ6, ECO2 - SCI_VERSION_2, // GK1, PQ4 (Floppy), QFG4 (Floppy) - SCI_VERSION_2_1, // GK2, KQ7, SQ6, Torin - SCI_VERSION_3 // LSL7, RAMA, Lighthouse -}; - /** Resource status types */ enum ResourceStatus { kResStatusNoMalloc = 0, diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index f92a56d9b3..a0fad0adb2 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -43,22 +43,6 @@ namespace Sci { class GfxDriver; -// FIXME: error-prone -const char *versionNames[] = { - "Autodetect", - "SCI0 Early", - "SCI0 Late", - "SCI01", - "SCI1 EGA", - "SCI1 Early", - "SCI1 Middle", - "SCI1 Late", - "SCI1.1", - "SCI2", - "SCI2.1", - "SCI3" -}; - SciEngine::SciEngine(OSystem *syst, const SciGameDescription *desc) : Engine(syst), _gameDescription(desc) { // Put your engine in a sane state, but do nothing big yet; @@ -212,7 +196,7 @@ Common::Error SciEngine::run() { return Common::kUnknownError; } - printf("Emulating SCI version %s\n", versionNames[_resourceManager->sciVersion()]); + printf("Emulating SCI version %s\n", getSciVersionDesc(_resourceManager->sciVersion()).c_str()); game_run(&_gamestate); // Run the game @@ -290,4 +274,35 @@ void SciEngine::pauseEngineIntern(bool pause) { _mixer->pauseAll(pause); } +Common::String SciEngine::getSciVersionDesc(SciVersion version) const { + switch (version) { + case SCI_VERSION_AUTODETECT: + return "Autodetect"; + case SCI_VERSION_0_EARLY: + return "Early SCI0"; + case SCI_VERSION_0_LATE: + return "Late SCI0"; + case SCI_VERSION_01: + return "SCI01"; + case SCI_VERSION_1_EGA: + return "SCI1 EGA"; + case SCI_VERSION_1_EARLY: + return "Early SCI1"; + case SCI_VERSION_1_MIDDLE: + return "Middle SCI1"; + case SCI_VERSION_1_LATE: + return "Late SCI1"; + case SCI_VERSION_1_1: + return "SCI1.1"; + case SCI_VERSION_2: + return "SCI2"; + case SCI_VERSION_2_1: + return "SCI2.1"; + case SCI_VERSION_3: + return "SCI3"; + default: + return "Unknown"; + } +} + } // End of namespace Sci diff --git a/engines/sci/sci.h b/engines/sci/sci.h index 9af7b35667..965be510e7 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -29,14 +29,13 @@ #include "engines/engine.h" #include "engines/advancedDetector.h" -#include "sci/resource.h" - namespace Sci { class Console; struct EngineState; class Kernel; class Vocabulary; +class ResourceManager; // our engine debug levels enum kDebugLevels { @@ -79,6 +78,22 @@ enum SciGameFlags { GF_SCI0_OLDGETTIME = (1 << 0) }; +/** SCI versions */ +enum SciVersion { + SCI_VERSION_AUTODETECT, + SCI_VERSION_0_EARLY, // Early KQ4, 1988 xmas card + SCI_VERSION_0_LATE, // KQ4, LSL2, LSL3, SQ3 etc + SCI_VERSION_01, // KQ1 and multilingual games (S.old.*) + SCI_VERSION_1_EGA, // EGA with parser, QFG2 + SCI_VERSION_1_EARLY, // KQ5. (EGA/VGA) + SCI_VERSION_1_MIDDLE, // LSL1, JONESCD. (EGA?/VGA) + SCI_VERSION_1_LATE, // ECO1, LSL5. (EGA/VGA) + SCI_VERSION_1_1, // KQ6, ECO2 + SCI_VERSION_2, // GK1, PQ4 (Floppy), QFG4 (Floppy) + SCI_VERSION_2_1, // GK2, KQ7, SQ6, Torin + SCI_VERSION_3 // LSL7, RAMA, Lighthouse +}; + class SciEngine : public Engine { friend class Console; public: @@ -110,6 +125,8 @@ public: /** Remove the 'TARGET-' prefix of the given filename, if present. */ Common::String unwrapFilename(const Common::String &name) const; + Common::String getSciVersionDesc(SciVersion version) const; + private: const SciGameDescription *_gameDescription; ResourceManager *_resourceManager; |