I'll get right to the point. I want to force a sprite's graphics to be drawn in front of mario. I know it's possible, because, well... one of the tiles of a door sprite does it.
It's 8 8x8 tiles. I've no clue why one goes in front of mario, as they all have the same settings. The only unique thing about that tile is that it is rather high in the OAM order.
EDIT: The graphics routine of that sprite, if interested.
The last tile is the one being drawn over mario.
I want to prevent tiles drawing over mario in this case, and cause it elsewhere.
Everything I've ever read about sprite priority in SMW states that they're drawn over each other in relation to the order of the OAM. I want to know exactly what that means. I thought lower OAM order meant higher priority, as evidenced by mario's tiles being at $0310, when the sprite tile OAM starts at $0300 (only allowing for 3 tiles to be below him, which I presume to be used by yoshi).
But if that's true, why is the tile in my above screenshot acting the way it is?
Oh, and another thing. Here's an excerpt from a SNES graphics reference I've been using:
Register $2105: Screen mode register (1b/W)
dcbapmmm d: BG4 tile size c: BG3 tile size b: BG2 tile size
a: BG1 tile size Sizes are: 0=8x8; 1=16x16. (See reg. $2107)
p: order of BG priorities m: General screen mode
I'm mostly interested in bits p and m of that register. From all.log:
CODE_0082F7: A9 09 LDA.B #$09
CODE_0082F9: 8D 05 21 STA.W $2105 ; BG Mode and Tile Size Setting
This, as far as I can tell, is a regular level's settings. #$09 means that it is mode 1, and the priority bit is set (00001001).
Now, back to the graphic reference:
The p (priority bit) affects the order in which BGs are drawn on the screen, as follows
("o" refers to the setting of bit 13 of the tile map):
p (Priority) 0 1
Drawn first BG4, o=0 BG4, o=0
(Behind) BG3, o=0 BG3, o=0
. Sprites with OAM priority 0 (%00)
. BG4, o=1 BG4, o=1
. BG3, o=1 OAM pri. 1
. OAM pri. 1 BG2, o=0
. BG2, o=0 BG1, o=0
. BG1, o=0 BG2, o=1
. Sprites with OAM priority 2 (%10)
. BG2, o=1 BG1, o=1
Drawn last BG1, o=1 OAM pri. 3
(in front) OAM pri. 3 BG3, o=1
The p bit only works in Mode 1. In all other modes, it is ignored (drawing is performed as if this bit were clear.)
My question is: Is my reference incorrect? Am I misreading it? It states that, in a regular SMW level, sprites with both priority bits set should be drawn above other sprites, and in fact everything but layer 3. In other words, sprites should
be drawn over each other based on priority. But they are not in SMW... Is this true for every SNES game, or is it a quirk of SMW?
Maybe I am misreading it. Does that list of priorities only matter when comparing different
BG/sprite layers? So, if you could somehow had a tile of BG1 with priority and one without overlap, would they theoretically also respect some sort of VRAM order, and not priority bits? (I'm pretty sure it's impossible for BG tiles from the same layer to overlap, but
I'm certain I can do what I want regardless of the answer. I'm just a little confused as to how these things work.
Mod edit: stretch--;