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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Thu Sep 3 09:01:48 CEST 2009


Revision: 43915
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43915&view=rev
Author:   thebluegr
Date:     2009-09-03 07:01:48 +0000 (Thu, 03 Sep 2009)

Log Message:
-----------
- Re-added the SCI0 dithering code. Dithering is disabled by default. Added the 3 dithering modes as an enum (and reorganized them a bit)
- Added 3 config options for dithering in the ini file - mainly for purists (config option "dither_mode"): 0 - disabled, 1 - 16 color dithering (Sierra style) and 2 - 256 color dithering
- Dithering is now always applied depending on the screen scale (removed the relevant parameter)
- Removed the background picture buffering option, used to speed-up room changes. Room changing is quite fast (instantaneous), and the extra memory allocated is not worth the possible speed increase in small devices. Plus.... there is no reliable value to set this option to, so there is no point in letting the user decide what value to put there using guesswork

Modified Paths:
--------------
    scummvm/trunk/engines/sci/gfx/gfx_options.h
    scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp
    scummvm/trunk/engines/sci/gfx/gfx_resource.h
    scummvm/trunk/engines/sci/gfx/res_pic.cpp
    scummvm/trunk/engines/sci/sci.cpp

Modified: scummvm/trunk/engines/sci/gfx/gfx_options.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_options.h	2009-09-02 23:42:07 UTC (rev 43914)
+++ scummvm/trunk/engines/sci/gfx/gfx_options.h	2009-09-03 07:01:48 UTC (rev 43915)
@@ -47,16 +47,10 @@
  */
 struct gfx_options_t {
 #ifdef CUSTOM_GRAPHICS_OPTIONS
-	int buffer_pics_nr; /* Number of unused pics to buffer in LRU storage */
-
 	/* SCI0 pic resource options */
 	int pic0_unscaled; /* Don't draw scaled SCI0 pics */
+	DitherMode pic0_dither_mode; /* Mode to use for pic0 dithering, defined in gfx_resource.h */
 
-#if 0
-	int pic0_dither_mode; /* Mode to use for pic0 dithering, defined in gfx_resource.h */
-	int pic0_dither_pattern; /* Pattern to use for pic0 dithering, defined in gfx_resource.h */
-#endif
-
 	gfx_brush_mode_t pic0_brush_mode;
 	gfx_line_mode_t pic0_line_mode;
 

Modified: scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp	2009-09-02 23:42:07 UTC (rev 43914)
+++ scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp	2009-09-03 07:01:48 UTC (rev 43915)
@@ -119,13 +119,11 @@
 
 		memcpy(scaled_pic->undithered_buffer, scaled_pic->visual_map->index_data, scaled_pic->undithered_buffer_size);
 
-#if 0
 #ifdef CUSTOM_GRAPHICS_OPTIONS
-		gfxr_dither_pic0(scaled_pic, _options->pic0_dither_mode, _options->pic0_dither_pattern);
+		gfxr_dither_pic0(scaled_pic, _options->pic0_dither_mode);
 #else
-		gfxr_dither_pic0(scaled_pic, GFXR_DITHER_MODE_D256, GFXR_DITHER_PATTERN_SCALED);
+		gfxr_dither_pic0(scaled_pic, kDitherNone);
 #endif
-#endif
 	}
 
 	// Mark default palettes
@@ -152,22 +150,15 @@
 			return 10;
 		else
 			return (_options->pic0_unscaled) ? 0x10000 : 
-#if 0
 					 (_options->pic0_dither_mode << 12) |
-			         (_options->pic0_dither_pattern << 8) |
-#endif
 					 (_options->pic0_brush_mode << 4) |
 				     (_options->pic0_line_mode);
 #else
 		if (_resMan->isVGA())
 			return 10;
 		else
-#if 0
-			return 0x10000 | (GFXR_DITHER_PATTERN_SCALED << 8) | (GFX_BRUSH_MODE_RANDOM_ELLIPSES << 4) | GFX_LINE_MODE_CORRECT;
-#else
 			return 0x10000 | (GFX_BRUSH_MODE_RANDOM_ELLIPSES << 4) | GFX_LINE_MODE_CORRECT;
 #endif
