aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorVladimir Menshakov2009-12-12 13:33:35 +0000
committerVladimir Menshakov2009-12-12 13:33:35 +0000
commit435360d3ba7d979c7ed5c05e4ac07e113c6f2a0e (patch)
tree15cd5d7743ecda7c046f8142d9b0509e707113b9 /engines
parentf34d55211147d3753476df3daa19003d6d139a2d (diff)
downloadscummvm-rg350-435360d3ba7d979c7ed5c05e4ac07e113c6f2a0e.tar.gz
scummvm-rg350-435360d3ba7d979c7ed5c05e4ac07e113c6f2a0e.tar.bz2
scummvm-rg350-435360d3ba7d979c7ed5c05e4ac07e113c6f2a0e.zip
added z-ordering of the animation slots.
svn-id: r46343
Diffstat (limited to 'engines')
-rw-r--r--engines/teenagent/scene.cpp30
1 files changed, 27 insertions, 3 deletions
diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp
index 463f1460e0..331e9dc483 100644
--- a/engines/teenagent/scene.cpp
+++ b/engines/teenagent/scene.cpp
@@ -26,6 +26,7 @@
#include "teenagent/resources.h"
#include "teenagent/surface.h"
#include "common/debug.h"
+#include "common/algorithm.h"
#include "teenagent/objects.h"
#include "teenagent/teenagent.h"
#include "teenagent/dialog.h"
@@ -483,6 +484,12 @@ bool Scene::processEvent(const Common::Event &event) {
}
}
+struct ZOrderCmp {
+ inline bool operator()(const Surface *a, const Surface *b) const {
+ return a->y + a->h < b->y + b->h;
+ }
+};
+
bool Scene::render(OSystem *system) {
Resources *res = Resources::instance();
bool busy;
@@ -542,7 +549,9 @@ bool Scene::render(OSystem *system) {
s->render(surface);
}
}
-
+
+ Common::List<Surface *> z_order;
+
for (byte i = 0; i < 4; ++i) {
Animation *a = custom_animation + i;
Surface *s = a->currentFrame();
@@ -577,9 +586,9 @@ bool Scene::render(OSystem *system) {
if (s == NULL)
continue;
-
+
if (debug_features.feature[DebugFeatures::kShowLan])
- animation_position[i] = s->render(surface);
+ z_order.push_back(s);
if (a->id == 0)
continue;
@@ -595,6 +604,16 @@ bool Scene::render(OSystem *system) {
}
}
+ Common::sort(z_order.begin(), z_order.end(), ZOrderCmp());
+ Common::List<Surface *>::iterator z_order_it;
+
+ for(z_order_it = z_order.begin(); z_order_it != z_order.end(); ++z_order_it) {
+ Surface *s = *z_order_it;
+ if (s->y + s->h > position.y)
+ break;
+ s->render(surface);
+ }
+
{
Surface *mark = actor_animation.currentFrame();
if (mark != NULL) {
@@ -659,6 +678,11 @@ bool Scene::render(OSystem *system) {
}
}
+ for(; z_order_it != z_order.end(); ++z_order_it) {
+ Surface *s = *z_order_it;
+ s->render(surface);
+ }
+
if (!message.empty()) {
bool visible = true;
if (message_first_frame != 0 && message_animation != NULL) {