[Scummvm-cvs-logs] SF.net SVN: scummvm:[39694] scummvm/trunk/engines/sci/scicore/vocab_debug. cpp

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Mar 25 23:37:09 CET 2009


Revision: 39694
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39694&view=rev
Author:   thebluegr
Date:     2009-03-25 22:37:08 +0000 (Wed, 25 Mar 2009)

Log Message:
-----------
Use the default kernel vocabulary names for SCI1 games, instead of reading the unreliable (in SCI1 games) 999.voc resource. KQ5 and EcoQuest 1 now work properly, and all other SCI1 games seem to be unaffected and working with this change. If there's any SCI1 game with different kernel vocabulary names, we can add special flags to it to our detector, so this change fixes more than it breaks :)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/scicore/vocab_debug.cpp

Modified: scummvm/trunk/engines/sci/scicore/vocab_debug.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/vocab_debug.cpp	2009-03-25 21:58:16 UTC (rev 39693)
+++ scummvm/trunk/engines/sci/scicore/vocab_debug.cpp	2009-03-25 22:37:08 UTC (rev 39694)
@@ -471,12 +471,31 @@
 	return t;
 }
 
-//NOTE: Untested
 static char **vocabulary_get_knames1(ResourceManager *resmgr, int *count) {
 	char **t = NULL;
+	// vocab.999/999.voc is notoriously unreliable in SCI1 games, and should not be used
+	// We hardcode the default SCI1 kernel names here (i.e. the ones inside the "special"
+	// 999.voc file from FreeSCI). All SCI1 games seem to be working with this change, but
+	// if any SCI1 game has different kernel vocabulary names, it might not work. It seems
+	// that all SCI1 games use the same kernel vocabulary names though, so this seems to be
+	// a safe change. If there's any SCI1 game with different kernel vocabulary names, we can
+	// add special flags to it to our detector
+	t = (char **)sci_malloc((SCI1_KNAMES_DEFAULT_ENTRIES_NR + 1) * sizeof(char*));
+	*count = SCI1_KNAMES_DEFAULT_ENTRIES_NR - 1; // index of last element
+
+	for (int i = 0; i < SCI1_KNAMES_DEFAULT_ENTRIES_NR; i++)
+		t[i] = sci_strdup(sci1_default_knames[i]);
+
+	t[SCI1_KNAMES_DEFAULT_ENTRIES_NR] = NULL; // Terminate list
+
+	return t;
+
+// Previous code, which used the unreliable 999.voc resource
+#if 0
 	unsigned int size = 64, used = 0, pos = 0;
 	Resource *r = resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_KNAMES, 0);
-	if(r == NULL) {// failed to open vocab.999 (happens with SCI1 demos)
+
+	if (r == NULL) {// failed to open vocab.999 (happens with SCI1 demos)
 		t = (char **)sci_malloc((SCI1_KNAMES_DEFAULT_ENTRIES_NR + 1) * sizeof(char*));
 		*count = SCI1_KNAMES_DEFAULT_ENTRIES_NR - 1; // index of last element
 
@@ -504,6 +523,7 @@
 	t[used] = NULL;
 
 	return t;
+#endif
 }
 //
 static char **vocabulary_get_knames11(ResourceManager *resmgr, int *count) {


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