refinerygameobj.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***********************************************************************************************
  19. *** Confidential - Westwood Studios ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Commando *
  23. * *
  24. * $Archive:: /Commando/Code/Combat/refinerygameobj.h $*
  25. * *
  26. * $Author:: Greg_h $*
  27. * *
  28. * $Modtime:: 1/18/02 11:17p $*
  29. * *
  30. * $Revision:: 10 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef __REFINERYGAMEOBJ_H
  39. #define __REFINERYGAMEOBJ_H
  40. #include "always.h"
  41. #include "building.h"
  42. ////////////////////////////////////////////////////////////////
  43. // Forward delcarations
  44. ////////////////////////////////////////////////////////////////
  45. class HarvesterClass;
  46. class BaseControllerClass;
  47. class VehicleGameObj;
  48. ////////////////////////////////////////////////////////////////
  49. //
  50. // RefineryGameObjDef
  51. //
  52. ////////////////////////////////////////////////////////////////
  53. class RefineryGameObjDef : public BuildingGameObjDef
  54. {
  55. public:
  56. ////////////////////////////////////////////////////////////////
  57. // Public constructors/destructors
  58. ////////////////////////////////////////////////////////////////
  59. RefineryGameObjDef (void);
  60. ~RefineryGameObjDef (void);
  61. ////////////////////////////////////////////////////////////////
  62. // Public methods
  63. ////////////////////////////////////////////////////////////////
  64. uint32 Get_Class_ID (void) const;
  65. PersistClass * Create (void) const;
  66. bool Save (ChunkSaveClass &csave);
  67. bool Load (ChunkLoadClass &cload);
  68. const PersistFactoryClass & Get_Factory (void) const;
  69. ////////////////////////////////////////////////////////////////
  70. // Editable support
  71. ////////////////////////////////////////////////////////////////
  72. DECLARE_EDITABLE (RefineryGameObjDef, BuildingGameObjDef);
  73. protected:
  74. ////////////////////////////////////////////////////////////////
  75. // Protected methods
  76. ////////////////////////////////////////////////////////////////
  77. void Load_Variables (ChunkLoadClass &cload);
  78. ////////////////////////////////////////////////////////////////
  79. // Protected member data
  80. ////////////////////////////////////////////////////////////////
  81. float UnloadTime;
  82. float FundsGathered;
  83. float FundsDistributedPerSec;
  84. int HarvesterDefID;
  85. ////////////////////////////////////////////////////////////////
  86. // Friends
  87. ////////////////////////////////////////////////////////////////
  88. friend class RefineryGameObj;
  89. };
  90. ////////////////////////////////////////////////////////////////
  91. //
  92. // RefineryGameObj
  93. //
  94. ////////////////////////////////////////////////////////////////
  95. class RefineryGameObj : public BuildingGameObj
  96. {
  97. public:
  98. ////////////////////////////////////////////////////////////////
  99. // Public constructors/destructors
  100. ////////////////////////////////////////////////////////////////
  101. RefineryGameObj (void);
  102. ~RefineryGameObj (void);
  103. ////////////////////////////////////////////////////////////////
  104. // Public methods
  105. ////////////////////////////////////////////////////////////////
  106. //
  107. // Definition support
  108. //
  109. virtual void Init( void );
  110. void Init (const RefineryGameObjDef & definition);
  111. const RefineryGameObjDef & Get_Definition (void) const;
  112. //
  113. // RTTI
  114. //
  115. RefineryGameObj * As_RefineryGameObj (void) { return this; }
  116. //
  117. // Persist support
  118. //
  119. bool Save (ChunkSaveClass &csave);
  120. bool Load (ChunkLoadClass &cload);
  121. const PersistFactoryClass & Get_Factory (void) const;
  122. //
  123. // From BuildingGameObj
  124. //
  125. void CnC_Initialize (BaseControllerClass *base);
  126. void On_Destroyed (void);
  127. //
  128. // GameObj methods
  129. //
  130. void Think (void);
  131. void Manage_Money_Trickle_Sound (void);
  132. //
  133. // State access
  134. //
  135. bool Needs_Harvester (void) const { return (!IsDestroyed) && (Harvester == NULL); }
  136. int Get_Harvester_Def_ID (void) const { return Get_Definition ().HarvesterDefID; }
  137. void Set_Is_Harvester_Docked(bool flag);
  138. bool Get_Is_Harvester_Docked(void) { return IsHarvesterDocked; }
  139. //
  140. // Harvester access
  141. //
  142. VehicleGameObj * Get_Harvester_Vehicle (void);
  143. void Set_Harvester_Vehicle (VehicleGameObj *harvester);
  144. HarvesterClass * Get_Harvester (void) { return Harvester; }
  145. void Set_Harvester (HarvesterClass *harvester) { Harvester = harvester; }
  146. //
  147. // Notifications
  148. //
  149. void On_Harvester_Docked (void);
  150. void On_Harvester_Damaged(VehicleGameObj*);
  151. void On_Harvester_Destroyed(VehicleGameObj*);
  152. //
  153. // Door access
  154. //
  155. void Play_Unloading_Animation (bool onoff);
  156. //
  157. // Dockin access
  158. //
  159. const Matrix3D & Get_Dock_TM (void) const { return DockTM; }
  160. void Set_Dock_TM (const Matrix3D &tm) { DockTM = tm; }
  161. //
  162. // Network support
  163. //
  164. virtual void Export_Rare (BitStreamClass &packet);
  165. virtual void Import_Rare (BitStreamClass &packet);
  166. private:
  167. ////////////////////////////////////////////////////////////////
  168. // Private methods
  169. ////////////////////////////////////////////////////////////////
  170. void Load_Variables (ChunkLoadClass &cload);
  171. ////////////////////////////////////////////////////////////////
  172. // Private constants
  173. ////////////////////////////////////////////////////////////////
  174. ////////////////////////////////////////////////////////////////
  175. // Private member data
  176. ////////////////////////////////////////////////////////////////
  177. HarvesterClass * Harvester;
  178. OBBoxClass TiberiumField;
  179. bool IsHarvesterDocked;
  180. float UnloadTimer;
  181. int UnloadAnimationID;
  182. float TotalFunds;
  183. float FundsPerSecond;
  184. float DistributionTimer;
  185. Matrix3D DockTM;
  186. AudibleSoundClass * MoneyTrickleSound;
  187. };
  188. #endif // __REFINERYGAMEOBJ_H