PathObject.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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 : LevelEdit *
  23. * *
  24. * $Archive:: /Commando/Code/wwphys/PathObject.h $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 10/31/00 2:31p $*
  29. * *
  30. * $Revision:: 5 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef __PATH_OBJECT_H
  39. #define __PATH_OBJECT_H
  40. #include "aabox.h"
  41. #include "obbox.h"
  42. // Forward declarations
  43. class PhysClass;
  44. ///////////////////////////////////////////////////////////////////////////
  45. //
  46. // PathObjectClass
  47. //
  48. ///////////////////////////////////////////////////////////////////////////
  49. class PathObjectClass
  50. {
  51. public:
  52. //////////////////////////////////////////////////////////////////
  53. // Public constructors/destructors
  54. //////////////////////////////////////////////////////////////////
  55. PathObjectClass (void);
  56. ~PathObjectClass (void);
  57. //////////////////////////////////////////////////////////////////
  58. // Public data types
  59. //////////////////////////////////////////////////////////////////
  60. typedef enum
  61. {
  62. CAN_BACKUP = 1,
  63. CAN_BOX_ROTATE = 2,
  64. CAN_USE_EQUIPMENT = 4,
  65. IS_VEHICLE = 8
  66. } Flags;
  67. //////////////////////////////////////////////////////////////////
  68. // Public methods
  69. //////////////////////////////////////////////////////////////////
  70. void Initialize (PhysClass &phys_obj);
  71. void Init_Human (void);
  72. void Set_Turn_Radius (float radius);
  73. float Get_Turn_Radius (void) const;
  74. void Set_Wheel_Offset (float offset);
  75. float Get_Wheel_Offset (void) const;
  76. void Set_Max_Speed (float speed);
  77. float Get_Max_Speed (void) const;
  78. void Set_Collision_Box (const OBBoxClass &box);
  79. void Get_Collision_Box (OBBoxClass &box) const;
  80. void Get_Collision_Box (AABoxClass &box) const;
  81. float Get_Width (void) const;
  82. void Set_Flags (int flag_mask);
  83. int Get_Flags (void) const;
  84. bool Is_Flag_Set (Flags flag) const;
  85. void Set_Flag (Flags flag, bool onoff);
  86. int Get_Key_Ring (void) const { return m_KeyRing; }
  87. void Set_Key_Ring (int keys) { m_KeyRing = keys; }
  88. private:
  89. //////////////////////////////////////////////////////////////////
  90. // Private member data
  91. //////////////////////////////////////////////////////////////////
  92. float m_TurnRadius;
  93. float m_MaxSpeed;
  94. float m_WheelOffset;
  95. OBBoxClass m_CollisionBox;
  96. int m_Flags;
  97. int m_KeyRing;
  98. };
  99. //////////////////////////////////////////////////////////////////
  100. // Inlines
  101. //////////////////////////////////////////////////////////////////
  102. inline void PathObjectClass::Set_Flags (int flag_mask)
  103. {
  104. m_Flags = flag_mask;
  105. return ;
  106. }
  107. inline int PathObjectClass::Get_Flags (void) const
  108. {
  109. return m_Flags;
  110. }
  111. inline bool PathObjectClass::Is_Flag_Set (Flags flag) const
  112. {
  113. return bool((m_Flags & flag) == flag);
  114. }
  115. inline void PathObjectClass::Set_Flag (Flags flag, bool onoff)
  116. {
  117. if (onoff) {
  118. m_Flags |= flag;
  119. } else {
  120. m_Flags &= (~flag);
  121. }
  122. return ;
  123. }
  124. inline void PathObjectClass::Set_Max_Speed (float speed)
  125. {
  126. m_MaxSpeed = speed;
  127. return ;
  128. }
  129. inline float PathObjectClass::Get_Max_Speed (void) const
  130. {
  131. return m_MaxSpeed;
  132. }
  133. inline void PathObjectClass::Set_Turn_Radius (float radius)
  134. {
  135. m_TurnRadius = radius;
  136. return ;
  137. }
  138. inline float PathObjectClass::Get_Turn_Radius (void) const
  139. {
  140. return m_TurnRadius;
  141. }
  142. inline void PathObjectClass::Set_Wheel_Offset (float offset)
  143. {
  144. m_WheelOffset = offset;
  145. return ;
  146. }
  147. inline float PathObjectClass::Get_Wheel_Offset (void) const
  148. {
  149. return m_WheelOffset;
  150. }
  151. inline void PathObjectClass::Set_Collision_Box (const OBBoxClass &box)
  152. {
  153. m_CollisionBox = box;
  154. return ;
  155. }
  156. inline void PathObjectClass::Get_Collision_Box (OBBoxClass &box) const
  157. {
  158. box = m_CollisionBox;
  159. return ;
  160. }
  161. inline void PathObjectClass::Get_Collision_Box (AABoxClass &box) const
  162. {
  163. box.Center = m_CollisionBox.Center;
  164. box.Extent = m_CollisionBox.Extent;
  165. return ;
  166. }
  167. inline float PathObjectClass::Get_Width (void) const
  168. {
  169. return m_CollisionBox.Extent.Y;
  170. }
  171. #endif //__PATH_OBJECT_H