aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/gfx
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/gfx')
-rw-r--r--engines/sci/gfx/gfx_options.h8
-rw-r--r--engines/sci/gfx/gfx_resmgr.cpp25
-rw-r--r--engines/sci/gfx/gfx_resource.h26
-rw-r--r--engines/sci/gfx/res_pic.cpp17
4 files changed, 19 insertions, 57 deletions
diff --git a/engines/sci/gfx/gfx_options.h b/engines/sci/gfx/gfx_options.h
index 6060b30b4d..03b00ca616 100644
--- a/engines/sci/gfx/gfx_options.h
+++ b/engines/sci/gfx/gfx_options.h
@@ -47,15 +47,9 @@ namespace Sci {
*/
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 */
-
-#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
+ DitherMode pic0_dither_mode; /* Mode to use for pic0 dithering, defined in gfx_resource.h */
gfx_brush_mode_t pic0_brush_mode;
gfx_line_mode_t pic0_line_mode;
diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp
index 0307fec026..9aa829c90c 100644
--- a/engines/sci/gfx/gfx_resmgr.cpp
+++ b/engines/sci/gfx/gfx_resmgr.cpp
@@ -119,12 +119,10 @@ int GfxResManager::calculatePic(gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic
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);
-#endif
+ gfxr_dither_pic0(scaled_pic, kDitherNone);
#endif
}
@@ -152,22 +150,15 @@ int GfxResManager::getOptionsHash(gfx_resource_type_t type) {
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 @@ gfxr_pic_t *GfxResManager::getPic(int num, int maps, int flags, int default_pale
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 @@ gfxr_pic_t *GfxResManager::getPic(int num, int maps, int flags, int default_pale
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_pic_t *GfxResManager::addToPic(int old_nr, int new_nr, int flags, int old_d
_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);
diff --git a/engines/sci/gfx/gfx_resource.h b/engines/sci/gfx/gfx_resource.h
index 79fa955666..5fcf67e3fa 100644
--- a/engines/sci/gfx/gfx_resource.h
+++ b/engines/sci/gfx/gfx_resource.h
@@ -42,17 +42,12 @@ namespace Common {
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 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
+/* Dithering modes for SCI0 games */
+enum DitherMode {
+ kDitherNone = 0, // No dithering
+ kDither16Colors = 1, // Sierra SCI style
+ kDither256Colors = 2 // Enhanced style
+};
#define SCI_TITLEBAR_SIZE 10
@@ -247,16 +242,13 @@ void gfxr_draw_pic11(gfxr_pic_t *pic, int fill_normally,
*/
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.
diff --git a/engines/sci/gfx/res_pic.cpp b/engines/sci/gfx/res_pic.cpp
index 90f100a901..041a47119f 100644
--- a/engines/sci/gfx/res_pic.cpp
+++ b/engines/sci/gfx/res_pic.cpp
@@ -1684,36 +1684,34 @@ void gfxr_draw_pic11(gfxr_pic_t *pic, int flags, int default_palette, int size,
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 @@ void gfxr_dither_pic0(gfxr_pic_t *pic, int dmode, int pattern) {
}
}
}
-#endif
} // End of namespace Sci