diff options
author | Paul Gilbert | 2014-03-08 08:44:01 -0500 |
---|---|---|
committer | Paul Gilbert | 2014-03-08 08:44:01 -0500 |
commit | 8d3857c0536e47a6a03497346424c111b5bebd7b (patch) | |
tree | 28e6c41b68dbffb1ca48d7d7b8748eb6e96d4d7f | |
parent | 80bba746406743ab7a7ae6c163c79c652f6d7624 (diff) | |
download | scummvm-rg350-8d3857c0536e47a6a03497346424c111b5bebd7b.tar.gz scummvm-rg350-8d3857c0536e47a6a03497346424c111b5bebd7b.tar.bz2 scummvm-rg350-8d3857c0536e47a6a03497346424c111b5bebd7b.zip |
MADS: Cleanup code for accessing sprite assets
-rw-r--r-- | engines/mads/animation.cpp | 8 | ||||
-rw-r--r-- | engines/mads/messages.cpp | 2 | ||||
-rw-r--r-- | engines/mads/scene_data.cpp | 2 | ||||
-rw-r--r-- | engines/mads/sequence.cpp | 10 | ||||
-rw-r--r-- | engines/mads/sprites.h | 3 |
5 files changed, 11 insertions, 14 deletions
diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 588e4eaf36..3508631690 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -332,8 +332,8 @@ void Animation::loadFrame(int frameNumber) { return; Common::Point pt; - int listIndex = _spriteListIndexes[_header._spritesIndex]; - SpriteAsset &spriteSet = scene._spriteSlots.getSprite(listIndex); + int spriteListIndex = _spriteListIndexes[_header._spritesIndex]; + SpriteAsset &spriteSet = *scene._sprites[spriteListIndex]; if (_unkIndex < 0) { MSurface *frame = spriteSet.getFrame(0); @@ -480,8 +480,8 @@ void Animation::update() { slot.copy(_frameEntries[_oldFrameEntry]._spriteSlot); slot._seqIndex = _frameEntries[_oldFrameEntry]._seqIndex + 0x80; - SpriteAsset &spriteSet = scene._spriteSlots.getSprite( - scene._spriteSlots[slotIndex]._spritesIndex); + SpriteAsset &spriteSet = *scene._sprites[ + scene._spriteSlots[slotIndex]._spritesIndex]; slot._spriteType = spriteSet.isBackground() ? ST_BACKGROUND : ST_FOREGROUND; } break; diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index 69d984313b..0e66626bbc 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -194,7 +194,7 @@ void KernelMessages::processText(int msgIndex) { if (msg._flags & KMSG_SEQ_ENTRY) { SequenceEntry &seqEntry = scene._sequences[msg._sequenceIndex]; if (!seqEntry._nonFixed) { - SpriteAsset &spriteSet = scene._spriteSlots.getSprite(seqEntry._spritesIndex); + SpriteAsset &spriteSet = *scene._sprites[seqEntry._spritesIndex]; MSprite *frame = spriteSet.getFrame(seqEntry._frameIndex - 1); x1 = frame->getBounds().left; y1 = frame->getBounds().top; diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index c15a3876a8..ed53bca52a 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -193,7 +193,7 @@ void DirtyArea::setSpriteSlot(const SpriteSlot *spriteSlot) { _bounds.left = spriteSlot->_position.x - scene._posAdjust.x; _bounds.top = spriteSlot->_position.y - scene._posAdjust.y; - SpriteAsset &spriteSet = scene._spriteSlots.getSprite(spriteSlot->_spritesIndex); + SpriteAsset &spriteSet = *scene._sprites[spriteSlot->_spritesIndex]; MSprite *frame = spriteSet.getFrame(((spriteSlot->_frameNumber & 0x7fff) - 1) & 0x7f); if (spriteSlot->_scale == -1) { diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 93cc9ea39e..1e9281090b 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -95,7 +95,7 @@ int SequenceList::add(int spriteListIndex, bool flipped, int frameIndex, int tri if (frameStart <= 0) frameStart = 1; if (numSprites == 0) - numSprites = scene._spriteSlots.getSprite(spriteListIndex).getCount(); + numSprites = scene._sprites[spriteListIndex]->getCount(); if (frameStart == numSprites) frameInc = 0; @@ -169,7 +169,7 @@ void SequenceList::remove(int seqIndex) { void SequenceList::setSpriteSlot(int seqIndex, SpriteSlot &spriteSlot) { Scene &scene = _vm->_game->_scene; SequenceEntry &timerEntry = _entries[seqIndex]; - SpriteAsset &spriteSet = scene._spriteSlots.getSprite(timerEntry._spritesIndex); + SpriteAsset &spriteSet = *scene._sprites[timerEntry._spritesIndex]; spriteSlot._spriteType = spriteSet.isBackground() ? ST_BACKGROUND : ST_FOREGROUND; spriteSlot._seqIndex = seqIndex; @@ -209,7 +209,7 @@ bool SequenceList::loadSprites(int seqIndex) { int x2 = 0, y2 = 0; if ((seqEntry._field13 != 0) || (seqEntry._dynamicHotspotIndex >= 0)) { - SpriteAsset &spriteSet = scene._spriteSlots.getSprite(seqEntry._spritesIndex); + SpriteAsset &spriteSet = *scene._sprites[seqEntry._spritesIndex]; MSprite *frame = spriteSet.getFrame(seqEntry._frameIndex - 1); int width = frame->getWidth() * seqEntry._scale / 200; int height = frame->getHeight() * seqEntry._scale / 100; @@ -340,7 +340,7 @@ void SequenceList::delay(uint32 priorFrameTime, uint32 currentTime) { void SequenceList::setAnimRange(int seqIndex, int startVal, int endVal) { Scene &scene = _vm->_game->_scene; SequenceEntry &seqEntry = _entries[seqIndex]; - SpriteAsset &spriteSet = scene._spriteSlots.getSprite(seqEntry._spritesIndex); + SpriteAsset &spriteSet = *scene._sprites[seqEntry._spritesIndex]; int numSprites = spriteSet.getCount(); int tempStart = startVal, tempEnd = endVal; @@ -397,7 +397,7 @@ void SequenceList::setMsgPosition(int seqIndex, const Common::Point &pt) { int SequenceList::addSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks, int triggerCountdown, int timeoutTicks, int extraTicks) { Scene &scene = _vm->_game->_scene; - MSprite *spriteFrame = scene._spriteSlots.getSprite(srcSpriteIdx).getFrame(0); + MSprite *spriteFrame = scene._sprites[srcSpriteIdx]->getFrame(0); int depth = scene._depthSurface.getDepth(Common::Point(spriteFrame->_pos.x + (spriteFrame->w / 2), spriteFrame->_pos.y + (spriteFrame->h / 2))); diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index b7e63a0d24..b92a6c22a2 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -176,9 +176,6 @@ public: */ void fullRefresh(bool clearAll = false); - SpriteAsset &getSprite(int idx) { - error("TODO"); - } void deleteTimer(int idx) { warning("TODO: SpriteSlots::deleteTimer"); } |