c4.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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/c4.h $*
  25. * *
  26. * $Author:: Greg_h $*
  27. * *
  28. * $Modtime:: 1/08/02 3:05p $*
  29. * *
  30. * $Revision:: 33 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #ifndef C4_H
  36. #define C4_H
  37. #ifndef ALWAYS_H
  38. #include "always.h"
  39. #endif
  40. #ifndef SIMPLEGAMEOBJ_H
  41. #include "simplegameobj.h"
  42. #endif
  43. #ifndef TIMEMGR_H
  44. #include "timemgr.h"
  45. #endif
  46. class AmmoDefinitionClass;
  47. class StaticAnimPhysClass;
  48. /*
  49. ** C4GameObjDef - Defintion class for a C4GameObj
  50. */
  51. class C4GameObjDef : public SimpleGameObjDef
  52. {
  53. public:
  54. C4GameObjDef( void );
  55. virtual uint32 Get_Class_ID( void ) const;
  56. virtual PersistClass * Create( void ) const ;
  57. virtual bool Save( ChunkSaveClass &csave );
  58. virtual bool Load( ChunkLoadClass &cload );
  59. virtual const PersistFactoryClass & Get_Factory( void ) const;
  60. DECLARE_EDITABLE( C4GameObjDef, SimpleGameObjDef );
  61. float ThrowVelocity;
  62. protected:
  63. friend class C4GameObj;
  64. };
  65. /*
  66. **
  67. */
  68. class C4GameObj : public SimpleGameObj {
  69. public:
  70. C4GameObj();
  71. virtual ~C4GameObj();
  72. // Definitions
  73. virtual void Init( void );
  74. void Init( const C4GameObjDef & definition );
  75. const C4GameObjDef & Get_Definition( void ) const ;
  76. // Save / Load / Construction Factory
  77. virtual bool Save( ChunkSaveClass & csave );
  78. virtual bool Load( ChunkLoadClass & cload );
  79. virtual const PersistFactoryClass & Get_Factory( void ) const;
  80. virtual C4GameObj * As_C4GameObj( void ) { return this; }
  81. void Init_C4( const AmmoDefinitionClass * def, SoldierGameObj *owner, int detonation_mode, const Matrix3D & tm );
  82. virtual CollisionReactionType Collision_Occurred( const CollisionEventClass & event );
  83. virtual void Think();
  84. virtual void Post_Think();
  85. virtual void Get_Information( StringClass & string );
  86. virtual void Export_Rare( BitStreamClass &packet );
  87. virtual void Import_Rare( BitStreamClass &packet );
  88. ScriptableGameObj * Get_Stuck_Object(void) { return StuckObject.Get_Ptr(); }
  89. virtual void Completely_Damaged( const OffenseObjectClass & damager );
  90. SoldierGameObj *Get_Owner( void ) const { return (SoldierGameObj *)Owner.Get_Ptr(); }
  91. void Defuse( void );
  92. static void Maintain_C4_Limit( int player_type );
  93. private:
  94. float Timer;
  95. GameObjReference Owner;
  96. void * OwnerBackup;
  97. const AmmoDefinitionClass * AmmoDefinition;
  98. int DetonationMode;
  99. bool Stuck;
  100. bool StuckToObject;
  101. GameObjReference StuckObject;
  102. Vector3 StuckOffset;
  103. int StuckBone;
  104. StaticAnimPhysClass * StuckStaticAnimObj;
  105. bool StuckMCT;
  106. float Age;
  107. void Detonate( void );
  108. void Restore_Owner( void );
  109. };
  110. #endif // C4_H