Merge branch 'feature/creatureWindow' into refactoring/guiClasses
BIN
Mods/vcmi/Data/stackWindow/bonus-effects.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
Mods/vcmi/Data/stackWindow/button-panel.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
Mods/vcmi/Data/stackWindow/commander-abilities.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
Mods/vcmi/Data/stackWindow/commander-bg.png
Normal file
After Width: | Height: | Size: 65 KiB |
BIN
Mods/vcmi/Data/stackWindow/icons.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
Mods/vcmi/Data/stackWindow/info-panel-0.png
Normal file
After Width: | Height: | Size: 88 KiB |
BIN
Mods/vcmi/Data/stackWindow/info-panel-1.png
Normal file
After Width: | Height: | Size: 86 KiB |
BIN
Mods/vcmi/Data/stackWindow/info-panel-2.png
Normal file
After Width: | Height: | Size: 82 KiB |
BIN
Mods/vcmi/Data/stackWindow/spell-effects.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
Mods/vcmi/Sprites/stackWindow/cancel-normal.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
Mods/vcmi/Sprites/stackWindow/cancel-pressed.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
8
Mods/vcmi/Sprites/stackWindow/cancelButton.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"basepath" : "stackWindow/",
|
||||||
|
"images" :
|
||||||
|
[
|
||||||
|
{ "frame" : 0, "file" : "cancel-normal.png"},
|
||||||
|
{ "frame" : 1, "file" : "cancel-pressed.png"}
|
||||||
|
]
|
||||||
|
}
|
BIN
Mods/vcmi/Sprites/stackWindow/level-0.png
Normal file
After Width: | Height: | Size: 182 B |
BIN
Mods/vcmi/Sprites/stackWindow/level-1.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
Mods/vcmi/Sprites/stackWindow/level-10.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
Mods/vcmi/Sprites/stackWindow/level-2.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
Mods/vcmi/Sprites/stackWindow/level-3.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
Mods/vcmi/Sprites/stackWindow/level-4.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
Mods/vcmi/Sprites/stackWindow/level-5.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
Mods/vcmi/Sprites/stackWindow/level-6.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
Mods/vcmi/Sprites/stackWindow/level-7.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
Mods/vcmi/Sprites/stackWindow/level-8.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
Mods/vcmi/Sprites/stackWindow/level-9.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
17
Mods/vcmi/Sprites/stackWindow/levels.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"basepath" : "stackWindow/",
|
||||||
|
"images" :
|
||||||
|
[
|
||||||
|
{ "frame" : 0, "file" : "level-0.png"},
|
||||||
|
{ "frame" : 1, "file" : "level-1.png"},
|
||||||
|
{ "frame" : 2, "file" : "level-2.png"},
|
||||||
|
{ "frame" : 3, "file" : "level-3.png"},
|
||||||
|
{ "frame" : 4, "file" : "level-4.png"},
|
||||||
|
{ "frame" : 5, "file" : "level-5.png"},
|
||||||
|
{ "frame" : 6, "file" : "level-6.png"},
|
||||||
|
{ "frame" : 7, "file" : "level-7.png"},
|
||||||
|
{ "frame" : 8, "file" : "level-8.png"},
|
||||||
|
{ "frame" : 9, "file" : "level-9.png"},
|
||||||
|
{ "frame" : 10,"file" : "level-10.png"}
|
||||||
|
]
|
||||||
|
}
|
7
Mods/vcmi/Sprites/stackWindow/switchModeIcons.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"images" :
|
||||||
|
[
|
||||||
|
{ "frame" : 0, "file" : "SECSK32:69"},
|
||||||
|
{ "frame" : 1, "file" : "SECSK32:28"}
|
||||||
|
]
|
||||||
|
}
|
BIN
Mods/vcmi/Sprites/stackWindow/upgrade-normal.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
Mods/vcmi/Sprites/stackWindow/upgrade-pressed.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
8
Mods/vcmi/Sprites/stackWindow/upgradeButton.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"basepath" : "stackWindow/",
|
||||||
|
"images" :
|
||||||
|
[
|
||||||
|
{ "frame" : 0, "file" : "upgrade-normal.png"},
|
||||||
|
{ "frame" : 1, "file" : "upgrade-pressed.png"}
|
||||||
|
]
|
||||||
|
}
|
@ -15,6 +15,7 @@ For building from source see project wiki at http://wiki.vcmi.eu/
|
|||||||
|
|
||||||
## Copyright and license
|
## Copyright and license
|
||||||
|
|
||||||
VCMI Project is released under GPL version 2 or later
|
VCMI Project source code is licensed under GPL version 2 or later.
|
||||||
|
VCMI Project assets are licensed under CC-BY-SA 4.0. Assets sources and information about contributors are available under following link: [https://github.com/vcmi/vcmi-assets]
|
||||||
|
|
||||||
Copyright (C) 2007-2014 VCMI Team (check AUTHORS file for the contributors list)
|
Copyright (C) 2007-2014 VCMI Team (check AUTHORS file for the contributors list)
|
||||||
|
@ -497,10 +497,12 @@ void CPlayerInterface::commanderGotLevel (const CCommanderInstance * commander,
|
|||||||
waitWhileDialog();
|
waitWhileDialog();
|
||||||
CCS->soundh->playSound(soundBase::heroNewLevel);
|
CCS->soundh->playSound(soundBase::heroNewLevel);
|
||||||
|
|
||||||
CCreatureWindow * cw = new CCreatureWindow(skills, commander,
|
GH.pushInt(new CStackWindow(commander, skills, [=](ui32 selection)
|
||||||
[=](ui32 selection){ cb->selectionMade(selection, queryID); });
|
{
|
||||||
GH.pushInt(cw);
|
cb->selectionMade(selection, queryID);
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlayerInterface::heroInGarrisonChange(const CGTownInstance *town)
|
void CPlayerInterface::heroInGarrisonChange(const CGTownInstance *town)
|
||||||
{
|
{
|
||||||
EVENT_HANDLER_CALLED_BY_CLIENT;
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
||||||
|
@ -671,7 +671,9 @@ CSelectionScreen::CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EMulti
|
|||||||
if(multiPlayer == CMenuScreen::MULTI_NETWORK_GUEST)
|
if(multiPlayer == CMenuScreen::MULTI_NETWORK_GUEST)
|
||||||
{
|
{
|
||||||
SDL_Color orange = {232, 184, 32, 0};
|
SDL_Color orange = {232, 184, 32, 0};
|
||||||
select->text->color = opts->text->color = randomBtn->text->color = orange;
|
dynamic_cast<CLabel*>(select->overlay)->color = orange;
|
||||||
|
dynamic_cast<CLabel*>(opts->overlay)->color = orange;
|
||||||
|
dynamic_cast<CLabel*>(randomBtn->overlay)->color = orange;
|
||||||
select->block(true);
|
select->block(true);
|
||||||
opts->block(true);
|
opts->block(true);
|
||||||
randomBtn->block(true);
|
randomBtn->block(true);
|
||||||
|
@ -2430,7 +2430,7 @@ void CBattleInterface::handleHex(BattleHex myNumber, int eventType)
|
|||||||
{
|
{
|
||||||
cursorFrame = ECursor::COMBAT_QUERY;
|
cursorFrame = ECursor::COMBAT_QUERY;
|
||||||
consoleMsg = (boost::format(CGI->generaltexth->allTexts[297]) % shere->getName()).str();
|
consoleMsg = (boost::format(CGI->generaltexth->allTexts[297]) % shere->getName()).str();
|
||||||
realizeAction = [=]{ GH.pushInt(createCreWindow(shere, true)); };
|
realizeAction = [=]{ GH.pushInt(new CStackWindow(shere, false)); };
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -608,7 +608,7 @@ void CClickableHex::clickRight(tribool down, bool previousState)
|
|||||||
if(!myst->alive()) return;
|
if(!myst->alive()) return;
|
||||||
if(down)
|
if(down)
|
||||||
{
|
{
|
||||||
GH.pushInt(createCreWindow(myst));
|
GH.pushInt(new CStackWindow(myst, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,15 +141,16 @@ typename boost::enable_if_c<boost::is_unsigned<T>::type, T>::type abs(T arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename IntType>
|
template<typename IntType>
|
||||||
std::string makeNumberShort(IntType number) //the output is a string containing at most 5 characters [4 if positive] (eg. intead 10000 it gives 10k)
|
std::string makeNumberShort(IntType number, IntType maxLength = 3) //the output is a string containing at most 5 characters [4 if positive] (eg. intead 10000 it gives 10k)
|
||||||
{
|
{
|
||||||
if (abs(number) < 1000)
|
IntType max = pow(10, maxLength);
|
||||||
|
if (abs(number) < max)
|
||||||
return boost::lexical_cast<std::string>(number);
|
return boost::lexical_cast<std::string>(number);
|
||||||
|
|
||||||
std::string symbols = "kMGTPE";
|
std::string symbols = " kMGTPE";
|
||||||
auto iter = symbols.begin();
|
auto iter = symbols.begin();
|
||||||
|
|
||||||
while (number >= 1000)
|
while (number >= max)
|
||||||
{
|
{
|
||||||
number /= 1000;
|
number /= 1000;
|
||||||
iter++;
|
iter++;
|
||||||
|
@ -210,7 +210,7 @@ CButtonBase::CButtonBase()
|
|||||||
bitmapOffset = 0;
|
bitmapOffset = 0;
|
||||||
state=NORMAL;
|
state=NORMAL;
|
||||||
image = nullptr;
|
image = nullptr;
|
||||||
text = nullptr;
|
overlay = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CButtonBase::~CButtonBase()
|
CButtonBase::~CButtonBase()
|
||||||
@ -220,12 +220,12 @@ CButtonBase::~CButtonBase()
|
|||||||
|
|
||||||
void CButtonBase::update()
|
void CButtonBase::update()
|
||||||
{
|
{
|
||||||
if (text)
|
if (overlay)
|
||||||
{
|
{
|
||||||
if (state == PRESSED)
|
if (state == PRESSED)
|
||||||
text->moveTo(Point(pos.x+pos.w/2+1, pos.y+pos.h/2+1));
|
overlay->moveTo(overlay->pos.centerIn(pos).topLeft() + Point(1,1));
|
||||||
else
|
else
|
||||||
text->moveTo(Point(pos.x+pos.w/2, pos.y+pos.h/2));
|
overlay->moveTo(overlay->pos.centerIn(pos).topLeft());
|
||||||
}
|
}
|
||||||
|
|
||||||
int newPos = (int)state + bitmapOffset;
|
int newPos = (int)state + bitmapOffset;
|
||||||
@ -251,8 +251,16 @@ void CButtonBase::update()
|
|||||||
void CButtonBase::addTextOverlay( const std::string &Text, EFonts font, SDL_Color color)
|
void CButtonBase::addTextOverlay( const std::string &Text, EFonts font, SDL_Color color)
|
||||||
{
|
{
|
||||||
OBJ_CONSTRUCTION_CAPTURING_ALL;
|
OBJ_CONSTRUCTION_CAPTURING_ALL;
|
||||||
delete text;
|
addOverlay(new CLabel(pos.w/2, pos.h/2, font, CENTER, color, Text));
|
||||||
text = new CLabel(pos.w/2, pos.h/2, font, CENTER, color, Text);
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CButtonBase::addOverlay(CIntObject *newOverlay)
|
||||||
|
{
|
||||||
|
delete overlay;
|
||||||
|
overlay = newOverlay;
|
||||||
|
addChild(newOverlay);
|
||||||
|
overlay->moveTo(overlay->pos.centerIn(pos).topLeft());
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1154,14 +1162,15 @@ CHoverableArea::~CHoverableArea()
|
|||||||
|
|
||||||
void LRClickableAreaWText::clickLeft(tribool down, bool previousState)
|
void LRClickableAreaWText::clickLeft(tribool down, bool previousState)
|
||||||
{
|
{
|
||||||
if(!down && previousState)
|
if(!down && previousState && !text.empty())
|
||||||
{
|
{
|
||||||
LOCPLINT->showInfoDialog(text);
|
LOCPLINT->showInfoDialog(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void LRClickableAreaWText::clickRight(tribool down, bool previousState)
|
void LRClickableAreaWText::clickRight(tribool down, bool previousState)
|
||||||
{
|
{
|
||||||
adventureInt->handleRightClick(text, down);
|
if (!text.empty())
|
||||||
|
adventureInt->handleRightClick(text, down);
|
||||||
}
|
}
|
||||||
|
|
||||||
LRClickableAreaWText::LRClickableAreaWText()
|
LRClickableAreaWText::LRClickableAreaWText()
|
||||||
|
@ -100,7 +100,9 @@ public:
|
|||||||
bool swappedImages,//fix for some buttons: normal and pressed image are swapped
|
bool swappedImages,//fix for some buttons: normal and pressed image are swapped
|
||||||
keepFrame; // don't change visual representation
|
keepFrame; // don't change visual representation
|
||||||
|
|
||||||
|
void addOverlay(CIntObject * newOverlay);
|
||||||
void addTextOverlay(const std::string &Text, EFonts font, SDL_Color color = Colors::WHITE);
|
void addTextOverlay(const std::string &Text, EFonts font, SDL_Color color = Colors::WHITE);
|
||||||
|
|
||||||
void update();//to refresh button after image or text change
|
void update();//to refresh button after image or text change
|
||||||
|
|
||||||
void setOffset(int newOffset);
|
void setOffset(int newOffset);
|
||||||
@ -113,7 +115,7 @@ public:
|
|||||||
bool isHighlighted();
|
bool isHighlighted();
|
||||||
|
|
||||||
CAnimImage * image; //image for this button
|
CAnimImage * image; //image for this button
|
||||||
CLabel * text;//text overlay
|
CIntObject * overlay;//object-overlay
|
||||||
|
|
||||||
CButtonBase(); //c-tor
|
CButtonBase(); //c-tor
|
||||||
virtual ~CButtonBase(); //d-tor
|
virtual ~CButtonBase(); //d-tor
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include "../../lib/HeroBonus.h"
|
#include "../../lib/HeroBonus.h"
|
||||||
#include "../gui/CIntObject.h"
|
#include "../gui/CIntObject.h"
|
||||||
#include "../widgets/CArtifactHolder.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CCreatureWindow.h, part of VCMI engine
|
* CCreatureWindow.h, part of VCMI engine
|
||||||
@ -14,150 +13,106 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct Bonus;
|
class StackWindowInfo;
|
||||||
class CCreature;
|
|
||||||
class CStackInstance;
|
|
||||||
class CCommanderInstance;
|
class CCommanderInstance;
|
||||||
|
class CStackInstance;
|
||||||
class CStack;
|
class CStack;
|
||||||
struct ArtifactLocation;
|
|
||||||
class CCreatureArtifactInstance;
|
|
||||||
class CAdventureMapButton;
|
|
||||||
class CBonusItem;
|
|
||||||
class CGHeroInstance;
|
|
||||||
class CComponent;
|
|
||||||
class LRClickableAreaWText;
|
|
||||||
class MoraleLuckBox;
|
|
||||||
class CAdventureMapButton;
|
|
||||||
struct UpgradeInfo;
|
struct UpgradeInfo;
|
||||||
class CPicture;
|
|
||||||
class CCreaturePic;
|
|
||||||
class LRClickableAreaWTextComp;
|
class LRClickableAreaWTextComp;
|
||||||
class CSlider;
|
|
||||||
class CLabel;
|
|
||||||
class CAnimImage;
|
|
||||||
class CSelectableSkill;
|
|
||||||
|
|
||||||
// New creature window
|
class CClickableObject : public LRClickableAreaWText
|
||||||
class CCreatureWindow : public CWindowObject, public CArtifactHolder
|
|
||||||
{
|
{
|
||||||
|
CIntObject * object; // passive object that will be used to determine clickable area
|
||||||
public:
|
public:
|
||||||
enum CreWinType {OTHER = 0, BATTLE = 1, ARMY = 2, HERO = 3, COMMANDER = 4, COMMANDER_LEVEL_UP = 5, COMMANDER_BATTLE = 6}; // > 3 are opened permanently
|
CClickableObject(CIntObject * object, std::function<void()> callback);
|
||||||
//bool active; //TODO: comment me
|
|
||||||
CreWinType type;
|
|
||||||
int bonusRows; //height of skill window
|
|
||||||
ArtifactPosition displayedArtifact;
|
|
||||||
|
|
||||||
std::string count; //creature count in text format
|
|
||||||
const CCreature *c; //related creature
|
|
||||||
const CStackInstance *stack;
|
|
||||||
const CBonusSystemNode *stackNode;
|
|
||||||
const CCommanderInstance * commander;
|
|
||||||
const CGHeroInstance *heroOwner;
|
|
||||||
const CArtifactInstance *creatureArtifact; //currently worn artifact
|
|
||||||
std::vector<CComponent*> upgResCost; //cost of upgrade (if not possible then empty)
|
|
||||||
std::vector<CBonusItem*> bonusItems;
|
|
||||||
std::vector<LRClickableAreaWText*> spellEffects;
|
|
||||||
|
|
||||||
CCreaturePic *anim; //related creature's animation
|
|
||||||
MoraleLuckBox *luck, *morale;
|
|
||||||
LRClickableAreaWTextComp * expArea; //displays exp details
|
|
||||||
CSlider * slider; //Abilities
|
|
||||||
CAdventureMapButton *dismiss, *upgrade, *ok;
|
|
||||||
CAdventureMapButton * leftArtRoll, * rightArtRoll; //artifact selection
|
|
||||||
CAdventureMapButton * passArtToHero;
|
|
||||||
CAnimImage * artifactImage;
|
|
||||||
CAnimation * spellEffectsPics; //bitmaps representing spells affecting a stack in battle
|
|
||||||
|
|
||||||
//commander level-up
|
|
||||||
int selectedOption; //index for upgradeOptions
|
|
||||||
std::vector<ui32> upgradeOptions; //value 0-5 - secondary skills, 100+ - special skills
|
|
||||||
std::vector<CSelectableSkill *> selectableSkills, selectableBonuses;
|
|
||||||
std::vector<CPicture *> skillPictures; //secondary skills
|
|
||||||
|
|
||||||
std::string skillToFile(int skill); //return bitmap for secondary skill depending on selection / avaliability
|
|
||||||
void selectSkill (ui32 which);
|
|
||||||
void setArt(const CArtifactInstance *creatureArtifact);
|
|
||||||
|
|
||||||
void artifactRemoved (const ArtifactLocation &artLoc);
|
|
||||||
void artifactMoved (const ArtifactLocation &artLoc, const ArtifactLocation &destLoc);
|
|
||||||
void artifactDisassembled (const ArtifactLocation &artLoc) {return;};
|
|
||||||
void artifactAssembled (const ArtifactLocation &artLoc) {return;};
|
|
||||||
|
|
||||||
std::function<void()> dsm; //dismiss button callback
|
|
||||||
std::function<void()> Upg; //upgrade button callback
|
|
||||||
std::function<void(ui32)> levelUp; //choose commander skill to level up
|
|
||||||
|
|
||||||
CCreatureWindow(const CStack & stack, CreWinType type); //battle c-tor
|
|
||||||
CCreatureWindow (const CStackInstance &stack, CreWinType Type); //pop-up c-tor
|
|
||||||
CCreatureWindow(const CStackInstance &st, CreWinType Type, std::function<void()> Upg, std::function<void()> Dsm, UpgradeInfo *ui); //full garrison window
|
|
||||||
CCreatureWindow(const CCommanderInstance * commander, const CStack * stack = nullptr); //commander window
|
|
||||||
CCreatureWindow(std::vector<ui32> &skills, const CCommanderInstance * commander, std::function<void(ui32)> callback);
|
|
||||||
CCreatureWindow(CreatureID Cid, CreWinType Type, int creatureCount); //c-tor
|
|
||||||
|
|
||||||
void init(const CStackInstance *stack, const CBonusSystemNode *stackNode, const CGHeroInstance *heroOwner);
|
|
||||||
void showAll(SDL_Surface * to);
|
|
||||||
void show(SDL_Surface * to);
|
|
||||||
void printLine(int nr, const std::string &text, int baseVal, int val=-1, bool range=false);
|
|
||||||
void sliderMoved(int newpos);
|
|
||||||
void close();
|
|
||||||
~CCreatureWindow(); //d-tor
|
|
||||||
|
|
||||||
void recreateSkillList(int pos);
|
|
||||||
void scrollArt(int dir);
|
|
||||||
void passArtifactToHero();
|
|
||||||
};
|
|
||||||
|
|
||||||
class CBonusItem : public LRClickableAreaWTextComp //responsible for displaying creature skill, active or not
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
std::string name, description;
|
|
||||||
CPicture * bonusGraphics;
|
|
||||||
bool visible;
|
|
||||||
|
|
||||||
CBonusItem();
|
|
||||||
CBonusItem(const Rect &Pos, const std::string &Name, const std::string &Description, const std::string &graphicsName);
|
|
||||||
~CBonusItem();
|
|
||||||
|
|
||||||
void showAll (SDL_Surface * to);
|
|
||||||
};
|
|
||||||
|
|
||||||
class CSelectableSkill : public LRClickableAreaWText
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
std::function<void()> callback; //TODO: create more generic clickable class than AdvMapButton?
|
std::function<void()> callback; //TODO: create more generic clickable class than AdvMapButton?
|
||||||
|
|
||||||
virtual void clickLeft(tribool down, bool previousState);
|
void clickLeft(tribool down, bool previousState) override;
|
||||||
virtual void clickRight(tribool down, bool previousState){};
|
//void clickRight(tribool down, bool previousState){};
|
||||||
|
|
||||||
|
void setObject(CIntObject * object);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// original creature info window
|
class CStackWindow : public CWindowObject
|
||||||
class CCreInfoWindow : public CWindowObject
|
|
||||||
{
|
{
|
||||||
|
struct BonusInfo
|
||||||
|
{
|
||||||
|
std::string name;
|
||||||
|
std::string description;
|
||||||
|
std::string imagePath;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CWindowSection : public CIntObject
|
||||||
|
{
|
||||||
|
CStackWindow * parent;
|
||||||
|
|
||||||
|
CPicture * background;
|
||||||
|
|
||||||
|
void createBackground(std::string path);
|
||||||
|
void createBonusItem(size_t index, Point position);
|
||||||
|
|
||||||
|
void printStatString(int index, std::string name, std::string value);
|
||||||
|
void printStatRange(int index, std::string name, int min, int max);
|
||||||
|
void printStatBase(int index, std::string name, int base, int current);
|
||||||
|
void printStat(int index, std::string name, int value);
|
||||||
|
public:
|
||||||
|
void createStackInfo(bool showExp, bool showArt);
|
||||||
|
void createActiveSpells();
|
||||||
|
void createCommanderSection();
|
||||||
|
void createCommander();
|
||||||
|
void createCommanderAbilities();
|
||||||
|
void createBonuses(boost::optional<size_t> size = boost::optional<size_t>());
|
||||||
|
void createBonusEntry(size_t index);
|
||||||
|
void createButtonPanel();
|
||||||
|
|
||||||
|
CWindowSection(CStackWindow * parent);
|
||||||
|
};
|
||||||
|
|
||||||
|
CAnimImage * stackArtifactIcon;
|
||||||
|
LRClickableAreaWTextComp * stackArtifactHelp;
|
||||||
|
CAdventureMapButton * stackArtifactButton;
|
||||||
|
|
||||||
|
std::unique_ptr<StackWindowInfo> info;
|
||||||
|
std::vector<BonusInfo> activeBonuses;
|
||||||
|
size_t activeTab;
|
||||||
|
CTabbedInt * commanderTab;
|
||||||
|
|
||||||
|
std::map<int, CAdventureMapButton *> switchButtons;
|
||||||
|
|
||||||
|
void setSelection(si32 newSkill, CClickableObject * newIcon);
|
||||||
|
CClickableObject * selectedIcon;
|
||||||
|
si32 selectedSkill;
|
||||||
|
|
||||||
|
CIntObject * createBonusEntry(size_t index);
|
||||||
|
CIntObject * switchTab(size_t index);
|
||||||
|
|
||||||
|
void removeStackArtifact(ArtifactPosition pos);
|
||||||
|
void setStackArtifact(const CArtifactInstance * art, Point artPos);
|
||||||
|
|
||||||
|
void initSections();
|
||||||
|
void initBonusesList();
|
||||||
|
|
||||||
|
void init();
|
||||||
|
|
||||||
|
std::string generateStackExpDescription();
|
||||||
|
|
||||||
|
CIntObject * createSkillEntry(int index);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CLabel * creatureCount;
|
// for battles
|
||||||
CLabel * creatureName;
|
CStackWindow(const CStack * stack, bool popup);
|
||||||
CLabel * abilityText;
|
|
||||||
|
|
||||||
CCreaturePic * animation;
|
// for non-existing stacks, e.g. recruit screen
|
||||||
std::vector<CComponent *> upgResCost; //cost of upgrade (if not possible then empty)
|
CStackWindow(const CCreature * creature, bool popup);
|
||||||
std::vector<CAnimImage *> effects;
|
|
||||||
std::map<size_t, std::pair<CLabel *, CLabel * > > infoTexts;
|
|
||||||
|
|
||||||
MoraleLuckBox * luck, * morale;
|
// for normal stacks in armies
|
||||||
|
CStackWindow(const CStackInstance * stack, bool popup);
|
||||||
|
CStackWindow(const CStackInstance * stack, std::function<void()> dismiss, const UpgradeInfo & info, std::function<void(CreatureID)> callback);
|
||||||
|
|
||||||
CAdventureMapButton * dismiss, * upgrade, * ok;
|
// for commanders & commander level-up dialog
|
||||||
|
CStackWindow(const CCommanderInstance * commander, bool popup);
|
||||||
|
CStackWindow(const CCommanderInstance * commander, std::vector<ui32> &skills, std::function<void(ui32)> callback);
|
||||||
|
|
||||||
CCreInfoWindow(const CStackInstance & st, bool LClicked, std::function<void()> Upg = nullptr, std::function<void()> Dsm = nullptr, UpgradeInfo * ui = nullptr);
|
~CStackWindow();
|
||||||
CCreInfoWindow(const CStack & st, bool LClicked = 0);
|
|
||||||
CCreInfoWindow(int Cid, bool LClicked, int creatureCount);
|
|
||||||
~CCreInfoWindow();
|
|
||||||
|
|
||||||
void init(const CCreature * cre, const CBonusSystemNode * stackNode, const CGHeroInstance * heroOwner, int creatureCount, bool LClicked);
|
|
||||||
void printLine(int nr, const std::string & text, int baseVal, int val = -1, bool range = false);
|
|
||||||
|
|
||||||
void show(SDL_Surface * to);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CIntObject *createCreWindow(const CStack *s, bool lclick = false);
|
|
||||||
CIntObject *createCreWindow(CreatureID Cid, CCreatureWindow::CreWinType Type, int creatureCount);
|
|
||||||
CIntObject *createCreWindow(const CStackInstance *s, CCreatureWindow::CreWinType type, std::function<void()> Upg = nullptr, std::function<void()> Dsm = nullptr, UpgradeInfo *ui = nullptr);
|
|
||||||
|
@ -329,7 +329,7 @@ void CHeroWindow::commanderWindow()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
GH.pushInt(new CCreatureWindow (curHero->commander));
|
GH.pushInt(new CStackWindow(curHero->commander, false));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,5 +54,23 @@
|
|||||||
"anyOf" : "Any of the following:",
|
"anyOf" : "Any of the following:",
|
||||||
"allOf" : "All of the following:",
|
"allOf" : "All of the following:",
|
||||||
"noneOf" : "None of the following:"
|
"noneOf" : "None of the following:"
|
||||||
|
},
|
||||||
|
"creatureWindow" :
|
||||||
|
{
|
||||||
|
"showBonuses" :
|
||||||
|
{
|
||||||
|
"label" : "Switch to bonuses view",
|
||||||
|
"help" : "Displays all active bonuses of the commander"
|
||||||
|
},
|
||||||
|
"showSkills" :
|
||||||
|
{
|
||||||
|
"label" : "Switch to skills view",
|
||||||
|
"help" : "Displays all learned skills of the commander"
|
||||||
|
},
|
||||||
|
"returnArtifact" :
|
||||||
|
{
|
||||||
|
"label" : "Give back artifact",
|
||||||
|
"help" : "Use this button to return stack artifact back into hero backpack"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -459,7 +459,18 @@ CGeneralTextHandler::CGeneralTextHandler()
|
|||||||
{
|
{
|
||||||
CLegacyConfigParser parser("DATA/ZCREXP.TXT");
|
CLegacyConfigParser parser("DATA/ZCREXP.TXT");
|
||||||
parser.endLine();//header
|
parser.endLine();//header
|
||||||
do
|
for (size_t iter=0; iter<325; iter++)
|
||||||
|
{
|
||||||
|
parser.readString(); //ignore 1st column with description
|
||||||
|
zcrexp.push_back(parser.readString());
|
||||||
|
parser.endLine();
|
||||||
|
}
|
||||||
|
// line 325 - some weird formatting here
|
||||||
|
zcrexp.push_back(parser.readString());
|
||||||
|
parser.readString();
|
||||||
|
parser.endLine();
|
||||||
|
|
||||||
|
do // rest of file can be read normally
|
||||||
{
|
{
|
||||||
parser.readString(); //ignore 1st column with description
|
parser.readString(); //ignore 1st column with description
|
||||||
zcrexp.push_back(parser.readString());
|
zcrexp.push_back(parser.readString());
|
||||||
|