diff options
author | Max Horn | 2009-09-23 12:12:37 +0000 |
---|---|---|
committer | Max Horn | 2009-09-23 12:12:37 +0000 |
commit | ba0bd938e457df9f6b297731de5ae85ddbadf236 (patch) | |
tree | f2cf89179363856459e8acac6721ac42c04a7259 /engines/sci | |
parent | 92e75a768ab79a2e8dd38d97b78193e10fa12bbf (diff) | |
download | scummvm-rg350-ba0bd938e457df9f6b297731de5ae85ddbadf236.tar.gz scummvm-rg350-ba0bd938e457df9f6b297731de5ae85ddbadf236.tar.bz2 scummvm-rg350-ba0bd938e457df9f6b297731de5ae85ddbadf236.zip |
SCI: Rename _sciVersion to s_sciVersion and made it local to resource.cpp (i.e. follow CFG and achieve code/data isolation)
svn-id: r44271
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/resource.cpp | 47 | ||||
-rw-r--r-- | engines/sci/sci.cpp | 2 | ||||
-rw-r--r-- | engines/sci/sci.h | 7 |
3 files changed, 28 insertions, 28 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index b637fbb615..f6b24d0a12 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -38,6 +38,13 @@ namespace Sci { +static SciVersion s_sciVersion = SCI_VERSION_AUTODETECT; + +SciVersion getSciVersion() { + assert(s_sciVersion != SCI_VERSION_AUTODETECT); + return s_sciVersion; +} + #undef SCI_REQUIRE_RESOURCE_FILES //#define SCI_VERBOSE_resMan 1 @@ -945,7 +952,7 @@ void ResourceManager::processPatch(ResourceSource *source, ResourceType restype, void ResourceManager::readResourcePatches(ResourceSource *source) { // Note: since some SCI1 games(KQ5 floppy, SQ4) might use SCI0 naming scheme for patch files // this function tries to read patch file with any supported naming scheme, -// regardless of _sciVersion value +// regardless of s_sciVersion value Common::String mask, name; Common::ArchiveMemberList files; @@ -1581,9 +1588,9 @@ ViewType ResourceManager::detectViewType() { } void ResourceManager::detectSciVersion() { - // We use the view compression to set a preliminary _sciVersion for the sake of getResourceInfo + // We use the view compression to set a preliminary s_sciVersion for the sake of getResourceInfo // Pretend we have a SCI0 game - _sciVersion = SCI_VERSION_0_EARLY; + s_sciVersion = SCI_VERSION_0_EARLY; bool oldDecompressors = true; ResourceCompression viewCompression = getViewCompression(); @@ -1591,7 +1598,7 @@ void ResourceManager::detectSciVersion() { // If it's a different compression type from kCompLZW, the game is probably // SCI_VERSION_1_EGA or later. If the views are uncompressed, it is // likely not an early disk game. - _sciVersion = SCI_VERSION_1_EGA; + s_sciVersion = SCI_VERSION_1_EGA; oldDecompressors = false; } @@ -1615,10 +1622,10 @@ void ResourceManager::detectSciVersion() { // 0x80. We differentiate between SCI2 and SCI2.1/3 based on that. // TODO: Differentiate between SCI2.1 and SCI3 if (_mapVersion == kResVersionSci1Late) { - _sciVersion = SCI_VERSION_2; + s_sciVersion = SCI_VERSION_2; return; } else { - _sciVersion = SCI_VERSION_2_1; + s_sciVersion = SCI_VERSION_2_1; return; } } @@ -1627,13 +1634,13 @@ void ResourceManager::detectSciVersion() { case kResVersionSci0Sci1Early: if (_viewType == kViewVga) { // VGA - _sciVersion = SCI_VERSION_1_EARLY; + s_sciVersion = SCI_VERSION_1_EARLY; return; } // EGA if (hasOldScriptHeader()) { - _sciVersion = SCI_VERSION_0_EARLY; + s_sciVersion = SCI_VERSION_0_EARLY; return; } @@ -1643,10 +1650,10 @@ void ResourceManager::detectSciVersion() { // We first check for SCI1 vocab.999 if (testResource(ResourceId(kResourceTypeVocab, 999))) { if (hasSci0Voc999()) { - _sciVersion = SCI_VERSION_0_LATE; + s_sciVersion = SCI_VERSION_0_LATE; return; } else { - _sciVersion = SCI_VERSION_01; + s_sciVersion = SCI_VERSION_01; return; } } @@ -1654,45 +1661,45 @@ void ResourceManager::detectSciVersion() { // If vocab.999 is missing, we try vocab.900 if (testResource(ResourceId(kResourceTypeVocab, 900))) { if (hasSci1Voc900()) { - _sciVersion = SCI_VERSION_01; + s_sciVersion = SCI_VERSION_01; return; } else { - _sciVersion = SCI_VERSION_0_LATE; + s_sciVersion = SCI_VERSION_0_LATE; return; } } warning("Failed to accurately determine SCI version"); // No parser, we assume SCI_VERSION_01. - _sciVersion = SCI_VERSION_01; + s_sciVersion = SCI_VERSION_01; return; } // New decompressors. It's either SCI_VERSION_1_EGA or SCI_VERSION_1_EARLY. if (hasSci1Voc900()) { - _sciVersion = SCI_VERSION_1_EGA; + s_sciVersion = SCI_VERSION_1_EGA; return; } // SCI_VERSION_1_EARLY EGA versions seem to be lacking a valid vocab.900. // If this turns out to be unreliable, we could do some pic resource checks instead. - _sciVersion = SCI_VERSION_1_EARLY; + s_sciVersion = SCI_VERSION_1_EARLY; return; case kResVersionSci1Middle: - _sciVersion = SCI_VERSION_1_MIDDLE; + s_sciVersion = SCI_VERSION_1_MIDDLE; return; case kResVersionSci1Late: if (_volVersion == kResVersionSci11) { - _sciVersion = SCI_VERSION_1_1; + s_sciVersion = SCI_VERSION_1_1; return; } - _sciVersion = SCI_VERSION_1_LATE; + s_sciVersion = SCI_VERSION_1_LATE; return; case kResVersionSci11: - _sciVersion = SCI_VERSION_1_1; + s_sciVersion = SCI_VERSION_1_1; return; default: - _sciVersion = SCI_VERSION_AUTODETECT; + s_sciVersion = SCI_VERSION_AUTODETECT; error("detectSciVersion(): Unable to detect the game's SCI version"); } } diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index d24d651905..e185c79fa5 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -43,8 +43,6 @@ namespace Sci { class GfxDriver; -SciVersion _sciVersion; - SciEngine::SciEngine(OSystem *syst, const SciGameDescription *desc) : Engine(syst), _gameDescription(desc) { // Put your engine in a sane state, but do nothing big yet; diff --git a/engines/sci/sci.h b/engines/sci/sci.h index a48fc2e202..3dbafcede8 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -134,15 +134,10 @@ private: Console *_console; }; -extern SciVersion _sciVersion; - /** * Convenience function to obtain the active SCI version. */ -inline static SciVersion getSciVersion() { - assert (_sciVersion != SCI_VERSION_AUTODETECT); - return _sciVersion; -} +SciVersion getSciVersion(); inline static Common::String getSciVersionDesc(SciVersion version) { switch (version) { |