home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / descent / source / lib / iff.h < prev    next >
C/C++ Source or Header  |  1998-06-08  |  5KB  |  122 lines

  1. /*
  2. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  3. SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
  4. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  5. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  6. IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  7. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  8. FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  9. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
  10. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
  11. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  12. */
  13. /*
  14.  * $Source: f:/miner/source/iff/rcs/iff.h $
  15.  * $Revision: 1.12 $
  16.  * $Author: matt $
  17.  * $Date: 1994/11/07 21:26:53 $
  18.  *
  19.  * Header for IFF routines
  20.  *
  21.  * $Log: iff.h $
  22.  * Revision 1.12  1994/11/07  21:26:53  matt
  23.  * Added new function iff_read_into_bitmap()
  24.  * 
  25.  * Revision 1.11  1994/05/06  19:37:38  matt
  26.  * Improved error handling and checking
  27.  * 
  28.  * Revision 1.10  1994/04/16  20:12:54  matt
  29.  * Made masked (stenciled) bitmaps work
  30.  * 
  31.  * Revision 1.9  1994/04/13  23:46:00  matt
  32.  * Added function, iff_errormsg(), which returns ptr to error message.
  33.  * 
  34.  * Revision 1.8  1994/04/13  23:27:10  matt
  35.  * Put in support for anim brushes (.abm files)
  36.  * 
  37.  * Revision 1.7  1994/04/06  23:08:02  matt
  38.  * Cleaned up code; added prototype (but no new code) for anim brush read
  39.  * 
  40.  * Revision 1.6  1994/01/22  14:40:59  john
  41.  * Fixed bug with declareations.
  42.  * 
  43.  * Revision 1.5  1994/01/22  14:23:13  john
  44.  * Added global vars to check transparency
  45.  * 
  46.  * Revision 1.4  1993/10/27  12:47:42  john
  47.  * Extended the comments
  48.  * 
  49.  * Revision 1.3  1993/09/22  19:17:20  matt
  50.  * Fixed handling of pad byte in ILBM/PPB body - was writing pad byte to
  51.  * destination buffer.
  52.  * 
  53.  * Revision 1.2  1993/09/08  19:23:25  matt
  54.  * Added additional return code, IFF_BAD_BM_TYPE
  55.  * 
  56.  * Revision 1.1  1993/09/08  14:24:21  matt
  57.  * Initial revision
  58.  * 
  59.  *
  60.  */
  61.  
  62. #ifndef _IFF_H
  63. #define _IFF_H
  64.  
  65. #include "types.h"
  66. #include "gr.h"
  67.  
  68. //Prototypes for IFF library functions
  69.  
  70. int iff_read_bitmap(char *ifilename,grs_bitmap *bm,int bitmap_type,ubyte *palette);
  71.     //reads an IFF file into a grs_bitmap structure. fills in palette if not null
  72.     //returns error codes - see IFF.H.  see GR.H for bitmap_type
  73.     //MEM DETAILS:  This routines assumes that you already have the grs_bitmap
  74.     //structure allocated, but that you don't have the data for this bitmap
  75.     //allocated. In other words, do this:
  76.     //   grs_bitmap * MyPicture;
  77.     //   MALLOC( MyPicture, grs_bitmap, 1);
  78.     //   iff_read_bitmap( filename, MyPicture, BM_LINEAR, NULL );
  79.     //   ...do whatever with your bitmap ...
  80.     //   gr_free_bitmap( MyPicture );
  81.     //   exit(0)
  82.  
  83. //like iff_read_bitmap(), but reads into a bitmap that already exists,
  84. //without allocating memory for the bitmap. 
  85. int iff_read_into_bitmap(char *ifilename,grs_bitmap *bm,byte *palette);
  86.  
  87. //read in animator brush (.abm) file
  88. //fills in array of pointers, and n_bitmaps.
  89. //returns iff error codes. max_bitmaps is size of array.
  90. int iff_read_animbrush(char *ifilename,grs_bitmap **bm,int max_bitmaps,int *n_bitmaps,ubyte *palette);
  91.  
  92. // After a read
  93. extern ubyte iff_transparent_color;
  94. extern ubyte iff_has_transparency;    // 0=no transparency, 1=iff_transparent_color is valid
  95.  
  96. int iff_write_bitmap(char *ofilename,grs_bitmap *bm,ubyte *palette);
  97.     //writes an IFF file from a grs_bitmap structure. writes palette if not null
  98.     //returns error codes - see IFF.H.
  99.  
  100. //function to return pointer to error message
  101. char *iff_errormsg(int error_number);
  102.  
  103.  
  104. //Error codes for read & write routines
  105.  
  106. #define IFF_NO_ERROR            0        //everything is fine, have a nice day
  107. #define IFF_NO_MEM            1        //not enough mem for loading or processing
  108. #define IFF_UNKNOWN_FORM    2        //IFF file, but not a bitmap
  109. #define IFF_NOT_IFF            3        //this isn't even an IFF file
  110. #define IFF_NO_FILE            4        //cannot find or open file
  111. #define IFF_BAD_BM_TYPE        5        //tried to save invalid type, like BM_RGB15
  112. #define IFF_CORRUPT            6        //bad data in file
  113. #define IFF_FORM_ANIM        7        //this is an anim, with non-anim load rtn
  114. #define IFF_FORM_BITMAP        8        //this is not an anim, with anim load rtn
  115. #define IFF_TOO_MANY_BMS    9        //anim read had more bitmaps than room for
  116. #define IFF_UNKNOWN_MASK    10        //unknown masking type
  117. #define IFF_READ_ERROR        11        //error reading from file
  118. #define IFF_BM_MISMATCH        12        //bm being loaded doesn't match bm loaded into
  119.  
  120. #endif
  121.  
  122.