BattleEffectsController.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. class CAnimation;
  18. class Canvas;
  19. class BattleInterface;
  20. class BattleRenderer;
  21. class PointEffectAnimation;
  22. /// Struct for battle effect animation e.g. morale, prayer, armageddon, bless,...
  23. struct BattleEffect
  24. {
  25. int x, y; //position on the screen
  26. float currentFrame;
  27. std::shared_ptr<CAnimation> animation;
  28. int effectID; //uniqueID equal ot ID of appropriate CSpellEffectAnim
  29. BattleHex position; //Indicates if effect which hex the effect is drawn on
  30. };
  31. /// Controls rendering of effects in battle, e.g. from spells, abilities and various other actions like morale
  32. class BattleEffectsController
  33. {
  34. BattleInterface & owner;
  35. /// list of current effects that are being displayed on screen (spells & creature abilities)
  36. std::vector<BattleEffect> battleEffects;
  37. public:
  38. BattleEffectsController(BattleInterface & owner);
  39. void startAction(const BattleAction* action);
  40. //displays custom effect on the battlefield
  41. void displayEffect(EBattleEffect effect, const BattleHex & destTile);
  42. void displayEffect(EBattleEffect effect, uint32_t soundID, const BattleHex & destTile);
  43. void battleTriggerEffect(const BattleTriggerEffect & bte);
  44. void collectRenderableObjects(BattleRenderer & renderer);
  45. friend class PointEffectAnimation;
  46. };