From 5b7754e3f095eb8a469dd4b7de5a6379f8e13c27 Mon Sep 17 00:00:00 2001 From: athrxx Date: Wed, 15 Jun 2011 17:12:17 +0200 Subject: SCUMM: fix bug #3316738 This provides fallback to 8bit color mode for SCUMM3 FM-TOWNS games on platforms which set the USE_RGB_COLOR define even though that color mode is not being fully implemented for that platform. --- engines/scumm/cursor.cpp | 18 +++++++++++------- engines/scumm/palette.cpp | 14 ++++++++------ engines/scumm/scumm.cpp | 14 ++++++++++---- 3 files changed, 29 insertions(+), 17 deletions(-) (limited to 'engines/scumm') diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp index e9b5260eca..8676c857ea 100644 --- a/engines/scumm/cursor.cpp +++ b/engines/scumm/cursor.cpp @@ -114,17 +114,21 @@ void ScummEngine_v6::setCursorTransparency(int a) { void ScummEngine::updateCursor() { int transColor = (_game.heversion >= 80) ? 5 : 255; #ifdef USE_RGB_COLOR - Graphics::PixelFormat format = _system->getScreenFormat(); - CursorMan.replaceCursor(_grabbedCursor, _cursor.width, _cursor.height, - _cursor.hotspotX, _cursor.hotspotY, - (_game.platform == Common::kPlatformNES ? _grabbedCursor[63] : transColor), - (_game.heversion == 70 ? 2 : 1), - &format); -#else + if (_bytesPerPixelOutput == 2) { + Graphics::PixelFormat format = _system->getScreenFormat(); + CursorMan.replaceCursor(_grabbedCursor, _cursor.width, _cursor.height, + _cursor.hotspotX, _cursor.hotspotY, + (_game.platform == Common::kPlatformNES ? _grabbedCursor[63] : transColor), + (_game.heversion == 70 ? 2 : 1), + &format); + } else { +#endif CursorMan.replaceCursor(_grabbedCursor, _cursor.width, _cursor.height, _cursor.hotspotX, _cursor.hotspotY, (_game.platform == Common::kPlatformNES ? _grabbedCursor[63] : transColor), (_game.heversion == 70 ? 2 : 1)); +#ifdef USE_RGB_COLOR + } #endif } diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp index ba13ff46d9..3e8c35cfd8 100644 --- a/engines/scumm/palette.cpp +++ b/engines/scumm/palette.cpp @@ -222,10 +222,12 @@ void ScummEngine::resetPalette() { if (_game.id == GID_INDY4 || _game.id == GID_MONKEY2) _townsClearLayerFlag = 0; #ifdef USE_RGB_COLOR - else if (_game.id == GID_LOOM) - towns_setTextPaletteFromPtr(tableTownsLoomPalette); - else if (_game.version == 3) - towns_setTextPaletteFromPtr(tableTownsV3Palette); + else if (_bytesPerPixelOutput == 2) { + if (_game.id == GID_LOOM) + towns_setTextPaletteFromPtr(tableTownsLoomPalette); + else if (_game.version == 3) + towns_setTextPaletteFromPtr(tableTownsV3Palette); + } #endif _townsScreen->toggleLayers(_townsActiveLayerFlags); @@ -1014,7 +1016,7 @@ void ScummEngine::setCurrentPalette(int palindex) { setPCEPaletteFromPtr(pals); #ifdef USE_RGB_COLOR #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE - } else if (_game.platform == Common::kPlatformFMTowns) { + } else if (_game.platform == Common::kPlatformFMTowns && _bytesPerPixelOutput == 2) { towns_setPaletteFromPtr(pals); #endif #endif @@ -1117,7 +1119,7 @@ void ScummEngine::updatePalette() { #ifdef USE_RGB_COLOR #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE - if (_game.platform == Common::kPlatformFMTowns) { + if (_game.platform == Common::kPlatformFMTowns && _bytesPerPixelOutput == 2) { p = palette_colors; for (i = first; i < first + num; ++i) { _16BitPalette[i] = get16BitColor(p[0], p[1], p[2]); diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 0a5338374e..97dd68af7c 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1156,8 +1156,15 @@ Common::Error ScummEngine::init() { #ifdef USE_RGB_COLOR Graphics::PixelFormat format = Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); initGraphics(screenWidth, screenHeight, screenWidth > 320, &format); - if (format != _system->getScreenFormat()) - return Common::kUnsupportedColorMode; + if (format != _system->getScreenFormat()) { + if (_game.platform == Common::kPlatformFMTowns && _game.version == 3) { + warning("Your ScummVM build does not support the type of 16bit color mode required by this target.\nStarting game in 8bit color mode...\nYou may experience color glitches"); + _bytesPerPixelOutput = 1; + initGraphics(screenWidth, screenHeight, (screenWidth > 320)); + } else { + return Common::kUnsupportedColorMode; + } + } #else if (_game.platform == Common::kPlatformFMTowns && _game.version == 3) { warning("Starting game without the required 16bit color support.\nYou may experience color glitches"); @@ -1364,8 +1371,7 @@ void ScummEngine::resetScumm() { #ifdef USE_RGB_COLOR if (_game.features & GF_16BIT_COLOR #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE - - || _game.platform == Common::kPlatformFMTowns + || (_game.platform == Common::kPlatformFMTowns && _bytesPerPixelOutput == 2) #endif ) _16BitPalette = (uint16 *)calloc(512, sizeof(uint16)); -- cgit v1.2.3