Reaction.h
上传用户:royluo
上传日期:2007-01-05
资源大小:1584k
文件大小:3k
源码类别:

游戏

开发平台:

Visual C++

  1. /*****************************************************************************
  2. *                                                                             
  3. *   Reaction.h
  4. *                                                                             
  5. *   Electrical Engineering Faculty - Software Lab                             
  6. *   Spring semester 1998                                                      
  7. *                                                                             
  8. *   Tanks game                                                                
  9. *                                                                             
  10. *   Module description: Implements the game reaction object.
  11. *                       
  12. *                                                                             
  13. *   Authors: Eran Yariv - 28484475                                           
  14. *            Moshe Zur  - 24070856                                           
  15. *                                                                            
  16. *                                                                            
  17. *   Date: 23/09/98                                                           
  18. *                                                                            
  19. ******************************************************************************/
  20. #ifndef _REACTION_H
  21. #define _REACTION_H
  22. typedef enum {  TERR_EMPTY  = 0,
  23.                 TERR_75SPEED,
  24.                 TERR_50SPEED,
  25.                 TERR_25SPEED,
  26.                 TERR_BLOCKED,       // Hit block area (wall)
  27.                 HIT_TANK            // Hit block area (tank)
  28.              } TerrainType;
  29. typedef enum {
  30.     BONUS_NONE    = 0,
  31.     BONUS_SHELLS,
  32.     BONUS_BULLETS,
  33.     BONUS_MINES,
  34.     BONUS_BOMBER,
  35.     BONUS_FIRE_RATE,
  36.     BONUS_SHIELD,
  37.     NUM_BONUSES
  38. } BonusType;
  39. class CReaction
  40. {
  41. public:
  42.     CReaction (UINT uExplosionIntensity = 0,
  43.                TerrainType uTerrainDifficulty = TERR_EMPTY,
  44.                BonusType = BONUS_NONE,
  45.                UINT TankID = 0);
  46.     virtual ~CReaction() {}
  47.     UINT            GetExplosionIntensity();
  48.     TerrainType     GetTerrainDifficulty();
  49.     BonusType       GetBonusType ();
  50.     UINT            GetTankID ();
  51. private:
  52.     WORD    m_wReactionBits;
  53.                     /*  Bits  0.. 5  - Explosion intensity (0..63)
  54.                         Bits  6.. 8  - Terrain difficulty level.
  55.                                        Values defined in GameBoard.h as TERR_XXX + HIT_TANK
  56.                         Bits  9..11  - Bonus type (0=None, 1=Shells Ammo., 
  57.                                        2 = Bullets ammo., 3=Mines, 
  58.                                        4=Bomber, 5=Fire rate, 6=Shield)
  59.                         Bits 12..14  - Tank ID (in case of HIT_TANK)
  60.                     */
  61.     enum {  REACTION_EXPLOSION_MASK     = 0x03F,
  62.             REACTION_TERRAIN_MASK       = 0x1C0,
  63.             REACTION_TERRAIN_SHIFT      = 0x6,
  64.             REACTION_BONUS_MASK         = 0xE00,
  65.             REACTION_BONUS_SHIFT        = 0x9,
  66.             REACTION_TANKID_MASK        = 0x7000,
  67.             REACTION_TANKID_SHIFT       = 0xC
  68.          };
  69. };
  70. #include <Reaction.inl>
  71. #endif