diff options
author | Paul Gilbert | 2014-03-21 22:47:31 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-03-21 22:47:31 -0400 |
commit | 2090987b81615af4cda189a462bc04cd22d7a180 (patch) | |
tree | 3a0bd163ae80953701f7f9e6e5a9d83f1ff5ce76 /engines | |
parent | de09300fdd2194cd78054175b5d4e5231482ab1d (diff) | |
download | scummvm-rg350-2090987b81615af4cda189a462bc04cd22d7a180.tar.gz scummvm-rg350-2090987b81615af4cda189a462bc04cd22d7a180.tar.bz2 scummvm-rg350-2090987b81615af4cda189a462bc04cd22d7a180.zip |
MADS: Fixes for handling horizontally flipped frames
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mads/assets.cpp | 1 | ||||
-rw-r--r-- | engines/mads/msurface.cpp | 2 | ||||
-rw-r--r-- | engines/mads/screen.cpp | 11 | ||||
-rw-r--r-- | engines/mads/sequence.cpp | 5 | ||||
-rw-r--r-- | engines/mads/sprites.cpp | 4 |
5 files changed, 12 insertions, 11 deletions
diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp index 136a3fffd6..a84d1940df 100644 --- a/engines/mads/assets.cpp +++ b/engines/mads/assets.cpp @@ -78,6 +78,7 @@ void SpriteAsset::load(Common::SeekableReadStream *stream, int flags) { int numColors = palStream->readUint16LE(); assert(numColors <= 252); + _colorCount = numColors; // Load in the palette palette.resize(numColors); diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index 3ce5bdacd3..8f40173f13 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -498,7 +498,7 @@ MSurface *MSurface::flipHorizontal() const { for (int y = 0; y < this->h; ++y) { const byte *srcP = getBasePtr(this->w - 1, y); - byte *destP = dest->getData(); + byte *destP = dest->getBasePtr(0, y); for (int x = 0; x < this->w; ++x) *destP++ = *srcP--; diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 7fea54a2f2..975ec7720b 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -91,13 +91,12 @@ void DirtyArea::setSpriteSlot(const SpriteSlot *spriteSlot) { _bounds.top = spriteSlot->_position.y - scene._posAdjust.y; SpriteAsset &spriteSet = *scene._sprites[spriteSlot->_spritesIndex]; - MSprite *frame = spriteSet.getFrame(((spriteSlot->_frameNumber & 0x7fff) - 1) & 0x7f); + MSprite *frame = spriteSet.getFrame(ABS(spriteSlot->_frameNumber) - 1); if (spriteSlot->_scale == -1) { width = frame->w; height = frame->h; - } - else { + } else { width = frame->w * spriteSlot->_scale / 100; height = frame->h * spriteSlot->_scale / 100; @@ -380,8 +379,10 @@ void ScreenSurface::init() { void ScreenSurface::copyRectToScreen(const Common::Point &destPos, const Common::Rect &bounds) { byte *buf = getBasePtr(destPos.x, destPos.y); - g_system->copyRectToScreen(buf, this->pitch, bounds.left, bounds.top, - bounds.width(), bounds.height()); + + if (bounds.width() != 0 && bounds.height() != 0) + g_system->copyRectToScreen(buf, this->pitch, bounds.left, bounds.top, + bounds.width(), bounds.height()); } void ScreenSurface::copyRectToScreen(const Common::Rect &bounds) { diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index e5cc3b5a2c..a03d0f839c 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -187,15 +187,14 @@ void SequenceList::setSpriteSlot(int seqIndex, SpriteSlot &spriteSlot) { spriteSlot._SlotType = spriteSet.isBackground() ? ST_BACKGROUND : ST_FOREGROUND; spriteSlot._seqIndex = seqIndex; spriteSlot._spritesIndex = timerEntry._spritesIndex; - spriteSlot._frameNumber = (timerEntry._flipped ? 0x8000 : 0) | timerEntry._frameIndex; + spriteSlot._frameNumber = timerEntry._flipped ? -timerEntry._frameIndex : timerEntry._frameIndex; spriteSlot._depth = timerEntry._depth; spriteSlot._scale = timerEntry._scale; if (!timerEntry._nonFixed) { spriteSlot._position = timerEntry._msgPos; } else { - assert(spriteSlot._frameNumber > 0); - MSprite *sprite = spriteSet.getFrame(spriteSlot._frameNumber - 1); + MSprite *sprite = spriteSet.getFrame(timerEntry._frameIndex - 1); spriteSlot._position = sprite->_offset; } } diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index ea4dbbbaad..c0467ff95f 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -322,8 +322,8 @@ void SpriteSlots::drawForeground(MSurface *s) { SpriteAsset &spriteSet = *scene._sprites[slot._spritesIndex]; // Get the sprite frame - int frameNumber = slot._frameNumber & 0x7fff; - bool flipped = (slot._frameNumber & 0x8000) != 0; + int frameNumber = ABS(slot._frameNumber); + bool flipped = slot._frameNumber < 0; assert(frameNumber > 0); MSprite *sprite = spriteSet.getFrame(frameNumber - 1); |