afxProjectile.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. bool onAdd() override;
  56. void packData(BitStream* stream) override;
  57. void unpackData(BitStream* stream) override;
  58. bool allowSubstitutions() const override { return true; }
  59. static void initPersistFields();
  60. DECLARE_CONOBJECT(afxProjectileData);
  61. };
  62. typedef afxProjectileData::LaunchDirType afxProjectile_LaunchDirType;
  63. DefineEnumType( afxProjectile_LaunchDirType );
  64. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  65. // afxProjectile
  66. class afxProjectile : public Projectile, public afxEffectDefs
  67. {
  68. typedef Projectile Parent;
  69. private:
  70. U32 chor_id;
  71. bool hookup_with_chor;
  72. StringTableEntry ghost_cons_name;
  73. bool client_only;
  74. public:
  75. /*C*/ afxProjectile();
  76. /*C*/ afxProjectile(U32 networking, U32 chor_id, StringTableEntry cons_name);
  77. /*D*/ ~afxProjectile();
  78. void init(Point3F& pos, Point3F& vel, ShapeBase* src_obj);
  79. bool onNewDataBlock(GameBaseData* dptr, bool reload) override;
  80. void processTick(const Move *move) override;
  81. void interpolateTick(F32 delta) override;
  82. void advanceTime(F32 dt) override;
  83. bool onAdd() override;
  84. void onRemove() override;
  85. U32 packUpdate(NetConnection*, U32, BitStream*) override;
  86. void unpackUpdate(NetConnection*, BitStream*) override;
  87. void explode(const Point3F& p, const Point3F& n, const U32 collideType) override;
  88. DECLARE_CONOBJECT(afxProjectile);
  89. DECLARE_CATEGORY("UNLISTED");
  90. };
  91. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  92. #endif // _AFX_PROJECTILE_H_