The Flip Masks allow you to specify a mask value to indicate that a tile has been flipped horizontally and/or vertically when drawn. Additionally there is a checkbox to enable or disable the flipping so you can quickly toggle the map to see if it looks correct.
Global Gladiators (c) Virgin
The tiles from Global Gladiators are very easy to locate. They are 16x16 tiles, 4 bitplanes (16 colours) and stored in Amiga ILBM format. They look like this:
The tile search feature will attempt to detect flipped tiles by searching for tiles drawn normally, and failing that will search for flipped tiles. If a flipped tile is found, it will be preceeded by the letters x or y in the results. Here's an example matching a small selection from the game:
x187, x186, x185, 57, 57, 58, 57
x191, x190, x189, 40, 41, 42, 43
x192, x59, xy58, 43, 61, 62/268, 63
45, 53, 44, 64, 45, 64, 47/81
In this case, the first tile was found as index 187 but only after flipping it horizontally. On the 3rd row it found tile 58 was found after flipping both horizontally and vertically. Also on the 3rd row, one of the tiles matched tile 62 and 268, so those are duplicate tiles. There is also a duplicate tile 47 and 81 on the 4th row.
Once the map for the game is located and a valid mask is set ($fff), the map will look slightly strange. Notice the tree in the middle looks wrong, as the branches do not connect to each other correctly.
Hover over some of the incorrect tiles and note the values at the bottom of the screen:
Map: $87cbe: (198, 28) = $2076 = tile 118 ($76)
This is telling you that the mouse is over the tile at address $87cbe in the savestate, which corresponds to map-coordinate (198, 28) and the value is $2076. After masking with $fff, the tile is 118 (or $76 in hex).
This will give you a helpful clue. One of the high-bits has been set in the tile index, adding $2000 to the tile index. Enter $2000 as the Flip-X mask and click the Enabled tickbox to see the new map:
Much better, but still not perfect. The game still has a lot of tiles that are incorrect. Hover over any tile that looks upside down and note the values at the bottom of the screen:
Map: $890aa: (188, 33) = $103F = tile 63 ($3F)
This is telling you that the mouse is over the tile at address $890aa in the savestate, which corresponds to map-coordinate (188, 33) and the value is $103F. After masking with $fff, the tile is 63 (or $3F in hex).
You can probably guess that the game is adding $1000 to the tile index for vertically flipped tiles. Enter $1000 as the Flip-Y mask and click the Enabled tickbox to see the final map:
The map now looks perfect! Some tiles will have both masks applied to them, so a value of $303a would mean that tile number 6 is flipped horizontally ($2000) and vertically ($1000).
Internally the map ripper is performing the following for every tile in the map:
- Reads the tile index from memory (eg. $b03a)
- Checks if the Flip-Y mask is set and enabled, and if so, subtracts the mask ($b03a - $1000 = $a03a)
- Checks if the Flip-X mask is set and enabled, and if so, subtracts the mask ($a03a - $2000 = $803a)
- Applies any shift (no shift specified)
- Applies any mask ($803a and $fff = $3a)
- Draws tile number $3a (58) both vertically and horizontally flipped onto the map!
On the Amiga, vertical tile flipping is extremely easy to perform with the blitter so is commonly found in games. Horizontal flipping cannot be done with the blitter and involves lookup tables or pre-calculating and storing flipped tiles, hence it is much more rare.
Incidentally, John Twiddy programmed Global Gladiators, Cool Spot and Aladdin, and all 3 games use the same flip-masks despite different tile sizes!
You may enjoy these articles...
If you look inside many Amiga games, secret messages have been hidden by the programmers. Richard Aplin was the king of hiding messages in the startup-sequence file, and his Line of Fire and Final Fight startup-sequences have become legendary! The Sensible Software team were also prolific at hiding messages in their games.
A collection of technical interviews with Amiga programmers that worked on commercial software in the glory days of the Amiga (late 1980s to early 1990s!)
The Ultimate Amiga Graphics, Level and Map Ripper!
A random assortment of rants relating to the Amiga!
An explanation of how many famous Amiga games utilised sprites in weird and interesting ways