aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2009-10-14 15:43:58 +0000
committerMartin Kiewitz2009-10-14 15:43:58 +0000
commite07479261606df3ee02c905bd5707061a5d49811 (patch)
treed38aa7a70843c79dd4d2db435b6448c3b1b1b7d4
parent1b3a5eaff610a55f7f4295e2585616619c3517f6 (diff)
downloadscummvm-rg350-e07479261606df3ee02c905bd5707061a5d49811.tar.gz
scummvm-rg350-e07479261606df3ee02c905bd5707061a5d49811.tar.bz2
scummvm-rg350-e07479261606df3ee02c905bd5707061a5d49811.zip
SCI/newgui: SciGuiTransitions now also supports scrolling up (lsl6 intro)
svn-id: r45084
-rw-r--r--engines/sci/gui/gui.cpp5
-rw-r--r--engines/sci/gui/gui_screen.cpp12
-rw-r--r--engines/sci/gui/gui_screen.h2
-rw-r--r--engines/sci/gui/gui_transitions.cpp45
-rw-r--r--engines/sci/gui/gui_transitions.h10
5 files changed, 69 insertions, 5 deletions
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp
index 146c28c445..5fac9a86ef 100644
--- a/engines/sci/gui/gui.cpp
+++ b/engines/sci/gui/gui.cpp
@@ -509,8 +509,9 @@ void SciGui::animateShowPic() {
Common::Rect picRect = picPort->rect;
// Adjust picRect to become relative to screen
- picRect.top += picPort->top; picRect.bottom += picPort->top;
- picRect.left += picPort->left; picRect.right += picPort->left;
+ picRect.translate(picPort->left, picPort->top);
+ //picRect.top += picPort->top; picRect.bottom += picPort->top;
+ //picRect.left += picPort->left; picRect.right += picPort->left;
_transitions->doit(picRect);
}
diff --git a/engines/sci/gui/gui_screen.cpp b/engines/sci/gui/gui_screen.cpp
index 1ec194772c..4d9216432b 100644
--- a/engines/sci/gui/gui_screen.cpp
+++ b/engines/sci/gui/gui_screen.cpp
@@ -25,6 +25,7 @@
#include "common/timer.h"
#include "common/util.h"
+#include "graphics/surface.h"
#include "sci/sci.h"
#include "sci/engine/state.h"
@@ -66,10 +67,21 @@ void SciGuiScreen::copyToScreen() {
g_system->copyRectToScreen(_activeScreen, _displayWidth, 0, 0, _displayWidth, _displayHeight);
}
+void SciGuiScreen::copyFromScreen(byte *buffer) {
+ Graphics::Surface *screen;
+ screen = g_system->lockScreen();
+ memcpy(buffer, screen->pixels, _displayWidth * _displayHeight);
+ g_system->unlockScreen();
+}
+
void SciGuiScreen::copyRectToScreen(const Common::Rect &rect) {
g_system->copyRectToScreen(_activeScreen + rect.top * _displayWidth + rect.left, _displayWidth, rect.left, rect.top, rect.width(), rect.height());
}
+void SciGuiScreen::copyRectToScreen(const Common::Rect &rect, int16 x, int16 y) {
+ g_system->copyRectToScreen(_activeScreen + rect.top * _displayWidth + rect.left, _displayWidth, x, y, rect.width(), rect.height());
+}
+
byte SciGuiScreen::getDrawingMask(byte color, byte prio, byte control) {
byte flag = 0;
if (color != 255)
diff --git a/engines/sci/gui/gui_screen.h b/engines/sci/gui/gui_screen.h
index 63f641189c..179a7de3e8 100644
--- a/engines/sci/gui/gui_screen.h
+++ b/engines/sci/gui/gui_screen.h
@@ -46,7 +46,9 @@ public:
~SciGuiScreen();
void copyToScreen();
+ void copyFromScreen(byte *buffer);
void copyRectToScreen(const Common::Rect &rect);
+ void copyRectToScreen(const Common::Rect &rect, int16 x, int16 y);
byte getDrawingMask(byte color, byte prio, byte control);
void putPixel(int x, int y, byte drawMask, byte color, byte prio, byte control);
diff --git a/engines/sci/gui/gui_transitions.cpp b/engines/sci/gui/gui_transitions.cpp
index b68d1b3f93..02a91f831e 100644
--- a/engines/sci/gui/gui_transitions.cpp
+++ b/engines/sci/gui/gui_transitions.cpp
@@ -43,9 +43,11 @@ SciGuiTransitions::SciGuiTransitions(SciGui *gui, SciGuiScreen *screen, SciGuiPa
}
SciGuiTransitions::~SciGuiTransitions() {
+ delete[] _oldScreen;
}
void SciGuiTransitions::init() {
+ _oldScreen = new byte[_screen->_displayHeight * _screen->_displayWidth];
}
void SciGuiTransitions::setup(int16 number) {
@@ -70,6 +72,10 @@ void SciGuiTransitions::doit(Common::Rect picRect) {
fadeOut(); setNewScreen(); fadeIn();
break;
+ case SCI_TRANSITIONS_VGA_SCROLLUP:
+ scroll(SCI_TRANSITIONS_SCROLL_UP);
+ break;
+
default:
warning("SciGuiTransitions: VGA-%d not implemented", _number);
setNewPalette(); setNewScreen();
@@ -142,7 +148,7 @@ void SciGuiTransitions::fadeIn() {
}
}
-// pixelates the new picture over the old one
+// pixelates the new picture over the old one - works against the whole screen
void SciGuiTransitions::pixelation () {
uint16 mask = 0x40, stepNr = 0;
Common::Rect pixelRect;
@@ -162,7 +168,7 @@ void SciGuiTransitions::pixelation () {
} while (mask != 0x40);
}
-// like pixelation but uses 8x8 blocks
+// like pixelation but uses 8x8 blocks - works against the whole screen
void SciGuiTransitions::blocks() {
uint16 mask = 0x40, stepNr = 0;
Common::Rect blockRect;
@@ -182,4 +188,39 @@ void SciGuiTransitions::blocks() {
} while (mask != 0x40);
}
+// scroll old screen (up/down/left/right) and insert new screen that way - works on _picRect area
+void SciGuiTransitions::scroll(int16 direction) {
+ int16 screenWidth, screenHeight;
+ int16 oldWidth, oldHeight;
+ int16 newWidth, newHeight;
+ byte *oldScreenPtr;
+ int16 x, y;
+ Common::Rect newScreenRect = _picRect;
+
+ _screen->copyFromScreen(_oldScreen);
+ screenWidth = _screen->_displayWidth; screenHeight = _screen->_displayHeight;
+
+ x = _picRect.left; y = _picRect.top;
+ oldWidth = _picRect.width(); oldHeight = _picRect.height();
+ newWidth = 0; newHeight = 0;
+
+ oldScreenPtr = _oldScreen + _picRect.left + _picRect.top * screenWidth;
+
+ switch (direction) {
+ case SCI_TRANSITIONS_SCROLL_UP:
+ newScreenRect.bottom = newScreenRect.top;
+ y += oldHeight;
+ while (oldHeight > 0) {
+ oldScreenPtr += screenWidth; oldHeight--;
+ if (oldHeight)
+ g_system->copyRectToScreen(oldScreenPtr, _screen->_displayWidth, _picRect.left, _picRect.top, oldWidth, oldHeight);
+ newScreenRect.bottom++; y--;
+ _screen->copyRectToScreen(newScreenRect, x, y);
+ g_system->updateScreen();
+ g_system->delayMillis(3);
+ }
+ break;
+ }
+}
+
} // End of namespace Sci
diff --git a/engines/sci/gui/gui_transitions.h b/engines/sci/gui/gui_transitions.h
index df4291403c..db3d2ea4e7 100644
--- a/engines/sci/gui/gui_transitions.h
+++ b/engines/sci/gui/gui_transitions.h
@@ -39,7 +39,13 @@ enum {
enum {
SCI_TRANSITIONS_VGA_BLOCKS = 8,
SCI_TRANSITIONS_VGA_PIXELATION = 9,
- SCI_TRANSITIONS_VGA_FADEPALETTE = 10
+ SCI_TRANSITIONS_VGA_FADEPALETTE = 10,
+ SCI_TRANSITIONS_VGA_SCROLLUP = 13,
+ SCI_TRANSITIONS_VGA_SCROLLDOWN = 14
+};
+
+enum {
+ SCI_TRANSITIONS_SCROLL_UP = 1
};
class SciGuiScreen;
@@ -59,6 +65,7 @@ private:
void fadeIn();
void pixelation();
void blocks();
+ void scroll(int16 direction);
SciGui *_gui;
SciGuiScreen *_screen;
@@ -67,6 +74,7 @@ private:
bool _isVGA;
int16 _number;
Common::Rect _picRect;
+ byte *_oldScreen; // buffer for saving current active screen data to, has dimenions of _screen->_displayScreen
};
} // End of namespace Sci