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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Thu May 14 21:33:03 CEST 2009


Revision: 40566
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40566&view=rev
Author:   thebluegr
Date:     2009-05-14 19:33:03 +0000 (Thu, 14 May 2009)

Log Message:
-----------
Added a parameter to the graphics resource manager to determine if the running SCI1 game is VGA or not (better than modifying the detected SCI resource version)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/game.cpp
    scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp
    scummvm/trunk/engines/sci/gfx/gfx_resmgr.h
    scummvm/trunk/engines/sci/gfx/operations.cpp
    scummvm/trunk/engines/sci/gfx/operations.h
    scummvm/trunk/engines/sci/sci.cpp

Modified: scummvm/trunk/engines/sci/engine/game.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/game.cpp	2009-05-14 18:55:30 UTC (rev 40565)
+++ scummvm/trunk/engines/sci/engine/game.cpp	2009-05-14 19:33:03 UTC (rev 40566)
@@ -74,7 +74,7 @@
 	gfx_color_t transparent = { PaletteEntry(), 0, -1, -1, 0 };
 	sciprintf("Initializing graphics\n");
 
-	if (s->resmgr->_sciVersion <= SCI_VERSION_01) {
+	if (s->resmgr->_sciVersion <= SCI_VERSION_01 || (s->flags & GF_SCI1_EGA)) {
 		int i;
 
 		for (i = 0; i < 16; i++) {

Modified: scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp	2009-05-14 18:55:30 UTC (rev 40565)
+++ scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp	2009-05-14 19:33:03 UTC (rev 40566)
@@ -49,12 +49,12 @@
 	gfx_driver_t *driver;
 };
 
-GfxResManager::GfxResManager(int version, gfx_options_t *options, gfx_driver_t *driver, ResourceManager *resManager) : 
-				_version(version), _options(options), _driver(driver), _resManager(resManager), 
+GfxResManager::GfxResManager(int version, bool isVGA, gfx_options_t *options, gfx_driver_t *driver, ResourceManager *resManager) : 
+				_version(version), _isVGA(isVGA), _options(options), _driver(driver), _resManager(resManager), 
 				_lockCounter(0), _tagLockCounter(0), _staticPalette(0) {
 	gfxr_init_static_palette();
 
-	if (_version < SCI_VERSION_01_VGA) {
+	if (_version < SCI_VERSION_01_VGA || !_isVGA) {
 		_staticPalette = gfx_sci0_pic_colors->getref();
 	} else if (_version == SCI_VERSION_1_1) {
 		GFXDEBUG("Palettes are not yet supported in this SCI version\n");
@@ -103,7 +103,7 @@
 		if (_version == SCI_VERSION_1_1)
 			DRAW_PIC11(unscaled_pic, &basic_style)
 		else
-			DRAW_PIC01(unscaled_pic, &basic_style, _version >= SCI_VERSION_01_VGA)
+			DRAW_PIC01(unscaled_pic, &basic_style, _isVGA)
 	}
 
 	if (scaled_pic && scaled_pic->undithered_buffer)
@@ -112,9 +112,9 @@
 	if (_version == SCI_VERSION_1_1)
 		DRAW_PIC11(scaled_pic, &style)
 	else
-		DRAW_PIC01(scaled_pic, &style, _version >= SCI_VERSION_01_VGA)
+		DRAW_PIC01(scaled_pic, &style, _isVGA)
 
-	if (_version < SCI_VERSION_01_VGA) {
+	if (!_isVGA) {
 		if (need_unscaled)
 			gfxr_remove_artifacts_pic0(scaled_pic, unscaled_pic);
 
@@ -524,14 +524,14 @@
 
 		if (_version < SCI_VERSION_01)
 			view = gfxr_draw_view0(resid, viewRes->data, viewRes->size, -1);
-		else if (_version == SCI_VERSION_01)
+		else if (_version == SCI_VERSION_01 || !_isVGA)
 			view = gfxr_draw_view0(resid, viewRes->data, viewRes->size, palette);
 		else if (_version >= SCI_VERSION_01_VGA && _version <= SCI_VERSION_1_LATE)
 			view = gfxr_draw_view1(resid, viewRes->data, viewRes->size, _staticPalette);
 		else if (_version >= SCI_VERSION_1_1)
 			view = gfxr_draw_view11(resid, viewRes->data, viewRes->size);
 
-		if (_version >= SCI_VERSION_01_VGA) {
+		if (_isVGA) {
 			if (!view->palette) {
 				view->palette = new Palette(_staticPalette->size());
 				view->palette->name = "interpreter_get_view";

Modified: scummvm/trunk/engines/sci/gfx/gfx_resmgr.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_resmgr.h	2009-05-14 18:55:30 UTC (rev 40565)
+++ scummvm/trunk/engines/sci/gfx/gfx_resmgr.h	2009-05-14 19:33:03 UTC (rev 40566)
@@ -87,7 +87,7 @@
 
 class GfxResManager {
 public:
-	GfxResManager(int version, gfx_options_t *options, gfx_driver_t *driver, ResourceManager *resManager);
+	GfxResManager(int version, bool isVGA, gfx_options_t *options, gfx_driver_t *driver, ResourceManager *resManager);
 
 	~GfxResManager();
 
@@ -248,6 +248,7 @@
 
 private:
 	int _version;
+	bool _isVGA;
 	gfx_options_t *_options;
 	gfx_driver_t *_driver;
 	Palette *_staticPalette;

Modified: scummvm/trunk/engines/sci/gfx/operations.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/operations.cpp	2009-05-14 18:55:30 UTC (rev 40565)
+++ scummvm/trunk/engines/sci/gfx/operations.cpp	2009-05-14 19:33:03 UTC (rev 40566)
@@ -405,7 +405,7 @@
 	(*pixmap)->palette = new Palette(default_colors, DEFAULT_COLORS_NR);
 }
 
-int gfxop_init(int version, GfxState *state, gfx_options_t *options, ResourceManager *resManager, 
+int gfxop_init(int version, bool isVGA, GfxState *state, gfx_options_t *options, ResourceManager *resManager, 
 			   int xfact, int yfact, gfx_color_mode_t bpp) {
 	int color_depth = bpp ? bpp : 1;
 	int initialized = 0;
@@ -434,7 +434,7 @@
 	if (!initialized)
 		return GFX_FATAL;
 
-	state->gfxResMan = new GfxResManager(version, state->options, state->driver, resManager);
+	state->gfxResMan = new GfxResManager(version, isVGA, state->options, state->driver, resManager);
 
 	gfxop_set_clip_zone(state, gfx_rect(0, 0, 320, 200));
 

Modified: scummvm/trunk/engines/sci/gfx/operations.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/operations.h	2009-05-14 18:55:30 UTC (rev 40565)
+++ scummvm/trunk/engines/sci/gfx/operations.h	2009-05-14 19:33:03 UTC (rev 40566)
@@ -136,7 +136,7 @@
 /* Fundamental operations */
 /**************************/
 
-int gfxop_init(int version, GfxState *state, gfx_options_t *options, ResourceManager *resManager,
+int gfxop_init(int version, bool isVGA, GfxState *state, gfx_options_t *options, ResourceManager *resManager,
 			   int xfact = 1, int yfact = 1, gfx_color_mode_t bpp = GFX_COLOR_MODE_INDEX);
 /* Initializes a graphics mode
 ** Parameters: (int) version: The interpreter version

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2009-05-14 18:55:30 UTC (rev 40565)
+++ scummvm/trunk/engines/sci/sci.cpp	2009-05-14 19:33:03 UTC (rev 40566)
@@ -226,8 +226,7 @@
 	// Default config ends
 #endif
 
-	int resVersion = !(getFlags() & GF_SCI1_EGA) ? _resmgr->_sciVersion : SCI_VERSION_01;
-	if (gfxop_init(resVersion, &gfx_state, &gfx_options, _resmgr)) {
+	if (gfxop_init(_resmgr->_sciVersion, !(getFlags() & GF_SCI1_EGA), &gfx_state, &gfx_options, _resmgr)) {
 		fprintf(stderr, "Graphics initialization failed. Aborting...\n");
 		return Common::kUnknownError;
 	}


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