staticShape.h 2.7 KB

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