From 34fdec37b26c7328f07f6251263f1c1afc7d1629 Mon Sep 17 00:00:00 2001 From: Borja Lorente Date: Tue, 16 Aug 2016 12:14:20 +0200 Subject: MACVENTURE: Fix debug messages --- engines/macventure/container.cpp | 4 ++-- engines/macventure/dialog.cpp | 2 +- engines/macventure/gui.cpp | 2 +- engines/macventure/macventure.cpp | 13 ++++++------- engines/macventure/script.cpp | 14 +++++++------- engines/macventure/sound.cpp | 5 ++--- engines/macventure/stringtable.h | 2 +- engines/macventure/text.cpp | 4 ++-- engines/macventure/world.cpp | 2 +- 9 files changed, 23 insertions(+), 25 deletions(-) diff --git a/engines/macventure/container.cpp b/engines/macventure/container.cpp index 73f706a0c5..1781f96a07 100644 --- a/engines/macventure/container.cpp +++ b/engines/macventure/container.cpp @@ -89,7 +89,7 @@ Container::Container(Common::String filename) { mask = _res->readUint32BE(); mask >>= (16 - bits); mask &= 0xFFFF; - debugC(11, kMVDebugContainer, "Load mask of object &%d:%d is %x", i, j, mask); + debugC(4, kMVDebugContainer, "Load mask of object &%d:%d is %x", i, j, mask); _res->seek(-4, SEEK_CUR); // Look in the Huffman table int x = 0; @@ -128,7 +128,7 @@ Container::Container(Common::String filename) { } group.lengths[j] = length; - debugC(11, kMVDebugContainer, "Load legth of object %d:%d is %d", i, j, length); + debugC(4, kMVDebugContainer, "Load legth of object %d:%d is %d", i, j, length); } _groups.push_back(group); diff --git a/engines/macventure/dialog.cpp b/engines/macventure/dialog.cpp index 043cd38a92..27ef224712 100644 --- a/engines/macventure/dialog.cpp +++ b/engines/macventure/dialog.cpp @@ -176,7 +176,7 @@ bool DialogButton::doProcessEvent(MacVenture::Dialog *dialog, Common::Event even if (event.type == Common::EVENT_LBUTTONDOWN) { dialog->localize(mouse); if (_bounds.contains(mouse)) { - debugC(1, kMVDebugGUI, "Click! Button: %s", _text.c_str()); + debugC(2, kMVDebugGUI, "Click! Button: %s", _text.c_str()); dialog->handleDialogAction(this, _action); return true; } diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp index 9346a1bd5c..ac429d03d9 100644 --- a/engines/macventure/gui.cpp +++ b/engines/macventure/gui.cpp @@ -472,7 +472,7 @@ bool Gui::loadWindows() { } data.scrollPos = Common::Point(0, 0); - debugC(4, kMVDebugGUI, "Window loaded: %s", data.title.c_str()); + debugC(1, kMVDebugGUI, "Window loaded: %s", data.title.c_str()); _windowData->push_back(data); diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp index ef2b7fadb0..2c91680926 100644 --- a/engines/macventure/macventure.cpp +++ b/engines/macventure/macventure.cpp @@ -36,7 +36,7 @@ namespace MacVenture { // HACK, see below void toASCII(Common::String &str) { - debugC(1, kMVDebugMain, "toASCII: %s", str.c_str()); + debugC(3, kMVDebugMain, "toASCII: %s", str.c_str()); Common::String::iterator it = str.begin(); for (; it != str.end(); it++) { if (*it == '\216') { str.replace(it, it + 1, "e"); } @@ -506,7 +506,7 @@ void MacVentureEngine::processEvents() { } bool MacVenture::MacVentureEngine::runScriptEngine() { - debugC(4, kMVDebugMain, "MAIN: Running script engine"); + debugC(3, kMVDebugMain, "Running script engine"); if (_haltedAtEnd) { _haltedAtEnd = false; if (_scriptEngine->resume(false)) { @@ -754,7 +754,7 @@ void MacVentureEngine::highlightExit(ObjID objID) { void MacVentureEngine::selectPrimaryObject(ObjID objID) { if (objID == _destObject) return; int idx; - debugC(5, kMVDebugMain, "Select primary object (%d)", objID); + debugC(4, kMVDebugMain, "Select primary object (%d)", objID); if (_destObject > 0 && (idx = findObjectInArray(_destObject, _currentSelection)) != -1) { unselectAll(); @@ -776,8 +776,7 @@ void MacVentureEngine::focusObjectWindow(ObjID objID) { } void MacVentureEngine::openObject(ObjID objID) { - - debugC(1, kMVDebugMain, "Open Object[%d] parent[%d] x[%d] y[%d]", + debugC(3, kMVDebugMain, "Open Object[%d] parent[%d] x[%d] y[%d]", objID, _world->getObjAttr(objID, kAttrParentObject), _world->getObjAttr(objID, kAttrPosX), @@ -807,7 +806,7 @@ void MacVentureEngine::closeObject(ObjID objID) { void MacVentureEngine::checkObject(QueuedObject old) { //warning("checkObject: unimplemented"); bool hasChanged = false; - debugC(1, kMVDebugMain, "Check Object[%d] parent[%d] x[%d] y[%d]", + debugC(3, kMVDebugMain, "Check Object[%d] parent[%d] x[%d] y[%d]", old.object, old.parent, old.x, @@ -874,7 +873,7 @@ void MacVentureEngine::reflectSwap(ObjID fromID, ObjID toID) { WindowReference from = getObjWindow(fromID); WindowReference to = getObjWindow(toID); WindowReference tmp = to; - debugC(1, kMVDebugMain, "Swap Object[%d] to Object[%d], from win[%d] to win[%d] ", + debugC(3, kMVDebugMain, "Swap Object[%d] to Object[%d], from win[%d] to win[%d] ", fromID, toID, from, to); if (!to) { diff --git a/engines/macventure/script.cpp b/engines/macventure/script.cpp index c743e49a55..c88ac0bf3e 100644 --- a/engines/macventure/script.cpp +++ b/engines/macventure/script.cpp @@ -51,14 +51,14 @@ bool ScriptEngine::runControl(ControlAction action, ObjID source, ObjID destinat frame.haltedInFirst = false; frame.haltedInFamily = false; _frames.push_back(frame); - debugC(3, kMVDebugScript, "SCRIPT: Stored frame %d, action: %d src: %d dest: %d point: (%d, %d)", + debugC(3, kMVDebugScript, "Stored frame %d, action: %d src: %d dest: %d point: (%d, %d)", _frames.size() - 1, frame.action, frame.src, frame.dest, frame.x, frame.y); return resume(true); } bool ScriptEngine::resume(bool execAll) { - debugC(3, kMVDebugScript, "SCRIPT: Resume"); + debugC(3, kMVDebugScript, "Resume Script"); while (_frames.size()) { bool fail = execFrame(execAll); if (fail) return true; @@ -146,7 +146,7 @@ bool ScriptEngine::execFrame(bool execAll) { bool ScriptEngine::loadScript(EngineFrame * frame, uint32 scriptID) { if (_scripts->getItemByteSize(scriptID) > 0) { - debugC(2, kMVDebugScript, "SCRIPT: Loading function %d", scriptID); + debugC(2, kMVDebugScript, "Loading function %d", scriptID); // Insert the new script at the front frame->scripts.push_front(ScriptAsset(scriptID, _scripts)); return runFunc(frame); @@ -169,7 +169,7 @@ bool ScriptEngine::runFunc(EngineFrame *frame) { byte op; while (script.hasNext()) { op = script.fetch(); - debugC(3, kMVDebugScript, "SCRIPT: I'm running operation %d", op); + debugC(4, kMVDebugScript, "Running operation %d", op); if (!(op & 0x80)) { state->push(op); } else { @@ -921,12 +921,12 @@ bool ScriptEngine::opbcCALL(EngineState * state, EngineFrame * frame, ScriptAsse word id = state->pop(); ScriptAsset newfun = ScriptAsset(id, _scripts); ScriptAsset current = script; - debugC(2, kMVDebugScript, "SCRIPT: Call function: %d", id); + debugC(2, kMVDebugScript, "Call function: %d", id); if (loadScript(frame, id)) return true; frame->scripts.pop_front(); script = frame->scripts.front(); - debugC(2, kMVDebugScript, "SCRIPT: Return from fuction %d", id); + debugC(2, kMVDebugScript, "Return from fuction %d", id); return false; } @@ -1207,7 +1207,7 @@ void ScriptAsset::loadInstructions() { _instructions.push_back(res->readByte()); } delete res; - debugC(2, kMVDebugScript, "SCRIPT: Load %d instructions for script %d", amount, _id); + debugC(2, kMVDebugScript, "Load %d instructions for script %d", amount, _id); } } // End of namespace MacVenture diff --git a/engines/macventure/sound.cpp b/engines/macventure/sound.cpp index eb0941607c..590da2eef3 100644 --- a/engines/macventure/sound.cpp +++ b/engines/macventure/sound.cpp @@ -61,9 +61,8 @@ void SoundManager::ensureLoaded(ObjID sound) { SoundAsset::SoundAsset(Container *container, ObjID id) : _container(container), _id(id), _length(0), _frequency(1) { - debug("SoundAsset::SoundAsset(%d)", _id); if (_container->getItemByteSize(_id) == 0) - warning("Trying to load an empty sound asset."); + warning("Trying to load an empty sound asset (%d).", _id); Common::SeekableReadStream *stream = _container->getItem(_id); @@ -101,7 +100,7 @@ SoundAsset::SoundAsset(Container *container, ObjID id) : } SoundAsset::~SoundAsset() { - debug("SoundAsset::~SoundAsset(%d)", _id); + debugC(3, kMVDebugSound, "~SoundAsset(%d)", _id); } void SoundAsset::play(Audio::Mixer *mixer, Audio::SoundHandle *soundHandle) { diff --git a/engines/macventure/stringtable.h b/engines/macventure/stringtable.h index a03fb28a0d..54aba03337 100644 --- a/engines/macventure/stringtable.h +++ b/engines/macventure/stringtable.h @@ -85,7 +85,7 @@ private: // HACK until a proper special char implementation is found, this will have to do. Common::String result = Common::String(str); toASCII(result); - debugC(5, kMVDebugText, "Loaded string %s", str); + debugC(4, kMVDebugText, "Loaded string %s", str); _strings.push_back(Common::String(result)); delete[] str; } diff --git a/engines/macventure/text.cpp b/engines/macventure/text.cpp index 095b0f3332..5a2d029714 100644 --- a/engines/macventure/text.cpp +++ b/engines/macventure/text.cpp @@ -99,7 +99,7 @@ void TextAsset::decodeOld() { } str[strLen] = '\0'; - debugC(3, kMVDebugText, "Decoded %d string (old): %s", _id, str); + debugC(3, kMVDebugText, "Decoded string [%d] (old encoding): %s", _id, str); _decoded = Common::String(str); } @@ -162,7 +162,7 @@ void TextAsset::decodeHuffman() { } } _decoded += '\0'; - debugC(4, kMVDebugText, "Decoded %d'th string (new): %s", _id, _decoded.c_str()); + debugC(3, kMVDebugText, "Decoded string [%d] (new encoding): %s", _id, _decoded.c_str()); } Common::String TextAsset::getNoun(ObjID subval) { ObjID obj; diff --git a/engines/macventure/world.cpp b/engines/macventure/world.cpp index 4ef55094bb..c514ebd535 100644 --- a/engines/macventure/world.cpp +++ b/engines/macventure/world.cpp @@ -43,7 +43,7 @@ void World::startNewGame() { if (!saveGameFile.open(_startGameFileName)) error("WORLD: Could not load initial game configuration"); - debug("Loading save game state from %s", _startGameFileName.c_str()); + debugC(2, kMVDebugMain, "Loading save game state from %s", _startGameFileName.c_str()); Common::SeekableReadStream *saveGameRes = saveGameFile.readStream(saveGameFile.size()); _saveGame = new SaveGame(_engine, saveGameRes); -- cgit v1.2.3