If SizeX = 1 (EXCEPT if SizeY = 1 in which case it is a 1*1 BM) the BM file is multiple.
The header of multiple BMs is different from that of a normal BM.
BM_Multiple_Header IS
{
| MAGIC | char[4] | // = 'BM ' + 0x1E |
| SizeX | int | // = 1 |
| SizeY | int | // = length of file - 32 |
| idemX | int | // = -2 |
| idemY | int | // number of 'sub' BMs |
| Transparent | byte | |
| logSizeY | byte | |
| Compressed | int | |
| DataSize | long | |
| pad1 | byte[12] | // 12 times 0x00 |
}
Straight after the Multiple BM header are two bytes:
- The first is either the frame rate (in frames per second) of an animated texture, or is 0 to designate a switch. You may alter this value if you want.
- The second byte is 2.
Then follows a table of offsets to the 'sub' BM composed of idemY long.
The simple fact that this table exists tells us that sub BMs of different sizes may be stored.
Each 'sub' BM then has its own header, slightly different from the BM_Header:
BM_SUBHeader IS
{
| SizeX | int | // horizontal size |
| SizeY | int | // vertical size |
| idemX | int | // unused by engine |
| idemY | int | // unused by engine |
| DataSize | long | // unused (no compression allowed) |
| logSizeY | byte | // logSizeY = log2(SizeY) |
| pad1 | byte[3] | |
| u1 | byte[3] | // these are always filled, but they seem // to be unused |
| pad2 | byte[5] | |
| Transparent | byte | // 0x36 for normal // 0x3E for transparent |
| pad3 | byte[3] |
}
Important notes
1) There is no MAGIC field.
2) For a multiple BM to work correctly, it must be made a SIGN, and for switches there MUST also exist a corresponding trigger in the .INF Else, switches will be displayed wrong (as a single column) and the animated will display correctly, but static.
This means that you cannot do animated floors and ceilings this way !
3) The multiple BMs are limited to 64K in size because SizeY contains the size of the file - 32 and is an int.
Although it should never be a problem with switches, this means that you must use animated BMs for small textures only.
A solution that allows animated walls of any size AND animated floors and ceilings is to compose a huge texture with your multiple images pasted next to each other. Then use INF elevators to scroll wall or scroll floor/ceiling using the offsets of the images as stops. If you set a speed of 0, the change will be instantaneous, and the effect will be the same. An added bonus is that you'll also have complete control on starting/stopping the animation.