aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/engine/kernel.h1
-rw-r--r--engines/sci/engine/kernel_tables.h2
-rw-r--r--engines/sci/engine/kmisc.cpp8
-rw-r--r--engines/sci/sci.cpp1
-rw-r--r--engines/sci/sci.h3
5 files changed, 13 insertions, 2 deletions
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index 6cacb5f839..b3677d965b 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -630,6 +630,7 @@ reg_t kWinHelp(EngineState *s, int argc, reg_t *argv);
reg_t kMessageBox(EngineState *s, int argc, reg_t *argv);
reg_t kGetConfig(EngineState *s, int argc, reg_t *argv);
reg_t kGetSierraProfileInt(EngineState *s, int argc, reg_t *argv);
+reg_t kPrintDebug(EngineState *s, int argc, reg_t *argv);
reg_t kCelInfo(EngineState *s, int argc, reg_t *argv);
reg_t kSetLanguage(EngineState *s, int argc, reg_t *argv);
reg_t kScrollWindow(EngineState *s, int argc, reg_t *argv);
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index b8d8450bc1..8d2408a3be 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -929,7 +929,7 @@ static SciKernelMapEntry s_kernelMap[] = {
// stub in the original interpreters, but it gets called by the game scripts.
// Usually, it gets called with a string (which is the output format) and a
// variable number of parameters
- { MAP_EMPTY(PrintDebug), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+ { MAP_CALL(PrintDebug), SIG_SCI32, SIGFOR_ALL, "r(.*)", NULL, NULL },
// SetWindowsOption is used to set Windows specific options, like for example the title bar visibility of
// the game window in Phantasmagoria 2. We ignore these settings completely.
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index f2a3c6b0f7..9aa03a4760 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -459,6 +459,14 @@ reg_t kGetWindowsOption(EngineState *s, int argc, reg_t *argv) {
}
}
+extern Common::String format(const Common::String &source, int argc, const reg_t *argv);
+
+reg_t kPrintDebug(EngineState *s, int argc, reg_t *argv) {
+ const Common::String debugString = s->_segMan->getString(argv[0]);
+ debugC(kDebugLevelGame, "%s", format(debugString, argc - 1, argv + 1).c_str());
+ return s->r_acc;
+}
+
#endif
// kIconBar is really a subop of kMacPlatform for SCI1.1 Mac
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 8e330f274b..6ae858ec72 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -128,6 +128,7 @@ SciEngine::SciEngine(OSystem *syst, const ADGameDescription *desc, SciGameId gam
DebugMan.addDebugChannel(kDebugLevelScriptPatcher, "ScriptPatcher", "Notifies when scripts are patched");
DebugMan.addDebugChannel(kDebugLevelWorkarounds, "Workarounds", "Notifies when workarounds are triggered");
DebugMan.addDebugChannel(kDebugLevelVideo, "Video", "Video (SEQ, VMD, RBT) debugging");
+ DebugMan.addDebugChannel(kDebugLevelGame, "Game", "Debug calls from game scripts");
DebugMan.addDebugChannel(kDebugLevelGC, "GC", "Garbage Collector debugging");
DebugMan.addDebugChannel(kDebugLevelResMan, "ResMan", "Resource manager debugging");
DebugMan.addDebugChannel(kDebugLevelOnStartup, "OnStartup", "Enter debugger at start of game");
diff --git a/engines/sci/sci.h b/engines/sci/sci.h
index b336eb8cce..b46207b075 100644
--- a/engines/sci/sci.h
+++ b/engines/sci/sci.h
@@ -125,7 +125,8 @@ enum kDebugLevels {
kDebugLevelDebugMode = 1 << 21,
kDebugLevelScriptPatcher = 1 << 22,
kDebugLevelWorkarounds = 1 << 23,
- kDebugLevelVideo = 1 << 24
+ kDebugLevelVideo = 1 << 24,
+ kDebugLevelGame = 1 << 25
};
enum SciGameId {