diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/game.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 11 | ||||
-rw-r--r-- | engines/sci/vocabulary.cpp | 64 |
3 files changed, 39 insertions, 38 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index b8af8bdc34..b8cf1d8d32 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -265,6 +265,8 @@ int create_class_table_sci11(EngineState *s) { } } + s->resmgr->unlockResource(vocab996, 996, kResourceTypeVocab); + vocab996 = NULL; return 0; } diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index a587f4eb87..b33b89577c 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -302,8 +302,15 @@ 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 : // set cursor according to the first parameter - GFX_ASSERT(gfxop_set_pointer_cursor(s->gfx_state, SKPV(0))); + case 1 : + if (s->version < SCI_VERSION_1_1) { + // Pre-SCI1.1: set cursor according to the first parameter + GFX_ASSERT(gfxop_set_pointer_cursor(s->gfx_state, SKPV(0))); + } else { + // SCI1.1: Hide cursor + if (SKPV(0) == 0) + GFX_ASSERT(gfxop_set_pointer_cursor(s->gfx_state, GFXOP_NO_POINTER)); + } break; case 2 : if (s->version < SCI_VERSION_1_1) { diff --git a/engines/sci/vocabulary.cpp b/engines/sci/vocabulary.cpp index d823a7432c..02b0b5229d 100644 --- a/engines/sci/vocabulary.cpp +++ b/engines/sci/vocabulary.cpp @@ -32,18 +32,6 @@ namespace Sci { -static int vocab_version; // FIXME: Avoid static vars - -#define VOCAB_RESOURCE_PARSE_TREE_BRANCHES vocab_version == 1 ? \ - VOCAB_RESOURCE_SCI1_PARSE_TREE_BRANCHES : \ - VOCAB_RESOURCE_SCI0_PARSE_TREE_BRANCHES - -#define VOCAB_RESOURCE_SUFFIX_VOCAB vocab_version==1 ? \ - VOCAB_RESOURCE_SCI1_SUFFIX_VOCAB : \ - VOCAB_RESOURCE_SCI0_SUFFIX_VOCAB - - - #if 0 /** @@ -156,12 +144,10 @@ bool vocab_get_words(ResourceManager *resmgr, WordMap &words) { char currentword[256] = ""; // They're not going to use words longer than 255 ;-) int currentwordpos = 0; - Resource *resource; - // First try to load the SCI0 vocab resource. - resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_MAIN_VOCAB, 0); - vocab_version = 0; - + Resource *resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_MAIN_VOCAB, 0); + int vocab_version = 0; + if (!resource) { warning("SCI0: Could not find a main vocabulary, trying SCI01"); resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_MAIN_VOCAB, 0); @@ -239,15 +225,16 @@ const char *vocab_get_any_group_word(int group, const WordMap &words) { } bool vocab_get_suffixes(ResourceManager *resmgr, SuffixList &suffixes) { - // FIXME: This call relies on vocab_version being set, which is done by vocab_get_words. - // So vocab_get_words *must* be called before vocab_get_branches gets called - Resource *resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SUFFIX_VOCAB, 1); - unsigned int seeker = 1; + // Determine if we got a SCI0 vocabulary loaded + Resource* resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_MAIN_VOCAB, 1); + if (!resource) + // No SCI0 vocabulary? Try SCI1 + resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_MAIN_VOCAB, 1); - if (!resource) { - warning("Could not find suffix vocabulary"); - return false; // Not critical - } + if (!resource) + return false; // No vocabulary found + + unsigned int seeker = 1; while ((seeker < resource->size - 1) && (resource->data[seeker + 1] != 0xff)) { suffix_t suffix; @@ -276,25 +263,30 @@ bool vocab_get_suffixes(ResourceManager *resmgr, SuffixList &suffixes) { } void vocab_free_suffixes(ResourceManager *resmgr, SuffixList &suffixes) { - // FIXME: This call relies on vocab_version being set, which is done by vocab_get_words. - // So vocab_get_words *must* be called before vocab_get_branches gets called - resmgr->unlockResource(resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SUFFIX_VOCAB, 0), - VOCAB_RESOURCE_SUFFIX_VOCAB, kResourceTypeVocab); + // Determine if we got a SCI0 vocabulary loaded + Resource* resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_MAIN_VOCAB, 0); + if (resource && resource->status == kResStatusLocked) { + resmgr->unlockResource(resource, VOCAB_RESOURCE_SCI0_MAIN_VOCAB, kResourceTypeVocab); + } else { + // No SCI0 vocabulary? Try SCI1 + resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_MAIN_VOCAB, 0); + if (resource && resource->status == kResStatusLocked) + resmgr->unlockResource(resource, VOCAB_RESOURCE_SCI1_MAIN_VOCAB, kResourceTypeVocab); + } suffixes.clear(); } bool vocab_get_branches(ResourceManager * resmgr, Common::Array<parse_tree_branch_t> &branches) { - // FIXME: This call relies on vocab_version being set, which is done by vocab_get_words. - // So vocab_get_words *must* be called before vocab_get_branches gets called - Resource *resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_PARSE_TREE_BRANCHES, 0); + Resource *resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_PARSE_TREE_BRANCHES, 0); + if (!resource) + // No SCI0 parser tree? Try SCI1 + resource = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_PARSE_TREE_BRANCHES, 0); branches.clear(); - if (!resource) { - fprintf(stderr, "No parser tree data found!\n"); - return false; - } + if (!resource) + return false; // No parser tree data found int branches_nr = resource->size / 20; |