weaponmanager.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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/weaponmanager.h $*
  25. * *
  26. * $Author:: Byon_g $*
  27. * *
  28. * $Modtime:: 1/02/02 3:05p $*
  29. * *
  30. * $Revision:: 64 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #ifndef WEAPONMANAGER_H
  36. #define WEAPONMANAGER_H
  37. #ifndef ALWAYS_H
  38. #include "always.h"
  39. #endif
  40. #ifndef WWSTRING_H
  41. #include "wwstring.h"
  42. #endif
  43. #ifndef DEFINITION_H
  44. #include "definition.h"
  45. #endif
  46. #ifndef _DATASAFE_H
  47. #include "..\commando\datasafe.h"
  48. #endif //_DATASAFE_H
  49. class WeaponClass;
  50. /*
  51. ** Weapon Definition Structure - These describe the basic functionality of
  52. ** a weapon, and CANNOT be modified by instances
  53. */
  54. class WeaponDefinitionClass : public DefinitionClass {
  55. public:
  56. WeaponDefinitionClass( void );
  57. virtual uint32 Get_Class_ID( void ) const;
  58. virtual PersistClass * Create( void ) const { WWASSERT( 0 ); return NULL; }
  59. virtual bool Save( ChunkSaveClass &csave );
  60. virtual bool Load( ChunkLoadClass &cload );
  61. virtual const PersistFactoryClass & Get_Factory( void ) const;
  62. DECLARE_EDITABLE( WeaponDefinitionClass, DefinitionClass );
  63. bool operator == ( const WeaponDefinitionClass & vector) const { return false; }
  64. bool operator != ( const WeaponDefinitionClass & vector) const { return true; }
  65. int Style;
  66. StringClass Model;
  67. StringClass IdleAnim;
  68. StringClass FireAnim;
  69. StringClass BackModel;
  70. // int LegacyFireSoundDefID;
  71. float SwitchTime;
  72. safe_float ReloadTime;
  73. float KeyNumber;
  74. bool CanSnipe;
  75. bool CanReceiveGenericCnCAmmo;
  76. float Rating;
  77. int EjectPhysDefID;
  78. int MuzzleFlashPhysDefID;
  79. StringClass FirstPersonModel;
  80. Vector3 FirstPersonOffset;
  81. float RecoilImpulse;
  82. StringClass HUDIconTextureName;
  83. int ReloadSoundDefID;
  84. int EmptySoundDefID;
  85. int PrimaryAmmoDefID;
  86. int SecondaryAmmoDefID;
  87. safe_int ClipSize;
  88. float RecoilTime;
  89. float RecoilScale;
  90. bool AGiveWeaponsWeapon;
  91. safe_int MaxInventoryRounds;
  92. int IconNameID;
  93. StringClass IconTextureName;
  94. RectClass IconTextureUV;
  95. Vector2 IconOffset;
  96. StringClass HumanFiringAnimation;
  97. };
  98. /*
  99. **
  100. */
  101. class AmmoDefinitionClass : public DefinitionClass {
  102. public:
  103. enum {
  104. AMMO_TYPE_NORMAL,
  105. AMMO_TYPE_C4_REMOTE,
  106. AMMO_TYPE_C4_TIMED,
  107. AMMO_TYPE_C4_PROXIMITY,
  108. };
  109. AmmoDefinitionClass( void );
  110. virtual uint32 Get_Class_ID( void ) const;
  111. virtual PersistClass * Create( void ) const { WWASSERT( 0 ); return NULL; }
  112. virtual bool Save( ChunkSaveClass &csave );
  113. virtual bool Load( ChunkLoadClass &cload );
  114. virtual const PersistFactoryClass & Get_Factory( void ) const;
  115. DECLARE_EDITABLE( AmmoDefinitionClass, DefinitionClass );
  116. bool operator == ( const AmmoDefinitionClass & vector) const { return false; }
  117. bool operator != ( const AmmoDefinitionClass & vector) const { return true; }
  118. StringClass ModelFilename;
  119. StringClass ModelName;
  120. safe_int Warhead;
  121. safe_float Damage;
  122. safe_float Range;
  123. safe_float Velocity;
  124. float Gravity;
  125. float Elasticity;
  126. float RateOfFire;
  127. float SprayAngle;
  128. safe_int SprayCount;
  129. StringClass TrailEmitter;
  130. float AquireTime;
  131. float BurstDelayTime;
  132. safe_int BurstMax;
  133. int SoftPierceLimit;
  134. float TurnRate;
  135. bool TimeActivated;
  136. bool TerrainActivated;
  137. bool IsTracking;
  138. safe_float EffectiveRange;
  139. int ExplosionDefID;
  140. float RandomTrackingScale;
  141. bool DisplayLaser;
  142. safe_float ChargeTime;
  143. int ContinuousSoundDefID;
  144. int FireSoundDefID;
  145. StringClass ContinuousEmitterName;
  146. int MaxBounces;
  147. int SprayBulletCost;
  148. safe_int AmmoType;
  149. float C4TriggerTime1;
  150. float C4TriggerTime2;
  151. float C4TriggerTime3;
  152. float C4TriggerRange1;
  153. float C4TriggerRange2;
  154. float C4TriggerRange3;
  155. int C4TimingSound1ID;
  156. int C4TimingSound2ID;
  157. int C4TimingSound3ID;
  158. float AliasedSpeed;
  159. int HitterType;
  160. int BeaconDefID;
  161. bool BeamEnabled; // enable/disable usage of beam for instant bullets
  162. Vector3 BeamColor;
  163. float BeamTime; // seconds
  164. float BeamWidth; // meters
  165. bool BeamEndCaps; // put end-caps on the beam?
  166. StringClass BeamTexture; // texture filename
  167. bool BeamSubdivisionEnabled; // boolean; we use fixed subdivision count
  168. float BeamSubdivisionScale; // normalized amplitude.
  169. bool BeamSubdivisionFrozen; // animated or frozen subdivision
  170. int IconNameID;
  171. StringClass IconTextureName;
  172. RectClass IconTextureUV;
  173. Vector2 IconOffset;
  174. float GrenadeSafetyTime;
  175. };
  176. /*
  177. ** Weapon Manager
  178. */
  179. class WeaponManager {
  180. public:
  181. static const WeaponDefinitionClass *Find_Weapon_Definition( const char *name );
  182. static const WeaponDefinitionClass *Find_Weapon_Definition( int id );
  183. static const AmmoDefinitionClass *Find_Ammo_Definition( const char *ammo_name );
  184. static const AmmoDefinitionClass *Find_Ammo_Definition( int id );
  185. static bool Is_Weapon_Help_Disabled( void ) { return IsWeaponHelpDisabled; }
  186. static void Set_Weapon_Help_Disabled( bool state ) { IsWeaponHelpDisabled = state; }
  187. private:
  188. static bool IsWeaponHelpDisabled;
  189. };
  190. #endif // WEAPONMANAGER_H