aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorFilippos Karapetis2009-07-07 07:44:25 +0000
committerFilippos Karapetis2009-07-07 07:44:25 +0000
commitc716e43a2bad7fbf7ad6e1ea0594a84cb24ae49b (patch)
tree38efc5afd0a928a3db3fc9e6cbb9d32459f579e2 /engines/sci
parentb50b5ae5a4d896a0319d661f16641e5b35855b60 (diff)
downloadscummvm-rg350-c716e43a2bad7fbf7ad6e1ea0594a84cb24ae49b.tar.gz
scummvm-rg350-c716e43a2bad7fbf7ad6e1ea0594a84cb24ae49b.tar.bz2
scummvm-rg350-c716e43a2bad7fbf7ad6e1ea0594a84cb24ae49b.zip
- 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 svn-id: r42206
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/detection.cpp40
-rw-r--r--engines/sci/engine/game.cpp12
-rw-r--r--engines/sci/engine/kernel.cpp3
-rw-r--r--engines/sci/engine/kgraphics.cpp20
-rw-r--r--engines/sci/engine/ksound.cpp2
-rw-r--r--engines/sci/engine/savegame.cpp2
-rw-r--r--engines/sci/engine/script.cpp3
-rw-r--r--engines/sci/gfx/gfx_resmgr.cpp44
-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
-rw-r--r--engines/sci/resource.cpp39
-rw-r--r--engines/sci/resource.h3
-rw-r--r--engines/sci/sci.cpp15
-rw-r--r--engines/sci/sci.h24
-rw-r--r--engines/sci/vocabulary.cpp2
18 files changed, 116 insertions, 123 deletions
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index f86810e6b9..af03f1269c 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -457,7 +457,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "58942b1aa6d6ffeb66e9f8897fd4435f", 469243},
{"resource.006", 0, "8c767b3939add63d11274065e46aad04", 713158},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
- GF_SCI1_EGA,
+ 0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@@ -949,8 +949,8 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "9ae2a13708d691cd42f9129173c4b39d", 820443},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH},
0,
- SCI_VERSION_01_EGA,
- SCI_VERSION_01_EGA
+ SCI_VERSION_01,
+ SCI_VERSION_01
},
// King's Quest 1 SCI Remake - English DOS Non-Interactive Demo
@@ -2066,8 +2066,8 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "9e33566515b18bee7915db448063bba2", 871853},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH},
0,
- SCI_VERSION_01_EGA,
- SCI_VERSION_01_EGA
+ SCI_VERSION_01,
+ SCI_VERSION_01
},
// Mixed-Up Fairy Tales v1.000 - English DOS (supplied by markcoolio in bug report #2723791)
@@ -2081,8 +2081,8 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "f79daa70390d73746742ffcfc3dc4471", 937580},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
0,
- SCI_VERSION_01_EGA,
- SCI_VERSION_01_EGA
+ SCI_VERSION_01,
+ SCI_VERSION_01
},
// Mixed-Up Fairy Tales - English DOS Floppy (from jvprat)
@@ -2095,8 +2095,8 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "dd6cef0c592eadb7e6be9a25307c57a2", 1344719},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
0,
- SCI_VERSION_01_EGA,
- SCI_VERSION_01_EGA
+ SCI_VERSION_01,
+ SCI_VERSION_01
},
// Mixed-Up Mother Goose - English Amiga (from www.back2roots.org)
@@ -2108,8 +2108,8 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "fb552ae550ca1dac19ed8f6a3767612d", 817191},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH},
0,
- SCI_VERSION_01_EGA,
- SCI_VERSION_01_EGA
+ SCI_VERSION_01,
+ SCI_VERSION_01
},
// Mixed-Up Mother Goose v2.000 - English DOS Floppy (supplied by markcoolio in bug report #2723795)
@@ -2119,8 +2119,8 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "b7ecd8ae9e254e80310b5a668b276e6e", 2948975},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
0,
- SCI_VERSION_01_EGA,
- SCI_VERSION_01_EGA
+ SCI_VERSION_01,
+ SCI_VERSION_01
},
// Mixed-Up Mother Goose - English DOS CD (from jvprat)
@@ -2520,7 +2520,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{NULL, 0, NULL, 0}}, Common::JA_JPN, Common::kPlatformPC98, 0, GUIO_NOSPEECH},
0,
SCI_VERSION_AUTODETECT,
- SCI_VERSION_01_EGA
+ SCI_VERSION_01
},
// Quest for Glory 1 - Japanese PC-98 5.25" Floppy
@@ -2533,7 +2533,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{NULL, 0, NULL, 0}}, Common::JA_JPN, Common::kPlatformPC98, 0, GUIO_NOSPEECH},
0,
SCI_VERSION_AUTODETECT,
- SCI_VERSION_01_EGA
+ SCI_VERSION_01
},
// Quest for Glory 1 - English Amiga
@@ -2606,7 +2606,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH},
0,
SCI_VERSION_AUTODETECT,
- SCI_VERSION_01_EGA
+ SCI_VERSION_01
},
// Quest for Glory 2 - English (from FRG)
@@ -2621,7 +2621,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
0,
SCI_VERSION_AUTODETECT,
- SCI_VERSION_01_EGA
+ SCI_VERSION_01
},
// Quest for Glory 2 - English DOS
@@ -2639,7 +2639,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
0,
SCI_VERSION_AUTODETECT,
- SCI_VERSION_01_EGA
+ SCI_VERSION_01
},
// Quest for Glory 3 - English DOS Non-Interactive Demo (from FRG)
@@ -3125,7 +3125,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "454684e3a7a68cbca073945e50778447", 1187088},
{"resource.002", 0, "6dc668326cc22cb9e8bd8ca9e68d2a66", 1181249},
{NULL, 0, NULL, 0}}, Common::JA_JPN, Common::kPlatformPC98, 0, GUIO_NOSPEECH},
- GF_SCI1_EGA,
+ 0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
@@ -3138,7 +3138,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "454684e3a7a68cbca073945e50778447", 1187088},
{"resource.002", 0, "6dc668326cc22cb9e8bd8ca9e68d2a66", 1181249},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC98, 0, GUIO_NOSPEECH},
- GF_SCI1_EGA,
+ 0,
SCI_VERSION_AUTODETECT,
SCI_VERSION_1
},
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index 7eb4c6731a..e35fbf99f8 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -43,10 +43,8 @@ int _reset_graphics_input(EngineState *s) {
gfx_color_t transparent = { PaletteEntry(), 0, -1, -1, 0 };
debug(2, "Initializing graphics");
- if (s->resmgr->_sciVersion <= SCI_VERSION_01_EGA || (s->_flags & GF_SCI1_EGA)) {
- int i;
-
- for (i = 0; i < 16; i++) {
+ if (!s->resmgr->isVGA()) {
+ for (int i = 0; i < 16; i++) {
if (gfxop_set_color(s->gfx_state, &(s->ega_colors[i]), gfx_sci0_image_colors[sci0_palette][i].r,
gfx_sci0_image_colors[sci0_palette][i].g, gfx_sci0_image_colors[sci0_palette][i].b, 0, -1, -1)) {
return 1;
@@ -111,7 +109,7 @@ int _reset_graphics_input(EngineState *s) {
s->iconbar_port = new GfxPort(s->visual, gfx_rect(0, 0, 320, 200), s->ega_colors[0], transparent);
s->iconbar_port->_flags |= GFXW_FLAG_NO_IMPLICIT_SWITCH;
- if (s->resmgr->_sciVersion >= SCI_VERSION_01_VGA) {
+ if (s->resmgr->isVGA()) {
// This bit sets the foreground and background colors in VGA SCI games
gfx_color_t fgcolor;
gfx_color_t bgcolor;
@@ -181,7 +179,7 @@ static void _free_graphics_input(EngineState *s) {
}
int game_init_sound(EngineState *s, int sound_flags) {
- if (s->resmgr->_sciVersion >= SCI_VERSION_01_EGA)
+ if (s->resmgr->_sciVersion >= SCI_VERSION_01)
sound_flags |= SFX_STATE_FLAG_MULTIPLAY;
s->sfx_init_flags = sound_flags;
@@ -466,7 +464,7 @@ int game_init(EngineState *s) {
s->successor = NULL; // No successor
s->_statusBarText.clear(); // Status bar is blank
s->status_bar_foreground = 0;
- s->status_bar_background = (s->resmgr->_sciVersion >= SCI_VERSION_01_VGA) ? 255 : 15;
+ s->status_bar_background = !s->resmgr->isVGA() ? 15 : 255;
SystemString *str = &s->sys_strings->strings[SYS_STRING_PARSER_BASE];
str->name = strdup("parser-base");
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index 80071b2847..f869a3a9ea 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -832,8 +832,7 @@ bool Kernel::loadKernelNames() {
switch (_resmgr->_sciVersion) {
case SCI_VERSION_0:
- case SCI_VERSION_01_EGA:
- case SCI_VERSION_01_VGA:
+ case SCI_VERSION_01:
case SCI_VERSION_01_VGA_ODD:
case SCI_VERSION_1:
case SCI_VERSION_1_1:
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 487813a4c7..435dd39d5a 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -269,7 +269,7 @@ void graph_restore_box(EngineState *s, reg_t handle) {
}
PaletteEntry get_pic_color(EngineState *s, int color) {
- if (s->resmgr->_sciVersion < SCI_VERSION_01_VGA)
+ if (!s->resmgr->isVGA())
return s->ega_colors[color].visual;
if (color == -1 || color == 255) // -1 occurs in Eco Quest 1. Not sure if this is the best approach, but it seems to work
@@ -286,7 +286,7 @@ PaletteEntry get_pic_color(EngineState *s, int color) {
static gfx_color_t graph_map_color(EngineState *s, int color, int priority, int control) {
gfx_color_t retval;
- if (s->resmgr->_sciVersion < SCI_VERSION_01_VGA) {
+ if (!s->resmgr->isVGA()) {
retval = s->ega_colors[(color >=0 && color < 16)? color : 0];
gfxop_set_color(s->gfx_state, &retval, (color < 0) ? -1 : retval.visual.r, retval.visual.g, retval.visual.b,
(color == -1) ? 255 : 0, priority, control);
@@ -502,7 +502,7 @@ reg_t kGraph(EngineState *s, int funct_nr, int argc, reg_t *argv) {
case K_GRAPH_GET_COLORS_NR:
- return make_reg(0, s->resmgr->_sciVersion < SCI_VERSION_01_VGA ? 0x10 : 0x100);
+ return make_reg(0, !s->resmgr->isVGA() ? 0x10 : 0x100);
break;
case K_GRAPH_DRAW_LINE: {
@@ -2502,7 +2502,7 @@ reg_t kNewWindow(EngineState *s, int funct_nr, int argc, reg_t *argv) {
int16 bgColor = (argc > 8 + argextra) ? argv[8 + argextra].toSint16() : 255;
if (bgColor >= 0) {
- if (s->resmgr->_sciVersion < SCI_VERSION_01_VGA)
+ if (!s->resmgr->isVGA())
bgcolor.visual = get_pic_color(s, MIN<int>(bgColor, 15));
else
bgcolor.visual = get_pic_color(s, bgColor);
@@ -2528,7 +2528,7 @@ reg_t kNewWindow(EngineState *s, int funct_nr, int argc, reg_t *argv) {
black.alpha = 0;
black.control = -1;
black.priority = -1;
- lWhite.visual = get_pic_color(s, s->resmgr->_sciVersion < SCI_VERSION_01_VGA ? 15 : 255);
+ lWhite.visual = get_pic_color(s, !s->resmgr->isVGA() ? 15 : 255);
lWhite.mask = GFX_MASK_VISUAL;
lWhite.alpha = 0;
lWhite.priority = -1;
@@ -3149,7 +3149,7 @@ reg_t kDisplay(EngineState *s, int funct_nr, int argc, reg_t *argv) {
bg_color = port->_bgcolor;
// TODO: in SCI1VGA the default colors for text and background are #0 (black)
// SCI0 case should be checked
- if (s->resmgr->_sciVersion >= SCI_VERSION_01_VGA) {
+ if (s->resmgr->isVGA()) {
// This priority check fixes the colors in the menus in KQ5
// TODO/FIXME: Is this correct?
if (color0.priority >= 0)
@@ -3191,10 +3191,10 @@ reg_t kDisplay(EngineState *s, int funct_nr, int argc, reg_t *argv) {
temp = argv[argpt++].toSint16();
debugC(2, kDebugLevelGraphics, "Display: set_color(%d)\n", temp);
- if ((s->resmgr->_sciVersion < SCI_VERSION_01_VGA) && temp >= 0 && temp <= 15)
+ if (!s->resmgr->isVGA() && temp >= 0 && temp <= 15)
color0 = (s->ega_colors[temp]);
else
- if (s->resmgr->_sciVersion >= SCI_VERSION_01_VGA && temp >= 0 && temp < 256) {
+ if (s->resmgr->isVGA() && temp >= 0 && temp < 256) {
color0.visual = get_pic_color(s, temp);
color0.mask = GFX_MASK_VISUAL;
} else
@@ -3208,10 +3208,10 @@ reg_t kDisplay(EngineState *s, int funct_nr, int argc, reg_t *argv) {
temp = argv[argpt++].toSint16();
debugC(2, kDebugLevelGraphics, "Display: set_bg_color(%d)\n", temp);
- if (s->resmgr->_sciVersion < SCI_VERSION_01_VGA && temp >= 0 && temp <= 15)
+ if (!s->resmgr->isVGA() && temp >= 0 && temp <= 15)
bg_color = s->ega_colors[temp];
else
- if ((s->resmgr->_sciVersion >= SCI_VERSION_01_VGA) && temp >= 0 && temp <= 256) {
+ if (s->resmgr->isVGA() && temp >= 0 && temp <= 256) {
bg_color.visual = get_pic_color(s, temp);
bg_color.mask = GFX_MASK_VISUAL;
} else
diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp
index ef02f8ee21..f1584bf975 100644
--- a/engines/sci/engine/ksound.cpp
+++ b/engines/sci/engine/ksound.cpp
@@ -154,7 +154,7 @@ void process_sound_events(EngineState *s) { /* Get all sound events, apply their
SongHandle handle;
int cue;
- if (s->_version >= SCI_VERSION_01_EGA)
+ if (s->_version >= SCI_VERSION_01)
return;
/* SCI01 and later explicitly poll for everything */
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index ade0304683..bfff828745 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -693,7 +693,7 @@ int _reset_graphics_input(EngineState *s);
static void reconstruct_sounds(EngineState *s) {
Song *seeker;
- SongIteratorType it_type = s->resmgr->_sciVersion >= SCI_VERSION_01_EGA ? SCI_SONG_ITERATOR_TYPE_SCI1 : SCI_SONG_ITERATOR_TYPE_SCI0;
+ SongIteratorType it_type = s->resmgr->_sciVersion >= SCI_VERSION_01 ? SCI_SONG_ITERATOR_TYPE_SCI1 : SCI_SONG_ITERATOR_TYPE_SCI0;
seeker = s->_sound._songlib._lib;
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp
index e78f3fd77f..991955cd67 100644
--- a/engines/sci/engine/script.cpp
+++ b/engines/sci/engine/script.cpp
@@ -91,9 +91,8 @@ opcode_format g_opcode_formats[128][4] = {
void script_adjust_opcode_formats(int res_version) {
switch (res_version) {
case SCI_VERSION_0:
- case SCI_VERSION_01_EGA:
break;
- case SCI_VERSION_01_VGA:
+ case SCI_VERSION_01:
case SCI_VERSION_01_VGA_ODD:
case SCI_VERSION_1:
case SCI_VERSION_1_1:
diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp
index 523a1e6ac4..5a1556ca41 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;
@@ -340,12 +340,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) {
@@ -356,7 +356,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;
@@ -529,17 +529,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";
@@ -553,7 +552,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) {
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 ac8e0ef9b0..f714ab0245 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, gfx_options_t *options, ResourceManager *resManager,
+int gfxop_init(int version, GfxState *state, gfx_options_t *options, ResourceManager *resManager,
int xfact, int yfact, gfx_color_mode_t bpp) {
//int color_depth = bpp ? bpp : 1;
//int initialized = 0;
@@ -423,8 +423,8 @@ int gfxop_init(int version, bool isVGA, GfxState *state, gfx_options_t *options,
state->driver = new GfxDriver(xfact, yfact, bpp);
- 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 491b485da0..b9a16d4a27 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
@@ -147,7 +146,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, gfx_options_t *options,
+int gfxop_init(int version, GfxState *state, gfx_options_t *options,
ResourceManager *resManager, int xfact = 1, int yfact = 1,
gfx_color_mode_t bpp = GFX_COLOR_MODE_INDEX);
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;
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 15e05ea656..a9de8ba112 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -358,7 +358,7 @@ int ResourceManager::guessSciVersion() {
file.close();
if (compression == 3) {
- return SCI_VERSION_01_VGA;
+ return SCI_VERSION_01;
}
}
@@ -382,7 +382,7 @@ int ResourceManager::guessSciVersion() {
file.close();
if (compression == 3) {
- return SCI_VERSION_01_VGA;
+ return SCI_VERSION_01;
}
}
@@ -495,14 +495,14 @@ ResourceManager::ResourceManager(int version, int maxMemory) {
switch (_mapVersion) {
case SCI_VERSION_0:
if (testResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_MAIN_VOCAB))) {
- version = guessSciVersion() ? SCI_VERSION_01_VGA : SCI_VERSION_0;
+ version = guessSciVersion() ? SCI_VERSION_01 : SCI_VERSION_0;
} else if (testResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_MAIN_VOCAB))) {
version = guessSciVersion();
- if (version != SCI_VERSION_01_VGA) {
- version = testResource(ResourceId(kResourceTypeVocab, 912)) ? SCI_VERSION_0 : SCI_VERSION_01_EGA;
+ if (version != SCI_VERSION_01) {
+ version = testResource(ResourceId(kResourceTypeVocab, 912)) ? SCI_VERSION_0 : SCI_VERSION_01;
}
} else {
- version = guessSciVersion() ? SCI_VERSION_01_VGA : SCI_VERSION_0;
+ version = guessSciVersion() ? SCI_VERSION_01 : SCI_VERSION_0;
}
break;
case SCI_VERSION_01_VGA_ODD:
@@ -519,18 +519,37 @@ ResourceManager::ResourceManager(int version, int maxMemory) {
version = SCI_VERSION_AUTODETECT;
}
+ _isVGA = false;
+
+ // Determine if the game is using EGA graphics or not
+ if (version == SCI_VERSION_0) {
+ _isVGA = false; // There is no SCI0 VGA game
+ } else if (version >= SCI_VERSION_1_1) {
+ _isVGA = true; // There is no SCI11 EGA game
+ } else {
+ // SCI01 or SCI1: EGA games have the second byte of their views set
+ // to 0, VGA ones to non-zero
+ int i = 0;
+
+ while (true) {
+ Resource *res = findResource(ResourceId(kResourceTypeView, i), 0);
+ if (res) {
+ _isVGA = (res->data[1] != 0);
+ break;
+ }
+ i++;
+ }
+ }
+
_sciVersion = version;
// temporary version printout - should be reworked later
switch (_sciVersion) {
case SCI_VERSION_0:
debug("Resmgr: Detected SCI0");
break;
- case SCI_VERSION_01_EGA:
+ case SCI_VERSION_01:
debug("Resmgr: Detected SCI01");
break;
- case SCI_VERSION_01_VGA:
- debug("Resmgr: Detected SCI01VGA - KQ5 or similar");
- break;
case SCI_VERSION_01_VGA_ODD:
debug("Resmgr: Detected SCI01VGA - Jones/CD or similar");
break;
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index 8ef42b171d..ad9e7a1d8d 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -214,6 +214,8 @@ public:
int _mapVersion; //!< RESOURCE.MAP version
int _volVersion; //!< RESOURCE.0xx version
+ bool isVGA() const { return _isVGA; }
+
/**
* Creates a new SCI resource manager.
* @param version The SCI version to look for; use SCI_VERSION_AUTODETECT
@@ -265,6 +267,7 @@ public:
void setAudioLanguage(int language);
protected:
+ bool _isVGA; // Used to determine if the game has EGA or VGA graphics
int _maxMemory; //!< Config option: Maximum total byte number allocated
Common::List<ResourceSource *> _sources;
int _memoryLocked; //!< Amount of resource bytes in locked memory
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index fb5356ba64..698983acaf 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -43,11 +43,10 @@ namespace Sci {
class GfxDriver;
-const char *versionNames[8] = {
+const char *versionNames[7] = {
"Autodetected",
"SCI0",
- "SCI01 EGA",
- "SCI01 VGA",
+ "SCI01",
"SCI01 VGA ODD",
"SCI1",
"SCI1.1",
@@ -151,9 +150,6 @@ Common::Error SciEngine::run() {
// Verify that we haven't got an invalid game detection entry
if (version < SCI_VERSION_1) {
// SCI0/SCI01
- if (flags & GF_SCI1_EGA) {
- error("This game entry is erroneous. It's marked as SCI0/SCI01, but it has SCI1 flags set");
- }
} else if (version == SCI_VERSION_1) {
// SCI1
@@ -162,10 +158,6 @@ Common::Error SciEngine::run() {
error("This game entry is erroneous. It's marked as SCI1, but it has SCI0 flags set");
}
} else if (version == SCI_VERSION_1_1 || version == SCI_VERSION_32) {
- if (flags & GF_SCI1_EGA) {
- error("This game entry is erroneous. It's marked as SCI1.1/SCI32, but it has SCI1 flags set");
- }
-
if (flags & GF_SCI0_OLD ||
flags & GF_SCI0_OLDGETTIME) {
error("This game entry is erroneous. It's marked as SCI1.1/SCI32, but it has SCI0 flags set");
@@ -218,8 +210,7 @@ Common::Error SciEngine::run() {
// Default config ends
#endif
- bool isVGA = _resmgr->_sciVersion >= SCI_VERSION_01_VGA && !(getFlags() & GF_SCI1_EGA);
- if (gfxop_init(_resmgr->_sciVersion, isVGA, &gfx_state, &gfx_options, _resmgr)) {
+ if (gfxop_init(_resmgr->_sciVersion, &gfx_state, &gfx_options, _resmgr)) {
warning("Graphics initialization failed. Aborting...");
return Common::kUnknownError;
}
diff --git a/engines/sci/sci.h b/engines/sci/sci.h
index 4404165c53..82a0f80b34 100644
--- a/engines/sci/sci.h
+++ b/engines/sci/sci.h
@@ -71,15 +71,14 @@ struct SciGameDescription {
enum SciGameVersions {
SCI_VERSION_AUTODETECT = 0,
SCI_VERSION_0 = 1,
- SCI_VERSION_01_EGA = 2,
- SCI_VERSION_01_VGA = 3,
- SCI_VERSION_01_VGA_ODD = 4,
- SCI_VERSION_1 = 5,
- SCI_VERSION_1_1 = 6,
- SCI_VERSION_32 = 7
+ SCI_VERSION_01 = 2,
+ SCI_VERSION_01_VGA_ODD = 3,
+ SCI_VERSION_1 = 4,
+ SCI_VERSION_1_1 = 5,
+ SCI_VERSION_32 = 6
};
-extern const char *versionNames[8];
+extern const char *versionNames[7];
enum SciGameFlags {
// SCI0 flags
@@ -96,16 +95,7 @@ enum SciGameFlags {
/* Applies to all versions before 0.000.629
* Older SCI versions had simpler code for GetTime()
*/
- GF_SCI0_OLDGETTIME = (1 << 1),
-
- // ----------------------------------------------------------------------------
-
- // SCI1 flags
-
- /*
- * Used to distinguish SCI1 EGA games
- */
- GF_SCI1_EGA = (1 << 2)
+ GF_SCI0_OLDGETTIME = (1 << 1)
};
class SciEngine : public Engine {
diff --git a/engines/sci/vocabulary.cpp b/engines/sci/vocabulary.cpp
index dd56cdf88a..5253e7885b 100644
--- a/engines/sci/vocabulary.cpp
+++ b/engines/sci/vocabulary.cpp
@@ -91,7 +91,7 @@ Vocabulary::Vocabulary(ResourceManager *resmgr) : _resmgr(resmgr) {
debug(2, "Initializing vocabulary");
- if (_resmgr->_sciVersion < SCI_VERSION_01_VGA && loadParserWords()) {
+ if (_resmgr->_sciVersion <= SCI_VERSION_01 && loadParserWords()) {
loadSuffixes();
if (loadBranches())
// Now build a GNF grammar out of this