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.
This commit is contained in:
athrxx 2011-06-15 17:12:17 +02:00
parent 38c9988938
commit 5b7754e3f0
3 changed files with 29 additions and 17 deletions

View File

@ -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
}

View File

@ -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]);

View File

@ -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));