aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/gfx
diff options
context:
space:
mode:
authorTravis Howell2009-07-07 23:24:34 +0000
committerTravis Howell2009-07-07 23:24:34 +0000
commit3e47aaa151ff751af867c57344b063c30f5f75f3 (patch)
tree84101b9c9d7eb333063c43a076ae3645a95ab703 /engines/sci/gfx
parentbd87b653aca29c593cadcdedfc2208cec51456aa (diff)
parenta62b26ea8026666fd658337bcc061c1c4e2ab3f9 (diff)
downloadscummvm-rg350-3e47aaa151ff751af867c57344b063c30f5f75f3.tar.gz
scummvm-rg350-3e47aaa151ff751af867c57344b063c30f5f75f3.tar.bz2
scummvm-rg350-3e47aaa151ff751af867c57344b063c30f5f75f3.zip
Merged revisions 42205-42206,42208-42209,42211-42212,42214-42217,42219,42221-42222,42229-42235,42238-42240 via svnmerge from
https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk ........ r42205 | dreammaster | 2009-07-07 17:41:02 +1000 (Tue, 07 Jul 2009) | 1 line Removed the shooting workaround delay - the overlay number can vary, so it isn't a reliable way of identifying the specific message ........ r42206 | thebluegr | 2009-07-07 17:44:25 +1000 (Tue, 07 Jul 2009) | 4 lines - Added auto-detection for EGA graphics. As a result of this, GF_SCI1_EGA has been removed and versions SCI_VERSION_01_EGA and SCI_VERSION_01_VGA have been merged into SCI_VERSION_01 - Simplified the checks for EGA and VGA graphics - Fixed a bug in script_adjust_opcode_formats() - Simplified the code in GfxResManager::getView() a bit ........ r42208 | strangerke | 2009-07-07 17:51:18 +1000 (Tue, 07 Jul 2009) | 1 line Add detection of Playtoons 2 En ........ r42209 | thebluegr | 2009-07-07 17:51:26 +1000 (Tue, 07 Jul 2009) | 1 line Added a SCI1.1 case in the lofss opcode, like in the lofsa opcode (essentially, lofss and lofsa both load an offset, with lofsa loading it in the accumulator and lofss in the stack). lofss is rarely used in SCI1.1 games, which explains why no lofss-related crashes have been observed in SCI1.1 ........ r42211 | thebluegr | 2009-07-07 20:28:05 +1000 (Tue, 07 Jul 2009) | 1 line Added auto-detection for games with older headers for script blocks, and removed game flag GF_SCI0_OLD ........ r42212 | thebluegr | 2009-07-07 21:14:18 +1000 (Tue, 07 Jul 2009) | 1 line Cleanup: added an enum for the auto-detected features, removed the selectors which are only used for auto-detection from the convenience selector map and placed feature auto-detection in a separate function. Also, now the automatically detected graphics resources are shown in the console. ........ r42214 | strangerke | 2009-07-07 21:58:22 +1000 (Tue, 07 Jul 2009) | 2 lines - Separate Playtoons gametypes from in GobEngine::initGameParts() - Add a specific save/load class for Playtoons as some specific files need to be tested ........ r42215 | strangerke | 2009-07-07 22:03:27 +1000 (Tue, 07 Jul 2009) | 3 lines - Add a new gametype for 'The Land of the Magic Stones' - Add detection of the french version - Add a new game feature for 800*600 ........ r42216 | thebluegr | 2009-07-07 22:29:55 +1000 (Tue, 07 Jul 2009) | 1 line Removed the superfluous sci_version_types array (it's essentially the same as the versionNames array) ........ r42217 | strangerke | 2009-07-07 22:51:21 +1000 (Tue, 07 Jul 2009) | 1 line Change SaveLoad_Playtoons case ........ r42219 | thebluegr | 2009-07-07 23:39:24 +1000 (Tue, 07 Jul 2009) | 1 line Removed the weird checks for a maximum resource number (the sci_max_resource_nr array), as it doesn't serve any real purpose and leads to strange errors: if a resource is found which is bigger than the maximum number, it will be remapped to an incorrect number from this check. This makes KQ5CD work properly again (resources would be remapped to incorrect resource numbers from this code as a result of not updating this array with the latest SCI version merges). ........ r42221 | lordhoto | 2009-07-08 00:22:23 +1000 (Wed, 08 Jul 2009) | 1 line Add generic functionallity to draw FM-Towns ROM. (To be used by KYRA and SCI) ........ r42222 | lordhoto | 2009-07-08 00:22:39 +1000 (Wed, 08 Jul 2009) | 1 line Adapt KYRA to use the new Graphics::FontSJIS code. ........ r42229 | sev | 2009-07-08 03:11:29 +1000 (Wed, 08 Jul 2009) | 2 lines kFeatures800 -> kFeatures800x600 in order to have more meaningful name ........ r42230 | lordhoto | 2009-07-08 04:10:35 +1000 (Wed, 08 Jul 2009) | 2 lines - Added support for outlined FM-Towns ROM drawing - Adapted KYRA to use that ........ r42231 | lordhoto | 2009-07-08 04:17:30 +1000 (Wed, 08 Jul 2009) | 2 lines - Rename FontSJIS::enableShadow to enableOutline. - Initialize outline to false by default in FontTowns. ........ r42232 | lordhoto | 2009-07-08 05:00:39 +1000 (Wed, 08 Jul 2009) | 1 line Change "FM-Towns" to "FM-TOWNS" for consistency. ........ r42233 | lordhoto | 2009-07-08 05:00:51 +1000 (Wed, 08 Jul 2009) | 1 line Add guards to only include SJIS font code, when KYRA or SCI is enabled. ........ r42234 | lordhoto | 2009-07-08 05:18:32 +1000 (Wed, 08 Jul 2009) | 1 line Simply compile guard of SJIS code and fix comment. ........ r42235 | lordhoto | 2009-07-08 05:18:53 +1000 (Wed, 08 Jul 2009) | 1 line Change all uses of FM-Towns/fm-towns to FM-TOWNS. ........ r42238 | thebluegr | 2009-07-08 06:01:15 +1000 (Wed, 08 Jul 2009) | 1 line Added a workaround for incorrect font references in LSL1VGA (which was the original purpose of the code removed in rev. 42219) ........ r42239 | thebluegr | 2009-07-08 06:17:07 +1000 (Wed, 08 Jul 2009) | 1 line Improved the LSL1VGA workaround after talking with waltervn ........ r42240 | thebluegr | 2009-07-08 06:43:27 +1000 (Wed, 08 Jul 2009) | 1 line Silenced the very chatty song iterator console messages by converting them to appropriate debug messages ........ svn-id: r42248
Diffstat (limited to 'engines/sci/gfx')
-rw-r--r--engines/sci/gfx/gfx_resmgr.cpp49
-rw-r--r--engines/sci/gfx/gfx_resmgr.h6
-rw-r--r--engines/sci/gfx/gfx_resource.h11
-rw-r--r--engines/sci/gfx/operations.cpp6
-rw-r--r--engines/sci/gfx/operations.h3
-rw-r--r--engines/sci/gfx/res_view.cpp4
6 files changed, 39 insertions, 40 deletions
diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp
index 4abcc1fb78..9343b66cb8 100644
--- a/engines/sci/gfx/gfx_resmgr.cpp
+++ b/engines/sci/gfx/gfx_resmgr.cpp
@@ -49,14 +49,14 @@ struct param_struct {
GfxDriver *driver;
};
-GfxResManager::GfxResManager(int version, bool isVGA, gfx_options_t *options, GfxDriver *driver, ResourceManager *resManager) :
- _version(version), _isVGA(isVGA), _options(options), _driver(driver), _resManager(resManager),
+GfxResManager::GfxResManager(int version, gfx_options_t *options, GfxDriver *driver, ResourceManager *resManager) :
+ _version(version), _options(options), _driver(driver), _resManager(resManager),
_lockCounter(0), _tagLockCounter(0), _staticPalette(0) {
gfxr_init_static_palette();
_portBounds = Common::Rect(0, 10, 320, 200); // default value, with a titlebar of 10px
- if (_version < SCI_VERSION_01_VGA || !_isVGA) {
+ if (!_resManager->isVGA()) {
_staticPalette = gfx_sci0_pic_colors->getref();
} else if (_version == SCI_VERSION_1_1) {
debugC(2, kDebugLevelGraphics, "Palettes are not yet supported in this SCI version\n");
@@ -99,7 +99,7 @@ int GfxResManager::calculatePic(gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic
if (_version == SCI_VERSION_1_1)
gfxr_draw_pic11(unscaled_pic, flags, default_palette, res->size, res->data, &basic_style, res->id.number, _staticPalette, _portBounds);
else
- gfxr_draw_pic01(unscaled_pic, flags, default_palette, res->size, res->data, &basic_style, res->id.number, _isVGA, _staticPalette, _portBounds);
+ gfxr_draw_pic01(unscaled_pic, flags, default_palette, res->size, res->data, &basic_style, res->id.number, _resManager->isVGA(), _staticPalette, _portBounds);
}
if (scaled_pic && scaled_pic->undithered_buffer)
@@ -108,9 +108,9 @@ int GfxResManager::calculatePic(gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic
if (_version == SCI_VERSION_1_1)
gfxr_draw_pic11(scaled_pic, flags, default_palette, res->size, res->data, &style, res->id.number, _staticPalette, _portBounds);
else
- gfxr_draw_pic01(scaled_pic, flags, default_palette, res->size, res->data, &style, res->id.number, _isVGA, _staticPalette, _portBounds);
+ gfxr_draw_pic01(scaled_pic, flags, default_palette, res->size, res->data, &style, res->id.number, _resManager->isVGA(), _staticPalette, _portBounds);
- if (!_isVGA) {
+ if (!_resManager->isVGA()) {
if (need_unscaled)
gfxr_remove_artifacts_pic0(scaled_pic, unscaled_pic);
@@ -144,7 +144,7 @@ int GfxResManager::getOptionsHash(gfx_resource_type_t type) {
case GFX_RESOURCE_TYPE_PIC:
#ifdef CUSTOM_GRAPHICS_OPTIONS
- if (_version >= SCI_VERSION_01_VGA)
+ if (_resManager->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;
@@ -153,7 +153,7 @@ int GfxResManager::getOptionsHash(gfx_resource_type_t type) {
| (_options->pic0_dither_pattern << 8) | (_options->pic0_brush_mode << 4)
| (_options->pic0_line_mode);
#else
- if (_version >= SCI_VERSION_01_VGA)
+ if (_resManager->isVGA())
return 10;
else
return 0x10000 | (GFXR_DITHER_PATTERN_SCALED << 8) | (GFX_BRUSH_MODE_RANDOM_ELLIPSES << 4) | GFX_LINE_MODE_CORRECT;
@@ -341,12 +341,12 @@ gfxr_pic_t *GfxResManager::getPic(int num, int maps, int flags, int default_pale
#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), _version >= SCI_VERSION_01_VGA);
+ pic = gfxr_init_pic(&mode_1x1_color_index, GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _resManager->isVGA());
} else
- pic = gfxr_init_pic(_driver->getMode(), GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _version >= SCI_VERSION_01_VGA);
+ pic = gfxr_init_pic(_driver->getMode(), GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _resManager->isVGA());
#else
need_unscaled = 0;
- pic = gfxr_init_pic(_driver->getMode(), GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _version >= SCI_VERSION_01_VGA);
+ pic = gfxr_init_pic(_driver->getMode(), GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _resManager->isVGA());
#endif
if (!pic) {
@@ -357,7 +357,7 @@ gfxr_pic_t *GfxResManager::getPic(int num, int maps, int flags, int default_pale
gfxr_clear_pic0(pic, SCI_TITLEBAR_SIZE);
if (need_unscaled) {
- unscaled_pic = gfxr_init_pic(&mode_1x1_color_index, GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _version >= SCI_VERSION_01_VGA);
+ unscaled_pic = gfxr_init_pic(&mode_1x1_color_index, GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _resManager->isVGA());
if (!unscaled_pic) {
error("Failed to allocate unscaled pic");
return NULL;
@@ -530,17 +530,16 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) {
return NULL;
int resid = GFXR_RES_ID(GFX_RESOURCE_TYPE_VIEW, nr);
+
+ if (!_resManager->isVGA()) {
+ int pal = (_version == SCI_VERSION_0) ? -1 : palette;
+ view = getEGAView(resid, viewRes->data, viewRes->size, pal);
+ } else {
+ if (_version < SCI_VERSION_1_1)
+ view = getVGAView(resid, viewRes->data, viewRes->size, _staticPalette, false);
+ else
+ view = getVGAView(resid, viewRes->data, viewRes->size, 0, true);
- if (_version < SCI_VERSION_01_EGA)
- view = gfxr_draw_view0(resid, viewRes->data, viewRes->size, -1);
- else if (_version == SCI_VERSION_01_EGA || !_isVGA)
- view = gfxr_draw_view0(resid, viewRes->data, viewRes->size, palette);
- else if (_version >= SCI_VERSION_01_VGA && _version <= SCI_VERSION_1)
- view = gfxr_draw_view1(resid, viewRes->data, viewRes->size, _staticPalette, false);
- else if (_version >= SCI_VERSION_1_1)
- view = gfxr_draw_view1(resid, viewRes->data, viewRes->size, 0, true);
-
- if (_isVGA) {
if (!view->palette) {
view->palette = new Palette(_staticPalette->size());
view->palette->name = "interpreter_get_view";
@@ -554,7 +553,6 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) {
view->palette->setColor(i, sc.r, sc.g, sc.b);
}
}
-
}
if (!res) {
@@ -619,6 +617,11 @@ gfx_bitmap_font_t *GfxResManager::getFont(int num, bool scaled) {
gfx_resource_t *res = NULL;
int hash = getOptionsHash(GFX_RESOURCE_TYPE_FONT);
+ // Workaround: LSL1VGA mixes its own internal fonts with the global
+ // SCI ones, so we translate them here, by removing their extra bits
+ if (!resMap.contains(num) && !_resManager->testResource(ResourceId(kResourceTypeFont, num)))
+ num = num & 0x7ff;
+
res = resMap.contains(num) ? resMap[num] : NULL;
if (!res || res->mode != hash) {
diff --git a/engines/sci/gfx/gfx_resmgr.h b/engines/sci/gfx/gfx_resmgr.h
index 1f0f58dce9..8230e84aa0 100644
--- a/engines/sci/gfx/gfx_resmgr.h
+++ b/engines/sci/gfx/gfx_resmgr.h
@@ -90,7 +90,7 @@ typedef Common::HashMap<int, gfx_resource_t *> IntResMap;
/** Graphics resource manager */
class GfxResManager {
public:
- GfxResManager(int version, bool isVGA, gfx_options_t *options,
+ GfxResManager(int version, gfx_options_t *options,
GfxDriver *driver, ResourceManager *resManager);
~GfxResManager();
@@ -311,14 +311,12 @@ public:
*
* @return Number of pallete entries
*/
- int getColorCount()
- {
+ int getColorCount() {
return _staticPalette ? _staticPalette->size() : 0;
}
private:
int _version;
- bool _isVGA;
gfx_options_t *_options;
GfxDriver *_driver;
Palette *_staticPalette;
diff --git a/engines/sci/gfx/gfx_resource.h b/engines/sci/gfx/gfx_resource.h
index 780060bc4f..9c83cf07cd 100644
--- a/engines/sci/gfx/gfx_resource.h
+++ b/engines/sci/gfx/gfx_resource.h
@@ -245,7 +245,7 @@ void gfxr_remove_artifacts_pic0(gfxr_pic_t *dest, gfxr_pic_t *src);
void gfxr_dither_pic0(gfxr_pic_t *pic, int mode, int pattern);
/**
- * Calculates a SCI0 view.
+ * Calculates an EGA view.
*
* @param[in] id Resource ID of the view
* @param[in] resource Pointer to the resource to read
@@ -253,7 +253,7 @@ void gfxr_dither_pic0(gfxr_pic_t *pic, int mode, int pattern);
* @param[in] palette The palette to use
* @return The resulting view
*/
-gfxr_view_t *gfxr_draw_view0(int id, byte *resource, int size, int palette);
+gfxr_view_t *getEGAView(int id, byte *resource, int size, int palette);
/**
* Calculates a SCI cursor.
@@ -265,8 +265,7 @@ gfxr_view_t *gfxr_draw_view0(int id, byte *resource, int size, int palette);
* @return A newly allocated pixmap containing an index color
* representation of the cursor
*/
-gfx_pixmap_t *gfxr_draw_cursor(int id, byte *resource, int size,
- bool isSci01);
+gfx_pixmap_t *gfxr_draw_cursor(int id, byte *resource, int size, bool isSci01);
/** @} */
@@ -304,7 +303,7 @@ Palette *gfxr_read_pal1_amiga(Common::File &file);
Palette *gfxr_read_pal11(int id, byte *resource, int size);
/**
- * Calculates an SCI1 view.
+ * Calculates a VGA view.
*
* @param[in] id Resource ID of the view
* @param[in] resource Pointer to the resource to read
@@ -313,7 +312,7 @@ Palette *gfxr_read_pal11(int id, byte *resource, int size);
* @param[in] isSci11 true if SCI1.1, false otherwise
* @return The resulting view
*/
-gfxr_view_t *gfxr_draw_view1(int id, byte *resource, int size, Palette *static_pal, bool isSci11);
+gfxr_view_t *getVGAView(int id, byte *resource, int size, Palette *static_pal, bool isSci11);
gfx_pixmap_t *gfxr_draw_cel1(int id, int loop, int cel, int mirrored, byte *resource, byte *cel_base, int size, gfxr_view_t *view, bool isAmiga, bool isSci11);
/** @} */
diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp
index 80adb9eddb..057f28b56f 100644
--- a/engines/sci/gfx/operations.cpp
+++ b/engines/sci/gfx/operations.cpp
@@ -404,7 +404,7 @@ static void init_aux_pixmap(gfx_pixmap_t **pixmap) {
(*pixmap)->palette = new Palette(default_colors, DEFAULT_COLORS_NR);
}
-int gfxop_init(int version, bool isVGA, GfxState *state,
+int gfxop_init(int version, GfxState *state,
gfx_options_t *options, ResourceManager *resManager,
Graphics::PixelFormat mode, int xfact, int yfact) {
//int color_depth = bpp ? bpp : 1;
@@ -424,8 +424,8 @@ int gfxop_init(int version, bool isVGA, GfxState *state,
state->driver = new GfxDriver(xfact, yfact, mode);
- state->gfxResMan = new GfxResManager(version, isVGA, state->options, state->driver, resManager);
-
+ state->gfxResMan = new GfxResManager(version, state->options, state->driver, resManager);
+
gfxop_set_clip_zone(state, gfx_rect(0, 0, 320, 200));
init_aux_pixmap(&(state->control_map));
diff --git a/engines/sci/gfx/operations.h b/engines/sci/gfx/operations.h
index d567934ceb..ec0a810224 100644
--- a/engines/sci/gfx/operations.h
+++ b/engines/sci/gfx/operations.h
@@ -135,7 +135,6 @@ struct GfxState {
* Initializes a graphics mode.
*
* @param[in] version The interpreter version
- * @param[in] isVGA true if using VGA resolution
* @param[in] state The state to initialize
* @param[in] xfact Horizontal scale factor
* @param[in] yfact Vertical scale factors
@@ -146,7 +145,7 @@ struct GfxState {
* is unavailable, or GFX_FATAL if the graphics driver
* is unable to provide any useful graphics support
*/
-int gfxop_init(int version, bool isVGA, GfxState *state,
+int gfxop_init(int version, GfxState *state,
gfx_options_t *options, ResourceManager *resManager,
Graphics::PixelFormat mode, int xfact = 1, int yfact = 1);
diff --git a/engines/sci/gfx/res_view.cpp b/engines/sci/gfx/res_view.cpp
index 41cb55fa75..d484136f8e 100644
--- a/engines/sci/gfx/res_view.cpp
+++ b/engines/sci/gfx/res_view.cpp
@@ -135,7 +135,7 @@ gfx_pixmap_t *gfxr_draw_cel0(int id, int loop, int cel, byte *resource, int size
return retval;
}
-gfxr_view_t *gfxr_draw_view0(int id, byte *resource, int size, int palette) {
+gfxr_view_t *getEGAView(int id, byte *resource, int size, int palette) {
int i;
gfxr_view_t *view;
int mirror_bitpos = 1;
@@ -365,7 +365,7 @@ gfx_pixmap_t *gfxr_draw_cel1(int id, int loop, int cel, int mirrored, byte *reso
return retval;
}
-gfxr_view_t *gfxr_draw_view1(int id, byte *resource, int size, Palette *static_pal, bool isSci11) {
+gfxr_view_t *getVGAView(int id, byte *resource, int size, Palette *static_pal, bool isSci11) {
uint16 palOffset = READ_LE_UINT16(resource + V1_PALETTE_OFFSET + (isSci11 ? 2 : 0));
uint16 headerSize = isSci11 ? READ_LE_UINT16(resource + V2_HEADER_SIZE) : 0;
byte* seeker = resource + headerSize;