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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Thu Oct 29 15:16:27 CET 2009


Revision: 45500
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45500&view=rev
Author:   m_kiewitz
Date:     2009-10-29 14:16:20 +0000 (Thu, 29 Oct 2009)

Log Message:
-----------
SCI/newgui: Defining color white and others in SciGuiScreen and using that. Also clears screen with 0 on sci1.1 games (needs further investigation), fixes pictures

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/gui/gui_cursor.cpp
    scummvm/trunk/engines/sci/gui/gui_cursor.h
    scummvm/trunk/engines/sci/gui/gui_gfx.cpp
    scummvm/trunk/engines/sci/gui/gui_picture.cpp
    scummvm/trunk/engines/sci/gui/gui_screen.cpp
    scummvm/trunk/engines/sci/gui/gui_screen.h
    scummvm/trunk/engines/sci/sci.cpp

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-10-29 09:58:36 UTC (rev 45499)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-10-29 14:16:20 UTC (rev 45500)
@@ -440,7 +440,8 @@
 		rect.right = rect.left + 1;
 		rect.bottom = rect.top + 1;
 	}
-	return make_reg(0, s->_gui->onControl(screenMask, rect));
+	uint16 result = s->_gui->onControl(screenMask, rect);
+	return make_reg(0, result);
 }
 
 void _k_view_list_free_backgrounds(EngineState *s, ViewObject *list, int list_nr);

Modified: scummvm/trunk/engines/sci/gui/gui_cursor.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_cursor.cpp	2009-10-29 09:58:36 UTC (rev 45499)
+++ scummvm/trunk/engines/sci/gui/gui_cursor.cpp	2009-10-29 14:16:20 UTC (rev 45500)
@@ -30,13 +30,14 @@
 #include "sci/sci.h"
 #include "sci/engine/state.h"
 #include "sci/gui/gui_palette.h"
