Documentation
¶
Overview ¶
Package crt decodes Total Annihilation: Kingdoms .crt scenario files.
A .crt file accompanies a TA:K map (.tnt) and stores the scripted layer of a scenario: the pre-placed units/objects, the per-player rule engine (each rule a set of conditions guarding a set of actions) and the named rectangular trigger regions referenced by those rules. Multiplayer maps ship an empty stub (no units, nine empty players, no triggers); the campaign and special maps populate every section.
The layout is a direct image of the in-memory C structures, so each unit record carries a fixed 256-byte type and name field followed by a block of 32-bit fields, several of which are uninitialised padding in shipped files.
Index ¶
Constants ¶
const Signature uint32 = 0x3F800000
Signature is the little-endian uint32 that opens every .crt file. It is the IEEE-754 encoding of the float 1.0, used by the engine as a format marker.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clause ¶
type Clause struct {
// Opcode selects the condition or action to evaluate.
Opcode uint32
// Args holds the five raw 64-byte argument slots verbatim.
Args [argsPerClause][argSize]byte
}
Clause is a single condition or action: a numeric opcode followed by five fixed-size argument slots.
type File ¶
type File struct {
// Unknown1 is the header word following the signature; 0 for every shipped
// map except one hand-edited outlier.
Unknown1 uint32
Units []Unit
Players []Player
Triggers []Trigger
}
File is a decoded .crt scenario.
func (*File) UnitCounts ¶
UnitCounts returns the number of placements per unit type.
type Player ¶
type Player struct {
Rules []Rule
}
Player is one scenario player slot and its rule list. Empty slots (the common case) carry no rules.
type Unit ¶
type Unit struct {
// Type is the unit/object definition name (e.g. "VERLIEGE", "NPCFARM").
Type string
// Name is the per-instance scripting handle; usually empty.
Name string
// X, Y, Z are the world position. Y is the vertical (height) axis.
X, Y, Z uint32
// Player is the owning player slot (0-based).
Player uint32
// HealthPercent, ArmorPercent, WeaponPercent are starting condition,
// normally 100.
HealthPercent, ArmorPercent, WeaponPercent uint32
// Angle is the facing, in the engine's angle units.
Angle uint32
// Veteran is the starting veterancy level.
Veteran uint32
// FootprintX, FootprintZ are the unit's footprint in map cells.
FootprintX, FootprintZ uint32
// Unknown1..3 are undecoded fields, retained for round-trip fidelity.
Unknown1, Unknown2, Unknown3 uint32
}
Unit is a single pre-placed unit or object.