From 73988683f299755395d048310a746b758c6b4a7d Mon Sep 17 00:00:00 2001 From: AndywinXp Date: Fri, 10 Nov 2023 16:34:33 +0100 Subject: [PATCH] SCUMM: INDY4 (DOS/Mac Jap): Implement accurate character shading This is taken from disasm. --- engines/scumm/charset.cpp | 23 ++++++++++++++++++++--- engines/scumm/scumm.cpp | 4 ++++ engines/scumm/scumm.h | 1 + 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp index 1d0247496f4..0c240085d5f 100644 --- a/engines/scumm/charset.cpp +++ b/engines/scumm/charset.cpp @@ -739,16 +739,33 @@ void CharsetRendererPC::drawBits1(Graphics::Surface &dest, int x, int y, const b int pitch = dest.pitch - width * dest.format.bytesPerPixel; byte *dst2 = dst + dest.pitch; + bool isIndy4Jap = _vm->_game.id == GID_INDY4 && _vm->_language == Common::JA_JPN && + (_vm->_game.platform == Common::kPlatformDOS || _vm->_game.platform == Common::kPlatformMacintosh); + + if (isIndy4Jap) { + // Characters allow shadows only if this is the main virtual screen, and we are not drawing + // a message on a GUI banner. The main menu is fine though, and allows shadows as well. + bool canDrawShadow = _vm->findVirtScreen(_top)->number == kMainVirtScreen && !_vm->isMessageBannerActive(); + enableShadow(canDrawShadow); + } + for (y = 0; y < height && y + drawTop < dest.h; y++) { for (x = 0; x < width; x++) { if ((x % 8) == 0) bits = *src++; if ((bits & revBitMask(x % 8)) && y + drawTop >= 0) { if (_enableShadow) { - if (_shadowType == kNormalShadowType) - dst[1] = dst2[0] = dst2[1] = _shadowColor; - else if (_shadowType == kHorizontalShadowType) + if (_shadowType == kNormalShadowType) { + dst[1] = dst2[1] = _shadowColor; + + // Mac and DOS/V versions of Japanese INDY4 don't + // draw a shadow pixel below the first pixel. + // Verified from disasm. + if (!isIndy4Jap) + dst2[0] = _shadowColor; + } else if (_shadowType == kHorizontalShadowType) { dst[1] = _shadowColor; + } } dst[0] = col; } else if (!(bits & revBitMask(x % 8)) && (y < height - 1) && diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 9f747c920da..e845c94da90 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -3682,6 +3682,10 @@ bool ScummEngine::isUsingOriginalGUI() { return _useOriginalGUI; } +bool ScummEngine::isMessageBannerActive() { + return _messageBannerActive; +} + void ScummEngine::runBootscript() { int args[NUM_SCRIPT_LOCAL]; memset(args, 0, sizeof(args)); diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index 73fc0d0a533..1ffa6698114 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -660,6 +660,7 @@ public: void pauseGame(); void restart(); bool isUsingOriginalGUI(); + bool isMessageBannerActive(); // For Indy4 Jap character shadows protected: Dialog *_pauseDialog = nullptr;