Sonic the hedgehog 2

Creating or editing animated patterns

Thanks to Nemesis Sonic 2 Hacking Guide.
By Sonic Hachelle-Bee on October 2004.
Information submitted by Guifrog on May 16 2005.
For the animated patterns, there is a double relative offset index at $3FCE0.
This offset index is shared with the dynamic patterns.
For every level, there is 2x2 bytes relative offsets:
The first 2 bytes are the offset for dynamic patterns.
The last 2 are for animated patterns.

Ex: EHZ: 024C is for dynamic patterns. 02B4 is for animated patterns.

Now, here is the format of the animated patterns:

Automatic frame speed control:
With automatic frame speed control, the format is the following for each animated pattern:

SS XX XX XX YY YY NN TT RR RR RR RR...

SS = Frames speed (time to wait in milliseconds between each frame). The more higher this value is set, the less speed you will get.
XX = Absolute address where the art is located (in an uncompressed form).
YY = Address in VRAM where to store the animated pattern.
NN = Number of frames of the animated pattern.
TT = Number of graphics cells (8x8 tiles) to use in VRAM.
RR = Relative to the absolute address where the art is stored, for each frame, this value is used to know where we have to start reading the art for the current frame. For example, if I write 00 then 02, there is 2 frames: the first one will load its graphics at the absolute address $XXXXXX, the second one will load its graphics two graphic cells (8x8 tiles) after, at $XXXXXX+2x20.

With automatic frame speed control, every frame have the same speed: the number SS.

Manual frame speed control:
With manual frame speed control, the format is the following:

FF XX XX XX YY YY NN TT RR SS RR SS RR SS...

This format is used to set a different speed for each frame. It's pretty much the same as before, but instead of writing only the RR value for each frame, you have to write also the SS (speed) value that come with this frame. So, for the first byte, only write FF instead of the frames speed (specified individually for each frame now).

Note that for every level, the animated patterns load cue's needs a 2 bytes header (starting at 00 00) to specify how many animated patterns you are loading. One level can only handle no more than 8 animated patterns (hardware limitations).


Back to: Sonic the hedgehog 2
Table of contents