GELIB.H 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. /* Catacomb Armageddon Source Code
  2. * Copyright (C) 1993-2014 Flat Rock Software
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along
  15. * with this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  17. */
  18. #include "SL_FILE.h"
  19. ///////////////////////////////////////////////////////////////////////////
  20. //
  21. // Defines
  22. //
  23. #define ANIM_USES_SHAPE_TABLE false
  24. #define PI_MAX_ANIMS 10
  25. #define PI_MAX_PAGES 40
  26. #define SAVEVER_DATA "0.01"
  27. #define FILENAME_LEN 15
  28. #define GAMENAME "CATACOMB ARMAGEDDON 3-D"
  29. #define VERSION "V1.02"
  30. #define REVISION " rev 1 "
  31. //#define BOBLIST 1 //SP - Undefine if not using BOBList
  32. #define AUDIO_DISK (2)
  33. #define VIDEO_DISK (1)
  34. #define LEVEL_DISK (2)
  35. #define BIO_BUFFER_LEN (512)
  36. #define TrashProg Quit
  37. // #define AMIGA
  38. typedef struct Sample {
  39. char *filename;
  40. memptr *data;
  41. } Sample;
  42. typedef enum {ged_none, ged_SoundSource,ged_SoundBlaster} AudioDeviceType;
  43. //typedef struct {
  44. // memptr textptr;
  45. // char far *pages[MAX_TEXT_PAGES];
  46. // short totalpages;
  47. //} textinfo;
  48. typedef struct {
  49. int handle; // handle of file
  50. memptr buffer; // pointer to buffer
  51. word offset; // offset into buffer
  52. word status; // read/write status
  53. } BufferedIO;
  54. typedef enum ANIMINFO {at_NONE,at_INIT,at_WAIT,at_ONCE,at_CYCLE,
  55. at_REBOUND,at_EXTRA,
  56. at_FWD,at_REV
  57. } ANIMINFO;
  58. struct BitMapHeader {
  59. unsigned int w,h,x,y;
  60. unsigned char d,trans,comp,pad;
  61. };
  62. struct BitMap {
  63. unsigned int Width;
  64. unsigned int Height;
  65. unsigned int Depth;
  66. unsigned int BytesPerRow;
  67. char far *Planes[8];
  68. };
  69. struct Shape {
  70. memptr Data;
  71. long size;
  72. unsigned int BPR;
  73. struct BitMapHeader bmHdr;
  74. };
  75. #ifdef AMIGA
  76. typedef struct {
  77. char *script[PI_MAX_PAGES];
  78. XBitMap **shapes;
  79. XBitMap **font;
  80. short xl,yl,xh,yh;
  81. struct BitMap *dst;
  82. char numpages,bgcolor;
  83. } PresenterInfo;
  84. #else
  85. typedef struct {
  86. char far *script[PI_MAX_PAGES];
  87. memptr scriptstart;
  88. short xl,yl,xh,yh;
  89. char numpages,bgcolor,ltcolor,dkcolor;
  90. } PresenterInfo;
  91. #endif
  92. ///////////////////////////////////////////////////////////////////////////
  93. //
  94. // Externs
  95. //
  96. extern char Filename[], ID[], VER[];
  97. extern boolean ge_textmode;
  98. extern short PPT_LeftEdge,PPT_RightEdge;
  99. //extern boolean ConserveMemory;
  100. extern BufferedIO lzwBIO;
  101. extern short wall_anim_delay,wall_anim_time;
  102. ///////////////////////////////////////////////////////////////////////////
  103. //
  104. // Function prototypes
  105. //
  106. void WaitKeyVBL(short key, short vbls);
  107. void CalibrateJoystick(short joynum);
  108. void MoveScreen(short x, short y);
  109. void MoveGfxDst(short x, short y);
  110. void DoPiracy(void);
  111. void PrintPropText(char far *text);
  112. //void DisplayText(textinfo *textinfo);
  113. //long LoadTextFile(char *filename,textinfo *textinfo);
  114. //void FreeTextFile(textinfo *textinfo);
  115. //void InitTextFile(textinfo *textinfo);
  116. long Verify(char *filename);
  117. void GE_SaveGame(void);
  118. boolean GE_LoadGame(void);
  119. int GE_HardError(word errval,int ax,int bp,int si);
  120. #ifdef BOBLIST
  121. boolean UpdateBOBList(objtype *obj,struct Simple_Shape *Shape,shapeclass Class, short priority, spriteflags sprflags);
  122. boolean RemoveBOBShape(objtype *obj, shapeclass Class);
  123. void RemoveBOBList(objtype *obj);
  124. void InitBOBList(objtype *obj, struct BOB_Shape *BOB_Shape, short NumElements);
  125. void RefreshBOBList(objtype *obj);
  126. #endif
  127. unsigned long BLoad(char *SourceFile, memptr *DstPtr);
  128. void lzwDecompressFromRAM(byte far *SrcPtr, byte far *DstPtr, longword SrcLen);
  129. void lzwDecompressFromFile(BufferedIO *SrcPtr, byte far *DstPtr, longword SrcLen);
  130. byte readch(int handle);
  131. memptr InitBufferedIO(int handle, BufferedIO *bio);
  132. void FreeBufferedIO(BufferedIO *bio);
  133. byte bio_readch(BufferedIO *bio);
  134. void bio_fillbuffer(BufferedIO *bio);
  135. void SwapLong(long far *Var);
  136. void SwapWord(unsigned int far *Var);
  137. int LoadShape(char *Filename,struct Shape *SHP);
  138. void FreeShape(struct Shape *shape);
  139. int UnpackEGAShapeToScreen(struct Shape *SHP,int startx,int starty);
  140. char GetKeyChoice(char *choices,boolean clear);
  141. boolean AnimateObj(objtype *obj);
  142. void AdvanceAnimFWD(objtype *obj);
  143. void AdvanceAnimREV(objtype *obj);
  144. void LoadASArray(struct Sample *ASArray);
  145. void FreeASArray(struct Sample *ASArray);
  146. //void SelectDigiAudio(AudioDeviceType Device);
  147. void PlaySample(unsigned SampleNum);
  148. void GE_FreeAllDigiSounds(void);
  149. void GE_LoadAllDigiSounds(void);
  150. void DisplayGameList(short winx, short winy, short list_width, short list_height);
  151. void ReadGameList(void);
  152. void CheckStack(void);
  153. void CenterObj(objtype *obj, unsigned x, unsigned y);
  154. void cachein(short s,short e);
  155. void cacheout(short s,short e);
  156. void FizzleFade (unsigned source, unsigned dest,unsigned width,unsigned height, boolean abortable);
  157. void mprintf(char *msg, ...);
  158. boolean FindFile(char *filename,char *disktext,char disknum);
  159. void CacheAV(char *title);
  160. void BlackPalette(void);
  161. void ColoredPalette(void);
  162. void Presenter(PresenterInfo *pi);
  163. unsigned PI_VALUE(char far *ptr,char num_nybbles);
  164. long LoadPresenterScript(char *filename,PresenterInfo *pi);
  165. void FreePresenterScript(PresenterInfo *pi);
  166. void InitPresenterScript(PresenterInfo *pi);
  167. void AnimatePage(short numanims);
  168. short BoxAroundPic(short x1, short y1, unsigned picnum, PresenterInfo *pi);
  169. void PurgeAllGfx(void);
  170. void CachePage(char far *script);
  171. void AnimateWallList(void);