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

游戏

开发平台:

Visual C++

  1. /*****************************************************************************
  2. *                                                                             
  3. *   TankObj.inl
  4. *                                                                             
  5. *   Electrical Engineering Faculty - Software Lab                             
  6. *   Spring semester 1998                                                      
  7. *                                                                             
  8. *   Tanks game                                                                
  9. *                                                                             
  10. *   Contents: Inline functions implementations.
  11. *                                                                             
  12. *   Authors: Eran Yariv - 28484475                                           
  13. *            Moshe Zur  - 24070856                                           
  14. *                                                                            
  15. *                                                                            
  16. *   Date: 23/09/98                                                           
  17. *                                                                            
  18. ******************************************************************************/
  19. inline 
  20. CTankObj::~CTankObj()
  21. {
  22. }
  23. inline UINT 
  24. CTankObj::GetID ()
  25. {
  26.     return m_uTankID;
  27. }
  28. inline UINT 
  29. CTankObj::GetShieldLevel ()
  30. {
  31.     return m_uShieldLevel;
  32. }
  33. inline UINT 
  34. CTankObj::GetShellsCount ()
  35. {
  36.     return m_uShells;
  37. }
  38. inline UINT 
  39. CTankObj::GetBulletsCount ()
  40. {
  41.     return m_uBullets;
  42. }
  43. inline UINT 
  44. CTankObj::GetMinesCount ()
  45. {
  46.     return m_uMines;
  47. }
  48. inline UINT
  49. CTankObj::SetShieldLevel (UINT uShield)
  50. {
  51.     UINT uOldShield = m_uShieldLevel;
  52.     m_uShieldLevel = uShield;
  53.     return uOldShield;
  54. }
  55. inline UINT
  56. CTankObj::SetShellsCount (UINT uShells)
  57. {
  58.     UINT uOldShells = m_uShells;
  59.     m_uShells = uShells;
  60.     return uOldShells;
  61. }
  62. inline UINT
  63. CTankObj::SetBulletsCount (UINT uBullets)
  64. {
  65.     UINT uOldBullets = m_uBullets;
  66.     m_uBullets = uBullets;
  67.     return uOldBullets;
  68. }
  69. inline UINT
  70. CTankObj::SetMinesCount (UINT uMines)
  71. {
  72.     UINT uOldMines = m_uMines;
  73.     m_uMines = uMines;
  74.     return uOldMines;
  75. }
  76. inline HIMAGE 
  77. CTankObj::GetImage()
  78. {
  79.     m_GlobalImageManager.UpdateImage (*m_pCurrentImage, m_bImageChanged);
  80.     return *m_pCurrentImage;
  81. }
  82. inline GameObjectType 
  83. CTankObj::GetType()
  84. {
  85.     return TANK;
  86. }
  87. inline ObjectHeightType 
  88. CTankObj::GetHeight()
  89. {
  90.     return LOWER_LEVEL;
  91. }
  92. inline BOOL
  93. CTankObj::IsLocal ()
  94. {
  95.     return m_bLocal;
  96. }
  97. inline void
  98. CTankObj::RelinquishInput ()
  99. {
  100.     m_bUseManouverSet = FALSE;
  101. }
  102. inline CManouverSet&       
  103. CTankObj::GetManouverSet () const
  104. {
  105.     return m_ManouverSet;
  106. }
  107. inline BOOL
  108. CTankObj::IsExploding ()
  109. {
  110.     return (m_pCurrentImage == &m_hExplodedTankImage);
  111. }
  112. inline WORD                
  113. CTankObj::GetStateCheckSum()
  114. {   // Gets check sum (16 bits) of shield level, ammo level and fast fire rate
  115.     return WORD(
  116.             PackBits (WORD(m_uShieldLevel), 4)            +   // Pack shield  level to 4 bits ( 0.. 3)
  117.            (PackBits (WORD(m_uShells),      4) <<  4)     +   // Pack shells  count to 4 bits ( 4.. 7)
  118.            (PackBits (WORD(m_uBullets),     4) <<  8)     +   // Pack bullets count to 4 bits ( 8..11) 
  119.            (PackBits (WORD(m_uMines),       3) << 12)     +   // Pack mines   count to 3 bits (12..14)
  120.            (m_dwFireRateBonusLastTick ? 0x8000 : 0));   // Pack fast fire rate to a bit (15)
  121. }
  122. inline UINT
  123. CTankObj::GetDirection ()
  124. {
  125.     return m_uDirectionIndex;
  126. }
  127. inline BOOL
  128. CTankObj::IsZombie ()
  129. {
  130.     return m_bZombie;
  131. }
  132. inline void
  133. CTankObj::SetZombie (BOOL b)
  134. {
  135.     m_bZombie = b;
  136.         // Fix image to reflect zombie mode change:
  137.     m_ImageManager.SetOverlay (m_hTankImage, m_bZombie ? &m_hZombieOverlay : NULL);
  138. }
  139. inline BOOL
  140. CTankObj::GetFastFire()
  141. {
  142.     return (0 != m_dwFireRateBonusLastTick);
  143. }