From 443aacee79fad00ba17a76e48ffd86c160b9077a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 14 May 2009 19:33:03 +0000 Subject: Added a parameter to the graphics resource manager to determine if the running SCI1 game is VGA or not (better than modifying the detected SCI resource version) svn-id: r40566 --- engines/sci/engine/game.cpp | 2 +- engines/sci/gfx/gfx_resmgr.cpp | 16 ++++++++-------- engines/sci/gfx/gfx_resmgr.h | 3 ++- engines/sci/gfx/operations.cpp | 4 ++-- engines/sci/gfx/operations.h | 2 +- engines/sci/sci.cpp | 3 +-- 6 files changed, 15 insertions(+), 15 deletions(-) (limited to 'engines') diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index 998c06b9c2..787e372694 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -74,7 +74,7 @@ int _reset_graphics_input(EngineState *s) { gfx_color_t transparent = { PaletteEntry(), 0, -1, -1, 0 }; sciprintf("Initializing graphics\n"); - if (s->resmgr->_sciVersion <= SCI_VERSION_01) { + if (s->resmgr->_sciVersion <= SCI_VERSION_01 || (s->flags & GF_SCI1_EGA)) { int i; for (i = 0; i < 16; i++) { diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp index c1c747eab5..72faf3916d 100644 --- a/engines/sci/gfx/gfx_resmgr.cpp +++ b/engines/sci/gfx/gfx_resmgr.cpp @@ -49,12 +49,12 @@ struct param_struct { gfx_driver_t *driver; }; -GfxResManager::GfxResManager(int version, gfx_options_t *options, gfx_driver_t *driver, ResourceManager *resManager) : - _version(version), _options(options), _driver(driver), _resManager(resManager), +GfxResManager::GfxResManager(int version, bool isVGA, gfx_options_t *options, gfx_driver_t *driver, ResourceManager *resManager) : + _version(version), _isVGA(isVGA), _options(options), _driver(driver), _resManager(resManager), _lockCounter(0), _tagLockCounter(0), _staticPalette(0) { gfxr_init_static_palette(); - if (_version < SCI_VERSION_01_VGA) { + if (_version < SCI_VERSION_01_VGA || !_isVGA) { _staticPalette = gfx_sci0_pic_colors->getref(); } else if (_version == SCI_VERSION_1_1) { GFXDEBUG("Palettes are not yet supported in this SCI version\n"); @@ -103,7 +103,7 @@ int GfxResManager::calculatePic(gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic if (_version == SCI_VERSION_1_1) DRAW_PIC11(unscaled_pic, &basic_style) else - DRAW_PIC01(unscaled_pic, &basic_style, _version >= SCI_VERSION_01_VGA) + DRAW_PIC01(unscaled_pic, &basic_style, _isVGA) } if (scaled_pic && scaled_pic->undithered_buffer) @@ -112,9 +112,9 @@ int GfxResManager::calculatePic(gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic if (_version == SCI_VERSION_1_1) DRAW_PIC11(scaled_pic, &style) else - DRAW_PIC01(scaled_pic, &style, _version >= SCI_VERSION_01_VGA) + DRAW_PIC01(scaled_pic, &style, _isVGA) - if (_version < SCI_VERSION_01_VGA) { + if (!_isVGA) { if (need_unscaled) gfxr_remove_artifacts_pic0(scaled_pic, unscaled_pic); @@ -524,14 +524,14 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) { if (_version < SCI_VERSION_01) view = gfxr_draw_view0(resid, viewRes->data, viewRes->size, -1); - else if (_version == SCI_VERSION_01) + else if (_version == SCI_VERSION_01 || !_isVGA) view = gfxr_draw_view0(resid, viewRes->data, viewRes->size, palette); else if (_version >= SCI_VERSION_01_VGA && _version <= SCI_VERSION_1_LATE) view = gfxr_draw_view1(resid, viewRes->data, viewRes->size, _staticPalette); else if (_version >= SCI_VERSION_1_1) view = gfxr_draw_view11(resid, viewRes->data, viewRes->size); - if (_version >= SCI_VERSION_01_VGA) { + if (_isVGA) { if (!view->palette) { view->palette = new Palette(_staticPalette->size()); view->palette->name = "interpreter_get_view"; diff --git a/engines/sci/gfx/gfx_resmgr.h b/engines/sci/gfx/gfx_resmgr.h index a040d68062..647aa82b02 100644 --- a/engines/sci/gfx/gfx_resmgr.h +++ b/engines/sci/gfx/gfx_resmgr.h @@ -87,7 +87,7 @@ typedef Common::HashMap IntResMap; class GfxResManager { public: - GfxResManager(int version, gfx_options_t *options, gfx_driver_t *driver, ResourceManager *resManager); + GfxResManager(int version, bool isVGA, gfx_options_t *options, gfx_driver_t *driver, ResourceManager *resManager); ~GfxResManager(); @@ -248,6 +248,7 @@ public: private: int _version; + bool _isVGA; gfx_options_t *_options; gfx_driver_t *_driver; Palette *_staticPalette; diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index ad210b9508..29606f5d7f 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -405,7 +405,7 @@ static void init_aux_pixmap(gfx_pixmap_t **pixmap) { (*pixmap)->palette = new Palette(default_colors, DEFAULT_COLORS_NR); } -int gfxop_init(int version, GfxState *state, gfx_options_t *options, ResourceManager *resManager, +int gfxop_init(int version, bool isVGA, 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; @@ -434,7 +434,7 @@ int gfxop_init(int version, GfxState *state, gfx_options_t *options, ResourceMan if (!initialized) return GFX_FATAL; - state->gfxResMan = new GfxResManager(version, state->options, state->driver, resManager); + state->gfxResMan = new GfxResManager(version, isVGA, state->options, state->driver, resManager); gfxop_set_clip_zone(state, gfx_rect(0, 0, 320, 200)); diff --git a/engines/sci/gfx/operations.h b/engines/sci/gfx/operations.h index e3dae6a317..2f4a443509 100644 --- a/engines/sci/gfx/operations.h +++ b/engines/sci/gfx/operations.h @@ -136,7 +136,7 @@ struct GfxState { /* Fundamental operations */ /**************************/ -int gfxop_init(int version, GfxState *state, gfx_options_t *options, ResourceManager *resManager, +int gfxop_init(int version, bool isVGA, GfxState *state, gfx_options_t *options, ResourceManager *resManager, int xfact = 1, int yfact = 1, gfx_color_mode_t bpp = GFX_COLOR_MODE_INDEX); /* Initializes a graphics mode ** Parameters: (int) version: The interpreter version diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 85f16f9902..f91c8d568c 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -226,8 +226,7 @@ Common::Error SciEngine::run() { // Default config ends #endif - int resVersion = !(getFlags() & GF_SCI1_EGA) ? _resmgr->_sciVersion : SCI_VERSION_01; - if (gfxop_init(resVersion, &gfx_state, &gfx_options, _resmgr)) { + if (gfxop_init(_resmgr->_sciVersion, !(getFlags() & GF_SCI1_EGA), &gfx_state, &gfx_options, _resmgr)) { fprintf(stderr, "Graphics initialization failed. Aborting...\n"); return Common::kUnknownError; } -- cgit v1.2.3