SCI/newgui: transitions now also support horizontalRoll (e.g. qfg1ega), cleanup, oldIdTable now also supports blackoutFlag

svn-id: r45134
This commit is contained in:
Martin Kiewitz 2009-10-15 22:01:57 +00:00
parent 93587aad89
commit 6ade594794
2 changed files with 87 additions and 32 deletions

View file

@ -47,15 +47,19 @@ SciGuiTransitions::~SciGuiTransitions() {
} }
// This table contains a mapping between oldIDs (prior SCI1LATE) and newIDs // This table contains a mapping between oldIDs (prior SCI1LATE) and newIDs
byte oldTransitionIDs[256][2] = { static const GuiTransitionTranslateEntry oldTransitionIDs[] = {
{ 8, SCI_TRANSITIONS_BLOCKS }, { 1, SCI_TRANSITIONS_HORIZONTALROLLFROMCENTER, false },
{ 18, SCI_TRANSITIONS_PIXELATION }, { 8, SCI_TRANSITIONS_BLOCKS, false },
{ 30, SCI_TRANSITIONS_FADEPALETTE }, { 10, SCI_TRANSITIONS_HORIZONTALROLLTOCENTER, false },
{ 40, SCI_TRANSITIONS_SCROLLRIGHT }, { 17, SCI_TRANSITIONS_BLOCKS, true },
{ 41, SCI_TRANSITIONS_SCROLLLEFT }, { 18, SCI_TRANSITIONS_PIXELATION, false },
{ 42, SCI_TRANSITIONS_SCROLLUP }, { 27, SCI_TRANSITIONS_PIXELATION, true },
{ 43, SCI_TRANSITIONS_SCROLLDOWN }, { 30, SCI_TRANSITIONS_FADEPALETTE, false },
{ 255, 255 } { 40, SCI_TRANSITIONS_SCROLLRIGHT, false },
{ 41, SCI_TRANSITIONS_SCROLLLEFT, false },
{ 42, SCI_TRANSITIONS_SCROLLUP, false },
{ 43, SCI_TRANSITIONS_SCROLLDOWN, false },
{ 255, 255, false }
}; };
void SciGuiTransitions::init() { void SciGuiTransitions::init() {
@ -64,7 +68,7 @@ void SciGuiTransitions::init() {
if (getSciVersion() >= SCI_VERSION_1_LATE) if (getSciVersion() >= SCI_VERSION_1_LATE)
_translationTable = NULL; _translationTable = NULL;
else else
_translationTable = (byte *)&oldTransitionIDs; _translationTable = oldTransitionIDs;
} }
void SciGuiTransitions::setup(int16 number, bool blackoutFlag) { void SciGuiTransitions::setup(int16 number, bool blackoutFlag) {
@ -73,29 +77,39 @@ void SciGuiTransitions::setup(int16 number, bool blackoutFlag) {
} }
void SciGuiTransitions::doit(Common::Rect picRect) { void SciGuiTransitions::doit(Common::Rect picRect) {
byte *translationPtr; const GuiTransitionTranslateEntry *translationEntry = _translationTable;
_picRect = picRect; _picRect = picRect;
if (_translationTable) { if (translationEntry) {
// We need to translate the ID // We need to translate the ID
translationPtr = _translationTable; while (1) {
while (*translationPtr != 255) { if (translationEntry->oldId == 255) {
if (*translationPtr == _number) {
translationPtr++; _number = *translationPtr;
break;
}
translationPtr += 2;
}
if (*translationPtr == 255) {
warning("SciGuiTransitions: old ID %d not supported", _number); warning("SciGuiTransitions: old ID %d not supported", _number);
setNewPalette(); setNewScreen(); setNewPalette(); setNewScreen();
_screen->_picNotValid = 0; _screen->_picNotValid = 0;
return; return;
} }
if (translationEntry->oldId == _number) {
_number = translationEntry->realId;
_blackoutFlag = translationEntry->blackoutFlag;
break;
}
translationEntry++;
}
} }
if (_blackoutFlag)
warning("SciGuiTransitions: blackout flag currently not supported");
switch (_number) { switch (_number) {
case SCI_TRANSITIONS_HORIZONTALROLLFROMCENTER:
setNewPalette(); horizontalRollFromCenter();
break;
case SCI_TRANSITIONS_HORIZONTALROLLTOCENTER:
setNewPalette(); horizontalRollToCenter();
break;
case SCI_TRANSITIONS_PIXELATION: case SCI_TRANSITIONS_PIXELATION:
setNewPalette(); pixelation(); setNewPalette(); pixelation();
break; break;
@ -201,7 +215,7 @@ void SciGuiTransitions::blocks() {
} while (mask != 0x40); } while (mask != 0x40);
} }
// scroll old screen (up/down/left/right) and insert new screen that way - works on _picRect area // scroll old screen (up/down/left/right) and insert new screen that way - works on _picRect area only
void SciGuiTransitions::scroll() { void SciGuiTransitions::scroll() {
int16 screenWidth, screenHeight; int16 screenWidth, screenHeight;
byte *oldScreenPtr; byte *oldScreenPtr;
@ -282,4 +296,34 @@ void SciGuiTransitions::scroll() {
} }
} }
// horizontally displays new screen starting from center - works on _picRect area only
void SciGuiTransitions::horizontalRollFromCenter() {
Common::Rect upperRect = Common::Rect(_picRect.left, _picRect.top + (_picRect.height() / 2) - 1, _picRect.right, _picRect.top + (_picRect.height() / 2));
Common::Rect lowerRect = Common::Rect(upperRect.left, upperRect.bottom, upperRect.right, upperRect.bottom + 1);
while ((upperRect.top > _picRect.top) && (lowerRect.bottom < _picRect.bottom)) {
if (upperRect.top < _picRect.top)
upperRect.translate(0, 1);
if (lowerRect.bottom > _picRect.bottom)
lowerRect.translate(0, -1);
_screen->copyRectToScreen(upperRect); upperRect.translate(0, -1);
_screen->copyRectToScreen(lowerRect); lowerRect.translate(0, 1);
g_system->updateScreen();
g_system->delayMillis(3);
}
}
// horizontally displays new screen starting from upper and lower edge - works on _picRect area only
void SciGuiTransitions::horizontalRollToCenter() {
Common::Rect upperRect = Common::Rect(_picRect.left, _picRect.top, _picRect.right, _picRect.top + 1);
Common::Rect lowerRect = Common::Rect(upperRect.left, _picRect.bottom - 1, upperRect.right, _picRect.bottom);
while (upperRect.top < lowerRect.bottom) {
_screen->copyRectToScreen(upperRect); upperRect.translate(0, 1);
_screen->copyRectToScreen(lowerRect); lowerRect.translate(0, -1);
g_system->updateScreen();
g_system->delayMillis(3);
}
}
} // End of namespace Sci } // End of namespace Sci

View file

@ -30,14 +30,23 @@
namespace Sci { namespace Sci {
struct GuiTransitionTranslateEntry {
int16 oldId;
int16 realId;
bool blackoutFlag;
};
enum { enum {
SCI_TRANSITIONS_HORIZONTALROLLFROMCENTER = 1,
SCI_TRANSITIONS_BLOCKS = 8, SCI_TRANSITIONS_BLOCKS = 8,
SCI_TRANSITIONS_PIXELATION = 9, SCI_TRANSITIONS_PIXELATION = 9,
SCI_TRANSITIONS_FADEPALETTE = 10, SCI_TRANSITIONS_FADEPALETTE = 10,
SCI_TRANSITIONS_SCROLLRIGHT = 11, SCI_TRANSITIONS_SCROLLRIGHT = 11,
SCI_TRANSITIONS_SCROLLLEFT = 12, SCI_TRANSITIONS_SCROLLLEFT = 12,
SCI_TRANSITIONS_SCROLLUP = 13, SCI_TRANSITIONS_SCROLLUP = 13,
SCI_TRANSITIONS_SCROLLDOWN = 14 SCI_TRANSITIONS_SCROLLDOWN = 14,
// here are transitions that are used by the old tableset, but are not included anymore in the new tableset
SCI_TRANSITIONS_HORIZONTALROLLTOCENTER = 300
}; };
class SciGuiScreen; class SciGuiScreen;
@ -58,13 +67,15 @@ private:
void pixelation(); void pixelation();
void blocks(); void blocks();
void scroll(); void scroll();
void horizontalRollFromCenter();
void horizontalRollToCenter();
SciGui *_gui; SciGui *_gui;
SciGuiScreen *_screen; SciGuiScreen *_screen;
SciGuiPalette *_palette; SciGuiPalette *_palette;
bool _isVGA; bool _isVGA;
byte *_translationTable; const GuiTransitionTranslateEntry *_translationTable;
int16 _number; int16 _number;
bool _blackoutFlag; bool _blackoutFlag;
Common::Rect _picRect; Common::Rect _picRect;