afxFootSwitch.cpp 4.3 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. #include "afx/arcaneFX.h"
  25. #include "console/consoleTypes.h"
  26. #include "core/stream/bitStream.h"
  27. #include "afx/ce/afxFootSwitch.h"
  28. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  29. // afxFootSwitchData
  30. IMPLEMENT_CO_DATABLOCK_V1(afxFootSwitchData);
  31. ConsoleDocClass( afxFootSwitchData,
  32. "@brief A datablock that specifies a Foot Switch effect.\n\n"
  33. "A Foot Switch effect is used to disable some or all of the standard built-in footstep effects generated by Player objects."
  34. "\n\n"
  35. "Stock Player objects generate footprint decals, footstep sounds, and puffs of particle dust in response to special "
  36. "animation triggers embedded in the Player's dts model. With the help of Phase Effects, AFX can substitute alternatives for "
  37. "these built-in effects. When this is done, it is often preferable to turn off some or all of the built-in footstep effects."
  38. "\n\n"
  39. "Foot Switch effects are only meaningful when the primary position constraint is a Player or Player-derived object."
  40. "\n\n"
  41. "@ingroup afxEffects\n"
  42. "@ingroup AFX\n"
  43. "@ingroup Datablocks\n"
  44. );
  45. afxFootSwitchData::afxFootSwitchData()
  46. {
  47. override_all = false;
  48. override_decals = false;
  49. override_sounds = false;
  50. override_dust = false;
  51. }
  52. afxFootSwitchData::afxFootSwitchData(const afxFootSwitchData& other, bool temp_clone) : GameBaseData(other, temp_clone)
  53. {
  54. override_all = other.override_all;
  55. override_decals = other.override_decals;
  56. override_sounds = other.override_sounds;
  57. override_dust = other.override_dust;
  58. }
  59. #define myOffset(field) Offset(field, afxFootSwitchData)
  60. void afxFootSwitchData::initPersistFields()
  61. {
  62. addField("overrideAll", TypeBool, myOffset(override_all),
  63. "When true, all of a Player's footstep effects are turned off for the duration of "
  64. "the foot-switch effect.");
  65. addField("overrideDecals", TypeBool, myOffset(override_decals),
  66. "Specifically selects whether the Player's footprint decals are enabled.");
  67. addField("overrideSounds", TypeBool, myOffset(override_sounds),
  68. "Specifically selects whether the Player's footstep sounds are enabled.");
  69. addField("overrideDust", TypeBool, myOffset(override_dust),
  70. "Specifically selects whether the Player's footstep puffs of dust are enabled.");
  71. Parent::initPersistFields();
  72. }
  73. void afxFootSwitchData::packData(BitStream* stream)
  74. {
  75. Parent::packData(stream);
  76. if (!stream->writeFlag(override_all))
  77. {
  78. stream->writeFlag(override_decals);
  79. stream->writeFlag(override_sounds);
  80. stream->writeFlag(override_dust);
  81. }
  82. }
  83. void afxFootSwitchData::unpackData(BitStream* stream)
  84. {
  85. Parent::unpackData(stream);
  86. override_all = stream->readFlag();
  87. if (!override_all)
  88. {
  89. override_decals = stream->readFlag();
  90. override_sounds = stream->readFlag();
  91. override_dust = stream->readFlag();
  92. }
  93. }
  94. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//