pathaction.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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/pathaction.h $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 11/16/01 3:26p $*
  29. * *
  30. * $Revision:: 7 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef __PATHACTION_H
  39. #define __PATHACTION_H
  40. #include "elevator.h"
  41. #include "vector3.h"
  42. ////////////////////////////////////////////////////////////////////////////////////////////
  43. // Forward declarations
  44. ////////////////////////////////////////////////////////////////////////////////////////////
  45. class SmartGameObj;
  46. class PathClass;
  47. class ChunkSaveClass;
  48. class ChunkLoadClass;
  49. ////////////////////////////////////////////////////////////////////////////////////////////
  50. //
  51. // PathActionClass
  52. //
  53. ////////////////////////////////////////////////////////////////////////////////////////////
  54. class PathActionClass
  55. {
  56. public:
  57. ////////////////////////////////////////////////////////////////
  58. // Public constants
  59. ////////////////////////////////////////////////////////////////
  60. typedef enum
  61. {
  62. STATE_FINISHED = 0,
  63. STATE_WAITING,
  64. STATE_MOVING
  65. } STATE;
  66. typedef enum
  67. {
  68. TYPE_UNKNOWN = 0,
  69. TYPE_JUMPING,
  70. TYPE_ELEVATOR,
  71. TYPE_DOOR,
  72. TYPE_LADDER
  73. } TYPE;
  74. ////////////////////////////////////////////////////////////////
  75. // Public constructors/destructors
  76. ////////////////////////////////////////////////////////////////
  77. PathActionClass (void);
  78. ~PathActionClass (void);
  79. ////////////////////////////////////////////////////////////////
  80. // Public methods
  81. ////////////////////////////////////////////////////////////////
  82. //
  83. // Configuration
  84. //
  85. void Initialize (TYPE type, PathClass *path, SmartGameObj *game_obj, StaticPhysClass *mechanism = NULL);
  86. void Set_Ladder_Index (int index) { LadderIndex = index; }
  87. void Reset (void);
  88. //
  89. // Run-time interface
  90. //
  91. bool Process (void);
  92. STATE Get_State (void) const { return State; }
  93. const Vector3 &Get_Destination (void) const { return Destination; }
  94. //
  95. // Save/Load support
  96. //
  97. void Save (ChunkSaveClass &csave);
  98. void Load (ChunkLoadClass &cload);
  99. //
  100. // Ladder occupant access
  101. //
  102. static ScriptableGameObj * Get_Ladder_Occupant (int ladder_index);
  103. static void Set_Ladder_Occupant (int ladder_index, ScriptableGameObj *object);
  104. private:
  105. ////////////////////////////////////////////////////////////////
  106. // Private methods
  107. ////////////////////////////////////////////////////////////////
  108. void Handle_Jump (void);
  109. void Handle_Ladder (void);
  110. void Handle_Door (void);
  111. void Handle_Elevator (void);
  112. bool Has_Arrived (void);
  113. void Get_Elevator_Zone_Pos (ELEVATOR_ZONE zone_id, Vector3 *position);
  114. void Load_Variables (ChunkLoadClass &cload);
  115. void Set_Finished (void);
  116. ////////////////////////////////////////////////////////////////
  117. // Private constants
  118. ////////////////////////////////////////////////////////////////
  119. typedef enum
  120. {
  121. ELEVATOR_STATE_NONE = 0,
  122. ELEVATOR_STATE_WAITING,
  123. ELEVATOR_STATE_RIDING,
  124. ELEVATOR_STATE_ENTERING,
  125. ELEVATOR_STATE_EXITING,
  126. } ELEVATOR_STATE;
  127. typedef enum
  128. {
  129. DOOR_STATE_NONE = 0,
  130. DOOR_STATE_GETTING_IN_POSITION,
  131. DOOR_STATE_WAITING,
  132. DOOR_STATE_ENTERING
  133. } DOOR_STATE;
  134. typedef enum
  135. {
  136. LADDER_STATE_NONE = 0,
  137. LADDER_STATE_WAITING,
  138. LADDER_STATE_GETTING_ON,
  139. LADDER_STATE_CLIMBING
  140. } LADDER_STATE;
  141. ////////////////////////////////////////////////////////////////
  142. // Private member data
  143. ////////////////////////////////////////////////////////////////
  144. ELEVATOR_STATE ElevatorState;
  145. DOOR_STATE DoorState;
  146. LADDER_STATE LadderState;
  147. STATE State;
  148. TYPE Type;
  149. PathClass * Path;
  150. StaticPhysClass * Mechanism;
  151. SmartGameObj * GameObj;
  152. Vector3 Destination;
  153. Vector3 FacePos;
  154. float Timer;
  155. int LadderIndex;
  156. static DynamicVectorClass<GameObjReference> LadderList;
  157. };
  158. #endif //__PATHACTION_H