diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index 40eec8a35de..d4eeae4212a 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -20,7 +20,6 @@ */ #include "common/system.h" // for setFocusRectangle/clearFocusRectangle -#include "common/config-manager.h" #include "scumm/scumm.h" #include "scumm/actor.h" #include "scumm/actor_he.h" @@ -1610,7 +1609,7 @@ void Actor::putActor(int dstX, int dstY, int newRoom) { // WORKAROUND: The green transparency of the tank in the Hall of Oddities // is positioned one pixel too far to the left. This appears to be a bug // in the original game as well. - if (_vm->_game.id == GID_SAMNMAX && newRoom == 16 && _number == 5 && dstX == 235 && dstY == 236 && ConfMan.getBool("enable_enhancements")) + if (_vm->_game.id == GID_SAMNMAX && newRoom == 16 && _number == 5 && dstX == 235 && dstY == 236 && _vm->_enableEnhancements) dstX++; _pos.x = dstX; diff --git a/engines/scumm/gfx_mac.cpp b/engines/scumm/gfx_mac.cpp index e29f049bee5..4ab0eadf4bc 100644 --- a/engines/scumm/gfx_mac.cpp +++ b/engines/scumm/gfx_mac.cpp @@ -20,7 +20,6 @@ */ #include "common/system.h" -#include "common/config-manager.h" #include "graphics/macega.h" #include "scumm/actor.h" #include "scumm/charset.h" @@ -52,11 +51,9 @@ void ScummEngine::mac_drawStripToScreen(VirtScreen *vs, int top, int x, int y, i // unmodified. At least, that's what Mini vMac did when I tried it. if (_renderMode == Common::kRenderMacintoshBW) { - bool enableEnhancements = ConfMan.getBool("enable_enhancements"); - for (int h = 0; h < height; h++) { for (int w = 0; w < width; w++) { - int color = enableEnhancements ? _shadowPalette[pixels[w]] : pixels[w]; + int color = _enableEnhancements ? _shadowPalette[pixels[w]] : pixels[w]; if (ts[2 * w] == CHARSET_MASK_TRANSPARENCY) mac[2 * w] = Graphics::macEGADither[color][0]; if (ts[2 * w + 1] == CHARSET_MASK_TRANSPARENCY) diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp index 0b5557ae86a..2edb08aaaed 100644 --- a/engines/scumm/resource.cpp +++ b/engines/scumm/resource.cpp @@ -1738,7 +1738,7 @@ void ScummEngine::applyWorkaroundIfNeeded(ResType type, int idx) { // overwritten. This probably affects all CD versions, so we just have // to add further patches as they are reported. - if (_game.id == GID_MONKEY && type == rtRoom && idx == 25 && ConfMan.getBool("enable_enhancements")) { + if (_game.id == GID_MONKEY && type == rtRoom && idx == 25 && _enableEnhancements) { tryPatchMI1CannibalScript(getResourceAddress(type, idx), size); } else diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp index 575746d588b..d6e8ee24580 100644 --- a/engines/scumm/script_v5.cpp +++ b/engines/scumm/script_v5.cpp @@ -457,7 +457,7 @@ void ScummEngine_v5::o5_actorOps() { // But in the VGA CD version, only costume 0 is used // and the close-up is missing the cigar smoke. - if (_game.id == GID_MONKEY && _currentRoom == 76 && act == 12 && i == 0 && ConfMan.getBool("enable_enhancements")) { + if (_game.id == GID_MONKEY && _currentRoom == 76 && act == 12 && i == 0 && _enableEnhancements) { i = 76; } @@ -670,7 +670,7 @@ void ScummEngine_v5::o5_add() { // We restore the old behavior by adding 0, not 1, to the second // variable when examining the clock tower. - if (_game.id == GID_MONKEY && vm.slot[_currentScript].number == 210 && _currentRoom == 35 && _resultVarNumber == 248 && a == 1 && ConfMan.getBool("enable_enhancements")) { + if (_game.id == GID_MONKEY && vm.slot[_currentScript].number == 210 && _currentRoom == 35 && _resultVarNumber == 248 && a == 1 && _enableEnhancements) { a = 0; } @@ -1396,7 +1396,7 @@ void ScummEngine_v5::o5_isLessEqual() { // together that they look like one. This adjusts the timing of the // second one. - if (_game.id == GID_LOOM && _game.version >= 4 && _language == Common::EN_ANY && vm.slot[_currentScript].number == 95 && var == VAR_MUSIC_TIMER && b == 1708 && ConfMan.getBool("enable_enhancements")) { + if (_game.id == GID_LOOM && _game.version >= 4 && _language == Common::EN_ANY && vm.slot[_currentScript].number == 95 && var == VAR_MUSIC_TIMER && b == 1708 && _enableEnhancements) { b = 1815; } @@ -1650,7 +1650,7 @@ void ScummEngine_v5::o5_putActor() { // other coordinates. The difference is never more than a single pixel, // so there's not much reason to correct those. - if (_game.id == GID_MONKEY && _currentRoom == 76 && act == 12 && ConfMan.getBool("enable_enhancements")) { + if (_game.id == GID_MONKEY && _currentRoom == 76 && act == 12 && _enableEnhancements) { if (x == 176 && y == 80) { x = 174; y = 86; @@ -1922,7 +1922,7 @@ void ScummEngine_v5::o5_roomOps() { // we want the original color 3 for the cigar smoke. It // should be ok since there is no GUI in this scene. - if (_game.id == GID_MONKEY && _currentRoom == 76 && d == 3 && ConfMan.getBool("enable_enhancements")) + if (_game.id == GID_MONKEY && _currentRoom == 76 && d == 3 && _enableEnhancements) break; setPalColor(d, a, b, c); /* index, r, g, b */ @@ -2341,7 +2341,7 @@ void ScummEngine_v5::o5_stopSound() { // 10001 regardless of which room it is. We figure out which one by // looking at which rooms we're moving between. - if (_game.id == GID_MONKEY && (_game.features & GF_AUDIOTRACKS) && sound == 126 && vm.slot[_currentScript].number == 10001 && VAR(VAR_ROOM) == 43 && VAR(VAR_NEW_ROOM) == 76 && ConfMan.getBool("enable_enhancements")) { + if (_game.id == GID_MONKEY && (_game.features & GF_AUDIOTRACKS) && sound == 126 && vm.slot[_currentScript].number == 10001 && VAR(VAR_ROOM) == 43 && VAR(VAR_NEW_ROOM) == 76 && _enableEnhancements) { return; } @@ -2977,7 +2977,7 @@ void ScummEngine_v5::decodeParseString() { case 15:{ // SO_TEXTSTRING const int len = resStrLen(_scriptPointer); - if (_game.id == GID_LOOM && vm.slot[_currentScript].number == 95 && strcmp((const char *)_scriptPointer, "I am Choas.") == 0 && ConfMan.getBool("enable_enhancements")) { + if (_game.id == GID_LOOM && vm.slot[_currentScript].number == 95 && _enableEnhancements && strcmp((const char *)_scriptPointer, "I am Choas.") == 0) { // WORKAROUND: This happens when Chaos introduces // herself to bishop Mandible. Of all the places to put // a typo... diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index b26211766cb..eef5d9ecca0 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -109,7 +109,8 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _currentScript(0xFF), // Let debug() work on init stage _messageDialog(nullptr), _pauseDialog(nullptr), _versionDialog(nullptr), _rnd("scumm"), - _shakeTimerRate(dr.game.version <= 3 ? 236696 : 291304) + _shakeTimerRate(dr.game.version <= 3 ? 236696 : 291304), + _enableEnhancements(false) { _localizer = nullptr; @@ -1114,6 +1115,8 @@ Common::Error ScummEngine::init() { const Common::FSNode gameDataDir(ConfMan.get("path")); + _enableEnhancements = ConfMan.getBool("enable_enhancements"); + // Add default file directories. if (((_game.platform == Common::kPlatformAmiga) || (_game.platform == Common::kPlatformAtariST)) && (_game.version <= 4)) { // This is for the Amiga version of Indy3/Loom/Maniac/Zak diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index 055d4aedd0b..74654fe5fbf 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -314,6 +314,8 @@ public: /** Central resource data. */ ResourceManager *_res; + bool _enableEnhancements; + protected: VirtualMachineState vm; diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index b777fc6d1a1..f2c4a567920 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -1496,7 +1496,7 @@ int ScummEngine::readSoundResource(ResId idx) { // Some of the Mac MI2 music only exists as Roland tracks. The // original interpreter doesn't play them. I don't think there // is any similarly missing FoA music. - if (_game.id == GID_MONKEY2 && _game.platform == Common::kPlatformMacintosh && !ConfMan.getBool("enable_enhancements")) { + if (_game.id == GID_MONKEY2 && _game.platform == Common::kPlatformMacintosh && !_enableEnhancements) { pri = -1; break; } diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp index ce1c1147c63..84c98944ba1 100644 --- a/engines/scumm/string.cpp +++ b/engines/scumm/string.cpp @@ -68,7 +68,7 @@ void ScummEngine::printString(int m, const byte *msg) { vm.slot[_currentScript].number == 203 && _actorToPrintStrFor == 255 && strcmp((const char *)msg, " ") == 0 && getOwner(200) == VAR(VAR_EGO) && VAR(VAR_HAVE_MSG) && - ConfMan.getBool("enable_enhancements")) { + _enableEnhancements) { return; }