Hello CC3/CoI fans!

Modding of CC3/CoI-Guns/Wrecks ZFX files requires five steps:

- unpacking ZFX archives,
- converting resulting CC3/CoI-TXTF-files into TGA 16-bit uncompressed,
- editing TGA graphics,
- re-converting TGA to CC3/CoI-TXTF-file format,
- repacking these files into ZFX-archives.

To understand why, you must know something about CC-file formats. The TXTF file format was introduced by CC2. 16-bit graphics with a given header telling the graphic's size. CC3 introduced much more file formats. For vehicles, they used a format storing more than one graphic (to give the graphical effect of vehicles "shaking" over the terrain).

But for guns and wrecks, this was not neccessary, so they used for those CC3/CoI graphics a file format similiar to the one of CC2: some graphical concept but with an extended header (8 bytes more) to store the "hotpoint" coordinates.

Despite the differences between vehicle graphic file concept and the gun/wreck file concept, they decided to bundle such files into archives of the same concept: the ZFX-archive format. To increase the trouble for modders, they used also the same filetype extensions (or even no extension at all) no matter which real filetype the graphics file is.

So be warned: a *.NNH file of CC3/CoI can be a vehicles file and also a guns file. You must examine the header, to determine it (and you might fail). So for modders it will be best to know the source-ZFX-archive to know what kind of file you are currently handling (and of course, you cannot be sure!).

The CC3-file formats are well described by gerry Shaw aka 'TinTin':
http://www.organicbit.com/closecombat/
where you will find also the needed tools.

ZFX-file handling was also done by tools of Cpl_Filth:
http://www.student.oulu.fi/%7Epsaastam/

Me only made additional tools to handle CC3-files under MacOS-X, but you can use them for these CC3/CoI-specials as well on a PC:



- CC2Spriter v2.91 for ZFX-un- & -repacking.
- RtBTool v2.17 for CC3/CoI-TXTF-file conversion to TGA and back and for more CC3/CoI actions (see menubar of RtBTool !)
- or CC2Tools v5.01 for CC3/CoI-TXTF-file conversion to TGA and back
(see chapter CC3-CC5-RtB-Graphics, button "CC3 txtf -> TGA" / "TGA -> CC3 txtf"; the hotpoint coordinates are placed into the file name).


This is what CC2Spriter does with ZFX-archives: 
CC3s *.ZFX archives can not only be extracted, but also rebuilded. These *.ZFX files have a fixed size header (number of files, filename table with 600 entries, offset table with 600 entries, file size table with 600 entries) followed by the file datas. The extracting process will respect the values entered in the file size table. The only exception are zero values. In this case my tool will calculate the file size from the file offset distances. The tool will report such errors in the ZFX directory table. Zero values in the file size table are always present if the ZFX archive was made with older tools. Such zero values are not used in the original CC3 files, but zero values here will not prevent CC3 from handling the ZFX archive correctly. When repacking the ZFX archives my tool will only import readable and visible files if their filename does not start with a dot ".". 


The RtBTool-package also contains the needed file format infos like this:

CC3-txtf files of Guns.zfx / Wrecks.zfx with 
file name extension NNH/NSH/ZNH/ZSH 
Their header is 8 bytes longer than a regular CC2-txtf file.

WARNING: same format used by CC4/CC5/CCM/RtB files inside the file 'FT.azp'. file format description by Mafi, last update Jan. 6th, 2008.

contents of these "txtf"-files: 1 small graphical texture for gun or wreck.

Byte order: Little Endian (Intel style)

// header, 24 bytes
char(4)		// 4 bytes headerID, always txtf short		// 2 bytes, unknown, always 0000h short		// 2 bytes, versionID, always 0002h long		// 4 bytes, image width
long		// 4 bytes, image height
long		// 4 bytes, hotpoint-X
long		// 4 bytes, hotpoint-Y

// the graphical datas will follow immediately (one image only) data (16-bit encoded RGB-graphics)


And this is the CC3-ZFX-file format as reported by Gerry Shaw aka 'TinTin':

ZFX File Format
The .zfx file contain a bunch of other files concatenated into a single file. This is done to decrease seek times when reading files from disk or CD.
Basic Format:
		Intel style byte ordering
		File Count (4 byte int)
		Directory (13 byte strings, 0 padded 8.3 format  always at least one terminating null character, always starts at offset 4, 0 padded to a fixed size of 600 strings - 7800 bytes)
		File Offsets (always starts at 7804, 600 32bit ints)
		Files (always start 12604, offsets are from start of file so this tidbit isnt really needed)

Example of Guns.zfx offset table
12604
13648
14692
18660


