home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / graphics / directx / foxbear / gameproc.h < prev    next >
C/C++ Source or Header  |  1997-07-14  |  5KB  |  198 lines

  1. /*==========================================================================
  2.  *
  3.  *  Copyright (C) 1995-1997 Microsoft Corporation. All Rights Reserved.
  4.  *  Copyright (C) 1994-1995 ATI Technologies Inc. All Rights Reserved.
  5.  *
  6.  *  File:    gameproc.h
  7.  *  Content:    include file for game processing info
  8.  *
  9.  ***************************************************************************/
  10. #ifndef __GAMEPROC_INCLUDED__
  11. #define __GAMEPROC_INCLUDED__
  12.  
  13. typedef enum enum_POSITION {
  14.     P_ABSOLUTE,
  15.     P_RELATIVE,
  16.     P_AUTOMATIC
  17. } POSITION;
  18.  
  19. typedef enum enum_SWITCHING {
  20.     HOR,
  21.     VER,
  22.     TIME
  23. } SWITCHING;
  24.  
  25. typedef enum enum_DIRECTION {
  26.     SAME,
  27.     RIGHT,
  28.     LEFT
  29. } DIRECTION;
  30.  
  31. typedef enum enum_ACTION {
  32.     NONE,
  33.     STILL,
  34.     WALK,
  35.     RUN,
  36.     JUMP,
  37.     THROW,
  38.     CROUCH,
  39.     STOP,
  40.     STUNNED,
  41.     JUMPTHROW,
  42.     CROUCHWALK,
  43.     BLURR,
  44.     STRIKE,
  45.     MISS,
  46.     CHEW,
  47. } ACTION;
  48.  
  49. typedef SHORT HPOSLIST;
  50. typedef BOOL HSURFACELIST;
  51.  
  52. typedef struct struct_HPLANE {
  53.     GFX_HBM *hBM;
  54.     BOOL    *surface;
  55.     LONG     x;
  56.     LONG     y;
  57.     USHORT   width;
  58.     USHORT   height;
  59.     LONG     xv;
  60.     LONG     xslide;
  61.     LONG     xincrem;
  62.     USHORT   denom;
  63. } HPLANE, FAR *LPHPLANE;
  64.  
  65. typedef struct struct_HSPRITE_BM {
  66.     GFX_HBM   hBM;
  67.     ACTION    action;
  68.     DIRECTION direction;
  69.     SHORT     x;
  70.     SHORT     y;
  71.     USHORT    width;
  72.     USHORT    height;
  73. } HSPRITE_BM;
  74.  
  75. typedef struct struct_HSPRITE {
  76.     HSPRITE_BM *hSBM;
  77.     USHORT      bitmapCount;
  78.     ACTION      currentAction;
  79.     DIRECTION   currentDirection;
  80.     USHORT      currentBitmap;
  81.     BOOL        active;
  82.     LONG        x;
  83.     LONG        y;
  84.     USHORT      width;
  85.     USHORT      height;
  86.     LONG        xv;
  87.     LONG        yv;
  88.     LONG        xa;
  89.     LONG        ya;
  90.     SHORT       xmax;
  91.     SHORT       ymax;
  92.     LONG        absSwitch;
  93.     LONG        relSwitch;
  94.     SWITCHING   switchType;
  95.     BOOL        switchForward;
  96.     BOOL        switchDone;
  97. } HSPRITE, FAR *LPHSPRITE, FAR * FAR *LPLPHSPRITE;
  98.  
  99. typedef struct struct_HBITMAPLIST 
  100. {
  101.     GFX_HBM *hBM;
  102. } HBITMAPLIST, FAR *LPHBITMAPLIST;
  103.  
  104.  
  105. #include "tile.h"
  106. #include "plane.h"
  107. #include "sprite.h"
  108.  
  109. #define C_UNIT        (LONG) 65536    
  110.  
  111. #define C_TILE_W                32
  112. #define C_TILE_H                32
  113. #define C_SCREEN_W             640
  114. #define C_SCREEN_H             480
  115.  
  116. #define C_FORE_W                80
  117. #define C_FORE_H                15
  118. #define C_MID_W                 40
  119. #define C_MID_H                 15
  120. #define C_BACK_W                25
  121. #define C_BACK_H                15
  122. #define C_WORLD_W               20
  123. #define C_WORLD_H               15 
  124.  
  125. #define C_BACK_DENOM            12
  126. #define C_MID_DENOM              3
  127. #define C_FORE_DENOM             1
  128.  
  129. #define C_TILETOTAL            123      // TILE BITMAP TOTAL
  130. #define C_FBT                  112      // FOX BITMAP TOTAL
  131. #define C_BBT                   26      // BEAR BITMAP TOTAL
  132.  
  133. #define C_FOXSTILL               1      // NUMBER OF BITMAPS
  134. #define C_FOXWALK               12
  135. #define C_FOXRUN                16
  136. #define C_FOXJUMP                4
  137. #define C_FOXTHROW               2
  138. #define C_FOXCROUCH              1
  139. #define C_FOXSTOP                1
  140. #define C_FOXSTUNNED             1
  141. #define C_FOXJUMPTHROW           2
  142. #define C_FOXCROUCHWALK         12
  143. #define C_FOXBLURR               4
  144.  
  145. #define C_BEARMISS               2
  146. #define C_BEARWALK              12
  147. #define C_BEARSTRIKE            12
  148.  
  149.  
  150. #define C_FOX_XMOVE          (LONG)   C_UNIT / 4
  151.  
  152. #define C_BOUNDINCREM        (LONG)     5 * C_UNIT
  153. #define C_BOUNDDIF           (LONG)   240 * C_UNIT
  154.  
  155. #define C_FOX_STARTX         (LONG)   150 * C_UNIT     
  156. #define C_FOX_STARTY         (LONG)   318 * C_UNIT
  157.  
  158. #define C_FOX_WALKMOVE       (LONG)     6 * C_UNIT
  159. #define C_FOX_RUNMOVE        (LONG)    18 * C_UNIT
  160. #define C_FOX_JUMPMOVE       (LONG)     9 * C_UNIT
  161.  
  162. #define C_FOX_WALKSWITCH     (LONG)     6 * C_UNIT
  163. #define C_FOX_JUMPSWITCH     (LONG)     9 * C_UNIT
  164. #define C_FOX_THROWSWITCH    (LONG)    15 * C_UNIT
  165. #define C_FOX_RUNSWITCH      (LONG)    18 * C_UNIT 
  166. #define C_FOX_BLURRSWITCH    (LONG)    18 * C_UNIT 
  167.  
  168. #define C_FOX_WALKTORUN      (LONG)     4 * C_UNIT
  169. #define C_FOX_RUNTOBLURR     (LONG)    14 * C_UNIT
  170.  
  171. #define C_BEAR_STARTX        (LONG)   600 * C_UNIT
  172. #define C_BEAR_STARTY        (LONG)   329 * C_UNIT
  173.  
  174. #define C_BEAR_WALKMOVE      (LONG)     1 * C_UNIT
  175.  
  176. #define C_BEAR_WALKSWITCH    (LONG)     6 * C_UNIT
  177. #define C_BEAR_STRIKESWITCH  (LONG)     8 * C_UNIT
  178. #define C_BEAR_MISSSWITCH    (LONG)    10 * C_UNIT
  179.  
  180.  
  181. extern void ErrorMessage( LPSTR );
  182. extern BOOL InitBuffer( GFX_HBM* );
  183. extern void DestroyBuffer( GFX_HBM );
  184. extern HBITMAPLIST *LoadBitmaps( void );
  185. extern void InitTiles( HBITMAPLIST**, HBITMAPLIST*, USHORT );
  186. extern void InitPlane( HPLANE**, HPOSLIST**, CHAR*, USHORT, USHORT, USHORT );
  187. extern void InitSurface( HSURFACELIST**, CHAR*, USHORT, USHORT );
  188. extern void InitFox( HSPRITE**, HBITMAPLIST* );
  189. extern void InitBear( HSPRITE**, HBITMAPLIST* );
  190. extern void InitApple( HSPRITE**, HBITMAPLIST* );
  191. extern BOOL PreInitializeGame( void );
  192. extern BOOL InitializeGame( void );
  193. extern BOOL GetInput( void );
  194. extern BOOL ProcessInput ( SHORT input );
  195. extern int NewGameFrame( void );
  196. extern void DestroyGame( void );
  197. #endif
  198.