[Scummvm-git-logs] scummvm master -> 3256a04e2dcb75e62ce6e87b1c6d74a5647fa334

aquadran noreply at scummvm.org
Tue Nov 3 03:57:04 UTC 2026


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
3256a04e2d GRIM: Rework debug log system


Commit: 3256a04e2dcb75e62ce6e87b1c6d74a5647fa334
    https://github.com/scummvm/scummvm/commit/3256a04e2dcb75e62ce6e87b1c6d74a5647fa334
Author: Joel Teichroeb (joel at teichroeb.net)
Date: 2026-11-03T04:56:57+01:00

Commit Message:
GRIM: Rework debug log system

The logging didn't work when we used multiple channels simultainiously.
Remove support for using multiple channels, allow everything to flow
through debug/warning/error calls to indicate the severity.

Rename Lua to LuaTrace to indicate it's for tracing lua, not debugging
scripts.

Changed paths:
    engines/grim/costume/anim_component.cpp
    engines/grim/costume/bitmap_component.cpp
    engines/grim/debug.cpp
    engines/grim/debug.h
    engines/grim/debugger.h
    engines/grim/detection.cpp
    engines/grim/emi/costume/emiluacode_component.cpp
    engines/grim/emi/costume/emiluavar_component.cpp
    engines/grim/emi/lua_v2_actor.cpp
    engines/grim/emi/lua_v2_sound.cpp
    engines/grim/lua/lstate.cpp
    engines/grim/lua_v1.cpp
    engines/grim/movie/codecs/smush_decoder.cpp
    engines/grim/set.cpp


