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//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 25// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
 26// Copyright (C) 2015 Faust Logic, Inc.
 27//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 28
 29#ifndef _STATICSHAPE_H_
 30#define _STATICSHAPE_H_
 31
 32#ifndef _SHAPEBASE_H_
 33#include "T3D/shapeBase.h"
 34#endif
 35
 36//----------------------------------------------------------------------------
 37
 38struct StaticShapeData: public ShapeBaseData {
 39   typedef ShapeBaseData Parent;
 40
 41  public:
 42   StaticShapeData();
 43
 44   bool  noIndividualDamage;
 45   S32   dynamicTypeField;
 46   bool  isShielded;
 47   F32   energyPerDamagePoint;   // Re-added for AFX
 48
 49   //
 50   DECLARE_CONOBJECT(StaticShapeData);
 51   static void initPersistFields();
 52   virtual void packData(BitStream* stream);
 53   virtual void unpackData(BitStream* stream);
 54public:
 55   StaticShapeData(const StaticShapeData&, bool = false);
 56   virtual bool   allowSubstitutions() const { return true; }
 57};
 58
 59
 60//----------------------------------------------------------------------------
 61
 62class StaticShape: public ShapeBase
 63{
 64   typedef ShapeBase Parent;
 65
 66   StaticShapeData*  mDataBlock;
 67   bool              mPowered;
 68
 69   void onUnmount(SceneObject* obj,S32 node);
 70
 71protected:
 72   enum MaskBits {
 73      PositionMask = Parent::NextFreeMask,     
 74      NextFreeMask = Parent::NextFreeMask << 1
 75   };
 76
 77public:
 78   DECLARE_CONOBJECT(StaticShape);
 79
 80   StaticShape();
 81   ~StaticShape();
 82
 83   bool onAdd();
 84   void onRemove();
 85   bool onNewDataBlock(GameBaseData *dptr, bool reload);
 86
 87   void processTick(const Move *move);
 88   void interpolateTick(F32 delta);
 89   void setTransform(const MatrixF &mat);
 90
 91   U32  packUpdate  (NetConnection *conn, U32 mask, BitStream *stream);
 92   void unpackUpdate(NetConnection *conn,           BitStream *stream);
 93
 94   // power
 95   void setPowered(bool power)      {mPowered = power;}
 96   bool isPowered()                 {return(mPowered);}
 97
 98   static void initPersistFields();   
 99};
100
101
102#endif
103