aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
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/engine
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/engine')
-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
6 files changed, 19 insertions, 23 deletions
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: