aboutsummaryrefslogtreecommitdiff
path: root/engines/director/lingo/lingo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/director/lingo/lingo.cpp')
-rw-r--r--engines/director/lingo/lingo.cpp47
1 files changed, 38 insertions, 9 deletions
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 9aea9593e9..d37da42670 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -121,17 +121,17 @@ const char *Lingo::findNextDefinition(const char *s) {
return NULL;
if (!strncmp(res, "macro ", 6)) {
- warning("See macro");
+ debugC(3, kDebugLingoCompile, "See macro");
return res;
}
if (!strncmp(res, "factory ", 8)) {
- warning("See factory");
+ debugC(3, kDebugLingoCompile, "See factory");
return res;
}
if (!strncmp(res, "method ", 7)) {
- warning("See method");
+ debugC(3, kDebugLingoCompile, "See method");
return res;
}
@@ -181,6 +181,14 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
parse(chunk.c_str());
+ if (debugChannelSet(3, kDebugLingoCompile)) {
+ int pc = 0;
+ while (pc < _currentScript->size()) {
+ Common::String instr = decodeInstruction(pc, &pc);
+ debugC(3, kDebugLingoCompile, "[%5d] %s", pc, instr.c_str());
+ }
+ }
+
_currentScript->clear();
begin = end;
@@ -198,8 +206,16 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
_inFactory = false;
- if (_currentScript->size() && !_hadError)
- Common::hexdump((byte *)&_currentScript->front(), _currentScript->size() * sizeof(inst));
+ if (debugChannelSet(3, kDebugLingoCompile)) {
+ if (_currentScript->size() && !_hadError)
+ Common::hexdump((byte *)&_currentScript->front(), _currentScript->size() * sizeof(inst));
+
+ int pc = 0;
+ while (pc < _currentScript->size()) {
+ Common::String instr = decodeInstruction(pc, &pc);
+ debugC(3, kDebugLingoCompile, "[%5d] %s", pc, instr.c_str());
+ }
+ }
}
void Lingo::executeScript(ScriptType type, uint16 id) {
@@ -225,7 +241,7 @@ void Lingo::processEvent(LEvent event, int entityId) {
if (!_eventHandlerTypes.contains(event))
error("processEvent: Unknown event %d for entity %d", event, entityId);
- debug(2, "processEvent(%s) for %d", _eventHandlerTypes[event], entityId);
+ debug(2, "STUB: processEvent(%s) for %d", _eventHandlerTypes[event], entityId);
}
int Lingo::alignTypes(Datum &d1, Datum &d2) {
@@ -285,6 +301,15 @@ Common::String *Datum::toString() {
delete s;
s = u.s;
break;
+ case OBJECT:
+ *s = Common::String::format("#%s", u.s->c_str());
+ break;
+ case VOID:
+ *s = "#void";
+ break;
+ case VAR:
+ *s = Common::String::format("var: #%s", u.sym->name);
+ break;
default:
warning("Incorrect operation toString() for type: %s", type2str());
}
@@ -313,6 +338,10 @@ const char *Datum::type2str(bool isk) {
return isk ? "#point" : "POINT";
case SYMBOL:
return isk ? "#symbol" : "SYMBOL";
+ case OBJECT:
+ return isk ? "#object" : "OBJECT";
+ case VAR:
+ return isk ? "#var" : "VAR";
default:
snprintf(res, 20, "-- (%d) --", type);
return res;
@@ -374,7 +403,7 @@ void Lingo::runTests() {
Common::sort(fileList.begin(), fileList.end());
- for (int i = 0; i < fileList.size(); i++) {
+ for (uint i = 0; i < fileList.size(); i++) {
Common::SeekableReadStream *const stream = SearchMan.createReadStreamForMember(fileList[i]);
if (stream) {
uint size = stream->size();
@@ -383,7 +412,7 @@ void Lingo::runTests() {
stream->read(script, size);
- warning("Compiling file %s of size %d, id: %d", fileList[i].c_str(), size, counter);
+ debugC(2, kDebugLingoCompile, "Compiling file %s of size %d, id: %d", fileList[i].c_str(), size, counter);
_hadError = false;
addCode(script, kMovieScript, counter);
@@ -391,7 +420,7 @@ void Lingo::runTests() {
if (!_hadError)
executeScript(kMovieScript, counter);
else
- warning("Skipping execution");
+ debugC(2, kDebugLingoCompile, "Skipping execution");
free(script);