+#include "sci/gui/gui_screen.h"
 #include "sci/gui/gui_view.h"
 #include "sci/gui/gui_cursor.h"
 
 namespace Sci {
 
-SciGuiCursor::SciGuiCursor(ResourceManager *resMan, SciGuiPalette *palette)
-	: _resMan(resMan), _palette(palette) {
+SciGuiCursor::SciGuiCursor(ResourceManager *resMan, SciGuiPalette *palette, SciGuiScreen *screen)
+	: _resMan(resMan), _palette(palette), _screen(screen) {
 
 	setPosition(Common::Point(160, 150));		// TODO: how is that different in 640x400 games?
 	setMoveZone(Common::Rect(0, 0, 320, 200));	// TODO: hires games
@@ -88,7 +89,7 @@
 
 	// Now find out what colors we are supposed to use
 	colorMapping[0] = 0; // Black is hardcoded
-	colorMapping[1] = _resMan->isVGA() ? 255 : 15; // White is also hardcoded
+	colorMapping[1] = _screen->_colorWhite; // White is also hardcoded
 	colorMapping[2] = SCI_CURSOR_SCI0_TRANSPARENCYCOLOR;
 	colorMapping[3] = _palette->matchColor(&_palette->_sysPalette, 170, 170, 170); // Grey
 	

Modified: scummvm/trunk/engines/sci/gui/gui_cursor.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_cursor.h	2009-10-29 09:58:36 UTC (rev 45499)
+++ scummvm/trunk/engines/sci/gui/gui_cursor.h	2009-10-29 14:16:20 UTC (rev 45500)
@@ -37,7 +37,7 @@
 class SciGuiPalette;
 class SciGuiCursor {
 public:
-	SciGuiCursor(ResourceManager *resMan, SciGuiPalette *palette);
+	SciGuiCursor(ResourceManager *resMan, SciGuiPalette *palette, SciGuiScreen *screen);
 	~SciGuiCursor();
 
 	void show();

Modified: scummvm/trunk/engines/sci/gui/gui_gfx.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_gfx.cpp	2009-10-29 09:58:36 UTC (rev 45499)
+++ scummvm/trunk/engines/sci/gui/gui_gfx.cpp	2009-10-29 14:16:20 UTC (rev 45500)
@@ -302,10 +302,7 @@
 	picture = new SciGuiPicture(_s->resMan, this, _screen, _palette, pictureId);
 	// do we add to a picture? if not -> clear screen
 	if (!addToFlag) {
-		if (_s->resMan->isVGA())
-			ClearScreen(255);
-		else
-			ClearScreen(15);
+		ClearScreen(_screen->_colorClearScreen);
 	}
 	picture->draw(animationNr, mirroredFlag, addToFlag, paletteId);
 }

Modified: scummvm/trunk/engines/sci/gui/gui_picture.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_picture.cpp	2009-10-29 09:58:36 UTC (rev 45499)
+++ scummvm/trunk/engines/sci/gui/gui_picture.cpp	2009-10-29 14:16:20 UTC (rev 45500)
@@ -301,7 +301,8 @@
 
 void SciGuiPicture::drawVectorData(byte *data, int dataSize) {
 	byte pic_op;
-	byte pic_color = 0, pic_priority = 255, pic_control = 255;
+	byte pic_color = _screen->_colorDefaultVectorData;
+	byte pic_priority = 255, pic_control = 255;
 	int16 x = 0, y = 0, oldx, oldy;
 	byte EGApalettes[PIC_EGAPALETTE_TOTALSIZE] = {0};
 	byte *EGApalette = &EGApalettes[_EGApaletteNo * PIC_EGAPALETTE_SIZE];
@@ -604,13 +605,8 @@
 
 	// This logic was taken directly from sierra sci, floodfill will get aborted on various occations
 	if (screenMask & SCI_SCREEN_MASK_VISUAL) {
-		if (_resMan->isVGA()) {
-			if ((color == 255) || (searchColor != 255))
-				return;
-		} else {
-			if ((color == 15) || (searchColor != 15))
-				return;
-		}
+		if ((color == _screen->_colorWhite) || (searchColor != _screen->_colorClearScreen))
+			return;
 	} else if (screenMask & SCI_SCREEN_MASK_PRIORITY) {
 		if ((priority == 0) || (searchPriority != 0))
 			return;

Modified: scummvm/trunk/engines/sci/gui/gui_screen.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_screen.cpp	2009-10-29 09:58:36 UTC (rev 45499)
+++ scummvm/trunk/engines/sci/gui/gui_screen.cpp	2009-10-29 14:16:20 UTC (rev 45500)
@@ -33,8 +33,8 @@
 
 namespace Sci {
 
-SciGuiScreen::SciGuiScreen(int16 width, int16 height, int16 scaleFactor) : 
-	_width(width), _height(height) {
+SciGuiScreen::SciGuiScreen(ResourceManager *resMan, int16 width, int16 height, int16 scaleFactor) : 
+	_resMan(resMan), _width(width), _height(height) {
 
 	_pixels = _width * _height;
 
@@ -53,6 +53,23 @@
 
 	_picNotValid = false;
 	_unditherState = true;
+
+	if (_resMan->isVGA()) {
+		_colorWhite = 255;
+		// TODO: Find out whats really different between SCI11 and SCI1, because actually the clearScreen in SCI11
+		//  really uses 255 as well
+		if (getSciVersion() >= SCI_VERSION_1_1) {
+			_colorClearScreen = 0;
+			_colorDefaultVectorData = 255;
+		} else {
+			_colorClearScreen = 255;
+			_colorDefaultVectorData = 0;
+		}
+	} else {
+		_colorWhite = 15;
+		_colorClearScreen = 15;
+		_colorDefaultVectorData = 0;
+	}
 }
 
 SciGuiScreen::~SciGuiScreen() {

Modified: scummvm/trunk/engines/sci/gui/gui_screen.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_screen.h	2009-10-29 09:58:36 UTC (rev 45499)
+++ scummvm/trunk/engines/sci/gui/gui_screen.h	2009-10-29 14:16:20 UTC (rev 45500)
@@ -42,7 +42,7 @@
 
 class SciGuiScreen {
 public:
-	SciGuiScreen(int16 width = 320, int16 height = 200, int16 scaleFactor = 1);
+	SciGuiScreen(ResourceManager *resMan, int16 width = 320, int16 height = 200, int16 scaleFactor = 1);
 	~SciGuiScreen();
 
 	void copyToScreen();
@@ -85,6 +85,10 @@
 
 	int _picNotValid; // possible values 0, 1 and 2
 
+	byte _colorWhite;
+	byte _colorClearScreen;
+	byte _colorDefaultVectorData;
+
 private:
 	void bitsRestoreScreen(Common::Rect rect, byte *&memoryPtr, byte *screen);
 	void bitsSaveScreen(Common::Rect rect, byte *screen, byte *&memoryPtr);
@@ -104,6 +108,8 @@
 	byte *_displayScreen;
 private:
 
+	ResourceManager *_resMan;
+
 	// this is a pointer to the currently active screen (changing it only required for debug purposes)
 	byte *_activeScreen;
 };

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2009-10-29 09:58:36 UTC (rev 45499)
+++ scummvm/trunk/engines/sci/sci.cpp	2009-10-29 14:16:20 UTC (rev 45500)
@@ -110,9 +110,9 @@
 
 	_kernel = new Kernel(_resMan);
 	_vocabulary = new Vocabulary(_resMan);
-	SciGuiScreen *screen = new SciGuiScreen();
+	SciGuiScreen *screen = new SciGuiScreen(_resMan);
 	SciGuiPalette *palette = new SciGuiPalette(_resMan, screen);
-	SciGuiCursor *cursor = new SciGuiCursor(_resMan, palette);
+	SciGuiCursor *cursor = new SciGuiCursor(_resMan, palette, screen);
 
 	// We'll set the GUI below
 	_gamestate = new EngineState(_resMan, _kernel, _vocabulary, NULL, cursor);


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