-#endif
 
 	case GFX_RESOURCE_TYPE_FONT:
 	case GFX_RESOURCE_TYPE_CURSOR:
@@ -384,11 +375,7 @@
 		if (!res) {
 			res = (gfx_resource_t *)malloc(sizeof(gfx_resource_t));
 			res->ID = GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num);
-#ifdef CUSTOM_GRAPHICS_OPTIONS
-			res->lock_sequence_nr = _options->buffer_pics_nr;
-#else
 			res->lock_sequence_nr = 0;
-#endif
 			resMap[num] = res;
 		} else {
 			gfxr_free_pic(res->scaled_data.pic);
@@ -400,11 +387,7 @@
 		res->scaled_data.pic = pic;
 		res->unscaled_data.pic = unscaled_pic;
 	} else {
-#ifdef CUSTOM_GRAPHICS_OPTIONS
-		res->lock_sequence_nr = _options->buffer_pics_nr; // Update lock counter
-#else
 		res->lock_sequence_nr = 0;
-#endif
 	}
 
 #ifdef CUSTOM_GRAPHICS_OPTIONS
@@ -496,11 +479,7 @@
 		_gfxr_unscale_pixmap_index_data(res->scaled_data.pic->priority_map, _driver->getMode());
 
 	// The following two operations are needed when returning scaled maps (which is always the case here)
-#ifdef CUSTOM_GRAPHICS_OPTIONS
-	res->lock_sequence_nr = _options->buffer_pics_nr;
-#else
 	res->lock_sequence_nr = 0;
-#endif
 	calculatePic(res->scaled_data.pic, need_unscaled ? res->unscaled_data.pic : NULL,
 		                               flags | DRAWPIC01_FLAG_OVERLAID_PIC, default_palette, new_nr);
 

