2008-01-10 21:01:25 +02:00
|
|
|
#pragma once
|
|
|
|
#include "CPlayerInterface.h"
|
|
|
|
|
2008-05-18 20:33:39 +03:00
|
|
|
class AdventureMapButton;
|
2008-01-19 15:19:58 +02:00
|
|
|
struct SDL_Surface;
|
2008-01-10 21:01:25 +02:00
|
|
|
class CGHeroInstance;
|
2008-01-12 14:55:45 +02:00
|
|
|
class CDefHandler;
|
2008-01-19 15:19:58 +02:00
|
|
|
class CArtifact;
|
2008-01-25 21:09:41 +02:00
|
|
|
class CHeroWindow;
|
2008-01-19 15:19:58 +02:00
|
|
|
|
2008-01-19 20:58:24 +02:00
|
|
|
class LClickableArea: public ClickableL
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void clickLeft (tribool down);
|
|
|
|
virtual void activate();
|
|
|
|
virtual void deactivate();
|
|
|
|
};
|
|
|
|
|
2008-01-27 18:07:27 +02:00
|
|
|
class RClickableArea: public ClickableR
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void clickRight (tribool down);
|
|
|
|
virtual void activate();
|
|
|
|
virtual void deactivate();
|
|
|
|
};
|
|
|
|
|
2008-01-25 21:09:41 +02:00
|
|
|
class LClickableAreaHero : public LClickableArea
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int id;
|
|
|
|
CHeroWindow * owner;
|
|
|
|
virtual void clickLeft (tribool down);
|
|
|
|
};
|
|
|
|
|
2008-01-31 14:10:59 +02:00
|
|
|
class LRClickableAreaWText: public LClickableArea, public RClickableArea, public Hoverable
|
2008-01-27 18:07:27 +02:00
|
|
|
{
|
|
|
|
public:
|
2008-01-31 14:10:59 +02:00
|
|
|
std::string text, hoverText;
|
2008-01-27 18:07:27 +02:00
|
|
|
virtual void activate();
|
|
|
|
virtual void deactivate();
|
|
|
|
virtual void clickLeft (tribool down);
|
|
|
|
virtual void clickRight (tribool down);
|
2008-01-31 14:10:59 +02:00
|
|
|
virtual void hover(bool on);
|
2008-01-27 18:07:27 +02:00
|
|
|
};
|
|
|
|
|
2008-01-31 14:10:59 +02:00
|
|
|
class LRClickableAreaWTextComp: public LClickableArea, public RClickableArea, public Hoverable
|
2008-01-20 15:53:11 +02:00
|
|
|
{
|
|
|
|
public:
|
2008-01-31 14:10:59 +02:00
|
|
|
std::string text, hoverText;
|
2008-01-28 14:28:18 +02:00
|
|
|
int baseType;
|
2008-01-27 18:07:27 +02:00
|
|
|
int bonus, type;
|
|
|
|
virtual void activate();
|
|
|
|
virtual void deactivate();
|
2008-01-20 15:53:11 +02:00
|
|
|
virtual void clickLeft (tribool down);
|
2008-01-27 18:07:27 +02:00
|
|
|
virtual void clickRight (tribool down);
|
2008-01-31 14:10:59 +02:00
|
|
|
virtual void hover(bool on);
|
2008-01-20 15:53:11 +02:00
|
|
|
};
|
|
|
|
|
2008-01-30 12:55:43 +02:00
|
|
|
class CArtPlace: public IShowable, public LRClickableAreaWTextComp
|
2008-01-19 15:19:58 +02:00
|
|
|
{
|
2008-01-20 17:26:34 +02:00
|
|
|
private:
|
|
|
|
bool active;
|
2008-01-19 15:19:58 +02:00
|
|
|
public:
|
2008-08-26 00:14:00 +03:00
|
|
|
//bool spellBook, warMachine1, warMachine2, warMachine3, warMachine4,
|
|
|
|
// misc1, misc2, misc3, misc4, misc5, feet, lRing, rRing, torso,
|
|
|
|
// lHand, rHand, neck, shoulders, head; //my types
|
2008-08-20 22:02:48 +03:00
|
|
|
ui16 slotID; //0 head 1 shoulders 2 neck 3 right hand 4 left hand 5 torso 6 right ring 7 left ring 8 feet 9 misc. slot 1 10 misc. slot 2 11 misc. slot 3 12 misc. slot 4 13 ballista (war machine 1) 14 ammo cart (war machine 2) 15 first aid tent (war machine 3) 16 catapult 17 spell book 18 misc. slot 5 19+ backpack slots
|
2008-01-30 12:55:43 +02:00
|
|
|
|
|
|
|
bool clicked;
|
|
|
|
CHeroWindow * ourWindow;
|
2008-01-19 15:19:58 +02:00
|
|
|
const CArtifact * ourArt;
|
2008-06-11 04:53:57 +03:00
|
|
|
CArtPlace(const CArtifact * Art);
|
2008-01-19 15:19:58 +02:00
|
|
|
void clickLeft (tribool down);
|
2008-01-29 15:55:14 +02:00
|
|
|
void clickRight (tribool down);
|
2008-01-19 15:19:58 +02:00
|
|
|
void activate();
|
|
|
|
void deactivate();
|
|
|
|
void show(SDL_Surface * to = NULL);
|
2008-01-30 12:55:43 +02:00
|
|
|
bool fitsHere(const CArtifact * art); //returns true if given artifact can be placed here
|
2008-01-20 15:53:11 +02:00
|
|
|
~CArtPlace();
|
2008-01-19 15:19:58 +02:00
|
|
|
};
|
2008-01-10 21:01:25 +02:00
|
|
|
|
2008-08-20 09:57:53 +03:00
|
|
|
class CHeroWindow: public IShowActivable, public virtual CIntObject
|
2008-01-10 21:01:25 +02:00
|
|
|
{
|
2008-01-12 14:55:45 +02:00
|
|
|
SDL_Surface * background, * curBack;
|
2008-01-10 21:01:25 +02:00
|
|
|
const CGHeroInstance * curHero;
|
2008-01-30 15:18:08 +02:00
|
|
|
CGarrisonInt * garInt;
|
2008-01-31 14:10:59 +02:00
|
|
|
CStatusBar * ourBar; //heroWindow's statusBar
|
2008-01-11 20:56:39 +02:00
|
|
|
|
2008-01-12 14:55:45 +02:00
|
|
|
//general graphics
|
2008-08-13 03:44:31 +03:00
|
|
|
CDefHandler *flags;
|
2008-01-12 14:55:45 +02:00
|
|
|
|
2008-01-11 20:56:39 +02:00
|
|
|
//buttons
|
2008-05-18 20:33:39 +03:00
|
|
|
AdventureMapButton * gar4button; //splitting
|
2008-01-25 21:09:41 +02:00
|
|
|
std::vector<LClickableAreaHero *> heroListMi; //new better list of heroes
|
2008-01-19 15:19:58 +02:00
|
|
|
|
2008-01-30 12:55:43 +02:00
|
|
|
std::vector<CArtPlace *> artWorn; // 0 - head; 1 - shoulders; 2 - neck; 3 - right hand; 4 - left hand; 5 - torso; 6 - right ring; 7 - left ring; 8 - feet; 9 - misc1; 10 - misc2; 11 - misc3; 12 - misc4; 13 - mach1; 14 - mach2; 15 - mach3; 16 - mach4; 17 - spellbook; 18 - misc5
|
2008-01-19 20:58:24 +02:00
|
|
|
std::vector<CArtPlace *> backpack; //hero's visible backpack (only 5 elements!)
|
|
|
|
int backpackPos; //unmber of first art visible in backpack (in hero's vector)
|
2008-01-30 12:55:43 +02:00
|
|
|
CArtPlace * activeArtPlace;
|
2008-01-19 20:58:24 +02:00
|
|
|
//clickable areas
|
2008-01-27 18:07:27 +02:00
|
|
|
LRClickableAreaWText * portraitArea;
|
|
|
|
std::vector<LRClickableAreaWTextComp *> primSkillAreas;
|
|
|
|
LRClickableAreaWText * expArea;
|
2008-01-29 15:55:14 +02:00
|
|
|
LRClickableAreaWText * spellPointsArea;
|
2008-01-28 14:28:18 +02:00
|
|
|
std::vector<LRClickableAreaWTextComp *> secSkillAreas;
|
2008-01-10 21:01:25 +02:00
|
|
|
public:
|
2008-08-16 11:47:41 +03:00
|
|
|
AdventureMapButton * quitButton, * dismissButton, * questlogButton, //general
|
|
|
|
* leftArtRoll, * rightArtRoll;
|
2008-09-24 11:15:49 +03:00
|
|
|
CHighlightableButton *gar2button; //garrison / formation handling;
|
|
|
|
CHighlightableButtonsGroup *formations;
|
2008-01-25 21:09:41 +02:00
|
|
|
int player;
|
2008-01-11 20:56:39 +02:00
|
|
|
CHeroWindow(int playerColor); //c-tor
|
2008-01-10 21:01:25 +02:00
|
|
|
~CHeroWindow(); //d-tor
|
2008-06-08 03:58:29 +03:00
|
|
|
void setHero(const CGHeroInstance * Hero); //sets main displayed hero
|
2008-01-11 20:56:39 +02:00
|
|
|
void activate(); //activates hero window;
|
2008-01-20 14:34:39 +02:00
|
|
|
void deactivate(); //activates hero window;
|
2008-01-10 21:01:25 +02:00
|
|
|
virtual void show(SDL_Surface * to = NULL); //shows hero window
|
2008-01-15 20:50:52 +02:00
|
|
|
void redrawCurBack(); //redraws curBAck from scratch
|
2008-01-11 20:56:39 +02:00
|
|
|
void quit(); //stops displaying hero window
|
2008-02-03 17:24:35 +02:00
|
|
|
void dismissCurrent(); //dissmissed currently displayed hero (curHero)
|
2008-01-13 21:42:21 +02:00
|
|
|
void questlog(); //show quest log in hero window
|
|
|
|
void leftArtRoller(); //scrolls artifacts in bag left
|
|
|
|
void rightArtRoller(); //scrolls artifacts in bag right
|
|
|
|
void switchHero(); //changes displayed hero
|
2008-01-30 12:55:43 +02:00
|
|
|
|
|
|
|
//friends
|
|
|
|
friend void CArtPlace::clickLeft(tribool down);
|
2008-08-02 18:08:03 +03:00
|
|
|
friend class CPlayerInterface;
|
2008-01-19 15:19:58 +02:00
|
|
|
};
|