diff --git a/engines/grim/costume/anim_component.cpp b/engines/grim/costume/anim_component.cpp
index f07f61aa649..fb9be685c9b 100644
--- a/engines/grim/costume/anim_component.cpp
+++ b/engines/grim/costume/anim_component.cpp
@@ -57,7 +57,7 @@ void AnimComponent::setKey(int val) {
 	// bitmaps were not loading with the scene. This was because they were requested
 	// as a different case then they were stored (tu_0_dorcu_door_open versus
 	// TU_0_DORCU_door_open), which was causing problems in the string comparison.
-	Debug::warning(Debug::Bitmaps | Debug::Costumes, "Missing scene bitmap: %s", _name.c_str());
+	Debug::warning(Debug::Costumes, "Missing scene bitmap: %s", _name.c_str());
 
 /* In case you feel like drawing the missing bitmap anyway...
 	// Assume that all objects the scene file forgot about are OBJSTATE_STATE class
diff --git a/engines/grim/costume/bitmap_component.cpp b/engines/grim/costume/bitmap_component.cpp
index a872a869c2d..4db8116a981 100644
--- a/engines/grim/costume/bitmap_component.cpp
+++ b/engines/grim/costume/bitmap_component.cpp
@@ -43,7 +43,7 @@ void BitmapComponent::setKey(int val) {
 	// bitmaps were not loading with the scene. This was because they were requested
 	// as a different case then they were stored (tu_0_dorcu_door_open versus
 	// TU_0_DORCU_door_open), which was causing problems in the string comparison.
-	Debug::warning(Debug::Bitmaps | Debug::Costumes, "Missing scene bitmap: %s", _name.c_str());
+	Debug::warning(Debug::Costumes, "Missing scene bitmap: %s", _name.c_str());
 
 /* In case you feel like drawing the missing bitmap anyway...
 	// Assume that all objects the scene file forgot about are OBJSTATE_STATE class
diff --git a/engines/grim/debug.cpp b/engines/grim/debug.cpp
index c86b5c35e74..1de42091610 100644
--- a/engines/grim/debug.cpp
+++ b/engines/grim/debug.cpp
@@ -20,20 +20,18 @@
  */
 
 #include "common/debug-channels.h"
+#include "common/debug.h"
 
 #include "engines/grim/debug.h"
 
 namespace Grim {
 
-void Debug::registerDebugChannels() {
-}
-
 bool Debug::isChannelEnabled(DebugChannel chan) {
 	return DebugMan.isDebugChannelEnabled(chan);
 }
 
 void Debug::debug(DebugChannel channel, const char *s, ...) {
-	if (isChannelEnabled(channel | Debug::Info)) {
+	if (isChannelEnabled(channel)) {
 		va_list args;
 		va_start(args, s);
 		Common::String buf = Common::String::vformat(s, args);
@@ -44,7 +42,7 @@ void Debug::debug(DebugChannel channel, const char *s, ...) {
 }
 
 void Debug::warning(DebugChannel channel, const char *s, ...) {
-	if (isChannelEnabled(channel | Debug::Warning)) {
+	if (isChannelEnabled(channel)) {
 		va_list args;
 		va_start(args, s);
 		Common::String buf = Common::String::vformat(s, args);
@@ -55,18 +53,7 @@ void Debug::warning(DebugChannel channel, const char *s, ...) {
 }
 
 void Debug::error(DebugChannel channel, const char *s, ...) {
-	if (isChannelEnabled(channel | Debug::Error)) {
-		va_list args;
-		va_start(args, s);
-		Common::String buf = Common::String::vformat(s, args);
-		va_end(args);
-
-		::error("%s", buf.c_str());
-	}
-}
-
-void Debug::error(const char *s, ...) {
-	if (isChannelEnabled(Debug::Error)) {
+	if (isChannelEnabled(channel)) {
 		va_list args;
 		va_start(args, s);
 		Common::String buf = Common::String::vformat(s, args);
diff --git a/engines/grim/debug.h b/engines/grim/debug.h
index 2ee87674f10..dacf1ebac0e 100644
--- a/engines/grim/debug.h
+++ b/engines/grim/debug.h
@@ -22,38 +22,31 @@
 #ifndef GRIM_DEBUG_H
 #define GRIM_DEBUG_H
 
-#include "common/debug.h"
-#include "common/streamdebug.h"
-
 namespace Grim {
 
 class Debug {
 public:
 	enum DebugChannel {
-		Info = 1,
-		Warning = 2 << 0,
-		Error = 2 << 1,
-		Engine = 2 << 2,
-		Lua = 2 << 3,
-		Bitmaps = 2 << 4,
-		Models = 2 << 5,
-		Actors = 2 << 6,
-		Costumes = 2 << 7,
-		Chores = 2 << 8,
-		Fonts = 2 << 9,
-		Keyframes = 2 << 10,
-		Materials = 2 << 11,
-		Movie = 2 << 12,
-		Sound = 2 << 13,
-		Scripts = 2 << 14,
-		Sets = 2 << 15,
-		TextObjects = 2 << 16,
-		Patchr = 2 << 17,
-		Lipsync = 2 << 18,
-		Sprites = 2 << 19
+		Actors = 1,
+		Bitmaps,
+		Chores,
+		Costumes,
+		Engine,
+		Fonts,
+		Keyframes,
+		Lipsync,
+		LuaTrace,
+		Materials,
+		Models,
+		Movie,
+		Patchr,
+		Scripts,
+		Sets,
+		Sound,
+		Sprites,
+		TextObjects
 	};
 
-	static void registerDebugChannels();
 	static bool isChannelEnabled(DebugChannel chan);
 
 	/**
@@ -77,19 +70,8 @@ public:
 	 * @param channel The debug channel to use.
 	 */
 	static void error(DebugChannel channel, const char *s, ...);
-	/**
-	 * Prints a message to the console (stderr) and exit the program immediately,
-	 * only if the debug channel Error is active.
-	 *
-	 * @param channel The debug channel to use.
-	 */
-	static void error(const char *s, ...);
 };
 
-inline Debug::DebugChannel operator|(Debug::DebugChannel a, Debug::DebugChannel b) {
-	return (Debug::DebugChannel)((int)a | (int) b);
-}
-
 }
 
 #endif
diff --git a/engines/grim/debugger.h b/engines/grim/debugger.h
index 103dfdfb40d..96117b202c9 100644
--- a/engines/grim/debugger.h
+++ b/engines/grim/debugger.h
@@ -22,8 +22,6 @@
 #ifndef GRIM_DEBUGGER_H
 #define GRIM_DEBUGGER_H
 
-#include "common/debug.h"
-
 #include "gui/debugger.h"
 
 namespace Grim {
diff --git a/engines/grim/detection.cpp b/engines/grim/detection.cpp
index 1afca9afb44..26cc1867fca 100644
--- a/engines/grim/detection.cpp
+++ b/engines/grim/detection.cpp
@@ -25,26 +25,23 @@
 #include "grim/detection_tables.h"
 
 static const DebugChannelDef debugFlagList[] = {
-	{Grim::Debug::Info, "info", ""},
-	{Grim::Debug::Warning, "warning", ""},
-	{Grim::Debug::Error, "error", ""},
-	{Grim::Debug::Engine, "engine", ""},
-	{Grim::Debug::Lua, "lua", ""},
-	{Grim::Debug::Bitmaps, "bitmaps", ""},
-	{Grim::Debug::Models, "models", ""},
-	{Grim::Debug::Actors, "actors", ""},
-	{Grim::Debug::Costumes, "costumes", ""},
-	{Grim::Debug::Chores, "chores", ""},
-	{Grim::Debug::Fonts, "fonts", ""},
-	{Grim::Debug::Keyframes, "keyframes", ""},
-	{Grim::Debug::Movie, "movie", ""},
-	{Grim::Debug::Sound, "sound", ""},
-	{Grim::Debug::Scripts, "scripts", ""},
-	{Grim::Debug::Sets, "sets", ""},
-	{Grim::Debug::TextObjects, "textobjects", ""},
-	{Grim::Debug::Patchr, "patchr", ""},
-	{Grim::Debug::Lipsync, "lipsync", ""},
-	{Grim::Debug::Sprites, "sprites", ""},
+	{Grim::Debug::Engine, "engine", "General engine messages"},
+	{Grim::Debug::LuaTrace, "luatrace", "Lua call and line trace"},
+	{Grim::Debug::Bitmaps, "bitmaps", "Bitmap loading"},
+	{Grim::Debug::Models, "models", "Model loading"},
+	{Grim::Debug::Actors, "actors", "Actor state and costumes"},
+	{Grim::Debug::Costumes, "costumes", "Costume components"},
+	{Grim::Debug::Chores, "chores", "Costume chores"},
+	{Grim::Debug::Fonts, "fonts", "Font loading"},
+	{Grim::Debug::Keyframes, "keyframes", "Keyframe animation"},
+	{Grim::Debug::Movie, "movie", "Video playback"},
+	{Grim::Debug::Sound, "sound", "Sound and music"},
+	{Grim::Debug::Scripts, "scripts", "Script debug output"},
+	{Grim::Debug::Sets, "sets", "Set and sector loading"},
+	{Grim::Debug::TextObjects, "textobjects", "On-screen text objects"},
+	{Grim::Debug::Patchr, "patchr", "Patch file loading"},
+	{Grim::Debug::Lipsync, "lipsync", "Lip sync data"},
+	{Grim::Debug::Sprites, "sprites", "Sprite loading"},
 	DEBUG_CHANNEL_END
 };
 
diff --git a/engines/grim/emi/costume/emiluacode_component.cpp b/engines/grim/emi/costume/emiluacode_component.cpp
index b35ae9b3581..bf7955c2767 100644
--- a/engines/grim/emi/costume/emiluacode_component.cpp
+++ b/engines/grim/emi/costume/emiluacode_component.cpp
@@ -40,7 +40,7 @@ int EMILuaCodeComponent::update(uint time) {
 }
 
 void EMILuaCodeComponent::setKey(int val) {
-	Debug::debug(Debug::Lua, "LuaC component: executing code [%s]", _name.c_str());
+	Debug::debug(Debug::Costumes, "LuaC component: executing code [%s]", _name.c_str());
 	lua_dostring(_name.c_str());
 }
 
diff --git a/engines/grim/emi/costume/emiluavar_component.cpp b/engines/grim/emi/costume/emiluavar_component.cpp
index 2769a191c8e..1116c8d3885 100644
--- a/engines/grim/emi/costume/emiluavar_component.cpp
+++ b/engines/grim/emi/costume/emiluavar_component.cpp
@@ -41,7 +41,7 @@ int EMILuaVarComponent::update(uint time) {
 }
 
 void EMILuaVarComponent::setKey(int val) {
-	Debug::debug(Debug::Lua, "LuaV component: setting %s to %d", _name.c_str(), val);
+	Debug::debug(Debug::Costumes, "LuaV component: setting %s to %d", _name.c_str(), val);
 	lua_pushnumber(val);
 	lua_setglobal(_name.c_str());
 }
diff --git a/engines/grim/emi/lua_v2_actor.cpp b/engines/grim/emi/lua_v2_actor.cpp
index 38a1082c78d..778b0e66d20 100644
--- a/engines/grim/emi/lua_v2_actor.cpp
+++ b/engines/grim/emi/lua_v2_actor.cpp
@@ -969,7 +969,7 @@ void Lua_V2::AttachActor() {
 	}
 
 	attached->attachToActor(actor, joint);
-	Debug::debug(Debug::Actors | Debug::Scripts, "Lua_V2::AttachActor: attaching %s to %s (on %s)", attached->getName().c_str(), actor->getName().c_str(), joint ? joint : "(none)");
+	Debug::debug(Debug::Scripts, "Lua_V2::AttachActor: attaching %s to %s (on %s)", attached->getName().c_str(), actor->getName().c_str(), joint ? joint : "(none)");
 
 	g_emi->invalidateSortOrder();
 }
@@ -985,7 +985,7 @@ void Lua_V2::DetachActor() {
 	if (!attached)
 		return;
 
-	Debug::debug(Debug::Actors | Debug::Scripts, "Lua_V2::DetachActor: detaching %s from parent actor", attached->getName().c_str());
+	Debug::debug(Debug::Scripts, "Lua_V2::DetachActor: detaching %s from parent actor", attached->getName().c_str());
 	attached->detach();
 
 	g_emi->invalidateSortOrder();
diff --git a/engines/grim/emi/lua_v2_sound.cpp b/engines/grim/emi/lua_v2_sound.cpp
index e1cf8afa628..377e6d100cd 100644
--- a/engines/grim/emi/lua_v2_sound.cpp
+++ b/engines/grim/emi/lua_v2_sound.cpp
@@ -63,7 +63,7 @@ void Lua_V2::ImGetMillisecondPosition() {
 		// Currently a bit of guesswork, and probably wrong, as the stateId
 		// is ignored by emisound (which only has one music-track now).
 		uint32 msPos = g_emiSound->getMsPos(sound);
-		Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImGetMillisecondPosition: sound: %d ms: %d", sound, msPos);
+		Debug::debug(Debug::Scripts, "Lua_V2::ImGetMillisecondPosition: sound: %d ms: %d", sound, msPos);
 		lua_pushnumber(msPos);
 	}
 }
@@ -105,7 +105,7 @@ void Lua_V2::SetReverb() {
 	if (lua_isnumber(dampingObj))
 		damping = lua_getnumber(dampingObj);
 
-	Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::SetReverb, eax: %d, decay: %f, mix: %f, predelay: %f, damping: %f", param, decay, mix, predelay, damping);
+	Debug::debug(Debug::Scripts, "Lua_V2::SetReverb, eax: %d, decay: %f, mix: %f, predelay: %f, damping: %f", param, decay, mix, predelay, damping);
 	// FIXME: func(param, decay, mix, predelay, damping);
 }
 
@@ -116,7 +116,7 @@ void Lua_V2::ImSetState() {
 
 	int state = (int)lua_getnumber(stateObj);
 	g_imuseState = state;
-	Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImSetState: stub, state: %d", state);
+	Debug::debug(Debug::Scripts, "Lua_V2::ImSetState: stub, state: %d", state);
 }
 
 void Lua_V2::ImStateHasEnded() {
@@ -128,7 +128,7 @@ void Lua_V2::ImStateHasEnded() {
 
 	pushbool(g_emiSound->stateHasEnded(state));
 
-	Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImStateHasEnded: state %d.", state);
+	Debug::debug(Debug::Scripts, "Lua_V2::ImStateHasEnded: state %d.", state);
 }
 
 // TODO: Implement this:
@@ -150,7 +150,7 @@ void Lua_V2::EnableVoiceFX() {
 		state = true;
 
 	// FIXME: func(state);
-	Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::EnableVoiceFX: implement opcode, state: %d", (int)state);
+	Debug::debug(Debug::Scripts, "Lua_V2::EnableVoiceFX: implement opcode, state: %d", (int)state);
 }
 
 void Lua_V2::SetGroupVolume() {
@@ -180,7 +180,7 @@ void Lua_V2::SetGroupVolume() {
 			error("Lua_V2::SetGroupVolume - unknown group %d", group);
 	}
 	// FIXME: func(group, volume);
-	Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::SetGroupVolume: group: %d, volume %d", group, volume);
+	Debug::debug(Debug::Scripts, "Lua_V2::SetGroupVolume: group: %d, volume %d", group, volume);
 }
 
 void Lua_V2::EnableAudioGroup() {
@@ -211,7 +211,7 @@ void Lua_V2::EnableAudioGroup() {
 			error("Lua_V2::EnableAudioGroup - unknown group %d", group);
 	}
 
-	Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::EnableAudioGroup: group: %d, state %d", group, (int)state);
+	Debug::debug(Debug::Scripts, "Lua_V2::EnableAudioGroup: group: %d, state %d", group, (int)state);
 }
 
 void Lua_V2::ImSelectSet() {
@@ -221,13 +221,13 @@ void Lua_V2::ImSelectSet() {
 		int quality = (int)lua_getnumber(qualityObj);
 		// FIXME: func(quality);
 		g_emiSound->selectMusicSet(quality);
-		Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImSelectSet: quality mode: %d", quality);
+		Debug::debug(Debug::Scripts, "Lua_V2::ImSelectSet: quality mode: %d", quality);
 	}
 }
 
 void Lua_V2::ImFlushStack() {
 	// FIXME
-	Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImFlushStack: currently guesswork");
+	Debug::debug(Debug::Scripts, "Lua_V2::ImFlushStack: currently guesswork");
 	g_emiSound->flushStack();
 }
 
@@ -409,7 +409,7 @@ void Lua_V2::PlaySound() {
 	Common::String filename = addSoundSuffix(str);
 
 	if (!g_emiSound->startSfx(filename, convertEmiVolumeToMixer(volume))) {
-		Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::PlaySound: Could not open sound '%s'", filename.c_str());
+		Debug::debug(Debug::Scripts, "Lua_V2::PlaySound: Could not open sound '%s'", filename.c_str());
 	}
 }
 
@@ -453,7 +453,7 @@ void Lua_V2::PlaySoundFrom() {
 	Math::Vector3d pos(x, y, z);
 
 	if (!g_emiSound->startSfxFrom(filename.c_str(), pos, convertEmiVolumeToMixer(volume))) {
-		Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::PlaySoundFrom: Could not open sound '%s'", filename.c_str());
+		Debug::debug(Debug::Scripts, "Lua_V2::PlaySoundFrom: Could not open sound '%s'", filename.c_str());
 	}
 }
 
@@ -523,7 +523,7 @@ void Lua_V2::ImSetMusicVol() {
 	if (!lua_isnumber(volumeObj))
 		return;
 	int volume = (int)lua_getnumber(volumeObj);
-	Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImSetMusicVol: implement opcode, wants volume %d", convertEmiVolumeToMixer(volume));
+	Debug::debug(Debug::Scripts, "Lua_V2::ImSetMusicVol: implement opcode, wants volume %d", convertEmiVolumeToMixer(volume));
 }
 
 void Lua_V2::ImSetSfxVol() {
@@ -533,7 +533,7 @@ void Lua_V2::ImSetSfxVol() {
 	if (!lua_isnumber(volumeObj))
 		return;
 	int volume = (int)lua_getnumber(volumeObj);
-	Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImSetSfxVol: implement opcode, wants volume %d", convertEmiVolumeToMixer(volume));
+	Debug::debug(Debug::Scripts, "Lua_V2::ImSetSfxVol: implement opcode, wants volume %d", convertEmiVolumeToMixer(volume));
 }
 
 void Lua_V2::ImSetVoiceVol() {
@@ -543,7 +543,7 @@ void Lua_V2::ImSetVoiceVol() {
 	if (!lua_isnumber(volumeObj))
 		return;
 	int volume = (int)lua_getnumber(volumeObj);
-	Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImSetVoiceVol: implement opcode, wants volume %d", convertEmiVolumeToMixer(volume));
+	Debug::debug(Debug::Scripts, "Lua_V2::ImSetVoiceVol: implement opcode, wants volume %d", convertEmiVolumeToMixer(volume));
 }
 
 void Lua_V2::ImSetVoiceEffect() {
@@ -554,11 +554,11 @@ void Lua_V2::ImSetVoiceEffect() {
 		return;
 
 	const char *str = lua_getstring(strObj);
-	Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImSetVoiceEffect: implement opcode, wants effect %s", str);
+	Debug::debug(Debug::Scripts, "Lua_V2::ImSetVoiceEffect: implement opcode, wants effect %s", str);
 }
 
 void Lua_V2::StopAllSounds() {
-	Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::StopAllSounds: implement opcode");
+	Debug::debug(Debug::Scripts, "Lua_V2::StopAllSounds: implement opcode");
 }
 
 void Lua_V2::ImPushState() {
@@ -572,11 +572,11 @@ void Lua_V2::ImPushState() {
 		g_imuseState = state;
 	}
 
-	Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImPushState: currently guesswork");
+	Debug::debug(Debug::Scripts, "Lua_V2::ImPushState: currently guesswork");
 }
 void Lua_V2::ImPopState() {
 	g_emiSound->popStateFromStack();
-	Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImPopState: currently guesswork");
+	Debug::debug(Debug::Scripts, "Lua_V2::ImPopState: currently guesswork");
 }
 
 // Used in the demo only.
diff --git a/engines/grim/lua/lstate.cpp b/engines/grim/lua/lstate.cpp
index cfe6bedcfa2..8a801725d4d 100644
--- a/engines/grim/lua/lstate.cpp
+++ b/engines/grim/lua/lstate.cpp
@@ -213,7 +213,7 @@ void lua_open() {
 	luaT_init();
 	luaB_predefine();
 	luaL_addlibtolist(stdErrorRimFunc, ARRAYSIZE(stdErrorRimFunc));
-	if (Debug::isChannelEnabled(Debug::Lua))
+	if (Debug::isChannelEnabled(Debug::LuaTrace))
 		lua_callhook = callHook;
 }
 
diff --git a/engines/grim/lua_v1.cpp b/engines/grim/lua_v1.cpp
index 8b80aa1f47e..c577f59f1a8 100644
--- a/engines/grim/lua_v1.cpp
+++ b/engines/grim/lua_v1.cpp
@@ -53,6 +53,19 @@ byte clamp_color(int c) {
 		return c;
 }
 
+Common::String getLuaMessage() {
+	lua_Object strObj = lua_getparam(1);
+	if (lua_isnil(strObj))
+		return "(nil)";
+	if (!lua_isstring(strObj))
+		return {};
+	Common::String msg(lua_getstring(strObj));
+	// Our print functions will handle the newline
+	if (msg[msg.size() - 1] == '\n')
+		msg.deleteLastChar();
+	return msg;
+}
+
 int32 luaA_passresults();
 
 void Lua_V1::new_dofile() {
@@ -65,42 +78,27 @@ void Lua_V1::new_dofile() {
 // Debugging message functions
 
 void Lua_V1::PrintDebug() {
-	if (Debug::isChannelEnabled(Debug::Scripts | Debug::Info)) {
-		Common::String msg("Debug: ");
-		lua_Object strObj = lua_getparam(1);
-		if (lua_isnil(strObj))
-			msg += "(nil)";
-		if (!lua_isstring(strObj))
-			return;
-		msg += Common::String(lua_getstring(strObj));
-		debugN("%s\n", msg.c_str());
-	}
+	if (!Debug::isChannelEnabled(Debug::Scripts))
+		return;
+	Common::String msg("Debug: ");
+	msg += getLuaMessage();
+	debug("%s", msg.c_str());
 }
 
 void Lua_V1::PrintError() {
-	if (Debug::isChannelEnabled(Debug::Scripts | Debug::Error)) {
-		Common::String msg("Error: ");
-		lua_Object strObj = lua_getparam(1);
-		if (lua_isnil(strObj))
-			msg += "(nil)";
-		if (!lua_isstring(strObj))
-			return;
-		msg += Common::String(lua_getstring(strObj));
-		debugN("%s\n", msg.c_str());
-	}
+	if (!Debug::isChannelEnabled(Debug::Scripts))
+		return;
+	Common::String msg("Error: ");
+	msg += getLuaMessage();
+	warning("%s", msg.c_str());
 }
 
 void Lua_V1::PrintWarning() {
-	if (Debug::isChannelEnabled(Debug::Scripts | Debug::Warning)) {
-		Common::String msg("Warning: ");
-		lua_Object strObj = lua_getparam(1);
-		if (lua_isnil(strObj))
-			msg += "(nil)";
-		if (!lua_isstring(strObj))
-			return;
-		msg += Common::String(lua_getstring(strObj));
-		debugN("%s\n", msg.c_str());
-	}
+	if (!Debug::isChannelEnabled(Debug::Scripts))
+		return;
+	Common::String msg("Warning: ");
+	msg += getLuaMessage();
+	warning( "%s", msg.c_str());
 }
 
 void Lua_V1::FunctionName() {
diff --git a/engines/grim/movie/codecs/smush_decoder.cpp b/engines/grim/movie/codecs/smush_decoder.cpp
index 39bcd291ee8..8cc55f47b91 100644
--- a/engines/grim/movie/codecs/smush_decoder.cpp
+++ b/engines/grim/movie/codecs/smush_decoder.cpp
@@ -87,7 +87,7 @@ bool SmushDecoder::readHeader() {
 
 	int16 flags = _file->readUint16LE();
 	// Output information for checking out the flags
-	if (Debug::isChannelEnabled(Debug::Movie | Debug::Info)) {
+	if (Debug::isChannelEnabled(Debug::Movie)) {
 		warning("SMUSH Flags:");
 		for (int i = 0; i < 16; i++) {
 			warning(" %d", (flags & (1 << i)) != 0);
diff --git a/engines/grim/set.cpp b/engines/grim/set.cpp
index a624dfa92bf..47164c02c68 100644
--- a/engines/grim/set.cpp
+++ b/engines/grim/set.cpp
@@ -398,7 +398,7 @@ void Set::Setup::load(Set *set, int id, TextSplitter &ts) {
 		// Don't even try to load if it's the "none" bitmap
 		if (strcmp(buf, "<none>.lbm") != 0) {
 			_bkgndZBm = Bitmap::create(buf);
-			Debug::debug(Debug::Bitmaps | Debug::Sets,
+			Debug::debug(Debug::Sets,
 						 "Loading scene z-buffer bitmap: %s\n", buf);
 		}
 	}
@@ -895,7 +895,7 @@ void Set::setSetup(int num) {
 Bitmap::Ptr Set::loadBackground(const char *fileName) {
 	Bitmap::Ptr bg = Bitmap::create(fileName);
 	if (!bg) {
-		Debug::warning(Debug::Bitmaps | Debug::Sets,
+		Debug::warning(Debug::Sets,
 					   "Unable to load scene bitmap: %s, loading dfltroom instead", fileName);
 		if (g_grim->getGameType() == GType_MONKEY4) {
 			bg = Bitmap::create("dfltroom.til");
@@ -903,10 +903,10 @@ Bitmap::Ptr Set::loadBackground(const char *fileName) {
 			bg = Bitmap::create("dfltroom.bm");
 		}
 		if (!bg) {
-			Debug::error(Debug::Bitmaps | Debug::Sets, "Unable to load dfltroom");
+			Debug::error(Debug::Sets, "Unable to load dfltroom");
 		}
 	} else {
-		Debug::debug(Debug::Bitmaps | Debug::Sets,
+		Debug::debug(Debug::Sets,
 					 "Loaded scene bitmap: %s", fileName);
 	}
 	return bg;




More information about the Scummvm-git-logs mailing list