aboutsummaryrefslogtreecommitdiff
path: root/engines/composer
diff options
context:
space:
mode:
authorAlyssa Milburn2011-07-18 15:04:19 +0200
committerAlyssa Milburn2011-07-18 15:04:19 +0200
commitf6cd3357e8d99b91dc3f35c4af691364c17530cb (patch)
tree367a82d219765ced32f3152f7d62e5b84b2a0ceb /engines/composer
parent9babfcb8a029700f92b59095d5cc7817fba80d78 (diff)
downloadscummvm-rg350-f6cd3357e8d99b91dc3f35c4af691364c17530cb.tar.gz
scummvm-rg350-f6cd3357e8d99b91dc3f35c4af691364c17530cb.tar.bz2
scummvm-rg350-f6cd3357e8d99b91dc3f35c4af691364c17530cb.zip
COMPOSER: Some more sorting fixes.
Diffstat (limited to 'engines/composer')
-rw-r--r--engines/composer/composer.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/engines/composer/composer.cpp b/engines/composer/composer.cpp
index 5c686241e7..683e30f8fe 100644
--- a/engines/composer/composer.cpp
+++ b/engines/composer/composer.cpp
@@ -658,7 +658,11 @@ void ComposerEngine::removeSprite(uint16 id, uint16 animId) {
}
const Sprite *ComposerEngine::getSpriteAtPos(const Common::Point &pos) {
- for (Common::List<Sprite>::iterator i = _sprites.begin(); i != _sprites.end(); i++) {
+ for (Common::List<Sprite>::iterator i = _sprites.reverse_begin(); i != _sprites.end(); --i) {
+ // avoid highest-level objects (e.g. the cursor)
+ if (!i->_zorder)
+ continue;
+
if (i->contains(pos))
return &(*i);
}
@@ -966,7 +970,17 @@ void ComposerEngine::loadLibrary(uint id) {
uint16 buttonId = buttonResources[i];
Common::SeekableReadStream *stream = library._archive->getResource(ID_BUTN, buttonId);
Button button(stream, buttonId);
- _buttons.push_back(button);
+
+ bool inserted = false;
+ for (Common::List<Button>::iterator b = _buttons.begin(); b != _buttons.end(); b++) {
+ if (button._zorder <= b->_zorder)
+ continue;
+ _buttons.insert(b, button);
+ inserted = true;
+ break;
+ }
+ if (!inserted)
+ _buttons.push_back(button);
}
// add background sprite, if it exists