I've been stuck with a depth sorting issue for a long while now, and that's for thin partition walls that the hero can walk either side of. Using a depth sorting algorithm that takes a greater account of the y position of the sprites causes the following error:

(the blue crosses show where the clips are centred.)
No matter how I arrange the centre of the clips, I can't see a way to ensure that the hero can move around the thin wall and both be depth sorted correctly.
Any ideas?