Monday, August 23, 2010

Animation Format

I've disassembled the code relating to the animation sequences displayed after you complete a route. There are five animation sequences dependent on the route you've taken. I'd hoped that the animation format would be similar to the code to handle the animation sequences during collision, for example the Ferrari rolling over. Unfortunately it was completely different.

If you're using the same revision of the ROMs as myself, you can trigger the sequences instantly in the MAME debugger with the following command:

w@60be8 = x; pc = 9978; g [where x is the end sequence number 0-4]

Animation frames  are stored in groups of 8 bytes, and formatted as follows:

+00 [Byte] Sprite Colour Palette
+01 [Byte] Bit 7: Make X Position Negative
           Bits 4-6: Sprite To Sprite Priority
           Bits 0-3: Top Bits Of Sprite Data Address
+02 [Word] Sprite Data Address
+04 [Byte] Sprite X Position
+05 [Byte] Sprite Y Position
+06 [Byte] Sprite To Road Priority
+07 [Byte] Bit 7: Set To Load Next Block Of Sprite Animation Data To 0x1E
           Bit 6: Set For H-Flip
           Bit 4:
           Bits 0-3: Animation Frame Delay (Before Incrementing To Next Block Of 8 Bytes)

Each sprite (or object if you like) is assigned an address containing the animation sequence data. The animation terminates when bit 7 of byte 7 of a chunk is set. Two other animations use the same format at the start of the game - the map waving the start flag, and the Ferrari driving in from the side of the screen.