cover.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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/cover.h $*
  25. * *
  26. * $Author:: Byon_g $*
  27. * *
  28. * $Modtime:: 9/12/00 5:56p $*
  29. * *
  30. * $Revision:: 6 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #ifndef COVER_H
  36. #define COVER_H
  37. #ifndef ALWAYS_H
  38. #include "always.h"
  39. #endif
  40. #ifndef MATRIX3D_H
  41. #include "matrix3d.h"
  42. #endif
  43. #ifndef VECTOR_H
  44. #include "vector.h"
  45. #endif
  46. #ifndef REFCOUNT_H
  47. #include "refcount.h"
  48. #endif
  49. class ChunkSaveClass;
  50. class ChunkLoadClass;
  51. /*
  52. **
  53. */
  54. typedef DynamicVectorClass<Vector3> AttackPositionListType;
  55. class CoverEntryClass : public RefCountClass {
  56. public:
  57. CoverEntryClass( void ) : Transform(1), Crouch( false ), InUse( false ) {}
  58. ~CoverEntryClass( void ) {}
  59. bool Save( ChunkSaveClass & csave );
  60. bool Load( ChunkLoadClass & cload );
  61. void Set_Transform( const Matrix3D & tm ) { Transform = tm; }
  62. const Matrix3D & Get_Transform( void ) { return Transform; }
  63. AttackPositionListType * Get_Attack_Position_List( void ) { return &AttackPositionList; }
  64. Vector3 Get_Attack_Position( Vector3 & enemy_pos );
  65. void Set_Crouch( bool crouch ) { Crouch = crouch; }
  66. bool Get_Crouch( void ) { return Crouch; }
  67. void Set_In_Use( bool in_use ) { InUse = in_use; }
  68. bool Get_In_Use( void ) { return InUse; }
  69. private:
  70. Matrix3D Transform;
  71. AttackPositionListType AttackPositionList;
  72. bool Crouch;
  73. bool InUse;
  74. };
  75. /*
  76. **
  77. */
  78. class CoverManager {
  79. public:
  80. static void Init( void );
  81. static void Shutdown( void );
  82. static bool Save( ChunkSaveClass & csave );
  83. static bool Load( ChunkLoadClass & cload );
  84. static void Add_Entry( CoverEntryClass * entry );
  85. static void Remove_Entry( CoverEntryClass * entry );
  86. static void Remove_All( void );
  87. static CoverEntryClass * Request_Cover( const Vector3 & cur_pos, const Vector3 & danger, float max_dist );
  88. static void Release_Cover( CoverEntryClass * entry );
  89. static bool Is_Cover_Safe( CoverEntryClass * cover, const Vector3 & danger );
  90. private:
  91. static DynamicVectorClass<CoverEntryClass *> CoverPositions;
  92. };
  93. #endif // COVER_H