staticShape.h 3.2 KB

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