# Formats

Chaos Gate has over 700MB of data, organized (seemingly) logically into files in
directories. Being able to parse, display, and use that data is paramount to any
remake.

## Filesystem layout

* [✓] [`Anim/`](obj.md#WarHammer.ani)
    * [`WarHammer.ani`](obj.md#WarHammer.ani)
* [`Assign/`](obj.md#assign)
    * `*.asn` # Specify properties for frames in .obj files
* `Cursor/`
    * `*.ani` # RIFF data, standard ANI format \o/
    * [`Cursors.cur`](obj.md) # `obj` file containing pointers and drag elements
* `Data/`
    * `*.dat` # plaintext files defining properties of objects. No single format
        * **PARSED**
            * `Accounting.dat`  # key = value => internal/data/accounting.go
            * `AniObjDef.dat`   # animated object definitions
            * `GenericData.dat` # Generic Game Settings
            * [`HasAction.dat`](ani.md) # "Are there animation for each of the character" - list of booleans
        * **TODO**
            * `ChaNames.dat`    # list of character names
            * `Coordinates.dat` # Weapon Firing Coordinates
            * `Credits.dat`     # list of credits
            * `Defs.dat`        # defines properties for objects and tiles, each of which seems to have an id
            * `GDestroy.dat`    # table of what destroys what?

            * `MiniMap.dat`     # lots of seemingly random numbers. IDs?
            * `MissionBriefing.dat` # Contains all Campaign Mission Briefing Text. Sections: "CAMPAIGN MISSION X ... END CAMPAIGN MISSION X"
            * `PWeight.dat`     # Personality weights for the individual character types
            * `Random_AI.dat`   # contains the percentage of the different AI types for each of the different Chaos Squad Types
            * `RandomPlanets.dat` #  Campaign Primary and Secondary Objectives
            * [`Sounds.dat`](sound.md)      # Sound Effect Data
            * `SpellDef.dat`    # SPELL DEFINITIONS
            * `StdWeap.dat`     # SQUAD STANDARD WEAPONS
            * `Ultnames.dat`    # List of names for ultramarines
            * `VehicDef.dat`    # VEHICLE DEFINITIONS
            * `WeapDef.dat`     # Weapon definitions
        * **PROBABLY NOT NEEDED**
            * `BugHunt.dat`     # Contains SMF text for Bug hunt random missions
            * `GenArm.dat`      # "Random campaign armory levels - space marine"
            * `HeroArm.dat`     # "Random campaign armory levels - Veteran"
            * `MHeroArm.dat`    # "Random campaign armory levels - Veteran"
            * `PlanetDesc.dat`  # well-documented params. random mission generator params per planet.
            * `RandChar.dat`    # Random character matrix. Information on what goes into a character matrix.
            * `RandSMFtext.dat` # SuperMacro Objectives for Campaign Random Mission Generator.
            * `SpArm.dat`       # "RANDOM CAMPAIGN ARMORY LEVELS - Veteran"
            * `VetArm.dat`      # "RANDOM CAMPAIGN ARMORY LEVELS - Veteran"
            * `*.chk` # checksums? Mentions all the .dat files
    * `Cycle.cyc` # ColorCycle DataFile.
    * `Encyclopedia.dta` # encyclopedia entries
    * `keymap.dta` # unknown
    * `USEng.dta`  # Localized strings
* `EquipmentMenuData` # gzip-compressed, presumably to do with (initial?) squad configuration
* `Filters/`
    * `wh40k.flt` # Audio filter(s?)
* [✓] [`Fonts/`](fonts.md)
    * `cboxfont` # ???
    * [`*.fnt`](fonts.md)
    * [`*.spr`](obj.md) # `obj` file
* [ ] [`Idx/`](ani.md)
    * [`WarHammer.idx`](ani.md) # unknown, 1.8M
* [`Maps/`](maps.md)
    * [`*.MAP`](maps.md)
    * [`*.TXT`](maps.md)
* [`Menu/`](mnu.md) - UI element definitions
    * [`*.mni`](mnu.md) # Menu include file
    * [`*.mnu`](mnu.md)
    * [`*.obj`](obj.md)
* `Misc/`
    * `occlusio.lis` # plain text, presumably occlusion mappings?
* [`MultiMaps/`](maps.md#multimaps)
    * [`*.MAP`](maps.md)
    * [`*.TXT`](maps.md)
* [`Obj/`](obj.md)
    * [ ] `cpiece.rec` # "Rects for various cursor piece types..."
    * [✓] [`*.obj`](obj.md)
* [✓] `Pic/`
    * `*.pcx` # Standard .pcx format
* `RandomMaps/`
    * `*.chk` # multiplayer. worry about these another day
    * `*.dat`
* `Save_G/`
    * `*.sav` # savedata, gzip-compressed, custom format
    * `*.txt` # Seems to be a copy of one of Maps/*.txt
* [✓] [`Sets/`](sets.md)
    * `Data.chk`
    * [`*.set`](sets.md)
* [✓] `SMK/`
    * `*.smk` # Videos: RAD Game Tools Smacker Multimedia version 2
* [ ] [`Sounds/`](sound.md)
    * [`wh40k.ds`](sound.md)
* [ ] [`Wav/`](sound.md)
    * [`*.wav`](sound.md)

Phew.

## General notes

* For binary formats, integers seem to be stored in little-endian
* *Almost everything* seems to be in a data file somewhere. Helpful!
* `make loader` creates a `load` binary that will try to load various bits
  of data from `investigation/` and `orig/`. I use it to investigate file
  formats and the parsers I'm writing.

## Cross-links / associations

(Just some noticed so far)

* [`Assign/*.asn`](assign.md):
    * [`Obj/*.obj`](obj.md).
* [`Maps/*.map`](maps.md):
    * [`Maps/*.txt`](maps.md#associated-txt-file)
    * [`Sets/*.set`](sets.md)
* [`Sounds/wh40k.ds`](sound.md)
    * `Wav/*.wav`
