-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathID_CA.H
143 lines (106 loc) · 3.7 KB
/
ID_CA.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
// ID_CA.H
//===========================================================================
#define NUM_EPISODES 1
#define MAPS_PER_EPISODE 25
#define MAPS_WITH_STATS 20
#define NUMMAPS NUM_EPISODES*MAPS_PER_EPISODE
#define MAPPLANES 2
#define UNCACHEGRCHUNK(chunk) {MM_FreePtr(&grsegs[chunk]);grneeded[chunk]&=~ca_levelbit;}
#define THREEBYTEGRSTARTS
#ifdef THREEBYTEGRSTARTS
#define FILEPOSSIZE 3
#else
#define FILEPOSSIZE 4
#endif
//===========================================================================
typedef struct
{
long planestart[3];
unsigned planelength[3];
unsigned width,height;
char name[16];
} maptype;
typedef struct
{
unsigned bit0,bit1; // 0-255 is a character, > is a pointer to a node
} huffnode;
typedef struct
{
unsigned RLEWtag;
long headeroffsets[100];
byte tileinfo[];
} mapfiletype;
//===========================================================================
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);
extern int grhandle; // handle to EGAGRAPH
extern int maphandle; // handle to MAPTEMP / GAMEMAPS
extern int audiohandle; // handle to AUDIOT / AUDIO
extern long chunkcomplen,chunkexplen;
#ifdef GRHEADERLINKED
extern huffnode *grhuffman;
#else
extern huffnode grhuffman[255];
#endif
//===========================================================================
// 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 CAL_SetupAudioFile (void);
void CAL_SetupGrFile (void);
void CAL_SetupMapFile (void);
void CAL_HuffExpand (byte huge *source, byte huge *dest,
long length,huffnode far *hufftable, boolean screenhack);
void CloseGrFile(void);
void OpenGrFile(void);