MACVENTURE: Fix debug messages

This commit is contained in:
Borja Lorente 2016-08-16 12:14:20 +02:00
parent f928deebaf
commit 34fdec37b2
9 changed files with 23 additions and 25 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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);

View File

@ -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) {

View File

@ -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

View File

@ -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) {

View File

@ -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;
}

View File

@ -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;

View File

@ -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);