1 /* Catacomb Armageddon Source Code
\r
2 * Copyright (C) 1993-2014 Flat Rock Software
\r
4 * This program is free software; you can redistribute it and/or modify
\r
5 * it under the terms of the GNU General Public License as published by
\r
6 * the Free Software Foundation; either version 2 of the License, or
\r
7 * (at your option) any later version.
\r
9 * This program is distributed in the hope that it will be useful,
\r
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
12 * GNU General Public License for more details.
\r
14 * You should have received a copy of the GNU General Public License along
\r
15 * with this program; if not, write to the Free Software Foundation, Inc.,
\r
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
19 #include "SL_FILE.h"
\r
22 ///////////////////////////////////////////////////////////////////////////
\r
27 #define ANIM_USES_SHAPE_TABLE false
\r
28 #define PI_MAX_ANIMS 10
\r
29 #define PI_MAX_PAGES 40
\r
31 #define SAVEVER_DATA "0.01"
\r
32 #define FILENAME_LEN 15
\r
34 #define GAMENAME "CATACOMB ARMAGEDDON 3-D"
\r
35 #define VERSION "V1.02"
\r
36 #define REVISION " rev 1 "
\r
38 //#define BOBLIST 1 //SP - Undefine if not using BOBList
\r
40 #define AUDIO_DISK (2)
\r
41 #define VIDEO_DISK (1)
\r
42 #define LEVEL_DISK (2)
\r
44 #define BIO_BUFFER_LEN (512)
\r
46 #define TrashProg Quit
\r
51 typedef struct Sample {
\r
56 typedef enum {ged_none, ged_SoundSource,ged_SoundBlaster} AudioDeviceType;
\r
60 // char far *pages[MAX_TEXT_PAGES];
\r
61 // short totalpages;
\r
65 int handle; // handle of file
\r
66 memptr buffer; // pointer to buffer
\r
67 word offset; // offset into buffer
\r
68 word status; // read/write status
\r
71 typedef enum ANIMINFO {at_NONE,at_INIT,at_WAIT,at_ONCE,at_CYCLE,
\r
72 at_REBOUND,at_EXTRA,
\r
76 struct BitMapHeader {
\r
77 unsigned int w,h,x,y;
\r
78 unsigned char d,trans,comp,pad;
\r
83 unsigned int Height;
\r
85 unsigned int BytesPerRow;
\r
86 char far *Planes[8];
\r
93 struct BitMapHeader bmHdr;
\r
98 char *script[PI_MAX_PAGES];
\r
102 struct BitMap *dst;
\r
103 char numpages,bgcolor;
\r
107 char far *script[PI_MAX_PAGES];
\r
108 memptr scriptstart;
\r
110 char numpages,bgcolor,ltcolor,dkcolor;
\r
115 ///////////////////////////////////////////////////////////////////////////
\r
120 extern char Filename[], ID[], VER[];
\r
121 extern boolean ge_textmode;
\r
122 extern short PPT_LeftEdge,PPT_RightEdge;
\r
123 //extern boolean ConserveMemory;
\r
124 extern BufferedIO lzwBIO;
\r
125 extern short wall_anim_delay,wall_anim_time;
\r
129 ///////////////////////////////////////////////////////////////////////////
\r
131 // Function prototypes
\r
133 void WaitKeyVBL(short key, short vbls);
\r
134 void CalibrateJoystick(short joynum);
\r
135 void MoveScreen(short x, short y);
\r
136 void MoveGfxDst(short x, short y);
\r
137 void DoPiracy(void);
\r
138 void PrintPropText(char far *text);
\r
139 //void DisplayText(textinfo *textinfo);
\r
140 //long LoadTextFile(char *filename,textinfo *textinfo);
\r
141 //void FreeTextFile(textinfo *textinfo);
\r
142 //void InitTextFile(textinfo *textinfo);
\r
143 long Verify(char *filename);
\r
144 void GE_SaveGame(void);
\r
145 boolean GE_LoadGame(void);
\r
146 int GE_HardError(word errval,int ax,int bp,int si);
\r
151 boolean UpdateBOBList(objtype *obj,struct Simple_Shape *Shape,shapeclass Class, short priority, spriteflags sprflags);
\r
152 boolean RemoveBOBShape(objtype *obj, shapeclass Class);
\r
153 void RemoveBOBList(objtype *obj);
\r
154 void InitBOBList(objtype *obj, struct BOB_Shape *BOB_Shape, short NumElements);
\r
155 void RefreshBOBList(objtype *obj);
\r
159 unsigned long BLoad(char *SourceFile, memptr *DstPtr);
\r
160 void lzwDecompressFromRAM(byte far *SrcPtr, byte far *DstPtr, longword SrcLen);
\r
161 void lzwDecompressFromFile(BufferedIO *SrcPtr, byte far *DstPtr, longword SrcLen);
\r
162 byte readch(int handle);
\r
164 memptr InitBufferedIO(int handle, BufferedIO *bio);
\r
165 void FreeBufferedIO(BufferedIO *bio);
\r
166 byte bio_readch(BufferedIO *bio);
\r
167 void bio_fillbuffer(BufferedIO *bio);
\r
170 void SwapLong(long far *Var);
\r
171 void SwapWord(unsigned int far *Var);
\r
172 int LoadShape(char *Filename,struct Shape *SHP);
\r
173 void FreeShape(struct Shape *shape);
\r
174 int UnpackEGAShapeToScreen(struct Shape *SHP,int startx,int starty);
\r
175 char GetKeyChoice(char *choices,boolean clear);
\r
176 boolean AnimateObj(objtype *obj);
\r
177 void AdvanceAnimFWD(objtype *obj);
\r
178 void AdvanceAnimREV(objtype *obj);
\r
180 void LoadASArray(struct Sample *ASArray);
\r
181 void FreeASArray(struct Sample *ASArray);
\r
182 //void SelectDigiAudio(AudioDeviceType Device);
\r
183 void PlaySample(unsigned SampleNum);
\r
184 void GE_FreeAllDigiSounds(void);
\r
185 void GE_LoadAllDigiSounds(void);
\r
186 void DisplayGameList(short winx, short winy, short list_width, short list_height);
\r
187 void ReadGameList(void);
\r
188 void CheckStack(void);
\r
189 void CenterObj(objtype *obj, unsigned x, unsigned y);
\r
190 void cachein(short s,short e);
\r
191 void cacheout(short s,short e);
\r
192 void FizzleFade (unsigned source, unsigned dest,unsigned width,unsigned height, boolean abortable);
\r
193 void mprintf(char *msg, ...);
\r
194 boolean FindFile(char *filename,char *disktext,char disknum);
\r
195 void CacheAV(char *title);
\r
196 void BlackPalette(void);
\r
197 void ColoredPalette(void);
\r
198 void Presenter(PresenterInfo *pi);
\r
199 unsigned PI_VALUE(char far *ptr,char num_nybbles);
\r
200 long LoadPresenterScript(char *filename,PresenterInfo *pi);
\r
201 void FreePresenterScript(PresenterInfo *pi);
\r
202 void InitPresenterScript(PresenterInfo *pi);
\r
204 void AnimatePage(short numanims);
\r
205 short BoxAroundPic(short x1, short y1, unsigned picnum, PresenterInfo *pi);
\r
206 void PurgeAllGfx(void);
\r
207 void CachePage(char far *script);
\r
210 void AnimateWallList(void);
\r