BattleEffectsController.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 "../gui/Geometries.h"
  13. #include "BattleConstants.h"
  14. VCMI_LIB_NAMESPACE_BEGIN
  15. class BattleAction;
  16. struct BattleTriggerEffect;
  17. VCMI_LIB_NAMESPACE_END
  18. struct ColorMuxerEffect;
  19. class CAnimation;
  20. class Canvas;
  21. class BattleInterface;
  22. class BattleRenderer;
  23. class EffectAnimation;
  24. /// Struct for battle effect animation e.g. morale, prayer, armageddon, bless,...
  25. struct BattleEffect
  26. {
  27. Point pos; //position on the screen
  28. float currentFrame;
  29. std::shared_ptr<CAnimation> animation;
  30. int effectID; //uniqueID equal ot ID of appropriate CSpellEffectAnim
  31. BattleHex tile; //Indicates if effect which hex the effect is drawn on
  32. };
  33. /// Controls rendering of effects in battle, e.g. from spells, abilities and various other actions like morale
  34. class BattleEffectsController
  35. {
  36. BattleInterface & owner;
  37. /// list of current effects that are being displayed on screen (spells & creature abilities)
  38. std::vector<BattleEffect> battleEffects;
  39. std::map<std::string, ColorMuxerEffect> colorMuxerEffects;
  40. void loadColorMuxers();
  41. public:
  42. const ColorMuxerEffect &getMuxerEffect(const std::string & name);
  43. BattleEffectsController(BattleInterface & owner);
  44. void startAction(const BattleAction* action);
  45. //displays custom effect on the battlefield
  46. void displayEffect(EBattleEffect effect, const BattleHex & destTile);
  47. void displayEffect(EBattleEffect effect, std::string soundFile, const BattleHex & destTile);
  48. void battleTriggerEffect(const BattleTriggerEffect & bte);
  49. void collectRenderableObjects(BattleRenderer & renderer);
  50. friend class EffectAnimation;
  51. };