CShootingAnimation.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #pragma once
  2. #include "CAttackAnimation.h"
  3. #include "../../lib/SHexField.h"
  4. class CBattleInterface;
  5. class CStack;
  6. struct SCatapultSProjectileInfo;
  7. /*
  8. * CShootingAnimation.h, part of VCMI engine
  9. *
  10. * Authors: listed in file AUTHORS in main folder
  11. *
  12. * License: GNU General Public License v2.0 or later
  13. * Full text of license available in license.txt file, in main folder
  14. *
  15. */
  16. /// Small struct which contains information about the position and the velocity of a projectile
  17. struct SProjectileInfo
  18. {
  19. double x, y; //position on the screen
  20. double dx, dy; //change in position in one step
  21. int step, lastStep; //to know when finish showing this projectile
  22. int creID; //ID of creature that shot this projectile
  23. int stackID; //ID of stack
  24. int frameNum; //frame to display form projectile animation
  25. bool spin; //if true, frameNum will be increased
  26. int animStartDelay; //how many times projectile must be attempted to be shown till it's really show (decremented after hit)
  27. bool reverse; //if true, projectile will be flipped by vertical asix
  28. SCatapultSProjectileInfo *catapultInfo; // holds info about the parabolic trajectory of the cannon
  29. };
  30. /// Shooting attack
  31. class CShootingAnimation : public CAttackAnimation
  32. {
  33. private:
  34. int catapultDamage;
  35. bool catapult;
  36. public:
  37. bool init();
  38. void nextFrame();
  39. void endAnim();
  40. //last param only for catapult attacks
  41. CShootingAnimation(CBattleInterface *_owner, const CStack *attacker,
  42. SHexField _dest, const CStack *_attacked, bool _catapult = false, int _catapultDmg = 0);
  43. };