From 37b5e5896105bbf3dc9b69b72653802d21f7182f Mon Sep 17 00:00:00 2001 From: Mike Thomas Date: Thu, 30 Aug 2007 18:50:16 +0000 Subject: [PATCH] If a MultiTileSprite overlaps with another item, take their render priorities into account. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@290 ed5b42cb-e716-0410-a449-f6a68f950b19 --- .../threerings/miso/client/DirtyItemList.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/java/com/threerings/miso/client/DirtyItemList.java b/src/java/com/threerings/miso/client/DirtyItemList.java index b8556b79..b684dd8e 100644 --- a/src/java/com/threerings/miso/client/DirtyItemList.java +++ b/src/java/com/threerings/miso/client/DirtyItemList.java @@ -624,6 +624,22 @@ public class DirtyItemList } } + // One is a multi-tile sprite and the two overlap - use render order if it helps. + // Note - Ideally logic like this should probably apply regardless of the type of object + // BUT considering the number of things that already exist that use this code, I suspect + // it would break something... + if ((da.obj instanceof MultiTileSprite || db.obj instanceof MultiTileSprite) && + (da.lx <= db.rx && da.rx >= db.lx && da.ry <= db.ly && da.ly >= db.ry)) { + Sprite as = (Sprite)da.obj, bs = (Sprite)db.obj; + // we're comparing two sprites co-existing on the same + // tile, first check their render order + int rocomp = as.getRenderOrder() - bs.getRenderOrder(); + if (rocomp != 0) { + return rocomp; + } + } + + // otherwise use a consistent ordering for non-overlappers; // see narya/docs/miso/render_sort_diagram.png for more info if (db.lx <= da.ox && db.ry <= da.oy) {