cloakigc.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /*
  2. ** Copyright (C) 1996, 1997 Microsoft Corporation. All Rights Reserved.
  3. **
  4. ** File: cloakIGC.h
  5. **
  6. ** Author:
  7. **
  8. ** Description:
  9. ** Header for the CcloakIGC class. This file was initially created by
  10. ** the ATL wizard.
  11. **
  12. ** History:
  13. */
  14. // cloakIGC.h : Declaration of the CcloakIGC
  15. #ifndef __CLOAKIGC_H_
  16. #define __CLOAKIGC_H_
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CcloakIGC
  19. class CcloakIGC : public IcloakIGC
  20. {
  21. public:
  22. CcloakIGC(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_cloak;
  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_Cloak;
  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_mountID == 0);
  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_cloaking = 0.0f;
  66. assert (m_ship->GetCloaking() == 1.0f);
  67. }
  68. }
  69. virtual void Deactivate(void)
  70. {
  71. assert (m_ship);
  72. if (m_fActive)
  73. {
  74. m_ship->ChangeSignature(-m_typeData->signature);
  75. m_fActive = false;
  76. m_ship->SetCloaking(1.0f); //1.0 - m_cloaking
  77. }
  78. }
  79. virtual float GetMass(void) const
  80. {
  81. return m_typeData->mass;
  82. }
  83. virtual Money GetPrice(void) const
  84. {
  85. return m_typeData->price;
  86. }
  87. virtual float GetMountedFraction(void) const
  88. {
  89. return m_mountedFraction;
  90. }
  91. virtual void SetMountedFraction(float f)
  92. {
  93. m_mountedFraction = f;
  94. }
  95. virtual void Arm(void)
  96. {
  97. m_mountedFraction = 1.0f;
  98. }
  99. // IcloakIGC
  100. virtual float GetEnergyConsumption(void) const
  101. {
  102. return m_typeData->energyConsumption;
  103. }
  104. virtual float GetMaxCloaking(void) const
  105. {
  106. return m_typeData->maxCloaking;
  107. /*
  108. return m_ship
  109. ? (m_typeData->rateRegen * m_ship->GetSide()->GetGlobalAttributeSet().GetAttribute(c_gaRegenerationShield))
  110. : m_typeData->rateRegen;
  111. */
  112. }
  113. virtual float GetOnRate(void) const
  114. {
  115. return m_typeData->onRate;
  116. }
  117. virtual float GetOffRate(void) const
  118. {
  119. return m_typeData->offRate;
  120. }
  121. virtual SoundID GetEngageSound() const
  122. {
  123. return m_typeData->engageSound;
  124. }
  125. virtual SoundID GetDisengageSound() const
  126. {
  127. return m_typeData->disengageSound;
  128. }
  129. private:
  130. const DataCloakTypeIGC* m_typeData;
  131. IpartTypeIGC* m_partType;
  132. IshipIGC* m_ship;
  133. ImissionIGC* m_pMission;
  134. float m_cloaking;
  135. float m_mountedFraction;
  136. Mount m_mountID;
  137. bool m_fActive;
  138. };
  139. #endif //__CLOAKIGC_H_