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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Oct 7 13:31:30 CEST 2009


Revision: 44724
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44724&view=rev
Author:   thebluegr
Date:     2009-10-07 11:31:30 +0000 (Wed, 07 Oct 2009)

Log Message:
-----------
More work on the view code wrapper. Now all SCI0-SCI11 views should be displayed correctly, apart from the late SCI0 ones (e.g. in Codename Iceman), where the palette is incorrect

Modified Paths:
--------------
    scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp
    scummvm/trunk/engines/sci/gui/gui_view.h

Modified: scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp	2009-10-06 22:45:08 UTC (rev 44723)
+++ scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp	2009-10-07 11:31:30 UTC (rev 44724)
@@ -519,13 +519,21 @@
 		// Translate view palette
 		view->palette = NULL;
 
-		if (guiView->getPalette()) {
-			GuiPalette viewPalette = guiView->getPalette()->_sysPalette;
-			int colorCount = (viewType == kViewVga) ? 256 : 16;
-			view->palette = new Palette(colorCount);
+		if (viewType == kViewVga || viewType == kViewVga11) {
+			GuiPalette *viewPalette = guiView->getPalette();
+			if (viewPalette) {
+				view->palette = new Palette(256);
+				for (int c = 0; c < 256; c++)
+					view->palette->setColor(c, viewPalette->colors[c].r, viewPalette->colors[c].g, viewPalette->colors[c].b);
+			}
+		} else {
+			view->palette = _staticPalette->getref();
 
-			for (int c = 0; c < colorCount; c++)
-				view->palette->setColor(c, viewPalette.colors[c].r, viewPalette.colors[c].g, viewPalette.colors[c].b);
+			const byte *paldata = guiView->getEgaMapping();
+			for (int p = 0; p < GFX_SCI0_IMAGE_COLORS_NR; p++)
+				view->translation[p] = *(paldata++);
+
+			view->flags |= GFX_PIXMAP_FLAG_PALETTIZED;
 		}
 
 		view->loops_nr = guiView->getLoopCount();
@@ -546,15 +554,16 @@
 				curCel->height = celInfo->height;
 				curCel->index_width = celInfo->width;
 				curCel->index_height = celInfo->height;
-				curCel->palette_revision = 0;
-				curCel->xoffset = celInfo->displaceX;
-				curCel->yoffset = celInfo->displaceY;
+				curCel->palette_revision = -1;
+				curCel->xoffset = -celInfo->displaceX;
+				curCel->yoffset = -celInfo->displaceY;
 				curCel->alpha_map = 0;	// will be allocated by gfx_xlate_pixmap()
 				curCel->data = 0;		// will be allocated by gfx_xlate_pixmap()
-				curCel->palette = view->palette->getref();
+				curCel->palette = NULL;	// will be assigned to the view palette below
 			}
 		}
 
+		if (viewType == kViewVga || viewType == kViewVga11) {
 #else
 
 		// Existing code
@@ -570,6 +579,7 @@
 			view = getEGAView(resid, viewRes->data, viewRes->size, pal);
 		} else {
 			view = getVGAView(resid, viewRes->data, viewRes->size, viewType);
+#endif
 
 			if (view->palette) {
 				// Palettize view
@@ -585,8 +595,6 @@
 			}
 		}
 
-#endif
-
 		if (!res) {
 			res = (gfx_resource_t *)malloc(sizeof(gfx_resource_t));
 			res->scaled_data.view = NULL;
@@ -607,30 +615,9 @@
 	}
 
 	*loop = CLIP<int>(*loop, 0, view->loops_nr - 1);
-
-	if (*loop < 0) {
-		warning("[GFX] View %d has no loops", nr);
-		return NULL;
-	}
-
 	loop_data = view->loops + (*loop);
-	if (loop_data == NULL) {
-		warning("[GFX] Trying to load invalid loop %d of view %d", *loop, nr);
-		return NULL;
-	}
-
 	*cel = CLIP<int>(*cel, 0, loop_data->cels_nr - 1);
-
-	if (*cel < 0) {
-		warning("[GFX] View %d loop %d has no cels", nr, *loop);
-		return NULL;
-	}
-
 	cel_data = loop_data->cels[*cel];
-	if (loop_data == NULL) {
-		warning("[GFX] Trying to load invalid view/loop/cel %d/%d/%d", nr, *loop, *cel);
-		return NULL;
-	}
 
 	if (!cel_data->data) {
 		if (!cel_data->palette)

Modified: scummvm/trunk/engines/sci/gui/gui_view.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_view.h	2009-10-06 22:45:08 UTC (rev 44723)
+++ scummvm/trunk/engines/sci/gui/gui_view.h	2009-10-07 11:31:30 UTC (rev 44724)
@@ -59,7 +59,8 @@
 	byte *getBitmap(GuiViewLoopNo loopNo, GuiViewCelNo celNo);
 	void draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte priority, uint16 paletteNo);
 	uint16 getLoopCount() const { return _loopCount; }
-	SciGuiPalette *getPalette() const { return _palette; }
+	GuiPalette *getPalette() { return &_viewPalette; }
+	const byte *getEgaMapping() const { return _EGAMapping; }
 
 private:
 	void initData(GuiResourceId resourceId);


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