missionMarker.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #ifndef _MISSIONMARKER_H_
  23. #define _MISSIONMARKER_H_
  24. #ifndef _BITSTREAM_H_
  25. #include "core/stream/bitStream.h"
  26. #endif
  27. #ifndef _SIMBASE_H_
  28. #include "console/simBase.h"
  29. #endif
  30. #ifndef _SHAPEBASE_H_
  31. #include "T3D/shapeBase.h"
  32. #endif
  33. #ifndef _MATHIO_H_
  34. #include "math/mathIO.h"
  35. #endif
  36. #ifndef _COLOR_H_
  37. #include "core/color.h"
  38. #endif
  39. class MissionMarkerData : public ShapeBaseData
  40. {
  41. private:
  42. typedef ShapeBaseData Parent;
  43. public:
  44. DECLARE_CONOBJECT(MissionMarkerData);
  45. };
  46. //------------------------------------------------------------------------------
  47. // Class: MissionMarker
  48. //------------------------------------------------------------------------------
  49. class MissionMarker : public ShapeBase
  50. {
  51. private:
  52. typedef ShapeBase Parent;
  53. protected:
  54. enum MaskBits {
  55. PositionMask = Parent::NextFreeMask,
  56. NextFreeMask = Parent::NextFreeMask << 1
  57. };
  58. MissionMarkerData * mDataBlock;
  59. bool mAddedToScene;
  60. public:
  61. MissionMarker();
  62. // GameBase
  63. bool onNewDataBlock( GameBaseData *dptr, bool reload );
  64. // SceneObject
  65. void setTransform(const MatrixF &mat);
  66. // SimObject
  67. bool onAdd();
  68. void onRemove();
  69. void onEditorEnable();
  70. void onEditorDisable();
  71. void inspectPostApply();
  72. // NetObject
  73. U32 packUpdate (NetConnection *conn, U32 mask, BitStream *stream);
  74. void unpackUpdate(NetConnection *conn, BitStream *stream);
  75. DECLARE_CONOBJECT(MissionMarker);
  76. static void initPersistFields();
  77. };
  78. //------------------------------------------------------------------------------
  79. // Class: WayPoint
  80. //------------------------------------------------------------------------------
  81. class WayPoint;
  82. class WayPointTeam
  83. {
  84. public:
  85. WayPointTeam();
  86. S32 mTeamId;
  87. WayPoint * mWayPoint;
  88. };
  89. DECLARE_STRUCT( WayPointTeam );
  90. DefineConsoleType( TypeWayPointTeam, WayPointTeam * );
  91. class WayPoint : public MissionMarker
  92. {
  93. private:
  94. typedef MissionMarker Parent;
  95. public:
  96. enum WayPointMasks {
  97. UpdateNameMask = Parent::NextFreeMask,
  98. UpdateTeamMask = Parent::NextFreeMask << 1,
  99. UpdateHiddenMask = Parent::NextFreeMask << 2,
  100. NextFreeMask = Parent::NextFreeMask << 3
  101. };
  102. WayPoint();
  103. // ShapeBase: only ever added to scene if in the editor
  104. void setHidden(bool hidden);
  105. // SimObject
  106. bool onAdd();
  107. void inspectPostApply();
  108. // NetObject
  109. U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream);
  110. void unpackUpdate(NetConnection *conn, BitStream *stream);
  111. // field data
  112. StringTableEntry mName;
  113. WayPointTeam mTeam;
  114. static void initPersistFields();
  115. DECLARE_CONOBJECT(WayPoint);
  116. };
  117. //------------------------------------------------------------------------------
  118. // Class: SpawnSphere
  119. //------------------------------------------------------------------------------
  120. class SpawnSphere : public MissionMarker
  121. {
  122. private:
  123. typedef MissionMarker Parent;
  124. public:
  125. SpawnSphere();
  126. // SimObject
  127. bool onAdd();
  128. void inspectPostApply();
  129. // NetObject
  130. enum SpawnSphereMasks
  131. {
  132. UpdateSphereMask = Parent::NextFreeMask,
  133. NextFreeMask = Parent::NextFreeMask << 1
  134. };
  135. U32 packUpdate (NetConnection *conn, U32 mask, BitStream *stream);
  136. void unpackUpdate(NetConnection *conn, BitStream *stream);
  137. // ProcessObject
  138. void advanceTime( F32 timeDelta );
  139. void processTick( const Move *move );
  140. // Spawn info
  141. String mSpawnClass;
  142. String mSpawnDataBlock;
  143. String mSpawnName;
  144. String mSpawnProperties;
  145. String mSpawnScript;
  146. bool mAutoSpawn;
  147. bool mSpawnTransform;
  148. // Radius/weight info
  149. F32 mRadius;
  150. F32 mSphereWeight;
  151. F32 mIndoorWeight;
  152. F32 mOutdoorWeight;
  153. SimObject* spawnObject(String additionalProps = String::EmptyString);
  154. static void initPersistFields();
  155. DECLARE_CONOBJECT(SpawnSphere);
  156. DECLARE_CALLBACK( void, onAdd, ( U32 objectId ) );
  157. };
  158. //------------------------------------------------------------------------------
  159. // Class: CameraBookmark
  160. //------------------------------------------------------------------------------
  161. class CameraBookmark : public MissionMarker
  162. {
  163. private:
  164. typedef MissionMarker Parent;
  165. public:
  166. enum WayPointMasks {
  167. UpdateNameMask = Parent::NextFreeMask,
  168. NextFreeMask = Parent::NextFreeMask << 1
  169. };
  170. CameraBookmark();
  171. // SimObject
  172. virtual bool onAdd();
  173. virtual void onRemove();
  174. virtual void onGroupAdd();
  175. virtual void onGroupRemove();
  176. void inspectPostApply();
  177. // NetObject
  178. U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream);
  179. void unpackUpdate(NetConnection *conn, BitStream *stream);
  180. // field data
  181. StringTableEntry mName;
  182. static void initPersistFields();
  183. DECLARE_CONOBJECT(CameraBookmark);
  184. /*DECLARE_CALLBACK( void, onAdd, () );
  185. DECLARE_CALLBACK( void, onRemove, () );
  186. DECLARE_CALLBACK( void, onGroupAdd, () );
  187. DECLARE_CALLBACK( void, onGroupRemove, () );
  188. DECLARE_CALLBACK( void, onInspectPostApply, () );*/
  189. };
  190. #endif // _MISSIONMARKER_H_