LET US DISCUSS SPRITE ASSEMBLYI'm up to speed on how the game engine specifies which tile to load I think, and am examining everyone's notes to figure out how the game engine places the loaded tiles on a 2D plane. But in the meantime, here's something I find extremely unsettling, probably due to my inexperience in this area:
Illustrated are the 9 non-blank tiles summoned from Crono's GFX pack to form his first frame, which I will call Frame #1 (Standing-Front). Notice how that
damn little hair piece at the very top of his head has to be misaligned for the sprite to be built correctly?
How does sprite assembly data specify such a thing? Is there some function in the last eight bytes of Crono's first frame that allows pixel-by-pixel shifting of a tile?
______________
But I digress -- I should have used this post to describe my understanding of sprite assembly a.) to revive the topic and b.) to ensure that I have a correct understanding of how the game engine decides which tiles from a GFX pack to load. What follows is essentially a regurgitation of what Vehek and justin3009 had posted earlier, just in my own language.
Let's start with the hex code for Crono's first sprite frame, Frame #1 (Standing-Front):
00 00 00 00
02 00 01 00-00 00 00 00 20 00 21 00
00 00 00 00 10 00 11 00-00 00 31 00
30 00 30 40F8 00 F8 E0 F5 D0 F8 F0
This consists of 16 tiles from Crono's GFX pack, 2 bytes each, plus 8 bytes that I'm still trying to figure out tagging along at the end (third row).
I like to think of the format for the two-byte pairs in rows 1 and 2 as follows:
VH OS
With...
V = Vertical Axis slot
H = Horizontal Axis slot
O = Orientation
S = Section
The Vertical Axis nybble specifies which tile the game engine looks for in the up-down direction.
The Horizontal Axis nybble specifies which tile the game engine looks for in the right-left direction.
The Orientation nybble specifies whether the tile should be mirrored in the built sprite. There may be other ways to orient
the tile, but I am currently unaware of other values besides "4," which is the mirror value.
The Section nybble specifies which 0xF by 0xF grouping in a GFX pack the game engine is supposed to look at when pulling
tiles. Notice that on the vertical axis of the GFX pack pictured below I leave room for two nybbles, or a whole byte --
starting with 0x00 and going through 0x3D at the very bottom. There are four "sections," one from 00 ~ 0F, another from
10 ~ 1F, another from 20 ~ 2F, and another from 30 ~ 3D.
Next, let's get Crono's GFX pack up:
Note that the horizontal axis consists of hexidecimal values from 0x0 through 0xF -- these are
H values.
Note that the vertical axis consists of hexidecimal values 0x00 through 0x3D -- these are
SV values.
Let's go through the blue-colored bytes in Crono's first frame:
02 00The game engine reads everything in Little Endian order, so we're looking at [OS VH] being [00 02].
The O value is 0, meaning there's no mirroring of the tile. The S value is 0, meaning we're in the 0V section of the GFX pack. The V value is 0x0, meaning we're in the top row. The H value is 0x2, meaning we're in the third row over. Thus, the tile loaded by this byte pair is the pink-filled tile in the pic below:
In the same vein, the red-colored bytes highlighted in Crono's first frame sprite assembly (30 00) specify the following tile:
The green-highlighted bytes highighted in Crono's first frame sprite assembly (30 40) give us much better practice. Read 0x4030, the first nybble tells us that the tile is mirrored and the second tells us that the game engine is pulling from the 0x00 ~ 0x0F range on the vertical axis. The tile in question is once again:
...it's just flipped this time so Crono can have two feet using the same tile.
Sprite Assembly gurus, don't hold back -- let me know if my understanding is correct so far, and please guide me on the meaning of the last eight bytes in Crono's first frame at your convenience.