aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2014-03-08 10:53:10 -0500
committerPaul Gilbert2014-03-08 10:53:10 -0500
commit984099ae2ca9dd53b47e44e7815c560c68acbd61 (patch)
treec1497c4e34a3c990d83dd15c97f9bc14dbb40767 /engines
parent9c88ed16828ef6dde467fc03bb9af8d04b0bb3e2 (diff)
downloadscummvm-rg350-984099ae2ca9dd53b47e44e7815c560c68acbd61.tar.gz
scummvm-rg350-984099ae2ca9dd53b47e44e7815c560c68acbd61.tar.bz2
scummvm-rg350-984099ae2ca9dd53b47e44e7815c560c68acbd61.zip
MADS: Implemented stubbed SpriteSlots methods
Diffstat (limited to 'engines')
-rw-r--r--engines/mads/animation.cpp4
-rw-r--r--engines/mads/sequence.cpp4
-rw-r--r--engines/mads/sprites.cpp16
-rw-r--r--engines/mads/sprites.h16
4 files changed, 28 insertions, 12 deletions
diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp
index 90f1331d92..e4549d1054 100644
--- a/engines/mads/animation.cpp
+++ b/engines/mads/animation.cpp
@@ -447,7 +447,7 @@ void Animation::update() {
int newIndex = -1;
if (paChanged) {
- newIndex = scene._spriteSlots.getIndex();
+ newIndex = scene._spriteSlots.add();
scene._spriteSlots[newIndex]._seqIndex = -1;
scene._spriteSlots[newIndex]._spriteType = ST_FULL_SCREEN_REFRESH;
}
@@ -476,7 +476,7 @@ void Animation::update() {
}
if (spriteSlotIndex == 0) {
- int slotIndex = scene._spriteSlots.getIndex();
+ int slotIndex = scene._spriteSlots.add();
SpriteSlot &slot = scene._spriteSlots[slotIndex];
slot.copy(_frameEntries[_oldFrameEntry]._spriteSlot);
slot._seqIndex = _frameEntries[_oldFrameEntry]._seqIndex + 0x80;
diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp
index 1e9281090b..ec9c1a8c62 100644
--- a/engines/mads/sequence.cpp
+++ b/engines/mads/sequence.cpp
@@ -202,7 +202,7 @@ bool SequenceList::loadSprites(int seqIndex) {
// Doesn't have an associated sprite anymore, so mark as done
seqEntry._doneFlag = true;
}
- else if ((slotIndex = scene._spriteSlots.getIndex()) >= 0) {
+ else if ((slotIndex = scene._spriteSlots.add()) >= 0) {
SpriteSlot &spriteSlot = scene._spriteSlots[slotIndex];
setSpriteSlot(seqIndex, spriteSlot);
@@ -377,7 +377,7 @@ void SequenceList::scan() {
for (uint i = 0; i < _entries.size(); ++i) {
if (!_entries[i]._active && (_entries[i]._spritesIndex != -1)) {
- int idx = scene._spriteSlots.getIndex();
+ int idx = scene._spriteSlots.add();
setSpriteSlot(i, scene._spriteSlots[idx]);
}
}
diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp
index 87a23d1296..82e45deffc 100644
--- a/engines/mads/sprites.cpp
+++ b/engines/mads/sprites.cpp
@@ -70,7 +70,6 @@ MSprite::MSprite(Common::SeekableReadStream *source, const Common::Point &offset
MSprite::~MSprite() {
}
-
// TODO: The sprite outlines (pixel value 0xFD) are not shown
void MSprite::loadSprite(Common::SeekableReadStream *source) {
byte *outp, *lineStart;
@@ -217,6 +216,21 @@ void SpriteSlots::fullRefresh(bool clearAll) {
push_back(SpriteSlot(ST_FULL_SCREEN_REFRESH, -1));
}
+void SpriteSlots::deleteTimer(int seqIndex) {
+ for (uint idx = 0; idx < size(); ++idx) {
+ if ((*this)[idx]._seqIndex == seqIndex) {
+ remove_at(idx);
+ return;
+ }
+ }
+}
+
+int SpriteSlots::add() {
+ SpriteSlot ss;
+ push_back(ss);
+ return size() - 1;
+}
+
void SpriteSlots::drawBackground() {
Scene &scene = _vm->_game->_scene;
diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h
index b92a6c22a2..2a85115330 100644
--- a/engines/mads/sprites.h
+++ b/engines/mads/sprites.h
@@ -176,13 +176,15 @@ public:
*/
void fullRefresh(bool clearAll = false);
- void deleteTimer(int idx) {
- warning("TODO: SpriteSlots::deleteTimer");
- }
- int getIndex() {
- warning("TODO: SpriteSlots::indexOf");
- return -1;
- }
+ /**
+ * Delete a timer entry with the given Id
+ */
+ void deleteTimer(int seqIndex);
+
+ /**
+ * Add a new slot entry and return it's index
+ */
+ int add();
/**
* Draw any sprites into the background of the scene