afxPhraseEffect.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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_PHRASE_EFFECT_H_
  25. #define _AFX_PHRASE_EFFECT_H_
  26. #include "console/typeValidators.h"
  27. #include "afx/ce/afxComponentEffect.h"
  28. #include "afx/afxEffectDefs.h"
  29. #include "afx/afxEffectWrapper.h"
  30. #include "afx/afxPhrase.h"
  31. class afxPhraseEffectData : public GameBaseData, public afxEffectDefs, public afxComponentEffectData
  32. {
  33. typedef GameBaseData Parent;
  34. class ewValidator : public TypeValidator
  35. {
  36. U32 id;
  37. public:
  38. ewValidator(U32 id) { this->id = id; }
  39. void validateType(SimObject *object, void *typePtr);
  40. };
  41. bool do_id_convert;
  42. public:
  43. enum MatchType {
  44. MATCH_ANY = 0,
  45. MATCH_ALL = 1
  46. };
  47. enum StateType {
  48. STATE_ON = 1,
  49. STATE_OFF = 2,
  50. STATE_ON_AND_OFF = STATE_ON | STATE_OFF
  51. };
  52. enum PhraseType
  53. {
  54. PHRASE_TRIGGERED = 0,
  55. PHRASE_CONTINUOUS = 1
  56. };
  57. public:
  58. afxEffectList fx_list;
  59. F32 duration;
  60. S32 n_loops;
  61. U32 trigger_mask;
  62. U32 match_type;
  63. U32 match_state;
  64. U32 phrase_type;
  65. bool no_choreographer_trigs;
  66. bool no_cons_trigs;
  67. bool no_player_trigs;
  68. StringTableEntry on_trig_cmd;
  69. afxEffectBaseData* dummy_fx_entry;
  70. private:
  71. void pack_fx(BitStream* stream, const afxEffectList& fx, bool packed);
  72. void unpack_fx(BitStream* stream, afxEffectList& fx);
  73. public:
  74. /*C*/ afxPhraseEffectData();
  75. /*C*/ afxPhraseEffectData(const afxPhraseEffectData&, bool = false);
  76. virtual void reloadReset();
  77. virtual bool onAdd();
  78. virtual void packData(BitStream*);
  79. virtual void unpackData(BitStream*);
  80. bool preload(bool server, String &errorStr);
  81. virtual void gather_cons_defs(Vector<afxConstraintDef>& defs);
  82. virtual bool allowSubstitutions() const { return true; }
  83. static void initPersistFields();
  84. DECLARE_CONOBJECT(afxPhraseEffectData);
  85. DECLARE_CATEGORY("AFX");
  86. };
  87. typedef afxPhraseEffectData::MatchType afxPhraseEffect_MatchType;
  88. DefineEnumType( afxPhraseEffect_MatchType );
  89. typedef afxPhraseEffectData::StateType afxPhraseEffect_StateType;
  90. DefineEnumType( afxPhraseEffect_StateType );
  91. typedef afxPhraseEffectData::PhraseType afxPhraseEffect_PhraseType;
  92. DefineEnumType( afxPhraseEffect_PhraseType );
  93. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  94. #endif // _AFX_PHRASE_EFFECT_H_