// ID_CA.H
//===========================================================================
#define NUMMAPS 60
#define MAPPLANES 2
#define UNCACHEGRchunk(chunk) {MM_FreePtr(&grsegs[chunk]);grneeded[chunk]&=~CA_levelbit;}
//===========================================================================
typedef struct
{
long planestart[3];
unsigned planelength[3];
unsigned width,height;
char name[16];
} maptype;
//===========================================================================
extern char audioname[13];
extern byte _seg *tinf;
extern int mapon;
extern unsigned _seg *mapsegs[MAPPLANES];
extern maptype _seg *mapheaderseg[NUMMAPS];
extern byte _seg *audiosegs[NUMSNDchunkS];
extern void _seg *grsegs[NUMchunkS];
extern byte far grneeded[NUMchunkS];
extern byte CA_levelbit,CA_levelnum;
extern char *titleptr[8];
extern int profilehandle,debughandle;
extern char extension[5],
gheadname[10],
gfilename[10],
gdictname[10],
mheadname[10],
mfilename[10],
aheadname[10],
afilename[10];
extern long _seg *grstarts; // array of offsets in egagraph, -1 for sparse
extern long _seg *audiostarts; // array of offsets in audio / audiot
//
// hooks for custom CAche dialogs
//
extern void (*drawCAchebox) (char *title, unsigned numCAche);
extern void (*updateCAchebox) (void);
extern void (*finishCAchebox) (void);
//===========================================================================
// just for the score box reshifting
void CAL_ShiftSprite (unsigned segment,unsigned source,unsigned dest,
unsigned width, unsigned height, unsigned pixshift);
//===========================================================================
void CA_OpenDebug (void);
void CA_CloseDebug (void);
boolean CA_FarRead (int handle, byte far *dest, long length);
boolean CA_FarWrite (int handle, byte far *source, long length);
boolean CA_ReadFile (char *filename, memptr *ptr);
boolean CA_LoadFile (char *filename, memptr *ptr);
boolean CA_WriteFile (char *filename, void far *ptr, long length);
long CA_RLEWCompress (unsigned huge *source, long length, unsigned huge *dest,
unsigned rlewtag);
void CA_RLEWexpand (unsigned huge *source, unsigned huge *dest,long length,
unsigned rlewtag);
void CA_Startup (void);
void CA_Shutdown (void);
void CA_SetGrPurge (void);
void CA_CAcheAudiochunk (int chunk);
void CA_LoadAllSounds (void);
void CA_UpLevel (void);
void CA_DownLevel (void);
void CA_SetAllPurge (void);
void CA_ClearMarks (void);
void CA_ClearAllMarks (void);
#define CA_MarkGrchunk(chunk) grneeded[chunk]|=CA_levelbit
void CA_CAcheGrchunk (int chunk);
void CA_CAcheMap (int mapnum);
void CA_CAcheMarks (void);
void CA_CAcheScreen (int chunk);