CHeroWindow.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. #pragma once
  2. #include "CPlayerInterface.h"
  3. #include "CAdvmapInterface.h"
  4. template <typename T> class AdventureMapButton;
  5. struct SDL_Surface;
  6. class CGHeroInstance;
  7. class CDefHandler;
  8. class CArtifact;
  9. class CHeroWindow;
  10. class LClickableArea: public ClickableL
  11. {
  12. public:
  13. virtual void clickLeft (tribool down);
  14. virtual void activate();
  15. virtual void deactivate();
  16. };
  17. class RClickableArea: public ClickableR
  18. {
  19. public:
  20. virtual void clickRight (tribool down);
  21. virtual void activate();
  22. virtual void deactivate();
  23. };
  24. class LClickableAreaHero : public LClickableArea
  25. {
  26. public:
  27. int id;
  28. CHeroWindow * owner;
  29. virtual void clickLeft (tribool down);
  30. };
  31. class LRClickableAreaWText: public LClickableArea, public RClickableArea
  32. {
  33. public:
  34. std::string text;
  35. virtual void activate();
  36. virtual void deactivate();
  37. virtual void clickLeft (tribool down);
  38. virtual void clickRight (tribool down);
  39. };
  40. class LRClickableAreaWTextComp: public LClickableArea, public RClickableArea
  41. {
  42. public:
  43. std::string text;
  44. int baseType;
  45. int bonus, type;
  46. virtual void activate();
  47. virtual void deactivate();
  48. virtual void clickLeft (tribool down);
  49. virtual void clickRight (tribool down);
  50. };
  51. class CArtPlace: public ClickableL, public IShowable
  52. {
  53. private:
  54. bool active;
  55. public:
  56. const CArtifact * ourArt;
  57. CArtPlace(CArtifact * art);
  58. void clickLeft (tribool down);
  59. void activate();
  60. void deactivate();
  61. void show(SDL_Surface * to = NULL);
  62. ~CArtPlace();
  63. };
  64. class CHeroWindow: public IActivable, public IShowable, public virtual CIntObject
  65. {
  66. SDL_Surface * background, * curBack;
  67. const CGHeroInstance * curHero;
  68. //general graphics
  69. CDefHandler * skillpics, *flags;
  70. //buttons
  71. AdventureMapButton<CHeroWindow> * quitButton, * dismissButton, * questlogButton, //general
  72. * gar1button, * gar2button, * gar3button, * gar4button, //garrison / formation handling
  73. * leftArtRoll, * rightArtRoll;
  74. //std::vector< AdventureMapButton<CHeroWindow> * > heroList; //list of heroes
  75. std::vector<LClickableAreaHero *> heroListMi; //new better list of heroes
  76. //artifact places
  77. CArtPlace * artHead, * artLRing, * artRRing, * artLHand, * artRhand,
  78. * artFeet, * artSpellBook, * artMach1, * artMach2, * artMach3,
  79. * artMach4, * artMisc1, * artMisc2, * artMisc3, * artMisc4,
  80. * artMisc5, * artTorso, * artNeck, * artShoulders; //heroes' artifacts
  81. std::vector<CArtPlace *> backpack; //hero's visible backpack (only 5 elements!)
  82. int backpackPos; //unmber of first art visible in backpack (in hero's vector)
  83. //clickable areas
  84. LRClickableAreaWText * portraitArea;
  85. std::vector<LRClickableAreaWTextComp *> primSkillAreas;
  86. LRClickableAreaWText * expArea;
  87. std::vector<LRClickableAreaWTextComp *> secSkillAreas;
  88. public:
  89. int player;
  90. CHeroWindow(int playerColor); //c-tor
  91. ~CHeroWindow(); //d-tor
  92. void setHero(const CGHeroInstance * hero); //sets main displayed hero
  93. void activate(); //activates hero window;
  94. void deactivate(); //activates hero window;
  95. virtual void show(SDL_Surface * to = NULL); //shows hero window
  96. void redrawCurBack(); //redraws curBAck from scratch
  97. void quit(); //stops displaying hero window
  98. void dismissCurrent(); //dissmissed currently displayed hero (curHero) //TODO: make it working
  99. void questlog(); //show quest log in hero window
  100. void gar1(); //garrison / formation handling
  101. void gar2(); //garrison / formation handling
  102. void gar3(); //garrison / formation handling
  103. void gar4(); //garrison / formation handling
  104. void leftArtRoller(); //scrolls artifacts in bag left
  105. void rightArtRoller(); //scrolls artifacts in bag right
  106. void switchHero(); //changes displayed hero
  107. };