Originally Posted By jbo_85
The remaining OAM priority issues can be fixed by only checking the priority of the topmost sprite against the backgrounds.

Passage in Anomie's Register Doc:
Code:
Note that only the priority of the topmost sprite is
considered relative to the backgrounds. Thus, if FirstSprite+3 and
FirstSprite+4 are identical except FirstSprite+3 has priority 0 and
FirstSprite+4 has priority 3, they will both be hidden by any backgrounds that
hide priority 0 sprites. This may seem counterintuitive, since FirstSprite+4
would normally go in front of these BGs, but many games depend on this
behavior.



I spent quite some time in the past few days on this, but I'm not sure how this should work exactly. In particular, what does "topmost" means here?

If I use the priority of FirstSprite only for all sprites, in each line, then all the sprites will use the same priority w.r.t. the bg, i.e. all sprites become OAM0, OAM1, OAM2 or OAM3 depending on the priority of FirstSprite.

While this indeed fixes the current priority problems in Chrono Trigger intro, it also introduces many brand new priority problems. Look at the following snap, from Chrono Trigger intro, and in particular to the half-hidden character on the right:



the snap only shows Mode1 BG1A (the one with higher priority) and sprites, to better isolate the issue: FristSprite is OAM2, i.e. priority 6; BG1A has priority 8; the sprite of the jumping/rolling Goku-like character is OAM3, i.e. it would have priority 9. By using FirstSprite priority for all the sprites, you end up with OAM3 to become OAM2 and with the OAM3 sprites hidden below the BG1 layer, as the snap shows...

Another example is again in Chrono Trigger intro: the judge with the hammer disappears below its seat (which has higher priority than FirstSprite)...

I guess the problem it's me not understanding the docs, but could anyone explain me how this should work exactly?

EDIT: for whoever wants to try the code, I simply changed line 1265 of video/snes.c from

Code:
priority = oam_spritelist[active_sprite].priority_bits;


to

Code:
priority = oam_spritelist[0].priority_bits;


so that all the sprites in a line get the FirstSprite priority...