From 965cdb6fbf1d7db6ca839a9cb75be1821975d8b7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 27 Jun 2010 05:18:21 +0000 Subject: Several bugfixes to the loading, display, and digital sound playing of messages during cutscenes svn-id: r50366 --- engines/m4/animation.cpp | 31 +++++++++++++++++-------------- engines/m4/animation.h | 6 +++--- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/engines/m4/animation.cpp b/engines/m4/animation.cpp index 6b32bdca17..fae21db072 100644 --- a/engines/m4/animation.cpp +++ b/engines/m4/animation.cpp @@ -132,23 +132,24 @@ void MadsAnimation::initialise(const Common::String &filename, uint16 flags, M4S for (int i = 0; i < messagesCount; ++i) { AnimMessage rec; - rec.soundId = animStream->readUint16LE(); - animStream->read(rec.msg, 70); - animStream->readUint16LE(); - animStream->readUint16LE(); + rec.soundId = animStream->readSint16LE(); + animStream->read(rec.msg, 64); + animStream->skip(4); + rec.pos.x = animStream->readSint16LE(); + rec.pos.y = animStream->readSint16LE(); + rec.flags = animStream->readUint16LE(); rec.rgb1.r = animStream->readByte(); rec.rgb1.g = animStream->readByte(); rec.rgb1.b = animStream->readByte(); rec.rgb2.r = animStream->readByte(); rec.rgb2.g = animStream->readByte(); rec.rgb2.b = animStream->readByte(); - animStream->readUint16LE(); - animStream->readUint16LE(); - rec.kernelMsgIndex = animStream->readUint16LE(); - rec.pos.x = animStream->readUint16LE(); - rec.pos.y = animStream->readUint16LE(); + animStream->skip(2); // Space for kernelMsgIndex + rec.kernelMsgIndex = -1; + animStream->skip(6); rec.startFrame = animStream->readUint16LE(); rec.endFrame = animStream->readUint16LE(); + animStream->skip(2); _messages.push_back(rec); } @@ -166,8 +167,8 @@ void MadsAnimation::initialise(const Common::String &filename, uint16 flags, M4S rec.seqIndex = animStream->readByte(); rec.spriteSlot.spriteListIndex = animStream->readByte(); rec.spriteSlot.frameNumber = animStream->readUint16LE(); - rec.spriteSlot.xp = animStream->readUint16LE(); - rec.spriteSlot.yp = animStream->readUint16LE(); + rec.spriteSlot.xp = animStream->readSint16LE(); + rec.spriteSlot.yp = animStream->readSint16LE(); rec.spriteSlot.depth = animStream->readByte(); rec.spriteSlot.scale = (int8)animStream->readByte(); @@ -425,10 +426,12 @@ void MadsAnimation::update() { _vm->_palette->setEntry(colIndex + 1, me.rgb2.r, me.rgb2.g, me.rgb2.b); // Add a kernel message to display the given text - me.kernelMsgIndex = _view->_kernelMessages.add(me.pos, colIndex * 101, 0, 0, INDEFINITE_TIMEOUT, me.msg); + me.kernelMsgIndex = _view->_kernelMessages.add(me.pos, colIndex * 0x101, 0, 0, INDEFINITE_TIMEOUT, me.msg); + assert(me.kernelMsgIndex >= 0); + // Play the associated sound, if it exists - if (me.soundId >= 0) - _vm->_sound->playDSRSound(me.soundId, 255, false); + if (me.soundId > 0) + _vm->_sound->playDSRSound(me.soundId - 1, 255, false); ++_messageCtr; } } diff --git a/engines/m4/animation.h b/engines/m4/animation.h index 89c3cbbfaf..135618d7e2 100644 --- a/engines/m4/animation.h +++ b/engines/m4/animation.h @@ -40,12 +40,12 @@ class SpriteSlotSubset; class AnimMessage { public: int16 soundId; - char msg[70]; + char msg[64]; Common::Point pos; RGB8 rgb1, rgb2; - int kernelMsgIndex; - + uint16 flags; int startFrame, endFrame; + int kernelMsgIndex; }; class AnimFrameEntry { -- cgit v1.2.3