************************************* | Star Fighter 3000 | | Documentation Project | ************************************* | Reference 1: File Formats | | Changed: CJB 23.10.03 | ************************************* 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.3 Ground map 1.4 Ground map overlay 1.5 Objects grid 1.6 Objects grid overlay 1.7 Sky colour definition 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.9 Planet graphics set 1.10 Map tile graphics set 1.11 Map animations 1.12 Hill colours 1.13 Music data ----------------------------------------------------------------------------- >> 1.1 Polygon colours =================== Filetype: &154 ('Fednet') Location: "Landscapes.Palette" Compression: Yes Purpose: Maps the 320 logical colours used on polygonal objects in the game to the standard static 256 colours available in mode 13. Description: Each entry in the palette is a single byte, being a mode 13 colour number. The first 256 entries are the static colours, and map directly to the standard 256 colours. 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. Note that this filetype is also used for other types of compressed Fednet files, for instance the game title pictures, compressed game code, and Stunt Racer 2000 tracks. Total length of polygon colours file: 320 bytes Offset Data +0... Static colours (standard 256 colours) +256... Engine 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... Fast flashing lights : +272... Enemy ships (4 colours) +276... Friendly ships (4 colours) +280... Player's ship (4 colours) +284... Medium flashing lights : +284... Ground objects A (4 colours) +288... Ground objects B (4 colours) +292... Miscellaneous (8 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. Description: Undocumented ----------------------------------------------------------------------------- >> 1.3 Ground map ============== Filetype: &400 Location: "LandScapes.Base.SprScape" Compression: Yes Purpose: Holds the ground tiles map for a base map. Description: All maps are 256 tiles wide by 256 tiles long. Each tile is represented by its reference number (0-254), and occupies a single byte in the map. Thus maps require exactly 64 KB of storage when decompressed into memory. The interpretation of a ground map depends on the map graphics set asked for by the mission data; see section 1.8. Only very simple maps will work correctly with all graphics sets. Offset Data +0 ref of tile at (0,0) +1 ref of tile at (0,1) +2 ref of tile at (0,2) ...etc +256 ref of tile at (1,0) +257 ref of tile at (1,1) +258 ref of tile at (1,2) ...etc ----------------------------------------------------------------------------- >> 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. Description: The file format is essentially the same as for the base map files, except that bytes with the value 255 are ignored. This effectively provides a mask to preserve the base map, when the overlay map is overlayed onto it. ----------------------------------------------------------------------------- >> 1.5 Objects grid ================ Filetype: &402 Location: "LandScapes.Base.FxdObj" Compression: Yes Purpose: Holds the positions of the ground objects on the base maps. Description: The polygonal objects are mapped onto a grid 128 wide by 128 long, each represented in the grid by a single byte, which is the reference number of that object. Thus the decompressed grid size is 16384 bytes (16k). Object numbers may be in the range 0-254, and the object with reference 0 is a blank. This theoretically allows up to 253 different types of ground object per map, though in fact many are hill & cloud references. The locations on the objects grid correspond to the centre of groups of four tiles on the ground map, being mapped at exactly half the resolution. The interpretation of an objects grid depends on the polygonal objects set asked for by the mission data; see section 1.8. Only very simple grids will work correctly with all objects sets. Offset Data +0 ref of object at (0,0) +1 ref of object at (0,1) +2 ref of object at (0,2) ...etc +128 ref of object at (1,0) +129 ref of object at (1,1) +130 ref of object at (1,2) ...etc ----------------------------------------------------------------------------- >> 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. Description: The file format for the objects grid overlays is virtually identical to that for the base objects grid. Similarly to the ground map overlay, bytes set to 255 are treated as a protective mask when overlaying the patch onto the base map. The objects grid overlay size is 16384 bytes (16k). ----------------------------------------------------------------------------- >> 1.7 Sky colour definition ========================= Filetype: &404 ('SkyCols') Location: "LandScapes.Sky" Compression: Yes Purpose: Stores the colours used to paint a planetary atmosphere. Description: Total length of sky file: 512 bytes Header: Offset Data +0 Min height of sky +4 Start height of star plot ...followed by 126 shades, each 4 pixels, 8bpp (may be dithered) ----------------------------------------------------------------------------- >> 1.8 Mission data ================ Filetype: &405 Location: "LandScapes.Missions.E/M/H" Compression: Yes Purpose: Stores all details about a mission, including the text briefing, location briefings, details of flying ships, flightpaths, ship performance data, map and graphics to use. Description: Total length of mission file: 7060 bytes Offset Data +0 X starting position of player's ship +1 Y starting position of player's ship +2 Starting height of player's ship +3 Start rotation of player's ship (0-7) +4 Special ship for this mission? (0=No, 1=Yes) If special ship, then details follow: +5 Laser power +6 Engine power +7 Control rating +8 Shields strength +9 Number of A-T-A missiles +10 Number of A-T-G missiles +11 Number of aerial mines +12 Number of freefall bombs +13 Number of wide area laser shots +14 Number of multi-missiles +15 Ship type we are flying +16 Number of hits against Fednet allowed +17 ? +18 ? +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 Are we starting docked? (255=No else Yes) +24(w) Number of ground object triggers +28... Ground triggers... (see 1.8.3 for data format) +284(w) Number of location briefings +288... Locations list... +352(w) Mission time +356(w) Defence time General mission difficulty: +360 Laser fire frequency +361 Laser fire type +362 [b0-b3] Type of fighter to launch from big ships/hangars [b4-b7] Fighters per hangar +363 Hangar launch frequency +364(w) Mission level number +368(w) Mission pyramid number Special mission variables: +372 Is scanner knackered? (0=No, 1=Yes) +373 Prevent damage to ground? (0=No, 1=Yes) +374... Free for future expansion of special variables Ship performance data (7 types, 32 bytes each): +404... Type 1 (fighter) data (see 1.8.1 for data format) +436... Type 2 (fighter) data +468... Type 3 (fighter) data +500... Type 4 (fighter) data +532... Type 13 (big ship) data +564... Type 14 (big ship) data +596... Type 15 (big ship) data Ships starting this mission: +628(w) Number of ships flying (up to 32 ships, 32 bytes each)) +632... Ship 1 position and details (see 1.8.2 for data format) +664... Ship 2 position and details +696... Ship 3 position and details +32 Ship x position and details... Flightpaths: +1656(w) Number of flightpaths (up to 8 flightpaths, 260 bytes each) +1660.. Flightpath 1 (see 1.8.4 for data format) +1920.. Flightpath 2 +2180.. Flightpath 3 +260 Flightpath x Associated files: (each filename is 11 chars+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 colour definition filename +3836.. Planet graphics filename +3848.. Palette filename +3860.. Hill colours filename (This data is deliberately encoded) Mission briefing: +3872(w) No. of briefing strings? +3876(w) No. of visit strings? +3880(w) Offset to text block 1 (from this address) +3884(w) Offset to text block 2 +3888(w) Offset to text block 3...etc (19 offsets) +3956... Title string (obsolete - is usually the 1st text block) +3988... 3 KB of text data (see 1.8.5 for data format) >> 1.8.1 Ship performance data Offset Data +0(w) Chance of firing lasers (out of 2048) +4(w) Laser type (~0-8) +8(w) FT: Engine power (~5000-35000, 8192=low, 32768=missile) +12(w) FT: Manoeuvrability (~2-30) +16(w) Shield strength (~50-5000, 999999=remote generator) +20(w) FT: Chance of firing A-T-A missile (out of 2048) +24(w) BS: Chance of launching fighter (out of 2048) +28(w) BS: How many fighters can we launch? (~0-10) >> 1.8.2 Ship adding data Offset Data +0(w) X position +4(w) Y position +8(w) Height +12 Type (0-4, 13-15) +13 First flags byte: [b0-b1] Start mode (0=Attack, 1=Flightpath, 2=Follow ship) [b2] Allegiance (0=Enemy, 1=Friendly) [b3] 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) Height 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 Second flags byte: [b0] Ignore incoming attack? (0=No, 1=Yes) [b1] On flightpath, player proximity action (0=Ignore, 1=Join formation (Fr) or attack(En)) +30 Big ship movement pattern (0=fly around, 1=spinning top space station 2=rotating wheel space station 3=don't move) +31 Direction and pilot [b0-b3] Pilot's name (0-15) [b4-b7] Starting direction (0-15) >> 1.8.3 Ground objects trigger Offset Data +0 X position of check (on objects grid) +1 Y position of check (on objects grid) +2 Type of trigger (activated when object destroyed) 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) 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 9 : Credits/10 to award 10 : Seconds until mission fail >> 1.8.4 Flightpath Offset Data +0(w) Number of points in flightpath (up to 64!) +4... Point 1 (4 bytes) +0 X coordinate +1 Y coordinate +2 Z coordinate +3 Free +8... Point 2 (4 bytes) +12... Point 3 (4 bytes) +16... Point 4...etc >> 1.8.5 Text data block Offset Data +0... Header data (undocumented) +48... String of characters (terminated by 255) ----------------------------------------------------------------------------- >> 1.9 Planet graphics set ======================= Filetype: &406 ('Planets') Location: "LandScapes.Planets" Compression: Yes Purpose: Contains the images of distant planets painted onto the sky. Description: A planets file (which may hold up to two images) begins with a 36-byte header. The 1st word of this is the number of the last planet in the file (e.g. 0 or 1). The 2nd and 3rd words are X and Y screen offsets for the first planet, and the 4th and 5th words are screen offsets for the second planet in the file (if any). The game does not currently pay any attention to these offsets when painting planets to the screen. The 6th and 7th words of the header are offsets from the start of the header to the first planet image and 'mask', respectively. This data is held in words 8 and 9 for the second planet. The 'mask' offsets are obsolete, though conventionally they point to a duplicate of the planet image, stored after the main bitmap. The image data is stored in the file after the header. The data for a single planet is 1296 bytes long, or 2592 bytes including the redundant 'mask' data. Each bitmap is 36x36 pixels, 8 bpp, and assumes the standard 256 colour RISC OS palette. Offset Data +0 Number of planet images in file-1 +4 Planet 0 X screen offset } +8 Planet 0 Y screen offset } not currently +12 [Planet 1 X screen offset] } used by renderer +16 [Planet 1 Y screen offset] } +20 Offset to planet 0 image +24 Offset to planet 0 mask (obsolete) +28 [Offset to planet 1 image] +32 [Offset to planet 1 mask (obsolete)] ...followed by bitmap images, each 36x36 pixels, 8bpp, 1296 bytes ----------------------------------------------------------------------------- >> 1.10 Map tile graphics set ========================== Filetype: &407 ('MapTiles') 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. Description: Map graphics sets may be of variable length when decompressed, since they do not contain a fixed number of tiles. The tiles are refered to by their reference number (position in the tiles data), which must be within the range 0-254 due to the map format. The initial 16 bytes of the data are a header for the tiles data. The first word is the number of the last tiles in the file. Following this, bytes 4 to 7 contain the tile numbers for a splash animation, used when the ground is damaged (e.g. by laser fire). Bytes 8-11 specify an alternative splash animation. This is used where the tile at the ground hit position is one of the tiles given specified in the alternate splash triggers (bytes 12-15). These four values are also tile numbers, but this time each is the first of a pair n,(n+1). So '1' would specify both tiles 1 and 2 as triggers for the alternative splash. By packing the triggers in this way, up to eight tiles can be specified - just enough to allow a second type of terrain (water, lava) to react to hits differently (e.g. splash rather than scorched earth). Conventionally, at least four of these trigger tiles will be assigned to the actual tiles of the alternative splash animation. However the "Death" tiles set breaks this rule to obtain an unusual effect. The tile graphics are stored sequentially after the header (+16). Each bitmap is 16x16 pixels, at a colour depth of 8bpp (e.g. 256 bytes). They assume the standard RISC OS 256 colour palette. Header: Offset Data +0(w) Number of tiles in file-1 +4(w) Splash animation (4x1 byte tile numbers) +8(w) Alternate splash animation (4x1 byte tile numbers) +12(w) Alternate splash triggers (4x1 byte tile n,n+1 pairs) ...followed by tile graphics, each 16x16 pixels, 8bpp, 256 bytes ----------------------------------------------------------------------------- >> 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. Description: Header: Offset Data +0(w) Number of animations +4(w) Unused +8(w) Unused +12(w) Unused ...followed by animations data (see format below), each block 28 bytes long 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. Description: Three colour bands of 12 entries each, giving a total of 36 colours. The entries are 1 byte each, and refer to the colour numbers of the standard 256 colour RISC OS palette. Total length of hill colours file: 36 bytes Offset Data +0 Band 1, colour 1 +1 Band 1, colour 2 +2 Band 1, colour 3... +12... Band 2 colours +24... Band 3 colours Note that this filetype is also used for other types of compressed Fednet files, for instance the game title pictures, compressed game code, and Stunt Racer 2000 tracks. ----------------------------------------------------------------------------- >> 1.13 Music data =============== Filetype: &154 ('Fednet') Location: "Music" Compression: Yes Purpose: The track data used by the SFX_Handler module music player. Description: Header: Offset Data +0 Tempo (metronome value in centiseconds) +1... Unused +16... 16 byte table mapping logical to actual voices +32(w) Number of sheets in track +36(w) Number of sheets to play (obsolete) +40... 64 byte play order for sheets (terminated by 255) ...followed by sheets data (see format below), each sheet 1024 bytes long Sheet: Offset Data +0... 64 beats of command data (see format below), each beat being 16 bytes Beats: Offset Data +0... Channel 0 command (0 for none) +4... Channel 1 command (0 for none) +8... Channel 2 command (0 for none) +12... Channel 3 command (0 for none) Commands: Offset Data +0 Note number 0-11 (b0-3) +1 Octave number 0-7 (b0-3) and Volume 0-15 (b4-7) +2 Voice number (b0-3) and Action (b4-7) +3 Number of repeats (b4-7) The sample number to be used is looked up from the specified voice number using the logical-to-actual-voice table in the track header. The note number is converted to a 12-bit pitch using an internal note-to- pitch table (see below). The octave number is then put into bits 12-14 to give a 15-bit fractional octave number. Finally, any tuning increment (specified for that sample upon loading) is added on. Note 12-bit pitch 0 0 1 341 2 682 3 1024 4 1365 5 1706 6 2048 7 2389 8 2730 9 3072 10 3413 11 3754 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 are ignored. Otherwise a note is forced on the channel, using the specified sample, volume, pitch and repeats parameters. Note that this filetype is also used for other types of compressed Fednet files, for instance the game title pictures, compressed game code, and Stunt Racer 2000 tracks.