BattleEffectsController.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * BattleEffectsController.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "../../lib/battle/BattleHex.h"
  12. #include "BattleConstants.h"
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. class BattleAction;
  15. struct BattleTriggerEffect;
  16. VCMI_LIB_NAMESPACE_END
  17. struct ColorMuxerEffect;
  18. class CAnimation;
  19. class Canvas;
  20. class BattleInterface;
  21. class BattleRenderer;
  22. class EffectAnimation;
  23. /// Struct for battle effect animation e.g. morale, prayer, armageddon, bless,...
  24. struct BattleEffect
  25. {
  26. int x, y; //position on the screen
  27. float currentFrame;
  28. std::shared_ptr<CAnimation> animation;
  29. int effectID; //uniqueID equal ot ID of appropriate CSpellEffectAnim
  30. BattleHex position; //Indicates if effect which hex the effect is drawn on
  31. };
  32. /// Controls rendering of effects in battle, e.g. from spells, abilities and various other actions like morale
  33. class BattleEffectsController
  34. {
  35. BattleInterface & owner;
  36. /// list of current effects that are being displayed on screen (spells & creature abilities)
  37. std::vector<BattleEffect> battleEffects;
  38. std::map<std::string, ColorMuxerEffect> colorMuxerEffects;
  39. void loadColorMuxers();
  40. public:
  41. const ColorMuxerEffect &getMuxerEffect(const std::string & name);
  42. BattleEffectsController(BattleInterface & owner);
  43. void startAction(const BattleAction* action);
  44. //displays custom effect on the battlefield
  45. void displayEffect(EBattleEffect effect, const BattleHex & destTile);
  46. void displayEffect(EBattleEffect effect, std::string soundFile, const BattleHex & destTile);
  47. void battleTriggerEffect(const BattleTriggerEffect & bte);
  48. void collectRenderableObjects(BattleRenderer & renderer);
  49. friend class EffectAnimation;
  50. };