Torque3D Documentation / _generateds / missionMarker.h

missionMarker.h

Engine/source/T3D/missionMarker.h

More...

Classes:

Detailed Description

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