home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / progmisc / acksrc.zip / ACK3D.H < prev    next >
Text File  |  1993-06-20  |  7KB  |  244 lines

  1. /* Header file for xEngine.c "Currently called xtest.c" */
  2.  
  3. #define DEBUG    0
  4.  
  5. #define CLOCK_PTR   (*(long far *)((long)0x46C))
  6.  
  7. #define ULPTR    unsigned long
  8.  
  9. #define INT_ANGLE_1    5
  10. #define INT_ANGLE_2    10
  11. #define INT_ANGLE_4    20
  12. #define INT_ANGLE_6    30
  13. #define INT_ANGLE_30    160
  14. #define INT_ANGLE_45    240
  15. #define INT_ANGLE_90    480
  16. #define INT_ANGLE_135    720
  17. #define INT_ANGLE_180    960
  18. #define INT_ANGLE_225    1200
  19. #define INT_ANGLE_270    1440
  20. #define INT_ANGLE_315    1680
  21. #define INT_ANGLE_360    1920
  22.  
  23. #define FP_SHIFT    16
  24. #define FP_MULT        65536
  25. #define FP_HALF        32768
  26.  
  27. #define VIEW_WIDTH    320
  28. #define MAX_DISTANCE    2048
  29.  
  30. #define SKY_COLOR    195
  31. #define SKY_FLASH    15
  32. #define FLOOR_COLOR    20
  33.  
  34. #define TYPE_WALL    0
  35. #define TYPE_OBJECT    1
  36. #define TYPE_PALETTE    2
  37.  
  38. #define BITMAP_WIDTH    64
  39. #define BITMAP_HEIGHT    64
  40. #define BITMAP_SIZE    (BITMAP_WIDTH * BITMAP_HEIGHT)
  41.  
  42. #define GRID_SIZE    64
  43. #define GRID_WIDTH    64
  44. #define GRID_HEIGHT    64
  45. #define GRID_MAX    GRID_WIDTH * GRID_HEIGHT
  46. #define GRID_XMAX    GRID_WIDTH * GRID_SIZE
  47. #define GRID_YMAX    GRID_HEIGHT * GRID_SIZE
  48.  
  49. #define GRID_XMAXLONG    (GRID_XMAX * FP_MULT)
  50. #define GRID_YMAXLONG    (GRID_YMAX * FP_MULT)
  51.  
  52. typedef struct {        /* Keyboard structure. Each key that can */
  53.     int rightArrow;        /* be pressed is represented here.     */
  54.     int leftArrow;
  55.     int upArrow;
  56.     int downArrow;
  57.     int home;
  58.     int pgup;
  59.     int pgdn;
  60.     int end;
  61.     int control;
  62.     int alt;
  63.     int plus;
  64.     int minus;
  65.     int escape;
  66.     int letA;
  67.     int letS;
  68. } KEYBOARD;
  69.  
  70. #define KEYBD  0x9    /* INTERRUPT 9 */
  71.  
  72. /* Keyboard press and release codes for INT 9 handler */
  73.  
  74. #define RIGHT_ARROW_PRESSED   77
  75. #define RIGHT_ARROW_RELEASED  205
  76. #define UP_ARROW_PRESSED      72
  77. #define UP_ARROW_RELEASED     200
  78. #define LEFT_ARROW_PRESSED    75
  79. #define LEFT_ARROW_RELEASED   203
  80. #define DOWN_ARROW_PRESSED    80
  81. #define DOWN_ARROW_RELEASED   208
  82. #define CONTROL_PRESSED          29
  83. #define CONTROL_RELEASED      157
  84. #define ESCAPE              1
  85. #define HOME_PRESSED          71
  86. #define HOME_RELEASED          199
  87. #define PGUP_PRESSED          73
  88. #define PGUP_RELEASED          201
  89. #define PGDN_PRESSED          81
  90. #define PGDN_RELEASED          209
  91. #define END_PRESSED          79
  92. #define END_RELEASED          207
  93. #define PLUS_PRESSED          78
  94. #define PLUS_RELEASED          206
  95. #define MINUS_PRESSED          74
  96. #define MINUS_RELEASED          202
  97. #define LETTER_A_PRESSED      30
  98. #define LETTER_A_RELEASED     158
  99. #define LETTER_S_PRESSED      31
  100. #define LETTER_S_RELEASED     159
  101.  
  102. typedef struct {
  103.         int        BitmapNumber;    /* Number in map  */
  104.         int        BitmapType;        /* Wall or object */
  105.         char    *BitmapFile;    /* Filename      */
  106. } BMFILE;
  107.  
  108. typedef struct {
  109.     int        Number;
  110.     int        Column;
  111.     int        Distance;
  112.     int        filler;    /* Use to allow shifts vs multiplies */
  113.     } WALLARRAY;
  114.  
  115. #define MAX_VIEWS        49
  116. #define MAX_OBJECTS        100
  117.  
  118. #define MAX_HEIGHT        1024
  119. #define MIN_HEIGHT        16
  120.  
  121.  
  122. #define DOOR_SECRETCODE        58
  123. #define DOOR_XCODE        60
  124. #define DOOR_SIDECODE        61
  125. #define DOOR_YCODE        62
  126.  
  127. #define DEFAULT_DOOR_SPEED  2
  128. #define MAX_DOORS        10        /* Max opening or closing at one time  */
  129. #define MAX_UPDOWN        30        /* Max up or down spots for each level */
  130. #define MAX_SECRET_DOORS    30        /* Max secret doors in one level       */
  131.  
  132. #define MAP_STARTCODE        0xFC    /* Force player to this square  */
  133. #define MAP_UPCODE        0xFD    /* Go up to previous level        */
  134. #define MAP_DOWNCODE        0xFE    /* Go down to next level        */
  135. #define MAP_GOALCODE        0xFF    /* Finish line!            */
  136.  
  137.  
  138. #define ERR_BADFILE        100
  139. #define ERR_BADCOMMAND        101
  140. #define ERR_BADOBJNUMBER    102
  141. #define ERR_BADSYNTAX        103
  142. #define ERR_LOADINGBITMAP   104
  143. #define ERR_BADDIRECTION    105
  144. #define ERR_BADSTARTX        106
  145. #define ERR_BADSTARTY        107
  146. #define ERR_BADANGLE        108
  147. #define ERR_BADMAPFILE        109
  148. #define ERR_READINGMAP        110
  149. #define ERR_BADPICNAME        111
  150. #define ERR_INVALIDFORM        112
  151. #define ERR_NOPBM        113
  152. #define ERR_BADPICFILE        114
  153. #define ERR_NOMEMORY        115
  154. #define ERR_BADPALFILE        116
  155.  
  156. typedef struct {
  157.         int        mPos;
  158. unsigned    char    mCode;
  159. } SPECIALCODE;
  160.  
  161.  
  162. typedef struct {
  163.         int        mPos;
  164.         int        mPos1;
  165. unsigned    char    mCode;
  166. unsigned    char    mCode1;
  167. unsigned    char    ColOffset;
  168.         char    Speed;
  169.         char    Type;
  170. } DOORS;
  171.  
  172.  
  173. typedef struct {
  174.         char    Active;
  175. unsigned    char    bmNum[MAX_VIEWS];
  176.         int        Sides;
  177.         char    Dir;
  178. unsigned    char    CurNum;
  179. unsigned    char    MaxNum;
  180.         char    Speed;
  181.         int        VidRow;
  182.         int        x;
  183.         int        y;
  184.         int        mPos;
  185. } OBJECTS;
  186.  
  187. typedef struct {
  188.     int        mdx;
  189.     int        mdy;
  190.     int        mButtons;
  191. } MOUSE;
  192.  
  193. /****************************************************************************
  194. **  P R O T O T Y P E S                               **
  195. ****************************************************************************/
  196. void SetPalette(unsigned char far *PalBuf);
  197. int mouse_installed(void);
  198. void mouse_read_cursor(int *button,int *row,int *col);
  199. void mouse_set_cursor(int row,int col);
  200. void usepage(int);
  201. void flippage(void);
  202. void graphinit(void);
  203. void textmode(int);
  204. void DrawObject(int ObjNum,int ObjCol,int ObjDist,int VidCol,int PageNum);
  205. void DrawOneObject(int ObjNum,int ObjCol,int ObjDist,int VidCol,int PageNum);
  206. void DrawWalls(void);
  207. unsigned char far * Readiff(char *picname);
  208. char *GetExtent(char *s);
  209. int LoadBitmap(int BitmapNumber,char *BitmapName,int BitmapType);
  210. int LoadPalette(char *PalName);
  211. char *StripEndOfLine(char *s);
  212. char *SkipSpaces(char *s);
  213. char *AddExtent(char *s,char *ext);
  214. char *CopyToComma(char *dest,char *src);
  215. long long_sqrt(long value);
  216. char xRay(int x,int y,int angle);
  217. char yRay(int x,int y,int angle);
  218. void DrawView(int xPlayer,int yPlayer,int PlayerAngle);
  219. void FindObject(int xPlayer,int yPlayer,int PlayerAngle);
  220. int GetTables(void);
  221. void keyCheck(void);
  222. void keyBoardInit(void);
  223. long CheckObjects(int xPlayer,int yPlayer,int PlayerAngle);
  224. int CheckHit(int xPlayer,int yPlayer,int ViewAngle);
  225. void CheckMouse(MOUSE *m);
  226. void MoveObject(int Index,int dx,int dy);
  227. void CheckObjectMovement(void);
  228. int FindDoor(int MapPosn);
  229. int FindDoorSlot(int MapPosn);
  230. int BuildTables(void);
  231. void InitializeMouse(void);
  232. void BuildXYgrid(void);
  233. void CheckDoors(int xPlayer,int yPlayer);
  234. int ReadMasterFile(char *fname);
  235. int ReadMapFile(void);
  236. unsigned char CheckSpecialCodes(int MapPosn);
  237. int ReadNewLevel(void);
  238. void WrapUp(void);
  239. void DoGoalScreen(void);
  240. void SetVGAmode(void);
  241. int FindSecretDoor(int MapPosn);
  242. int GetSecretColumn(int MapPosn);
  243.  
  244.