From 227f4a575f8802e05d58eb1dbb8033c64d0af48d Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Wed, 22 Jul 2009 09:52:44 +0000 Subject: [PATCH] Simplify fade code. svn-id: r42654 --- engines/agos/draw.cpp | 10 ++++------ engines/agos/script_s1.cpp | 13 +++++-------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/engines/agos/draw.cpp b/engines/agos/draw.cpp index 45443aa335a..368da5db831 100644 --- a/engines/agos/draw.cpp +++ b/engines/agos/draw.cpp @@ -871,13 +871,11 @@ void AGOSEngine::slowFadeIn() { _fastFadeInFlag &= ~0x8000; _paletteFlag = false; - memset(_videoBuf1, 0, 1024); - memcpy(_currentPalette, _displayPalette, 1024); - memcpy(_videoBuf1 + 1024, _displayPalette, 1024); + memset(_currentPalette, 0, sizeof(_currentPalette)); for (c = 255; c >= 0; c -= 4) { - src = _videoBuf1 + 1024; - dst = _videoBuf1; + src = _displayPalette; + dst = _currentPalette; for (p = _fastFadeInFlag; p !=0 ; p -= 3) { if (src[0] >= c) @@ -889,7 +887,7 @@ void AGOSEngine::slowFadeIn() { src += 4; dst += 4; } - _system->setPalette(_videoBuf1, 0, _fastFadeCount); + _system->setPalette(_currentPalette, 0, _fastFadeCount); delay(5); } _fastFadeInFlag = 0; diff --git a/engines/agos/script_s1.cpp b/engines/agos/script_s1.cpp index 2e3d936037e..81efb5cd81b 100644 --- a/engines/agos/script_s1.cpp +++ b/engines/agos/script_s1.cpp @@ -576,18 +576,15 @@ void AGOSEngine_Simon1::os1_specialFade() { // 187: fade to black uint i; - memcpy(_videoBuf1, _currentPalette, 4 * 256); - for (i = 32; i != 0; --i) { - paletteFadeOut(_videoBuf1, 32, 8); - paletteFadeOut(_videoBuf1 + 4 * 48, 144, 8); - paletteFadeOut(_videoBuf1 + 4 * 208, 48, 8); - _system->setPalette(_videoBuf1, 0, 256); + paletteFadeOut(_currentPalette, 32, 8); + paletteFadeOut(_currentPalette + 4 * 48, 144, 8); + paletteFadeOut(_currentPalette + 4 * 208, 48, 8); + _system->setPalette(_currentPalette, 0, 256); delay(5); } - memcpy(_currentPalette, _videoBuf1, 1024); - memcpy(_displayPalette, _videoBuf1, 1024); + memcpy(_displayPalette, _currentPalette, 1024); } void AGOSEngine::scriptMouseOff() {