2009-05-19 18:23:04 +00:00
|
|
|
/*
|
|
|
|
* GUIClasses.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
2017-07-13 11:26:03 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../lib/GameConstants.h"
|
|
|
|
#include "../lib/ResourceSet.h"
|
|
|
|
#include "../lib/CConfigHandler.h"
|
|
|
|
#include "../widgets/CArtifactHolder.h"
|
|
|
|
#include "../widgets/CGarrisonInt.h"
|
|
|
|
#include "../widgets/Images.h"
|
|
|
|
#include "../windows/CWindowObject.h"
|
2009-05-19 18:23:04 +00:00
|
|
|
|
2009-07-26 10:43:22 +00:00
|
|
|
class CGDwelling;
|
2010-05-18 07:01:54 +00:00
|
|
|
class IMarket;
|
2014-07-13 18:39:45 +03:00
|
|
|
class CCreaturePic;
|
|
|
|
class MoraleLuckBox;
|
|
|
|
class CHeroArea;
|
|
|
|
class CMinorResDataBar;
|
2014-07-15 10:14:49 +03:00
|
|
|
class CSlider;
|
2014-07-13 18:39:45 +03:00
|
|
|
class CComponentBox;
|
2014-07-15 10:14:49 +03:00
|
|
|
class CTextInput;
|
|
|
|
class CListBox;
|
|
|
|
class CLabelGroup;
|
2014-08-03 14:16:19 +03:00
|
|
|
class CToggleButton;
|
|
|
|
class CToggleGroup;
|
2015-08-21 23:05:08 -04:00
|
|
|
class CVolumeSlider;
|
2014-07-15 10:14:49 +03:00
|
|
|
class CGStatusBar;
|
2009-05-19 18:23:04 +00:00
|
|
|
|
2011-02-22 11:52:36 +00:00
|
|
|
/// Recruitment window where you can recruit creatures
|
2012-06-15 17:08:19 +00:00
|
|
|
class CRecruitmentWindow : public CWindowObject
|
2009-05-19 18:23:04 +00:00
|
|
|
{
|
2012-06-22 11:40:16 +00:00
|
|
|
class CCreatureCard : public CIntObject
|
2009-05-19 18:23:04 +00:00
|
|
|
{
|
2012-06-22 11:40:16 +00:00
|
|
|
CRecruitmentWindow * parent;
|
2017-07-20 02:50:47 +03:00
|
|
|
CCreaturePic * pic; //creature's animation
|
2012-06-22 11:40:16 +00:00
|
|
|
bool selected;
|
|
|
|
|
2015-10-12 16:47:10 +03:00
|
|
|
void clickLeft(tribool down, bool previousState) override;
|
|
|
|
void clickRight(tribool down, bool previousState) override;
|
2017-07-20 02:50:47 +03:00
|
|
|
void showAll(SDL_Surface * to) override;
|
|
|
|
|
|
|
|
public:
|
2012-06-22 11:40:16 +00:00
|
|
|
const CCreature * creature;
|
|
|
|
si32 amount;
|
|
|
|
|
|
|
|
void select(bool on);
|
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
CCreatureCard(CRecruitmentWindow * window, const CCreature * crea, int totalAmount);
|
2012-06-22 11:40:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/// small class to display creature costs
|
|
|
|
class CCostBox : public CIntObject
|
|
|
|
{
|
2017-07-20 02:50:47 +03:00
|
|
|
std::map<int, std::pair<CLabel *, CAnimImage *>> resources;
|
|
|
|
|
|
|
|
public:
|
2012-06-22 11:40:16 +00:00
|
|
|
//res - resources to show
|
|
|
|
void set(TResources res);
|
|
|
|
//res - visible resources
|
|
|
|
CCostBox(Rect position, std::string title);
|
|
|
|
void createItems(TResources res);
|
2009-05-19 18:23:04 +00:00
|
|
|
};
|
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
std::function<void(CreatureID, int)> onRecruit; //void (int ID, int amount) <-- call to recruit creatures
|
2012-06-22 11:40:16 +00:00
|
|
|
|
2009-07-26 10:43:22 +00:00
|
|
|
int level;
|
2017-07-20 02:50:47 +03:00
|
|
|
const CArmedInstance * dst;
|
2009-07-26 10:43:22 +00:00
|
|
|
|
2012-06-22 11:40:16 +00:00
|
|
|
CCreatureCard * selected;
|
|
|
|
std::vector<CCreatureCard *> cards;
|
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
CSlider * slider; //for selecting amount
|
|
|
|
CButton * maxButton, * buyButton, * cancelButton;
|
2012-06-22 11:40:16 +00:00
|
|
|
//labels for visible values
|
|
|
|
CLabel * title;
|
|
|
|
CLabel * availableValue;
|
|
|
|
CLabel * toRecruitValue;
|
|
|
|
CCostBox * costPerTroopValue;
|
|
|
|
CCostBox * totalCostValue;
|
|
|
|
|
|
|
|
void select(CCreatureCard * card);
|
|
|
|
void buy();
|
2009-05-19 18:23:04 +00:00
|
|
|
void sliderMoved(int to);
|
2012-06-22 11:40:16 +00:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
void showAll(SDL_Surface * to) override;
|
|
|
|
|
2012-06-22 11:40:16 +00:00
|
|
|
public:
|
|
|
|
const CGDwelling * const dwelling;
|
2017-07-20 02:50:47 +03:00
|
|
|
CRecruitmentWindow(const CGDwelling * Dwelling, int Level, const CArmedInstance * Dst, const std::function<void(CreatureID, int)> & Recruit, int y_offset = 0); //creatures - pairs<creature_ID,amount> //c-tor
|
2012-06-22 11:40:16 +00:00
|
|
|
void availableCreaturesChanged();
|
2009-05-19 18:23:04 +00:00
|
|
|
};
|
|
|
|
|
2013-02-07 17:34:50 +00:00
|
|
|
/// Split window where creatures can be split up into two single unit stacks
|
2012-06-13 13:04:06 +00:00
|
|
|
class CSplitWindow : public CWindowObject
|
2009-05-19 18:23:04 +00:00
|
|
|
{
|
2013-06-26 11:18:27 +00:00
|
|
|
std::function<void(int, int)> callback;
|
2012-06-13 13:04:06 +00:00
|
|
|
int leftAmount;
|
|
|
|
int rightAmount;
|
|
|
|
|
|
|
|
int leftMin;
|
|
|
|
int rightMin;
|
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
CSlider * slider;
|
|
|
|
CCreaturePic * animLeft, * animRight; //creature's animation
|
|
|
|
CButton * ok, * cancel;
|
2009-05-19 18:23:04 +00:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
CTextInput * leftInput, * rightInput;
|
2012-06-13 13:04:06 +00:00
|
|
|
void setAmountText(std::string text, bool left);
|
|
|
|
void setAmount(int value, bool left);
|
|
|
|
void sliderMoved(int value);
|
|
|
|
void apply();
|
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* creature - displayed creature
|
|
|
|
* callback(leftAmount, rightAmount) - function to call on close
|
|
|
|
* leftMin, rightMin - minimal amount of creatures in each stack
|
|
|
|
* leftAmount, rightAmount - amount of creatures in each stack
|
|
|
|
*/
|
2017-07-20 02:50:47 +03:00
|
|
|
CSplitWindow(const CCreature * creature, std::function<void(int, int)> callback, int leftMin, int rightMin, int leftAmount, int rightAmount);
|
2009-05-19 18:23:04 +00:00
|
|
|
};
|
|
|
|
|
2011-02-22 11:52:36 +00:00
|
|
|
/// Raised up level windowe where you can select one out of two skills
|
2012-06-15 17:08:19 +00:00
|
|
|
class CLevelWindow : public CWindowObject
|
2009-05-19 18:23:04 +00:00
|
|
|
{
|
2012-07-07 13:32:37 +00:00
|
|
|
CComponentBox * box; //skills to select
|
2013-06-26 11:18:27 +00:00
|
|
|
std::function<void(ui32)> cb;
|
2009-05-19 18:23:04 +00:00
|
|
|
|
2012-07-07 13:32:37 +00:00
|
|
|
void selectionChanged(unsigned to);
|
2017-07-20 02:50:47 +03:00
|
|
|
|
2012-07-07 13:32:37 +00:00
|
|
|
public:
|
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
CLevelWindow(const CGHeroInstance * hero, PrimarySkill::PrimarySkill pskill, std::vector<SecondarySkill> & skills, std::function<void(ui32)> callback);
|
2017-07-18 00:04:00 +03:00
|
|
|
~CLevelWindow();
|
2012-07-07 13:32:37 +00:00
|
|
|
|
2009-05-19 18:23:04 +00:00
|
|
|
};
|
|
|
|
|
2011-02-22 11:52:36 +00:00
|
|
|
/// Town portal, castle gate window
|
2012-06-15 17:08:19 +00:00
|
|
|
class CObjectListWindow : public CWindowObject
|
2010-06-26 10:01:26 +00:00
|
|
|
{
|
2012-01-12 15:23:00 +00:00
|
|
|
class CItem : public CIntObject
|
|
|
|
{
|
2017-07-20 02:50:47 +03:00
|
|
|
CObjectListWindow * parent;
|
|
|
|
CLabel * text;
|
|
|
|
CPicture * border;
|
|
|
|
|
|
|
|
public:
|
2012-01-12 15:23:00 +00:00
|
|
|
const size_t index;
|
2017-07-20 02:50:47 +03:00
|
|
|
CItem(CObjectListWindow * parent, size_t id, std::string text);
|
2012-01-12 15:23:00 +00:00
|
|
|
|
|
|
|
void select(bool on);
|
2015-10-12 16:47:10 +03:00
|
|
|
void clickLeft(tribool down, bool previousState) override;
|
2012-01-12 15:23:00 +00:00
|
|
|
};
|
2010-06-26 10:01:26 +00:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
std::function<void(int)> onSelect; //called when OK button is pressed, returns id of selected item.
|
2012-01-12 15:23:00 +00:00
|
|
|
CLabel * title;
|
|
|
|
CLabel * descr;
|
2010-06-26 10:01:26 +00:00
|
|
|
|
2014-03-10 16:00:58 +00:00
|
|
|
CListBox * list;
|
2017-07-20 02:50:47 +03:00
|
|
|
CButton * ok, * exit;
|
2010-06-26 10:01:26 +00:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
std::vector<std::pair<int, std::string>> items; //all items present in list
|
2010-06-26 10:01:26 +00:00
|
|
|
|
2014-03-10 16:00:58 +00:00
|
|
|
void init(CIntObject * titlePic, std::string _title, std::string _descr);
|
2017-06-06 07:53:51 +03:00
|
|
|
void exitPressed();
|
2017-07-20 02:50:47 +03:00
|
|
|
|
2012-01-12 15:23:00 +00:00
|
|
|
public:
|
2017-07-20 02:50:47 +03:00
|
|
|
size_t selected; //index of currently selected item
|
2017-06-06 07:53:51 +03:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
std::function<void()> onExit; //optional exit callback
|
2017-06-06 07:53:51 +03:00
|
|
|
|
2010-06-26 10:01:26 +00:00
|
|
|
/// Callback will be called when OK button is pressed, returns id of selected item. initState = initially selected item
|
2013-06-26 11:18:27 +00:00
|
|
|
/// Image can be nullptr
|
2012-01-12 15:23:00 +00:00
|
|
|
///item names will be taken from map objects
|
2017-07-20 02:50:47 +03:00
|
|
|
CObjectListWindow(const std::vector<int> & _items, CIntObject * titlePic, std::string _title, std::string _descr, std::function<void(int)> Callback);
|
2017-07-03 21:09:27 +03:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
CObjectListWindow(const std::vector<std::string> & _items, CIntObject * titlePic, std::string _title, std::string _descr, std::function<void(int)> Callback);
|
2010-06-26 10:01:26 +00:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
CIntObject * genItem(size_t index);
|
|
|
|
void elementSelected(); //call callback and close this window
|
2012-01-12 15:23:00 +00:00
|
|
|
void changeSelection(size_t which);
|
2017-07-20 02:50:47 +03:00
|
|
|
void keyPressed(const SDL_KeyboardEvent & key) override;
|
2010-06-26 10:01:26 +00:00
|
|
|
};
|
|
|
|
|
2012-06-15 17:08:19 +00:00
|
|
|
class CSystemOptionsWindow : public CWindowObject
|
2009-05-19 18:23:04 +00:00
|
|
|
{
|
|
|
|
private:
|
2017-07-20 02:50:47 +03:00
|
|
|
CLabel * title;
|
|
|
|
CLabelGroup * leftGroup;
|
|
|
|
CLabelGroup * rightGroup;
|
|
|
|
CButton * load, * save, * restart, * mainMenu, * quitGame, * backToMap; //load and restart are not used yet
|
2014-08-03 14:16:19 +03:00
|
|
|
CToggleGroup * heroMoveSpeed;
|
2014-08-11 19:16:39 +03:00
|
|
|
CToggleGroup * enemyMoveSpeed;
|
2014-08-03 14:16:19 +03:00
|
|
|
CToggleGroup * mapScrollSpeed;
|
2015-08-21 23:05:08 -04:00
|
|
|
CVolumeSlider * musicVolume, * effectsVolume;
|
2012-01-12 15:23:00 +00:00
|
|
|
|
|
|
|
//CHighlightableButton * showPath;
|
2014-08-03 14:16:19 +03:00
|
|
|
CToggleButton * showReminder;
|
|
|
|
CToggleButton * quickCombat;
|
|
|
|
CToggleButton * spellbookAnim;
|
|
|
|
CToggleButton * fullscreen;
|
2012-01-12 15:23:00 +00:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
CButton * gameResButton;
|
|
|
|
CLabel * gameResLabel;
|
2012-01-12 15:23:00 +00:00
|
|
|
|
2012-09-30 10:35:17 +00:00
|
|
|
SettingsListener onFullscreenChanged;
|
|
|
|
|
2009-05-19 18:23:04 +00:00
|
|
|
//functions bound to buttons
|
2012-04-09 02:53:50 +00:00
|
|
|
void bloadf(); //load game
|
2009-05-19 18:23:04 +00:00
|
|
|
void bsavef(); //save game
|
|
|
|
void bquitf(); //quit game
|
|
|
|
void breturnf(); //return to game
|
2012-04-09 02:53:50 +00:00
|
|
|
void brestartf(); //restart game
|
2009-11-01 01:15:16 +00:00
|
|
|
void bmainmenuf(); //return to main menu
|
|
|
|
|
2012-05-18 17:35:46 +00:00
|
|
|
void selectGameRes();
|
|
|
|
void setGameRes(int index);
|
2012-09-11 14:25:19 +00:00
|
|
|
void closeAndPushEvent(int eventType, int code = 0);
|
2009-05-19 18:23:04 +00:00
|
|
|
|
2012-01-12 15:23:00 +00:00
|
|
|
public:
|
2017-07-18 00:04:00 +03:00
|
|
|
CSystemOptionsWindow();
|
2009-05-19 18:23:04 +00:00
|
|
|
};
|
|
|
|
|
2012-06-15 17:08:19 +00:00
|
|
|
class CTavernWindow : public CWindowObject
|
2009-05-19 18:23:04 +00:00
|
|
|
{
|
|
|
|
public:
|
2009-08-11 16:05:33 +00:00
|
|
|
class HeroPortrait : public CIntObject
|
2009-05-19 18:23:04 +00:00
|
|
|
{
|
2017-07-20 02:50:47 +03:00
|
|
|
public:
|
2009-05-19 18:23:04 +00:00
|
|
|
std::string hoverName;
|
2014-02-26 21:20:36 +00:00
|
|
|
std::string description; // "XXX is a level Y ZZZ with N artifacts"
|
2017-07-20 02:50:47 +03:00
|
|
|
const CGHeroInstance * h;
|
2010-07-08 23:03:27 +00:00
|
|
|
|
2015-10-12 16:47:10 +03:00
|
|
|
void clickLeft(tribool down, bool previousState) override;
|
|
|
|
void clickRight(tribool down, bool previousState) override;
|
2017-07-20 02:50:47 +03:00
|
|
|
void hover(bool on) override;
|
|
|
|
HeroPortrait(int & sel, int id, int x, int y, const CGHeroInstance * H);
|
2009-05-19 18:23:04 +00:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
private:
|
|
|
|
int * _sel;
|
2011-12-13 21:23:17 +00:00
|
|
|
const int _id;
|
|
|
|
|
2010-07-08 23:03:27 +00:00
|
|
|
} *h1, *h2; //recruitable heroes
|
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
int selected; //0 (left) or 1 (right)
|
|
|
|
int oldSelected; //0 (left) or 1 (right)
|
2009-05-19 18:23:04 +00:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
CButton * thiefGuild, * cancel, * recruit;
|
|
|
|
const CGObjectInstance * tavernObj;
|
2009-05-19 18:23:04 +00:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
CTavernWindow(const CGObjectInstance * TavernObj);
|
2017-07-18 00:04:00 +03:00
|
|
|
~CTavernWindow();
|
2009-05-19 18:23:04 +00:00
|
|
|
|
|
|
|
void recruitb();
|
2010-01-31 18:41:22 +00:00
|
|
|
void thievesguildb();
|
2015-10-12 16:47:10 +03:00
|
|
|
void show(SDL_Surface * to) override;
|
2009-05-19 18:23:04 +00:00
|
|
|
};
|
|
|
|
|
2012-06-15 17:08:19 +00:00
|
|
|
class CExchangeWindow : public CWindowObject, public CWindowWithGarrison, public CWindowWithArtifacts
|
2009-06-16 11:18:14 +00:00
|
|
|
{
|
2011-04-30 18:16:58 +00:00
|
|
|
CGStatusBar * ourBar; //internal statusbar
|
2009-06-19 12:10:36 +00:00
|
|
|
|
2014-08-03 14:16:19 +03:00
|
|
|
CButton * quit, * questlogButton[2];
|
2009-06-16 11:18:14 +00:00
|
|
|
|
2009-06-19 12:10:36 +00:00
|
|
|
std::vector<LRClickableAreaWTextComp *> secSkillAreas[2], primSkillAreas;
|
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
MoraleLuckBox * morale[2], * luck[2];
|
2010-01-31 23:30:47 +00:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
LRClickableAreaWText * specialty[2];
|
|
|
|
LRClickableAreaWText * experience[2];
|
|
|
|
LRClickableAreaWText * spellPoints[2];
|
|
|
|
CHeroArea * portrait[2];
|
2009-06-26 15:41:19 +00:00
|
|
|
|
2009-06-19 12:10:36 +00:00
|
|
|
public:
|
2009-06-16 11:18:14 +00:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
const CGHeroInstance * heroInst[2];
|
2009-06-28 13:49:39 +00:00
|
|
|
CArtifactsOfHero * artifs[2];
|
|
|
|
|
2009-06-19 12:10:36 +00:00
|
|
|
void questlog(int whichHero); //questlog button callback; whichHero: 0 - left, 1 - right
|
|
|
|
|
2009-06-28 13:49:39 +00:00
|
|
|
void prepareBackground(); //prepares or redraws bg
|
|
|
|
|
2017-07-18 00:04:00 +03:00
|
|
|
CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2, QueryID queryID);
|
|
|
|
~CExchangeWindow();
|
2009-06-16 11:18:14 +00:00
|
|
|
};
|
2009-05-19 18:23:04 +00:00
|
|
|
|
2011-02-22 11:52:36 +00:00
|
|
|
/// Here you can buy ships
|
2012-06-15 17:08:19 +00:00
|
|
|
class CShipyardWindow : public CWindowObject
|
2009-07-26 03:33:13 +00:00
|
|
|
{
|
|
|
|
public:
|
2017-07-20 02:50:47 +03:00
|
|
|
CGStatusBar * bar;
|
|
|
|
CPicture * bgWater;
|
2011-09-23 15:58:18 +00:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
CLabel * title;
|
|
|
|
CLabel * costLabel;
|
2011-09-23 15:58:18 +00:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
CAnimImage * woodPic, * goldPic;
|
|
|
|
CLabel * woodCost, * goldCost;
|
2011-09-23 15:58:18 +00:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
CAnimImage * bgShip;
|
|
|
|
CButton * build, * quit;
|
2009-07-26 03:33:13 +00:00
|
|
|
|
2011-09-23 15:58:18 +00:00
|
|
|
CGStatusBar * statusBar;
|
2009-07-26 03:33:13 +00:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
CShipyardWindow(const std::vector<si32> & cost, int state, int boatType, const std::function<void()> & onBuy);
|
2009-07-26 03:33:13 +00:00
|
|
|
};
|
2009-05-19 18:23:04 +00:00
|
|
|
|
2011-02-22 11:52:36 +00:00
|
|
|
/// Puzzle screen which gets uncovered when you visit obilisks
|
2012-06-15 17:08:19 +00:00
|
|
|
class CPuzzleWindow : public CWindowObject
|
2009-08-31 15:57:15 +00:00
|
|
|
{
|
|
|
|
private:
|
2012-06-15 17:08:19 +00:00
|
|
|
int3 grailPos;
|
|
|
|
|
2014-08-03 14:16:19 +03:00
|
|
|
CButton * quitb;
|
2009-08-31 15:57:15 +00:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
std::vector<CPicture *> piecesToRemove;
|
2012-06-15 17:08:19 +00:00
|
|
|
ui8 currentAlpha;
|
2009-08-31 15:57:15 +00:00
|
|
|
|
|
|
|
public:
|
2015-10-12 16:47:10 +03:00
|
|
|
void showAll(SDL_Surface * to) override;
|
|
|
|
void show(SDL_Surface * to) override;
|
2009-08-31 15:57:15 +00:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
CPuzzleWindow(const int3 & grailPos, double discoveredRatio);
|
2009-08-31 15:57:15 +00:00
|
|
|
};
|
|
|
|
|
2011-02-22 11:52:36 +00:00
|
|
|
/// Creature transformer window
|
2012-06-16 22:40:28 +00:00
|
|
|
class CTransformerWindow : public CWindowObject, public CGarrisonHolder
|
2010-07-03 12:00:53 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
class CItem : public CIntObject
|
|
|
|
{
|
2017-07-20 02:50:47 +03:00
|
|
|
public:
|
|
|
|
int id; //position of creature in hero army
|
|
|
|
bool left; //position of the item
|
2010-07-03 12:00:53 +00:00
|
|
|
int size; //size of creature stack
|
|
|
|
CTransformerWindow * parent;
|
2017-07-20 02:50:47 +03:00
|
|
|
CAnimImage * icon;
|
2010-07-03 12:00:53 +00:00
|
|
|
|
|
|
|
void move();
|
2015-10-12 16:47:10 +03:00
|
|
|
void clickLeft(tribool down, bool previousState) override;
|
2012-06-16 22:40:28 +00:00
|
|
|
void update();
|
2012-09-26 13:13:39 +00:00
|
|
|
CItem(CTransformerWindow * parent, int size, int id);
|
2010-07-03 12:00:53 +00:00
|
|
|
};
|
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
const CArmedInstance * army; //object with army for transforming (hero or town)
|
|
|
|
const CGHeroInstance * hero; //only if we have hero in town
|
|
|
|
const CGTownInstance * town; //market, town garrison is used if hero == nullptr
|
|
|
|
std::vector<CItem *> items;
|
2010-07-03 12:00:53 +00:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
CButton * all, * convert, * cancel;
|
|
|
|
CGStatusBar * bar;
|
2010-07-03 12:00:53 +00:00
|
|
|
void makeDeal();
|
|
|
|
void addAll();
|
2015-10-12 16:47:10 +03:00
|
|
|
void updateGarrisons() override;
|
2017-07-18 00:04:00 +03:00
|
|
|
CTransformerWindow(const CGHeroInstance * _hero, const CGTownInstance * _town);
|
2010-07-03 12:00:53 +00:00
|
|
|
};
|
|
|
|
|
2012-06-15 17:08:19 +00:00
|
|
|
class CUniversityWindow : public CWindowObject
|
2010-07-20 14:08:13 +00:00
|
|
|
{
|
2012-05-13 15:04:21 +00:00
|
|
|
class CItem : public CAnimImage
|
2010-07-20 14:08:13 +00:00
|
|
|
{
|
2017-07-20 02:50:47 +03:00
|
|
|
public:
|
|
|
|
int ID; //id of selected skill
|
2010-07-20 14:08:13 +00:00
|
|
|
CUniversityWindow * parent;
|
2010-11-15 15:15:00 +00:00
|
|
|
|
2015-10-12 16:47:10 +03:00
|
|
|
void showAll(SDL_Surface * to) override;
|
|
|
|
void clickLeft(tribool down, bool previousState) override;
|
|
|
|
void clickRight(tribool down, bool previousState) override;
|
|
|
|
void hover(bool on) override;
|
2017-07-20 02:50:47 +03:00
|
|
|
int state(); //0=can't learn, 1=learned, 2=can learn
|
2010-07-20 14:08:13 +00:00
|
|
|
CItem(CUniversityWindow * _parent, int _ID, int X, int Y);
|
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
2017-07-20 02:50:47 +03:00
|
|
|
const CGHeroInstance * hero;
|
2010-07-20 14:08:13 +00:00
|
|
|
const IMarket * market;
|
2010-11-15 15:15:00 +00:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
CPicture * green, * yellow, * red; //colored bars near skills
|
|
|
|
std::vector<CItem *> items;
|
2010-07-20 14:08:13 +00:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
CButton * cancel;
|
|
|
|
CGStatusBar * bar;
|
2010-11-15 15:15:00 +00:00
|
|
|
|
2017-07-18 00:04:00 +03:00
|
|
|
CUniversityWindow(const CGHeroInstance * _hero, const IMarket * _market);
|
2010-07-20 14:08:13 +00:00
|
|
|
};
|
|
|
|
|
2011-02-22 11:52:36 +00:00
|
|
|
/// Confirmation window for University
|
2012-06-15 17:08:19 +00:00
|
|
|
class CUnivConfirmWindow : public CWindowObject
|
2010-07-20 14:08:13 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
CUniversityWindow * parent;
|
2017-07-20 02:50:47 +03:00
|
|
|
CGStatusBar * bar;
|
|
|
|
CButton * confirm, * cancel;
|
2010-07-20 14:08:13 +00:00
|
|
|
|
2017-07-18 00:04:00 +03:00
|
|
|
CUnivConfirmWindow(CUniversityWindow * PARENT, int SKILL, bool available);
|
2010-07-20 14:08:13 +00:00
|
|
|
void makeDeal(int skill);
|
|
|
|
};
|
|
|
|
|
2011-02-22 11:52:36 +00:00
|
|
|
/// Hill fort is the building where you can upgrade units
|
2012-06-15 17:08:19 +00:00
|
|
|
class CHillFortWindow : public CWindowObject, public CWindowWithGarrison
|
2010-07-22 00:32:45 +00:00
|
|
|
{
|
2016-10-16 07:51:07 +03:00
|
|
|
private:
|
|
|
|
static const int slotsCount = 7;
|
|
|
|
//todo: mithril support
|
|
|
|
static const int resCount = 7;
|
2010-07-22 00:32:45 +00:00
|
|
|
|
|
|
|
const CGObjectInstance * fort;
|
|
|
|
const CGHeroInstance * hero;
|
|
|
|
|
2016-10-16 07:51:07 +03:00
|
|
|
CGStatusBar * bar;
|
2017-07-20 02:50:47 +03:00
|
|
|
CHeroArea * heroPic; //clickable hero image
|
|
|
|
CButton * quit; //closes window
|
|
|
|
CButton * upgradeAll; //upgrade all creatures
|
2016-10-16 07:51:07 +03:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
std::array<CButton *, slotsCount> upgrade; //upgrade single creature
|
|
|
|
std::array<int, slotsCount + 1> currState; //current state of slot - to avoid calls to getState or updating buttons
|
2016-10-16 07:51:07 +03:00
|
|
|
|
|
|
|
//there is a place for only 2 resources per slot
|
2017-07-20 02:50:47 +03:00
|
|
|
std::array<std::array<CAnimImage *, 2>, slotsCount> slotIcons;
|
|
|
|
std::array<std::array<CLabel *, 2>, slotsCount> slotLabels;
|
2016-10-16 07:51:07 +03:00
|
|
|
|
|
|
|
std::array<CAnimImage *, resCount> totalIcons;
|
|
|
|
std::array<CLabel *, resCount> totalLabels;
|
2010-11-15 15:15:00 +00:00
|
|
|
|
2017-07-20 02:50:47 +03:00
|
|
|
std::string getDefForSlot(SlotID slot); //return def name for this slot
|
|
|
|
std::string getTextForSlot(SlotID slot); //return hover text for this slot
|
|
|
|
void makeDeal(SlotID slot); //-1 for upgrading all creatures
|
2013-02-16 14:03:47 +00:00
|
|
|
int getState(SlotID slot); //-1 = no creature 0=can't upgrade, 1=upgraded, 2=can upgrade
|
2017-07-20 02:50:47 +03:00
|
|
|
|
2016-10-16 07:51:07 +03:00
|
|
|
public:
|
2017-07-18 00:04:00 +03:00
|
|
|
CHillFortWindow(const CGHeroInstance * visitor, const CGObjectInstance * object);
|
2017-07-20 02:50:47 +03:00
|
|
|
void updateGarrisons() override; //update buttons after garrison changes
|
2010-07-22 00:32:45 +00:00
|
|
|
};
|
|
|
|
|
2012-06-15 17:08:19 +00:00
|
|
|
class CThievesGuildWindow : public CWindowObject
|
2010-01-31 18:41:22 +00:00
|
|
|
{
|
2010-02-01 17:51:33 +00:00
|
|
|
const CGObjectInstance * owner;
|
|
|
|
|
2010-07-08 23:03:27 +00:00
|
|
|
CGStatusBar * statusBar;
|
2014-08-03 14:16:19 +03:00
|
|
|
CButton * exitb;
|
2010-02-04 18:40:40 +00:00
|
|
|
CMinorResDataBar * resdatabar;
|
2010-01-31 18:41:22 +00:00
|
|
|
|
|
|
|
public:
|
2010-02-01 17:51:33 +00:00
|
|
|
CThievesGuildWindow(const CGObjectInstance * _owner);
|
2010-01-31 18:41:22 +00:00
|
|
|
};
|