Subversion Repositories Games.Descent

Rev

Details | Last modification | View Log | RSS feed

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