home *** CD-ROM | disk | FTP | other *** search
- This document is an attempt to put what I have learn of the
- various data structures used in the Command and Conquer file
- 'game.dat' so that other people can create editors for this
- game as well.
-
- The areas I focussed on when creating my editor (ccedit) were:
- buildings, infantry and vehicles. I found out after I started
- that there were 2 (at least) classes of vehicles: aircraft
- and land vehicles. This means that there are at least 4 different
- data structures used that I have some knowledge about (there
- are undoubtably lots more used, but I don't know what they are).
-
- I will use the terminology 'entry' to describe the fields in
- the data structures, simply because I don't have a complete account
- of the entire data structures used, so I will be using one entry
- as a landmark to point to others.
-
- PART 1: DETERMINING THE ENTRY SIZE
- ----------------------------------
- One thing that makes editing these data structures difficult is that
- they can be of different sizes within the file. There is a way to
- work out the size of an entry however. It will only ever be either
- a 1 byte value or a 4 byte value. The way to find out which it will
- be is to look at the byte directly before it. If the value is 0x6a,
- then the next entry will be a single byte. If the value is 0x68, then
- the next entry will be 4 bytes long.
-
- The values stored here are signed values.
-
- The differences in entry size usually occur in entries dealing with
- hit points, and occasionally cost. Most of the time when dealing with
- vehicles, the hit points are stored as a 4 byte value, but for some of
- them, they are stored as a single byte value (which is why I classified
- things as being light and heavy in my editor).
-
- I may be possible to change the size of the game.dat file to convert a
- single byte value to a 4 byte value, but as this file is an executable
- file, I don't know what effect this would have (its probably not worth
- the bother).
-
- PART 2: REACHING THE END OF A STRUCTURE
- ---------------------------------------
- You can tell when you reach the end of one complete structure when you
- come across the value 0x81 then 0xc4. I think the value after these
- two reflects what type of data structure it is (whether aircraft, vehicle,
- etc).
-
- PART 3: AIRCRAFT STRUCTURE
- --------------------------
- There are 5 apparent aircraft. They are (in order of their appearance in
- the game.dat file): A-10, Chinook, Apache, Orca, and (I think) the
- transport plane.
-
- To give you a hint, the speed for the A-10 is at offset 0x667c8 (in the
- 1.18p English version of Command and Conquer).
-
- The aircraft data stucture is:
- entry use
- ----------------
- 1 ?
- 2 ?
- 3 speed
- 4 armour
- 5 secondary weapon
- 6 primary weapon
- 7 owner
- 8 ?
- 9 ?
- 10 ?
- 11 cost
- 12 visual radius
- 13 hit points
- 14 number of shots
- 15 ?
- 16 ?
- 17 ?
- 18 ?
- 19 invulnerability
- 20 ?
- 21 ?
- 22 ?
- 23 ?
- 24 ?
- 25 ?
- 26 ?
- 27 gives it a set of rotor blades
- 28 no wait between attacks; but can't fly (for orcas). Obviously used for the A-10's
- 29 transport ability (stuffs up graphics for apaches)
- 30 ?
- 31 ?
-
- There are a couple of other after this. One of the unknown entries between
- 14 and 31 has to do with giving that unit an additional rotor blade (which
- turns around in the opposite direction). The rotor blade is actually just
- a little animation that the aircraft can access (they are like the turrets
- on the tanks).
-
- PART 4: BUILDING STRUCTURE
- --------------------------
- There are a number of structures in the file, but I never bothered with the
- ones you cannot build. The others would undoubtably have the same format
- (roughly) as these.
-
- To give you a hint, the power required for the Temple of Nod is at offset
- 0x6defa (in the 1.18p English version of Command and Conquer).
-
- The building data structure is:
- entry use
- ----------------
- 1 ?
- 2 ?
- 3 ?
- 4 ?
- 5 power required
- 6 power produced
- 7 ?
- 8 ?
- 9 ?
- 10 secondary weapon
- 11 primary weapon
- 12 owner
- 13 ?
- 14 ?
- 15 ?
- 16 cost
- 17 visual radius (I think)
- 18 hit points
- 19 ?
- 20 what this structure can build (8 = construction yard; 6 =
- helicopters; 4 = vehicles [may need to set an extra entry to
- get this to work properly]; 2 = infantry)
- 21 ?
- 22 ?
- 23 ?
- 24 ?
- 25 fires weapons twice
- 26 ? (may have to do with the SAM site's pop-up graphics)
- 27 graphics for that building are not shown (not cloaked, just
- not drawn)
- 28 invulnerability
- 29 ?
- 30 ?
- 31 ?
- 32 ?
- 33 ?
- 34 ?
- 35 ?
- 36 ?
- 37 ? (couldn't deploy it anywhere)
- 38 ?
- 39 ?
- 40 ?
-
- There are some others after this.
-
- PART 5: VEHICLE STRUCTURE
- -------------------------
- The order of the vehicles in this section of the file is: viceroid, flame
- tank, stealth tank, light tank, medium tank, mammoth tank, hovercraft,
- mobile HQ, SSM, artillery, harvester, MCV, humm-vee, buggy, bike, rocket
- launcher, APC, boat, triceratops, t-rex, 'raptor, and stegasaurus.
-
- To give you a hint, the armour for the viceroid is at offset 0xde22e (in
- the 1.18p English version of Command and Conquer).
-
- The vehicles structure is:
- entry use
- ----------------
- 1 ?
- 2 ?
- 3 ?
- 4 speed
- 5 ?
- 6 ?
- 7 secondary weapon
- 8 primary weapon
- 9 owner
- 10 ?
- 11 ?
- 12 ?
- 13 cost
- 14 visual radius
- 15 hit points
- 16 ?
- 17 cycles through all that units graphics (used for the viceroid)
- 18 stealth
- 19 ? got rid of the turret on the medium tank
- 20 ?
- 21 ?
- 22 ?
- 23 ?
- 24 (what I was talking about in the aircraft section - this gives
- a tank 2 turrets rotating in opposite directions)
- 25 ?
- 26 ?
- 27 ?
- 28 fires its weapons twice
- 29 ?
- 30 invulnerability
- 31 ?
- 32 ?
- 33 ?
- 34 ?
- 35 can harvest tiberium (can't go into the refinery is this
- is set by itself)
- 36 ?
- 37 ?
- 38 transport (but can't carry infantry if set by itself)
- 39 ?
- 40 doesn't display the graphics for that unit (set to ON by
- default for the dinosaurs)
- 41 ?
- 42 ?
- 43 ?
-
- There are some other entries after these.
-
- PART 6: INFANTRY STRUCTURE
- --------------------------
- This section is definitely the hardest. I have almost no knowledge about
- what this data structure is. It was just luck that found this in the
- first place.
-
- To give you a hint, the weapon for the mnigunner is at offset 0x96fac (in
- the 1.18p English version of Command and Conquer).
-
- entry use
- ----------------
- 1 ?
- 2 secondary weapon
- 3 primary weapon
- 4 owner
- 5 ?
- 6 ?
- 7 ?
- 8 cost
- 9 visual radius
- 10 HP
-
- There are many more entries after this one, but I have no idea what
- they do.
-
- I tried looking for things like invulnerability, but couldn't find it.
-
- Andrew Griffin
-
- ========================================================================
- ======================= end of document ================================
- ========================================================================
-
- This next section is an extremly brief note about how to work out the
- addresses on the internal files in the .mix files used in Command and
- Conquer.
-
- The first part of the file contains the information you need to be able
- to work out how many internal files there are, where they are, and how
- large they are.
-
- The format of this header information is:
- short int number of internal files (I'll refer to this as N)
- long int size of file - modifier
-
- [modifier = N*12 + 6]
- Then for each of the N internal files, you have the following entry
- information:
- short int ?? unknown ??
- short int ?? unknown ??
- long int offset in file - modifier
- long int length of internal file
-
- [this information is thanks to Jens Mueller]
-
- With regard to the general.mix file (that is the file which contains all
- the mission information, you can tell which internal files are the map
- entries by their size. Each map has a size of 0x2000.
-
- Andrew Griffin