CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

IFF.H (7153B)


      1 //
      2 // Copyright 2020 Electronic Arts Inc.
      3 //
      4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 
      5 // software: you can redistribute it and/or modify it under the terms of 
      6 // the GNU General Public License as published by the Free Software Foundation, 
      7 // either version 3 of the License, or (at your option) any later version.
      8 
      9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 
     10 // in the hope that it will be useful, but with permitted additional restrictions 
     11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 
     12 // distributed with this program. You should have received a copy of the 
     13 // GNU General Public License along with permitted additional restrictions 
     14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
     15 
     16 /***************************************************************************
     17  **   C O N F I D E N T I A L --- W E S T W O O D   A S S O C I A T E S   **
     18  ***************************************************************************
     19  *                                                                         *
     20  *                 Project Name : Part of the FILEIO Library               *
     21  *                                                                         *
     22  *                    File Name : IFF.H                                    *
     23  *                                                                         *
     24  *                   Programmer : Scott K. Bowen                           *
     25  *                                                                         *
     26  *                   Start Date : April 20, 1994                           *
     27  *                                                                         *
     28  *                  Last Update : April 20, 1994   [SKB]                   *
     29  *                                                                         *
     30  *-------------------------------------------------------------------------*
     31  * Functions:                                                              *
     32  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
     33 
     34 #ifndef IFF_H
     35 #define IFF_H
     36 
     37 #ifndef GBUFFER_H
     38 #include <gbuffer.h>
     39 #endif
     40 
     41 #ifndef MISC_H
     42 #include <misc.h>		// This is needed fro Reverse_WORD and _LONG
     43 #endif
     44 
     45 #ifndef MEMFLAGS_H
     46 #include <memflag.h>	// This is needed for MemoryFlagType.
     47 #endif
     48 
     49 #define LZW_SUPPORTED			FALSE
     50 
     51 /*=========================================================================*/
     52 /* Iff and Load Picture system defines and enumerations							*/
     53 /*=========================================================================*/
     54 
     55 #define 	MAKE_ID(a,b,c,d)			((long) ((long) d << 24) | ((long) c << 16) | ((long) b <<  8) | (long)(a))
     56 #define	IFFize_WORD(a)			Reverse_Word(a)
     57 #define	IFFize_LONG(a)			Reverse_Long(a)
     58 
     59 
     60 //lint -strong(AJX,PicturePlaneType)
     61 typedef enum {
     62 	BM_AMIGA,	// Bit plane format (8K per bitplane).
     63 	BM_MCGA,		// Byte per pixel format (64K).
     64 
     65 	BM_DEFAULT=BM_MCGA	// Default picture format.
     66 } PicturePlaneType;
     67 
     68 /*
     69 **	This is the compression type code.  This value is used in the compressed
     70 **	file header to indicate the method of compression used.  Note that the
     71 **	LZW method may not be supported.
     72 */
     73 //lint -strong(AJX,CompressionType)
     74 typedef enum {
     75 	NOCOMPRESS,		// No compression (raw data).
     76 	LZW12,			// LZW 12 bit codes.
     77 	LZW14,			// LZW 14 bit codes.
     78 	HORIZONTAL,		// Run length encoding (RLE).
     79 	LCW				// Westwood proprietary compression.
     80 } CompressionType;
     81 
     82 /*
     83 **	Compressed blocks of data must start with this header structure.
     84 **	Note that disk based compressed files have an additional two
     85 **	leading bytes that indicate the size of the entire file.
     86 */
     87 //lint -strong(AJX,CompHeaderType)
     88 typedef struct {
     89 	char	Method;		// Compression method (CompressionType).
     90 	char	pad;			// Reserved pad byte (always 0).
     91 	long	Size;			// Size of the uncompressed data.
     92 	short	Skip;			// Number of bytes to skip before data.
     93 } CompHeaderType;
     94 
     95 
     96 /*=========================================================================*/
     97 /* The following prototypes are for the file: IFF.CPP								*/
     98 /*=========================================================================*/
     99 
    100 int __cdecl Open_Iff_File(char const *filename);
    101 void __cdecl Close_Iff_File(int fh);
    102 unsigned long __cdecl Get_Iff_Chunk_Size(int fh, long id);
    103 unsigned long __cdecl Read_Iff_Chunk(int fh, long id, void *buffer, unsigned long maxsize);
    104 void __cdecl Write_Iff_Chunk(int file, long id, void *buffer, long length);
    105 
    106 
    107 /*=========================================================================*/
    108 /* The following prototypes are for the file: LOADPICT.CPP						*/
    109 /*=========================================================================*/
    110 
    111 int __cdecl Load_Picture(char const *filename, BufferClass& scratchbuf, BufferClass& destbuf, unsigned char *palette=NULL, PicturePlaneType format=BM_DEFAULT);
    112 
    113 
    114 /*=========================================================================*/
    115 /* The following prototypes are for the file: LOAD.CPP							*/
    116 /*=========================================================================*/
    117 
    118 unsigned long __cdecl Load_Data(char const *name, void *ptr, unsigned long size);
    119 unsigned long __cdecl Write_Data(char const *name, void *ptr, unsigned long size);
    120 void * __cdecl Load_Alloc_Data(char const *name, MemoryFlagType flags);
    121 unsigned long __cdecl Load_Uncompress(char const *file, BufferClass& uncomp_buff, BufferClass& dest_buff, void *reserved_data=NULL);
    122 unsigned long __cdecl Uncompress_Data(void const *src, void *dst);
    123 void __cdecl Set_Uncomp_Buffer(int buffer_segment, int size_of_buffer);
    124 
    125 /*=========================================================================*/
    126 /* The following prototypes are for the file: WRITELBM.CPP						*/
    127 /*=========================================================================*/
    128 
    129 PUBLIC BOOL Write_LBM_File(int lbmhandle, BufferClass& buff, int bitplanes, unsigned char *palette);
    130 
    131 
    132 
    133 /*========================= Assembly Functions ============================*/
    134 
    135 #ifdef __cplusplus
    136 extern "C" {
    137 #endif
    138 
    139 /*=========================================================================*/
    140 /* The following prototypes are for the file: PACK2PLN.ASM						*/
    141 /*=========================================================================*/
    142 
    143 extern void __cdecl Pack_2_Plane(void *buffer, void * pageptr, int planebit);
    144 
    145 /*=========================================================================*/
    146 /* The following prototypes are for the file: LCWCOMP.ASM						*/
    147 /*=========================================================================*/
    148 
    149 extern unsigned long __cdecl LCW_Compress(void *source, void *dest, unsigned long length);
    150 
    151 /*=========================================================================*/
    152 /* The following prototypes are for the file: LCWUNCMP.ASM						*/
    153 /*=========================================================================*/
    154 
    155 extern unsigned long __cdecl LCW_Uncompress(void *source, void *dest, unsigned long length);
    156 
    157 #ifdef __cplusplus
    158 }
    159 #endif
    160 /*=========================================================================*/
    161 
    162 
    163 
    164 #endif //IFF_H