aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorTorbjörn Andersson2003-06-21 15:10:30 +0000
committerTorbjörn Andersson2003-06-21 15:10:30 +0000
commit445a805238fc667177d6fc0cc8bc9694cf4aa2d8 (patch)
tree67a6ffdf61972c2944f2cee67ebfe43f7c892783 /scumm
parentb81cbb930f4efe9e407d5fa38641f2ca8d931fda (diff)
downloadscummvm-rg350-445a805238fc667177d6fc0cc8bc9694cf4aa2d8.tar.gz
scummvm-rg350-445a805238fc667177d6fc0cc8bc9694cf4aa2d8.tar.bz2
scummvm-rg350-445a805238fc667177d6fc0cc8bc9694cf4aa2d8.zip
Fixed bug #758167. Cleanup.
svn-id: r8577
Diffstat (limited to 'scumm')
-rw-r--r--scumm/actor.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp
index 42db57b271..5f50d21c50 100644
--- a/scumm/actor.cpp
+++ b/scumm/actor.cpp
@@ -807,16 +807,24 @@ void Scumm::playActorSounds() {
}
}
-
-#define DRAW_ORDER(x) ((x)->y - ((x)->layer << 11))
inline int32 drawOrder (const Actor* x) { return (x)->y - ((x)->layer << 11); }
int sortByDrawOrder (const void* a, const void* b)
{
const Actor* actor1 = *(const Actor *const*)a;
const Actor* actor2 = *(const Actor *const*)b;
- assert (DRAW_ORDER (actor1)==drawOrder (actor1) && DRAW_ORDER (actor1)==drawOrder (actor1));
- return drawOrder (actor1)-drawOrder (actor2);
+ int32 order1 = drawOrder(actor1);
+ int32 order2 = drawOrder(actor2);
+
+ // The qsort() function is apparently not guaranteed to be stable (i.e.
+ // it may re-order actors with the same draw order value). Use the
+ // actor number as tie-breaker. This is needed for the Sam & Max intro,
+ // and possibly other cases as well. See bug #758167.
+
+ if (order1 == order2)
+ return actor1->number - actor2->number;
+
+ return order1 - order2;
}
void Scumm::processActors() {