From b093511239401c5d64d6b21c0b875d5be6e5f239 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 4 Jul 2009 16:30:20 +0000 Subject: - Merged the "early" and "late" SCI1 versions - these are functionally equivalent, and the code that does the version check is unreliable (e.g. it sets SQ1 VGA to SCI1 "late" and EcoQuest 1 to SCI1 "early") - Cleanup of the vocabulary setting functions - Cleanup of the cursor manipulation code svn-id: r42097 --- engines/sci/engine/kernel.cpp | 13 +++++++------ engines/sci/engine/kgraphics.cpp | 13 +++++++++---- engines/sci/engine/script.cpp | 3 +-- engines/sci/gfx/gfx_resmgr.cpp | 2 +- engines/sci/resource.cpp | 18 ++++-------------- engines/sci/resource.h | 2 -- engines/sci/sci.cpp | 4 ++-- engines/sci/sci.h | 3 +-- 8 files changed, 25 insertions(+), 33 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index b68c42296a..ab6fb36085 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -386,6 +386,7 @@ void Kernel::loadSelectorNames(bool isOldSci0) { Common::String tmp((const char *)r->data + offset + 2, len); _selectorNames.push_back(tmp); + //printf("%s\n", tmp.c_str()); // debug // Early SCI versions used the LSB in the selector ID as a read/write // toggle. To compensate for that, we add every selector name twice. @@ -751,6 +752,11 @@ void Kernel::setDefaultKernelNames() { offset = 4; } } + + if (_resmgr->_sciVersion == SCI_VERSION_1_1) { + // KQ6CD calls unimplemented function 0x26 + _kernelNames[0x26] = "Dummy"; + } } #ifdef ENABLE_SCI32 @@ -788,14 +794,9 @@ bool Kernel::loadKernelNames() { case SCI_VERSION_01: case SCI_VERSION_01_VGA: case SCI_VERSION_01_VGA_ODD: - case SCI_VERSION_1_EARLY: - case SCI_VERSION_1_LATE: + case SCI_VERSION_1: case SCI_VERSION_1_1: setDefaultKernelNames(); - if (_resmgr->_sciVersion == SCI_VERSION_1_1) { - // KQ6CD calls unimplemented function 0x26 - _kernelNames[0x26] = "Dummy"; - } break; #ifdef ENABLE_SCI32 case SCI_VERSION_32: diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 6e737597d6..9d19f3f0c9 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -304,7 +304,9 @@ static gfx_color_t graph_map_color(EngineState *s, int color, int priority, int reg_t kSetCursor(EngineState *s, int funct_nr, int argc, reg_t *argv) { switch (argc) { case 1 : - if (s->_version < SCI_VERSION_1_1) { + if (s->_version < SCI_VERSION_1) { + GFX_ASSERT(gfxop_set_pointer_cursor(s->gfx_state, argv[0].toSint16())); + } else if (s->_version == SCI_VERSION_1) { if (argv[0].toSint16() <= 1) { // Newer (SCI1.1) semantics: show/hide cursor CursorMan.showMouse(argv[0].toSint16() != 0); @@ -312,13 +314,16 @@ reg_t kSetCursor(EngineState *s, int funct_nr, int argc, reg_t *argv) { // Pre-SCI1.1: set cursor according to the first parameter GFX_ASSERT(gfxop_set_pointer_cursor(s->gfx_state, argv[0].toSint16())); } - } else { + } else if (s->_version >= SCI_VERSION_1_1) { // SCI1.1: Show/hide cursor CursorMan.showMouse(argv[0].toSint16() != 0); } break; case 2 : - if (s->_version < SCI_VERSION_1_1) { + if (s->_version < SCI_VERSION_1) { + GFX_ASSERT(gfxop_set_pointer_cursor(s->gfx_state, + argv[1].toSint16() == 0 ? GFXOP_NO_POINTER : argv[0].toSint16())); + } else if (s->_version == SCI_VERSION_1) { // Pre-SCI1.1: set cursor according to the first parameter, and toggle its // visibility based on the second parameter // Some late SCI1 games actually use the SCI1.1 version of this call (EcoQuest 1 @@ -337,7 +342,7 @@ reg_t kSetCursor(EngineState *s, int funct_nr, int argc, reg_t *argv) { GFX_ASSERT(gfxop_set_pointer_position(s->gfx_state, Common::Point(argv[0].toUint16(), argv[1].toUint16()))); } - } else { + } else if (s->_version >= SCI_VERSION_1_1) { // SCI1.1 and newer: set pointer position GFX_ASSERT(gfxop_set_pointer_position(s->gfx_state, Common::Point(argv[0].toUint16(), argv[1].toUint16()))); diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp index 3260be6b36..ca5379a4c0 100644 --- a/engines/sci/engine/script.cpp +++ b/engines/sci/engine/script.cpp @@ -97,8 +97,7 @@ void script_adjust_opcode_formats(int res_version) { break; case SCI_VERSION_01_VGA: case SCI_VERSION_01_VGA_ODD: - case SCI_VERSION_1_EARLY: - case SCI_VERSION_1_LATE: + case SCI_VERSION_1: case SCI_VERSION_1_1: g_opcode_formats[op_lofsa][0] = Script_Offset; g_opcode_formats[op_lofss][0] = Script_Offset; diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp index 0ec27ae41a..1289997721 100644 --- a/engines/sci/gfx/gfx_resmgr.cpp +++ b/engines/sci/gfx/gfx_resmgr.cpp @@ -534,7 +534,7 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) { view = gfxr_draw_view0(resid, viewRes->data, viewRes->size, -1); 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) + 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); diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 52c079e829..6368f40cc1 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -509,16 +509,9 @@ ResourceManager::ResourceManager(int version, int maxMemory) { case SCI_VERSION_01_VGA_ODD: version = _mapVersion; break; - case SCI_VERSION_1: { - Resource *res = testResource(ResourceId(kResourceTypeScript, 0)); - - _sciVersion = version = SCI_VERSION_1_EARLY; - loadResource(res); - - if (res->status == kResStatusNoMalloc) - version = SCI_VERSION_1_LATE; + case SCI_VERSION_1: + _sciVersion = version = SCI_VERSION_1; break; - } case SCI_VERSION_1_1: // No need to handle SCI 1.1 here - it was done in resource_map.cpp version = SCI_VERSION_1_1; @@ -542,11 +535,8 @@ ResourceManager::ResourceManager(int version, int maxMemory) { case SCI_VERSION_01_VGA_ODD: debug("Resmgr: Detected SCI01VGA - Jones/CD or similar"); break; - case SCI_VERSION_1_EARLY: - debug("Resmgr: Detected SCI1 Early"); - break; - case SCI_VERSION_1_LATE: - debug("Resmgr: Detected SCI1 Late"); + case SCI_VERSION_1: + debug("Resmgr: Detected SCI1"); break; case SCI_VERSION_1_1: debug("Resmgr: Detected SCI1.1"); diff --git a/engines/sci/resource.h b/engines/sci/resource.h index 77c92840ee..8ef42b171d 100644 --- a/engines/sci/resource.h +++ b/engines/sci/resource.h @@ -66,8 +66,6 @@ enum { /* the first critical error number */ }; -#define SCI_VERSION_1 SCI_VERSION_1_EARLY - #define MAX_OPENED_VOLUMES 5 // Max number of simultaneously opened volumes enum ResSourceType { diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 34db178706..3686126c83 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -147,13 +147,13 @@ Common::Error SciEngine::run() { _gamestate = new EngineState(_resmgr, version, flags); // Verify that we haven't got an invalid game detection entry - if (version < SCI_VERSION_1_EARLY) { + if (version < SCI_VERSION_1) { // SCI0/SCI01 if (flags & GF_SCI1_EGA || flags & GF_SCI1_LOFSABSOLUTE) { error("This game entry is erroneous. It's marked as SCI0/SCI01, but it has SCI1 flags set"); } - } else if (version >= SCI_VERSION_1_EARLY && version <= SCI_VERSION_1_LATE) { + } else if (version == SCI_VERSION_1) { // SCI1 if (flags & GF_SCI0_OLD || diff --git a/engines/sci/sci.h b/engines/sci/sci.h index fdf9dc9ebf..6236b9843b 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -73,8 +73,7 @@ enum SciGameVersions { SCI_VERSION_01 = 2, SCI_VERSION_01_VGA = 3, SCI_VERSION_01_VGA_ODD = 4, - SCI_VERSION_1_EARLY = 5, - SCI_VERSION_1_LATE = 6, + SCI_VERSION_1 = 5, SCI_VERSION_1_1 = 7, SCI_VERSION_32 = 8 }; -- cgit v1.2.3