diff options
-rw-r--r-- | engines/mads/animation.cpp | 7 | ||||
-rw-r--r-- | engines/mads/user_interface.cpp | 24 |
2 files changed, 22 insertions, 9 deletions
diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index ed274eb4a3..fec7f74423 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -101,16 +101,19 @@ void AnimMessage::load(Common::SeekableReadStream *f) { void AnimFrameEntry::load(Common::SeekableReadStream *f, bool uiFlag) { if (uiFlag) { f->skip(2); + _frameNumber = -1; // Unused _seqIndex = f->readByte(); _spriteSlot._spritesIndex = f->readByte(); - _spriteSlot._frameNumber = f->readUint16LE(); + _spriteSlot._frameNumber = (int8)f->readByte(); + f->skip(1); _spriteSlot._position.x = f->readSint16LE(); _spriteSlot._position.y = f->readSint16LE(); } else { _frameNumber = f->readUint16LE(); _seqIndex = f->readByte(); _spriteSlot._spritesIndex = f->readByte(); - _spriteSlot._frameNumber = f->readUint16LE(); + uint frame = f->readUint16LE(); + _spriteSlot._frameNumber = (frame < 0x80) ? frame : -(frame & 0x7f); _spriteSlot._position.x = f->readSint16LE(); _spriteSlot._position.y = f->readSint16LE(); _spriteSlot._depth = f->readSByte(); diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 52b466a0aa..09b3c8d5cf 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -65,7 +65,7 @@ void UISlots::add(const AnimFrameEntry &frameEntry) { ie._flags = IMG_UPDATE; ie._segmentId = frameEntry._seqIndex; ie._spritesIndex = frameEntry._spriteSlot._spritesIndex; - ie._frameNumber = frameEntry._frameNumber; + ie._frameNumber = frameEntry._spriteSlot._frameNumber; ie._position = frameEntry._spriteSlot._position; push_back(ie); @@ -148,15 +148,25 @@ void UISlots::draw(bool updateFlag, bool delFlag) { if (dirtyArea->_textActive) { SpriteAsset *asset = scene._sprites[slot._spritesIndex]; - + + // Get the frame details + int frameNumber = ABS(slot._frameNumber); + bool flipped = slot._frameNumber < 0; + if (slot._segmentId == IMG_SPINNING_OBJECT) { - MSprite *sprite = asset->getFrame(slot._frameNumber & 0x7F); + MSprite *sprite = asset->getFrame(frameNumber); sprite->copyTo(&userInterface, slot._position, sprite->getTransparencyIndex()); } else { - MSprite *sprite = asset->getFrame(slot._frameNumber - 1); - sprite->copyTo(&userInterface, slot._position, - sprite->getTransparencyIndex()); + MSprite *sprite = asset->getFrame(frameNumber - 1); + + if (flipped) { + MSurface *spr = sprite->flipHorizontal(); + spr->copyTo(&userInterface, slot._position, sprite->getTransparencyIndex()); + delete spr; + } else { + sprite->copyTo(&userInterface, slot._position, sprite->getTransparencyIndex()); + } } } } @@ -251,7 +261,7 @@ void UserInterface::load(const Common::String &resName) { // Read in the surface data Common::SeekableReadStream *pixelsStream = madsPack.getItemStream(1); pixelsStream->read(_surface.getData(), MADS_SCREEN_WIDTH * MADS_INTERFACE_HEIGHT); - delete pixelsStream; + delete pixelsStream; } void UserInterface::setup(InputMode inputMode) { |