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.


Michael said...

Very interesting. I just realised that this work might be handy to get the exact frame grabs required to produce a high quality reproduction of the map for the upright cabinet.

All the ones I have seen have low quality grabs probably taken from a scanner years ago and there are hardly any original maps are available for sale. I've been waiting for almost 1 year to get one.

Would it be possible to control the traffic using Mame to get the exact level, other car type, position and scale, car position, car flip frame, road curve and elevation, score etc. (Is the score shown on the map?) to get all the level screenshots for a high quality map for printing onto aluminium for cabinets?

The repro map should then be saved in a high quality vector graphics format for printing to any size. I don't want it to be a jpg.

We need the exact dimensions of the original map of course. Any suggestions as to the printing DPI and colour matching process would be very helpful. The exact font to layer on the place names would be handy too.

yt said...

Short answer - yes this is possible.

Long answer - it's difficult, and not something I'd spend time on myself. But I could provide information to someone wanting to do this.

Here are the steps you would potentially need to take to get these grabs. It's doable, but not easy:

Tools needed: Mame debugger.

1/ Setup a cheat in the debugger to freeze the game time.

2/ Adjust the position in the level step-by-step until it matches the map (in terms of progress through the level). You could do this on a granular basis by editing the appropriate memory address.

3/ Do the same for the x-position of the Ferrari.

4/ Manually setup an object sprite for the traffic as required (position, frame, image type). This would be the most difficult bit. I know the format though.

5/ Once setup, you would want to freeze this area of memory so it is never updated by the code (or simply disable the traffic code).

6/ Manually edit the score, laptime, speed and so forth in memory to reflect the original screenshots.

7/ Save a dump of memory and take a screenshot from mame!! :)

As a side note, I have an original unused map at my parents somewhere. Unfortunately, I have no idea where it is now. It cost me a small fortune about 10 years ago!