CBattleEffectsController.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * CBattleEffectsController.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. struct SDL_Surface;
  13. class BattleAction;
  14. class CAnimation;
  15. class CBattleInterface;
  16. struct BattleObjectsByHex;
  17. struct CustomEffectInfo;
  18. struct BattleTriggerEffect;
  19. class CEffectAnimation;
  20. namespace EBattleEffect
  21. {
  22. enum EBattleEffect
  23. {
  24. // list of battle effects that have hardcoded triggers
  25. FEAR = 15,
  26. GOOD_LUCK = 18,
  27. GOOD_MORALE = 20,
  28. BAD_MORALE = 30,
  29. BAD_LUCK = 48,
  30. RESURRECT = 50,
  31. POISON = 67,
  32. DEATH_BLOW = 73,
  33. REGENERATION = 74,
  34. MANA_DRAIN = 77,
  35. INVALID = -1,
  36. };
  37. }
  38. /// Struct for battle effect animation e.g. morale, prayer, armageddon, bless,...
  39. struct BattleEffect
  40. {
  41. int x, y; //position on the screen
  42. float currentFrame;
  43. std::shared_ptr<CAnimation> animation;
  44. int effectID; //uniqueID equal ot ID of appropriate CSpellEffectAnim
  45. BattleHex position; //Indicates if effect which hex the effect is drawn on
  46. };
  47. class CBattleEffectsController
  48. {
  49. CBattleInterface * owner;
  50. /// list of current effects that are being displayed on screen (spells & creature abilities)
  51. std::vector<BattleEffect> battleEffects;
  52. public:
  53. CBattleEffectsController(CBattleInterface * owner);
  54. void startAction(const BattleAction* action);
  55. void displayCustomEffects(const std::vector<CustomEffectInfo> & customEffects);
  56. void displayEffect(EBattleEffect::EBattleEffect effect, const BattleHex & destTile); //displays custom effect on the battlefield
  57. void displayEffect(EBattleEffect::EBattleEffect effect, uint32_t soundID, const BattleHex & destTile); //displays custom effect on the battlefield
  58. void battleTriggerEffect(const BattleTriggerEffect & bte);
  59. void showBattlefieldObjects(SDL_Surface *to, const BattleHex & destTile);
  60. friend class CEffectAnimation; // currently, battleEffects is largely managed by CEffectAnimation, TODO: move this logic into CBattleEffectsController
  61. };