diff options
author | Colin Snover | 2016-10-19 12:57:08 -0500 |
---|---|---|
committer | Colin Snover | 2016-10-20 11:33:29 -0500 |
commit | 34bd1bcaa9246d6599819ff3ed1ab4c35812136d (patch) | |
tree | 9543804205b0bce0fdb4bfb4b0e1fbfe807ec79e /engines/sci | |
parent | 55222ec06c030a03d288b7ad476c5dbf1444a48b (diff) | |
download | scummvm-rg350-34bd1bcaa9246d6599819ff3ed1ab4c35812136d.tar.gz scummvm-rg350-34bd1bcaa9246d6599819ff3ed1ab4c35812136d.tar.bz2 scummvm-rg350-34bd1bcaa9246d6599819ff3ed1ab4c35812136d.zip |
SCI32: Split out detection of features that cross SSCI versions
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/engine/features.h | 35 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics32.cpp | 4 | ||||
-rw-r--r-- | engines/sci/graphics/palette32.cpp | 3 | ||||
-rw-r--r-- | engines/sci/graphics/plane32.cpp | 10 | ||||
-rw-r--r-- | engines/sci/graphics/remap32.cpp | 3 | ||||
-rw-r--r-- | engines/sci/sound/audio32.cpp | 19 |
6 files changed, 47 insertions, 27 deletions
diff --git a/engines/sci/engine/features.h b/engines/sci/engine/features.h index b2d40f400f..15c80a7277 100644 --- a/engines/sci/engine/features.h +++ b/engines/sci/engine/features.h @@ -82,6 +82,41 @@ public: * @return Graphics functions type, SCI_VERSION_2 / SCI_VERSION_2_1 */ SciVersion detectSci21KernelType(); + + inline bool usesModifiedAudioAttenuation() const { + switch (g_sci->getGameId()) { + // Assuming MGDX uses modified attenuation since SQ6 does and it was + // released earlier, but not verified (Phar Lap Windows-only release) + case GID_MOTHERGOOSEHIRES: + case GID_PQ4: + case GID_SQ6: + return true; + case GID_KQ7: + case GID_QFG4: + // (1) KQ7 1.51 (SCI2.1early) uses the non-standard attenuation, but + // 2.00b (SCI2.1mid) does not + // (2) QFG4 CD is SCI2.1early; QFG4 floppy is SCI2 and does not use + // the SCI2.1 audio system + return getSciVersion() == SCI_VERSION_2_1_EARLY; + default: + return false; + } + } + + inline bool hasTransparentPicturePlanes() const { + const SciGameId &gid = g_sci->getGameId(); + + // NOTE: MGDX is assumed to not have transparent picture planes since it + // was released before SQ6, but this has not been verified since it + // cannot be disassembled at the moment (Phar Lap Windows-only release) + return getSciVersion() >= SCI_VERSION_2_1_MIDDLE && + gid != GID_SQ6 && + gid != GID_MOTHERGOOSEHIRES; + } + + inline bool hasNewPaletteCode() const { + return getSciVersion() >= SCI_VERSION_2_1_MIDDLE || g_sci->getGameId() == GID_KQ7; + } #endif /** diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp index 039373c387..d4377417a8 100644 --- a/engines/sci/engine/kgraphics32.cpp +++ b/engines/sci/engine/kgraphics32.cpp @@ -972,9 +972,7 @@ reg_t kPalVarySetVary(EngineState *s, int argc, reg_t *argv) { int16 fromColor; int16 toColor; - if ((getSciVersion() >= SCI_VERSION_2_1_MIDDLE || g_sci->getGameId() == GID_KQ7) - && argc > 4) { - + if (g_sci->_features->hasNewPaletteCode() && argc > 4) { fromColor = argv[3].toSint16(); toColor = argv[4].toSint16(); } else { diff --git a/engines/sci/graphics/palette32.cpp b/engines/sci/graphics/palette32.cpp index ec3d912365..56e1940224 100644 --- a/engines/sci/graphics/palette32.cpp +++ b/engines/sci/graphics/palette32.cpp @@ -28,6 +28,7 @@ #include "sci/event.h" #include "sci/resource.h" #include "sci/util.h" +#include "sci/engine/features.h" #include "sci/graphics/palette32.h" #include "sci/graphics/remap32.h" #include "sci/graphics/screen.h" @@ -557,7 +558,7 @@ void GfxPalette32::setCycle(const uint8 fromColor, const uint8 toColor, const in } uint16 numColorsToCycle = toColor - fromColor; - if (getSciVersion() >= SCI_VERSION_2_1_MIDDLE || g_sci->getGameId() == GID_KQ7) { + if (g_sci->_features->hasNewPaletteCode()) { numColorsToCycle += 1; } cycler->fromColor = fromColor; diff --git a/engines/sci/graphics/plane32.cpp b/engines/sci/graphics/plane32.cpp index 7dfaed4243..086a4a749b 100644 --- a/engines/sci/graphics/plane32.cpp +++ b/engines/sci/graphics/plane32.cpp @@ -21,6 +21,7 @@ */ #include "sci/console.h" +#include "sci/engine/features.h" #include "sci/engine/kernel.h" #include "sci/engine/selector.h" #include "sci/engine/state.h" @@ -191,7 +192,7 @@ void Plane::addPicInternal(const GuiResourceId pictureId, const Common::Point *p delete screenItem->_celObj; screenItem->_celObj = celObj; } - _type = (getSciVersion() == SCI_VERSION_3 && transparent) ? kPlaneTypeTransparentPicture : kPlaneTypePicture; + _type = (g_sci->_features->hasTransparentPicturePlanes() && transparent) ? kPlaneTypeTransparentPicture : kPlaneTypePicture; } GuiResourceId Plane::addPic(const GuiResourceId pictureId, const Common::Point &position, const bool mirrorX, const bool deleteDuplicate) { @@ -751,14 +752,13 @@ void Plane::setType() { _type = kPlaneTypeOpaque; break; case kPlanePicTransparentPicture: - if (getSciVersion() == SCI_VERSION_3) { - warning("TODO: Using transparent picture plane. Rendering may be incomplete"); + if (g_sci->_features->hasTransparentPicturePlanes()) { _type = kPlaneTypeTransparentPicture; break; } - // fall through for sci2/2.1 + // fall through for games without transparent picture planes default: - if (_type != kPlaneTypeTransparentPicture) { + if (!g_sci->_features->hasTransparentPicturePlanes() || _type != kPlaneTypeTransparentPicture) { _type = kPlaneTypePicture; } break; diff --git a/engines/sci/graphics/remap32.cpp b/engines/sci/graphics/remap32.cpp index d5a2362f14..768594f974 100644 --- a/engines/sci/graphics/remap32.cpp +++ b/engines/sci/graphics/remap32.cpp @@ -21,6 +21,7 @@ */ #include "sci/sci.h" +#include "sci/engine/features.h" #include "sci/graphics/palette32.h" #include "sci/graphics/remap32.h" @@ -300,7 +301,7 @@ GfxRemap32::GfxRemap32() : // match the highest possible value of `_remapStartColor` assert(_remapStartColor == 236); - if (getSciVersion() >= SCI_VERSION_2_1_MIDDLE || g_sci->getGameId() == GID_KQ7) { + if (g_sci->_features->hasNewPaletteCode()) { _remaps.resize(9); } else { _remaps.resize(19); diff --git a/engines/sci/sound/audio32.cpp b/engines/sci/sound/audio32.cpp index 659a5265d4..d5a7ae14b8 100644 --- a/engines/sci/sound/audio32.cpp +++ b/engines/sci/sound/audio32.cpp @@ -35,6 +35,7 @@ #include "common/textconsole.h" // for warning #include "common/types.h" // for Flag::NO #include "engine.h" // for Engine, g_engine +#include "sci/engine/features.h" // for GameFeatures #include "sci/engine/vm_types.h" // for reg_t, make_reg, NULL_REG #include "sci/resource.h" // for ResourceId, ResourceType::kResour... #include "sci/sci.h" // for SciEngine, g_sci, getSciVersion @@ -135,23 +136,7 @@ Audio32::Audio32(ResourceManager *resMan) : _channels.resize(8); } - _useModifiedAttenuation = false; - if (getSciVersion() == SCI_VERSION_2_1_MIDDLE) { - switch (g_sci->getGameId()) { - case GID_MOTHERGOOSEHIRES: - case GID_PQ4: - case GID_QFG4: - case GID_SQ6: - _useModifiedAttenuation = true; - default: - break; - } - } else if (getSciVersion() == SCI_VERSION_2_1_EARLY && g_sci->getGameId() == GID_KQ7) { - // KQ7 1.51 uses the non-standard attenuation, but 2.00b - // does not, which is strange. - _useModifiedAttenuation = true; - } - + _useModifiedAttenuation = g_sci->_features->usesModifiedAudioAttenuation(); _mixer->playStream(Audio::Mixer::kSFXSoundType, &_handle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); } |