afterburnerIGC.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /*
  2. ** Copyright (C) 1996, 1997 Microsoft Corporation. All Rights Reserved.
  3. **
  4. ** File: afterburnerIGC.h
  5. **
  6. ** Author:
  7. **
  8. ** Description:
  9. ** Header for the CafterburnerIGC class. This file was initially created by
  10. ** the ATL wizard.
  11. **
  12. ** History:
  13. */
  14. // afterburnerIGC.h : Declaration of the CafterburnerIGC
  15. #ifndef __AFTERBURNERIGC_H_
  16. #define __AFTERBURNERIGC_H_
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CafterburnerIGC
  19. class CafterburnerIGC : public IafterburnerIGC
  20. {
  21. public:
  22. CafterburnerIGC(void);
  23. // IbaseIGC
  24. virtual HRESULT Initialize(ImissionIGC* pMission, Time now, const void* data, int dataSize);
  25. virtual void Terminate(void);
  26. virtual void Update(Time now);
  27. virtual ObjectType GetObjectType(void) const
  28. {
  29. return OT_afterburner;
  30. }
  31. virtual ImissionIGC* GetMission(void) const
  32. {
  33. return m_pMission;
  34. }
  35. // IpartIGC
  36. virtual EquipmentType GetEquipmentType(void) const
  37. {
  38. return ET_Afterburner;
  39. }
  40. virtual IpartTypeIGC* GetPartType(void) const
  41. {
  42. return m_partType;
  43. }
  44. virtual IshipIGC* GetShip(void) const
  45. {
  46. return m_ship;
  47. }
  48. virtual void SetShip(IshipIGC* newVal, Mount mount);
  49. virtual Mount GetMountID(void) const
  50. {
  51. return m_mountID;
  52. }
  53. virtual void SetMountID(Mount newVal);
  54. virtual bool fActive(void) const
  55. {
  56. return m_fActive;
  57. }
  58. virtual void Activate(void)
  59. {
  60. assert (m_ship);
  61. if (!m_fActive)
  62. {
  63. m_ship->ChangeSignature(m_typeData->signature);
  64. m_fActive = true;
  65. m_power = 0.0f;
  66. }
  67. }
  68. virtual void Deactivate(void)
  69. {
  70. assert (m_ship);
  71. if (m_fActive)
  72. {
  73. m_ship->ChangeSignature(-m_typeData->signature);
  74. m_fActive = false;
  75. m_power = 0.0f;
  76. }
  77. }
  78. virtual void Reset()
  79. {
  80. }
  81. virtual float GetMass(void) const
  82. {
  83. return m_typeData->mass;
  84. }
  85. virtual Money GetPrice(void) const
  86. {
  87. return m_typeData->price;
  88. }
  89. // IafterburnerIGC
  90. virtual float GetFuelConsumption(void) const
  91. {
  92. return m_typeData->fuelConsumption;
  93. }
  94. virtual float GetMaxThrust(void) const
  95. {
  96. return m_typeData->maxThrust;
  97. }
  98. virtual float GetOnRate(void) const
  99. {
  100. return m_typeData->onRate;
  101. }
  102. virtual float GetOffRate(void) const
  103. {
  104. return m_typeData->offRate;
  105. }
  106. virtual float GetPower(void) const
  107. {
  108. return m_power;
  109. }
  110. virtual void SetPower(float p)
  111. {
  112. assert (p >= 0.0f);
  113. assert (p <= 1.0f);
  114. if (p != 0.0f)
  115. Activate();
  116. m_power = p;
  117. }
  118. virtual void IncrementalUpdate(Time lastUpdate, Time now, bool bUseFuel);
  119. virtual SoundID GetInteriorSound(void) const
  120. {
  121. return m_typeData->interiorSound;
  122. }
  123. virtual SoundID GetExteriorSound(void) const
  124. {
  125. return m_typeData->exteriorSound;
  126. }
  127. virtual float GetMountedFraction(void) const
  128. {
  129. return m_mountedFraction;
  130. }
  131. virtual void SetMountedFraction(float f)
  132. {
  133. m_mountedFraction = f;
  134. if (f != 1.0f)
  135. Deactivate();
  136. }
  137. virtual void Arm(void)
  138. {
  139. m_mountedFraction = 1.0f;
  140. }
  141. private:
  142. ImissionIGC* m_pMission;
  143. const DataAfterburnerTypeIGC* m_typeData;
  144. IpartTypeIGC* m_partType;
  145. IshipIGC* m_ship;
  146. float m_power;
  147. float m_mountedFraction;
  148. Mount m_mountID;
  149. bool m_fActive;
  150. };
  151. #endif //__AFTERBURNERIGC_H_