aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorFilippos Karapetis2009-10-25 20:53:07 +0000
committerFilippos Karapetis2009-10-25 20:53:07 +0000
commit1a4b61739832a1f1d597b9c56e67dd8b80b32f76 (patch)
tree3c80fcc922210f4e89b134443b45bba8365febbe /engines/sci
parent0315264328af6b34a4c9e1028bba07a636da5df8 (diff)
downloadscummvm-rg350-1a4b61739832a1f1d597b9c56e67dd8b80b32f76.tar.gz
scummvm-rg350-1a4b61739832a1f1d597b9c56e67dd8b80b32f76.tar.bz2
scummvm-rg350-1a4b61739832a1f1d597b9c56e67dd8b80b32f76.zip
- Removed graphics options code from the old GUI. Almost all of them are not supposed to be modified by the user (e.g. the way lines and brushes are drawn), and we can implement any of them again if needed in the new GUI (but they shouldn't really be needed).
- Added a config option to disable dithering in the new GUI if requested, called "undither", which is set to true by default and can be changed to false if needed per game - The per-resource palette code has been removed for now, to be replaced by regular hashmaps (once the FreeSCI scifx reading code has been converted) svn-id: r45378
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/game.cpp8
-rw-r--r--engines/sci/gfx/gfx_options.h63
-rw-r--r--engines/sci/gfx/gfx_pixmap_scale.cpp11
-rw-r--r--engines/sci/gfx/gfx_res_options.cpp140
-rw-r--r--engines/sci/gfx/gfx_res_options.h91
-rw-r--r--engines/sci/gfx/gfx_resmgr.cpp136
-rw-r--r--engines/sci/gfx/gfx_resmgr.h23
-rw-r--r--engines/sci/gfx/gfx_state_internal.h1
-rw-r--r--engines/sci/gfx/gfx_system.h3
-rw-r--r--engines/sci/gfx/gfx_tools.cpp70
-rw-r--r--engines/sci/gfx/gfx_tools.h9
-rw-r--r--engines/sci/gfx/operations.cpp11
-rw-r--r--engines/sci/gfx/operations.h7
-rw-r--r--engines/sci/gui32/res_pic.cpp145
-rw-r--r--engines/sci/module.mk1
-rw-r--r--engines/sci/sci.cpp20
16 files changed, 23 insertions, 716 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index b1c08ee2fe..c2db6fc793 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -283,14 +283,6 @@ int _reset_graphics_input(EngineState *s) {
}
int game_init_graphics(EngineState *s) {
-#ifdef CUSTOM_GRAPHICS_OPTIONS
-#ifndef WITH_PIC_SCALING
- if (s->gfx_state->options->pic0_unscaled == 0)
- warning("Pic scaling was disabled; your version of ScummVM has no support for scaled pic drawing built in.");
-
- s->gfx_state->options->pic0_unscaled = 1;
-#endif
-#endif
return _reset_graphics_input(s);
}
diff --git a/engines/sci/gfx/gfx_options.h b/engines/sci/gfx/gfx_options.h
deleted file mode 100644
index 398cb379c9..0000000000
--- a/engines/sci/gfx/gfx_options.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-
-#ifndef SCI_GFX_GFX_OPTIONS_H
-#define SCI_GFX_GFX_OPTIONS_H
-
-#include "sci/gfx/gfx_resource.h"
-#include "sci/gfx/gfx_tools.h"
-
-// Define this to enable user-defined custom graphics options
-#define CUSTOM_GRAPHICS_OPTIONS
-
-#ifdef CUSTOM_GRAPHICS_OPTIONS
-#include "sci/gfx/gfx_res_options.h"
-#endif
-
-namespace Sci {
-
-/**
- * All user options to the rendering pipeline
- *
- * See note in sci_conf.h for config_entry_t before changing types of
- * variables
- */
-struct gfx_options_t {
-#ifdef CUSTOM_GRAPHICS_OPTIONS
- /* 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 */
-
- gfx_brush_mode_t pic0_brush_mode;
- gfx_line_mode_t pic0_line_mode;
-
- gfx_res_fullconf_t res_conf; /* Resource customisation: Per-resource palettes etc. */
-#endif
-};
-
-} // End of namespace Sci
-
-#endif // SCI_GFX_GFX_OPTIONS_H
diff --git a/engines/sci/gfx/gfx_pixmap_scale.cpp b/engines/sci/gfx/gfx_pixmap_scale.cpp
index 5681bdac1c..5b126f71d2 100644
--- a/engines/sci/gfx/gfx_pixmap_scale.cpp
+++ b/engines/sci/gfx/gfx_pixmap_scale.cpp
@@ -99,13 +99,8 @@ static void _gfx_xlate_pixmap_unfiltered(gfx_mode_t *mode, gfx_pixmap_t *pxm, in
}
}
- if (pxm->flags & GFX_PIXMAP_FLAG_SCALED_INDEX) {
- pxm->width = pxm->index_width;
- pxm->height = pxm->index_height;
- } else {
- pxm->width = pxm->index_width * mode->scaleFactor;
- pxm->height = pxm->index_height * mode->scaleFactor;
- }
+ pxm->width = pxm->index_width;
+ pxm->height = pxm->index_height;
}
@@ -123,7 +118,7 @@ void gfx_xlate_pixmap(gfx_pixmap_t *pxm, gfx_mode_t *mode) {
pxm->alpha_map = (byte*)malloc(mode->scaleFactor * mode->scaleFactor * pxm->index_width * pxm->index_height + 1);
}
- _gfx_xlate_pixmap_unfiltered(mode, pxm, !(pxm->flags & GFX_PIXMAP_FLAG_SCALED_INDEX));
+ _gfx_xlate_pixmap_unfiltered(mode, pxm, false);
if (pxm->palette)
pxm->palette_revision = pxm->palette->getRevision();
diff --git a/engines/sci/gfx/gfx_res_options.cpp b/engines/sci/gfx/gfx_res_options.cpp
deleted file mode 100644
index 8a8637bf48..0000000000
--- a/engines/sci/gfx/gfx_res_options.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "sci/sci.h"
-#include "sci/gfx/gfx_system.h"
-#include "sci/gfx/gfx_options.h"
-#include "sci/gfx/gfx_resmgr.h"
-
-#ifdef CUSTOM_GRAPHICS_OPTIONS
-
-namespace Sci {
-
-static bool matches_patternlist(gfx_res_pattern_t *patterns, int nr, int val) {
- for (int i = 0; i < nr; i++)
- if (patterns[i].min <= val && patterns[i].max >= val)
- return true;
-
- return false;
-}
-
-static bool resource_matches_patternlists(gfx_res_conf_t *conf, int type, int nr, int loop, int cel) {
- int loc;
- if (conf->patterns_nr && !matches_patternlist(conf->patterns, conf->patterns_nr, nr))
- return false;
-
- if (type == GFX_RESOURCE_TYPE_CURSOR)
- return true;
-
- /* Otherwise, we must match at least the loop (pic)
- ** and, for views, the cel as well */
- loc = conf->patterns_nr;
- if (conf->loops_nr &&
- !matches_patternlist(conf->patterns + loc,
- conf->loops_nr,
- loop))
- return false;
-
- if (type != GFX_RESOURCE_TYPE_VIEW)
- return true;
-
- loc += conf->loops_nr;
-
- if (!conf->cels_nr)
- return true;
-
- return matches_patternlist(conf->patterns + loc, conf->cels_nr, cel);
-}
-
-static gfx_res_conf_t *find_match(gfx_res_conf_t *conflist, int type, int nr, int loop, int cel) {
- while (conflist) {
- if (resource_matches_patternlists(conflist, type, nr, loop, cel))
- return conflist;
-
- conflist = conflist->next;
- }
-
- return NULL;
-}
-
-void apply_mod(byte rFactor, byte gFactor, byte bFactor, gfx_pixmap_t *pxm) {
- Palette *pal = pxm->palette;
- int i, pal_size = pal ? pal->size() : 0;
-
- // Id the pixmap's palette is shared, duplicate it
- if (pal && pal->isShared()) {
- pal = pxm->palette->copy();
- pxm->palette->free();
- pxm->palette = pal;
- }
-
- for (i = 0; i < pal_size; i++) {
- PaletteEntry c = pal->getColor(i);
- c.r = CLIP<int>((c.r * rFactor) >> 4, 0, 255);
- c.g = CLIP<int>((c.g * gFactor) >> 4, 0, 255);
- c.b = CLIP<int>((c.b * bFactor) >> 4, 0, 255);
- pal->setColor(i, c.r, c.g, c.b);
- }
-}
-
-int gfx_get_res_config(gfx_res_fullconf_t res_conf, gfx_pixmap_t *pxm) {
- int restype = GFXR_RES_TYPE(pxm->ID);
- int nr = GFXR_RES_NR(pxm->ID);
- int loop = pxm->loop;
- int cel = pxm->cel;
-
- gfx_res_conf_t *conf;
-
- if (pxm->ID < 0 || restype < 0 || restype >= GFX_RESOURCE_TYPES_NR)
- return 1; // Not appropriate
-
- // Find assignment config, if available
- conf = find_match(res_conf.assign[restype], restype, nr, loop, cel);
- if (conf) {
- // Assign palette
- if (pxm->palette)
- pxm->palette->free();
-
- pxm->palette = new Palette(conf->colors,
- conf->colors_nr);
- pxm->palette->name = "res";
- }
-
- // Find mod config, if available
- conf = res_conf.mod[restype];
- while (conf) {
- conf = find_match(conf, restype, nr, loop, cel);
- if (conf) {
- apply_mod(conf->rFactor, conf->gFactor, conf->bFactor, pxm);
- conf = conf->next;
- }
- }
-
- return 0;
-}
-
-} // End of namespace Sci
-
-#endif
diff --git a/engines/sci/gfx/gfx_res_options.h b/engines/sci/gfx/gfx_res_options.h
deleted file mode 100644
index 97347d3427..0000000000
--- a/engines/sci/gfx/gfx_res_options.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef SCI_GFX_GFX_RES_OPTIONS_H
-#define SCI_GFX_GFX_RES_OPTIONS_H
-
-#ifdef CUSTOM_GRAPHICS_OPTIONS
-
-#include "sci/sci.h"
-#include "sci/gfx/gfx_resource.h"
-#include "sci/gfx/gfx_resmgr.h"
-
-namespace Sci {
-/** @name Configuration options for per-resource customisations */
-/** @{ */
-
-struct gfx_res_pattern_t {
- int min, max;
-};
-
-/**
- * GFX resource modifications/
- */
-struct gfx_res_conf_t {
- int type; /**< Resource type-- only one allowed */
-
- /* If any of the following is 0, it means that there is no restriction.
- ** Otherwise, one of the patterns associated with them must match. */
- int patterns_nr; /**< Number of patterns (only 'view' patterns for views) */
- int loops_nr, cels_nr; /**< Number of loop/cel patterns, for views only.
- ** For pics, loops_nr identifies the palette. */
-
- gfx_res_pattern_t *patterns;
-
- int colors_nr;
- PaletteEntry *colors;
- byte rFactor, gFactor, bFactor;
-
- gfx_res_conf_t *next;
-};
-
-
-struct gfx_res_fullconf_t {
- gfx_res_conf_t *assign[GFX_RESOURCE_TYPES_NR];
- gfx_res_conf_t *mod[GFX_RESOURCE_TYPES_NR];
-};
-
-
-struct gfx_options_t;
-
-/**
- * Configures a graphical pixmap according to config options.
- *
- * Modifies pxm as considered appropriate by configuration options. Does
- * not do anything in colour index mode.
- *
- * @param[in] res_conf The resource options according to which modifications
- * should be performed
- * @param[in] pxm The pixmap to configure
- * @return 0 on success, non-zero otherwise
- */
-int gfx_get_res_config(gfx_res_fullconf_t res_conf, gfx_pixmap_t *pxm);
-
-/** @} */
-} // End of namespace Sci
-
-#endif
-
-#endif // SCI_GFX_GFX_RES_OPTIONS_H
diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp
index 9b94ab6a4b..b53aa419fb 100644
--- a/engines/sci/gfx/gfx_resmgr.cpp
+++ b/engines/sci/gfx/gfx_resmgr.cpp
@@ -44,16 +44,13 @@
namespace Sci {
-// Invalid hash mode: Used to invalidate modified pics
-#define MODE_INVALID -1
-
struct param_struct {
int args[4];
GfxDriver *driver;
};
-GfxResManager::GfxResManager(gfx_options_t *options, GfxDriver *driver, ResourceManager *resMan, SciGuiScreen *screen, SciGuiPalette *palette) :
- _options(options), _driver(driver), _resMan(resMan), _screen(screen), _palette(palette),
+GfxResManager::GfxResManager(GfxDriver *driver, ResourceManager *resMan, SciGuiScreen *screen, SciGuiPalette *palette) :
+ _driver(driver), _resMan(resMan), _screen(screen), _palette(palette),
_lockCounter(0), _tagLockCounter(0), _staticPalette(0) {
gfxr_init_static_palette();
@@ -86,14 +83,8 @@ void GfxResManager::calculatePic(gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pi
basic_style.line_mode = GFX_LINE_MODE_CORRECT;
basic_style.brush_mode = GFX_BRUSH_MODE_SCALED;
-
-#ifdef CUSTOM_GRAPHICS_OPTIONS
- style.line_mode = _options->pic0_line_mode;
- style.brush_mode = _options->pic0_brush_mode;
-#else
style.line_mode = GFX_LINE_MODE_CORRECT;
style.brush_mode = GFX_BRUSH_MODE_RANDOM_ELLIPSES;
-#endif
if (!res || !res->data)
error("calculatePic(): pic number %d not found", nr);
@@ -122,11 +113,7 @@ void GfxResManager::calculatePic(gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pi
memcpy(scaled_pic->undithered_buffer, scaled_pic->visual_map->index_data, scaled_pic->undithered_buffer_size);
-#ifdef CUSTOM_GRAPHICS_OPTIONS
- gfxr_dither_pic0(scaled_pic, _options->pic0_dither_mode);
-#else
gfxr_dither_pic0(scaled_pic, kDitherNone);
-#endif
}
// Mark default palettes
@@ -137,41 +124,6 @@ void GfxResManager::calculatePic(gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pi
unscaled_pic->visual_map->loop = default_palette;
}
-int GfxResManager::getOptionsHash(gfx_resource_type_t type) {
- switch (type) {
- case GFX_RESOURCE_TYPE_VIEW:
- // This should never happen
- error("getOptionsHash called on a VIEW resource");
-
- case GFX_RESOURCE_TYPE_PIC:
-#ifdef CUSTOM_GRAPHICS_OPTIONS
- if (_resMan->isVGA())
- // NOTE: here, it is assumed that the upper port bound is always 10, but this doesn't seem to matter for the
- // generated options hash anyway
- return 10;
- else
- return (_options->pic0_unscaled) ? 0x10000 :
- (_options->pic0_dither_mode << 12) |
- (_options->pic0_brush_mode << 4) |
- (_options->pic0_line_mode);
-#else
- if (_resMan->isVGA())
- return 10;
- else
- return 0x10000 | (GFX_BRUSH_MODE_RANDOM_ELLIPSES << 4) | GFX_LINE_MODE_CORRECT;
-#endif
-
- case GFX_RESOURCE_TYPE_FONT:
- case GFX_RESOURCE_TYPE_CURSOR:
- return 0;
-
- case GFX_RESOURCE_TYPES_NR:
- default:
- error("Invalid resource type: %d", type);
- return -1;
- }
-}
-
#define FREEALL(freecmd, type) \
if (resource->scaled_data.type) \
freecmd(resource->scaled_data.type); \
@@ -299,8 +251,7 @@ void GfxResManager::setStaticPalette(Palette *newPalette)
} \
}
-static gfxr_pic_t *gfxr_pic_xlate_common(gfx_resource_t *res, int maps, int scaled, int force, gfx_mode_t *mode,
- gfx_options_t *options) {
+static gfxr_pic_t *gfxr_pic_xlate_common(gfx_resource_t *res, int maps, int scaled, int force, gfx_mode_t *mode) {
XLATE_AS_APPROPRIATE(GFX_MASK_VISUAL, visual_map);
XLATE_AS_APPROPRIATE(GFX_MASK_PRIORITY, priority_map);
@@ -324,27 +275,16 @@ gfxr_pic_t *GfxResManager::getPic(int num, int maps, int flags, int default_pale
gfxr_pic_t *npic = NULL;
IntResMap &resMap = _resourceMaps[GFX_RESOURCE_TYPE_PIC];
gfx_resource_t *res = NULL;
- int hash = getOptionsHash(GFX_RESOURCE_TYPE_PIC);
int need_unscaled = (_driver->getMode()->scaleFactor != 1);
- hash |= (flags << 20) | ((default_palette & 0x7) << 28);
-
res = resMap.contains(num) ? resMap[num] : NULL;
- if (!res || res->mode != hash) {
+ if (!res) {
gfxr_pic_t *pic = NULL;
gfxr_pic_t *unscaled_pic = NULL;
-#ifdef CUSTOM_GRAPHICS_OPTIONS
- if (_options->pic0_unscaled) {
- need_unscaled = 0;
- pic = gfxr_init_pic(&mode_1x1_color_index, GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _resMan->isVGA());
- } else
- pic = gfxr_init_pic(_driver->getMode(), GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _resMan->isVGA());
-#else
need_unscaled = 0;
pic = gfxr_init_pic(_driver->getMode(), GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _resMan->isVGA());
-#endif
if (!pic) {
error("Failed to allocate scaled pic");
@@ -375,21 +315,13 @@ gfxr_pic_t *GfxResManager::getPic(int num, int maps, int flags, int default_pale
gfxr_free_pic(res->unscaled_data.pic);
}
- res->mode = hash;
res->scaled_data.pic = pic;
res->unscaled_data.pic = unscaled_pic;
} else {
res->lock_sequence_nr = 0;
}
-#ifdef CUSTOM_GRAPHICS_OPTIONS
- npic = gfxr_pic_xlate_common(res, maps, scaled || _options->pic0_unscaled, 0, _driver->getMode(),
- _options);
-#else
- npic = gfxr_pic_xlate_common(res, maps, 1, 0, _driver->getMode(),
- _options);
-#endif
-
+ npic = gfxr_pic_xlate_common(res, maps, 1, 0, _driver->getMode());
return npic;
}
@@ -417,44 +349,15 @@ static int get_pic_id(gfx_resource_t *res) {
return res->unscaled_data.pic->visual_map->ID;
}
-static void _gfxr_unscale_pixmap_index_data(gfx_pixmap_t *pxm, gfx_mode_t *mode) {
- int xmod = mode->scaleFactor; // Step size horizontally
- int ymod = pxm->index_width * mode->scaleFactor; // Vertical step size
- int maxpos = pxm->index_width * pxm->index_height;
- int pos;
- byte *dest = pxm->index_data;
-
- if (!(pxm->flags & GFX_PIXMAP_FLAG_SCALED_INDEX))
- return; // It's not scaled!
-
- for (pos = 0; pos < maxpos; pos += ymod) {
- int c;
-
- for (c = 0; c < pxm->index_width; c += xmod)
- *dest++ = pxm->index_data[pos + c];
- // No overwrite since line and offset readers move much faster (proof by in-duction, trivial
- // and left to the reader)
- }
-
- pxm->index_width /= mode->scaleFactor;
- pxm->index_height /= mode->scaleFactor;
- pxm->flags &= ~GFX_PIXMAP_FLAG_SCALED_INDEX;
-}
-
gfxr_pic_t *GfxResManager::addToPic(int old_nr, int new_nr, int flags, int old_default_palette, int default_palette) {
IntResMap &resMap = _resourceMaps[GFX_RESOURCE_TYPE_PIC];
gfxr_pic_t *pic = NULL;
gfx_resource_t *res = NULL;
- int hash = getOptionsHash(GFX_RESOURCE_TYPE_PIC);
-#ifdef CUSTOM_GRAPHICS_OPTIONS
- int need_unscaled = !(_options->pic0_unscaled) && (_driver->getMode()->scaleFactor != 1 || _driver->getMode()->scaleFactor != 1);
-#else
int need_unscaled = 1;
-#endif
res = resMap.contains(old_nr) ? resMap[old_nr] : NULL;
- if (!res || (res->mode != MODE_INVALID && res->mode != hash)) {
+ if (!res) {
getPic(old_nr, 0, flags, old_default_palette, 1);
res = resMap.contains(old_nr) ? resMap[old_nr] : NULL;
@@ -465,31 +368,15 @@ gfxr_pic_t *GfxResManager::addToPic(int old_nr, int new_nr, int flags, int old_d
}
}
-#ifdef CUSTOM_GRAPHICS_OPTIONS
- if (_options->pic0_unscaled) // Unscale priority map, if we scaled it earlier
-#endif
- _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)
res->lock_sequence_nr = 0;
calculatePic(res->scaled_data.pic, need_unscaled ? res->unscaled_data.pic : NULL,
flags | DRAWPIC01_FLAG_OVERLAID_PIC, default_palette, new_nr);
- res->mode = MODE_INVALID; // Invalidate
-
-#ifdef CUSTOM_GRAPHICS_OPTIONS
- if (_options->pic0_unscaled) // Scale priority map again, if needed
-#endif
- res->scaled_data.pic->priority_map = gfx_pixmap_scale_index_data(res->scaled_data.pic->priority_map, _driver->getMode());
-
{
int old_ID = get_pic_id(res);
set_pic_id(res, GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, new_nr)); // To ensure that our graphical translation options work properly
-#ifdef CUSTOM_GRAPHICS_OPTIONS
- pic = gfxr_pic_xlate_common(res, GFX_MASK_VISUAL, 1, 1, _driver->getMode(), _options);
-#else
- pic = gfxr_pic_xlate_common(res, GFX_MASK_VISUAL, 1, 1, _driver->getMode(), _options);
-#endif
+ pic = gfxr_pic_xlate_common(res, GFX_MASK_VISUAL, 1, 1, _driver->getMode());
set_pic_id(res, old_ID);
}
@@ -506,7 +393,7 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) {
gfxr_loop_t *loop_data = NULL;
gfx_pixmap_t *cel_data = NULL;
- if (!res || res->mode != hash) {
+ if (!res) {
// Wrapper code for the new view decoder
view = (gfxr_view_t *)malloc(sizeof(gfxr_view_t));
@@ -575,13 +462,11 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) {
res->scaled_data.view = NULL;
res->ID = GFXR_RES_ID(GFX_RESOURCE_TYPE_VIEW, nr);
res->lock_sequence_nr = _tagLockCounter;
- res->mode = hash;
resMap[nr] = res;
} else {
gfxr_free_view(res->unscaled_data.view);
}
- res->mode = hash;
res->unscaled_data.view = view;
} else {
@@ -595,7 +480,6 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) {
cel_data = loop_data->cels[*cel];
if (!cel_data->data) {
- gfx_get_res_config(_options->res_conf, cel_data);
gfx_xlate_pixmap(cel_data, _driver->getMode());
}
@@ -605,7 +489,6 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) {
gfx_bitmap_font_t *GfxResManager::getFont(int num, bool scaled) {
IntResMap &resMap = _resourceMaps[GFX_RESOURCE_TYPE_FONT];
gfx_resource_t *res = NULL;
- int hash = getOptionsHash(GFX_RESOURCE_TYPE_FONT);
// Workaround: lsl1sci mixes its own internal fonts with the global
// SCI ones, so we translate them here, by removing their extra bits
@@ -614,7 +497,7 @@ gfx_bitmap_font_t *GfxResManager::getFont(int num, bool scaled) {
res = resMap.contains(num) ? resMap[num] : NULL;
- if (!res || res->mode != hash) {
+ if (!res) {
Resource *fontRes = _resMan->findResource(ResourceId(kResourceTypeFont, num), 0);
if (!fontRes || !fontRes->data)
return NULL;
@@ -626,7 +509,6 @@ gfx_bitmap_font_t *GfxResManager::getFont(int num, bool scaled) {
res->scaled_data.font = NULL;
res->ID = GFXR_RES_ID(GFX_RESOURCE_TYPE_FONT, num);
res->lock_sequence_nr = _tagLockCounter;
- res->mode = hash;
resMap[num] = res;
} else {
gfxr_free_font(res->unscaled_data.font);
diff --git a/engines/sci/gfx/gfx_resmgr.h b/engines/sci/gfx/gfx_resmgr.h
index 1f03af0818..b6dea1a8e2 100644
--- a/engines/sci/gfx/gfx_resmgr.h
+++ b/engines/sci/gfx/gfx_resmgr.h
@@ -64,7 +64,6 @@ enum gfx_resource_type_t {
struct gfx_resource_t {
int ID; /**< Resource ID */
int lock_sequence_nr; /**< See description of lock_counter in GfxResManager */
- int mode; /**< A mode type hash */
/** Scaled pic */
union {
@@ -92,28 +91,9 @@ typedef Common::HashMap<int, gfx_resource_t *> IntResMap;
/** Graphics resource manager */
class GfxResManager {
public:
- GfxResManager(gfx_options_t *options, GfxDriver *driver, ResourceManager *resMan, SciGuiScreen *screen, SciGuiPalette *palette);
+ GfxResManager(GfxDriver *driver, ResourceManager *resMan, SciGuiScreen *screen, SciGuiPalette *palette);
~GfxResManager();
- /**
- * Calculates a unique hash value for the specified options/type
- * setup.
- *
- * Covering more entries than relevant may slow down the system when
- * options are changed, while covering less may result in invalid
- * cached data being used.
- * Only positive values may be returned, as negative values are used
- * internally by the generic resource manager code.
- * Also, only the lower 20 bits are available to the interpreter.
- * (Yes, this isn't really a "hash" in the traditional sense...)
- *
- * @param[in] type The type the hash is to be generated for
- * @return A hash over the values of the options entries,
- * covering entries iff they are relevant for the
- * specified type.
- */
- int getOptionsHash(gfx_resource_type_t type);
-
/**
* 'Tags' all resources for deletion.
@@ -284,7 +264,6 @@ public:
}
private:
- gfx_options_t *_options;
GfxDriver *_driver;
Palette *_staticPalette;
int _lockCounter; /**< Global lock counter; increased for each new
diff --git a/engines/sci/gfx/gfx_state_internal.h b/engines/sci/gfx/gfx_state_internal.h
index aeb3b05cd4..5334971e23 100644
--- a/engines/sci/gfx/gfx_state_internal.h
+++ b/engines/sci/gfx/gfx_state_internal.h
@@ -28,7 +28,6 @@
#include "sci/engine/vm.h"
#include "sci/gfx/gfx_tools.h"
-#include "sci/gfx/gfx_options.h"
#include "sci/gfx/operations.h"
#include "sci/gfx/gfx_resmgr.h"
#include "sci/gfx/gfx_system.h"
diff --git a/engines/sci/gfx/gfx_system.h b/engines/sci/gfx/gfx_system.h
index 7dd779ca01..31b799b8fe 100644
--- a/engines/sci/gfx/gfx_system.h
+++ b/engines/sci/gfx/gfx_system.h
@@ -130,9 +130,6 @@ extern rect_t gfx_rect_fullscreen;
#define GFX_PIC_COLORS 256
-#define GFX_PIXMAP_FLAG_SCALED_INDEX (1<<0) /* Index data is scaled already */
-#define GFX_PIXMAP_FLAG_INSTALLED (1<<2) /* Pixmap has been registered */
-
#define GFX_PIXMAP_COLOR_KEY_NONE -1 /* No transpacency colour key */
#define GFX_CURSOR_TRANSPARENT 255 // Cursor colour key
diff --git a/engines/sci/gfx/gfx_tools.cpp b/engines/sci/gfx/gfx_tools.cpp
index aa98d44332..eef89ded1b 100644
--- a/engines/sci/gfx/gfx_tools.cpp
+++ b/engines/sci/gfx/gfx_tools.cpp
@@ -144,13 +144,8 @@ gfx_pixmap_t *gfx_pixmap_alloc_data(gfx_pixmap_t *pixmap, gfx_mode_t *mode) {
return pixmap;
}
- if (pixmap->flags & GFX_PIXMAP_FLAG_SCALED_INDEX) {
- pixmap->width = pixmap->index_width;
- pixmap->height = pixmap->index_height;
- } else {
- pixmap->width = pixmap->index_width * mode->scaleFactor;
- pixmap->height = pixmap->index_height * mode->scaleFactor;
- }
+ pixmap->width = pixmap->index_width;
+ pixmap->height = pixmap->index_height;
size = pixmap->width * pixmap->height;
if (!size)
@@ -160,65 +155,4 @@ gfx_pixmap_t *gfx_pixmap_alloc_data(gfx_pixmap_t *pixmap, gfx_mode_t *mode) {
return pixmap;
}
-gfx_pixmap_t *gfx_pixmap_scale_index_data(gfx_pixmap_t *pixmap, gfx_mode_t *mode) {
- byte *old_data, *new_data, *initial_new_data;
- byte *linestart;
- int linewidth;
- int xl, yl;
- int i, yc;
- int xfact = mode->scaleFactor;
- int yfact = mode->scaleFactor;
-
- if (xfact == 1 && yfact == 1)
- return pixmap;
-
- if (!pixmap)
- return NULL;
-
- if (pixmap->flags & GFX_PIXMAP_FLAG_SCALED_INDEX)
- return pixmap; // Already done
-
- old_data = pixmap->index_data;
-
- if (!old_data) {
- error("Attempt to scale index data without index data!\n");
- return pixmap;
- }
-
- xl = pixmap->index_width;
- yl = pixmap->index_height;
- linewidth = xfact * xl;
- initial_new_data = new_data = (byte *)malloc(linewidth * yfact * yl);
-
- for (yc = 0; yc < yl; yc++) {
-
- linestart = new_data;
-
- if (xfact == 1) {
- memcpy(new_data, old_data, linewidth);
- new_data += linewidth;
- old_data += linewidth;
- } else for (i = 0; i < xl; i++) {
- byte fillc = *old_data++;
- memset(new_data, fillc, xfact);
- new_data += xfact;
- }
-
- for (i = 1; i < yfact; i++) {
- memcpy(new_data, linestart, linewidth);
- new_data += linewidth;
- }
- }
-
- free(pixmap->index_data);
- pixmap->index_data = initial_new_data;
-
- pixmap->flags |= GFX_PIXMAP_FLAG_SCALED_INDEX;
-
- pixmap->index_width = linewidth;
- pixmap->index_height *= yfact;
-
- return pixmap;
-}
-
} // End of namespace Sci
diff --git a/engines/sci/gfx/gfx_tools.h b/engines/sci/gfx/gfx_tools.h
index 57a70f50ad..2d15b51022 100644
--- a/engines/sci/gfx/gfx_tools.h
+++ b/engines/sci/gfx/gfx_tools.h
@@ -180,15 +180,6 @@ void gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority,
byte *priority_dest, int priority_line_width, int priority_skip);
-/**
- * Scales the index data associated with a pixmap
- *
- * @param[in] pixmap The pixmap whose index data should be scaled
- * @param[in] mode The mode to scale it to
- * @return The pixmap
- */
-gfx_pixmap_t *gfx_pixmap_scale_index_data(gfx_pixmap_t *pixmap, gfx_mode_t *mode);
-
/** @} */
} // End of namespace Sci
diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp
index 0a51004f1d..9edba13ae8 100644
--- a/engines/sci/gfx/operations.cpp
+++ b/engines/sci/gfx/operations.cpp
@@ -354,12 +354,9 @@ static void init_aux_pixmap(gfx_pixmap_t **pixmap) {
(*pixmap)->palette = new Palette(default_colors, DEFAULT_COLORS_NR);
}
-void gfxop_init(GfxState *state,
- gfx_options_t *options, ResourceManager *resMan,
+void gfxop_init(GfxState *state, ResourceManager *resMan,
SciGuiScreen *screen, SciGuiPalette *palette, int scaleFactor) {
- state->options = options;
state->visible_map = GFX_MASK_VISUAL;
- state->options = options;
state->disable_dirty = 0;
state->_events.clear();
state->pic = state->pic_unscaled = NULL;
@@ -370,7 +367,7 @@ void gfxop_init(GfxState *state,
state->driver = new GfxDriver(screen, scaleFactor);
- state->gfxResMan = new GfxResManager(state->options, state->driver, resMan, screen, palette);
+ state->gfxResMan = new GfxResManager(state->driver, resMan, screen, palette);
gfxop_set_clip_zone(state, gfx_rect(0, 0, 320, 200));
@@ -1382,10 +1379,6 @@ static void _gfxop_set_pic(GfxState *state) {
_gfxop_install_pixmap(state->driver, state->pic->visual_map);
}
-#ifdef CUSTOM_GRAPHICS_OPTIONS
- if (state->options->pic0_unscaled)
-#endif
- state->pic->priority_map = gfx_pixmap_scale_index_data(state->pic->priority_map, state->driver->getMode());
state->driver->setStaticBuffer(state->pic->visual_map, state->pic->priority_map);
}
diff --git a/engines/sci/gfx/operations.h b/engines/sci/gfx/operations.h
index 0255130b37..6e6ff938e5 100644
--- a/engines/sci/gfx/operations.h
+++ b/engines/sci/gfx/operations.h
@@ -30,7 +30,6 @@
#include "sci/gfx/gfx_resmgr.h"
#include "sci/gfx/gfx_tools.h"
-#include "sci/gfx/gfx_options.h"
#include "sci/gfx/gfx_system.h"
#include "sci/uinput.h"
@@ -89,8 +88,6 @@ typedef Common::List<rect_t> DirtyRectList;
struct GfxState {
- gfx_options_t *options;
-
rect_t clip_zone_unscaled; /**< The current UNSCALED clipping zone */
rect_t clip_zone; /**< The current SCALED clipping zone; a cached scaled version of clip_zone_unscaled */
@@ -131,11 +128,9 @@ struct GfxState {
* @param[in] state The state to initialize
* @param[in] scaleFactor Scale factor
* @param[in] mode Graphics mode to use
- * @param[in] options Rendering options
* @param[in] resMan Resource manager to use
*/
-void gfxop_init(GfxState *state,
- gfx_options_t *options, ResourceManager *resMan,
+void gfxop_init(GfxState *state, ResourceManager *resMan,
SciGuiScreen *screen, SciGuiPalette *palette, int scaleFactor = 1);
/**
diff --git a/engines/sci/gui32/res_pic.cpp b/engines/sci/gui32/res_pic.cpp
index 4ecec28011..fde3425d73 100644
--- a/engines/sci/gui32/res_pic.cpp
+++ b/engines/sci/gui32/res_pic.cpp
@@ -167,11 +167,6 @@ gfxr_pic_t *gfxr_init_pic(gfx_mode_t *mode, int ID, bool sci1) {
pic->visual_map->flags = 0;
pic->priority_map->flags = 0;
pic->control_map->flags = 0;
- if (mode->scaleFactor > 1) {
- pic->visual_map->flags |= GFX_PIXMAP_FLAG_SCALED_INDEX;
- pic->priority_map->flags |= GFX_PIXMAP_FLAG_SCALED_INDEX;
- }
-
pic->priority_map->palette = gfx_sci0_image_pal[sci0_palette]->getref();
pic->control_map->palette = gfx_sci0_image_pal[sci0_palette]->getref();
@@ -314,28 +309,6 @@ static void _gfxr_auxbuf_line_clear(gfxr_pic_t *pic, rect_t line, int color, int
#undef LINEMACRO
-#ifdef WITH_PIC_SCALING
-static void _gfxr_auxbuf_propagate_changes(gfxr_pic_t *pic, int bitmask) {
- // Propagates all filled bits into the planes described by bitmask
- unsigned long *data = (unsigned long *)pic->aux_map;
- unsigned long clearmask = 0x07070707;
- unsigned long andmask = (bitmask << 3) | (bitmask << (3 + 8)) | (bitmask << (3 + 16)) | (bitmask << (3 + 24));
-
- if (sizeof(unsigned long) == 8) { // UltraSparc, Alpha, newer MIPSens, etc
- andmask |= (andmask << 32);
- clearmask |= (clearmask << 32);
- }
-
- for (int i = 0; i < GFXR_AUX_MAP_SIZE / sizeof(unsigned long); i++) {
- unsigned long temp = *data & andmask;
- temp >>= 3;
- *data = (temp | *data) & clearmask;
- ++data;
- }
-}
-#endif
-
-
/*** Regular drawing operations ***/
#define PATTERN_FLAG_RECTANGLE 0x10
@@ -878,111 +851,6 @@ static void _gfxr_draw_line(gfxr_pic_t *pic, int x, int y, int ex, int ey, int c
}
-#define IS_FILL_BOUNDARY(x) (((x) & legalmask) != legalcolor)
-
-#ifdef WITH_PIC_SCALING
-
-#define TEST_POINT(xx, yy) \
- if (pic->aux_map[(yy) * 320 + (xx)] & FRESH_PAINT) { \
- mpos = (((yy) * 320 * pic->mode->scaleFactor) + (xx)) * pic->mode->scaleFactor; \
- for (iy = 0; iy < pic->mode->scaleFactor; iy++) { \
- for (ix = 0; ix < pic->mode->scaleFactor; ix++) { \
- if (!IS_FILL_BOUNDARY(test_map[mpos + ix])) { \
- *x = ix + (xx) * pic->mode->scaleFactor; \
- *y = iy + (yy) * pic->mode->scaleFactor; \
- return 0; \
- } \
- mpos += linewidth; \
- } \
- } \
- }
-
-static int _gfxr_find_fill_point(gfxr_pic_t *pic, int min_x, int min_y, int max_x, int max_y, int x_320,
- int y_200, int color, int drawenable, int *x, int *y) {
- // returns -1 on failure, 0 on success
- int linewidth = pic->mode->scaleFactor * 320;
- int mpos, ix, iy;
- int size_x = (max_x - min_x + 1) >> 1;
- int size_y = (max_y - min_y + 1) >> 1;
- int mid_x = min_x + size_x;
- int mid_y = min_y + size_y;
- int max_size = (size_x > size_y) ? size_x : size_y;
- int size;
- int legalcolor;
- int legalmask;
- byte *test_map;
- *x = x_320 * pic->mode->scaleFactor;
- *y = y_200 * pic->mode->scaleFactor;
-
- if (size_x < 0 || size_y < 0)
- return 0;
-
- if (drawenable & GFX_MASK_VISUAL) {
- test_map = pic->visual_map->index_data;
-
- if ((color & 0xf) == 0xf // When dithering with white, do more
- // conservative checks
- || (color & 0xf0) == 0xf0)
- legalcolor = 0xff;
- else
- legalcolor = 0xf0; // Only check the second color
-
- legalmask = legalcolor;
- } else if (drawenable & GFX_MASK_PRIORITY) {
- test_map = pic->priority_map->index_data;
- legalcolor = 0;
- legalmask = 0xf;
- } else return -3;
-
- TEST_POINT(x_320, y_200); // Most likely candidate
- TEST_POINT(mid_x, mid_y); // Second most likely candidate
-
- for (size = 1; size <= max_size; size++) {
- int i;
-
- if (size <= size_y) {
- int limited_size = (size > size_x) ? size_x : size;
-
- for (i = mid_x - limited_size; i <= mid_x + limited_size; i++) {
- TEST_POINT(i, mid_y - size);
- TEST_POINT(i, mid_y + size);
- }
- }
-
- if (size <= size_x) {
- int limited_size = (size - 1 > size_y) ? size_y : size - 1;
-
- for (i = mid_y - limited_size; i <= mid_y + limited_size; i++) {
- TEST_POINT(mid_x - size, i);
- TEST_POINT(mid_x + size, i);
- }
- }
- }
-
- return -1;
-}
-
-#undef TEST_POINT
-
-} // End of namespace Sci
-
-// Now include the actual filling code (with scaling support)
-#define FILL_FUNCTION _gfxr_fill_any
-#define FILL_FUNCTION_RECURSIVE _gfxr_fill_any_recursive
-#define AUXBUF_FILL_HELPER _gfxr_auxbuf_fill_any_recursive
-#define AUXBUF_FILL _gfxr_auxbuf_fill_any
-#define DRAW_SCALED
-# include "picfill.cpp"
-#undef DRAW_SCALED
-#undef AUXBUF_FILL
-#undef AUXBUF_FILL_HELPER
-#undef FILL_FUNCTION_RECURSIVE
-#undef FILL_FUNCTION
-
-namespace Sci {
-
-#endif // defined(WITH_PIC_SCALING)
-
} // End of namespace Sci
// Include again, but this time without support for scaling
@@ -1280,19 +1148,10 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size,
case PIC_OP_FILL:
debugC(2, kDebugLevelSci0Pic, "Fill @%d\n", pos);
while (*(resource + pos) < PIC_OP_FIRST) {
- //fprintf(stderr,"####################\n");
GET_ABS_COORDS(x, y);
debugC(2, kDebugLevelSci0Pic, "Abs coords %d,%d\n", x, y);
- //fprintf(stderr,"C=(%d,%d)\n", x, y + titlebar_size);
-#ifdef WITH_PIC_SCALING
- if (pic->mode->scaleFactor > 1)
- _gfxr_fill_any(pic, x, y + titlebar_size, (flags & DRAWPIC01_FLAG_FILL_NORMALLY) ?
- color : 0, priority, control, drawenable, titlebar_size);
-
- else
-#endif
- _gfxr_fill_1(pic, x, y + titlebar_size, (flags & DRAWPIC01_FLAG_FILL_NORMALLY) ?
- color : 0, priority, control, drawenable, titlebar_size);
+ _gfxr_fill_1(pic, x, y + titlebar_size, (flags & DRAWPIC01_FLAG_FILL_NORMALLY) ?
+ color : 0, priority, control, drawenable, titlebar_size);
}
goto end_op_loop;
diff --git a/engines/sci/module.mk b/engines/sci/module.mk
index 0f4d95010f..8b038bf286 100644
--- a/engines/sci/module.mk
+++ b/engines/sci/module.mk
@@ -38,7 +38,6 @@ MODULE_OBJS := \
gfx/gfx_driver.o \
gfx/gfx_gui.o \
gfx/gfx_pixmap_scale.o \
- gfx/gfx_res_options.o \
gfx/gfx_resmgr.o \
gfx/gfx_resource.o \
gfx/gfx_support.o \
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 4837c87b44..9f3a291733 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -138,24 +138,10 @@ Common::Error SciEngine::run() {
_gamestate->gfx_state = &gfx_state;
// Assign default values to the config manager, in case settings are missing
- ConfMan.registerDefault("dither_mode", "0");
-
- // Default config:
- gfx_options_t gfx_options;
-
-#ifdef CUSTOM_GRAPHICS_OPTIONS
- gfx_options.pic0_unscaled = 1;
- 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;
- for (int i = 0; i < GFX_RESOURCE_TYPES_NR; i++) {
- gfx_options.res_conf.assign[i] = NULL;
- gfx_options.res_conf.mod[i] = NULL;
- }
- // Default config ends
-#endif
+ ConfMan.registerDefault("undither", "true");
+ screen->unditherSetState(ConfMan.getBool("undither"));
- gfxop_init(&gfx_state, &gfx_options, _resMan, screen, palette, 1);
+ gfxop_init(&gfx_state, _resMan, screen, palette, 1);
if (game_init_graphics(_gamestate)) { // Init interpreter graphics
warning("Game initialization failed: Error in GFX subsystem. Aborting...");