************************************* | Star Fighter 3000 | | Documentation Project | ************************************* | Reference 1: File Formats | | Changed: CJB 30.08.20 | ************************************* N.B. This text is best viewed at a display width of 77 columns. To create an index do a 'List of found' search for ">>". ----------------------------------------------------------------------------- >> Contents: ========= 1.1 Polygon colours 1.2 Polygonal objects set 1.2.1 Plot type data 1.2.2 Explosion data 1.2.3 Object attributes 1.2.4 Vertex data 1.2.5 Clip distance and polygon data 1.2.6 Collision data 1.3 Ground map 1.4 Ground map overlay 1.5 Objects grid 1.6 Objects grid overlay 1.7 Sky colours 1.8 Mission data 1.8.1 Ship performance data 1.8.2 Ship adding data 1.8.3 Ground objects trigger 1.8.4 Flightpath 1.8.5 Text data block 1.8.6 Information point 1.8.7 Ship directions 1.9 Sky pictures set 1.10 Map tile graphics set 1.11 Map animations 1.12 Hill colours 1.13 Music track 1.14 Audio data 1.15 Colour numbers 1.16 Ground object numbers 1.17 Ship object numbers 1.19 Text font ----------------------------------------------------------------------------- >> 1.1 Polygon colours =================== Filetype: &154 ('Fednet') Location: Landscapes.Palette Compression: Yes Purpose: Maps the 320 logical colours used on polygonal objects to the 256 colours actually available in screen mode 13. Size: 320 bytes (decompressed) Description: Polygon colours files can't be easily identified because the same generic filetype is used for many other kinds of compressed game data and code. Each entry in the palette is a byte interpreted as a colour number (see 1.15 for format). The first 256 entries should always map logical colours directly to the corresponding colour number (0,1,2,3,4, etc). In addition, there are 44 entries for flashing colours - such as the engine exhausts of space craft, towers on the ground, and navigation lights. These entries are grouped into words, each containing four colour numbers. Finally, 20 more static colours are available for applying different liveries to the player's spacecraft, such as the strategic bomber, command ship or fast ship. Offset Data +0... Static colours +256... Player's engine (4 colours) +260... Fighter's engine (4 colours) +264... Cruiser's engine (4 colours) +268... Super fighter's engine (4 colours) +272... Enemy ships (4 colours) +276... Friendly ships (4 colours) +280... Player's ship (4 colours) +284... Ground objects A (4 colours) +288... Ground objects B (4 colours) +292... Miscellaneous A (4 colours) +296... Miscellaneous B (4 colours) +300... Player's ship (Predator) livery ----------------------------------------------------------------------------- >> 1.2 Polygonal objects set ========================= Filetype: &300 Location: LandScapes.Graphics Compression: Yes Purpose: Defines a complete set of polygonal objects - including all fighters, spaceships, ground installations, bonus coins etc. These graphics sets are interchangeable. Size: Varies according to number and complexity of objects Description: The number of objects in a polygonal objects set can only be found by iterating over them until the end-of-file marker is encountered. Their order is significant relative to other objects of the same type; ground and ship objects must be defined in the order listed in sections 1.16 and 1.17. The maximum possible size of a polygonal objects set is limited by the fact that the game uses a buffer size of 256 KB. Also, the size of the ARM code generated from a polygonal objects set must not exceed 200 KB. The relationship between source data and generated code size is complex. A polygonal objects set starts with shared command sequences used to plot complex objects (i.e. those that do not use plot type 0). Each plot type is defined as a sequence of commands that specify polygon groups to be plotted and normal vectors to be tested to determine whether a whole group is back- facing and can be culled (see 1.2.1 for format). This data is a variable length sequence of bytes with no alignment requirements. The command sequence for each plot type is terminated by byte value 255. There is assumed to be at least one plot type. No more than 10 plot types may be defined without causing a buffer overflow. The terminator of the last command sequence must be followed by byte value 254. The object definitions follow the plot type definitions at the first word aligned address at least 4 bytes ahead of the '254' terminator. There is assumed to be at least one object. No more than 64 ground objects, 64 bit objects and 32 ship objects may be defined without causing a buffer overflow. Each object definition begins with explosion data (see 1.2.2 for format). The size of this data is variable: 4 bytes + 36 bytes per explosion line. Most of the object's attributes are defined in the 12 bytes immediately following the explosion data, beginning with its type (see 1.2.3 for format). The start address will be naturally word-aligned. The object's vertex coordinates are defined immediately after the rest of its attributes (see 1.2.4 for format). The size of this data is 1 byte + 3 bytes per vertex. The start address will be naturally word-aligned. The object's clip distance and polygon data (see 1.2.5 for format) follow at the first word-aligned address after the vertex data. The size of this data is 5 bytes + 2 bytes per polygon + 1 byte per polygon side. The object's collision data (see 1.2.6 for format) follows at the first word-aligned address after the polygon data. The size of this data is 12 bytes + 28 bytes per collision box. There is assumed to be at least one collision box. There is a gap of 4 bytes between the last collision box and the start of the next object definition or the end-of-file marker (word value 99). The start address will be naturally word-aligned. In summary, the layout of a polygonal objects set is as follows: Plot type definitions For each object: Explosion data Miscellaneous attributes Vertex data Clip distance Polygon data Collision data >> 1.2.1 Plot type data A plot command may be one or two bytes in size. The second byte usually specifies a polygon group to be plotted if the result of a normal vector test is favourable, but the group number is instead encoded in bits 0-4 of the first byte if the action is 0 (always plot facing polygons). Although the same plot types are shared by all object definitions, the polygon group and vector test numbers in plot commands are interpreted with reference to the object being plotted. The number of polygon groups and vector tests for an object depends upon its polygon definitions (see 1.2.5). If a command's action is greater than 0 then bits 0-4 specify a vector test. This is the index of a polygon in group 7, derived from the order of polygon definition. The game calculates the z component of the normal vector of the plane on which the polygon sits. If the result is negative then the vector test fails; otherwise it passes. The outcome affects all polygons in the group to be plotted. If a command's action is less than 3 and the specified polygon group was not culled then normal vectors will also be calculated for individual polygons to determine whether they are facing the camera. Offset Data +0 Bits 0-4: Operand - vector test governing whether or not to cull the polygon group (if action is not 0). OR polygon group number (0..6) to be plotted unconditionally (if action is 0). Bits 5-7: Action - specifies conditions for culling the group and whether to also cull individual backfacing polygons. +1 Polygon group no. (0..6) to be plotted if action is not 0. Plot command actions: Number Action 0 Always plot facing polygons in the group 1 Plot facing polygons in the group if the vector test passes 2 Plot facing polygons in the group if the vector test fails 3 Plot all polygons in the group if the vector test passes 4 Plot all polygons in the group if the vector test fails 5..6 Illegal (but behave like action 4) 7 End of commands for plot type if operand is 31, else illegal >> 1.2.2 Explosion data Offset Data +0(w) Last line number in explosion (signed word) +8... Explosion line data (see format below) +8... 36 bytes for line 0 +44... 36 bytes for line 1 ... Explosion line: Offset Data +0(w) x0 coordinate (signed word) +4(w) y0 coordinate (signed word) +8(w) z0 coordinate (signed word) +12(w) x1 coordinate (signed word) +16(w) y1 coordinate (signed word) +20(w) z1 coordinate (signed word) +24(w) Colour 1 +28(w) Colour 2 +32(w) Number of groups The x and y coordinates are sign-inverted upon loading. >> 1.2.3 Object attributes Offset Data +0 Type (0 = Ground, 1 = Bit, 2 = Ship) +1 Coordinates scale (base-2 logarithm: 0..2) +2 Number of static vertices (minimum is 1) before all coordinates are rotated around the Z axis. 0 means no rotation. +3 Bits 0-3: y size of collision area in map tiles (ground objects only) Bits 4-7: x size of collision area in map tiles (ground objects only) +4(h) x clip size/2 (unsigned halfword, ship or ground objects only) +6(h) y clip size/2 (unsigned halfword, ship or ground objects only) +8 Score/25 (ship or ground objects only) +9 Number of hits a ground object can take OR minimum altitude/262144 for ship objects 13-15 (see 1.17) +10 Explosion style (ship or ground objects only) +11 Bits 0-3: Plot type (see 1.2.1) Bits 4-7: Highest polygon group number (0..6) >> 1.2.4 Vertex data A left-handed coordinate system is used to specify vertex positions. Ground level is the xy plane with z=0 and all negative z coordinate values are above ground. A vertex's coordinates are encoded as base-2 logarithmic offsets from the position of the preceding vertex, therefore the order of vertex definition is significant. The first vertex's coordinates are relative to the object's centre. The offset range is +/-32 in each dimension. Offset Data +0 Number of vertices in object +1... Vertex definitions (see format below) +1... 3 bytes for vertex 0 +4... 3 bytes for vertex 1 ... Vertex definition: Offset Data +0 x offset from previous vertex (85..90 or 96..104 or 110..115) +1 y offset from previous vertex +3 z offset from previous vertex Interpretation of vertex offsets: 85...90 : -2 to the power of 5...0 96...99 : -1 / (2 to the power of 1...4) 100 : 0 101...104 : +1 / (2 to the power of 4...1) 110...115 : +2 to the power of 0...5 >> 1.2.5 Clip distance and polygon data Polygons are defined as a set of vertex indices and a colour for flat- shading. Polygons have the same number of vertexes as sides, and they are assumed to have at least 3 sides. Vertex indices are derived from the order of vertex definition. Offset Data +0(w) Clip distance (signed word). Polygons may need to be clipped if the object is closer to the camera. +4 Number of polygons in object +5... Polygon definitions (see format below) Polygon definition: Offset Data +0 Bits 0-3: Number of sides (n) Bits 4-6: Group number (0..6 = Polygon group, 7 = Vector test group) Bit 7: Most significant bit of the colour index (see section 1.1) +1... Vertex indices +1... 1 byte for the first vertex index +2... 1 byte for the second vertex index ... +1+n Least significant 8 bits of the colour index (see section 1.1) >> 1.2.6 Collision data If x0 > x1 or y0 > y1 or z0 > z1 then the reversed coordinate pair will be swapped to ensure the collision box does not have a negative size in any dimension. The 7 least significant bits of coordinate values are discarded to allow them to be encoded as immediate constants in ARM instructions. This is equivalent to signed division rounding toward negative infinity (not zero). If the value is greater than 32,767 or less than -32,640 then the 9 least significant bits will be discarded. Values greater than 131,071 or less than -130,560 are illegal because they cannot be encoded as an 8 bit value left- shifted by 9 bits. Offset Data +0(w) Last collision box number (signed word) +4... Free +12... Collision boxes (see format below) +12... 28 bytes for collision box 0 +40... 28 bytes for collision box 1 ... Collision box: Offset Data +0 Type (unused) +1... Free +4(w) x0 coordinate (signed word; -130560 to 131071) +8(w) y0 coordinate (signed word; -130560 to 131071) +12(w) z0 coordinate (signed word; -130560 to 131071) +16(w) x1 coordinate (signed word; -130560 to 131071) +20(w) y1 coordinate (signed word; -130560 to 131071) +24(w) z1 coordinate (signed word; -130560 to 131071) ----------------------------------------------------------------------------- >> 1.3 Ground map ============== Filetype: &400 Location: LandScapes.Base.SprScape Compression: Yes Purpose: Holds the ground tiles map for a base map. Size: 64 KB (decompressed) Description: Ground maps are 256 tiles wide by 256 tiles long. Each map location is represented by a single byte which is interpreted as a tile number (0-254) to be incorporated in the global texture map. The value 255 is reserved because it has a special meaning for map overlays. The interpretation of a ground map depends on the tile graphics set specified by the mission data; see section 1.8. Only very simple maps will work correctly with all graphics sets. Offset Data +0 tile number at map location 0,0 +1 tile number at map location 0,1 +2 tile number at map location 0,2 ...etc ... +256 tile number at map location 1,0 +257 tile number at map location 1,1 +258 tile number at map location 1,2 ...etc ... +65535 tile number at map location 255,255 ----------------------------------------------------------------------------- >> 1.4 Ground map overlay ====================== Filetype: &401 Location: LandScapes.Level.SprScape.E/M/H Compression: Yes Purpose: Patches a base ground map with the features required for a specific mission. Size: 64 KB (decompressed) Description: The decompressed data format is essentially the same as for a base map file, except that a tile number of 255 means that the corresponding location should not be overwritten by the overlay map. Offset Data +0 tile number at map location 0,0 +1 tile number at map location 0,1 +2 tile number at map location 0,2 ...etc ... +256 tile number at map location 1,0 +257 tile number at map location 1,1 +258 tile number at map location 1,2 ...etc ... +65535 tile number at map location 255,255 ----------------------------------------------------------------------------- >> 1.5 Objects grid ================ Filetype: &402 Location: LandScapes.Base.FxdObj Compression: Yes Purpose: Holds the positions of the ground objects on the base maps. Size: 16 KB (decompressed) Description: Static polygonal objects (such as trees and gun towers) are mapped onto a grid 128 wide by 128 long. Each grid location is represented by a single byte that is interpreted as the type of object (1-254) to place there at the start of a mission, or 0 to leave that location empty. The value 255 is reserved because it has a special meaning for grid overlays. Every grid location corresponds to the centre of a set of four adjoining tiles in the ground map, because the objects grid is half the resolution of a ground map. The interpretation of an objects grid depends on the polygonal objects set specified by the mission data; see section 1.8. Only very simple grids will work correctly with all objects sets. Offset Data +0 object number at grid location 0,0 +1 object number at grid location 0,1 +2 object number at grid location 0,2 ...etc ... +128 object number at grid location 1,0 +129 object number at grid location 1,1 +130 object number at grid location 1,2 ...etc ... +16383 object number at grid location 127,127 ----------------------------------------------------------------------------- >> 1.6 Objects grid overlay ======================== Filetype: &403 Location: LandScapes.Level.FxdObj.E/M/H Compression: Yes Purpose: Patches a base objects grid with the features required for a specific mission. Size: 16 KB (decompressed) Description: The decompressed data format is essentially the same as for a base objects grid, except that an object number of 255 means that the corresponding location should not be overwritten by the overlay grid. Offset Data +0 object number at grid location 0,0 +1 object number at grid location 0,1 +2 object number at grid location 0,2 ...etc ... +128 object number at grid location 1,0 +129 object number at grid location 1,1 +130 object number at grid location 1,2 ...etc ... +16383 object number at grid location 127,127 ----------------------------------------------------------------------------- >> 1.7 Sky colours =============== Filetype: &404 ('SFSkyCol') Location: LandScapes.Sky Compression: Yes Purpose: Stores the colours used to paint a planetary atmosphere. Size: 512 bytes (decompressed) Description: A sky definition begins with an 8 byte header. The first word is an offset to be added to the camera's altitude within the game world, which is used to control how thinly to render the colour bands. The second word specifies the altitude at which to start plotting stars. The patterns are directly after the header (8 bytes from the start of the file). Each pattern comprises 4 pixels with 8 bits per pixel (4 bytes in total) and each pixel is a colour number (see 1.15 for format). Each quad-pixel pattern is tiled across the full width of the screen, and also vertically as many times as is necessary to 'stretch' that colour band to the desired height. On alternate lines the pattern is rotated left by one pixel, to avoid the ugly vertical stripes that would otherwise result. Offset Data +0(w) Render offset (signed word; 0 to 2048) +4(w) Stars plot altitude (signed word; -32768 to 2048) +8... Patterns data (see format below) +8... 4 bytes for pattern 1 +12... 4 bytes for pattern 2 +16... 4 bytes for pattern 3... ... +508.. 4 bytes for pattern 126 Pattern: Offset Data +0 Leftmost pixel of pattern ... +3 Rightmost pixel of pattern ----------------------------------------------------------------------------- >> 1.8 Mission data ================ Filetype: &405 Location: LandScapes.Missions.E/M/H Compression: Yes Purpose: Stores all details about a mission, including the briefing text, information points, details of flying ships, flightpaths, ship performance data, map and graphics to use. Size: 7060 bytes (decompressed) Description: Offset Data +0 X position of player's ship +1 Y position of player's ship +2 Z position (altitude) of player's ship +3 Direction of player's ship (see 1.8.7) +4 Player has special setup for this mission? (0=No, 1=Yes) +5 Player's laser power +6 Player's engine power +7 Player's control rating +8 Player's shields strength +9 Player's number of A-T-A missiles +10 Player's number of A-T-G missiles +11 Player's number of aerial mines +12 Player's number of freefall bombs +13 Player's number of wide area laser shots +14 Player's number of multi-missiles +15 Player's ship graphic type (see 1.2.3) +16 Number of hits against Fednet allowed +17.. Free +19 Is this a space/cyber mission? (0=No, 1=Yes) +20... Cloud colours +22 Do we need to dock to finish? (0=No, 1=Yes) +23 Mothership number if player starts docked in one, otherwise 255. +24(w) Number of ground object triggers (0-64) +28... Ground triggers... (see 1.8.3 for format) +28... 4 bytes for ground trigger 0 +32... 4 bytes for ground trigger 1 ... +280 4 bytes for ground trigger 63 +284(w) Number of information points on mission map (signed word; 0 to 16) +288... Information points... (see 1.8.6 for format) +288... 4 bytes for information point 0 +292... 4 bytes for information point 1 ... +348... 4 bytes for information point 15 +352(w) Mission time +356(w) Defence time +360 Chance of defences firing a laser or launching a missile, encoded as an unsigned byte with various interpretations: ((P(laser) * 1024) - 61) / 2 (between 5.9% and 55.8%) (P(missile) * 1024) - 17 (between 1.7% and 26.6%) ((P(satellite) * 1024) - 65) / 2 (between 6.3% and 56.2%) +361 Laser fire type +362 Bits 0-3: Type of fighter to launch from big ships/hangars (see 1.2.3) Bits 4-7: Number of fighters per hangar +363 Chance of hangar launching a fighter, encoded as an unsigned byte: ((P(fighter) * 1024) - 65) / 2 (between 6.3% and 56.2%) +364(w) Mission level number +368(w) Mission pyramid number +372 Is mission map unavailable? (0=No, 1=Yes) +373 Prevent damage to ground map? (0=No, 1=Yes) +374... Free +404... Ship type performance data (see 1.8.1 for data format) +404... 32 bytes for ship type 1 +436... 32 bytes for ship type 2 +468... 32 bytes for ship type 3 +500... 32 bytes for ship type 4 +532... 32 bytes for ship type 13 +564... 32 bytes for ship type 14 +596... 32 bytes for ship type 15 +628(w) Number of ships already in combat area (0-32) +632... Ships already in combat area (see 1.8.2 for data format) +632... 32 bytes for ship 0 +664... 32 bytes for ship 1 ... +1624.. 32 bytes for ship 31 +1656(w) Number of flightpaths (0-8) +1660... Flightpaths (see 1.8.4 for data format) +1660.. 260 bytes for flightpath 0 +1920.. 260 bytes for flightpath 1 ... +3480.. 260 bytes for flightpath 7 +3740... Ancillary file path names (each is 11 characters + terminator) +3740... Ground map filename +3752... Ground map overlay filename +3764... Objects grid filename +3776... Objects grid overlay filename +3788... Map animations filename +3800... Map tile graphics set filename +3812... Polygonal objects set filename +3824... Sky colours filename +3836... Sky pictures filename +3848... Palette filename +3860... Hill colours filename +3872(w) Number of text blocks in mission briefing (signed word). The offset to the first information point text block is immediately after the offset to the last mission briefing text block. +3876(w) Number of information points (signed word). Unused, duplicates value at +284. There are two text blocks per information point. +3880... Offsets to text blocks +3880(w) Offset to text block 1 (from this address) +3884(w) Offset to text block 2 ... +3952(w) Offset to text block 19 +3956 Should be 255 (string terminator) +3957... Free +3988... 3 KB of text data (see 1.8.5 for data format) >> 1.8.1 Ship type performance data Offset Data +0(w) Chance of firing a laser (between -1 and 2047), encoded as (P(laser) * 2048) - 1 +4(w) Laser type (0-7 for fighters, 0-8 for big ships) +8(w) Fighter: Engine power (10-35000, 8192=low, 32768=missile) +12(w) Fighter: Manoeuvrability (2-30) +16(w) Shield strength (50-5000 for fighters, 0-999999 for big ships) +20(w) Chance of firing A-T-A missile (between -1 and 2047), encoded as (P(missile) * 2048) - 1 +24(w) Big ship: Chance of launching fighter (between -1 and 2047), encoded as (P(fighter) * 2048) - 1. Ignored if friendly ship. +28(w) Big ship: How many fighters can we launch? (between -1 and 10) >> 1.8.2 Ship already in combat area Offset Data +0(w) X position +4(w) Y position +8(w) Z position (altitude) +12 Type (0-4 or 13-15) +13 Bits 0-1: Start mode (0=Attack, 1=Flightpath, 2=Follow ship) Bit 2: Allegiance (0=Enemy, 1=Friendly) Bit 3: Cloaking on? (0=No, 1=Yes) +14 Start point in flightpath +15 Ship/flightpath to follow If flightpath, then path number (0-7) If ship follow, then ship number (0-15, 255=follow players ship) +16(w) X follow offset +20(w) Y follow offset +24(w) Z follow offset +28 Mission importance (0=None, 1=Must kill, 2=Must survive, 3=Must survive and finish flightpath, 4=No special datablock, 5=Must not land) +29 Bit 0: Ignore incoming attack? (0=No, 1=Yes) Bit 1: On flightpath, player proximity action (0=Ignore, 1=Join formation (Fr) or attack(En)) +30 Big ship motion (0=fly around, 1=rotating wheel space station, 2=spinning top space station, 3=don't move) +31 Bits 0-3: Pilot's name (0=None, 1=Callum Blaze, 2=Luke Forester, 3=Jane-Holly Dean, 4=Hazel Phoenix, 5=Dave Valiant, 6=Stefan Lancaster, 7=Crusher, 8=Allied Pilot, 9=Leslie Jacobs, 10=Jake Phillips, 11=Spyder, 12=John.T.Booker, 13=Kelly Forester, 14=Trainee Pilot I, 15=Trainee Pilot II) Bits 4-7: Starting direction (see 1.8.7) >> 1.8.3 Ground objects trigger Offset Data +0 X position of check (on ground map). Halved on loading to convert to an objects grid coordinate. +1 Y position of check (on ground map). Halved on loading to convert to an objects grid coordinate. +2 Type of trigger (activated when object destroyed) 0 = Mission target (should destroy) 1 = Multi A-T-A missiles bonus 2 = Megalaser shots bonus 3 = Freefall bombs bonus 4 = Aerial mines bonus 5 = Set defences inactive timer 6 = Chain reaction (chain to previous trigger in list) 7 = Do nothing 8 = Reduce shields of ship class to 256 (used for remote shield generators) 9 = Cash bonus 10 = Set mission timer (used for power-surge twin towers) 11 = Fednet building (should protect) 12 = Mission target (should destroy) 13 = Fix scanners (used for radar-jamming installations) +3 Parameter (meaning depends on trigger type) 1 : Number of missiles to award 2 : Number of megalaser shots to award 3 : Number of bombs to award 4 : Number of mines to award 5 : Extra seconds of inactive time, or 255 = activate defences 6 : Time (number of frames/2) until blow next object 8 : Ship type to cripple (see 1.2.3) 9 : Credits/10 to award 10 : Seconds until mission fail >> 1.8.4 Flightpath Offset Data +0(w) Number of waypoints in flightpath (0-64) +4... Waypoints data (see format below) +4... 4 bytes for waypoint 1 +8... 4 bytes for waypoint 2 +12... 4 bytes for waypoint 3... ... +256... 4 bytes for waypoint 64 Waypoint: Offset Data +0 X coordinate +1 Y coordinate +2 Z coordinate +3 Free >> 1.8.5 Text data block Offset Data +0... Header data (undocumented) +48... String of characters (terminated by 255) >> 1.8.6 Information point Information point coordinates are relative to the south-west corner of the ground map, in map tiles. Offset Data +0 X coordinate +1 Y coordinate +2... 2 bytes free >> 1.8.7 Ship directions Ships can start a mission heading in any cardinal or ordinal direction: Number Direction 0 South 1 South-east 2 East 3 North-east 4 North 5 North-west 6 West 7 South-west ----------------------------------------------------------------------------- >> 1.9 Sky pictures set ==================== Filetype: &406 ('SFSkyPic') Location: LandScapes.Planets Compression: Yes Purpose: Contains the images of distant planets and other celestial bodies to be rendered in the sky. Size: 36 bytes + 1296 bytes per image (decompressed) Description: A sky pictures set (which may hold up to two images) begins with a 36 byte header. The first word is the number of the last image defined therein. The fact that only four words of the header are allocated for paint offsets effectively rules out files that contain more than 2 images, as does the fact that the game uses a buffer size of 5,248 bytes. Usually, the image bitmaps are stored directly after the header (36 bytes from the start of the decompressed data). Each bitmap comprises 36 by 36 pixels with 8 bits per pixel (1,296 bytes in total). Each pixel is a colour number (see 1.15 for format). A word-aligned bitmap always has two columns of black pixels on its right side. The non-aligned bitmap for the same image is identical, but offset to the right by two pixels (with two columns of black on its left side). The game chooses the aligned or non-aligned version of an image to accelerate drawing. N.B. Image 1 in the 'Alien' sky pictures file has coloured pixels down the right edge of its non-aligned bitmap. In the game, these pixels appear and disappear depending on the horizontal position of the image! This is a bug. Offset Data +0(w) Last image number in set (signed word; 0 or 1) +4(w) Horizontal paint offset for image 0 (signed word; -36 to 0) +8(w) Vertical paint offset for image 0 (signed word; -36 to 0) +12(w) Horizontal paint offset for image 1 +16(w) Vertical paint offset for image 1 +20(w) Offset to image 0 word-aligned bitmap (unsigned word) +24(w) Offset to image 0 non-aligned bitmap (unsigned word) +28(w) Offset to image 1 word-aligned bitmap +32(w) Offset to image 1 non-aligned bitmap +36... Image bitmaps (see format below) Image bitmap: Offset Data +0 Leftmost pixel of top row ... +35 Rightmost pixel of top row ... +1260 Leftmost pixel of bottom row ... +1295 Rightmost pixel of bottom row ----------------------------------------------------------------------------- >> 1.10 Map tile graphics set ========================== Filetype: &407 ('SFMapGfx') Location: LandScapes.Sprites Compression: Yes Purpose: Contains a set of map tile graphics to be used for rendering a certain type of ground map, and defines splash animations for that tile set. Size: 16 bytes + 256 bytes per tile (decompressed) Description: A map tile graphics set (which may hold up to 255 tiles) begins with a 16 byte header. The first word is the number of the last tile defined therein. Tile numbers must be between 0 and 254 because the value 255 has a special meaning in a map overlay. In practice, the fact that the game uses a buffer size of 49,168 bytes rules out tile graphics sets with more than 192 tiles. Bytes 4 to 7 of the header specify tile numbers for a splash animation, to be used when the ground map is damaged (e.g. by laser fire). Bytes 8 to 11 specify an alternative splash animation to be used where the damaged tile is one of those specified by bytes 12 to 15. Each alternative splash trigger is interpreted as the first of a pair of tile numbers, which allows eight tiles to be specified by only 4 bytes; just enough to define a second type of terrain which reacts to hits differently (e.g. with a splash effect rather than scorched earth). Conventionally, two of the triggers are mapped to the four tile numbers that comprise the alternative splash animation. However, the tiles set named "Death" breaks this rule for an unusual effect. The tile bitmaps are directly after the header (16 bytes from the start of the decompressed data). Each bitmap comprises 16 by 16 texels with 8 bits per texel (256 bytes in total). Each texel is a colour number (see 1.15 for format). The first row of texels is rendered at the southern edge of the tile and the last row at the northern edge (i.e. the bitmap must be flipped vertically to appear normal in an image editor). Offset Data +0(w) Last tile number in set (signed word; 0-254) +4 1st frame of standard animation (tile number 0-254) +5 2nd frame +6 3rd frame +7 4th frame +8 1st frame of alternative animation (tile number 0-254) +9 2nd frame +10 3rd frame +11 4th frame +12 1st trigger for alternative animation (tile number 0-254, implicitly including the next) +13 2nd trigger +14 3rd trigger +15 4th trigger +16... Tile bitmaps (see format below) +16... 256 bytes for tile 0 bitmap +272... 256 bytes for tile 1 bitmap +528... 256 bytes for tile 2 bitmap ...etc Tile bitmap: Offset Data +0 Westernmost texel of southern edge ... +15 Easternmost texel of southern edge ... +240 Westernmost texel of northern edge ... +255 Easternmost texel of northern edge ----------------------------------------------------------------------------- >> 1.11 Map animations =================== Filetype: &408 Location: LandScapes.Level.Animations.E/M/H Compression: Yes Purpose: Holds a list of ground map animations for a given mission. Unlike ground and objects maps, there is no concept of a 'base' animations file. Size: 16 bytes + 28 bytes per animation (decompressed) Description: A map animations set begins with a 16 byte header. The first word is the number of animations. In practice, the fact that the game uses a buffer size of 3,600 bytes (increased to 4,944 bytes in release 2.02) rules out sets with more than 128 (or 176) animations. Offset Data +0(w) Number of animations (signed word) +4... Unused +16... Animations data (see format below) +16... 28 bytes for animation 0 +44... 28 bytes for animation 1 ...etc Animation data: Offset Data +0(w) Offset into *expanded* ground map, e.g. ((y*256)+x)*4 +4(w) Timer counter (counts down to next update) +8(h) Reset counter (conventionally == timer counter, in file) +10(h) Frame number 0-3 (conventionally 0, in file) +12(w) Frame 0 tile number (or 255 for no change) +16(w) Frame 1 tile number (or 255 for no change) +20(w) Frame 2 tile number (or 255 for no change) +24(w) Frame 3 tile number (or 255 for no change) ----------------------------------------------------------------------------- >> 1.12 Hill colours ================= Filetype: &154 ('Fednet') Location: LandScapes.Hill Compression: Yes Purpose: Gives the colour palette used for the polygonal mountains. Size: 36 bytes (decompressed) Description: Polygon colours files can't be easily identified because the same generic filetype is used for many other kinds of compressed game data and code. Each entry in the palette is a byte interpreted as a colour number (see 1.15 for format). Offset Data +0 Colour 1 +1 Colour 2 +2 Colour 3... ... +35 Colour 36 ----------------------------------------------------------------------------- >> 1.13 Music track ================ Filetype: &154 ('Fednet') Location: Music Compression: Yes Purpose: Music tracks played by the SFX_Handler module. Size: 104 bytes + 1024 bytes per pattern (decompressed) Description: Until release 2.02 of Star Fighter 3000, the music tracks were incorporated directly into the 'SFX_Handler' module. In later releases, they were instead supplied as individual files containing the same data but encoded using Fednet's esoteric lossless compression algorithm. Music files can't be easily identified because the same generic filetype is used for other kinds of compressed game data and code. Offset Data +0 Tempo (metronome value in centiseconds, 0-255) +1... Unused +16... 16 byte table mapping voice numbers to sample numbers +16 Sample number to use for voice 0 +17 Sample number to use for voice 1 +18 Sample number to use for voice 2 ...etc +32(w) Number of patterns in track - 1 +36... Unused +40... 64 byte play order for patterns (terminated by 255) +104... Patterns data (see format below) +104... 1024 bytes for pattern 0 +1128.. 1024 bytes for pattern 1 +2152.. 1024 bytes for pattern 2 ...etc The value at offset +32 is supposedly a 32 bit word, and probably signed little-endian. However, there is no evidence to corroborate that because 'SFX_Handler' doesn't actually use this value. Patterns numbered higher than 254 would be inaccessible anyway because of the format of the play order. Pattern: Offset Data +0... 16 bytes for division 0 +16... 16 bytes for division 1 +32... 16 bytes for division 2 ... +1008.. 16 bytes for division 63 Division: Offset Data +0... Channel 1 data (0 for none) +4... Channel 2 data (0 for none) +8... Channel 3 data (0 for none) +12... Channel 4 data (0 for none) Channel data: Offset Data +0 Bits 0-3: Note number (in semitones, 0 to 11) Bits 4-7: Unused +1 Bits 0-3: Octave number (0 to 7) Bits 4-7: Linear volume (0 to 15) +2 Bits 0-3: Voice number (0 to 15) Bits 4-7: Action (0 none, 1 play, or 2 glissando) +3 Bits 0-3: Unused Bits 4-7: Number of repeats (0 to 15) The sample number to be used is looked up from the specified voice number using the voice table in the header. If action > 1 then a glissando effect is triggered, sliding all instances of the specified sample towards the specified pitch. The volume and repeats parameters of such commands are ignored. Otherwise a note is forced on the channel, using the specified sample, volume, pitch and repeats parameters. Early versions of the 'SFX_Handler' module automatically blocked sound effects whilst playing music. Sample numbers 0 to 11 are classified as effects whereas 12 to 22 are classified as instruments (surprisingly, 'Radio' is included in the latter category). Sound samples: Number Name Type 0 Thruster Effect 1 Laser Effect 2 SmallExp Effect 3 Explosion Effect 4 Fuzz Effect 5 Beep Effect 6 TextBeep Effect 7 Missile Effect 8 IncMissle Effect 9 ShieldWarn Effect 10 PickUp Effect 11 Wind Effect 12 Radio Instrument 13 BassLight Instrument 14 DrumLight Instrument 15 Piano Instrument 16 Snare Instrument 17 String Instrument 18 BassHeavy Instrument 19 DrumHeavy Instrument 20 TomGrab Instrument 21 Synth Instrument 22 HiHat Instrument ----------------------------------------------------------------------------- >> 1.14 Audio data =============== Filetype: &FFD ('Data') Location: Samples Compression: No Purpose: Audio data used by the SFX_Handler module for sound effects and musical instruments. Size: Varies according to the sample length. Description: Until release 2.02 of Star Fighter 3000, all of the instruments and sound effects required by the game were incorporated directly into the 'SFX_Handler' module in mono 8 bit Archimedes VIDC format (similar to mu-law). In later releases, the sound samples were instead supplied as individual files containing raw audio data in mono 16 bit little-endian signed linear format. This is better suited to the sound hardware in modern RISC OS machines and would make it possible to substitute equivalent sound samples with a greater dynamic range. ----------------------------------------------------------------------------- >> 1.15 Colour numbers =================== Cloud colours, polygonal object palettes, image and tile bitmaps all represent colours using the same additive RGB colour model with 4 bits per colour component. However, the 2 least-significant bits of each component (the 'tint' bits) must be equal for all three components. _____________________________________________________________________________ Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 Role | B high | G high | G low | R high | B low | R low | T high | T low Red component: (R high << 3) + (R low << 2) + (T high << 1) + T low Green component: (G high << 3) + (G low << 2) + (T high << 1) + T low Blue component: (B high << 3) + (B low << 2) + (T high << 1) + T low ('<< n' means 'left-shift by n binary places'.) For example, 42 (binary 00101010): B high 0, G high 0, G low 1, R high 0, B low 1, R low 0, T high 1, T low 0 Red: 0010 = 2/15 = 0.13 Green: 0110 = 6/15 = 0.4 Blue: 0110 = 6/15 = 0.4 This is similar to the SVG/HTML/CSS colour named 'Teal' (0.0, 0.50, 0.50). ----------------------------------------------------------------------------- >> 1.16 Ground object numbers ========================== Some ground object numbers are treated specially by the game engine and must be defined appropriately in every polygonal objects set in the order listed here (see section 1.2). These objects can be used in object grids (1.5) and grid overlays (1.6) without reference to the polygonal objects set specified by the mission data (1.8). Number Object 0 None 1..3 Ground guns 4..6 Surface-to-air missile launchers 7..8 Hangars or aircraft carriers 9..99 Miscellaneous ground objects 100..198 Reserved for clouds 199..247 Reserved for hills 248..254 None (used for collision references) 255 Mask (also used for collision reference) ----------------------------------------------------------------------------- >> 1.17 Ship object numbers ======================== All ship object numbers are treated specially by the game engine and must be defined appropriately in every polygonal objects set in the order listed here (see section 1.2). Number Object 0 Player's ship 1..4 Combat fighters 5 Bonus coin (1 credit) 6 Bonus coin (5 credits) 7 Bonus coin (extra life) 8 Bonus coin (50 credits) 9 Bonus coin (20 credits) 10 Bonus coin (10 A-T-G missiles) 11 Bonus coin (10 A-T-A missiles) 12 Damage coin 13 Big ship 14 Mothership 15 Big ship 16 A-T-G missile 17 A-T-A missile 18 Aerial mine 19 Freefall bomb 20 Parachute 21 Satellite ----------------------------------------------------------------------------- >> 1.19 Text font ============== Filetype: &154 ('Fednet') Location: Data.Font (Code.Font in the original Fednet release) Compression: Yes Purpose: Bitmap font used for large text (not the teletype-like text) in the game and its menu, bonus and level selection screens. Size: Varies according to number and dimensions of characters Description: Font files can't be easily identified because the same generic filetype is used for many other kinds of compressed game data and code. Only one font is supplied with the game. The maximum possible size of a font is limited by the fact that the game uses a buffer size of 30 KB (decreased to 30224 bytes in release 2). A font begins with an array that has 16 bytes of data per character. There is no way to determine how many characters a font contains except that it must be fewer than the lowest mask offset divided by 16. The supplied font has a 1 KB character data array (sufficient for 64 characters) but the table entries for characters 54..63 are garbage. Character table entry: Offset Data +0... Unused +4(w) Kerning offset, in bytes +8 X width-1 in words +9 Y height-1 in pixel rows +12(w) Offset to from start of font data to the character's masks When interpreting the kerning offset, you should assume that the address of a pixel at coordinates x+p,y+q is (320*q)+p bytes beyond the pixel at coordinates x,y and that the origin of the coordinate system is at the top- left. Character codes must be between 0 and 252 because values 253-255 have a special meaning. Character codes: Number Character 0..9 '0'..'9' 10..35 'A'..'Z' 36 '£' 37 ':' 38 '%' 39 Right-and-down arrow 40..49 Small '0'..'9' 50 Heart icon 51 Floppy disc icon 52 Right arrow icon 53 'Bonus' icon 54..63 None 253 Horizontal align to 12 pixels beyond the highest exact multiple of 16 pixels that is less than or equal to the current position 254 Space (12 pixels) 255 End of string When plotting characters, two masks are used: a foreground mask for the colour pattern to be plotted and a background mask for pixels read from the frame buffer. These masks have the same number of bits per pixel as the frame buffer and are applied using bitwise AND, which means they can darken colours as well as defining the shape of the character. In font data, the masks are interleaved: the first of each pair of words is the foreground mask for a block of 4 pixels and the second is the background mask for the same pixels. Successive pairs of words give masks for blocks to the right of their predecessor until the end of the row, whereupon the next pair of words is for the leftmost block on the next row. The final value of each pixel is computed as (f AND fmask) OR (b AND bmask) where f is the foreground colour to be plotted, fmask is the foreground mask, b is the background colour read from the frame buffer, and bmask is the background mask. Pixel values are colour numbers (see 1.15 for format).