aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorMax Horn2010-06-25 16:16:29 +0000
committerMax Horn2010-06-25 16:16:29 +0000
commit6ee82a20276d213a06d43ff731d197f5a92a09d7 (patch)
treed9bc631c10aa56d2ba6d47b2cdcb644696fee0a4 /engines/sci/engine
parent23d384e6b88f4023b9150401a70a4efdf9bae018 (diff)
downloadscummvm-rg350-6ee82a20276d213a06d43ff731d197f5a92a09d7.tar.gz
scummvm-rg350-6ee82a20276d213a06d43ff731d197f5a92a09d7.tar.bz2
scummvm-rg350-6ee82a20276d213a06d43ff731d197f5a92a09d7.zip
SCI: Introduce SciGameId enum
svn-id: r50273
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/kernel.cpp4
-rw-r--r--engines/sci/engine/kgraphics.cpp2
-rw-r--r--engines/sci/engine/kmisc.cpp4
-rw-r--r--engines/sci/engine/kpathing.cpp4
-rw-r--r--engines/sci/engine/segment.cpp4
-rw-r--r--engines/sci/engine/static_selectors.cpp2
-rw-r--r--engines/sci/engine/vm.cpp28
7 files changed, 25 insertions, 23 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index 41a2d2dd2b..d6dcf650bc 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -745,7 +745,7 @@ void Kernel::setDefaultKernelNames() {
// In SCI1.1, kSetSynonyms is an empty function
_kernelNames[0x26] = "Empty";
- if (g_sci->getGameId() == "kq6") {
+ if (g_sci->getGameId() == GID_KQ6) {
// In the Windows version of KQ6 CD, the empty kSetSynonyms
// function has been replaced with kPortrait. In KQ6 Mac,
// kPlayBack has been replaced by kShowMovie.
@@ -753,7 +753,7 @@ void Kernel::setDefaultKernelNames() {
_kernelNames[0x26] = "Portrait";
else if (g_sci->getPlatform() == Common::kPlatformMacintosh)
_kernelNames[0x84] = "ShowMovie";
- } else if (g_sci->getGameId() == "qfg4" && g_sci->isDemo()) {
+ } else if (g_sci->getGameId() == GID_QFG4 && g_sci->isDemo()) {
_kernelNames[0x7b] = "RemapColors"; // QFG4 Demo has this SCI2 function instead of StrSplit
}
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 756ac6ffcb..b1cd1451d1 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -541,7 +541,7 @@ reg_t kBaseSetter(EngineState *s, int argc, reg_t *argv) {
// WORKAROUND for a problem in LSL1VGA. This allows the casino door to be opened,
// till the actual problem is found
- if (s->currentRoomNumber() == 300 && g_sci->getGameId() == "lsl1sci") {
+ if (s->currentRoomNumber() == 300 && g_sci->getGameId() == GID_LSL1) {
int top = readSelectorValue(s->_segMan, object, SELECTOR(brTop));
writeSelectorValue(s->_segMan, object, SELECTOR(brTop), top + 2);
}
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index 4dd7df1b52..f742734ad7 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -60,9 +60,9 @@ reg_t kGameIsRestarting(EngineState *s, int argc, reg_t *argv) {
// throttling resulting in having to do 1000 pushups or something. Another
// way of handling this would be delaying incrementing of "machineSpeed"
// selector.
- if (g_sci->getGameId() == "lsl3" && s->currentRoomNumber() == 290)
+ if (g_sci->getGameId() == GID_LSL3 && s->currentRoomNumber() == 290)
s->_throttleTrigger = true;
- else if (g_sci->getGameId() == "iceman" && s->currentRoomNumber() == 27) {
+ else if (g_sci->getGameId() == GID_ICEMAN && s->currentRoomNumber() == 27) {
s->_throttleTrigger = true;
neededSleep = 60;
}
diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp
index ba6fb9bb6e..fdaae3e121 100644
--- a/engines/sci/engine/kpathing.cpp
+++ b/engines/sci/engine/kpathing.cpp
@@ -1090,7 +1090,7 @@ static Polygon *convert_polygon(EngineState *s, reg_t polygon) {
// WORKAROUND: broken polygon in lsl1sci, room 350, after opening elevator
// Polygon has 17 points but size is set to 19
- if ((size == 19) && g_sci->getGameId() == "lsl1sci") {
+ if ((size == 19) && g_sci->getGameId() == GID_LSL1) {
if ((s->currentRoomNumber() == 350)
&& (read_point(segMan, points, 18) == Common::Point(108, 137))) {
debug(1, "Applying fix for broken polygon in lsl1sci, room 350");
@@ -1212,7 +1212,7 @@ static PathfindingState *convert_polygon_set(EngineState *s, reg_t poly_list, Co
// WORKAROUND LSL5 room 660. Priority glitch due to us choosing a different path
// than SSCI. Happens when Patti walks to the control room.
- if (g_sci->getGameId() == "lsl5" && (s->currentRoomNumber() == 660) && (Common::Point(67, 131) == *new_start) && (Common::Point(229, 101) == *new_end)) {
+ if (g_sci->getGameId() == GID_LSL5 && (s->currentRoomNumber() == 660) && (Common::Point(67, 131) == *new_start) && (Common::Point(229, 101) == *new_end)) {
debug(1, "[avoidpath] Applying fix for priority problem in LSL5, room 660");
pf_s->_prependPoint = new_start;
new_start = new Common::Point(77, 107);
diff --git a/engines/sci/engine/segment.cpp b/engines/sci/engine/segment.cpp
index 6a564fcc57..0a39d950b0 100644
--- a/engines/sci/engine/segment.cpp
+++ b/engines/sci/engine/segment.cpp
@@ -465,7 +465,7 @@ SegmentRef LocalVariables::dereference(reg_t pointer) {
ret.reg = &_locals[pointer.offset / 2];
} else {
if ((g_sci->getEngineState()->currentRoomNumber() == 660 || g_sci->getEngineState()->currentRoomNumber() == 660)
- && g_sci->getGameId() == "laurabow2") {
+ && g_sci->getGameId() == GID_LAURABOW2) {
// Happens in two places during the intro of LB2CD, both from kMemory(peek):
// - room 160: Heap 160 has 83 local variables (0-82), and the game
// asks for variables at indices 83 - 90 too.
@@ -520,7 +520,7 @@ SegmentRef SystemStrings::dereference(reg_t pointer) {
if (isValidOffset(pointer.offset))
ret.raw = (byte *)(_strings[pointer.offset]._value);
else {
- if (g_sci->getGameId() == "kq5") {
+ if (g_sci->getGameId() == GID_KQ5) {
// This occurs in KQ5CD when interacting with certain objects
} else {
error("SystemStrings::dereference(): Attempt to dereference invalid pointer %04x:%04x", PRINT_REG(pointer));
diff --git a/engines/sci/engine/static_selectors.cpp b/engines/sci/engine/static_selectors.cpp
index 12d61ed24a..85089e74c8 100644
--- a/engines/sci/engine/static_selectors.cpp
+++ b/engines/sci/engine/static_selectors.cpp
@@ -158,7 +158,7 @@ Common::StringArray Kernel::checkStaticSelectorNames() {
}
}
- if (g_sci->getGameId() == "hoyle4") {
+ if (g_sci->getGameId() == GID_HOYLE4) {
// The demo of Hoyle 4 is one of the few demos with lip syncing and no selector vocabulary.
// This needs two selectors, "syncTime" and "syncCue", which keep changing positions in each
// game. Usually, games with speech and lip sync have a selector vocabulary, so we don't need
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 3295406745..3dad005bb2 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -169,7 +169,7 @@ static bool validate_variable(reg_t *r, reg_t *stack_base, int type, int max, in
} else {
// WORKAROUND: Mixed-Up Mother Goose tries to use an invalid parameter in Event::new().
// Just skip around it here so we don't error out in validate_arithmetic.
- if (g_sci->getGameId() == "mothergoose" && getSciVersion() <= SCI_VERSION_1_1 && type == VAR_PARAM && index == 1)
+ if (g_sci->getGameId() == GID_MOTHERGOOSE && getSciVersion() <= SCI_VERSION_1_1 && type == VAR_PARAM && index == 1)
return false;
debugC(2, kDebugLevelVM, "%s", txt.c_str());
@@ -184,20 +184,22 @@ static bool validate_variable(reg_t *r, reg_t *stack_base, int type, int max, in
}
struct UninitializedReadWorkaround {
- const char *gameId;
+ SciGameId gameId;
int scriptNr;
const char *objectName;
const char *methodName;
int index;
uint16 newValue;
-} static const uninitializedReadWorkarounds[] = {
- { "laurabow2", 24, "gcWin", "open", 5, 0xf }, // is used as priority for game menu
- { "freddypharkas", 24, "gcWin", "open", 5, 0xf }, // is used as priority for game menu
- { "freddypharkas", 31, "quitWin", "open", 5, 0xf }, // is used as priority for game menu
- { "lsl1sci", 720, "rm720", "init", 0, 0 }, // age check room
- { "islandbrain", 140, "piece", "init", 3, 1 }, // some initialization variable. bnt is done on it, and it should be non-0
- { "sq4", 928, "Narrator", "startText", 1000, 1 }, // sq4cd: method returns this to the caller
- { NULL, -1, NULL, NULL, 0, 0 }
+};
+
+static const UninitializedReadWorkaround uninitializedReadWorkarounds[] = {
+ { GID_LAURABOW2, 24, "gcWin", "open", 5, 0xf }, // is used as priority for game menu
+ { GID_FREDDYPHARKAS, 24, "gcWin", "open", 5, 0xf }, // is used as priority for game menu
+ { GID_FREDDYPHARKAS, 31, "quitWin", "open", 5, 0xf }, // is used as priority for game menu
+ { GID_LSL1, 720, "rm720", "init", 0, 0 }, // age check room
+ { GID_ISLANDBRAIN, 140, "piece", "init", 3, 1 }, // some initialization variable. bnt is done on it, and it should be non-0
+ { GID_SQ4, 928, "Narrator", "startText", 1000, 1 }, // sq4cd: method returns this to the caller
+ { (SciGameId)0, -1, NULL, NULL, 0, 0 }
};
static reg_t validate_read_var(reg_t *r, reg_t *stack_base, int type, int max, int index, int line, reg_t default_value) {
@@ -218,14 +220,14 @@ static reg_t validate_read_var(reg_t *r, reg_t *stack_base, int type, int max, i
Common::String curObjectName = state->_segMan->getObjectName(call.sendp);
Common::String curMethodName;
- Common::String gameId = g_sci->getGameId();
+ const SciGameId gameId = g_sci->getGameId();
if (call.type == EXEC_STACK_TYPE_CALL)
curMethodName = g_sci->getKernel()->getSelectorName(call.selector);
// Search if this is a known uninitialized read
const UninitializedReadWorkaround *workaround = uninitializedReadWorkarounds;
- while (workaround->gameId) {
+ while (workaround->objectName) {
if (workaround->gameId == gameId && workaround->scriptNr == curScriptNr && workaround->objectName == curObjectName
&& workaround->methodName == curMethodName && workaround->index == index) {
// Workaround found
@@ -481,7 +483,7 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt
if (!strcmp(objectName, "Sq4GlobalNarrator") && selector == 606) {
// SQ4 has a script bug in the Sq4GlobalNarrator object when invoking the
// returnVal selector, which doesn't affect gameplay, thus don't diplay it
- } else if (!strcmp(objectName, "longSong") && selector == 3 && g_sci->getGameId() == "qfg1") {
+ } else if (!strcmp(objectName, "longSong") && selector == 3 && g_sci->getGameId() == GID_QFG1) {
// QFG1VGA has a script bug in the longSong object when invoking the
// loop selector, which doesn't affect gameplay, thus don't diplay it
} else {