From e3cb949b95b1b6caa4239c4ee15ebcc6dec8063a Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Tue, 12 Apr 2016 21:51:36 +0100 Subject: DRASCULA: Fix wrong background for inventory in chapter 6 This was a regression from commit fa3d3e3 and this fixes part of bug #7113 DRASCULA: Serious sprite glitches. The original uses extraSurface to draw text in draw_abc() in the Spanish version while other languages use tableSurface. But in ScummVM this was changed to use tableSurface for all languages. However this caused an issue in chapter 6 when displaying the inventory has it is also using tableSurface, as it was for all languages in the original. While using the same surface works for other languages, in the Spanish version we get the wrong background in the inventory. Rather than revert to using extraSurface for drawing text which is a big change and impact all the chapters, I have opted to simply swap the usage of the tableSurface and extraSurface in chapter 6 for the Spanish version compared to the original engine. The changes therefore only impact chapter 6 and only the Spanish version. I played the chapter in full to check that it indeed works without causing adverse effects. --- engines/drascula/actors.cpp | 20 ++++++++++++-------- engines/drascula/animation.cpp | 4 ++-- engines/drascula/drascula.cpp | 7 +++++-- engines/drascula/interface.cpp | 9 +++++++++ engines/drascula/rooms.cpp | 2 +- engines/drascula/sound.cpp | 17 ++++++++++------- engines/drascula/talk.cpp | 10 ++++++++-- 7 files changed, 47 insertions(+), 22 deletions(-) (limited to 'engines') diff --git a/engines/drascula/actors.cpp b/engines/drascula/actors.cpp index b459c4539b..a1f2c5386c 100644 --- a/engines/drascula/actors.cpp +++ b/engines/drascula/actors.cpp @@ -196,6 +196,10 @@ void DrasculaEngine::moveCharacters() { return; } } + + byte *srcSurface = extraSurface; + if (currentChapter == 6 && _lang == kSpanish) + srcSurface = tableSurface; if (characterMoved == 0) { curPos[0] = 0; @@ -214,17 +218,17 @@ void DrasculaEngine::moveCharacters() { curPos[1] = 0; if (currentChapter == 2) copyRect(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5], - extraSurface, screenSurface); + srcSurface, screenSurface); else reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5], - factor_red[curY + curHeight], extraSurface, screenSurface); + factor_red[curY + curHeight], srcSurface, screenSurface); } else if (trackProtagonist == 1) { if (currentChapter == 2) copyRect(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5], - extraSurface, screenSurface); + srcSurface, screenSurface); else reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5], - factor_red[curY + curHeight], extraSurface, screenSurface); + factor_red[curY + curHeight], srcSurface, screenSurface); } else if (trackProtagonist == 2) { if (currentChapter == 2) copyRect(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5], @@ -256,17 +260,17 @@ void DrasculaEngine::moveCharacters() { curPos[1] = 0; if (currentChapter == 2) copyRect(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5], - extraSurface, screenSurface); + srcSurface, screenSurface); else reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5], - factor_red[curY + curHeight], extraSurface, screenSurface); + factor_red[curY + curHeight], srcSurface, screenSurface); } else if (trackProtagonist == 1) { if (currentChapter == 2) copyRect(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5], - extraSurface, screenSurface); + srcSurface, screenSurface); else reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5], - factor_red[curY + curHeight], extraSurface, screenSurface); + factor_red[curY + curHeight], srcSurface, screenSurface); } else if (trackProtagonist == 2) { if (currentChapter == 2) copyRect(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5], diff --git a/engines/drascula/animation.cpp b/engines/drascula/animation.cpp index 439253e5d6..5901d57b1f 100644 --- a/engines/drascula/animation.cpp +++ b/engines/drascula/animation.cpp @@ -1611,7 +1611,7 @@ void DrasculaEngine::animation_6_6() { removeObject(20); loadPic(96, frontSurface); loadPic(97, frontSurface); - loadPic(97, extraSurface); + loadPic(97, _lang == kSpanish ? tableSurface : extraSurface); loadPic(99, backSurface); doBreak = 1; objExit = 104; @@ -2215,7 +2215,7 @@ void DrasculaEngine::activatePendulum() { _roomNumber = 102; loadPic(102, bgSurface, HALF_PAL); loadPic("an_p1.alg", drawSurface3); - loadPic("an_p2.alg", extraSurface); + loadPic("an_p2.alg", _lang == kSpanish ? tableSurface : extraSurface); loadPic("an_p3.alg", frontSurface); copyBackground(0, 171, 0, 0, OBJWIDTH, OBJHEIGHT, backSurface, drawSurface3); diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index b821e7dbbe..c2ea761164 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -366,12 +366,15 @@ Common::Error DrasculaEngine::run() { memcpy(crosshairCursor + i * 40, tableSurface + 225 + (56 + i) * 320, 40); if (_lang == kSpanish) - loadPic(974, tableSurface); + loadPic(currentChapter == 6 ? 97 : 974, tableSurface); if (currentChapter != 2) { loadPic(99, cursorSurface); loadPic(99, backSurface); - loadPic(97, extraSurface); + if (currentChapter == 6 && _lang == kSpanish) + loadPic(95, extraSurface); + else + loadPic(97, extraSurface); } memset(iconName, 0, sizeof(iconName)); diff --git a/engines/drascula/interface.cpp b/engines/drascula/interface.cpp index 07f192cd4c..a09b9da07d 100644 --- a/engines/drascula/interface.cpp +++ b/engines/drascula/interface.cpp @@ -123,6 +123,15 @@ void DrasculaEngine::showMenu() { int h, n, x; byte *srcSurface = (currentChapter == 6) ? tableSurface : frontSurface; x = whichObject(); + + // The original uses extraSurface to draw text in draw_abc() in the Spanish version + // while other languages use tableSurface. Here all language use tableSurface for + // chapter 6. However the code in ScummVM was changed to use tableSurface for all + // labguage in draw_abc(). So instead here for the Spanish version we use extraSurface. + // Compared to the original the use of the tableSurface and extraSurface has been swapped + // for the Spanish language all through chapter 6. + if (currentChapter == 6 && _lang == kSpanish) + srcSurface = extraSurface; for (n = 1; n < ARRAYSIZE(inventoryObjects); n++) { h = inventoryObjects[n]; diff --git a/engines/drascula/rooms.cpp b/engines/drascula/rooms.cpp index 57d4517295..acfc528b0c 100644 --- a/engines/drascula/rooms.cpp +++ b/engines/drascula/rooms.cpp @@ -1501,7 +1501,7 @@ void DrasculaEngine::update_102() { if (actorFrames[kFramePendulum] <= 4) pendulumSurface = drawSurface3; else if (actorFrames[kFramePendulum] <= 11) - pendulumSurface = extraSurface; + pendulumSurface = _lang == kSpanish ? tableSurface : extraSurface; else pendulumSurface = frontSurface; diff --git a/engines/drascula/sound.cpp b/engines/drascula/sound.cpp index c576b37660..6c0c171664 100644 --- a/engines/drascula/sound.cpp +++ b/engines/drascula/sound.cpp @@ -44,10 +44,13 @@ void DrasculaEngine::updateVolume(Audio::Mixer::SoundType soundType, int prevVol } void DrasculaEngine::volumeControls() { + byte* srcSurface = tableSurface; + if (currentChapter == 6 && _lang == kSpanish) + srcSurface = extraSurface; if (_lang == kSpanish) - loadPic(95, tableSurface); + loadPic(95, srcSurface); - copyRect(1, 56, 73, 63, 177, 97, tableSurface, screenSurface); + copyRect(1, 56, 73, 63, 177, 97, srcSurface, screenSurface); updateScreen(73, 63, 73, 63, 177, 97, screenSurface); setCursor(kCursorCrosshair); @@ -64,11 +67,11 @@ void DrasculaEngine::volumeControls() { updateRoom(); - copyRect(1, 56, 73, 63, 177, 97, tableSurface, screenSurface); + copyRect(1, 56, 73, 63, 177, 97, srcSurface, screenSurface); - copyBackground(183, 56, 82, masterVolumeY, 39, 2 + masterVolume * 4, tableSurface, screenSurface); - copyBackground(183, 56, 138, voiceVolumeY, 39, 2 + voiceVolume * 4, tableSurface, screenSurface); - copyBackground(183, 56, 194, musicVolumeY, 39, 2 + musicVolume * 4, tableSurface, screenSurface); + copyBackground(183, 56, 82, masterVolumeY, 39, 2 + masterVolume * 4, srcSurface, screenSurface); + copyBackground(183, 56, 138, voiceVolumeY, 39, 2 + voiceVolume * 4, srcSurface, screenSurface); + copyBackground(183, 56, 194, musicVolumeY, 39, 2 + musicVolume * 4, srcSurface, screenSurface); updateScreen(); @@ -102,7 +105,7 @@ void DrasculaEngine::volumeControls() { } if (_lang == kSpanish) - loadPic(974, tableSurface); + loadPic(currentChapter == 6 ? 95 : 974, srcSurface); selectVerb(kVerbNone); diff --git a/engines/drascula/talk.cpp b/engines/drascula/talk.cpp index cc329b206b..3176c5e0f3 100644 --- a/engines/drascula/talk.cpp +++ b/engines/drascula/talk.cpp @@ -440,9 +440,12 @@ void DrasculaEngine::talk(const char *said, const char *filename) { copyRect(x_talk_izq[face], y_mask_talk, curX + 8, curY - 1, TALK_WIDTH, TALK_HEIGHT, extraSurface, screenSurface); else if (notTowers) { + byte *srcSurface = extraSurface; + if (currentChapter == 6 && _lang == kSpanish) + srcSurface = tableSurface; reduce_hare_chico(x_talk_izq[face], y_mask_talk, curX + (int)((8.0f / 100) * factor_red[MIN(201, curY + curHeight)]), curY, TALK_WIDTH, TALK_HEIGHT, factor_red[MIN(201, curY + curHeight)], - extraSurface, screenSurface); + srcSurface, screenSurface); } updateRefresh(); } else if (trackProtagonist == 1) { @@ -450,8 +453,11 @@ void DrasculaEngine::talk(const char *said, const char *filename) { copyRect(x_talk_dch[face], y_mask_talk, curX + 12, curY, TALK_WIDTH, TALK_HEIGHT, extraSurface, screenSurface); else if (notTowers) { + byte *srcSurface = extraSurface; + if (currentChapter == 6 && _lang == kSpanish) + srcSurface = tableSurface; reduce_hare_chico(x_talk_dch[face], y_mask_talk, curX + (int)((12.0f / 100) * factor_red[MIN(201, curY + curHeight)]), - curY, TALK_WIDTH, TALK_HEIGHT, factor_red[MIN(201, curY + curHeight)], extraSurface, screenSurface); + curY, TALK_WIDTH, TALK_HEIGHT, factor_red[MIN(201, curY + curHeight)], srcSurface, screenSurface); } updateRefresh(); } else if (trackProtagonist == 2) { -- cgit v1.2.3