diff options
author | Martin Kiewitz | 2009-10-15 12:48:47 +0000 |
---|---|---|
committer | Martin Kiewitz | 2009-10-15 12:48:47 +0000 |
commit | f351295ebe115a0517eb9d43c8c050f59d5cd76f (patch) | |
tree | d228e4a9ed0dc1c73b2403343b8f08473c622a5d /engines | |
parent | 6e18ee5b8831cf7908b52f91767f239631cbd9e3 (diff) | |
download | scummvm-rg350-f351295ebe115a0517eb9d43c8c050f59d5cd76f.tar.gz scummvm-rg350-f351295ebe115a0517eb9d43c8c050f59d5cd76f.tar.bz2 scummvm-rg350-f351295ebe115a0517eb9d43c8c050f59d5cd76f.zip |
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
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/gui/gui_transitions.cpp | 120 | ||||
-rw-r--r-- | engines/sci/gui/gui_transitions.h | 25 |
2 files changed, 69 insertions, 76 deletions
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; |