# WH40K: Chaos Gate Re-implementation of the WH40K binary. **You must have a copy of the original game data to use this project** WH40K.exe is the existing game engine WH40K_TD.exe is the map editor. Allows things to be saved as .MAP or as .SMF ("Super Macro File") This README is a grab-bag of miscellaneous information about file formats at present. This is being migrated to the [Formats overview](doc/formats/index.md) as a precursor to making this file useful! No game yet, nothing even close. I'm in the very early stages of trying to understand the various file formats. Until then, you can play WH40K: Chaos Gate in a WinXP VM, disconnected from the internet. It doesn't need 3D rendering! ## Building from source I'm writing code in Go at the moment, so you'll need to have a Go runtime installed on your system: ``` $ go version go version go1.10 linux/amd64 ``` Clone the source tree to `$GOPATH/src/ur.gs/chaos-gate`. You can then run `make loader` or `make view-map` to get the two binaries that exist at present. They're not very interesting :D. Place your WH40K: Chaos Gate installation in `./orig` to benefit from automatic path defaults. Otherwise, point to it with `-game-path` Dependency management uses `govendor`. Unless you're contributing code you shouldn't have to worry about it. `dep` bug https://github.com/golang/dep/issues/1725 means I can't use it. ## Unmigrated text "Mission Setup" includes information about available squad types From EquipDef.cpp Dumo: CEquipment we learn the following object types: 0. DELETED 1. WEAPON 2. GRENADE 3. MEDIPACK 4. SCANNER 5. GENESEED 6. CLIP 7. DOOR KEY 8. DOOR KEY 9. DOOR KEY 10. DOOR KEY And we learn they can be "on".... 0. CHARACTER 1. VEHICLE 2. CANISTER Hypothesis: Idx/WarHammer.idx points objects into bitmap data in Anim/WarHammer.ani We can use WH40K_TD.exe and investigate reads of .idx followed by reads of .ani to test this. WH40K_TD.exe opens files in this order: 1. Data/USEng.dta 1. WH40K_TD.exe (?) 1. Cursor/Cursors.cur 1. pread64(fd, 23, 0) = 23 1. _llseek(fd, 0, [0], SEEK_CUR) = 0 1. _llseek(fd, 0, [0], SEEK_CUR) = 0 1. _llseek(fd, 40666, [40666], SEEK_SET) = 0 1. _llseek(fd, 0, [0], SEEK_SET) = 0 1. close(fd) = 0 1. read(fd, "\x26\x00\x00\x00\x20\x00\x00\x00\x30\x01\x00\x00\x50\x01\x00\x00\x8a\x9d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 32) = 32 1. (...) 1. _llseek(15, 39868, [39868], SEEK_SET) = 0 1. read(15, "...", 798) = 798 1. (some statting of Idx/WarHammer.idx, no reading that I saw) 1. Anim/WarHammer.ani 1. read(15, "...", 32) = 32 1. (some clones of child procs, I didn't follow them) 1. Sounds/wh40k.ds 1. pread64(31, "...", 23, 0) = 23 1. read(31, "...", 417792) = 417792 1. read(31, "...", 4096) = 4096 1. Data/Sounds.dat 1. pread64(34, "#**********************", 23, 0) = 23 1. ... 1. Pic/wh40k.pcx 1. read(34, "...", 168509) = 168509 1. Sets/* 1. (lots of statting these) 1. Data/Randchar.dat 1. pread64(34, "#**********************", 23, 0) = 23 1. read(34, "#***************************************************************"..., 4096) = 4096 1. ... 1. Data/WeapDef.dat 1. pread64(35, "#**********************", 23, 0) = 23 1. read(35, "#***************************************************************"..., 4096) = 4096 1. ... 1. Data/SpellDef.dat 1. pread64(35, "#**********************", 23, 0) = 23 1. read(35, "#***************************************************************"..., 4096) = 4096 1. ... 1. Data/AniObDef.dat 1. pread64(35, "# ******** ANIMATED OBJ", 23, 0) = 23 1. read(35, "# ******** ANIMATED OBJECT DEFINITIONS **************\r\n#\t\t0 : **"..., 4096) = 4096 1. ... 1. Data/VehicDef.dat 1. pread64(35, "# ******** VEHICLE DEFI", 23, 0) = 23 1. read(35, "# ******** VEHICLE DEFINITIONS **************\r\n#\t\t0 : *** VEHICL"..., 4096) = 4096 1. ... 1. Data/StdWeap.dat 1. pread64(35, "# ******** SQUAD STANDA", 23, 0) = 23 1. read(35, "# ******** SQUAD STANDARD WEAPONS **************\r\n#\t\t0 : *** SQU"..., 4096) = 4096 1. ... 1. Data/Ultnames.dat 1. Data/Chanames.dat 1. Data/keymap.dta 1. Filters/wh40k.flt 1. _llseek(35, 0, [0], SEEK_SET) = 0 1. read(35, "\x01\x00\x00\x00", 4) = 4 1. _llseek(35, 4, [4], SEEK_SET) = 0 1. read(35, "...", 72) = 72 1. _llseek(35, 1444, [1444], SEEK_SET) = 0 1. read(35, "...", 327680) = 327680 1. Misc/occlusio.lis 1. pread64(35, "62 # Number of Absol", 23, 0) = 23 1. read(35, "62 # Number of Absolute Deltas.\r\n # These Deltas are off"..., 4096) = 982 1. read(35, "", 3114) = 0 1. Data/GDestroy.dat 1. (stat Obj/destroy.obj) 1. Data/minimap.dat 1. Misc/occlusio.list 1. Obj/specials.obj 1. Obj/Man_Shadow.obj 1. Sets/map01.set 1. Data/Defs.dat 1. [`Assign/jungtil.asn`](docs/formats/obj.md#assign) 1. [`Obj/jungtil.obj`](docs/formats/obj.md) 1. (more assign + obj pairs) 1. Data/Cycle.cyc