CCreatureWindow.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #include "../global.h"
  2. #include "GUIBase.h"
  3. #include "GUIClasses.h"
  4. #include "../lib/HeroBonus.h"
  5. /*
  6. * CCreatureWindow.h, part of VCMI engine
  7. *
  8. * Authors: listed in file AUTHORS in main folder
  9. *
  10. * License: GNU General Public License v2.0 or later
  11. * Full text of license available in license.txt file, in main folder
  12. *
  13. */
  14. struct Bonus;
  15. class CCreature;
  16. class CStackInstance;
  17. class CStack;
  18. class AdventureMapButton;
  19. class CBonusItem;
  20. class CCreatureWindow : public CIntObject
  21. {
  22. public:
  23. enum CreWinType {OTHER = 0, BATTLE = 1, ARMY = 2, HERO = 3}; //only last one should open permanently
  24. //bool active; //TODO: comment me
  25. int type;//0 - rclick popup; 1 - normal window
  26. int bonusRows; //height of skill window
  27. std::string count; //creature count in text format
  28. const CCreature *c; //related creature
  29. const CStackInstance *stack;
  30. const CBonusSystemNode *stackNode;
  31. const CGHeroInstance *heroOwner;
  32. std::vector<SComponent*> upgResCost; //cost of upgrade (if not possible then empty)
  33. std::vector<CBonusItem*> bonusItems;
  34. std::vector<LRClickableAreaWText*> spellEffects;
  35. CPicture *bitmap; //background
  36. CCreaturePic *anim; //related creature's animation
  37. MoraleLuckBox *luck, *morale;
  38. LRClickableAreaWTextComp * expArea; //displays exp details
  39. CArtPlace *creatureArtifact;
  40. CSlider * slider; //Abilities
  41. AdventureMapButton *dismiss, *upgrade, *ok;
  42. AdventureMapButton * leftArtRoll, * rightArtRoll; //artifact selection
  43. //TODO: Artifact drop
  44. boost::function<void()> dsm; //dismiss button callback
  45. boost::function<void()> Upg; //upgrade button callback
  46. CCreatureWindow(const CStack & stack, int type); //battle c-tor
  47. CCreatureWindow (const CStackInstance &stack, int Type); //pop-up c-tor
  48. CCreatureWindow(const CStackInstance &st, int Type, boost::function<void()> Upg, boost::function<void()> Dsm, UpgradeInfo *ui); //full garrison window
  49. CCreatureWindow(int Cid, int Type, int creatureCount); //c-tor
  50. void init(const CStackInstance *stack, const CBonusSystemNode *stackNode, const CGHeroInstance *heroOwner);
  51. void showAll(SDL_Surface * to);
  52. void show(SDL_Surface * to);
  53. void printLine(int nr, const std::string &text, int baseVal, int val=-1, bool range=false);
  54. void recreateSkillList(int pos);
  55. ~CCreatureWindow(); //d-tor
  56. //void activate();
  57. //void deactivate();
  58. void close();
  59. void clickRight(tribool down, bool previousState); //call-in
  60. void sliderMoved(int newpos);
  61. //void keyPressed (const SDL_KeyboardEvent & key); //call-in
  62. void scrollArt(int dir);
  63. };
  64. class CBonusItem : public LRClickableAreaWTextComp //responsible for displaying creature skill, active or not
  65. {
  66. public:
  67. std::string name, description;
  68. CPicture * bonusGraphics;
  69. bool visible;
  70. CBonusItem();
  71. CBonusItem(const Rect &Pos, const std::string &Name, const std::string &Description, const std::string &graphicsName);
  72. ~CBonusItem();
  73. void setBonus (const Bonus &bonus);
  74. void showAll (SDL_Surface * to);
  75. };