aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/m4/assets.cpp2
-rw-r--r--engines/m4/converse.cpp300
-rw-r--r--engines/m4/events.cpp2
-rw-r--r--engines/m4/font.cpp10
-rw-r--r--engines/m4/globals.cpp32
-rw-r--r--engines/m4/graphics.cpp10
-rw-r--r--engines/m4/hotspot.cpp2
-rw-r--r--engines/m4/m4.cpp7
-rw-r--r--engines/m4/m4_scene.cpp8
-rw-r--r--engines/m4/mads_menus.cpp2
-rw-r--r--engines/m4/rails.cpp4
-rw-r--r--engines/m4/resource.cpp26
-rw-r--r--engines/m4/script.cpp190
-rw-r--r--engines/m4/script.h2
-rw-r--r--engines/m4/woodscript.cpp10
-rw-r--r--engines/m4/ws_machine.cpp54
-rw-r--r--engines/m4/ws_sequence.cpp96
17 files changed, 379 insertions, 378 deletions
diff --git a/engines/m4/assets.cpp b/engines/m4/assets.cpp
index 091187d844..07cbff5bf1 100644
--- a/engines/m4/assets.cpp
+++ b/engines/m4/assets.cpp
@@ -527,7 +527,7 @@ bool AssetManager::loadAsset(const char *assetName, RGB8 *palette) {
_CELS[chunkHash] = new SpriteAsset(_vm, assetS, chunkSize, assetName);
break;
default:
- debug(kDebugGraphics, "AssetManager::loadAsset() Unknown chunk type %08X\n", chunkType);
+ debugC(kDebugGraphics, "AssetManager::loadAsset() Unknown chunk type %08X\n", chunkType);
}
// Until loading code is complete (see above)
diff --git a/engines/m4/converse.cpp b/engines/m4/converse.cpp
index 3baa6d5eb3..0e10e5e89d 100644
--- a/engines/m4/converse.cpp
+++ b/engines/m4/converse.cpp
@@ -227,10 +227,10 @@ void ConversationView::selectEntry(int entryIndex) {
// Hide selected entry, unless it has a persistent flag set
if (!(_activeItems[entryIndex]->flags & kEntryPersists)) {
- //debug(kDebugConversations, "Hiding selected entry\n");
+ //debugCN(kDebugConversations, "Hiding selected entry\n");
_m4Vm->_converse->getNode(_currentNodeIndex)->entries[entryIndex]->visible = false;
} else {
- //debug(kDebugConversations, "Selected entry is persistent, not hiding it\n");
+ //debugCN(kDebugConversations, "Selected entry is persistent, not hiding it\n");
}
}
@@ -286,7 +286,7 @@ void ConversationView::playNextReply() {
}
} else {
int selectedWeight = _vm->_random->getRandomNumber(currentEntry->totalWeight - 1) + 1;
- //debug(kDebugConversations, "Selected weight: %i\n", selectedWeight);
+ //debugCN(kDebugConversations, "Selected weight: %i\n", selectedWeight);
int previousWeight = 1;
int currentWeight = 0;
@@ -313,7 +313,7 @@ void ConversationView::playNextReply() {
// If we reached here, there are no more replies, so perform the active entry's actions
- //debug(kDebugConversations, "Current selection does %i actions\n", _activeItems[entryIndex]->actions.size());
+ //debugCN(kDebugConversations, "Current selection does %i actions\n", _activeItems[entryIndex]->actions.size());
for (uint32 i = 0; i < _activeItems[_highlightedIndex]->actions.size(); i++) {
if (!_m4Vm->_converse->performAction(_activeItems[_highlightedIndex]->actions[i]))
break;
@@ -399,30 +399,30 @@ void Converse::loadConversation(const char *convName) {
return;
}
size = convS->readUint32LE(); // is this used at all?
- if (debugFlag) debug(kDebugConversations, "Conv chunk size (external header): %i\n", size);
+ if (debugFlag) debugCN(kDebugConversations, "Conv chunk size (external header): %i\n", size);
// Conversation name, which is the conversation file's name
// without the extension
convS->read(buffer, 8);
- if (debugFlag) debug(kDebugConversations, "Conversation name: %s\n", buffer);
+ if (debugFlag) debugCN(kDebugConversations, "Conversation name: %s\n", buffer);
while (true) {
chunkPos = convS->pos();
chunk = convS->readUint32LE(); // read chunk
if (convS->eos()) break;
- if (debugFlag) debug(kDebugConversations, "***** Pos: %i -> ", chunkPos);
+ if (debugFlag) debugC(kDebugConversations, "***** Pos: %i -> ", chunkPos);
switch (chunk) {
case CHUNK_DECL: // Declare
- if (debugFlag) debug(kDebugConversations, "DECL chunk\n");
+ if (debugFlag) debugCN(kDebugConversations, "DECL chunk\n");
data = convS->readUint32LE();
- if (debugFlag) debug(kDebugConversations, "Tag: %i\n", data);
+ if (debugFlag) debugCN(kDebugConversations, "Tag: %i\n", data);
if (data > 0)
warning("Tag > 0 in DECL chunk, value is: %i", data); // TODO
val = convS->readUint32LE();
- if (debugFlag) debug(kDebugConversations, "Value: %i\n", val);
+ if (debugFlag) debugCN(kDebugConversations, "Value: %i\n", val);
data = convS->readUint32LE();
- if (debugFlag) debug(kDebugConversations, "Flags: %i\n", data);
+ if (debugFlag) debugCN(kDebugConversations, "Flags: %i\n", data);
if (data > 0)
warning("Flags != 0 in DECL chunk, value is %i", data); // TODO
setValue(chunkPos, val);
@@ -437,23 +437,23 @@ void Converse::loadConversation(const char *convName) {
curEntry->fallthroughMinEntries = -1;
curEntry->fallthroughOffset = -1;
if (chunk == CHUNK_NODE) {
- if (debugFlag) debug(kDebugConversations, "NODE chunk\n");
+ if (debugFlag) debugCN(kDebugConversations, "NODE chunk\n");
} else {
- if (debugFlag) debug(kDebugConversations, "LNOD chunk\n");
+ if (debugFlag) debugCN(kDebugConversations, "LNOD chunk\n");
}
curNode = convS->readUint32LE();
- if (debugFlag) debug(kDebugConversations, "Node number: %i\n", curNode);
+ if (debugFlag) debugCN(kDebugConversations, "Node number: %i\n", curNode);
data = convS->readUint32LE();
- if (debugFlag) debug(kDebugConversations, "Tag: %i\n", data);
+ if (debugFlag) debugCN(kDebugConversations, "Tag: %i\n", data);
if (chunk == CHUNK_LNOD) {
autoSelectIndex = convS->readUint32LE();
- if (debugFlag) debug(kDebugConversations, "Autoselect entry number: %i\n", autoSelectIndex);
+ if (debugFlag) debugCN(kDebugConversations, "Autoselect entry number: %i\n", autoSelectIndex);
}
size = convS->readUint32LE();
- if (debugFlag) debug(kDebugConversations, "Number of entries: %i\n", size);
+ if (debugFlag) debugCN(kDebugConversations, "Number of entries: %i\n", size);
for (i = 0; i < size; i++) {
data = convS->readUint32LE();
- if (debugFlag) debug(kDebugConversations, "Entry %i: %i\n", i + 1, data);
+ if (debugFlag) debugCN(kDebugConversations, "Entry %i: %i\n", i + 1, data);
}
_convNodes.push_back(curEntry);
setEntryInfo(curEntry->offset, curEntry->entryType, curNode, -1);
@@ -465,14 +465,14 @@ void Converse::loadConversation(const char *convName) {
curEntry->entryType = kEntry;
strcpy(curEntry->voiceFile, "");
strcpy(curEntry->text, "");
- if (debugFlag) debug(kDebugConversations, "ETRY chunk\n");
+ if (debugFlag) debugCN(kDebugConversations, "ETRY chunk\n");
data = convS->readUint32LE();
- if (debugFlag) debug(kDebugConversations, "Unknown (attributes perhaps?): %i\n", data);
+ if (debugFlag) debugCN(kDebugConversations, "Unknown (attributes perhaps?): %i\n", data);
data = convS->readUint32LE();
- if (debugFlag) debug(kDebugConversations, "Entry flags: ");
- if (debugFlag) if (data & kEntryInitial) debug(kDebugConversations, "Initial ");
- if (debugFlag) if (data & kEntryPersists) debug(kDebugConversations, "Persists ");
- if (debugFlag) debug(kDebugConversations, "\n");
+ if (debugFlag) debugCN(kDebugConversations, "Entry flags: ");
+ if (debugFlag) if (data & kEntryInitial) debugCN(kDebugConversations, "Initial ");
+ if (debugFlag) if (data & kEntryPersists) debugCN(kDebugConversations, "Persists ");
+ if (debugFlag) debugCN(kDebugConversations, "\n");
curEntry->flags = data;
curEntry->visible = (curEntry->flags & kEntryInitial) ? true : false;
if (autoSelectIndex >= 0) {
@@ -517,28 +517,28 @@ void Converse::loadConversation(const char *convName) {
if (chunk == CHUNK_WPRL || chunk == CHUNK_WRPL) {
replyEntry->entryType = kWeightedReply;
replyEntry->totalWeight = 0;
- if (debugFlag) debug(kDebugConversations, "WRPL chunk\n");
+ if (debugFlag) debugCN(kDebugConversations, "WRPL chunk\n");
size = convS->readUint32LE();
- if (debugFlag) debug(kDebugConversations, "Weighted reply %i - %i entries:\n", i, size);
+ if (debugFlag) debugCN(kDebugConversations, "Weighted reply %i - %i entries:\n", i, size);
for (i = 0; i < size; i++) {
weightedEntry = new ConvEntry();
weightedEntry->offset = chunkPos;
strcpy(weightedEntry->voiceFile, "");
weightedEntry->entryType = kWeightedReply;
data = convS->readUint32LE();
- if (debugFlag) debug(kDebugConversations, "- Weight: %i ", data);
+ if (debugFlag) debugCN(kDebugConversations, "- Weight: %i ", data);
weightedEntry->weight = data;
replyEntry->totalWeight += weightedEntry->weight;
data = convS->readUint32LE();
- if (debugFlag) debug(kDebugConversations, "offset: %i\n", data);
+ if (debugFlag) debugCN(kDebugConversations, "offset: %i\n", data);
replyEntry->entries.push_back(weightedEntry);
}
currentWeightedEntry = 0;
} else {
replyEntry->entryType = kReply;
- if (debugFlag) debug(kDebugConversations, "RPLY chunk\n");
+ if (debugFlag) debugCN(kDebugConversations, "RPLY chunk\n");
data = convS->readUint32LE();
- if (debugFlag) debug(kDebugConversations, "Reply data offset: %i\n", data);
+ if (debugFlag) debugCN(kDebugConversations, "Reply data offset: %i\n", data);
}
if (!curEntry)
@@ -563,9 +563,9 @@ void Converse::loadConversation(const char *convName) {
{
ConvEntry* parentEntry = NULL;
if (chunk == CHUNK_TEXT) {
- if (debugFlag) debug(kDebugConversations, "TEXT chunk\n");
+ if (debugFlag) debugCN(kDebugConversations, "TEXT chunk\n");
} else {
- if (debugFlag) debug(kDebugConversations, "MESG chunk\n");
+ if (debugFlag) debugCN(kDebugConversations, "MESG chunk\n");
}
if (replyEntry == NULL) {
@@ -580,22 +580,22 @@ void Converse::loadConversation(const char *convName) {
}
size = convS->readUint32LE();
- if (debugFlag) debug(kDebugConversations, "Entry data size: %i\n", size);
+ if (debugFlag) debugCN(kDebugConversations, "Entry data size: %i\n", size);
convS->read(buffer, 8);
size -= 8; // subtract maximum length of voice file name
// If the file name is 8 characters, it will not be 0-terminated, so use strncpy
strncpy(parentEntry->voiceFile, buffer, 8);
parentEntry->voiceFile[8] = '\0';
- if (debugFlag) debug(kDebugConversations, "Voice file: %s\n", parentEntry->voiceFile);
+ if (debugFlag) debugCN(kDebugConversations, "Voice file: %s\n", parentEntry->voiceFile);
if (chunk == CHUNK_TEXT) {
convS->read(buffer, size);
- if (debugFlag) debug(kDebugConversations, "Text: %s\n", buffer);
+ if (debugFlag) debugCN(kDebugConversations, "Text: %s\n", buffer);
sprintf(parentEntry->text, "%s", buffer);
} else {
while (size > 0) {
data = convS->readUint32LE();
- if (debugFlag) debug(kDebugConversations, "Unknown: %i\n", data); // TODO
+ if (debugFlag) debugCN(kDebugConversations, "Unknown: %i\n", data); // TODO
size -= 4;
}
}
@@ -612,7 +612,7 @@ void Converse::loadConversation(const char *convName) {
case CHUNK_CASN: // Conditional assign
case CHUNK_ASGN: // Assign
curAction = new EntryAction();
- if (debugFlag) debug(kDebugConversations, "ASGN chunk\n");
+ if (debugFlag) debugCN(kDebugConversations, "ASGN chunk\n");
curAction->actionType = kAssignValue;
// Conditional part
@@ -655,32 +655,32 @@ void Converse::loadConversation(const char *convName) {
if (chunk == CHUNK_GOTO || chunk == CHUNK_CCGO) {
curAction->actionType = kGotoEntry;
- if (debugFlag) debug(kDebugConversations, "GOTO chunk\n");
+ if (debugFlag) debugCN(kDebugConversations, "GOTO chunk\n");
} else if (chunk == CHUNK_HIDE || chunk == CHUNK_CHDE) {
curAction->actionType = kHideEntry;
- if (debugFlag) debug(kDebugConversations, "HIDE chunk\n");
+ if (debugFlag) debugCN(kDebugConversations, "HIDE chunk\n");
} else if (chunk == CHUNK_UHID || chunk == CHUNK_CUHD) {
curAction->actionType = kUnhideEntry;
- if (debugFlag) debug(kDebugConversations, "UHID chunk\n");
+ if (debugFlag) debugCN(kDebugConversations, "UHID chunk\n");
} else if (chunk == CHUNK_DSTR || chunk == CHUNK_CDST) {
curAction->actionType = kDestroyEntry;
- if (debugFlag) debug(kDebugConversations, "DSTR chunk\n");
+ if (debugFlag) debugCN(kDebugConversations, "DSTR chunk\n");
} else if (chunk == CHUNK_EXIT || chunk == CHUNK_CEGO) {
curAction->actionType = kExitConv;
- if (debugFlag) debug(kDebugConversations, "EXIT chunk\n");
+ if (debugFlag) debugCN(kDebugConversations, "EXIT chunk\n");
}
data = convS->readUint32LE();
- if (debugFlag) debug(kDebugConversations, "Offset: %i\n", data);
+ if (debugFlag) debugCN(kDebugConversations, "Offset: %i\n", data);
curAction->targetOffset = data;
curEntry->actions.push_back(curAction);
break;
case CHUNK_FALL: // Fallthrough
- if (debugFlag) debug(kDebugConversations, "FALL chunk\n");
+ if (debugFlag) debugCN(kDebugConversations, "FALL chunk\n");
size = convS->readUint32LE();
- if (debugFlag) debug(kDebugConversations, "Minimum nodes: %i\n", size);
+ if (debugFlag) debugCN(kDebugConversations, "Minimum nodes: %i\n", size);
_convNodes[curNode]->fallthroughMinEntries = size;
data = convS->readUint32LE();
- if (debugFlag) debug(kDebugConversations, "Offset: %i\n", data);
+ if (debugFlag) debugCN(kDebugConversations, "Offset: %i\n", data);
_convNodes[curNode]->fallthroughOffset = data;
break;
// ----------------------------------------------------------------------------
@@ -718,35 +718,35 @@ void Converse::loadConversationMads(const char *convName) {
// ------------------------------------------------------------
// Chunk 0
convS = convDataD.getItemStream(0);
- debug(kDebugConversations, "Chunk 0\n");
- debug(kDebugConversations, "Conv stream size: %i\n", convS->size());
+ debugCN(kDebugConversations, "Chunk 0\n");
+ debugCN(kDebugConversations, "Conv stream size: %i\n", convS->size());
while (!convS->eos()) { // FIXME (eos changed)
- debug(kDebugConversations, "%i ", convS->readByte());
+ debugCN(kDebugConversations, "%i ", convS->readByte());
}
- debug(kDebugConversations, "\n");
+ debugCN(kDebugConversations, "\n");
// ------------------------------------------------------------
// Chunk 1
convS = convDataD.getItemStream(1);
- debug(kDebugConversations, "Chunk 1\n");
- debug(kDebugConversations, "Conv stream size: %i\n", convS->size());
+ debugCN(kDebugConversations, "Chunk 1\n");
+ debugCN(kDebugConversations, "Conv stream size: %i\n", convS->size());
while (!convS->eos()) { // FIXME (eos changed)
- debug(kDebugConversations, "%i ", convS->readByte());
+ debugCN(kDebugConversations, "%i ", convS->readByte());
}
- debug(kDebugConversations, "\n");
+ debugCN(kDebugConversations, "\n");
// ------------------------------------------------------------
// Chunk 2
convS = convDataD.getItemStream(2);
- debug(kDebugConversations, "Chunk 2\n");
- debug(kDebugConversations, "Conv stream size: %i\n", convS->size());
+ debugCN(kDebugConversations, "Chunk 2\n");
+ debugCN(kDebugConversations, "Conv stream size: %i\n", convS->size());
while (!convS->eos()) { // FIXME (eos changed)
- debug(kDebugConversations, "%i ", convS->readByte());
+ debugCN(kDebugConversations, "%i ", convS->readByte());
}
- debug(kDebugConversations, "\n");
+ debugCN(kDebugConversations, "\n");
// ------------------------------------------------------------
// CNV file
@@ -769,46 +769,46 @@ void Converse::loadConversationMads(const char *convName) {
// TODO: finish this
// Chunk 0
convS = convData.getItemStream(0);
- debug(kDebugConversations, "Chunk 0\n");
- debug(kDebugConversations, "Conv stream size: %i\n", convS->size());
- debug(kDebugConversations, "%i ", convS->readUint16LE());
- debug(kDebugConversations, "%i ", convS->readUint16LE());
- debug(kDebugConversations, "%i ", convS->readUint16LE());
- debug(kDebugConversations, "%i ", convS->readUint16LE());
- debug(kDebugConversations, "%i ", convS->readUint16LE());
- debug(kDebugConversations, "%i ", convS->readUint16LE());
- debug(kDebugConversations, "\n");
+ debugCN(kDebugConversations, "Chunk 0\n");
+ debugCN(kDebugConversations, "Conv stream size: %i\n", convS->size());
+ debugCN(kDebugConversations, "%i ", convS->readUint16LE());
+ debugCN(kDebugConversations, "%i ", convS->readUint16LE());
+ debugCN(kDebugConversations, "%i ", convS->readUint16LE());
+ debugCN(kDebugConversations, "%i ", convS->readUint16LE());
+ debugCN(kDebugConversations, "%i ", convS->readUint16LE());
+ debugCN(kDebugConversations, "%i ", convS->readUint16LE());
+ debugCN(kDebugConversations, "\n");
count = convS->readUint16LE(); // conversation face count (usually 2)
- debug(kDebugConversations, "Conversation faces: %i\n", count);
+ debugCN(kDebugConversations, "Conversation faces: %i\n", count);
for (i = 0; i < 5; i++) {
convS->read(buffer, 16);
- debug(kDebugConversations, "Face %i: %s ", i + 1, buffer);
+ debugCN(kDebugConversations, "Face %i: %s ", i + 1, buffer);
}
- debug(kDebugConversations, "\n");
+ debugCN(kDebugConversations, "\n");
// 5 face slots
// 1 = face slot has a face (with the filename specified above)
// 0 = face slot doesn't contain face data
for (i = 0; i < 5; i++) {
- debug(kDebugConversations, "%i ", convS->readUint16LE());
+ debugCN(kDebugConversations, "%i ", convS->readUint16LE());
}
- debug(kDebugConversations, "\n");
+ debugCN(kDebugConversations, "\n");
convS->read(buffer, 14); // speech file
- debug(kDebugConversations, "Speech file: %s\n", buffer);
+ debugCN(kDebugConversations, "Speech file: %s\n", buffer);
while (!convS->eos()) { // FIXME: eos changed
- debug(kDebugConversations, "%i ", convS->readByte());
+ debugCN(kDebugConversations, "%i ", convS->readByte());
}
- debug(kDebugConversations, "\n");
+ debugCN(kDebugConversations, "\n");
delete convS;
// ------------------------------------------------------------
// Chunk 1: Conversation nodes
convS = convData.getItemStream(1);
- debug(kDebugConversations, "Chunk 1: conversation nodes\n");
- debug(kDebugConversations, "Conv stream size: %i\n", convS->size());
+ debugCN(kDebugConversations, "Chunk 1: conversation nodes\n");
+ debugCN(kDebugConversations, "Conv stream size: %i\n", convS->size());
while (true) {
uint16 id = convS->readUint16LE();
@@ -828,12 +828,12 @@ void Converse::loadConversationMads(const char *convName) {
unk = convS->readUint16LE();
assert (unk == 65535);
_convNodes.push_back(curEntry);
- debug(kDebugConversations, "Node %i, ID %i, entries %i\n", _convNodes.size(), curEntry->id, curEntry->entryCount);
+ debugCN(kDebugConversations, "Node %i, ID %i, entries %i\n", _convNodes.size(), curEntry->id, curEntry->entryCount);
// flags = 0: node has more than 1 entry
// flags = 65535: node has 1 entry
}
- debug(kDebugConversations, "Conversation has %i nodes\n", _convNodes.size());
- debug(kDebugConversations, "\n");
+ debugCN(kDebugConversations, "Conversation has %i nodes\n", _convNodes.size());
+ debugCN(kDebugConversations, "\n");
delete convS;
@@ -844,14 +844,14 @@ void Converse::loadConversationMads(const char *convName) {
// ------------------------------------------------------------
// Chunk 5 contains the conversation strings
convS = convData.getItemStream(5);
- //debug(kDebugConversations, "Chunk 5: conversation strings\n");
- //debug(kDebugConversations, "Conv stream size: %i\n", convS->size());
+ //debugCN(kDebugConversations, "Chunk 5: conversation strings\n");
+ //debugCN(kDebugConversations, "Conv stream size: %i\n", convS->size());
*buffer = 0;
while (true) {
//if (curPos == 0)
- // debug(kDebugConversations, "%i: Offset %i: ", _convStrings.size(), convS->pos());
+ // debugCN(kDebugConversations, "%i: Offset %i: ", _convStrings.size(), convS->pos());
uint8 b = convS->readByte();
if (convS->eos()) break;
@@ -862,7 +862,7 @@ void Converse::loadConversationMads(const char *convName) {
}
if (buffer[curPos - 1] == '\0') {
// end of string
- //debug(kDebugConversations, "%s\n", buffer);
+ //debugCN(kDebugConversations, "%s\n", buffer);
buf = new char[strlen(buffer) + 1];
strcpy(buf, buffer);
_convStrings.push_back(buf);
@@ -876,8 +876,8 @@ void Converse::loadConversationMads(const char *convName) {
// ------------------------------------------------------------
// Chunk 2: entry data
convS = convData.getItemStream(2);
- //debug(kDebugConversations, "Chunk 2 - entry data\n");
- //debug(kDebugConversations, "Conv stream size: %i\n", convS->size());
+ //debugCN(kDebugConversations, "Chunk 2 - entry data\n");
+ //debugCN(kDebugConversations, "Conv stream size: %i\n", convS->size());
for (i = 0; i < _convNodes.size(); i++) {
for (j = 0; j < _convNodes[i]->entryCount; j++) {
@@ -892,7 +892,7 @@ void Converse::loadConversationMads(const char *convName) {
curEntry->size = convS->readUint16LE();
_convNodes[i]->entries.push_back(curEntry);
- //debug(kDebugConversations, "Node %i, entry %i, id %i, offset %i, size %i, text: %s\n",
+ //debugCN(kDebugConversations, "Node %i, entry %i, id %i, offset %i, size %i, text: %s\n",
// i, j, curEntry->id, curEntry->offset, curEntry->size, curEntry->text);
}
}
@@ -902,8 +902,8 @@ void Converse::loadConversationMads(const char *convName) {
// ------------------------------------------------------------
// Chunk 3: message (MESG) chunks, created from the strings of chunk 5
convS = convData.getItemStream(3);
- //debug(kDebugConversations, "Chunk 3 - MESG chunk data\n");
- //debug(kDebugConversations, "Conv stream size: %i\n", convS->size());
+ //debugCN(kDebugConversations, "Chunk 3 - MESG chunk data\n");
+ //debugCN(kDebugConversations, "Conv stream size: %i\n", convS->size());
while (true) {
uint16 index = convS->readUint16LE();
@@ -913,15 +913,15 @@ void Converse::loadConversationMads(const char *convName) {
stringIndex = index;
stringCount = convS->readUint16LE();
*buffer = 0;
- //debug(kDebugConversations, "Message: %i\n", _madsMessageList.size());
+ //debugCN(kDebugConversations, "Message: %i\n", _madsMessageList.size());
for (i = stringIndex; i < stringIndex + stringCount; i++) {
- //debug(kDebugConversations, "%i: %s\n", i, _convStrings[i]);
+ //debugCN(kDebugConversations, "%i: %s\n", i, _convStrings[i]);
curMessage->messageStrings.push_back(_convStrings[i]);
}
_madsMessageList.push_back(curMessage);
- //debug(kDebugConversations, "----------\n");
+ //debugCN(kDebugConversations, "----------\n");
}
- //debug(kDebugConversations, "\n");
+ //debugCN(kDebugConversations, "\n");
delete convS;
@@ -929,31 +929,31 @@ void Converse::loadConversationMads(const char *convName) {
// TODO: finish this
// Chunk 6: conversation script
convS = convData.getItemStream(6);
- debug(kDebugConversations, "Chunk 6\n");
- debug(kDebugConversations, "Conv stream size: %i\n", convS->size());
+ debugCN(kDebugConversations, "Chunk 6\n");
+ debugCN(kDebugConversations, "Conv stream size: %i\n", convS->size());
/*while (!convS->eos()) { // FIXME (eos changed)
- debug(kDebugConversations, "%i ", convS->readByte());
- debug(kDebugConversations, "%i ", convS->readByte());
- debug(kDebugConversations, "%i ", convS->readByte());
- debug(kDebugConversations, "%i ", convS->readByte());
- debug(kDebugConversations, "%i ", convS->readByte());
- debug(kDebugConversations, "%i ", convS->readByte());
- debug(kDebugConversations, "%i ", convS->readByte());
- debug(kDebugConversations, "%i ", convS->readByte());
- debug(kDebugConversations, "%i ", convS->readByte());
- debug(kDebugConversations, "%i ", convS->readByte());
- debug(kDebugConversations, "\n");
+ debugCN(kDebugConversations, "%i ", convS->readByte());
+ debugCN(kDebugConversations, "%i ", convS->readByte());
+ debugCN(kDebugConversations, "%i ", convS->readByte());
+ debugCN(kDebugConversations, "%i ", convS->readByte());
+ debugCN(kDebugConversations, "%i ", convS->readByte());
+ debugCN(kDebugConversations, "%i ", convS->readByte());
+ debugCN(kDebugConversations, "%i ", convS->readByte());
+ debugCN(kDebugConversations, "%i ", convS->readByte());
+ debugCN(kDebugConversations, "%i ", convS->readByte());
+ debugCN(kDebugConversations, "%i ", convS->readByte());
+ debugCN(kDebugConversations, "\n");
}
return;*/
for (i = 0; i < _convNodes.size(); i++) {
for (j = 0; j < _convNodes[i]->entryCount; j++) {
- debug(kDebugConversations, "*** Node %i entry %i data size %i\n", i, j, _convNodes[i]->entries[j]->size);
- debug(kDebugConversations, "Entry ID %i, text %s\n", _convNodes[i]->entries[j]->id, _convNodes[i]->entries[j]->text);
+ debugCN(kDebugConversations, "*** Node %i entry %i data size %i\n", i, j, _convNodes[i]->entries[j]->size);
+ debugCN(kDebugConversations, "Entry ID %i, text %s\n", _convNodes[i]->entries[j]->id, _convNodes[i]->entries[j]->text);
Common::SubReadStream *entryStream = new Common::SubReadStream(convS, _convNodes[i]->entries[j]->size);
readConvEntryActions(entryStream, _convNodes[i]->entries[j]);
delete entryStream;
- debug(kDebugConversations, "--------------------\n");
+ debugCN(kDebugConversations, "--------------------\n");
}
}
@@ -978,50 +978,50 @@ void Converse::readConvEntryActions(Common::SubReadStream *convS, ConvEntry *cur
switch (chunk) {
case 1:
- debug(kDebugConversations, "TODO: chunk type %i\n", chunk);
+ debugCN(kDebugConversations, "TODO: chunk type %i\n", chunk);
break;
case 2:
- debug(kDebugConversations, "HIDE\n");
+ debugCN(kDebugConversations, "HIDE\n");
convS->readByte();
count = convS->readByte();
- debug(kDebugConversations, "%i entries: ", count);
+ debugCN(kDebugConversations, "%i entries: ", count);
for (int i = 0; i < count; i++)
- debug(kDebugConversations, "%i %d", i, convS->readUint16LE());
- debug(kDebugConversations, "\n");
+ debugCN(kDebugConversations, "%i %d", i, convS->readUint16LE());
+ debugCN(kDebugConversations, "\n");
break;
case 3:
- debug(kDebugConversations, "UNHIDE\n");
+ debugCN(kDebugConversations, "UNHIDE\n");
convS->readByte();
count = convS->readByte();
- debug(kDebugConversations, "%i entries: ", count);
+ debugCN(kDebugConversations, "%i entries: ", count);
for (int i = 0; i < count; i++)
- debug(kDebugConversations, "%i %d", i, convS->readUint16LE());
- debug(kDebugConversations, "\n");
+ debugCN(kDebugConversations, "%i %d", i, convS->readUint16LE());
+ debugCN(kDebugConversations, "\n");
break;
case 4: // MESSAGE
- debug(kDebugConversations, "MESSAGE\n");
+ debugCN(kDebugConversations, "MESSAGE\n");
if (type == 255) {
- //debug(kDebugConversations, "unconditional\n");
+ //debugCN(kDebugConversations, "unconditional\n");
} else if (type == 11) {
- //debug(kDebugConversations, "conditional\n");
+ //debugCN(kDebugConversations, "conditional\n");
} else {
- debug(kDebugConversations, "unknown type: %i\n", type);
+ debugCN(kDebugConversations, "unknown type: %i\n", type);
}
// Conditional part
if (type == 11) {
unk = convS->readUint16LE(); // 1
if (unk != 1)
- debug(kDebugConversations, "Message: unk != 1 (it's %i)\n", unk);
+ debugCN(kDebugConversations, "Message: unk != 1 (it's %i)\n", unk);
var = convS->readUint16LE();
val = convS->readUint16LE();
- debug(kDebugConversations, "Var %i == %i\n", var, val);
+ debugCN(kDebugConversations, "Var %i == %i\n", var, val);
}
unk = convS->readUint16LE(); // 256
if (unk != 256)
- debug(kDebugConversations, "Message: unk != 256 (it's %i)\n", unk);
+ debugCN(kDebugConversations, "Message: unk != 256 (it's %i)\n", unk);
// it seems that the first text entry is set when the message
// chunk is supposed to be shown unconditionally, whereas the second text
@@ -1031,74 +1031,74 @@ void Converse::readConvEntryActions(Common::SubReadStream *convS, ConvEntry *cur
if (hasText1 == 1) {
messageIndex = convS->readUint16LE();
- debug(kDebugConversations, "Message 1 index: %i, text:\n", messageIndex);
+ debugCN(kDebugConversations, "Message 1 index: %i, text:\n", messageIndex);
for (uint32 i = 0; i < _madsMessageList[messageIndex]->messageStrings.size(); i++) {
- debug(kDebugConversations, "%s\n", _madsMessageList[messageIndex]->messageStrings[i]);
+ debugCN(kDebugConversations, "%s\n", _madsMessageList[messageIndex]->messageStrings[i]);
}
}
if (hasText2 == 1) {
messageIndex = convS->readUint16LE();
if (hasText1 == 0) {
- debug(kDebugConversations, "Message 2 index: %i, text:\n", messageIndex);
+ debugCN(kDebugConversations, "Message 2 index: %i, text:\n", messageIndex);
for (uint32 i = 0; i < _madsMessageList[messageIndex]->messageStrings.size(); i++) {
- debug(kDebugConversations, "%s\n", _madsMessageList[messageIndex]->messageStrings[i]);
+ debugCN(kDebugConversations, "%s\n", _madsMessageList[messageIndex]->messageStrings[i]);
}
}
}
break;
case 5: // AUTO
- debug(kDebugConversations, "AUTO\n");
+ debugCN(kDebugConversations, "AUTO\n");
for (int k = 0; k < 4; k++)
convS->readByte();
messageIndex = convS->readUint16LE();
- debug(kDebugConversations, "Message index: %i, text:\n", messageIndex);
+ debugCN(kDebugConversations, "Message index: %i, text:\n", messageIndex);
for (uint32 i = 0; i < _madsMessageList[messageIndex]->messageStrings.size(); i++) {
- debug(kDebugConversations, "%s\n", _madsMessageList[messageIndex]->messageStrings[i]);
+ debugCN(kDebugConversations, "%s\n", _madsMessageList[messageIndex]->messageStrings[i]);
}
convS->readUint16LE();
break;
case 6:
- debug(kDebugConversations, "TODO: chunk type %i\n", chunk);
+ debugCN(kDebugConversations, "TODO: chunk type %i\n", chunk);
break;
case 7: // GOTO
unk = convS->readUint32LE(); // 0
if (unk != 0 && unk != 1)
- debug(kDebugConversations, "Goto: unk != 0 or 1 (it's %i)\n", unk);
+ debugCN(kDebugConversations, "Goto: unk != 0 or 1 (it's %i)\n", unk);
target = convS->readUint16LE();
convS->readUint16LE(); // 255
if (unk != 0)
- debug(kDebugConversations, "Goto: unk != 0 (it's %i)\n", unk);
+ debugCN(kDebugConversations, "Goto: unk != 0 (it's %i)\n", unk);
if (target != 65535)
- debug(kDebugConversations, "GOTO node %i\n", target);
+ debugCN(kDebugConversations, "GOTO node %i\n", target);
else
- debug(kDebugConversations, "GOTO exit\n");
+ debugCN(kDebugConversations, "GOTO exit\n");
break;
case 8:
- debug(kDebugConversations, "TODO: chunk type %i\n", chunk);
+ debugCN(kDebugConversations, "TODO: chunk type %i\n", chunk);
break;
case 9: // ASSIGN
- //debug(kDebugConversations, "ASSIGN\n");
+ //debugCN(kDebugConversations, "ASSIGN\n");
unk = convS->readUint32LE(); // 0
if (unk != 0)
- debug(kDebugConversations, "Assign: unk != 0 (it's %i)\n", unk);
+ debugCN(kDebugConversations, "Assign: unk != 0 (it's %i)\n", unk);
val = convS->readUint16LE();
var = convS->readUint16LE();
- //debug(kDebugConversations, "Var %i = %i\n", var, val);
+ //debugCN(kDebugConversations, "Var %i = %i\n", var, val);
break;
default:
- debug(kDebugConversations, "Unknown chunk type! (%i)\n", chunk);
+ debugCN(kDebugConversations, "Unknown chunk type! (%i)\n", chunk);
break;
}
}
- debug(kDebugConversations, "\n");
+ debugCN(kDebugConversations, "\n");
}
void Converse::setEntryInfo(int32 offset, EntryType type, int32 nodeIndex, int32 entryIndex) {
@@ -1109,7 +1109,7 @@ void Converse::setEntryInfo(int32 offset, EntryType type, int32 nodeIndex, int32
info.nodeIndex = nodeIndex;
info.entryIndex = entryIndex;
_offsetMap[hashOffset] = info;
- //debug(kDebugConversations, "Set entry info: offset %i, type %i, node %i, entry %i\n", offset, type, nodeIndex, entryIndex);
+ //debugCN(kDebugConversations, "Set entry info: offset %i, type %i, node %i, entry %i\n", offset, type, nodeIndex, entryIndex);
}
const EntryInfo* Converse::getEntryInfo(int32 offset) {
@@ -1172,7 +1172,7 @@ bool Converse::performAction(EntryAction *action) {
}
if (action->actionType == kAssignValue) {
- //debug(kDebugConversations, "Assigning variable at offset %i to value %i\n",
+ //debugCN(kDebugConversations, "Assigning variable at offset %i to value %i\n",
// action->targetOffset, action->value);
setValue(action->targetOffset, action->value);
return true; // nothing else to do in an assignment action
@@ -1190,24 +1190,24 @@ bool Converse::performAction(EntryAction *action) {
switch (action->actionType) {
case kGotoEntry:
- //debug(kDebugConversations, "Goto entry at offset %i. Associated node is %i, entry %i\n",
+ //debugCN(kDebugConversations, "Goto entry at offset %i. Associated node is %i, entry %i\n",
// action->targetOffset, entryInfo->nodeIndex, entryInfo->entryIndex);
_vm->_conversationView->setNode(entryInfo->nodeIndex);
if (entryInfo->entryIndex >= 0)
_vm->_conversationView->selectEntry(entryInfo->entryIndex);
return false;
case kHideEntry:
- //debug(kDebugConversations, "Hide entry at offset %i. Associated node is %i, entry %i\n",
+ //debugCN(kDebugConversations, "Hide entry at offset %i. Associated node is %i, entry %i\n",
// targetEntry->offset, entryInfo->nodeIndex, entryInfo->entryIndex);
targetEntry->visible = false;
return true;
case kUnhideEntry:
- //debug(kDebugConversations, "Show entry at offset %i. Associated node is %i, entry %i\n",
+ //debugCN(kDebugConversations, "Show entry at offset %i. Associated node is %i, entry %i\n",
// targetEntry->offset, entryInfo->nodeIndex, entryInfo->entryIndex);
targetEntry->visible = true;
return true;
case kDestroyEntry:
- //debug(kDebugConversations, "Destroy entry at offset %i. Associated node is %i, entry %i\n",
+ //debugCN(kDebugConversations, "Destroy entry at offset %i. Associated node is %i, entry %i\n",
// targetEntry->offset, entryInfo->nodeIndex, entryInfo->entryIndex);
if (entryInfo->entryIndex >= 0)
getNode(entryInfo->nodeIndex)->entries.remove_at(entryInfo->entryIndex);
@@ -1216,7 +1216,7 @@ bool Converse::performAction(EntryAction *action) {
targetEntry->visible = true;
return true;
case kExitConv:
- //debug(kDebugConversations, "Exit conversation\n");
+ //debugCN(kDebugConversations, "Exit conversation\n");
endConversation();
return false;
default:
diff --git a/engines/m4/events.cpp b/engines/m4/events.cpp
index 0d6ce907bf..29b243aceb 100644
--- a/engines/m4/events.cpp
+++ b/engines/m4/events.cpp
@@ -235,7 +235,7 @@ bool Mouse::init(const char *seriesName, RGB8 *palette) {
cursorPalette = _cursorSprites->getPalette();
_vm->_palette->setPalette(cursorPalette, 0, colorCount);
- //debug(kDebugCore, "Cursor count: %d\n", _cursorSprites->getCount());
+ //debugCN(kDebugCore, "Cursor count: %d\n", _cursorSprites->getCount());
_vm->res()->toss(seriesName);
diff --git a/engines/m4/font.cpp b/engines/m4/font.cpp
index 1d4ec14525..cba32c2225 100644
--- a/engines/m4/font.cpp
+++ b/engines/m4/font.cpp
@@ -82,7 +82,7 @@ void Font::setFontM4(const char *filename) {
Common::SeekableReadStream *fontFile = _vm->res()->openFile(filename);
if (fontFile->readUint32LE() != MKID_BE('FONT')) {
- debug(kDebugGraphics, "Font::Font: FONT tag expected\n");
+ debugCN(kDebugGraphics, "Font::Font: FONT tag expected\n");
return;
}
@@ -90,10 +90,10 @@ void Font::setFontM4(const char *filename) {
_maxWidth = fontFile->readByte();
uint32 fontSize = fontFile->readUint32LE();
- //debug(kDebugGraphics, "Font::Font: _maxWidth = %d, _maxHeight = %d, fontSize = %d\n", _maxWidth, _maxHeight, fontSize);
+ //debugCN(kDebugGraphics, "Font::Font: _maxWidth = %d, _maxHeight = %d, fontSize = %d\n", _maxWidth, _maxHeight, fontSize);
if (fontFile->readUint32LE() != MKID_BE('WIDT')) {
- debug(kDebugGraphics, "Font::Font: WIDT tag expected\n");
+ debugCN(kDebugGraphics, "Font::Font: WIDT tag expected\n");
return;
}
@@ -101,7 +101,7 @@ void Font::setFontM4(const char *filename) {
fontFile->read(_charWidths, 256);
if (fontFile->readUint32LE() != MKID_BE('OFFS')) {
- debug(kDebugGraphics, "Font::Font: OFFS tag expected\n");
+ debugCN(kDebugGraphics, "Font::Font: OFFS tag expected\n");
return;
}
@@ -111,7 +111,7 @@ void Font::setFontM4(const char *filename) {
_charOffs[i] = fontFile->readUint16LE();
if (fontFile->readUint32LE() != MKID_BE('PIXS')) {
- debug(kDebugGraphics, "Font::Font: PIXS tag expected\n");
+ debugCN(kDebugGraphics, "Font::Font: PIXS tag expected\n");
return;
}
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index f8d93a224d..d982ecad0e 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -75,7 +75,7 @@ bool Kernel::sendTrigger(int32 triggerNum) {
bool Kernel::handleTrigger(int32 triggerNum) {
- debug(kDebugScript, "betweenRooms = %d; triggerNum = %08X\n", betweenRooms, (uint)triggerNum);
+ debugCN(kDebugScript, "betweenRooms = %d; triggerNum = %08X\n", betweenRooms, (uint)triggerNum);
if (betweenRooms)
return true;
@@ -89,10 +89,10 @@ bool Kernel::handleTrigger(int32 triggerNum) {
int room = (triggerNum >> 16) & 0xFFF;
- debug(kDebugScript, "room = %d; currentRoom = %d\n", room, currentRoom);
+ debugCN(kDebugScript, "room = %d; currentRoom = %d\n", room, currentRoom);
if (room != currentRoom) {
- debug(kDebugScript, "Kernel::handleTrigger() Trigger from another room\n");
+ debugCN(kDebugScript, "Kernel::handleTrigger() Trigger from another room\n");
return false;
}
@@ -123,7 +123,7 @@ bool Kernel::handleTrigger(int32 triggerNum) {
break;
case KT_DAEMON:
- debug(kDebugScript, "KT_DAEMON\n");
+ debugCN(kDebugScript, "KT_DAEMON\n");
triggerMode = KT_DAEMON;
daemonTriggerAvailable = false;
roomDaemon();
@@ -139,7 +139,7 @@ bool Kernel::handleTrigger(int32 triggerNum) {
break;
default:
- debug(kDebugScript, "Kernel::handleTrigger() Unknown trigger mode %d\n", mode);
+ debugCN(kDebugScript, "Kernel::handleTrigger() Unknown trigger mode %d\n", mode);
}
@@ -180,7 +180,7 @@ void Kernel::globalDaemon() {
if (_globalDaemonFn)
_vm->_script->runFunction(_globalDaemonFn);
else {
- debug(kDebugScript, "Kernel::globalDaemon() _globalDaemonFn is NULL\n");
+ debugCN(kDebugScript, "Kernel::globalDaemon() _globalDaemonFn is NULL\n");
}
}
@@ -188,7 +188,7 @@ void Kernel::globalParser() {
if (_globalParserFn)
_vm->_script->runFunction(_globalParserFn);
else {
- debug(kDebugScript, "Kernel::globalParser() _globalParserFn is NULL\n");
+ debugCN(kDebugScript, "Kernel::globalParser() _globalParserFn is NULL\n");
}
}
@@ -196,7 +196,7 @@ void Kernel::sectionInit() {
if (_sectionInitFn)
_vm->_script->runFunction(_sectionInitFn);
else {
- debug(kDebugScript, "Kernel::sectionInit() _sectionInitFn is NULL\n");
+ debugCN(kDebugScript, "Kernel::sectionInit() _sectionInitFn is NULL\n");
}
}
@@ -204,7 +204,7 @@ void Kernel::sectionDaemon() {
if (_sectionDaemonFn)
_vm->_script->runFunction(_sectionDaemonFn);
else {
- debug(kDebugScript, "Kernel::sectionDaemon() _sectionDaemonFn is NULL\n");
+ debugCN(kDebugScript, "Kernel::sectionDaemon() _sectionDaemonFn is NULL\n");
}
}
@@ -212,7 +212,7 @@ void Kernel::sectionParser() {
if (_sectionParserFn)
_vm->_script->runFunction(_sectionParserFn);
else {
- debug(kDebugScript, "Kernel::sectionParser() _sectionParserFn is NULL\n");
+ debugCN(kDebugScript, "Kernel::sectionParser() _sectionParserFn is NULL\n");
}
}
@@ -220,7 +220,7 @@ void Kernel::roomInit() {
if (_roomInitFn)
_vm->_script->runFunction(_roomInitFn);
else {
- debug(kDebugScript, "Kernel::roomInit() _roomInitFn is NULL\n");
+ debugCN(kDebugScript, "Kernel::roomInit() _roomInitFn is NULL\n");
}
}
@@ -228,7 +228,7 @@ void Kernel::roomDaemon() {
if (_roomDaemonFn)
_vm->_script->runFunction(_roomDaemonFn);
else {
- debug(kDebugScript, "Kernel::roomDaemon() _roomDaemonFn is NULL\n");
+ debugCN(kDebugScript, "Kernel::roomDaemon() _roomDaemonFn is NULL\n");
}
}
@@ -236,7 +236,7 @@ void Kernel::roomPreParser() {
if (_roomPreParserFn)
_vm->_script->runFunction(_roomPreParserFn);
else {
- debug(kDebugScript, "Kernel::roomPreParser() _roomPreParserFn is NULL\n");
+ debugCN(kDebugScript, "Kernel::roomPreParser() _roomPreParserFn is NULL\n");
}
}
@@ -244,7 +244,7 @@ void Kernel::roomParser() {
if (_roomParserFn)
_vm->_script->runFunction(_roomParserFn);
else {
- debug(kDebugScript, "Kernel::roomParser() _roomParserFn is NULL\n");
+ debugCN(kDebugScript, "Kernel::roomParser() _roomParserFn is NULL\n");
}
}
@@ -350,7 +350,7 @@ void MadsGlobals::loadMadsMessagesInfo() {
Common::SeekableReadStream *messageS = _vm->res()->get("messages.dat");
int16 count = messageS->readUint16LE();
- //debug(kDebugScript, "%i messages\n", count);
+ //debugCN(kDebugScript, "%i messages\n", count);
for (int i = 0; i < count; i++) {
MessageItem curMessage;
@@ -364,7 +364,7 @@ void MadsGlobals::loadMadsMessagesInfo() {
if (i == count - 1)
curMessage.compSize = messageS->size() - curMessage.offset;
- //debug(kDebugScript, "id: %i, offset: %i, uncomp size: %i\n", curMessage->id, curMessage->offset, curMessage->uncompSize);
+ //debugCN(kDebugScript, "id: %i, offset: %i, uncomp size: %i\n", curMessage->id, curMessage->offset, curMessage->uncompSize);
_madsMessages.push_back(curMessage);
}
diff --git a/engines/m4/graphics.cpp b/engines/m4/graphics.cpp
index a45446627c..6d01db50bd 100644
--- a/engines/m4/graphics.cpp
+++ b/engines/m4/graphics.cpp
@@ -213,7 +213,7 @@ void M4Surface::drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &c
int scaledHeight = scaleValue(info.height, info.scaleY, errY);
/*
- debug(kDebugGraphics, "M4Surface::drawSprite() info.width = %d; info.scaleX = %d; info.height = %d; info.scaleY = %d; scaledWidth = %d; scaledHeight = %d\n",
+ debugCN(kDebugGraphics, "M4Surface::drawSprite() info.width = %d; info.scaleX = %d; info.height = %d; info.scaleY = %d; scaledWidth = %d; scaledHeight = %d\n",
info.width, info.scaleX, info.height, info.scaleY, scaledWidth, scaledHeight);
*/
@@ -233,7 +233,7 @@ void M4Surface::drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &c
scaledHeight = y + scaledHeight;
}
- //debug(kDebugGraphics, "M4Surface::drawSprite() width = %d; height = %d; scaledWidth = %d; scaledHeight = %d\n", info.width, info.height, scaledWidth, scaledHeight);
+ //debugCN(kDebugGraphics, "M4Surface::drawSprite() width = %d; height = %d; scaledWidth = %d; scaledHeight = %d\n", info.width, info.height, scaledWidth, scaledHeight);
// Check if sprite is inside the screen. If it's not, there's no need to draw it
if (scaledWidth + x <= 0 || scaledHeight + y <= 0) // check left and top (in case x,y are negative)
@@ -703,7 +703,7 @@ void M4Surface::madsLoadBackground(int roomNumber, RGBList **palData) {
else
compressedTileDataSize = tileDataUncomp->readUint32LE() - tileOfs;
- //debug(kDebugGraphics, "Tile: %i, compressed size: %i\n", i, compressedTileDataSize);
+ //debugCN(kDebugGraphics, "Tile: %i, compressed size: %i\n", i, compressedTileDataSize);
newTile->clear();
@@ -787,7 +787,7 @@ void M4Surface::m4LoadBackground(Common::SeekableReadStream *source) {
uint8 blackIndex = 0;
// Debug
- //debug(kDebugGraphics, "loadBackground(): %dx%d picture (%d bytes) - %dx%d tiles of size %dx%d\n",
+ //debugCN(kDebugGraphics, "loadBackground(): %dx%d picture (%d bytes) - %dx%d tiles of size %dx%d\n",
// widthVal, heightVal, size, tilesX, tilesY, tileWidth, tileHeight);
// BGR data, which is converted to RGB8
@@ -807,7 +807,7 @@ void M4Surface::m4LoadBackground(Common::SeekableReadStream *source) {
// note that the height of the scene in game scenes is smaller than 480, as the bottom part of the
// screen is the inventory
assert(width() == (int)widthVal);
- //debug(kDebugGraphics, "width(): %d, widthVal: %d, height(): %d, heightVal: %d\n", width(), widthVal, height(), heightVal);
+ //debugCN(kDebugGraphics, "width(): %d, widthVal: %d, height(): %d, heightVal: %d\n", width(), widthVal, height(), heightVal);
tileBuffer->create(tileWidth, tileHeight, 1);
diff --git a/engines/m4/hotspot.cpp b/engines/m4/hotspot.cpp
index 3132d6e4de..500464dc09 100644
--- a/engines/m4/hotspot.cpp
+++ b/engines/m4/hotspot.cpp
@@ -227,7 +227,7 @@ void HotSpotList::loadHotSpots(Common::SeekableReadStream* hotspotStream, int ho
// This looks to be some sort of bitmask. Perhaps it signifies
// the valid verbs for this hotspot
index = hotspotStream->readUint16LE(); // unknown
- //debug(kDebugCore, "%i ", index);
+ //debugC(kDebugCore, "%i ", index);
}
if (_vm->isM4())
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 7a5efbfbc1..93490a0821 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -122,6 +122,7 @@ MadsM4Engine::MadsM4Engine(OSystem *syst, const M4GameDescription *gameDesc) :
DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics debug level");
DebugMan.addDebugChannel(kDebugConversations, "conversations", "Conversations debugging");
DebugMan.addDebugChannel(kDebugSound, "sound", "Sounds debug level");
+ DebugMan.addDebugChannel(kDebugCore, "core", "Core debug level");
_resourceManager = NULL;
_globals = NULL;
@@ -290,7 +291,7 @@ void MadsM4Engine::dumpFile(const char* filename, bool uncompress) {
Common::MemoryReadStream *sourceUnc;
for (int i = 0; i < packData.getCount(); i++) {
sourceUnc = packData.getItemStream(i);
- debug(kDebugCore, "Dumping compressed chunk %i of %i, size is %i\n", i + 1, packData.getCount(), sourceUnc->size());
+ debugCN(kDebugCore, "Dumping compressed chunk %i of %i, size is %i\n", i + 1, packData.getCount(), sourceUnc->size());
while (!sourceUnc->eos()) {
bytesRead = sourceUnc->read(buffer, DUMP_BUFFER_SIZE);
f.write(buffer, bytesRead);
@@ -345,7 +346,7 @@ Common::Error M4Engine::run() {
for (int i = 1; i < 58; i++) {
_vm->_kernel->trigger = i;
_script->runFunction(func);
- debug(kDebugCore, "=================================\n");
+ debugCN(kDebugCore, "=================================\n");
}
#endif
@@ -541,7 +542,7 @@ Common::Error MadsEngine::run() {
// Test code to dump all messages to the console
//for (int i = 0; i < _globals->getMessagesSize(); i++)
- //debug(kDebugCore, "%s\n----------\n", _globals->loadMessage(i));
+ //debugCN(kDebugCore, "%s\n----------\n", _globals->loadMessage(i));
if (getGameType() == GType_RexNebular) {
MadsGameLogic::initialiseGlobals();
diff --git a/engines/m4/m4_scene.cpp b/engines/m4/m4_scene.cpp
index de6c5bddad..738f414add 100644
--- a/engines/m4/m4_scene.cpp
+++ b/engines/m4/m4_scene.cpp
@@ -61,7 +61,7 @@ void M4Scene::loadSceneSprites(int sceneNumber) {
_sceneSprites = new SpriteAsset(_vm, sceneS, sceneS->size(), filename);
_vm->res()->toss(filename);
- debug(kDebugGraphics, "Scene has %d sprites, each one having %d colors\n", _sceneSprites->getCount(), _sceneSprites->getColorCount());
+ debugCN(kDebugGraphics, "Scene has %d sprites, each one having %d colors\n", _sceneSprites->getCount(), _sceneSprites->getColorCount());
}
void M4Scene::loadSceneResources(int sceneNumber) {
@@ -136,7 +136,7 @@ void M4Scene::loadSceneSpriteCodes(int sceneNumber) {
// RGB8* spritePalette = _sceneSpriteCodes->getPalette();
//_vm->_palette->setPalette(spritePalette, 0, colorCount);
- debug(kDebugGraphics, "Scene has %d sprite codes, each one having %d colors\n", _sceneSpriteCodes->getCount(), colorCount);
+ debugCN(kDebugGraphics, "Scene has %d sprite codes, each one having %d colors\n", _sceneSpriteCodes->getCount(), colorCount);
// Note that toss() deletes the MemoryReadStream
_vm->res()->toss(filename);
@@ -252,7 +252,7 @@ void M4Scene::leftClick(int x, int y) {
*/
// Player said.... (for scene scripts)
- debug(kDebugGraphics, "Player said: %s %s\n", currentHotSpot->getVerb(), currentHotSpot->getVocab());
+ debugCN(kDebugGraphics, "Player said: %s %s\n", currentHotSpot->getVerb(), currentHotSpot->getVocab());
// FIXME: This should be moved somewhere else, and is incomplete
if (_m4Vm->scene()->getInterface()->_inventory.getSelectedIndex() == -1) {
@@ -268,7 +268,7 @@ void M4Scene::leftClick(int x, int y) {
strcpy(_vm->_player->object, "");
_vm->_player->commandReady = true;
- debug(kDebugGraphics, "## Player said: %s %s\n", _vm->_player->verb, _vm->_player->noun);
+ debugCN(kDebugGraphics, "## Player said: %s %s\n", _vm->_player->verb, _vm->_player->noun);
}
}
diff --git a/engines/m4/mads_menus.cpp b/engines/m4/mads_menus.cpp
index e2aa19171f..91db7d343a 100644
--- a/engines/m4/mads_menus.cpp
+++ b/engines/m4/mads_menus.cpp
@@ -546,7 +546,7 @@ int DragonMainMenuView::getHighlightedItem(int x, int y) {
M4Sprite *spr = _menuItem->getFrame(0);
if ((x >= pt.x - 25) && (y >= pt.y - spr->height()) && (x < (pt.x - 25 + spr->width())) && (y < (pt.y))) {
- debug(kDebugGraphics, "x = %d, y = %d, index = %d\n", x, y, index);
+ debugCN(kDebugGraphics, "x = %d, y = %d, index = %d\n", x, y, index);
return index;
}
}
diff --git a/engines/m4/rails.cpp b/engines/m4/rails.cpp
index 3bff7cb234..ff18d645e7 100644
--- a/engines/m4/rails.cpp
+++ b/engines/m4/rails.cpp
@@ -233,7 +233,7 @@ void Rails::createEdge(int32 node1, int32 node2) {
valid = isLineWalkable(_nodes[node1]->x, _nodes[node1]->y,
_nodes[node2]->x, _nodes[node2]->y);
- debug(kDebugCore, "test code says: %d\n", valid);
+ debugCN(kDebugCore, "test code says: %d\n", valid);
// Check if the line passes through a forbidden rectangle
if (valid) {
@@ -255,7 +255,7 @@ void Rails::createEdge(int32 node1, int32 node2) {
_edges.insert_at(index, (int16*)(distance >> 16));
}
- debug(kDebugCore, "node1 = %d, node2 = %d, valid = %d\n", node1, node2, valid);
+ debugCN(kDebugCore, "node1 = %d, node2 = %d, valid = %d\n", node1, node2, valid);
}
diff --git a/engines/m4/resource.cpp b/engines/m4/resource.cpp
index cc8fc3b055..fd54d439a6 100644
--- a/engines/m4/resource.cpp
+++ b/engines/m4/resource.cpp
@@ -43,12 +43,12 @@ FileSystem::FileSystem(const char *hashFilename) {
hashFile.open(hashFilename);
if (!hashFile.isOpen()) {
- debug(kDebugCore, "FileSystem::FileSystem: error opening hash %s\n", hashFilename);
+ debugCN(kDebugCore, "FileSystem::FileSystem: error opening hash %s\n", hashFilename);
}
hashSize = hashFile.readUint32LE();
- //debug(kDebugCore, "FileSystem::FileSystem: hashSize = %d\n", hashSize);
+ //debugCN(kDebugCore, "FileSystem::FileSystem: hashSize = %d\n", hashSize);
/* load file records and add them to the hash list */
for (uint i = 0; i < hashSize; i++) {
@@ -63,12 +63,12 @@ FileSystem::FileSystem(const char *hashFilename) {
if (entry.filename[0]) {
/*
- debug(kDebugCore, " filename: %s\n", entry.filename);
- debug(kDebugCore, " hagfile: %d\n", entry.hagfile);
- debug(kDebugCore, " disks: %d\n", entry.disks);
- debug(kDebugCore, " offset: %08X\n", entry.offset);
- debug(kDebugCore, " size: %d\n", entry.size);
- debug(kDebugCore, " next: %08X\n", entry.next);
+ debugCN(kDebugCore, " filename: %s\n", entry.filename);
+ debugCN(kDebugCore, " hagfile: %d\n", entry.hagfile);
+ debugCN(kDebugCore, " disks: %d\n", entry.disks);
+ debugCN(kDebugCore, " offset: %08X\n", entry.offset);
+ debugCN(kDebugCore, " size: %d\n", entry.size);
+ debugCN(kDebugCore, " next: %08X\n", entry.next);
*/
_fileEntries[entry.filename] = entry;
}
@@ -90,7 +90,7 @@ FileSystem::FileSystem(const char *hashFilename) {
_hagEntries[entry.fileIndex].hagFile->open(_hagEntries[entry.fileIndex].filename);
if (!_hagEntries[entry.fileIndex].hagFile->isOpen()) {
- debug(kDebugCore, "FileSystem::FileSystem: error opening hag %s\n", _hagEntries[entry.fileIndex].filename);
+ debugCN(kDebugCore, "FileSystem::FileSystem: error opening hag %s\n", _hagEntries[entry.fileIndex].filename);
}
}
@@ -113,7 +113,7 @@ Common::SeekableReadStream *FileSystem::loadFile(const char *resourceName, bool
Common::SeekableReadStream *result = NULL;
if (hfe) {
- //debug(kDebugCore, "FileSystem::loadFile() success opening %s\n", filename);
+ //debugCN(kDebugCore, "FileSystem::loadFile() success opening %s\n", filename);
HashHagEntry *hagEntry = &_hagEntries[hfe->hagfile];
if (preloadFlag) {
@@ -128,7 +128,7 @@ Common::SeekableReadStream *FileSystem::loadFile(const char *resourceName, bool
hfe->offset + hfe->size);
} else {
- debug(kDebugCore, "FileSystem::loadFile() error opening %s\n", resourceName);
+ debugCN(kDebugCore, "FileSystem::loadFile() error opening %s\n", resourceName);
}
return result;
@@ -207,7 +207,7 @@ void ResourceManager::toss(const char *resourceName) {
if (!strcmp(r->name, resourceName)) {
r->flags |= kResourcePurge;
- //debug(kDebugCore, "M4ResourceManager::toss: mark resource %s to be purged\n", resourceName);
+ //debugCN(kDebugCore, "M4ResourceManager::toss: mark resource %s to be purged\n", resourceName);
}
}
}
@@ -510,7 +510,7 @@ M4ResourceManager::~M4ResourceManager() {
}
Common::SeekableReadStream *M4ResourceManager::loadResource(const char *resourceName, bool preloadFlag) {
- //debug(kDebugCore, "M4ResourceManager::loadResource() loading resource %s\n", resourceName);
+ //debugCN(kDebugCore, "M4ResourceManager::loadResource() loading resource %s\n", resourceName);
Common::SeekableReadStream* result = NULL;
if (_hfs) {
// actually load the resource
diff --git a/engines/m4/script.cpp b/engines/m4/script.cpp
index 21532c44f1..42d55c6dc7 100644
--- a/engines/m4/script.cpp
+++ b/engines/m4/script.cpp
@@ -121,7 +121,7 @@ SeriesStreamBreakList::~SeriesStreamBreakList() {
void SeriesStreamBreakList::load(Common::File *fd) {
uint32 count = fd->readUint32LE();
- debug(kDebugScript, "SeriesStreamBreakList::load() count = %d\n", count);
+ debugCN(kDebugScript, "SeriesStreamBreakList::load() count = %d\n", count);
for (uint32 i = 0; i < count; i++) {
SeriesStreamBreakItem *item = new SeriesStreamBreakItem();
item->frameNum = fd->readUint32LE();
@@ -135,7 +135,7 @@ void SeriesStreamBreakList::load(Common::File *fd) {
item->value = fd->readUint32LE();
_items.push_back(item);
- debug(kDebugScript, "%02d: frameNum = %d; digiName = %s; digiChannel = %d; digiVolume = %d; trigger = %d; flags = %d; variable = %d; value = %d\n",
+ debugCN(kDebugScript, "%02d: frameNum = %d; digiName = %s; digiChannel = %d; digiVolume = %d; trigger = %d; flags = %d; variable = %d; value = %d\n",
i, item->frameNum, item->digiName, item->digiChannel, item->digiVolume, item->trigger, item->flags, item->variable.value, item->value);
}
@@ -146,7 +146,7 @@ SaidArray::~SaidArray() {
void SaidArray::load(Common::File *fd) {
uint32 count = fd->readUint32LE();
- debug(kDebugScript, "SaidArray::load() count = %d\n", count);
+ debugCN(kDebugScript, "SaidArray::load() count = %d\n", count);
for (uint32 i = 0; i < count; i++) {
SaidArrayItem *item = new SaidArrayItem();
item->itemName = _inter->loadGlobalString(fd);
@@ -155,7 +155,7 @@ void SaidArray::load(Common::File *fd) {
item->digiNameGear = _inter->loadGlobalString(fd);
_items.push_back(item);
- debug(kDebugScript, "itemName = %s; digiNameLook = %s; digiNameTake = %s; digiNameGear = %s\n",
+ debugCN(kDebugScript, "itemName = %s; digiNameLook = %s; digiNameTake = %s; digiNameGear = %s\n",
item->itemName, item->digiNameLook, item->digiNameTake, item->digiNameGear);
}
@@ -166,7 +166,7 @@ ParserArray::~ParserArray() {
void ParserArray::load(Common::File *fd) {
uint32 count = fd->readUint32LE();
- debug(kDebugScript, "ParserArray::load() count = %d\n", count);
+ debugCN(kDebugScript, "ParserArray::load() count = %d\n", count);
for (uint32 i = 0; i < count; i++) {
ParserArrayItem *item = new ParserArrayItem();
item->w0 = _inter->loadGlobalString(fd);
@@ -180,7 +180,7 @@ void ParserArray::load(Common::File *fd) {
item->value = fd->readUint32LE();
_items.push_back(item);
- debug(kDebugScript, "w0 = %s; w1 = %s; trigger = %d; testVariable = %d; testValue = %d; variable = %d; value = %d\n",
+ debugCN(kDebugScript, "w0 = %s; w1 = %s; trigger = %d; testVariable = %d; testValue = %d; variable = %d; value = %d\n",
item->w0, item->w1, item->trigger, item->testVariable.value, item->testValue, item->variable.value, item->value);
}
@@ -194,9 +194,9 @@ ScriptFunction::~ScriptFunction() {
}
void ScriptFunction::load(Common::File *fd) {
- debug(kDebugScript, "ScriptFunction::load()\n");
+ debugCN(kDebugScript, "ScriptFunction::load()\n");
uint32 size = fd->readUint32LE();
- debug(kDebugScript, "ScriptFunction::load() size = %d\n", size);
+ debugCN(kDebugScript, "ScriptFunction::load() size = %d\n", size);
_code = fd->readStream(size);
}
@@ -243,16 +243,16 @@ void ScriptInterpreter::open(const char *filename) {
}
int functionCount = _scriptFile->readUint32LE();
- debug(kDebugScript, "functionCount = %d\n", functionCount);
+ debugCN(kDebugScript, "functionCount = %d\n", functionCount);
for (int i = 0; i < functionCount; i++) {
uint32 offset = _scriptFile->readUint32LE();
- debug(kDebugScript, "func(%d) offset = %08X\n", i, offset);
+ debugCN(kDebugScript, "func(%d) offset = %08X\n", i, offset);
uint32 len = _scriptFile->readUint32LE();
if (len > 0) {
char *funcName = new char[len + 1];
_scriptFile->read(funcName, len);
funcName[len] = '\0';
- debug(kDebugScript, "func(%d) name = %s\n", i, funcName);
+ debugCN(kDebugScript, "func(%d) name = %s\n", i, funcName);
_functionNames[Common::String(funcName)] = _functions.size();
// DEBUG
_scriptFunctionNames.push_back(Common::String(funcName));
@@ -262,16 +262,16 @@ void ScriptInterpreter::open(const char *filename) {
}
int dataCount = _scriptFile->readUint32LE();
- debug(kDebugScript, "dataCount = %d\n", dataCount);
+ debugCN(kDebugScript, "dataCount = %d\n", dataCount);
for (int i = 0; i < dataCount; i++) {
uint32 offset = _scriptFile->readUint32LE();
ScriptDataType type = (ScriptDataType)_scriptFile->readUint32LE();
- debug(kDebugScript, "data(%d) offset = %08X; type = %d\n", i, offset, type);
+ debugCN(kDebugScript, "data(%d) offset = %08X; type = %d\n", i, offset, type);
_data.push_back(new ScriptDataEntry(offset, type));
}
_globalVarCount = _scriptFile->readUint32LE();
- debug(kDebugScript, "_globalVarCount = %d\n", _globalVarCount);
+ debugCN(kDebugScript, "_globalVarCount = %d\n", _globalVarCount);
uint32 stringOfs = _scriptFile->readUint32LE();
_scriptFile->seek(stringOfs);
@@ -324,11 +324,11 @@ ScriptFunction *ScriptInterpreter::loadFunction(uint32 index) {
ScriptFunction *ScriptInterpreter::loadFunction(const Common::String &name) {
FunctionNameMap::iterator iter = _functionNames.find(name);
if (iter == _functionNames.end()) {
- debug(kDebugScript, "ScriptInterpreter::loadFunction() Function '%s' not found!\n", name.c_str());
+ debugCN(kDebugScript, "ScriptInterpreter::loadFunction() Function '%s' not found!\n", name.c_str());
return NULL;
}
uint32 funcIndex = (*iter)._value;
- debug(kDebugScript, "ScriptInterpreter::loadFunction() index('%s') = %d\n", name.c_str(), funcIndex);
+ debugCN(kDebugScript, "ScriptInterpreter::loadFunction() index('%s') = %d\n", name.c_str(), funcIndex);
return loadFunction(funcIndex);
}
@@ -375,24 +375,24 @@ void ScriptInterpreter::pop(ScriptValue &value) {
}
void ScriptInterpreter::dumpStack() {
- debug(kDebugScript, "ScriptInterpreter::dumpStack()\n");
+ debugCN(kDebugScript, "ScriptInterpreter::dumpStack()\n");
for (int i = 0; i < _stackPtr; i++) {
- debug(kDebugScript, "%03d. type = %02d; value = %d\n", i, _stack[i].type, _stack[i].value);
+ debugCN(kDebugScript, "%03d. type = %02d; value = %d\n", i, _stack[i].type, _stack[i].value);
}
}
void ScriptInterpreter::dumpRegisters() {
- debug(kDebugScript, "ScriptInterpreter::dumpRegisters()\n");
+ debugCN(kDebugScript, "ScriptInterpreter::dumpRegisters()\n");
for (int i = 0; i < ARRAYSIZE(_registers); i++) {
- debug(kDebugScript, "%03d. type = %02d; value = %d\n", i, _registers[i].type, _registers[i].value);
+ debugCN(kDebugScript, "%03d. type = %02d; value = %d\n", i, _registers[i].type, _registers[i].value);
}
}
void ScriptInterpreter::dumpGlobalVars() {
- debug(kDebugScript, "ScriptInterpreter::dumpGlobalVars()\n");
+ debugCN(kDebugScript, "ScriptInterpreter::dumpGlobalVars()\n");
for (int i = 0; i < ARRAYSIZE(_globalVars); i++) {
if (_globalVars[i].type != -1)
- debug(kDebugScript, "%03d. type = %02d; value = %d\n", i, _globalVars[i].type, _globalVars[i].value);
+ debugCN(kDebugScript, "%03d. type = %02d; value = %d\n", i, _globalVars[i].type, _globalVars[i].value);
}
}
@@ -404,7 +404,7 @@ int ScriptInterpreter::toInteger(const ScriptValue &value) {
return value.value;
default:
- debug(kDebugScript, "ScriptInterpreter::toInteger() Invalid type %d!\n", value.type);
+ debugCN(kDebugScript, "ScriptInterpreter::toInteger() Invalid type %d!\n", value.type);
return 0;
}
@@ -422,7 +422,7 @@ const char *ScriptInterpreter::toString(const ScriptValue &value) {
return _constStrings[value.value];
default:
- debug(kDebugScript, "ScriptInterpreter::toString() Invalid type %d!\n", value.type);
+ debugCN(kDebugScript, "ScriptInterpreter::toString() Invalid type %d!\n", value.type);
return NULL;
}
@@ -461,7 +461,7 @@ void ScriptInterpreter::loadValue(ScriptValue &value) {
break;
default:
- debug(kDebugScript, "ScriptInterpreter::loadValue() Invalid value type %d!\n", value.type);
+ debugCN(kDebugScript, "ScriptInterpreter::loadValue() Invalid value type %d!\n", value.type);
}
@@ -470,7 +470,7 @@ void ScriptInterpreter::loadValue(ScriptValue &value) {
void ScriptInterpreter::copyValue(ScriptValue &destValue, ScriptValue &sourceValue) {
if (sourceValue.type == -1) {
- debug(kDebugScript, "ScriptInterpreter::copyValue() Trying to read uninitialized value!\n");
+ debugCN(kDebugScript, "ScriptInterpreter::copyValue() Trying to read uninitialized value!\n");
}
switch (destValue.type) {
@@ -488,7 +488,7 @@ void ScriptInterpreter::copyValue(ScriptValue &destValue, ScriptValue &sourceVal
if (sourceValue.type == kInteger) {
_logicGlobals[destValue.value] = sourceValue.value;
} else {
- debug(kDebugScript, "ScriptInterpreter::copyValue() Invalid source value type %d!\n", sourceValue.type);
+ debugCN(kDebugScript, "ScriptInterpreter::copyValue() Invalid source value type %d!\n", sourceValue.type);
}
break;
@@ -497,7 +497,7 @@ void ScriptInterpreter::copyValue(ScriptValue &destValue, ScriptValue &sourceVal
break;
default:
- debug(kDebugScript, "ScriptInterpreter::copyValue() Invalid dest value type %d!\n", destValue.type);
+ debugCN(kDebugScript, "ScriptInterpreter::copyValue() Invalid dest value type %d!\n", destValue.type);
}
@@ -532,7 +532,7 @@ void ScriptInterpreter::derefValue(ScriptValue &value) {
break;
default:
- debug(kDebugScript, "ScriptInterpreter::derefValue() Invalid value type %d!\n", value.type);
+ debugCN(kDebugScript, "ScriptInterpreter::derefValue() Invalid value type %d!\n", value.type);
}
@@ -540,21 +540,21 @@ void ScriptInterpreter::derefValue(ScriptValue &value) {
void ScriptInterpreter::callKernelFunction(uint32 index) {
- debug(kDebugScript, "ScriptInterpreter::callKernelFunction() index = %d\n", index);
+ debugCN(kDebugScript, "ScriptInterpreter::callKernelFunction() index = %d\n", index);
if (index > _kernelFunctionsMax) {
- debug(kDebugScript, "ScriptInterpreter::callKernelFunction() Invalid kernel functionindex (%d)\n", index);
+ debugCN(kDebugScript, "ScriptInterpreter::callKernelFunction() Invalid kernel functionindex (%d)\n", index);
return;
}
- debug(kDebugScript, "ScriptInterpreter::callKernelFunction() name = %s\n", _kernelFunctions[index].desc);
+ debugCN(kDebugScript, "ScriptInterpreter::callKernelFunction() name = %s\n", _kernelFunctions[index].desc);
int args = (this->*(_kernelFunctions[index].proc))();
// Now remove values from the stack if the function used any
if (args > 4)
_stackPtr -= args - 4;
- debug(kDebugScript, "-------------\n");
+ debugCN(kDebugScript, "-------------\n");
}
@@ -568,29 +568,29 @@ ScriptValue ScriptInterpreter::getArg(uint32 index) {
}
void ScriptInterpreter::dumpArgs(uint32 count) {
- debug(kDebugScript, "ScriptInterpreter::dumpArgs() ");
+ debugCN(kDebugScript, "ScriptInterpreter::dumpArgs() ");
for (uint32 i = 0; i < count; i++) {
ScriptValue argValue = getArg(i);
if (argValue.type == kConstString) {
- debug(kDebugScript, "'%s'", toString(argValue));
+ debugCN(kDebugScript, "'%s'", toString(argValue));
} else {
- debug(kDebugScript, "%d", argValue.value);
+ debugCN(kDebugScript, "%d", argValue.value);
}
if (i + 1 < count)
- debug(kDebugScript, ", ");
+ debugCN(kDebugScript, ", ");
}
- debug(kDebugScript, "\n");
+ debugCN(kDebugScript, "\n");
}
void ScriptInterpreter::callFunction(uint32 index) {
// NOTE: This is a temporary hack for script functions not yet in the m4.dat
if (index == 0xFFFFFFFF)
return;
- debug(kDebugScript, "ScriptInterpreter::callFunction() index = %d [%s]\n", index, _scriptFunctionNames[index].c_str());
+ debugCN(kDebugScript, "ScriptInterpreter::callFunction() index = %d [%s]\n", index, _scriptFunctionNames[index].c_str());
ScriptFunction *subFunction = loadFunction(index);
if (!subFunction) {
// This *should* never happen since the linker checks this
- debug(kDebugScript, "ScriptInterpreter::callFunction() Function %d could not be loaded!\n", index);
+ debugCN(kDebugScript, "ScriptInterpreter::callFunction() Function %d could not be loaded!\n", index);
return;
}
runFunction(subFunction);
@@ -598,7 +598,7 @@ void ScriptInterpreter::callFunction(uint32 index) {
bool ScriptInterpreter::execOpcode(byte opcode) {
- debug(kDebugScript, "opcode = %d (%s)\n", opcode, opcodeNames[opcode]);
+ debugCN(kDebugScript, "opcode = %d (%s)\n", opcode, opcodeNames[opcode]);
ScriptValue value1, value2, value3;
uint32 temp;
@@ -647,14 +647,14 @@ bool ScriptInterpreter::execOpcode(byte opcode) {
case opJmp:
temp = _runningFunction->readUint32();
- debug(kDebugScript, "-> ofs = %08X\n", temp);
+ debugCN(kDebugScript, "-> ofs = %08X\n", temp);
_runningFunction->jumpAbsolute(temp);
return true;
case opJl:
temp = _runningFunction->readUint32();
if (_cmpFlags < 0) {
- debug(kDebugScript, "-> ofs = %08X\n", temp);
+ debugCN(kDebugScript, "-> ofs = %08X\n", temp);
_runningFunction->jumpAbsolute(temp);
}
return true;
@@ -662,7 +662,7 @@ bool ScriptInterpreter::execOpcode(byte opcode) {
case opJle:
temp = _runningFunction->readUint32();
if (_cmpFlags <= 0) {
- debug(kDebugScript, "-> ofs = %08X\n", temp);
+ debugCN(kDebugScript, "-> ofs = %08X\n", temp);
_runningFunction->jumpAbsolute(temp);
}
return true;
@@ -670,7 +670,7 @@ bool ScriptInterpreter::execOpcode(byte opcode) {
case opJg:
temp = _runningFunction->readUint32();
if (_cmpFlags > 0) {
- debug(kDebugScript, "-> ofs = %08X\n", temp);
+ debugCN(kDebugScript, "-> ofs = %08X\n", temp);
_runningFunction->jumpAbsolute(temp);
}
return true;
@@ -678,7 +678,7 @@ bool ScriptInterpreter::execOpcode(byte opcode) {
case opJge:
temp = _runningFunction->readUint32();
if (_cmpFlags >= 0) {
- debug(kDebugScript, "-> ofs = %08X\n", temp);
+ debugCN(kDebugScript, "-> ofs = %08X\n", temp);
_runningFunction->jumpAbsolute(temp);
}
return true;
@@ -686,7 +686,7 @@ bool ScriptInterpreter::execOpcode(byte opcode) {
case opJz:
temp = _runningFunction->readUint32();
if (_cmpFlags == 0) {
- debug(kDebugScript, "-> ofs = %08X\n", temp);
+ debugCN(kDebugScript, "-> ofs = %08X\n", temp);
_runningFunction->jumpAbsolute(temp);
}
return true;
@@ -694,17 +694,17 @@ bool ScriptInterpreter::execOpcode(byte opcode) {
case opJnz:
temp = _runningFunction->readUint32();
if (_cmpFlags != 0) {
- debug(kDebugScript, "-> ofs = %08X\n", temp);
+ debugCN(kDebugScript, "-> ofs = %08X\n", temp);
_runningFunction->jumpAbsolute(temp);
}
return true;
case opJmpByTable:
temp = _runningFunction->readUint32();
- debug(kDebugScript, "-> index = %d\n", _registers[0].value);
+ debugCN(kDebugScript, "-> index = %d\n", _registers[0].value);
_runningFunction->jumpRelative(_registers[0].value * 4);
temp = _runningFunction->readUint32();
- debug(kDebugScript, "-> ofs = %08X\n", temp);
+ debugCN(kDebugScript, "-> ofs = %08X\n", temp);
_runningFunction->jumpAbsolute(temp);
return true;
@@ -716,8 +716,8 @@ bool ScriptInterpreter::execOpcode(byte opcode) {
if (value1.type != kInteger || value2.type != kInteger)
warning("ScriptInterpreter::execOpcode() Trying to compare non-integer values (%d, %d, line %d)", value1.type, value2.type, _lineNum);
_cmpFlags = value1.value - value2.value;
- debug(kDebugScript, "-> cmp %d, %d\n", value1.value, value2.value);
- debug(kDebugScript, "-> _cmpFlags = %d\n", _cmpFlags);
+ debugCN(kDebugScript, "-> cmp %d, %d\n", value1.value, value2.value);
+ debugCN(kDebugScript, "-> _cmpFlags = %d\n", _cmpFlags);
return true;
case opCall:
@@ -771,7 +771,7 @@ bool ScriptInterpreter::execOpcode(byte opcode) {
return true;
default:
- debug(kDebugScript, "Invalid opcode %d!\n", opcode);
+ debugCN(kDebugScript, "Invalid opcode %d!\n", opcode);
return false;
}
@@ -920,14 +920,14 @@ int ScriptInterpreter::o1_wilburFinishedTalking() {
int ScriptInterpreter::o1_preloadSound() {
const char *name = STRING(0);
int room = INTEGER(1);
- debug(kDebugScript, "name = %s; room = %d\n", name, room);
+ debugCN(kDebugScript, "name = %s; room = %d\n", name, room);
return 2;
}
int ScriptInterpreter::o1_unloadSound() {
const char *name = STRING(0);
int room = INTEGER(1);
- debug(kDebugScript, "name = %s; room = %d\n", name, room);
+ debugCN(kDebugScript, "name = %s; room = %d\n", name, room);
return 2;
}
@@ -937,7 +937,7 @@ int ScriptInterpreter::o1_playSound() {
int volume = INTEGER(2);
int trigger = INTEGER(3);
int room = INTEGER(4);
- debug(kDebugScript, "name = %s; channel = %d; volume = %d; trigger = %d; room = %d\n",
+ debugCN(kDebugScript, "name = %s; channel = %d; volume = %d; trigger = %d; room = %d\n",
name, channel, volume, trigger, room);
Common::String soundName = Common::String(name) + ".raw";
@@ -955,7 +955,7 @@ int ScriptInterpreter::o1_playLoopingSound() {
int volume = INTEGER(2);
int trigger = INTEGER(3);
int room = INTEGER(4);
- debug(kDebugScript, "name = %s; channel = %d; volume = %d; trigger = %d; room = %d\n",
+ debugCN(kDebugScript, "name = %s; channel = %d; volume = %d; trigger = %d; room = %d\n",
name, channel, volume, trigger, room);
// HACK until fixed
@@ -966,14 +966,14 @@ int ScriptInterpreter::o1_playLoopingSound() {
int ScriptInterpreter::o1_stopSound() {
int channel = INTEGER(0);
- debug(kDebugScript, "channel = %d\n", channel);
+ debugCN(kDebugScript, "channel = %d\n", channel);
return 1;
}
int ScriptInterpreter::o1_fadeSetStart() {
// skip arg 0: palette ptr
int percent = INTEGER(1);
- debug(kDebugScript, "percent = %d\n", percent);
+ debugCN(kDebugScript, "percent = %d\n", percent);
return 2;
}
@@ -984,7 +984,7 @@ int ScriptInterpreter::o1_fadeInit() {
int percent = INTEGER(3);
int ticks = INTEGER(4);
int trigger = INTEGER(5);
- debug(kDebugScript, "first = %d; last = %d; percent = %d; ticks = %d; trigger = %d\n",
+ debugCN(kDebugScript, "first = %d; last = %d; percent = %d; ticks = %d; trigger = %d\n",
first, last, percent, ticks, trigger);
// HACK until palette fading is implemented
@@ -1003,7 +1003,7 @@ int ScriptInterpreter::o1_initPaletteCycle() {
int delay = INTEGER(2);
int ticks = INTEGER(3);
int trigger = INTEGER(4);
- debug(kDebugScript, "first = %d; last = %d; delay = %d; ticks = %d; trigger = %d\n",
+ debugCN(kDebugScript, "first = %d; last = %d; delay = %d; ticks = %d; trigger = %d\n",
first, last, delay, ticks, trigger);
// HACK until palette cycling is implemented
@@ -1020,11 +1020,11 @@ int ScriptInterpreter::o1_hasPlayerSaid() {
const char *words[3];
for (int i = 0; i < 3; i++)
words[i] = STRING(i);
- debug(kDebugScript, "'%s', '%s', '%s'\n", words[0], words[1], words[2]);
+ debugCN(kDebugScript, "'%s', '%s', '%s'\n", words[0], words[1], words[2]);
int result = _vm->_player->said(words[0], words[1], words[2]);
- debug(kDebugScript, " -> '%d'\n", result);
+ debugCN(kDebugScript, " -> '%d'\n", result);
RETURN(result);
return 3;
@@ -1035,11 +1035,11 @@ int ScriptInterpreter::o1_hasPlayerSaidAny() {
for (int i = 0; i < 10; i++)
words[i] = STRING(i);
- debug(kDebugScript, "'%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'\n",
+ debugCN(kDebugScript, "'%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'\n",
words[0], words[1], words[2], words[3], words[4], words[5], words[6], words[7], words[8], words[9]);
int result = _vm->_player->saidAny(words[0], words[1], words[2], words[3], words[4], words[5], words[6], words[7], words[8], words[9]);
- debug(kDebugScript, " -> '%d'\n", result);
+ debugCN(kDebugScript, " -> '%d'\n", result);
RETURN(result);
return 10;
@@ -1055,13 +1055,13 @@ int ScriptInterpreter::o1_playerHotspotWalkOverride() {
int y1 = INTEGER(1);
int x2 = INTEGER(2);
int y2 = INTEGER(3);
- debug(kDebugScript, "(%d, %d); (%d, %d)\n", x1, y1, x2, y2);
+ debugCN(kDebugScript, "(%d, %d); (%d, %d)\n", x1, y1, x2, y2);
return 4;
}
int ScriptInterpreter::o1_playerHasItem() {
const char *name = STRING(0);
- debug(kDebugScript, "item = '%s'\n", name);
+ debugCN(kDebugScript, "item = '%s'\n", name);
// TODO
RETURN(0);
return 1;
@@ -1071,14 +1071,14 @@ int ScriptInterpreter::o1_setWalkerLocation() {
// skip arg 0: walker
int x = INTEGER(1);
int y = INTEGER(2);
- debug(kDebugScript, "x = %d; y = %d\n", x, y);
+ debugCN(kDebugScript, "x = %d; y = %d\n", x, y);
return 3;
}
int ScriptInterpreter::o1_setWalkerFacing() {
// skip arg 0: walker
int facing = INTEGER(1);
- debug(kDebugScript, "facing = %d\n", facing);
+ debugCN(kDebugScript, "facing = %d\n", facing);
return 2;
}
@@ -1086,7 +1086,7 @@ int ScriptInterpreter::o1_setHotspot() {
// skip arg 0: hotspot list
const char *name = STRING(1);
int value = INTEGER(2);
- debug(kDebugScript, "name = '%s' -> %d\n", name, value);
+ debugCN(kDebugScript, "name = '%s' -> %d\n", name, value);
_vm->_scene->getSceneResources().hotspots->setActive(name, (value != 0));
@@ -1117,7 +1117,7 @@ int ScriptInterpreter::o1_playSeries() {
int firstFrame = INTEGER(9);
int lastFrame = INTEGER(10);
- debug(kDebugScript, "name = %s; layer = %04X; flags = %08X; trigger = %d; frameRate = %d; loopCount = %d; scale = %d; x = %d; y = %d: firstFrame = %d; lastFrame = %d\n",
+ debugCN(kDebugScript, "name = %s; layer = %04X; flags = %08X; trigger = %d; frameRate = %d; loopCount = %d; scale = %d; x = %d; y = %d: firstFrame = %d; lastFrame = %d\n",
name, layer, flags, trigger, frameRate, loopCount, scale, x, y, firstFrame, lastFrame);
// TODO: Return the machine to the script
@@ -1137,7 +1137,7 @@ int ScriptInterpreter::o1_showSeries() {
int x = INTEGER(7);
int y = INTEGER(8);
- debug(kDebugScript, "name = %s; layer = %04X; flags = %08X; trigger = %d; duration = %d; frameIndex = %d; scale = %d; x = %d; y = %d\n",
+ debugCN(kDebugScript, "name = %s; layer = %04X; flags = %08X; trigger = %d; duration = %d; frameIndex = %d; scale = %d; x = %d; y = %d\n",
name, layer, flags, trigger, duration, frameIndex, scale, x, y);
// TODO: Return the machine to the script
@@ -1151,7 +1151,7 @@ int ScriptInterpreter::o1_loadSeries() {
int hash = INTEGER(1);
// skip arg 3: palette ptr
- debug(kDebugScript, "name = %s; hash = %d\n", name, hash);
+ debugCN(kDebugScript, "name = %s; hash = %d\n", name, hash);
int result = _vm->_ws->loadSeries(name, hash, NULL);
@@ -1182,7 +1182,7 @@ int ScriptInterpreter::o1_globalTriggerProc() {
int value1 = INTEGER(0);
int value2 = INTEGER(1);
int value3 = INTEGER(2);
- debug(kDebugScript, "%d; %d; %d\n", value1, value2, value3);
+ debugCN(kDebugScript, "%d; %d; %d\n", value1, value2, value3);
return 3;
}
@@ -1190,13 +1190,13 @@ int ScriptInterpreter::o1_triggerTimerProc() {
int value1 = INTEGER(0);
int value2 = INTEGER(1);
int value3 = INTEGER(2);
- debug(kDebugScript, "%d; %d; %d\n", value1, value2, value3);
+ debugCN(kDebugScript, "%d; %d; %d\n", value1, value2, value3);
return 3;
}
int ScriptInterpreter::o1_dispatchTrigger() {
int trigger = INTEGER(0);
- debug(kDebugScript, "trigger = %d\n", trigger);
+ debugCN(kDebugScript, "trigger = %d\n", trigger);
_vm->_kernel->sendTrigger(trigger);
//g_system->delayMillis(5000);
@@ -1222,7 +1222,7 @@ int ScriptInterpreter::o1_wilburSaid() {
SaidArrayItem *item = saidArray[i];
if (_vm->_player->said("LOOK AT", item->itemName) && item->digiNameLook) {
- debug(kDebugScript, " -> LOOK AT: '%s'\n", item->digiNameLook);
+ debugCN(kDebugScript, " -> LOOK AT: '%s'\n", item->digiNameLook);
Common::String soundName = Common::String(item->digiNameLook) + ".raw";
_vm->_sound->playVoice(soundName.c_str(), 100);
result = 1;
@@ -1230,7 +1230,7 @@ int ScriptInterpreter::o1_wilburSaid() {
}
if (_vm->_player->said("TAKE", item->itemName) && item->digiNameTake) {
- debug(kDebugScript, " -> TAKE: '%s'\n", item->digiNameTake);
+ debugCN(kDebugScript, " -> TAKE: '%s'\n", item->digiNameTake);
Common::String soundName = Common::String(item->digiNameTake) + ".raw";
_vm->_sound->playVoice(soundName.c_str(), 100);
result = 1;
@@ -1238,7 +1238,7 @@ int ScriptInterpreter::o1_wilburSaid() {
}
if (_vm->_player->said("GEAR", item->itemName) && item->digiNameGear) {
- debug(kDebugScript, " -> GEAR: '%s'\n", item->digiNameGear);
+ debugCN(kDebugScript, " -> GEAR: '%s'\n", item->digiNameGear);
Common::String soundName = Common::String(item->digiNameGear) + ".raw";
_vm->_sound->playVoice(soundName.c_str(), 100);
result = 1;
@@ -1246,11 +1246,11 @@ int ScriptInterpreter::o1_wilburSaid() {
}
/*
- debug(kDebugScript, "##### itemName = '%s'; digiNameLook = %s; digiNameTake = %s; digiNameGear = %s\n",
+ debugCN(kDebugScript, "##### itemName = '%s'; digiNameLook = %s; digiNameTake = %s; digiNameGear = %s\n",
item->itemName, item->digiNameLook, item->digiNameTake, item->digiNameGear);
*/
}
- debug(kDebugScript, " -> '%d'\n", result);
+ debugCN(kDebugScript, " -> '%d'\n", result);
RETURN(result);
return 1;
@@ -1270,7 +1270,7 @@ int ScriptInterpreter::o1_wilburSpeech() {
int volume = INTEGER(4);
int slot = INTEGER(5);
- debug(kDebugScript, "%s; %d; %d; %d; %d; %d\n", name, trigger, room, flag, volume, slot);
+ debugCN(kDebugScript, "%s; %d; %d; %d; %d; %d\n", name, trigger, room, flag, volume, slot);
//g_system->delayMillis(5000);
KernelTriggerType oldTriggerMode = _vm->_kernel->triggerMode;
@@ -1288,14 +1288,14 @@ int ScriptInterpreter::o1_wilburSpeech() {
void ScriptInterpreter::getKernelVar(int index, ScriptValue &value) {
- debug(kDebugScript, "ScriptInterpreter::getKernelVar() index = %d\n", index);
+ debugCN(kDebugScript, "ScriptInterpreter::getKernelVar() index = %d\n", index);
if (index > _kernelVarsMax) {
- debug(kDebugScript, "ScriptInterpreter::getKernelVar() Invalid kernel var index %d!\n", index);
+ debugCN(kDebugScript, "ScriptInterpreter::getKernelVar() Invalid kernel var index %d!\n", index);
return;
}
- debug(kDebugScript, "ScriptInterpreter::getKernelVar() name = %s\n", _kernelVars[index].desc);
+ debugCN(kDebugScript, "ScriptInterpreter::getKernelVar() name = %s\n", _kernelVars[index].desc);
ScriptKernelVariable var = _kernelVars[index].var;
@@ -1333,7 +1333,7 @@ void ScriptInterpreter::getKernelVar(int index, ScriptValue &value) {
break;
default:
- debug(kDebugScript, "ScriptInterpreter::getKernelVar() Invalid kernel var %d!\n", var);
+ debugCN(kDebugScript, "ScriptInterpreter::getKernelVar() Invalid kernel var %d!\n", var);
//g_system->delayMillis(2000);
}
@@ -1342,14 +1342,14 @@ void ScriptInterpreter::getKernelVar(int index, ScriptValue &value) {
void ScriptInterpreter::setKernelVar(int index, const ScriptValue &value) {
- debug(kDebugScript, "ScriptInterpreter::setKernelVar() index = %d\n", index);
+ debugCN(kDebugScript, "ScriptInterpreter::setKernelVar() index = %d\n", index);
if (index > _kernelVarsMax) {
- debug(kDebugScript, "ScriptInterpreter::setKernelVar() Invalid kernel var index %d!\n", index);
+ debugCN(kDebugScript, "ScriptInterpreter::setKernelVar() Invalid kernel var index %d!\n", index);
return;
}
- debug(kDebugScript, "ScriptInterpreter::setKernelVar() name = %s\n", _kernelVars[index].desc);
+ debugCN(kDebugScript, "ScriptInterpreter::setKernelVar() name = %s\n", _kernelVars[index].desc);
ScriptKernelVariable var = _kernelVars[index].var;
@@ -1357,31 +1357,31 @@ void ScriptInterpreter::setKernelVar(int index, const ScriptValue &value) {
case kKernelTrigger:
_vm->_kernel->trigger = toInteger(value);
- debug(kDebugScript, "kKernelTrigger -> %d\n", toInteger(value));
+ debugCN(kDebugScript, "kKernelTrigger -> %d\n", toInteger(value));
break;
case kKernelTriggerMode:
_vm->_kernel->triggerMode = (KernelTriggerType)toInteger(value);
- debug(kDebugScript, "kKernelTrigger -> %d\n", toInteger(value));
+ debugCN(kDebugScript, "kKernelTrigger -> %d\n", toInteger(value));
break;
case kKernelContinueHandlingTrigger:
_vm->_kernel->daemonTriggerAvailable = (toInteger(value) != 0);
- debug(kDebugScript, "kKernelContinueHandlingTrigger -> %d\n", toInteger(value));
+ debugCN(kDebugScript, "kKernelContinueHandlingTrigger -> %d\n", toInteger(value));
break;
case kGameNewRoom:
_vm->_kernel->newRoom = toInteger(value);
- debug(kDebugScript, "kGameNewRoom -> %d\n", toInteger(value));
+ debugCN(kDebugScript, "kGameNewRoom -> %d\n", toInteger(value));
break;
case kPlayerCommandReady:
// TODO
- debug(kDebugScript, "kPlayerCommandReady -> %d\n", toInteger(value));
+ debugCN(kDebugScript, "kPlayerCommandReady -> %d\n", toInteger(value));
break;
default:
- debug(kDebugScript, "ScriptInterpreter::setKernelVar() Invalid kernel var %d!\n", var);
+ debugCN(kDebugScript, "ScriptInterpreter::setKernelVar() Invalid kernel var %d!\n", var);
//g_system->delayMillis(2000);
}
diff --git a/engines/m4/script.h b/engines/m4/script.h
index d57dbf2639..2012926330 100644
--- a/engines/m4/script.h
+++ b/engines/m4/script.h
@@ -305,7 +305,7 @@ public:
// Is this ok?
template<class T>
const T& toData(const ScriptValue &value) {
- debug(kDebugScript, "ScriptInterpreter::toData() index = %d; type = %d; max = %d\n", value.value, _data[value.value]->type, _data.size());
+ debugCN(kDebugScript, "ScriptInterpreter::toData() index = %d; type = %d; max = %d\n", value.value, _data[value.value]->type, _data.size());
assert((uint32)value.value < _data.size());
T *result = 0;
_dataCache->load(_scriptFile, _data[value.value]->offset, result);
diff --git a/engines/m4/woodscript.cpp b/engines/m4/woodscript.cpp
index 7dc734dab6..ccd3401d3c 100644
--- a/engines/m4/woodscript.cpp
+++ b/engines/m4/woodscript.cpp
@@ -46,7 +46,7 @@ Bytecode::~Bytecode() {
int Bytecode::loadInstruction(Instruction &instruction) {
- //debug(kDebugScript, "Bytecode::loadInstruction() ip = %08X\n", _code->pos());
+ //debugCN(kDebugScript, "Bytecode::loadInstruction() ip = %08X\n", _code->pos());
int32 format, data;
uint32 code, code2;
@@ -90,7 +90,7 @@ int Bytecode::loadInstruction(Instruction &instruction) {
void Bytecode::jumpAbsolute(int32 ofs) {
_code->seek(ofs * 4);
- //debug(kDebugScript, "Bytecode::jumpAbsolute() ofs = %08X\n", _code->pos());
+ //debugCN(kDebugScript, "Bytecode::jumpAbsolute() ofs = %08X\n", _code->pos());
}
void Bytecode::jumpRelative(int32 ofs) {
@@ -200,7 +200,7 @@ void WoodScript::runTimerSequenceRequests() {
Machine *WoodScript::createMachine(int32 machineHash, Sequence *parentSeq,
int32 dataHash, int32 dataRowIndex, int callbackHandler, const char *machineName) {
- //debug(kDebugScript, "WoodScript::createMachine(%d)\n", machineHash);
+ //debugCN(kDebugScript, "WoodScript::createMachine(%d)\n", machineHash);
Machine *machine = new Machine(this, machineHash, parentSeq, dataHash, dataRowIndex, callbackHandler, machineName, _machineId);
_machineId++;
@@ -228,7 +228,7 @@ Machine *WoodScript::playSeries(const char *seriesName, long layer, uint32 flags
int32 frameRate, int32 loopCount, int32 s, int32 x, int32 y,
int32 firstFrame, int32 lastFrame) {
- //debug(kDebugScript, "WoodScript::playSeries(%s)\n", seriesName);
+ //debugCN(kDebugScript, "WoodScript::playSeries(%s)\n", seriesName);
RGB8 *palette = NULL;
if (flags & SERIES_LOAD_PALETTE)
@@ -282,7 +282,7 @@ Machine *WoodScript::showSeries(const char *seriesName, long layer, uint32 flags
}
Machine *WoodScript::streamSeries(const char *seriesName, int32 frameRate, long layer, int32 triggerNum) {
- //debug(kDebugScript, "WoodScript::streamSeries(%s)\n", seriesName);
+ //debugCN(kDebugScript, "WoodScript::streamSeries(%s)\n", seriesName);
_globals[kGlobTemp1] = frameRate << 16;
/* FIXME: Single frames from a stream series will be decompressed on-the-fly, contrary to
"normal" sprite series, to save some memory, and since no random access to single
diff --git a/engines/m4/ws_machine.cpp b/engines/m4/ws_machine.cpp
index 184d9847ab..3a25e3c622 100644
--- a/engines/m4/ws_machine.cpp
+++ b/engines/m4/ws_machine.cpp
@@ -147,7 +147,7 @@ void Machine::enterState() {
int32 Machine::execInstruction() {
- //debug(kDebugScript, "Machine::execInstruction()\n");
+ //debugCN(kDebugScript, "Machine::execInstruction()\n");
bool done = false;
Instruction instruction;
@@ -203,7 +203,7 @@ void Machine::execBlock(int32 offset, int32 count) {
int32 instruction = -1;
- //debug(kDebugScript, "---------------------------------------\n");
+ //debugCN(kDebugScript, "---------------------------------------\n");
while (instruction && instruction != 4 && _id == oldId && _recursionLevel == oldRecursionLevel &&
_code->pos() >= (uint32)startOffset && _code->pos() < (uint32)endOffset) {
@@ -212,7 +212,7 @@ void Machine::execBlock(int32 offset, int32 count) {
//g_system->delayMillis(500);
}
- //debug(kDebugScript, "---------------------------------------\n");
+ //debugCN(kDebugScript, "---------------------------------------\n");
if (instruction == 3) {
execInstruction();
@@ -225,7 +225,7 @@ void Machine::execBlock(int32 offset, int32 count) {
}
bool Machine::m1_gotoState(Instruction &instruction) {
- //debug(kDebugScript, "Machine::m1_gotoState() state = %d\n", (int32)instruction.argv[0] >> 16);
+ //debugCN(kDebugScript, "Machine::m1_gotoState() state = %d\n", (int32)instruction.argv[0] >> 16);
_currentState = (int32)instruction.argv[0] >> 16;
_recursionLevel = 0;
@@ -233,14 +233,14 @@ bool Machine::m1_gotoState(Instruction &instruction) {
}
bool Machine::m1_jump(Instruction &instruction) {
- //debug(kDebugScript, "Machine::m1_jump() ofs = %08X\n", (int32)instruction.argv[0] >> 16);
+ //debugCN(kDebugScript, "Machine::m1_jump() ofs = %08X\n", (int32)instruction.argv[0] >> 16);
_code->jumpRelative((int32)instruction.argv[0] >> 16);
return true;
}
bool Machine::m1_terminate(Instruction &instruction) {
- //debug(kDebugScript, "Machine::m1_terminate()\n");
+ //debugCN(kDebugScript, "Machine::m1_terminate()\n");
_currentState = -1;
_recursionLevel = 0;
@@ -248,15 +248,15 @@ bool Machine::m1_terminate(Instruction &instruction) {
}
bool Machine::m1_startSequence(Instruction &instruction) {
- //debug(kDebugScript, "Machine::m1_startSequence() sequence hash = %d\n", (uint32)instruction.argv[0] >> 16);
+ //debugCN(kDebugScript, "Machine::m1_startSequence() sequence hash = %d\n", (uint32)instruction.argv[0] >> 16);
int32 sequenceHash = instruction.argv[0] >> 16;
if (_sequence == NULL) {
- //debug(kDebugScript, "Machine::m1_startSequence() creating new sequence\n");
+ //debugCN(kDebugScript, "Machine::m1_startSequence() creating new sequence\n");
_sequence = _ws->createSequence(this, sequenceHash);
_code->setSequence(_sequence);
} else {
- //debug(kDebugScript, "Machine::m1_startSequence() using existing sequence\n");
+ //debugCN(kDebugScript, "Machine::m1_startSequence() using existing sequence\n");
_sequence->changeProgram(sequenceHash);
//_code->setSequence(_sequence);
}
@@ -264,28 +264,28 @@ bool Machine::m1_startSequence(Instruction &instruction) {
}
bool Machine::m1_pauseSequence(Instruction &instruction) {
- //debug(kDebugScript, "Machine::m1_pauseSequence()\n");
+ //debugCN(kDebugScript, "Machine::m1_pauseSequence()\n");
_sequence->pause();
return true;
}
bool Machine::m1_resumeSequence(Instruction &instruction) {
- //debug(kDebugScript, "Machine::m1_resumeSequence()\n");
+ //debugCN(kDebugScript, "Machine::m1_resumeSequence()\n");
_sequence->resume();
return true;
}
bool Machine::m1_storeValue(Instruction &instruction) {
- //debug(kDebugScript, "Machine::m1_storeValue() %p = %d (%08X)\n", (void*)instruction.argp[0], (uint32)instruction.argv[1], (uint32)instruction.argv[1]);
+ //debugCN(kDebugScript, "Machine::m1_storeValue() %p = %d (%08X)\n", (void*)instruction.argp[0], (uint32)instruction.argv[1], (uint32)instruction.argv[1]);
*instruction.argp[0] = instruction.getValue();
return true;
}
bool Machine::m1_sendMessage(Instruction &instruction) {
- //debug(kDebugScript, "Machine::m1_sendMessage() %p = %d (%08X)\n", (void*)instruction.argp[0], (uint32)instruction.argv[1], (uint32)instruction.argv[1]);
+ //debugCN(kDebugScript, "Machine::m1_sendMessage() %p = %d (%08X)\n", (void*)instruction.argp[0], (uint32)instruction.argv[1], (uint32)instruction.argv[1]);
#if 0
//TODO
@@ -304,7 +304,7 @@ bool Machine::m1_sendMessage(Instruction &instruction) {
}
bool Machine::m1_broadcastMessage(Instruction &instruction) {
- //debug(kDebugScript, "Machine::m1_broadcastMessage() %p = %d (%08X)\n", (void*)instruction.argp[0], (uint32)instruction.argv[1], (uint32)instruction.argv[1]);
+ //debugCN(kDebugScript, "Machine::m1_broadcastMessage() %p = %d (%08X)\n", (void*)instruction.argp[0], (uint32)instruction.argv[1], (uint32)instruction.argv[1]);
#if 0
//TODO
@@ -321,7 +321,7 @@ bool Machine::m1_broadcastMessage(Instruction &instruction) {
}
bool Machine::m1_replyMessage(Instruction &instruction) {
- //debug(kDebugScript, "Machine::m1_replyMessage() messageHash = %d; messageValue = %d\n", (uint32)instruction.argv[0], (uint32)instruction.argv[1]);
+ //debugCN(kDebugScript, "Machine::m1_replyMessage() messageHash = %d; messageValue = %d\n", (uint32)instruction.argv[0], (uint32)instruction.argv[1]);
#if 0
if (myArg2) {
msgValue = *myArg2;
@@ -335,28 +335,28 @@ bool Machine::m1_replyMessage(Instruction &instruction) {
}
bool Machine::m1_sendSystemMessage(Instruction &instruction) {
- //debug(kDebugScript, "Machine::m1_sendSystemMessage() messageValue = %d\n", (uint32)instruction.argv[0]);
+ //debugCN(kDebugScript, "Machine::m1_sendSystemMessage() messageValue = %d\n", (uint32)instruction.argv[0]);
#if 0
#endif
return true;
}
bool Machine::m1_createMachine(Instruction &instruction) {
- //debug(kDebugScript, "Machine::m1_createMachine()\n");
+ //debugCN(kDebugScript, "Machine::m1_createMachine()\n");
#if 0
#endif
return true;
}
bool Machine::m1_createMachineEx(Instruction &instruction) {
- //debug(kDebugScript, "Machine::m1_createMachineEx()\n");
+ //debugCN(kDebugScript, "Machine::m1_createMachineEx()\n");
#if 0
#endif
return true;
}
bool Machine::m1_clearVars(Instruction &instruction) {
- //debug(kDebugScript, "Machine::m1_clearVars()\n");
+ //debugCN(kDebugScript, "Machine::m1_clearVars()\n");
_sequence->clearVars();
return true;
@@ -364,7 +364,7 @@ bool Machine::m1_clearVars(Instruction &instruction) {
void Machine::m1_onEndSequence(Instruction &instruction) {
- //debug(kDebugScript, "Machine::m1_onEndSequence() count = %08X\n", (uint32)instruction.argv[0] >> 16);
+ //debugCN(kDebugScript, "Machine::m1_onEndSequence() count = %08X\n", (uint32)instruction.argv[0] >> 16);
int32 count = instruction.argv[0] >> 16;
_sequence->issueEndOfSequenceRequest(_code->pos(), count);
@@ -372,7 +372,7 @@ void Machine::m1_onEndSequence(Instruction &instruction) {
}
void Machine::m1_onMessage(Instruction &instruction) {
- //debug(kDebugScript, "Machine::m1_onEndSequence() count = %08X\n", (uint32)instruction.argv[0] >> 16);
+ //debugCN(kDebugScript, "Machine::m1_onEndSequence() count = %08X\n", (uint32)instruction.argv[0] >> 16);
// TODO: Add message to list
@@ -382,42 +382,42 @@ void Machine::m1_onMessage(Instruction &instruction) {
}
void Machine::m1_switchLt(Instruction &instruction) {
- //debug(kDebugScript, "Machine::m1_switchLt() %d < %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
+ //debugCN(kDebugScript, "Machine::m1_switchLt() %d < %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
if (instruction.argv[1] >= instruction.argv[2])
_code->jumpRelative(instruction.argv[0] >> 16);
}
void Machine::m1_switchLe(Instruction &instruction) {
- //debug(kDebugScript, "Machine::m1_switchLe() %d <= %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
+ //debugCN(kDebugScript, "Machine::m1_switchLe() %d <= %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
if (instruction.argv[1] > instruction.argv[2])
_code->jumpRelative(instruction.argv[0] >> 16);
}
void Machine::m1_switchEq(Instruction &instruction) {
- //debug(kDebugScript, "Machine::m1_switchEq() %d == %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
+ //debugCN(kDebugScript, "Machine::m1_switchEq() %d == %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
if (instruction.argv[1] != instruction.argv[2])
_code->jumpRelative(instruction.argv[0] >> 16);
}
void Machine::m1_switchNe(Instruction &instruction) {
- //debug(kDebugScript, "Machine::m1_switchNe() %d != %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
+ //debugCN(kDebugScript, "Machine::m1_switchNe() %d != %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
if (instruction.argv[1] == instruction.argv[2])
_code->jumpRelative(instruction.argv[0] >> 16);
}
void Machine::m1_switchGe(Instruction &instruction) {
- //debug(kDebugScript, "Machine::m1_switchGe() %d >= %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
+ //debugCN(kDebugScript, "Machine::m1_switchGe() %d >= %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
if (instruction.argv[1] < instruction.argv[2])
_code->jumpRelative(instruction.argv[0] >> 16);
}
void Machine::m1_switchGt(Instruction &instruction) {
- //debug(kDebugScript, "Machine::m1_switchGt() %d > %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
+ //debugCN(kDebugScript, "Machine::m1_switchGt() %d > %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
if (instruction.argv[1] <= instruction.argv[2])
_code->jumpRelative(instruction.argv[0] >> 16);
diff --git a/engines/m4/ws_sequence.cpp b/engines/m4/ws_sequence.cpp
index b45af2eebc..bb6230d041 100644
--- a/engines/m4/ws_sequence.cpp
+++ b/engines/m4/ws_sequence.cpp
@@ -201,7 +201,7 @@ void Sequence::resume() {
void Sequence::issueEndOfSequenceRequest(int32 codeOffset, int32 count) {
- //debug(kDebugScript, "Sequence::issueEndOfSequenceRequest(%04X, %04X)\n", codeOffset, count);
+ //debugCN(kDebugScript, "Sequence::issueEndOfSequenceRequest(%04X, %04X)\n", codeOffset, count);
//g_system->delayMillis(5000);
_endOfSequenceRequest.codeOffset = codeOffset;
@@ -216,7 +216,7 @@ bool Sequence::runProgram() {
bool done = true;
- //debug(kDebugScript, "_ws->getGlobal(kGlobTime) = %ld, _switchTime = %d\n", _ws->getGlobal(kGlobTime), _switchTime);
+ //debugCN(kDebugScript, "_ws->getGlobal(kGlobTime) = %ld, _switchTime = %d\n", _ws->getGlobal(kGlobTime), _switchTime);
if (_switchTime >= 0 && _ws->getGlobal(kGlobTime) >= _switchTime)
done = false;
@@ -248,7 +248,7 @@ bool Sequence::changeProgram(int32 sequenceHash) {
SequenceAsset *sequenceAsset = _ws->assets()->getSequence(sequenceHash);
if (sequenceAsset->localVarCount() > _localVarCount) {
- //debug(kDebugScript, "Sequence::changeProgram(%d) sequenceAsset->localVarCount() > _localVarCount\n", sequenceHash);
+ //debugCN(kDebugScript, "Sequence::changeProgram(%d) sequenceAsset->localVarCount() > _localVarCount\n", sequenceHash);
return false;
}
@@ -303,14 +303,14 @@ void Sequence::draw(M4Surface *surface, const Common::Rect &clipRect, Common::Re
}
bool Sequence::s1_end(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_end()\n");
+ //debugCN(kDebugScript, "Sequence::s1_end()\n");
_terminated = true;
return false;
}
bool Sequence::s1_clearVars(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_clearVars()\n");
+ //debugCN(kDebugScript, "Sequence::s1_clearVars()\n");
clearVars();
_vars[kSeqVarMachineID] = _machine->getId();
@@ -318,14 +318,14 @@ bool Sequence::s1_clearVars(Instruction &instruction) {
}
bool Sequence::s1_set(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_set()\n");
+ //debugCN(kDebugScript, "Sequence::s1_set()\n");
*instruction.argp[0] = instruction.getValue();
return true;
}
bool Sequence::s1_compare(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_compare()\n");
+ //debugCN(kDebugScript, "Sequence::s1_compare()\n");
long value = instruction.getValue();
if (instruction.argv[0] < value)
@@ -338,28 +338,28 @@ bool Sequence::s1_compare(Instruction &instruction) {
}
bool Sequence::s1_add(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_add()\n");
+ //debugCN(kDebugScript, "Sequence::s1_add()\n");
*instruction.argp[0] += instruction.getValue();
return true;
}
bool Sequence::s1_sub(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_sub()\n");
+ //debugCN(kDebugScript, "Sequence::s1_sub()\n");
*instruction.argp[0] -= instruction.getValue();
return true;
}
bool Sequence::s1_mul(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_mul()\n");
+ //debugCN(kDebugScript, "Sequence::s1_mul()\n");
*instruction.argp[0] = FixedMul(instruction.argv[0], instruction.getValue());
return true;
}
bool Sequence::s1_div(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_div()\n");
+ //debugCN(kDebugScript, "Sequence::s1_div()\n");
// TODO: Catch divisor = 0 in FixedDiv
*instruction.argp[0] = FixedDiv(instruction.argv[0], instruction.getValue());
@@ -367,7 +367,7 @@ bool Sequence::s1_div(Instruction &instruction) {
}
bool Sequence::s1_and(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_and()\n");
+ //debugCN(kDebugScript, "Sequence::s1_and()\n");
*instruction.argp[0] = instruction.argv[0] & instruction.getValue();
if (*instruction.argp[0])
@@ -378,7 +378,7 @@ bool Sequence::s1_and(Instruction &instruction) {
}
bool Sequence::s1_or(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_or()\n");
+ //debugCN(kDebugScript, "Sequence::s1_or()\n");
*instruction.argp[0] = instruction.argv[0] | instruction.getValue();
if (*instruction.argp[0])
@@ -389,7 +389,7 @@ bool Sequence::s1_or(Instruction &instruction) {
}
bool Sequence::s1_not(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_not()\n");
+ //debugCN(kDebugScript, "Sequence::s1_not()\n");
if (instruction.argv[0] == 0) {
*instruction.argp[0] = 0x10000;
@@ -402,7 +402,7 @@ bool Sequence::s1_not(Instruction &instruction) {
}
bool Sequence::s1_sin(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_sin()\n");
+ //debugCN(kDebugScript, "Sequence::s1_sin()\n");
int32 tempAngle = *instruction.argp[1] >> 16;
if (tempAngle < 0)
@@ -419,7 +419,7 @@ bool Sequence::s1_sin(Instruction &instruction) {
}
bool Sequence::s1_cos(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_cos()\n");
+ //debugCN(kDebugScript, "Sequence::s1_cos()\n");
int32 tempAngle = *instruction.argp[1] >> 16;
if (tempAngle < 0)
@@ -436,42 +436,42 @@ bool Sequence::s1_cos(Instruction &instruction) {
}
bool Sequence::s1_abs(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_abs()\n");
+ //debugCN(kDebugScript, "Sequence::s1_abs()\n");
*instruction.argp[0] = ABS(instruction.argv[1]);
return true;
}
bool Sequence::s1_min(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_min()\n");
+ //debugCN(kDebugScript, "Sequence::s1_min()\n");
*instruction.argp[0] = MIN(instruction.argv[1], instruction.argv[2]);
return true;
}
bool Sequence::s1_max(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_max()\n");
+ //debugCN(kDebugScript, "Sequence::s1_max()\n");
*instruction.argp[0] = MAX(instruction.argv[1], instruction.argv[2]);
return true;
}
bool Sequence::s1_mod(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_mod()\n");
+ //debugCN(kDebugScript, "Sequence::s1_mod()\n");
*instruction.argp[0] = instruction.argv[0] % instruction.getValue();
return true;
}
bool Sequence::s1_floor(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_floor()\n");
+ //debugCN(kDebugScript, "Sequence::s1_floor()\n");
*instruction.argp[0] = instruction.getValue() & 0xffff0000;
return true;
}
bool Sequence::s1_round(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_round()\n");
+ //debugCN(kDebugScript, "Sequence::s1_round()\n");
if ((*instruction.argp[1] & 0xffff) >= 0x8000)
*instruction.argp[0] = (*instruction.argp[1] + 0x10000) & 0xffff0000;
@@ -481,7 +481,7 @@ bool Sequence::s1_round(Instruction &instruction) {
}
bool Sequence::s1_ceil(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_ceil()\n");
+ //debugCN(kDebugScript, "Sequence::s1_ceil()\n");
if ((*instruction.argp[1] & 0xffff) >= 0)
*instruction.argp[0] = (*instruction.argp[1] + 0x10000) & 0xffff0000;
@@ -491,19 +491,19 @@ bool Sequence::s1_ceil(Instruction &instruction) {
}
bool Sequence::s1_point(Instruction &instruction) {
- debug(kDebugScript, "Sequence::s1_point()\n");
+ debugCN(kDebugScript, "Sequence::s1_point()\n");
// TODO
return true;
}
bool Sequence::s1_dist2d(Instruction &instruction) {
- debug(kDebugScript, "Sequence::s1_dist2d()\n");
+ debugCN(kDebugScript, "Sequence::s1_dist2d()\n");
// TODO
return true;
}
bool Sequence::s1_crunch(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_crunch()\n");
+ //debugCN(kDebugScript, "Sequence::s1_crunch()\n");
long deltaTime;
@@ -517,12 +517,12 @@ bool Sequence::s1_crunch(Instruction &instruction) {
_startTime = _ws->getGlobal(kGlobTime);
- //debug(kDebugScript, "deltaTime = %ld\n", deltaTime >> 16);
+ //debugCN(kDebugScript, "deltaTime = %ld\n", deltaTime >> 16);
//g_system->delayMillis(5000);
if (deltaTime >= 0) {
_switchTime = _ws->getGlobal(kGlobTime) + (deltaTime >> 16);
- //debug(kDebugScript, "_ws->getGlobal(kGlobTime) = %ld\n", _ws->getGlobal(kGlobTime));
+ //debugCN(kDebugScript, "_ws->getGlobal(kGlobTime) = %ld\n", _ws->getGlobal(kGlobTime));
//g_system->delayMillis(5000);
} else {
_switchTime = -1;
@@ -534,7 +534,7 @@ bool Sequence::s1_crunch(Instruction &instruction) {
}
bool Sequence::s1_branch(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_branch()\n");
+ //debugCN(kDebugScript, "Sequence::s1_branch()\n");
uint32 ofs = instruction.argv[1] >> 16;
switch (instruction.argv[0] >> 16) {
@@ -571,7 +571,7 @@ bool Sequence::s1_branch(Instruction &instruction) {
}
bool Sequence::s1_setFrame(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_setFrame()\n");
+ //debugCN(kDebugScript, "Sequence::s1_setFrame()\n");
int32 frameIndex;
if (instruction.argc == 3) {
@@ -582,8 +582,8 @@ bool Sequence::s1_setFrame(Instruction &instruction) {
frameIndex = (instruction.argv[0] & 0xFF0000) >> 16;
}
- //debug(kDebugScript, "Sequence::s1_setFrame() spriteHash = %d\n", (uint32)instruction.argv[0] >> 24);
- //debug(kDebugScript, "Sequence::s1_setFrame() frameIndex = %d\n", frameIndex);
+ //debugCN(kDebugScript, "Sequence::s1_setFrame() spriteHash = %d\n", (uint32)instruction.argv[0] >> 24);
+ //debugCN(kDebugScript, "Sequence::s1_setFrame() frameIndex = %d\n", frameIndex);
SpriteAsset *spriteAsset = _ws->assets()->getSprite((uint32)instruction.argv[0] >> 24);
_curFrame = spriteAsset->getFrame(frameIndex);
@@ -592,25 +592,25 @@ bool Sequence::s1_setFrame(Instruction &instruction) {
}
bool Sequence::s1_sendMessage(Instruction &instruction) {
- debug(kDebugScript, "Sequence::s1_sendMessage()\n");
+ debugCN(kDebugScript, "Sequence::s1_sendMessage()\n");
// TODO
return true;
}
bool Sequence::s1_push(Instruction &instruction) {
- debug(kDebugScript, "Sequence::s1_push()\n");
+ debugCN(kDebugScript, "Sequence::s1_push()\n");
// TODO
return true;
}
bool Sequence::s1_pop(Instruction &instruction) {
- debug(kDebugScript, "Sequence::s1_pop()\n");
+ debugCN(kDebugScript, "Sequence::s1_pop()\n");
// TODO
return true;
}
bool Sequence::s1_jumpSub(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_jumpSub()\n");
+ //debugCN(kDebugScript, "Sequence::s1_jumpSub()\n");
_returnHashes[_returnStackIndex] = _sequenceHash;
_returnOffsets[_returnStackIndex] = _code->pos();
@@ -630,7 +630,7 @@ bool Sequence::s1_jumpSub(Instruction &instruction) {
}
bool Sequence::s1_return(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_return()\n");
+ //debugCN(kDebugScript, "Sequence::s1_return()\n");
if (_returnStackIndex <= 0)
return s1_end(instruction);
@@ -654,7 +654,7 @@ bool Sequence::s1_return(Instruction &instruction) {
}
bool Sequence::s1_getFrameCount(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_getFrameCount()\n");
+ //debugCN(kDebugScript, "Sequence::s1_getFrameCount()\n");
SpriteAsset *spriteAsset = _ws->assets()->getSprite(instruction.argv[1] >> 24);
*instruction.argp[0] = spriteAsset->getCount() << 16;
@@ -662,7 +662,7 @@ bool Sequence::s1_getFrameCount(Instruction &instruction) {
}
bool Sequence::s1_getFrameRate(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_getFrameRate()\n");
+ //debugCN(kDebugScript, "Sequence::s1_getFrameRate()\n");
SpriteAsset *spriteAsset = _ws->assets()->getSprite(instruction.argv[1] >> 24);
*instruction.argp[0] = spriteAsset->getFrameRate();
@@ -670,37 +670,37 @@ bool Sequence::s1_getFrameRate(Instruction &instruction) {
}
bool Sequence::s1_getCelsPixSpeed(Instruction &instruction) {
- debug(kDebugScript, "Sequence::s1_getCelsPixSpeed()\n");
+ debugCN(kDebugScript, "Sequence::s1_getCelsPixSpeed()\n");
// TODO
return true;
}
bool Sequence::s1_setIndex(Instruction &instruction) {
- debug(kDebugScript, "Sequence::s1_setIndex()\n");
+ debugCN(kDebugScript, "Sequence::s1_setIndex()\n");
// TODO
return true;
}
bool Sequence::s1_setLayer(Instruction &instruction) {
- debug(kDebugScript, "Sequence::s1_setLayer()\n");
+ debugCN(kDebugScript, "Sequence::s1_setLayer()\n");
//TODO
return true;
}
bool Sequence::s1_setDepth(Instruction &instruction) {
- debug(kDebugScript, "Sequence::s1_setDepth()\n");
+ debugCN(kDebugScript, "Sequence::s1_setDepth()\n");
//TODO
return true;
}
bool Sequence::s1_setData(Instruction &instruction) {
- debug(kDebugScript, "Sequence::s1_setData()\n");
+ debugCN(kDebugScript, "Sequence::s1_setData()\n");
//TODO
return true;
}
bool Sequence::s1_openStream(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_openStream()\n");
+ //debugCN(kDebugScript, "Sequence::s1_openStream()\n");
_stream = _vm->res()->openFile(_machine->name().c_str());
streamOpen();
@@ -708,14 +708,14 @@ bool Sequence::s1_openStream(Instruction &instruction) {
}
bool Sequence::s1_streamNextFrame(Instruction &instruction) {
- //debug(kDebugScript, "Sequence::s1_streamNextFrame()\n");
+ //debugCN(kDebugScript, "Sequence::s1_streamNextFrame()\n");
streamNextFrame();
return true;
}
bool Sequence::s1_closeStream(Instruction &instruction) {
- debug(kDebugScript, "Sequence::s1_closeStream()\n");
+ debugCN(kDebugScript, "Sequence::s1_closeStream()\n");
//TODO
return true;
}
@@ -728,7 +728,7 @@ bool Sequence::streamOpen() {
_vars[kSeqVarSpriteFrameCount] = _streamSpriteAsset->getCount() << 16;
_vars[kSeqVarSpriteFrameRate] = _streamSpriteAsset->getFrameRate() << 16;
- //debug(kDebugScript, "Sequence::streamOpen() frames = %d; max = %d x %d\n", _streamSpriteAsset->getCount(), _streamSpriteAsset->getMaxFrameWidth(), _streamSpriteAsset->getMaxFrameHeight());
+ //debugCN(kDebugScript, "Sequence::streamOpen() frames = %d; max = %d x %d\n", _streamSpriteAsset->getCount(), _streamSpriteAsset->getMaxFrameWidth(), _streamSpriteAsset->getMaxFrameHeight());
_curFrame = new M4Sprite(_vm, _streamSpriteAsset->getMaxFrameWidth(), _streamSpriteAsset->getMaxFrameHeight());
streamNextFrame();