]> icculus.org git repositories - btb/d2x.git/blob - include/cfile.h
fix compiler warnings w/opengl
[btb/d2x.git] / include / cfile.h
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-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
12 */
13
14
15
16 #ifndef _CFILE_H
17 #define _CFILE_H
18
19 typedef struct CFILE {
20         FILE                            *file;
21         int                             size;
22         int                             lib_offset;
23         int                             raw_position;
24 } CFILE;
25
26 //Specify the name of the hogfile.  Returns 1 if hogfile found & had files
27 int cfile_init(char *hogname);
28
29 CFILE * cfopen(char * filename, char * mode);
30 int cfilelength( CFILE *fp );                                                   // Returns actual size of file...
31 size_t cfread( void * buf, size_t elsize, size_t nelem, CFILE * fp );
32 void cfclose( CFILE * cfile );
33 int cfgetc( CFILE * fp );
34 int cfseek( CFILE *fp, long int offset, int where );
35 int cftell( CFILE * fp );
36 char * cfgets( char * buf, size_t n, CFILE * fp );
37
38 int cfexist( char * filename ); // Returns true if file exists on disk (1) or in hog (2).
39
40 // Allows files to be gotten from an alternate hog file.
41 // Passing NULL disables this.
42 // Returns 1 if hogfile found (& contains file), else 0.  
43 // If NULL passed, returns 1
44 int cfile_use_alternate_hogfile( char * name );
45
46 // All cfile functions will check this directory if no file exists
47 // in the current directory.
48 void cfile_use_alternate_hogdir( char * path );
49
50 //tell cfile about your critical error counter 
51 void cfile_set_critical_error_counter_ptr(int *ptr);
52
53 // prototypes for reading basic types from cfile
54 int cfile_read_int(CFILE *file);
55 short cfile_read_short(CFILE *file);
56 byte cfile_read_byte(CFILE *file);
57
58 #endif