Editing Sprites - RetroKoH/S1Fixed GitHub Wiki
In most older-generation video games, a sprite is an arrangement of art tiles put together to form an image that can be moved anywhere on the screen. Sprites are often a visual representation of an object they are associated with, though this is not always the case. On the Sega Mega Drive, sprites consist of one or more mappings that can be anywhere from 1 to 4 tiles in width or height, therefore consisting of anything from 1-16 tiles. Multiple mappings can be placed together in varying ways to form complex sprites. Any given sprite mapping can be assigned one of 4 palette lines, a tile offset to begin drawing with, be mirrored or flipped, and also have a "priority" setting. It also has X and Y position properties. The setting applies to all the tiles in a sprite, and not for each individual tile in it. When a sprite is drawn, it first draws the tile that it gets assigned, and then for the other tiles, it just goes to the next tile in VRAM, and draws them column by column. All sprites that need to be drawn get stored in a dedicated section of VRAM.
All sprite mappings in S1Fixed are located in the _maps folder, and can be edited either directly, through a text editor, or through a dedicated tool such as Flex2. Sprite mappings can come in many different formats. This guide will cover the formats used in the mainline Sonic games, as well as the macro format that S1Fixed uses.
Sonic 1 Mapping Format
Each mapping is 5 bytes long, taking the form TTTT TTTT 0000 WWHH PCCY XAAA AAAA AAAA LLLL LLLL
.
- LLLL LLLL is the left co-ordinate of where the mapping appears.
- TTTT TTTT is the top co-ordinate of where the mapping appears.
- WW is the width of the mapping, in tiles minus one. So 0 means 8 pixels wide, 1 means 16 pixels wide, 2 means 24 pixels wide and 3 means 32 pixels wide.
- HH is the height of the mapping, in the same format as the width.
- P is the priority-flag. If P is set, the mapping will appear above everything else.
- CC is the palette line.
- X is the x-flip-flag. If X is set, the mapping will be flipped horizontally.
- Y is the y-flip-flag. If Y is set, the mapping will be flipped vertically.
- AAA AAAA AAAA is the tile index.
The VRAM offset specified in an object's SST will be added to the PCCY XAAA AAAA AAAA word.