waypoint.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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/waypoint.h $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 4/17/01 8:42a $*
  29. * *
  30. * $Revision:: 4 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef __WAYPOINT_H
  39. #define __WAYPOINT_H
  40. #include "persist.h"
  41. #include "vector3.h"
  42. #include "refcount.h"
  43. ////////////////////////////////////////////////////////////////
  44. // Forward declarations
  45. ////////////////////////////////////////////////////////////////
  46. class PathfindActionPortalClass;
  47. ////////////////////////////////////////////////////////////////
  48. //
  49. // WaypointClass
  50. //
  51. ////////////////////////////////////////////////////////////////
  52. class WaypointClass : public PersistClass, public RefCountClass
  53. {
  54. public:
  55. ////////////////////////////////////////////////////////////////
  56. // Public flags
  57. ////////////////////////////////////////////////////////////////
  58. typedef enum
  59. {
  60. FLAG_REQUIRES_JUMP = 0x00000001,
  61. FLAG_REQUIRES_ACTION
  62. } FLAGS;
  63. ////////////////////////////////////////////////////////////////
  64. // Public constructors/destructors
  65. ////////////////////////////////////////////////////////////////
  66. WaypointClass (void);
  67. WaypointClass (const WaypointClass &src);
  68. WaypointClass (const Vector3 &position);
  69. virtual ~WaypointClass (void);
  70. ////////////////////////////////////////////////////////////////
  71. // Public operators
  72. ////////////////////////////////////////////////////////////////
  73. const WaypointClass & operator= (const WaypointClass &src);
  74. ////////////////////////////////////////////////////////////////
  75. // Public methods
  76. ////////////////////////////////////////////////////////////////
  77. //
  78. // Identifaction methods
  79. //
  80. int Get_ID (void) const { return m_ID; }
  81. void Set_ID (int id) { m_ID = id; }
  82. //
  83. // Position methods
  84. //
  85. const Vector3 & Get_Position (void) const { return m_Position; }
  86. void Set_Position (const Vector3 &pos) { m_Position = pos; }
  87. //
  88. // Flags
  89. //
  90. int Get_Flags (void) const { return m_Flags; }
  91. void Set_Flags (int flags) { m_Flags = flags; }
  92. bool Get_Flag (int flag) { return bool((m_Flags & flag) == flag); }
  93. void Set_Flag (int flag, bool onoff);
  94. //
  95. // Action access
  96. //
  97. PathfindActionPortalClass * Get_Action_Portal (void);
  98. void Set_Action_Portal (PathfindActionPortalClass *portal);
  99. //
  100. // Serialization methods (from PersistClass)
  101. //
  102. const PersistFactoryClass & Get_Factory (void) const;
  103. bool Save (ChunkSaveClass &csave);
  104. bool Load (ChunkLoadClass &cload);
  105. protected:
  106. ////////////////////////////////////////////////////////////////
  107. // Protected methods
  108. ////////////////////////////////////////////////////////////////
  109. void Free (void) {}
  110. bool Load_Variables (ChunkLoadClass &cload);
  111. private:
  112. ////////////////////////////////////////////////////////////////
  113. // Private member data
  114. ////////////////////////////////////////////////////////////////
  115. int m_ID;
  116. Vector3 m_Position;
  117. int m_Flags;
  118. int m_ActionPortalID;
  119. };
  120. //////////////////////////////////////////////////////////////////////////////
  121. // Set_Flag
  122. //////////////////////////////////////////////////////////////////////////////
  123. inline void
  124. WaypointClass::Set_Flag (int flag, bool onoff)
  125. {
  126. m_Flags &= ~flag;
  127. if (onoff) {
  128. m_Flags |= flag;
  129. }
  130. return ;
  131. }
  132. #endif //__WAYPOINT_H