Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages
File formats
Overview
There are two file types: level and map files. There are one or more map files for each level file. The level file represents the data common to a set of levels (sprites and status screen information) where as the map file represents the data for one level ie how to draw the map and what the bad guys are going to do.
The game searches for level files sorted by uid. So it will run level file with uid3 equal to 1 before level file with uid3 equal to 2. It then searchs for map files with uid3 equal to the level file number and runs each of these in the order it finds them.
Map Files
Map files contain the information about:
- Which background sprites to plot to form the map.
- When to introduce bad guys.
- The paths the bad guys will follow.
- Which sprites to use for bullets, players ship and explosions.
- Where the players ship starts.
- Initial health and powerups of players ship.
Format
- 32bit uid 1 = application uid
- 32bit uid 2 = 2 (this is a map file)
- 32bit uid 3 = level number (which level file to load with this map)
- 32bit uid crc
- 32bit offset to map data
- 32bit offset to path data
- 32bit sprite number of players ship
- 32bit first sprite number to use for players ship explosion
- 32bit last sprite number to use for players ship explosion (inclusive)
- 32bit first sprite number to use for bad guy explosion
- 32bit last sprite number to use for bad guy explosion (inclusive)
- 32bit sprite number of first of 8 sequential sprites to use for bullets of power 1
- 32bit sprite number of first of 8 sequential sprites to use for bullets of power 2
- 32bit sprite number of first of 8 sequential sprites to use for bullets of power 3
- 32bit sprite number of first of 8 sequential sprites to use for bullets of power 4
- 32bit X position of players ship at start of level
- 32bit Y position of players ship at start of level
- 32bit health of players ship at start of level
- 32bit number of powerups for players bullets at start of level (only used if player is starting a new game on this level, other wise will use the number of powerups the player had at the end of the previous level)
- n * 2 * 8 (N * 8 * TInt16s) of map data (see file TMapLineType.h)
- n * 2 * 4 (N * 4 * TInt16s) of path data (see file TPathLineType.h)
Level Files
These contain the background and ship sprites and the information and sprites used to draw the status screen.
Format
- 32bit uid 1 = application uid
- 32bit uid 2 = 1 (this is a level file)
- 32bit uid 3 = level number (used to match map and level files together)
- 32bit uid crc
- 32bit map sprites offset
- 32bit ship sprites offset
- 32bit offset to status data and sprites
- map, ship, and status data.
Offsets are given from the first non uid byte, ie the offset of the map sprites offset is 0, the offset of the ship sprites offset is 4 the offset of the uid crc is -4 etc.
Map sprites are 64 pixels by 50 pixels, 2 pixels are stored in each 32bit word, so each sprites is 6400 bytes, see the sprite format for more infomation
Ship sprites are 32x24 pixels, again 2 pixels in one 32bit word, so each sprite is 1536 bytes, see the sprite format for more infomation
Status screen data is a list of the size and where to put sprites for the health and ships, what background sprites to plot, and where to put the score see the RStatus class for more information.
Sprite data format
The sprite data is a series of 32 bit words, the words are broken down into 8 nibbles (nibble = 1/2 byte) each of which represents mask information and two pixels. Numbering the nibbles 87654321 where 8 is the most significant nibble we have:
- nibble 8, bits give landscape/ship/ship extension mask:
- bit 3 = landscape
- bit 2 = ship extension, unused
- bit 1 = players ship
- bit 0 = unused
- nibble 7, red component of right hand pixel
- nibble 6, green component of right hand pixel
- nibble 5, blue component of right hand pixel
- nibble 4, mask for players bullets, 4 bits giving the number of the bullet. 8 bullets are currently supported.
- nibble 3, red component of left hand pixel
- nibble 2, green component of left hand pixel
- nibble 1, blue component of left hand pixel
Sprites are always a multiple of 32bit words therefore the X dimension of sprites is always a mutiple of 2. Also the sprite routines in the game only handle plotting sprites on 32bit boundarys so for a 640 pixel wide screen X dimensions run from 0-319. (ie plotting a sprite at 10,20 will put it at 20 pixels in from the left and 20 pixels down from the top).
Generating uids
The 3 uid words and the uid crc are generated using uidcrc.exe which takes 4 parameters. The three uids and the name of the file to create with the 16 byte uid header.
Documentation for Game (Beta) version 1.44.