[Scummvm-cvs-logs] SF.net SVN: scummvm:[43863] scummvm/trunk/engines/sci/engine
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Mon Aug 31 22:45:46 CEST 2009
Revision: 43863
http://scummvm.svn.sourceforge.net/scummvm/?rev=43863&view=rev
Author: thebluegr
Date: 2009-08-31 20:45:46 +0000 (Mon, 31 Aug 2009)
Log Message:
-----------
Rewrote the static selector mapper to use SCI versions instead of game IDs, and split the selectors in SCI generations
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/kernel.cpp
scummvm/trunk/engines/sci/engine/kernel.h
scummvm/trunk/engines/sci/engine/static_selectors.cpp
Modified: scummvm/trunk/engines/sci/engine/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.cpp 2009-08-31 20:42:20 UTC (rev 43862)
+++ scummvm/trunk/engines/sci/engine/kernel.cpp 2009-08-31 20:45:46 UTC (rev 43863)
@@ -418,7 +418,7 @@
if (!r) { // No such resource?
// Check if we have a table for this game
// Some demos do not have a selector table
- Common::StringList staticSelectorTable = checkStaticSelectorNames();
+ Common::StringList staticSelectorTable = checkStaticSelectorNames(_resourceManager->sciVersion());
if (staticSelectorTable.empty())
error("Kernel: Could not retrieve selector names");
Modified: scummvm/trunk/engines/sci/engine/kernel.h
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.h 2009-08-31 20:42:20 UTC (rev 43862)
+++ scummvm/trunk/engines/sci/engine/kernel.h 2009-08-31 20:45:46 UTC (rev 43863)
@@ -140,7 +140,7 @@
* Check for any hardcoded selector table we might have that can be used
* if a game is missing the selector names.
*/
- Common::StringList checkStaticSelectorNames();
+ Common::StringList checkStaticSelectorNames(SciVersion version);
/**
* Maps special selectors
Modified: scummvm/trunk/engines/sci/engine/static_selectors.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/static_selectors.cpp 2009-08-31 20:42:20 UTC (rev 43862)
+++ scummvm/trunk/engines/sci/engine/static_selectors.cpp 2009-08-31 20:45:46 UTC (rev 43863)
@@ -58,35 +58,8 @@
"draw", "delete", "z" // 80 - 82
};
-void createFirstPart(Common::StringList &names, int offset, bool hasCantBeHere, bool hasNodePtr) {
- int count = ARRAYSIZE(selectorNamesFirstPart) + offset;
- int i;
- names.resize(count);
-
- for (i = 0; i < offset; i++)
- names[i].clear();
-
- for (i = offset; i < count; i++) {
- names[i] = selectorNamesFirstPart[i - offset];
- if (hasNodePtr && i == handleIndex + offset)
- names[i] = "nodePtr";
- if (hasCantBeHere && i == canBeHereIndex + offset)
- names[i] = "cantBeHere";
- }
-}
-
-// Taken from King's Quest IV (Full Game)
-// offset: 3, hascantbehere: false, hasNodePtr: false
-static const SelectorRemap kq4_demo_selectors[] = {
- { "init", 87 }, { "dispose", 88 }, { "size", 96 },
- { "caller", 119 }, { "cue", 121 }, { "owner", 130 },
- { "completed", 158 }, { "motionCue", 161 }, { "cycler", 165 },
- { "moveDone", 169 }, { "setCursor", 253 }
-};
-
// Taken from Codename: Iceman (Full Game)
-// offset: 3, hascantbehere: false, hasNodePtr: false
-static const SelectorRemap iceman_demo_selectors[] = {
+static const SelectorRemap sci0_selectors[] = {
{ "init", 87 }, { "dispose", 88 }, { "size", 96 },
{ "caller", 119 }, { "cue", 121 }, { "owner", 130 },
{ "completed", 159 }, { "motionCue", 162 }, { "cycler", 164 },
@@ -95,8 +68,7 @@
};
// Taken from Leisure Suit Larry 1 VGA (Full Game)
-// offset: 3, hascantbehere: true, hasNodePtr: true
-static const SelectorRemap lsl1_demo_selectors[] = {
+static const SelectorRemap sci1_selectors[] = {
{ "parseLang", 86 }, { "printLang", 87 }, { "subtitleLang", 88 },
{ "size", 89 }, { "points", 90 }, { "palette", 91 },
{ "dataInc", 92 }, { "handle", 93 }, { "min", 94 },
@@ -109,9 +81,8 @@
{ "syncCue", 248 }
};
-// Taken from KQ6 floppy
-// offset: 0, hascantbehere: true, hasNodePtr: true
-static const SelectorRemap christmas1992_selectors[] = {
+// Taken from KQ6 floppy (Full Game)
+static const SelectorRemap sci11_selectors[] = {
{ "parseLang", 83 }, { "printLang", 84 }, { "subtitleLang", 85 },
{ "size", 86 }, { "points", 87 }, { "palette", 88 },
{ "dataInc", 89 }, { "handle", 90 }, { "min", 91 },
@@ -126,31 +97,37 @@
// A macro for loading one of the above tables in the function below
#define USE_SELECTOR_TABLE(x) \
- for (uint32 i = 0; i < ARRAYSIZE(x); i++) { \
- if (x[i].slot >= names.size()) \
- names.resize(x[i].slot + 1); \
- names[x[i].slot] = x[i].name; \
- }
-Common::StringList Kernel::checkStaticSelectorNames() {
+
+Common::StringList Kernel::checkStaticSelectorNames(SciVersion version) {
Common::StringList names;
- if (!g_engine)
- return names;
+ int offset = (version < SCI_VERSION_1_1) ? 3 : 0;
+ int count = ARRAYSIZE(selectorNamesFirstPart) + offset;
+ names.resize(count);
+ const SelectorRemap *selectors = sci0_selectors;
- Common::String gameID = ((SciEngine*)g_engine)->getGameID();
+ for (int j = 0; j < offset; j++)
+ names[j].clear();
- if (gameID == "kq4sci") {
- createFirstPart(names, 3, false, false);
- USE_SELECTOR_TABLE(kq4_demo_selectors);
- } else if (gameID == "lsl3" || gameID == "iceman") { // identical, except iceman has "flags"
- createFirstPart(names, 3, false, false);
- USE_SELECTOR_TABLE(iceman_demo_selectors);
- } else if (gameID == "christmas1992" || gameID == "laurabow2") {
- createFirstPart(names, 0, true, true);
- USE_SELECTOR_TABLE(christmas1992_selectors);
- } else if (gameID == "lsl1sci" || gameID == "lsl5") {
- createFirstPart(names, 3, true, true);
- USE_SELECTOR_TABLE(lsl1_demo_selectors);
+ for (int i = offset; i < count; i++) {
+ names[i] = selectorNamesFirstPart[i - offset];
+ if (version >= SCI_VERSION_1_EGA && i == handleIndex + offset)
+ names[i] = "nodePtr";
+ if (version >= SCI_VERSION_1_EGA && i == canBeHereIndex + offset)
+ names[i] = "cantBeHere";
+ }
+
+ if (version <= SCI_VERSION_01)
+ selectors = sci0_selectors;
+ else if (version >= SCI_VERSION_1_EGA && version <= SCI_VERSION_1_LATE)
+ selectors = sci1_selectors;
+ else
+ selectors = sci11_selectors;
+
+ for (uint32 k = 0; k < ARRAYSIZE(selectors); k++) {
+ if (selectors[k].slot >= names.size()) \
+ names.resize(selectors[k].slot + 1); \
+ names[selectors[k].slot] = selectors[k].name; \
}
return names;
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