| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | #ifndef _IFF_H |
| 20 | #define _IFF_H |
| 21 | |
| 22 | #include "cfile.h" |
| 23 | |
| 24 | // Error codes for read & write routines |
| 25 | |
| 26 | #define IFF_NO_ERROR 0 // everything is fine, have a nice day |
| 27 | #define IFF_NO_MEM 1 // not enough mem for loading or processing |
| 28 | #define IFF_UNKNOWN_FORM 2 // IFF file, but not a bitmap |
| 29 | #define IFF_NOT_IFF 3 // this isn't even an IFF file |
| 30 | #define IFF_NO_FILE 4 // cannot find or open file |
| 31 | #define IFF_BAD_BM_TYPE 5 // tried to save invalid type, like BM_RGB15 |
| 32 | #define IFF_CORRUPT 6 // bad data in file |
| 33 | #define IFF_FORM_ANIM 7 // this is an anim, with non-anim load rtn |
| 34 | #define IFF_FORM_BITMAP 8 // this is not an anim, with anim load rtn |
| 35 | #define IFF_TOO_MANY_BMS 9 // anim read had more bitmaps than room for |
| 36 | #define IFF_UNKNOWN_MASK 10 // unknown masking type |
| 37 | #define IFF_READ_ERROR 11 // error reading from file |
| 38 | #define IFF_BM_MISMATCH 12 // bm being loaded doesn't match bm loaded into |
| 39 | |
| 40 | // Type values for iff bitmaps |
| 41 | #define TYPE_PBM 0 |
| 42 | #define TYPE_ILBM 1 |
| 43 | |
| 44 | // Loads an IFF file, returning bitmap handle or -1 if error |
| 45 | int bm_iff_alloc_file(CFILE *); |
| 46 | |
| 47 | // Loads a tga or ogf file into a bitmap...returns handle to bm or -1 on error |
| 48 | int bm_tga_alloc_file(CFILE *infile, char *name, int format = 0); |
| 49 | |
| 50 | // Loads a pcx file and converts it to 16 bit. Returns bitmap handle or -1 on error |
| 51 | int bm_pcx_alloc_file(CFILE *infile); |
| 52 | |
| 53 | int bm_tga_load_short_file(CFILE *infile, char *name); |
| 54 | |
| 55 | // Pages in bitmap index n. Returns 1 if successful, 0 if not |
| 56 | int bm_page_in_file(int n); |
| 57 | |
| 58 | int bm_iff_read_animbrush(const char *ifilename, int *bm_list); |
| 59 | |
| 60 | #endif |