home *** CD-ROM | disk | FTP | other *** search
/ Game Programming - All in One (3rd Edition) / game_prog_all_in_one_3rd_ed.iso / sources / TankWar-Final / mappyal.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-01-16  |  4.5 KB  |  124 lines

  1. /* Header file for mappyAL V1.0 */
  2. /* (C)2001 Robin Burrows  -  rburrows@bigfoot.com */
  3.  
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7.  
  8. #define MER_NONE 0        /* All the horrible things that can go wrong */
  9. #define MER_OUTOFMEM 1
  10. #define MER_MAPLOADERROR 2
  11. #define MER_NOOPEN 3
  12. #define MER_NOSCREEN 4
  13. #define MER_NOACCELERATION 5
  14. #define MER_CVBFAILED 6
  15.  
  16. #define AN_END -1            /* Animation types, AN_END = end of anims */
  17. #define AN_NONE 0            /* No anim defined */
  18. #define AN_LOOPF 1        /* Loops from start to end, then jumps to start etc */
  19. #define AN_LOOPR 2        /* As above, but from end to start */
  20. #define AN_ONCE 3            /* Only plays once */
  21. #define AN_ONCEH 4        /* Only plays once, but holds end frame */
  22. #define AN_PPFF 5            /* Ping Pong start-end-start-end-start etc */
  23. #define AN_PPRR 6            /* Ping Pong end-start-end-start-end etc */
  24. #define AN_PPRF 7            /* Used internally by playback */
  25. #define AN_PPFR 8            /* Used internally by playback */
  26. #define AN_ONCES 9        /* Used internally by playback */
  27.  
  28. /* Obsolete functions */
  29. #define MapDraw8BG MapDrawBG
  30. #define MapDraw8BGT MapDrawBGT
  31. #define MapDraw8FG MapDrawFG
  32. #define MapDraw15BG MapDrawBG
  33. #define MapDraw15BGT MapDrawBGT
  34. #define MapDraw15FG MapDrawFG
  35. #define MapDraw16BG MapDrawBG
  36. #define MapDraw16BGT MapDrawBGT
  37. #define MapDraw16FG MapDrawFG
  38. #define MapDraw32BG MapDrawBG
  39. #define MapDraw32BGT MapDrawBGT
  40. #define MapDraw32FG MapDrawFG
  41.  
  42. typedef struct {                /* Structure for data blocks */
  43. long int bgoff, fgoff;            /* offsets from start of graphic blocks */
  44. long int fgoff2, fgoff3;         /* more overlay blocks */
  45. unsigned long int user1, user2;    /* user long data */
  46. unsigned short int user3, user4;    /* user short data */
  47. unsigned char user5, user6, user7;    /* user byte data */
  48. unsigned char tl : 1;                /* bits for collision detection */
  49. unsigned char tr : 1;
  50. unsigned char bl : 1;
  51. unsigned char br : 1;
  52. unsigned char trigger : 1;            /* bit to trigger an event */
  53. unsigned char unused1 : 1;
  54. unsigned char unused2 : 1;
  55. unsigned char unused3 : 1;
  56. } BLKSTR;
  57.  
  58. typedef struct {        /* Animation control structure */
  59. signed char antype;    /* Type of anim, AN_? */
  60. signed char andelay;    /* Frames to go before next frame */
  61. signed char ancount;    /* Counter, decs each frame, till 0, then resets to andelay */
  62. signed char anuser;    /* User info */
  63. long int ancuroff;    /* Points to current offset in list */
  64. long int anstartoff;    /* Points to start of blkstr offsets list, AFTER ref. blkstr offset */
  65. long int anendoff;    /* Points to end of blkstr offsets list */
  66. } ANISTR;
  67.  
  68.  
  69. /* All global variables used bt Mappy playback are here */
  70. extern int maperror;        /* Set to a MER_ error if something wrong happens */
  71. extern short int mapwidth, mapheight, mapblockwidth, mapblockheight, mapdepth;
  72. extern short int mapblockstrsize, mapnumblockstr, mapnumblockgfx;
  73. extern short int * mappt;
  74. extern short int ** maparraypt;
  75. extern char * mapcmappt;
  76. extern char * mapblockgfxpt;
  77. extern char * mapblockstrpt;
  78. extern ANISTR * mapanimstrpt;
  79. extern ANISTR * mapanimstrendpt;
  80. extern RGB * mapcmap6bit;
  81. extern short int ** mapmappt;
  82. extern short int *** mapmaparraypt;
  83. extern BITMAP ** abmTiles;
  84. extern int mapblocksinvidmem, mapblocksinsysmem;
  85. extern int mapblockgapx, mapblockgapy;
  86. extern int mapblockstaggerx, mapblockstaggery;
  87. /* End of Mappy globals */
  88.  
  89. void Mapconv8to6pal (unsigned char *);
  90. void MapFreeMem (void);
  91. void MapSetPal8 (void);
  92. void MapCorrectColours (void);
  93. int MapRelocate (void);
  94. int MapLoad (char *);
  95. int MapLoadVRAM (char *);
  96. int MapLoadABM (char *);
  97. int MapDecode (unsigned char *);
  98. int MapDecodeVRAM (unsigned char *);
  99. int MapDecodeABM (unsigned char *);
  100. int MapLoadMAR (char *, int);
  101. int MapDecodeMAR (unsigned char *, int);
  102. int MapGetBlockID (int, int);
  103. int MapGenerateYLookup (void);
  104. int MapChangeLayer (int);
  105. int MapGetXOffset (int, int);
  106. int MapGetYOffset (int, int);
  107. BLKSTR * MapGetBlockInPixels (int, int);
  108. BLKSTR * MapGetBlock (int, int);
  109. void MapSetBlockInPixels (int, int, int);
  110. void MapSetBlock (int, int, int);
  111. void MapRestore (void);
  112. void MapInitAnims (void);
  113. void MapUpdateAnims (void);
  114. void MapDrawBG (BITMAP *, int, int, int, int, int, int);
  115. void MapDrawBGT (BITMAP *, int, int, int, int, int, int);
  116. void MapDrawFG (BITMAP *, int, int, int, int, int, int, int);
  117. void MapDrawRow (BITMAP *, int, int, int, int, int, int, int, void (*cellcall) (int cx, int cy, int dx, int dy));
  118. BITMAP * MapMakeParallaxBitmap (BITMAP *, int);
  119. void MapDrawParallax (BITMAP *, BITMAP *, int, int, int, int, int, int);
  120.  
  121. #ifdef __cplusplus
  122. }
  123. #endif
  124.