From f351295ebe115a0517eb9d43c8c050f59d5cd76f Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Thu, 15 Oct 2009 12:48:47 +0000 Subject: SCI/newgui: SciGuiTransitions now translates old IDs to new IDs, also changed that new IDs will get used from SCI1_LATE upwards svn-id: r45115 --- engines/sci/gui/gui_transitions.cpp | 120 ++++++++++++++++++------------------ engines/sci/gui/gui_transitions.h | 25 +++----- 2 files changed, 69 insertions(+), 76 deletions(-) (limited to 'engines') diff --git a/engines/sci/gui/gui_transitions.cpp b/engines/sci/gui/gui_transitions.cpp index b6f04fb003..480a6dd97e 100644 --- a/engines/sci/gui/gui_transitions.cpp +++ b/engines/sci/gui/gui_transitions.cpp @@ -46,8 +46,25 @@ SciGuiTransitions::~SciGuiTransitions() { delete[] _oldScreen; } +// This table contains a mapping between oldIDs (prior SCI1LATE) and newIDs +byte oldTransitionIDs[256][2] = { + { 8, SCI_TRANSITIONS_BLOCKS }, + { 18, SCI_TRANSITIONS_PIXELATION }, + { 30, SCI_TRANSITIONS_FADEPALETTE }, + { 40, SCI_TRANSITIONS_SCROLLRIGHT }, + { 41, SCI_TRANSITIONS_SCROLLLEFT }, + { 42, SCI_TRANSITIONS_SCROLLUP }, + { 43, SCI_TRANSITIONS_SCROLLDOWN }, + { 255, 255 } +}; + void SciGuiTransitions::init() { _oldScreen = new byte[_screen->_displayHeight * _screen->_displayWidth]; + + if (getSciVersion() >= SCI_VERSION_1_LATE) + _translationTable = NULL; + else + _translationTable = (byte *)&oldTransitionIDs; } void SciGuiTransitions::setup(int16 number, bool blackoutFlag) { @@ -56,72 +73,58 @@ void SciGuiTransitions::setup(int16 number, bool blackoutFlag) { } void SciGuiTransitions::doit(Common::Rect picRect) { + byte *translationPtr; + _picRect = picRect; - if (_isVGA) { - // === VGA transitions - switch (_number) { - case SCI_TRANSITIONS_VGA_PIXELATION: - setNewPalette(); pixelation(); - break; - - case SCI_TRANSITIONS_VGA_BLOCKS: - setNewPalette(); blocks(); - break; - - case SCI_TRANSITIONS_VGA_FADEPALETTE: - fadeOut(); setNewScreen(); fadeIn(); - break; - - case SCI_TRANSITIONS_VGA_SCROLLRIGHT: - setNewPalette(); scroll(SCI_TRANSITIONS_SCROLL_RIGHT); - break; - case SCI_TRANSITIONS_VGA_SCROLLLEFT: - setNewPalette(); scroll(SCI_TRANSITIONS_SCROLL_LEFT); - break; - case SCI_TRANSITIONS_VGA_SCROLLUP: - setNewPalette(); scroll(SCI_TRANSITIONS_SCROLL_UP); - break; - - default: - warning("SciGuiTransitions: VGA-%d not implemented", _number); - setNewPalette(); setNewScreen(); - } - } else { - // === EGA transitions - switch (_number) { - case SCI_TRANSITIONS_EGA_PIXELATION: - pixelation(); - break; - - case SCI_TRANSITIONS_EGA_BLOCKS: - blocks(); - break; - - case SCI_TRANSITIONS_EGA_FADEPALETTE: - fadeOut(); setNewScreen(); fadeIn(); - break; - - case SCI_TRANSITIONS_EGA_SCROLLRIGHT: - scroll(SCI_TRANSITIONS_SCROLL_RIGHT); - break; - case SCI_TRANSITIONS_EGA_SCROLLLEFT: - scroll(SCI_TRANSITIONS_SCROLL_LEFT); - break; - case SCI_TRANSITIONS_EGA_SCROLLUP: - scroll(SCI_TRANSITIONS_SCROLL_UP); - break; - - default: - warning("SciGuiTransitions: EGA-%d not implemented", _number); - setNewScreen(); + if (_translationTable) { + // We need to translate the ID + translationPtr = _translationTable; + while (*translationPtr != 255) { + if (*translationPtr == _number) { + translationPtr++; _number = *translationPtr; + break; + } + translationPtr += 2; } + if (*translationPtr == 255) + _number = 255; + } + + switch (_number) { + case SCI_TRANSITIONS_PIXELATION: + setNewPalette(); pixelation(); + break; + + case SCI_TRANSITIONS_BLOCKS: + setNewPalette(); blocks(); + break; + + case SCI_TRANSITIONS_FADEPALETTE: + fadeOut(); setNewScreen(); fadeIn(); + break; + + case SCI_TRANSITIONS_SCROLLRIGHT: + setNewPalette(); scroll(SCI_TRANSITIONS_SCROLL_RIGHT); + break; + case SCI_TRANSITIONS_SCROLLLEFT: + setNewPalette(); scroll(SCI_TRANSITIONS_SCROLL_LEFT); + break; + case SCI_TRANSITIONS_SCROLLUP: + setNewPalette(); scroll(SCI_TRANSITIONS_SCROLL_UP); + break; + + default: + warning("SciGuiTransitions: ID %d not implemented", _number); + setNewPalette(); setNewScreen(); } + _screen->_picNotValid = 0; } void SciGuiTransitions::setNewPalette() { - _palette->setOnScreen(); + if (_isVGA) + _palette->setOnScreen(); } void SciGuiTransitions::setNewScreen() { @@ -149,7 +152,6 @@ void SciGuiTransitions::fadeOut() { // Note: dont do too many steps in here, otherwise cpu will crap out because of the load void SciGuiTransitions::fadeIn() { - byte workPalette[4 * 256]; GuiPalette *newPalette = &_palette->_sysPalette; int16 stepNr; diff --git a/engines/sci/gui/gui_transitions.h b/engines/sci/gui/gui_transitions.h index 5aabc22ee7..6c0594ff7c 100644 --- a/engines/sci/gui/gui_transitions.h +++ b/engines/sci/gui/gui_transitions.h @@ -31,23 +31,13 @@ namespace Sci { enum { - SCI_TRANSITIONS_EGA_BLOCKS = 8, - SCI_TRANSITIONS_EGA_PIXELATION = 18, - SCI_TRANSITIONS_EGA_FADEPALETTE = 30, - SCI_TRANSITIONS_EGA_SCROLLRIGHT = 40, - SCI_TRANSITIONS_EGA_SCROLLLEFT = 41, - SCI_TRANSITIONS_EGA_SCROLLUP = 42, - SCI_TRANSITIONS_EGA_SCROLLDOWN = 43 -}; - -enum { - SCI_TRANSITIONS_VGA_BLOCKS = 8, - SCI_TRANSITIONS_VGA_PIXELATION = 9, - SCI_TRANSITIONS_VGA_FADEPALETTE = 10, - SCI_TRANSITIONS_VGA_SCROLLRIGHT = 11, - SCI_TRANSITIONS_VGA_SCROLLLEFT = 12, - SCI_TRANSITIONS_VGA_SCROLLUP = 13, - SCI_TRANSITIONS_VGA_SCROLLDOWN = 14 + SCI_TRANSITIONS_BLOCKS = 8, + SCI_TRANSITIONS_PIXELATION = 9, + SCI_TRANSITIONS_FADEPALETTE = 10, + SCI_TRANSITIONS_SCROLLRIGHT = 11, + SCI_TRANSITIONS_SCROLLLEFT = 12, + SCI_TRANSITIONS_SCROLLUP = 13, + SCI_TRANSITIONS_SCROLLDOWN = 14 }; enum { @@ -80,6 +70,7 @@ private: SciGuiPalette *_palette; bool _isVGA; + byte *_translationTable; int16 _number; bool _blackoutFlag; Common::Rect _picRect; -- cgit v1.2.3