From 1b5e96f42903b0cf3a5456e85a09c2c01eef0538 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 11 Nov 2012 23:31:25 +0200 Subject: SAGA: Fix bug #3564919 - "SAGA: IHNM Spanish: Spiritual Barometer doesn't change" The Spanish version uses different colors for portrait backgrounds. Also, portrait colors are now set correctly when loading games directly from the launcher. --- engines/saga/events.cpp | 19 ++++++++++++++----- engines/saga/saga.h | 4 +--- engines/saga/sfuncs_ihnm.cpp | 18 +++++++++++++----- 3 files changed, 28 insertions(+), 13 deletions(-) (limited to 'engines/saga') diff --git a/engines/saga/events.cpp b/engines/saga/events.cpp index ec3ef2f6f9..d98cef0740 100644 --- a/engines/saga/events.cpp +++ b/engines/saga/events.cpp @@ -332,13 +332,22 @@ int Events::handleOneShot(Event *event) { #ifdef ENABLE_IHNM if (_vm->getGameId() == GID_IHNM) { + PalEntry portraitBgColor = _vm->_interface->_portraitBgColor; + byte portraitColor = (_vm->getLanguage() == Common::ES_ESP) ? 253 : 254; + + // Set the portrait bg color, in case a saved state is restored from the + // launcher. In this case, sfSetPortraitBgColor is not called, thus the + // portrait color will always be 0 (black). + if (portraitBgColor.red == 0 && portraitBgColor.green == 0 && portraitBgColor.blue == 0) + portraitBgColor.green = 255; + if (_vm->_spiritualBarometer > 255) - _vm->_gfx->setPaletteColor(kIHNMColorPortrait, 0xff, 0xff, 0xff); + _vm->_gfx->setPaletteColor(portraitColor, 0xff, 0xff, 0xff); else - _vm->_gfx->setPaletteColor(kIHNMColorPortrait, - _vm->_spiritualBarometer * _vm->_interface->_portraitBgColor.red / 256, - _vm->_spiritualBarometer * _vm->_interface->_portraitBgColor.green / 256, - _vm->_spiritualBarometer * _vm->_interface->_portraitBgColor.blue / 256); + _vm->_gfx->setPaletteColor(portraitColor, + _vm->_spiritualBarometer * portraitBgColor.red / 256, + _vm->_spiritualBarometer * portraitBgColor.green / 256, + _vm->_spiritualBarometer * portraitBgColor.blue / 256); } #endif diff --git a/engines/saga/saga.h b/engines/saga/saga.h index 829425aeaf..01cab21f5d 100644 --- a/engines/saga/saga.h +++ b/engines/saga/saga.h @@ -395,9 +395,7 @@ enum ColorId { kITEColorBlue = 0x93, kITEColorLightBlue94 = 0x94, kITEColorLightBlue96 = 0x96, - kITEColorGreen = 0xba, - - kIHNMColorPortrait = 0xfe + kITEColorGreen = 0xba }; enum KnownColor { diff --git a/engines/saga/sfuncs_ihnm.cpp b/engines/saga/sfuncs_ihnm.cpp index 3fbf3b6e67..fdfd0fdf2c 100644 --- a/engines/saga/sfuncs_ihnm.cpp +++ b/engines/saga/sfuncs_ihnm.cpp @@ -168,17 +168,25 @@ void Script::sfSetChapterPoints(SCRIPTFUNC_PARAMS) { _vm->_ethicsPoints[chapter] = thread->pop(); int16 barometer = thread->pop(); static PalEntry cur_pal[PAL_ENTRIES]; + PalEntry portraitBgColor = _vm->_interface->_portraitBgColor; + byte portraitColor = (_vm->getLanguage() == Common::ES_ESP) ? 253 : 254; _vm->_spiritualBarometer = _vm->_ethicsPoints[chapter] * 256 / barometer; _vm->_scene->setChapterPointsChanged(true); // don't save this music when saving in IHNM + // Set the portrait bg color, in case a saved state is restored from the + // launcher. In this case, sfSetPortraitBgColor is not called, thus the + // portrait color will always be 0 (black). + if (portraitBgColor.red == 0 && portraitBgColor.green == 0 && portraitBgColor.blue == 0) + portraitBgColor.green = 255; + if (_vm->_spiritualBarometer > 255) - _vm->_gfx->setPaletteColor(kIHNMColorPortrait, 0xff, 0xff, 0xff); + _vm->_gfx->setPaletteColor(portraitColor, 0xff, 0xff, 0xff); else - _vm->_gfx->setPaletteColor(kIHNMColorPortrait, - _vm->_spiritualBarometer * _vm->_interface->_portraitBgColor.red / 256, - _vm->_spiritualBarometer * _vm->_interface->_portraitBgColor.green / 256, - _vm->_spiritualBarometer * _vm->_interface->_portraitBgColor.blue / 256); + _vm->_gfx->setPaletteColor(portraitColor, + _vm->_spiritualBarometer * portraitBgColor.red / 256, + _vm->_spiritualBarometer * portraitBgColor.green / 256, + _vm->_spiritualBarometer * portraitBgColor.blue / 256); _vm->_gfx->getCurrentPal(cur_pal); _vm->_gfx->setPalette(cur_pal); -- cgit v1.2.3