From 749b0130a96c8af787737af1fbacc8b50350423f Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Tue, 15 Nov 2005 04:07:05 +0000 Subject: Fix palette glitches in FF, caused by fades. Some work on path finding differences in FF. svn-id: r19596 --- simon/game.cpp | 6 +-- simon/simon.cpp | 2 +- simon/simon.h | 4 +- simon/vga.cpp | 115 +++++++++++++++++++++++++++++++++++++++----------------- 4 files changed, 87 insertions(+), 40 deletions(-) diff --git a/simon/game.cpp b/simon/game.cpp index 0b0b6ed711..bbab8870ee 100644 --- a/simon/game.cpp +++ b/simon/game.cpp @@ -589,7 +589,7 @@ static GameDescription gameDescriptions[] = { FEEBLEFILES_GameFiles, GF_OLD_BUNDLE | GF_TALKIE, Common::EN_USA, - Common::kPlatformPC, + Common::kPlatformWindows, }, // The Feeble Files - English 4CD @@ -602,7 +602,7 @@ static GameDescription gameDescriptions[] = { FEEBLEFILES_GameFiles, GF_OLD_BUNDLE | GF_TALKIE, Common::EN_USA, - Common::kPlatformPC, + Common::kPlatformWindows, }, // The Feeble Files - German 4CD @@ -615,7 +615,7 @@ static GameDescription gameDescriptions[] = { FEEBLEFILES_GameFiles, GF_OLD_BUNDLE | GF_TALKIE, Common::DE_DEU, - Common::kPlatformPC, + Common::kPlatformWindows, }, }; diff --git a/simon/simon.cpp b/simon/simon.cpp index 648b3b7c8b..58a8106345 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -407,7 +407,7 @@ SimonEngine::SimonEngine(GameDetector *detector, OSystem *syst) _videoVar4 = 0; _videoVar5 = 0; - _videoVar3 = 0; + _fastFadeOutFlag = 0; _unkPalFlag = 0; _exitCutscene = 0; _skipSpeech = 0; diff --git a/simon/simon.h b/simon/simon.h index c2d4b98a7e..bfb5415130 100644 --- a/simon/simon.h +++ b/simon/simon.h @@ -314,7 +314,7 @@ protected: byte _videoVar4; bool _videoVar5; - bool _videoVar3; + bool _fastFadeOutFlag; bool _unkPalFlag; bool _exitCutscene; bool _skipSpeech; @@ -728,7 +728,7 @@ public: void vc58(); void vc59(); void vc60_killSprite(); - void vc61_changeSprite(); + void vc61_setMaskImage(); void vc62_fastFadeOut(); void vc63_fastFadeIn(); diff --git a/simon/vga.cpp b/simon/vga.cpp index e8126bc365..a925896d44 100644 --- a/simon/vga.cpp +++ b/simon/vga.cpp @@ -93,7 +93,7 @@ void SimonEngine::setupVgaOpcodes() { &SimonEngine::vc58, &SimonEngine::vc59, &SimonEngine::vc60_killSprite, - &SimonEngine::vc61_changeSprite, + &SimonEngine::vc61_setMaskImage, &SimonEngine::vc62_fastFadeOut, &SimonEngine::vc63_fastFadeIn, &SimonEngine::vc64_skipIfSpeechEnded, @@ -688,6 +688,8 @@ void SimonEngine::vc10_draw() { if (state.image < 0) state.image = vc_read_var(-state.image); + debug(1, "vc10_draw: image %d palette %d x %d y %d flags 0x0%x\n", state.image, state.palette, state.x, state.y, state.flags); + p2 = _curVgaFile2 + state.image * 8; state.depack_src = _curVgaFile2 + READ_BE_UINT32(p2); @@ -822,6 +824,8 @@ void SimonEngine::vc10_draw() { state.surf_addr = dx_lock_attached(); state.surf_pitch = _dxSurfacePitch; + memset(&_video_windows, 0, sizeof(_video_windows)); + { uint offs, offs2; // Allow one section of Simon the Sorcerer 1 introduction to be displayed @@ -1237,6 +1241,7 @@ void SimonEngine::vc22_setSpritePalette() { byte *palptr, *src; if (getGameType() == GType_FF) { + a = 0; num = 256; palSize = 768; } @@ -1554,33 +1559,70 @@ void SimonEngine::vc47_addToVar() { void SimonEngine::vc48_setPathFinder() { uint a = (uint16)_variableArray[12]; - uint b = (uint16)_variableArray[13]; - int c = _variableArray[14]; const uint16 *p = _pathFindArray[a - 1]; - int step; - int y1, y2; - int16 *vp; - p += b * 2 + 1; + if (getGameType() == GType_FF) { + VgaSprite *vsp = find_cur_sprite(); + int x, y, y1, y2, ydiff, count = 0; - step = 2; - if (c < 0) { - c = -c; - step = -2; - } + while(vsp->x > readUint16Wrapper(p + 2)) { + p += 2; + count++; + } - vp = &_variableArray[20]; + y1 = readUint16Wrapper(p + 1); + y2 = readUint16Wrapper(p + 3); + + if (y2 != 9999) { + ydiff = y2 - y1; + if (ydiff < 0) { + ydiff = - ydiff; + x = vsp->x & 7; + ydiff *= x; + ydiff /= 8; + ydiff = -ydiff; + } else { + x = vsp->x & 7; + ydiff *= x; + ydiff /= 8; + } + y1 += ydiff; + } - do { - y2 = readUint16Wrapper(p); - p += step; - y1 = readUint16Wrapper(p) - y2; + y = vsp->y; + vsp->y = y1; + //checkScrollY(y, diff); - vp[0] = y1 / 2; - vp[1] = y1 - (y1 / 2); + _variableArray[11] = readUint16Wrapper(p); + _variableArray[13] = count; + } else { + uint b = (uint16)_variableArray[13]; + p += b * 2 + 1; + int c = _variableArray[14]; + + int step; + int y1, y2; + int16 *vp; + + step = 2; + if (c < 0) { + c = -c; + step = -2; + } - vp += 2; - } while (--c); + vp = &_variableArray[20]; + + do { + y2 = readUint16Wrapper(p); + p += step; + y1 = readUint16Wrapper(p) - y2; + + vp[0] = y1 / 2; + vp[1] = y1 - (y1 / 2); + + vp += 2; + } while (--c); + } } void SimonEngine::vc_set_bit_to(uint bit, bool value) { @@ -1771,7 +1813,7 @@ void SimonEngine::vc60_killSprite() { vc_kill_sprite(file, sprite); } -void SimonEngine::vc61_changeSprite() { +void SimonEngine::vc61_setMaskImage() { VgaSprite *vsp = find_cur_sprite(); vsp->image = vc_read_var_or_word(); @@ -1788,12 +1830,14 @@ void SimonEngine::vc62_fastFadeOut() { vc29_stopAllSounds(); - if (!_videoVar3) { - _videoVar3 = true; + if (!_fastFadeOutFlag) { + _fastFadeOutFlag = true; _videoNumPalColors = 256; - if (_windowNum == 4) - _videoNumPalColors = 208; + if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) { + if (_windowNum == 4) + _videoNumPalColors = 208; + } memcpy(_videoBuf1, _paletteBackup, _videoNumPalColors * 4); for (i = NUM_PALETTE_FADEOUT; i != 0; --i) { @@ -1858,11 +1902,15 @@ void SimonEngine::vc62_fastFadeOut() { } void SimonEngine::vc63_fastFadeIn() { - _paletteColorCount = 208; - if (_windowNum != 4) { - _paletteColorCount = 256; + if (getGameType() == GType_FF) { + _paletteColorCount = 256; + } else { + _paletteColorCount = 208; + if (_windowNum != 4) { + _paletteColorCount = 256; + } } - _videoVar3 = false; + _fastFadeOutFlag = false; } void SimonEngine::vc64_skipIfSpeechEnded() { @@ -1880,7 +1928,7 @@ void SimonEngine::vc65_slowFadeIn() { _videoNumPalColors = 256; } _paletteColorCount |= 0x8000; - _videoVar3 = false; + _fastFadeOutFlag = false; } void SimonEngine::vc66_skipIfNotEqual() { @@ -2041,15 +2089,14 @@ void SimonEngine::vc78_computeXY() { const uint16 *p = _pathFindArray[a - 1]; p += b * 2; - uint16 posx = READ_LE_UINT16(p); + uint posx = readUint16Wrapper(p); _variableArray[15] = posx; vsp->x = posx; - uint16 posy = READ_LE_UINT16(p + 2); + uint posy = readUint16Wrapper(p + 1); _variableArray[16] = posy; vsp->y = posy; - vc_set_bit_to(85, false); if (vc_get_bit(74) == true) { //centreScroll(); -- cgit v1.2.3