Modified: scummvm/trunk/engines/sci/gfx/gfx_resource.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_resource.h	2009-09-02 23:42:07 UTC (rev 43914)
+++ scummvm/trunk/engines/sci/gfx/gfx_resource.h	2009-09-03 07:01:48 UTC (rev 43915)
@@ -42,18 +42,13 @@
 namespace Sci {
 
 /*** Styles for pic0 drawing ***/
-// These are used for the now-disabled dithering code. Is it even used anywhere?
-#if 0
-/* Dithering modes */
-#define GFXR_DITHER_MODE_D16 0  /* Sierra SCI style */
-#define GFXR_DITHER_MODE_F256 1 /* Flat color interpolation */
-#define GFXR_DITHER_MODE_D256 2 /* 256 color dithering */
+/* Dithering modes for SCI0 games */
+enum DitherMode {
+	kDitherNone = 0,         // No dithering
+	kDither16Colors = 1,     // Sierra SCI style
+	kDither256Colors = 2     // Enhanced style
+};
 
-/* Dithering patterns */
-#define GFXR_DITHER_PATTERN_SCALED 0 /* Dither per pixel on the 320x200 grid */
-#define GFXR_DITHER_PATTERN_1 1      /* Dither per pixel on the target */
-#endif
-
 #define SCI_TITLEBAR_SIZE 10
 
 #define DRAWPIC01_FLAG_FILL_NORMALLY 1
@@ -247,16 +242,13 @@
  */
 void gfxr_remove_artifacts_pic0(gfxr_pic_t *dest, gfxr_pic_t *src);
 
-#if 0
 /**
  * Dithers a gfxr_visual_map.
  *
- * @param[in] pic		The pic to dither
- * @param[in] mode		One of GFXR_DITHER_MODE
- * @param[in] pattern	One of GFXR_DITHER_PATTERN
+ * @param[in] pic		        The pic to dither
+ * @param[DitherMode] mode		The dithering mode to use
  */
-void gfxr_dither_pic0(gfxr_pic_t *pic, int mode, int pattern);
-#endif
+void gfxr_dither_pic0(gfxr_pic_t *pic, DitherMode mode);
 
 /**
  * Calculates an EGA view.

Modified: scummvm/trunk/engines/sci/gfx/res_pic.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/res_pic.cpp	2009-09-02 23:42:07 UTC (rev 43914)
+++ scummvm/trunk/engines/sci/gfx/res_pic.cpp	2009-09-03 07:01:48 UTC (rev 43915)
@@ -1684,36 +1684,34 @@
 	gfxr_draw_pic01(pic, flags, default_palette, size - vector_data_ptr, resource + vector_data_ptr, style, resid, kViewVga11, static_pal, portBounds);
 }
 
-#if 0
-void gfxr_dither_pic0(gfxr_pic_t *pic, int dmode, int pattern) {
+void gfxr_dither_pic0(gfxr_pic_t *pic, DitherMode dmode) {
 	int xl = pic->visual_map->index_width;
 	int yl = pic->visual_map->index_height;
-	int xfrob_max = (pattern == GFXR_DITHER_PATTERN_1) ? 1 : pic->mode->xfact;
-	int yfrob_max = (pattern == GFXR_DITHER_PATTERN_1) ? 1 : pic->mode->yfact;
+	int xfrob_max = pic->mode->xfact;
+	int yfrob_max = pic->mode->yfact;
 	int xfrobc = 0, yfrobc = 0;
 	int selection = 0;
 	int x, y;
 	byte *data = pic->visual_map->index_data;
 
-	if (dmode == GFXR_DITHER_MODE_F256)
+	if (dmode == kDitherNone)
 		return; // Nothing to do
 
-	if (dmode == GFXR_DITHER_MODE_D16) { // Limit to 16 colors
+	if (dmode == kDither16Colors)
 		pic->visual_map->palette = gfx_sci0_image_pal[sci0_palette]->getref();
-	}
 
 	for (y = 0; y < yl; y++) {
 		for (x = 0; x < xl; x++) {
 
 			switch (dmode) {
-			case GFXR_DITHER_MODE_D16:
+			case kDither16Colors:
 				if (selection)
 					*data = (*data & 0xf0) >> 4;
 				else
 					*data = (*data & 0xf);
 				break;
 
-			case GFXR_DITHER_MODE_D256:
+			case kDither256Colors:
 				if (selection)
 					*data = ((*data & 0xf) << 4) | ((*data & 0xf0) >> 4);
 				break;
@@ -1737,6 +1735,5 @@
 		}
 	}
 }
-#endif
 
 } // End of namespace Sci

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2009-09-02 23:42:07 UTC (rev 43914)
+++ scummvm/trunk/engines/sci/sci.cpp	2009-09-03 07:01:48 UTC (rev 43915)
@@ -164,17 +164,14 @@
 	ConfMan.registerDefault("view_filter", "0");
 	ConfMan.registerDefault("pic_filter", "0");
 	ConfMan.registerDefault("text_filter", "0");
+	ConfMan.registerDefault("dither_mode", "0");
 
 	// Default config:
 	gfx_options_t gfx_options;
 
 #ifdef CUSTOM_GRAPHICS_OPTIONS
-	gfx_options.buffer_pics_nr = 0;
 	gfx_options.pic0_unscaled = 1;
-#if 0
-	gfx_options.pic0_dither_mode = GFXR_DITHER_MODE_F256;
-	gfx_options.pic0_dither_pattern = GFXR_DITHER_PATTERN_SCALED;
-#endif
+	gfx_options.pic0_dither_mode = (DitherMode)ConfMan.getInt("dither_mode");
 	gfx_options.pic0_brush_mode = GFX_BRUSH_MODE_RANDOM_ELLIPSES;
 	gfx_options.pic0_line_mode = GFX_LINE_MODE_CORRECT;
 	gfx_options.cursor_xlate_filter = (gfx_xlate_filter_t)ConfMan.getInt("cursor_filter");


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