- Fixed usage of kSetCursor in SCI1.1 games (e.g. when starting KQ6 floppy)

- Removed a static variable (vocab_version)
- vocab.996 is now freed after creating the class table in SCI1 games, like in SCI0 games

svn-id: r40979
This commit is contained in:
Filippos Karapetis 2009-05-29 09:42:11 +00:00
parent c95e5fceee
commit b242d05563
3 changed files with 39 additions and 38 deletions

View File

@ -265,6 +265,8 @@ int create_class_table_sci11(EngineState *s) {
}
}
s->resmgr->unlockResource(vocab996, 996, kResourceTypeVocab);
vocab996 = NULL;
return 0;
}

View File

@ -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) {

View File

@ -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;