[Scummvm-cvs-logs] SF.net SVN: scummvm:[40979] scummvm/trunk/engines/sci
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Fri May 29 11:42:11 CEST 2009
Revision: 40979
http://scummvm.svn.sourceforge.net/scummvm/?rev=40979&view=rev
Author: thebluegr
Date: 2009-05-29 09:42:11 +0000 (Fri, 29 May 2009)
Log Message:
-----------
- 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
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/game.cpp
scummvm/trunk/engines/sci/engine/kgraphics.cpp
scummvm/trunk/engines/sci/vocabulary.cpp
Modified: scummvm/trunk/engines/sci/engine/game.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/game.cpp 2009-05-29 08:59:13 UTC (rev 40978)
+++ scummvm/trunk/engines/sci/engine/game.cpp 2009-05-29 09:42:11 UTC (rev 40979)
@@ -265,6 +265,8 @@
}
}
+ s->resmgr->unlockResource(vocab996, 996, kResourceTypeVocab);
+ vocab996 = NULL;
return 0;
}
Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp 2009-05-29 08:59:13 UTC (rev 40978)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp 2009-05-29 09:42:11 UTC (rev 40979)
@@ -302,8 +302,15 @@
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) {
Modified: scummvm/trunk/engines/sci/vocabulary.cpp
===================================================================
--- scummvm/trunk/engines/sci/vocabulary.cpp 2009-05-29 08:59:13 UTC (rev 40978)
+++ scummvm/trunk/engines/sci/vocabulary.cpp 2009-05-29 09:42:11 UTC (rev 40979)
@@ -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 @@
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,16 +225,17 @@
}
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 @@
}
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;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list