From 30de1272b7c6b50475270aa2882841f65ee7a5e0 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 20 Feb 2017 19:11:38 +0100 Subject: DIRECTOR: Added more debug output for score --- engines/director/lingo/lingo.cpp | 3 ++- engines/director/score.cpp | 14 +++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'engines/director') diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp index 759d40e819..4cfdc3fd82 100644 --- a/engines/director/lingo/lingo.cpp +++ b/engines/director/lingo/lingo.cpp @@ -158,7 +158,8 @@ const char *Lingo::findNextDefinition(const char *s) { } void Lingo::addCode(const char *code, ScriptType type, uint16 id) { - debugC(2, kDebugLingoCompile, "Add code \"%s\" for type %d with id %d", code, type, id); + debugC(2, kDebugLingoCompile, "Add code \"%s\" for type %s with id %d", code, scriptType2str(type), id); + warning("Add code \"%s\" for type %s with id %d", code, scriptType2str(type), id); if (_scripts[type].contains(id)) { delete _scripts[type][id]; diff --git a/engines/director/score.cpp b/engines/director/score.cpp index 2544a612c0..b8e601eccd 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -260,6 +260,7 @@ void Score::loadFrames(Common::SeekableSubReadStreamEndian &stream) { Common::MemoryReadStreamEndian *str = new Common::MemoryReadStreamEndian(channelData, ARRAYSIZE(channelData), stream.isBE()); //Common::hexdump(channelData, ARRAYSIZE(channelData)); frame->readChannels(str); + warning("Frame %d actionId: %d", _frames.size(), frame->_actionId); delete str; @@ -502,17 +503,22 @@ void Score::loadActions(Common::SeekableSubReadStreamEndian &stream) { uint16 offset = count * 4 + 2; byte id = stream.readByte(); + /*byte subId = */ stream.readByte(); // I couldn't find how it used in continuity (except print). Frame actionId = 1 byte. uint16 stringPos = stream.readUint16() + offset; for (uint16 i = 0; i < count; i++) { uint16 nextId = stream.readByte(); - /*byte subId = */ stream.readByte(); + byte subId = stream.readByte(); uint16 nextStringPos = stream.readUint16() + offset; uint16 streamPos = stream.pos(); stream.seek(stringPos); + if (_vm->getVersion() == 3) { + id -= 1; + } + for (uint16 j = stringPos; j < nextStringPos; j++) { byte ch = stream.readByte(); if (ch == 0x0d) { @@ -521,6 +527,8 @@ void Score::loadActions(Common::SeekableSubReadStreamEndian &stream) { _actions[id] += ch; } + warning("id: %d nextId: %d subId: %d, code: %s", id, nextId, subId, _actions[id].c_str()); + stream.seek(streamPos); id = nextId; @@ -881,8 +889,8 @@ void Score::update() { _surface->copyFrom(*_trailSurface); // Enter and exit from previous frame (Director 4) - _lingo->processEvent(kEventEnterFrame, kFrameScript, _frames[_currentFrame]->_actionId - 1); - _lingo->processEvent(kEventExitFrame, kFrameScript, _frames[_currentFrame]->_actionId - 1); + _lingo->processEvent(kEventEnterFrame, kFrameScript, _frames[_currentFrame]->_actionId); + _lingo->processEvent(kEventExitFrame, kFrameScript, _frames[_currentFrame]->_actionId); // TODO Director 6 - another order // TODO Director 6 step: send beginSprite event to any sprites whose span begin in the upcoming frame -- cgit v1.2.3