staticShape.h

Engine/source/T3D/staticShape.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 _STATICSHAPE_H_
25#define _STATICSHAPE_H_
26
27#ifndef _SHAPEBASE_H_
28#include "T3D/shapeBase.h"
29#endif
30
31//----------------------------------------------------------------------------
32
33struct StaticShapeData: public ShapeBaseData {
34   typedef ShapeBaseData Parent;
35
36  public:
37   StaticShapeData();
38
39   bool  noIndividualDamage;
40   S32   dynamicTypeField;
41   bool  isShielded;
42
43   //
44   DECLARE_CONOBJECT(StaticShapeData);
45   static void initPersistFields();
46   virtual void packData(BitStream* stream);
47   virtual void unpackData(BitStream* stream);
48};
49
50
51//----------------------------------------------------------------------------
52
53class StaticShape: public ShapeBase
54{
55   typedef ShapeBase Parent;
56
57   StaticShapeData*  mDataBlock;
58   bool              mPowered;
59
60   void onUnmount(SceneObject* obj,S32 node);
61
62protected:
63   enum MaskBits {
64      PositionMask = Parent::NextFreeMask,     
65      NextFreeMask = Parent::NextFreeMask << 1
66   };
67
68public:
69   DECLARE_CONOBJECT(StaticShape);
70
71   StaticShape();
72   ~StaticShape();
73
74   bool onAdd();
75   void onRemove();
76   bool onNewDataBlock(GameBaseData *dptr, bool reload);
77
78   void processTick(const Move *move);
79   void setTransform(const MatrixF &mat);
80
81   U32  packUpdate  (NetConnection *conn, U32 mask, BitStream *stream);
82   void unpackUpdate(NetConnection *conn,           BitStream *stream);
83
84   // power
85   void setPowered(bool power)      {mPowered = power;}
86   bool isPowered()                 {return(mPowered);}
87
88   static void initPersistFields();   
89};
90
91
92#endif
93