]> icculus.org git repositories - btb/d2x.git/blob - include/iff.h
add g3_uninit_polygon_model (doesn't do anything)
[btb/d2x.git] / include / iff.h
1 /* $Id: iff.h,v 1.4 2004-08-28 23:17:45 schaffner Exp $ */
2 /*
3 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
4 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
5 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
6 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
7 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
8 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
9 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
10 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
11 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
12 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
13 */
14
15 /*
16  *
17  * Header for IFF routines
18  *
19  */
20
21 #ifndef _IFF_H
22 #define _IFF_H
23
24 #include "pstypes.h"
25 #include "gr.h"
26
27 //Prototypes for IFF library functions
28
29 int iff_read_bitmap(char *ifilename,grs_bitmap *bm,int bitmap_type,ubyte *palette);
30         //reads an IFF file into a grs_bitmap structure. fills in palette if not null
31         //returns error codes - see IFF.H.  see GR.H for bitmap_type
32         //MEM DETAILS:  This routines assumes that you already have the grs_bitmap
33         //structure allocated, but that you don't have the data for this bitmap
34         //allocated. In other words, do this:
35         //   grs_bitmap * MyPicture;
36         //   MALLOC( MyPicture, grs_bitmap, 1);
37         //   iff_read_bitmap( filename, MyPicture, BM_LINEAR, NULL );
38         //   ...do whatever with your bitmap ...
39         //   gr_free_bitmap( MyPicture );
40         //   exit(0)
41
42 //like iff_read_bitmap(), but reads into a bitmap that already exists,
43 //without allocating memory for the bitmap.
44 int iff_read_into_bitmap(char *ifilename,grs_bitmap *bm, sbyte *palette);
45
46 //read in animator brush (.abm) file
47 //fills in array of pointers, and n_bitmaps.
48 //returns iff error codes. max_bitmaps is size of array.
49 int iff_read_animbrush(char *ifilename,grs_bitmap **bm,int max_bitmaps,int *n_bitmaps,ubyte *palette);
50
51 // After a read
52 extern ubyte iff_transparent_color;
53 extern ubyte iff_has_transparency;      // 0=no transparency, 1=iff_transparent_color is valid
54
55 int iff_write_bitmap(char *ofilename,grs_bitmap *bm,ubyte *palette);
56         //writes an IFF file from a grs_bitmap structure. writes palette if not null
57         //returns error codes - see IFF.H.
58
59 //function to return pointer to error message
60 char *iff_errormsg(int error_number);
61
62
63 //Error codes for read & write routines
64
65 #define IFF_NO_ERROR        0   //everything is fine, have a nice day
66 #define IFF_NO_MEM          1   //not enough mem for loading or processing
67 #define IFF_UNKNOWN_FORM    2   //IFF file, but not a bitmap
68 #define IFF_NOT_IFF         3   //this isn't even an IFF file
69 #define IFF_NO_FILE         4   //cannot find or open file
70 #define IFF_BAD_BM_TYPE     5   //tried to save invalid type, like BM_RGB15
71 #define IFF_CORRUPT         6   //bad data in file
72 #define IFF_FORM_ANIM       7   //this is an anim, with non-anim load rtn
73 #define IFF_FORM_BITMAP     8   //this is not an anim, with anim load rtn
74 #define IFF_TOO_MANY_BMS    9   //anim read had more bitmaps than room for
75 #define IFF_UNKNOWN_MASK    10  //unknown masking type
76 #define IFF_READ_ERROR      11  //error reading from file
77 #define IFF_BM_MISMATCH     12  //bm being loaded doesn't match bm loaded into
78
79 #endif
80