aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorFilippos Karapetis2010-09-09 20:09:32 +0000
committerFilippos Karapetis2010-09-09 20:09:32 +0000
commitf446dbc8d5e8cfa90dc90ea3034d9eb7b2252a84 (patch)
treeb95e006a8b31367bb891a4432171c50f8ad65b54 /engines/sci/engine
parenta8afefd64b6707bb48684fcc1d62866a8772cf5e (diff)
downloadscummvm-rg350-f446dbc8d5e8cfa90dc90ea3034d9eb7b2252a84.tar.gz
scummvm-rg350-f446dbc8d5e8cfa90dc90ea3034d9eb7b2252a84.tar.bz2
scummvm-rg350-f446dbc8d5e8cfa90dc90ea3034d9eb7b2252a84.zip
SCI: Implemented the kPrintDebug SCI2.1 kernel function, used in Shivers (demo)
svn-id: r52665
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/kernel.h8
-rw-r--r--engines/sci/engine/kernel_tables.h3
-rw-r--r--engines/sci/engine/kstring.cpp14
3 files changed, 20 insertions, 5 deletions
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index 46da60082c..90b0ae2bee 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -461,13 +461,13 @@ reg_t kRobot(EngineState *s, int argc, reg_t *argv);
reg_t kPlayVMD(EngineState *s, int argc, reg_t *argv);
reg_t kCD(EngineState *s, int argc, reg_t *argv);
reg_t kAddPicAt(EngineState *s, int argc, reg_t *argv);
-reg_t kGetWindowsOption(EngineState *s, int argc, reg_t *argv);
-reg_t kWinHelp(EngineState *s, int argc, reg_t *argv);
-reg_t kWinDLL(EngineState *s, int argc, reg_t *argv);
-
reg_t kAddBefore(EngineState *s, int argc, reg_t *argv);
reg_t kMoveToFront(EngineState *s, int argc, reg_t *argv);
reg_t kMoveToEnd(EngineState *s, int argc, reg_t *argv);
+reg_t kGetWindowsOption(EngineState *s, int argc, reg_t *argv);
+reg_t kWinHelp(EngineState *s, int argc, reg_t *argv);
+reg_t kWinDLL(EngineState *s, int argc, reg_t *argv);
+reg_t kPrintDebug(EngineState *s, int argc, reg_t *argv);
#endif
reg_t kDoSoundInit(EngineState *s, int argc, reg_t *argv);
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index 477fb08311..0ee71b37e9 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -503,7 +503,8 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_CALL(AddPicAt), SIG_EVERYWHERE, "oiii", NULL, NULL },
{ MAP_CALL(GetWindowsOption), SIG_EVERYWHERE, "i", NULL, NULL },
{ MAP_CALL(WinHelp), SIG_EVERYWHERE, "(.*)", NULL, NULL },
- { MAP_CALL(WinDLL), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+ { MAP_CALL(WinDLL), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+ { MAP_CALL(PrintDebug), SIG_EVERYWHERE, "ri", NULL, NULL },
// SCI2.1 empty functions
{ MAP_EMPTY(SetWindowsOption), SIG_EVERYWHERE, "ii", NULL, NULL },
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index 37bd265b57..a7dc445ba2 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -787,6 +787,20 @@ reg_t kString(EngineState *s, int argc, reg_t *argv) {
return NULL_REG;
}
+/**
+ * Debug function, used in the demo of Shivers. It's marked as a stub
+ * in the original interpreter, but it gets called by the game scripts.
+ */
+reg_t kPrintDebug(EngineState *s, int argc, reg_t *argv) {
+ Common::String debugTemplate = s->_segMan->getString(argv[0]);
+ char debugString[500];
+
+ sprintf(debugString, debugTemplate.c_str(), argv[1].toUint16());
+ debugC(2, "kPrintDebug: \"%s\"\n", debugString);
+
+ return s->r_acc;
+}
+
#endif
} // End of namespace Sci