2003-04-12 00:11:46 +00:00
|
|
|
/* $Id: cfile.h,v 1.8 2003-04-12 00:11:46 btb Exp $ */
|
2001-01-19 03:30:16 +00:00
|
|
|
/*
|
|
|
|
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
|
|
|
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
|
|
|
END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
|
|
|
|
ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
|
|
|
|
IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
|
|
|
|
SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
|
|
|
|
FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
|
|
|
|
CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
|
2003-04-12 00:11:46 +00:00
|
|
|
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
|
2001-01-19 03:30:16 +00:00
|
|
|
COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|
|
|
*/
|
|
|
|
|
2003-04-12 00:11:46 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Prototypes for compressed file functions...
|
|
|
|
*
|
|
|
|
* Old Log:
|
|
|
|
* Revision 1.1 1995/03/30 10:25:08 allender
|
|
|
|
* Initial revision
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* -- PC RCS Information ---
|
|
|
|
* Revision 1.10 1995/03/13 15:16:47 john
|
|
|
|
* Added alternate directory stuff.
|
|
|
|
*
|
|
|
|
* Revision 1.9 1995/02/01 20:56:40 john
|
|
|
|
* Added cfexist function
|
|
|
|
*
|
|
|
|
* Revision 1.8 1995/01/21 17:53:41 john
|
|
|
|
* Added alternate pig file thing.
|
|
|
|
*
|
|
|
|
* Revision 1.7 1994/12/12 13:19:47 john
|
|
|
|
* Made cfile work with fiellentth.
|
|
|
|
*
|
|
|
|
* Revision 1.6 1994/12/08 19:02:52 john
|
|
|
|
* Added cfgets.
|
|
|
|
*
|
|
|
|
* Revision 1.5 1994/12/07 21:34:07 john
|
|
|
|
* Stripped out compression stuff...
|
|
|
|
*
|
|
|
|
* Revision 1.4 1994/07/13 00:16:53 matt
|
|
|
|
* Added include
|
|
|
|
*
|
|
|
|
* Revision 1.3 1994/02/17 17:36:19 john
|
|
|
|
* Added CF_READ_MODE and CF_WRITE_MODE constants.
|
|
|
|
*
|
|
|
|
* Revision 1.2 1994/02/15 12:52:08 john
|
|
|
|
* Crappy inbetween version
|
|
|
|
*
|
|
|
|
* Revision 1.1 1994/02/15 10:54:23 john
|
|
|
|
* Initial revision
|
|
|
|
*
|
|
|
|
* Revision 1.1 1994/02/10 15:50:54 john
|
|
|
|
* Initial revision
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2001-01-19 03:30:16 +00:00
|
|
|
#ifndef _CFILE_H
|
|
|
|
#define _CFILE_H
|
|
|
|
|
2002-07-26 09:22:39 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2001-10-19 08:06:20 +00:00
|
|
|
#include "maths.h"
|
|
|
|
#include "vecmat.h"
|
|
|
|
|
2001-01-19 03:30:16 +00:00
|
|
|
typedef struct CFILE {
|
2002-07-26 09:22:39 +00:00
|
|
|
FILE *file;
|
2001-01-19 03:30:16 +00:00
|
|
|
int size;
|
|
|
|
int lib_offset;
|
|
|
|
int raw_position;
|
|
|
|
} CFILE;
|
|
|
|
|
|
|
|
//Specify the name of the hogfile. Returns 1 if hogfile found & had files
|
|
|
|
int cfile_init(char *hogname);
|
|
|
|
|
2002-08-23 01:52:59 +00:00
|
|
|
int cfile_size(char *hogname);
|
|
|
|
|
2001-01-19 03:30:16 +00:00
|
|
|
CFILE * cfopen(char * filename, char * mode);
|
|
|
|
int cfilelength( CFILE *fp ); // Returns actual size of file...
|
|
|
|
size_t cfread( void * buf, size_t elsize, size_t nelem, CFILE * fp );
|
|
|
|
void cfclose( CFILE * cfile );
|
|
|
|
int cfgetc( CFILE * fp );
|
|
|
|
int cfseek( CFILE *fp, long int offset, int where );
|
|
|
|
int cftell( CFILE * fp );
|
|
|
|
char * cfgets( char * buf, size_t n, CFILE * fp );
|
|
|
|
|
|
|
|
int cfexist( char * filename ); // Returns true if file exists on disk (1) or in hog (2).
|
|
|
|
|
|
|
|
// Allows files to be gotten from an alternate hog file.
|
|
|
|
// Passing NULL disables this.
|
|
|
|
// Returns 1 if hogfile found (& contains file), else 0.
|
|
|
|
// If NULL passed, returns 1
|
|
|
|
int cfile_use_alternate_hogfile( char * name );
|
|
|
|
|
2002-08-27 04:05:29 +00:00
|
|
|
// Allows files to be gotten from the Descent 1 hog file.
|
|
|
|
// Passing NULL disables this.
|
|
|
|
// Returns 1 if hogfile found (& contains file), else 0.
|
|
|
|
// If NULL passed, returns 1
|
|
|
|
int cfile_use_descent1_hogfile(char * name);
|
|
|
|
|
2001-01-19 03:30:16 +00:00
|
|
|
// All cfile functions will check this directory if no file exists
|
|
|
|
// in the current directory.
|
|
|
|
void cfile_use_alternate_hogdir( char * path );
|
|
|
|
|
|
|
|
//tell cfile about your critical error counter
|
|
|
|
void cfile_set_critical_error_counter_ptr(int *ptr);
|
|
|
|
|
|
|
|
// prototypes for reading basic types from cfile
|
|
|
|
int cfile_read_int(CFILE *file);
|
|
|
|
short cfile_read_short(CFILE *file);
|
|
|
|
byte cfile_read_byte(CFILE *file);
|
2001-10-19 08:06:20 +00:00
|
|
|
fix cfile_read_fix(CFILE *file);
|
2002-07-27 04:39:23 +00:00
|
|
|
fixang cfile_read_fixang(CFILE *file);
|
2001-10-19 08:06:20 +00:00
|
|
|
void cfile_read_vector(vms_vector *v, CFILE *file);
|
|
|
|
void cfile_read_angvec(vms_angvec *v, CFILE *file);
|
2002-07-27 04:39:23 +00:00
|
|
|
void cfile_read_matrix(vms_matrix *v, CFILE *file);
|
2001-01-19 03:30:16 +00:00
|
|
|
|
2002-02-11 07:42:54 +00:00
|
|
|
extern char AltHogDir[];
|
|
|
|
extern char AltHogdir_initialized;
|
|
|
|
|
2001-01-19 03:30:16 +00:00
|
|
|
#endif
|