[Scummvm-cvs-logs] SF.net SVN: scummvm:[45084] scummvm/trunk/engines/sci/gui

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Wed Oct 14 17:43:59 CEST 2009


Revision: 45084
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45084&view=rev
Author:   m_kiewitz
Date:     2009-10-14 15:43:58 +0000 (Wed, 14 Oct 2009)

Log Message:
-----------
SCI/newgui: SciGuiTransitions now also supports scrolling up (lsl6 intro)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/gui/gui.cpp
    scummvm/trunk/engines/sci/gui/gui_screen.cpp
    scummvm/trunk/engines/sci/gui/gui_screen.h
    scummvm/trunk/engines/sci/gui/gui_transitions.cpp
    scummvm/trunk/engines/sci/gui/gui_transitions.h

Modified: scummvm/trunk/engines/sci/gui/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui.cpp	2009-10-14 15:21:53 UTC (rev 45083)
+++ scummvm/trunk/engines/sci/gui/gui.cpp	2009-10-14 15:43:58 UTC (rev 45084)
@@ -509,8 +509,9 @@
 	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);
 }
 

Modified: scummvm/trunk/engines/sci/gui/gui_screen.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_screen.cpp	2009-10-14 15:21:53 UTC (rev 45083)
+++ scummvm/trunk/engines/sci/gui/gui_screen.cpp	2009-10-14 15:43:58 UTC (rev 45084)
@@ -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 @@
 	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)

Modified: scummvm/trunk/engines/sci/gui/gui_screen.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_screen.h	2009-10-14 15:21:53 UTC (rev 45083)
+++ scummvm/trunk/engines/sci/gui/gui_screen.h	2009-10-14 15:43:58 UTC (rev 45084)
@@ -46,7 +46,9 @@
 	~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);

Modified: scummvm/trunk/engines/sci/gui/gui_transitions.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_transitions.cpp	2009-10-14 15:21:53 UTC (rev 45083)
+++ scummvm/trunk/engines/sci/gui/gui_transitions.cpp	2009-10-14 15:43:58 UTC (rev 45084)
@@ -43,9 +43,11 @@
 }
 
 SciGuiTransitions::~SciGuiTransitions() {
+	delete[] _oldScreen;
 }
 
 void SciGuiTransitions::init() {
+	_oldScreen = new byte[_screen->_displayHeight * _screen->_displayWidth];
 }
 
 void SciGuiTransitions::setup(int16 number) {
@@ -70,6 +72,10 @@
 			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 @@
 	}
 }
 
-// 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 @@
 	} 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 @@
 	} 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

Modified: scummvm/trunk/engines/sci/gui/gui_transitions.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_transitions.h	2009-10-14 15:21:53 UTC (rev 45083)
+++ scummvm/trunk/engines/sci/gui/gui_transitions.h	2009-10-14 15:43:58 UTC (rev 45084)
@@ -39,9 +39,15 @@
 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;
 class SciGuiTransitions {
 public:
@@ -59,6 +65,7 @@
 	void fadeIn();
 	void pixelation();
 	void blocks();
+	void scroll(int16 direction);
 
 	SciGui *_gui;
 	SciGuiScreen *_screen;
@@ -67,6 +74,7 @@
 	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


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list