sakurabossgameobj.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  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. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Combat *
  23. * *
  24. * $Archive:: /Commando/Code/Combat/sakurabossgameobj.h $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 10/26/01 10:36a $*
  29. * *
  30. * $Revision:: 18 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef __SAKURABOSS_GAMEOBJ_H
  39. #define __SAKURABOSS_GAMEOBJ_H
  40. #include "vehicle.h"
  41. #include "damage.h"
  42. #include "pilot.h"
  43. #include "path.h"
  44. ////////////////////////////////////////////////////////////////
  45. // Forward declarations
  46. ////////////////////////////////////////////////////////////////
  47. ////////////////////////////////////////////////////////////////
  48. //
  49. // SakuraBossGameObjDef
  50. //
  51. ////////////////////////////////////////////////////////////////
  52. class SakuraBossGameObjDef : public VehicleGameObjDef
  53. {
  54. public:
  55. DECLARE_EDITABLE (SakuraBossGameObjDef, VehicleGameObjDef);
  56. ////////////////////////////////////////////////////////////////
  57. // Public constructors/destructors
  58. ////////////////////////////////////////////////////////////////
  59. SakuraBossGameObjDef (void);
  60. ~SakuraBossGameObjDef (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. protected:
  70. ////////////////////////////////////////////////////////////////
  71. // Protected methods
  72. ////////////////////////////////////////////////////////////////
  73. void Save_Variables (ChunkSaveClass &csave);
  74. void Load_Variables (ChunkLoadClass &cload);
  75. ////////////////////////////////////////////////////////////////
  76. // Protected member data
  77. ////////////////////////////////////////////////////////////////
  78. DefenseObjectDefClass RocketsDefense;
  79. int GattlingGunDefID;
  80. int RocketLauncherDefID;
  81. int GattlingGunRevSoundDefID;
  82. int RocketDestroyedExplosionID;
  83. int RocketDoorOpenSoundID;
  84. ////////////////////////////////////////////////////////////////
  85. // Friends
  86. ////////////////////////////////////////////////////////////////
  87. friend class SakuraBossGameObj;
  88. };
  89. ////////////////////////////////////////////////////////////////
  90. //
  91. // SakuraBossGameObj
  92. //
  93. ////////////////////////////////////////////////////////////////
  94. class SakuraBossGameObj : public VehicleGameObj
  95. {
  96. public:
  97. ////////////////////////////////////////////////////////////////
  98. // Public constructors/destructors
  99. ////////////////////////////////////////////////////////////////
  100. SakuraBossGameObj (void);
  101. ~SakuraBossGameObj (void);
  102. ////////////////////////////////////////////////////////////////
  103. // Public methods
  104. ////////////////////////////////////////////////////////////////
  105. //
  106. // Definitions
  107. //
  108. virtual void Init( void );
  109. void Init (const SakuraBossGameObjDef &definition);
  110. const SakuraBossGameObjDef & Get_Definition (void) const;
  111. //
  112. // From save/load
  113. //
  114. bool Save (ChunkSaveClass & csave);
  115. bool Load (ChunkLoadClass & cload);
  116. void On_Post_Load (void);
  117. const PersistFactoryClass & Get_Factory (void) const;
  118. //
  119. // Think
  120. //
  121. void Think (void);
  122. void Apply_Control (void);
  123. //
  124. // Muzzle override
  125. //
  126. const Matrix3D & Get_Muzzle (int index = 0);
  127. //
  128. // Damage
  129. //
  130. virtual void Apply_Damage_Extended( const OffenseObjectClass & offense,
  131. float scale = 1.0f,
  132. const Vector3 & direction = Vector3( 0,0,0 ),
  133. const char * collision_box_name = NULL );
  134. //
  135. // Occupant control
  136. //
  137. bool Is_Entry_Permitted (SoldierGameObj * /*p_soldier*/) { return false; }
  138. //
  139. // Network support
  140. //
  141. //void Import_Frequent (BitStreamClass &packet);
  142. //void Export_Frequent (BitStreamClass &packet);
  143. protected:
  144. ////////////////////////////////////////////////////////////////
  145. // Protected methods
  146. ////////////////////////////////////////////////////////////////
  147. void Save_Variables (ChunkSaveClass &csave);
  148. void Load_Variables (ChunkLoadClass &cload);
  149. void Blow_Off_Weapon (int weapon_id);
  150. void Open_Rocket_Launchers (bool onoff);
  151. bool Are_Rocker_Launchers_Ready (void);
  152. //
  153. // Rocket launcher state management
  154. //
  155. void Set_Rocket_State (int new_state);
  156. void Update_Rocket_State (void);
  157. //
  158. // Gatling gun state management
  159. //
  160. void Set_Gattling_Gun_State (int new_state);
  161. void Update_Gattling_Gun_State (void);
  162. //
  163. // Sakura state management
  164. //
  165. void Set_Sakura_State (int new_state);
  166. void Update_Sakura_State (void);
  167. //
  168. // Vehicle state management
  169. //
  170. void Set_Vehicle_State (int new_state);
  171. void Update_Vehicle_State (void);
  172. //
  173. // Overall state management
  174. //
  175. void Set_Overall_State (int new_state);
  176. void Decide_New_Overall_State (void);
  177. bool Should_Change_Overall_State (void);
  178. void Update_Overall_State (void);
  179. void Request_Overall_State (int new_state);
  180. void Update_Decision_Data (void);
  181. //
  182. // Attack control
  183. //
  184. void Attack_Target (float rocket_priority, float gattling_priority);
  185. void Stop_Attacking (void);
  186. //
  187. // Target management
  188. //
  189. void Update_Target (void);
  190. SoldierGameObj * Find_Closest_Human_Player (void);
  191. //
  192. // Movement helper functions
  193. //
  194. void Move_To_Location (const Vector3 &pos, float speed = 0.75F);
  195. void Do_Waypath (int waypath_id, int start_id = -1, int end_id = -1);
  196. //
  197. // Taunt control
  198. //
  199. void Shuffle_Taunt_List (void);
  200. //
  201. // Tilt control
  202. //
  203. void Update_Tilt (void);
  204. private:
  205. ////////////////////////////////////////////////////////////////
  206. // Private constants
  207. ////////////////////////////////////////////////////////////////
  208. enum
  209. {
  210. MAX_TAUNTS = 6
  211. };
  212. ////////////////////////////////////////////////////////////////
  213. // Private member data
  214. ////////////////////////////////////////////////////////////////
  215. int AvailableWeapons;
  216. int OverallState;
  217. int NextOverallState;
  218. bool FaceTargetInTransition;
  219. int RocketLauncherState;
  220. int GattlingGunState;
  221. int SakuraState;
  222. int VehicleState;
  223. DefenseObjectClass LeftRocketDefenseObject;
  224. DefenseObjectClass RightRocketDefenseObject;
  225. GameObjReference LastDamager;
  226. GameObjReference CurrentTarget;
  227. Vector3 MoveToLocation;
  228. float GattlingGunStateTimeLeft;
  229. float SakuraTauntTimeLeft;
  230. float RocketLauncherStateTimeLeft;
  231. float OverallStateTimeLeft;
  232. float TargetTimeLeft;
  233. //
  234. // Decision information
  235. //
  236. float CurrentHealth;
  237. float TargetAngle;
  238. Vector3 TargetPos;
  239. bool IsAttacking;
  240. WeaponClass * GattlingGun;
  241. WeaponClass * RockerLauncherLeft;
  242. WeaponClass * RockerLauncherRight;
  243. Matrix3D CurrentMuzzleTM;
  244. int CurrentMuzzleIndex;
  245. PilotClass Pilot;
  246. PathClass * Path;
  247. int TauntList[MAX_TAUNTS];
  248. int AvailableTaunts;
  249. float TiltAngle;
  250. int ChopperTiltBoneIndex;
  251. };
  252. #endif //__SAKURABOSS_GAMEOBJ_H