afxProjectile.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  2. // Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
  3. // Copyright (C) 2015 Faust Logic, Inc.
  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 _AFX_PROJECTILE_H_
  25. #define _AFX_PROJECTILE_H_
  26. #include "lighting/lightInfo.h"
  27. #include "T3D/projectile.h"
  28. #include "afx/afxEffectDefs.h"
  29. #include "afx/afxConstraint.h"
  30. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  31. // afxProjectileData
  32. class afxProjectileData : public ProjectileData, public afxEffectDefs
  33. {
  34. typedef ProjectileData Parent;
  35. public:
  36. enum LaunchDirType {
  37. TowardPos2Constraint,
  38. OrientConstraint,
  39. LaunchDirField
  40. };
  41. public:
  42. U8 networking;
  43. StringTableEntry launch_pos_spec;
  44. afxConstraintDef launch_pos_def;
  45. Point3F launch_dir_bias;
  46. bool ignore_src_timeout;
  47. U32 dynamicCollisionMask;
  48. U32 staticCollisionMask;
  49. bool override_collision_masks;
  50. U32 launch_dir_method;
  51. virtual void gather_cons_defs(Vector<afxConstraintDef>& defs);
  52. public:
  53. /*C*/ afxProjectileData();
  54. /*C*/ afxProjectileData(const afxProjectileData&, bool = false);
  55. virtual bool onAdd();
  56. void packData(BitStream* stream);
  57. void unpackData(BitStream* stream);
  58. virtual bool allowSubstitutions() const { return true; }
  59. static void initPersistFields();
  60. DECLARE_CONOBJECT(afxProjectileData);
  61. DECLARE_CATEGORY("AFX");
  62. };
  63. typedef afxProjectileData::LaunchDirType afxProjectile_LaunchDirType;
  64. DefineEnumType( afxProjectile_LaunchDirType );
  65. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  66. // afxProjectile
  67. class afxProjectile : public Projectile, public afxEffectDefs
  68. {
  69. typedef Projectile Parent;
  70. private:
  71. U32 chor_id;
  72. bool hookup_with_chor;
  73. StringTableEntry ghost_cons_name;
  74. bool client_only;
  75. public:
  76. /*C*/ afxProjectile();
  77. /*C*/ afxProjectile(U32 networking, U32 chor_id, StringTableEntry cons_name);
  78. /*D*/ ~afxProjectile();
  79. void init(Point3F& pos, Point3F& vel, ShapeBase* src_obj);
  80. virtual bool onNewDataBlock(GameBaseData* dptr, bool reload);
  81. virtual void processTick(const Move *move);
  82. virtual void interpolateTick(F32 delta);
  83. virtual void advanceTime(F32 dt);
  84. virtual bool onAdd();
  85. virtual void onRemove();
  86. virtual U32 packUpdate(NetConnection*, U32, BitStream*);
  87. virtual void unpackUpdate(NetConnection*, BitStream*);
  88. virtual void explode(const Point3F& p, const Point3F& n, const U32 collideType);
  89. DECLARE_CONOBJECT(afxProjectile);
  90. DECLARE_CATEGORY("AFX");
  91. };
  92. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  93. #endif // _AFX_PROJECTILE_H_