unit GAF_Format; interface Const // The standard version for all GAFs and TAFs GafVersionStandard = $00010100; // NOTE: Most of the content in this file was derived from the document // ta-gaf-fmt.txt by Joe D. {$MINENUMSIZE 1} type // The header at the beginning of ever GAF or TAF PGafHeader = ^TGafHeader; TGafHeader = packed record // Version is always $00010100 for both TA and Kingdoms Version : Longword; // Specifies the number of entries contained in this file NumberOfEntries : longword; // Presumably padding, its always $00000000 Padding : longword; // Immediately following this header is an array of pointers to each // entry in this file. // EntryPointers : array [0 .. NumberOfEntries-1] of Longword; end; {TGafHeader} TGafName = Packed array [1..32] of char; // Each entry pointer points to a structure of this type. PGafEntry = ^TGafEntry; TGafEntry = packed record // Scecifies the number of graphical frames for this entry item NumberOfFrames : Word; // This is always $0001 UnKnown_1 : Word; // This is always $0000 UnKnown_2 : longword; // The unique name of this entry, always padded to 32 characters long with 0 Name : TGafName; // Immediately following an entry is an array of frame entries // FrameEntries : array [ 0..NumberOfFrames-1 ] of TGafFrameEntry; end; {TGafEntry} // This structure provides an offset to the frame data PGafFrameEntry = ^TGafFrameEntry; TGafFrameEntry = packed record // The offset into the file at which the frame's data resides OffsetToFrameData : Longword; // This value seems to vary by a huge margin, perhaps it contains // bit flags used by CAVEDOG. Unknown_1 : longword; end; {TGafFrameEntry} PGafFrameData = ^TGafFrameData; TGafFrameData = packed record // The final width and height of the frame in pixels Width : word; Height : word; // The X and Y offset of the frame when displayed. Used for centering the // frame or other various purposes. Sometimes just ignored. XOffset : SmallInt; YOffset : SmallInt; // This is always $09 in TA, for TA:K .taf files it is $00 Unknown_1 : Byte; // The compression flag for this frame CompressionMethod : byte; // Specifies the amount of subframes associated with this frame NumberOfSubFrames : word; // This is always $00000000 Unknown_2 : Longword; // If there are no sub frames, this points to the pixel data. // If there are sub frames, this points to an array of offsets to // the sb frame data structures. OffsetToFrameData : Longword; // This seems to be another value that holds bit flags Unknown_3 : Longword; end; {TGafFrameData} const // This flag indicates that the frame is uncompressed. OffsetToFrameData points // to an array of Width x Height bytes. GafFrameNotCompressed = 0; // This flag inndicates that the frame is compressed using the compression // scheme used for TA and Kingdoms GafFrameCompressed_TA = 1; // This flag indicates that the frame is compressed using the compression // scheme used for Kingdoms TAF files ending in "*_4444.TAF" GafFrameCompressed_TAK1 = 4; // This flag indicates that the frame is compressed using the compression // scheme used for Kingdoms TAF files ending in "*_1555.TAF" GafFrameCompressed_TAK2 = 5; implementation end.