|
|
@@ -1,10 +1,10 @@
|
|
|
#include "CKingdomInterface.h"
|
|
|
#include "AdventureMapButton.h"
|
|
|
#include "CAdvmapInterface.h"
|
|
|
-#include "../CCallback.h"
|
|
|
+#include "../CCallback.h"
|
|
|
#include "CConfigHandler.h"
|
|
|
#include "CGameInfo.h"
|
|
|
-#include "CHeroWindow.h"
|
|
|
+#include "CHeroWindow.h"
|
|
|
#include "CSpellWindow.h"
|
|
|
#include "CMessage.h"
|
|
|
#include "SDL_Extensions.h"
|
|
|
@@ -13,11 +13,12 @@
|
|
|
#include "../hch/CDefHandler.h"
|
|
|
#include "../hch/CGeneralTextHandler.h"
|
|
|
#include "../hch/CObjectHandler.h"
|
|
|
+#include "../hch/CHeroHandler.h"
|
|
|
#include "../hch/CTownHandler.h"
|
|
|
#include "../lib/map.h"
|
|
|
#include "../lib/NetPacks.h"
|
|
|
-#include <boost/assign/std/vector.hpp>
|
|
|
-#include <boost/assign/list_of.hpp>
|
|
|
+#include <boost/assign/std/vector.hpp>
|
|
|
+#include <boost/assign/list_of.hpp>
|
|
|
#include <boost/format.hpp>
|
|
|
#include <sstream>
|
|
|
using namespace boost::assign;
|
|
|
@@ -32,7 +33,7 @@ using namespace CSDL_Ext;
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
*
|
|
|
*/
|
|
|
-
|
|
|
+
|
|
|
#define ADVOPT (conf.go()->ac)
|
|
|
CDefEssential* CKingdomInterface::slots;
|
|
|
CDefEssential* CKingdomInterface::fort;
|
|
|
@@ -42,22 +43,22 @@ CKingdomInterface::CKingdomInterface()
|
|
|
{
|
|
|
OBJ_CONSTRUCTION_CAPTURING_ALL;
|
|
|
defActions =/* ACTIVATE | DEACTIVATE | */SHARE_POS | DISPOSE;
|
|
|
- PicCount = ADVOPT.overviewPics;
|
|
|
- size = ADVOPT.overviewSize;
|
|
|
+ PicCount = ADVOPT.overviewPics;
|
|
|
+ size = ADVOPT.overviewSize;
|
|
|
pos.x = screen->w/2 - 400;
|
|
|
pos.y = screen->h/2 - (68+58*size);
|
|
|
heroPos = townPos = objPos = 0;
|
|
|
state = 0;
|
|
|
- showHarrisoned = false;//set to true if you want to see garrisoned heroes
|
|
|
+ showHarrisoned = false;//set to true if you want to see garrisoned heroes
|
|
|
|
|
|
- bg = BitmapHandler::loadBitmap(ADVOPT.overviewBg);
|
|
|
+ bg = BitmapHandler::loadBitmap(ADVOPT.overviewBg);
|
|
|
graphics->blueToPlayersAdv(bg, LOCPLINT->playerID);
|
|
|
mines = CDefHandler::giveDefEss("OVMINES.DEF");
|
|
|
title = CDefHandler::giveDefEss("OVTITLE.DEF");
|
|
|
hall = CDefHandler::giveDefEss("ITMTL.DEF");
|
|
|
fort = CDefHandler::giveDefEss("ITMCL.DEF");
|
|
|
- objPics = CDefHandler::giveDefEss("FLAGPORT.DEF");
|
|
|
- slots = CDefHandler::giveDefEss("OVSLOT.DEF");
|
|
|
+ objPics = CDefHandler::giveDefEss("FLAGPORT.DEF");
|
|
|
+ slots = CDefHandler::giveDefEss("OVSLOT.DEF");
|
|
|
|
|
|
toHeroes = new AdventureMapButton (CGI->generaltexth->overview[11],"",
|
|
|
boost::bind(&CKingdomInterface::listToHeroes,this),748,28+size*116,"OVBUTN1.DEF");
|
|
|
@@ -73,9 +74,9 @@ CKingdomInterface::CKingdomInterface()
|
|
|
|
|
|
statusbar = new CStatusBar(pos.x+7,pos.y+91+size*116,"TSTATBAR.bmp",732);
|
|
|
resdatabar = new CResDataBar("KRESBAR.bmp",pos.x+3,pos.y+111+size*116,32,2,76,76);
|
|
|
-
|
|
|
- for (int i = 0; i<size; i++)
|
|
|
- blitAt(slots->ourImages[PicCount].bitmap,23,26+i*116,bg);
|
|
|
+
|
|
|
+ for (int i = 0; i<size; i++)
|
|
|
+ blitAt(slots->ourImages[PicCount].bitmap,23,26+i*116,bg);
|
|
|
|
|
|
for (size_t i=0; i<RESOURCE_QUANTITY; i++)
|
|
|
incomes.push_back(new CResIncomePic(i,mines,this));//bottom panel with mines
|
|
|
@@ -178,7 +179,7 @@ CKingdomInterface::~CKingdomInterface()
|
|
|
delete slots;
|
|
|
delete fort;
|
|
|
delete hall;
|
|
|
- delete mines;
|
|
|
+ delete mines;
|
|
|
delete objPics;
|
|
|
|
|
|
towns.clear();//deleting lists
|
|
|
@@ -256,12 +257,12 @@ void CKingdomInterface::showAll( SDL_Surface * to/*=NULL*/)
|
|
|
}
|
|
|
|
|
|
void CKingdomInterface::show(SDL_Surface * to)
|
|
|
-{
|
|
|
+{
|
|
|
statusbar->show(to);
|
|
|
}
|
|
|
|
|
|
void CKingdomInterface::activate()
|
|
|
-{
|
|
|
+{
|
|
|
LOCPLINT->statusbar = statusbar;
|
|
|
exit->activate();
|
|
|
toTowns->activate();
|
|
|
@@ -303,7 +304,7 @@ void CKingdomInterface::deactivate()
|
|
|
|
|
|
for (size_t i=0; i<incomes.size(); i++)
|
|
|
incomes[i]->deactivate();
|
|
|
-
|
|
|
+
|
|
|
if (state == 1)
|
|
|
for (size_t i=0; i<size; i++)
|
|
|
towns[i]->deactivate();
|
|
|
@@ -329,7 +330,7 @@ void CKingdomInterface::recreateHeroList(int pos)
|
|
|
{
|
|
|
cnt++;
|
|
|
continue;
|
|
|
- }//this hero will be added
|
|
|
+ }//this hero will be added
|
|
|
heroes[i]->setHero(Heroes[j]);
|
|
|
i++;
|
|
|
}
|
|
|
@@ -359,11 +360,11 @@ void CKingdomInterface::listToTowns()
|
|
|
heroPos = slider->value;
|
|
|
slider->setAmount(LOCPLINT->cb->howManyTowns());
|
|
|
slider->value=townPos;//moving slider
|
|
|
- recreateTownList(townPos);
|
|
|
- for (size_t i=0;i<size;i++)
|
|
|
- {
|
|
|
- heroes[i]->deactivate();
|
|
|
- towns[i]->activate();
|
|
|
+ recreateTownList(townPos);
|
|
|
+ for (size_t i=0;i<size;i++)
|
|
|
+ {
|
|
|
+ heroes[i]->deactivate();
|
|
|
+ towns[i]->activate();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -375,37 +376,37 @@ void CKingdomInterface::listToHeroes()
|
|
|
townPos = slider->value;
|
|
|
slider->setAmount(LOCPLINT->cb->howManyHeroes(showHarrisoned));
|
|
|
slider->value=heroPos;//moving slider
|
|
|
- recreateHeroList(heroPos);
|
|
|
- for (size_t i=0;i<size;i++)
|
|
|
- {
|
|
|
- towns[i]->deactivate();
|
|
|
- heroes[i]->activate();
|
|
|
+ recreateHeroList(heroPos);
|
|
|
+ for (size_t i=0;i<size;i++)
|
|
|
+ {
|
|
|
+ towns[i]->deactivate();
|
|
|
+ heroes[i]->activate();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void CKingdomInterface::sliderMoved(int newpos)
|
|
|
-{
|
|
|
- if (state == 0)
|
|
|
+{
|
|
|
+ if (state == 0)
|
|
|
{
|
|
|
townPos = newpos;
|
|
|
- recreateHeroList(newpos);
|
|
|
+ recreateHeroList(newpos);
|
|
|
state = 2;
|
|
|
}
|
|
|
else if ( state == 1 )//towns
|
|
|
- {
|
|
|
+ {
|
|
|
for (size_t i=0; i<size; i++)
|
|
|
towns[i]->deactivate();
|
|
|
townPos = newpos;
|
|
|
- recreateTownList(newpos);
|
|
|
+ recreateTownList(newpos);
|
|
|
for (size_t i=0; i<size; i++)
|
|
|
towns[i]->activate();
|
|
|
}
|
|
|
else//heroes
|
|
|
- {
|
|
|
+ {
|
|
|
for (size_t i=0; i<size; i++)
|
|
|
heroes[i]->deactivate();
|
|
|
heroPos = newpos;
|
|
|
- recreateHeroList(newpos);
|
|
|
+ recreateHeroList(newpos);
|
|
|
for (size_t i=0; i<size; i++)
|
|
|
heroes[i]->activate();
|
|
|
}
|
|
|
@@ -492,7 +493,7 @@ void CKingdomInterface::CResIncomePic::show(SDL_Surface * to)
|
|
|
|
|
|
CKingdomInterface::CTownItem::CTownItem(int num, CKingdomInterface * Owner)
|
|
|
{
|
|
|
- recActions = DISPOSE | SHARE_POS;
|
|
|
+ recActions = DISPOSE | SHARE_POS;
|
|
|
owner = Owner;
|
|
|
numb = num;
|
|
|
pos.x += 23;
|
|
|
@@ -505,11 +506,11 @@ CKingdomInterface::CTownItem::CTownItem(int num, CKingdomInterface * Owner)
|
|
|
CKingdomInterface::CTownItem::~CTownItem()
|
|
|
{
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
void CKingdomInterface::CTownItem::setTown(const CGTownInstance * newTown)
|
|
|
-{
|
|
|
+{
|
|
|
town = newTown;
|
|
|
-}
|
|
|
+}
|
|
|
|
|
|
void CKingdomInterface::CTownItem::activate()
|
|
|
{
|
|
|
@@ -518,7 +519,7 @@ void CKingdomInterface::CTownItem::activate()
|
|
|
void CKingdomInterface::CTownItem::deactivate()
|
|
|
{
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
void CKingdomInterface::CTownItem::showAll(SDL_Surface * to)
|
|
|
{
|
|
|
if (!town)
|
|
|
@@ -600,37 +601,37 @@ void CKingdomInterface::CTownItem::showAll(SDL_Surface * to)
|
|
|
}
|
|
|
|
|
|
CKingdomInterface::CHeroItem::CHeroItem(int num, CKingdomInterface * Owner)
|
|
|
-{
|
|
|
- OBJ_CONSTRUCTION_CAPTURING_ALL;
|
|
|
- recActions = DISPOSE | SHARE_POS;
|
|
|
- defActions = SHARE_POS;
|
|
|
- owner = Owner;
|
|
|
+{
|
|
|
+ OBJ_CONSTRUCTION_CAPTURING_ALL;
|
|
|
+ recActions = DISPOSE | SHARE_POS;
|
|
|
+ defActions = SHARE_POS;
|
|
|
+ owner = Owner;
|
|
|
numb = num;
|
|
|
pos.x += 23;
|
|
|
pos.y += 26+num*116;
|
|
|
pos.w = 702;
|
|
|
pos.h = 114;
|
|
|
- hero = NULL;
|
|
|
+ hero = NULL;
|
|
|
garr = NULL;
|
|
|
- artGroup = 0;
|
|
|
- backpackPos = 0;
|
|
|
- artButtons = new CHighlightableButtonsGroup(0);
|
|
|
- for (size_t it = 0; it<3; it++)
|
|
|
- {
|
|
|
- artButtons->addButton(boost::assign::map_list_of(0,CGI->generaltexth->overview[13+it]),
|
|
|
- CGI->generaltexth->overview[8+it], "OVBUTN3.DEF",364+it*112, 46, it);
|
|
|
- std::string str = CGI->generaltexth->overview[8+it];//TODO:find function for this if any
|
|
|
- str = str.substr(str.find_first_of("{"), str.find_first_of("}")-str.find_first_of("{"));
|
|
|
+ artGroup = 0;
|
|
|
+ backpackPos = 0;
|
|
|
+ artButtons = new CHighlightableButtonsGroup(0);
|
|
|
+ for (size_t it = 0; it<3; it++)
|
|
|
+ {
|
|
|
+ artButtons->addButton(boost::assign::map_list_of(0,CGI->generaltexth->overview[13+it]),
|
|
|
+ CGI->generaltexth->overview[8+it], "OVBUTN3.DEF",364+it*112, 46, it);
|
|
|
+ std::string str = CGI->generaltexth->overview[8+it];//TODO:find function for this if any
|
|
|
+ str = str.substr(str.find_first_of("{"), str.find_first_of("}")-str.find_first_of("{"));
|
|
|
artButtons->buttons[it]->addTextOverlay(str, FONT_SMALL, tytulowy);
|
|
|
- }
|
|
|
- artButtons->onChange = boost::bind(&CKingdomInterface::CHeroItem::onArtChange, this, _1);
|
|
|
- artButtons->select(0,0);
|
|
|
-
|
|
|
- artLeft = new AdventureMapButton("", "", boost::bind
|
|
|
+ }
|
|
|
+ artButtons->onChange = boost::bind(&CKingdomInterface::CHeroItem::onArtChange, this, _1);
|
|
|
+ artButtons->select(0,0);
|
|
|
+
|
|
|
+ artLeft = new AdventureMapButton("", "", boost::bind
|
|
|
(&CKingdomInterface::CHeroItem::scrollArts,this,-1), 269, 66, "hsbtns3.def", SDLK_LEFT);
|
|
|
- artRight = new AdventureMapButton("", "", boost::bind
|
|
|
- (&CKingdomInterface::CHeroItem::scrollArts,this,+1), 675, 66, "hsbtns5.def", SDLK_RIGHT);
|
|
|
-
|
|
|
+ artRight = new AdventureMapButton("", "", boost::bind
|
|
|
+ (&CKingdomInterface::CHeroItem::scrollArts,this,+1), 675, 66, "hsbtns5.def", SDLK_RIGHT);
|
|
|
+
|
|
|
portrait = new LRClickableAreaWText();
|
|
|
portrait->pos = genRect(64, 58, pos.x+5, pos.y + 5);
|
|
|
char bufor[400];
|
|
|
@@ -640,10 +641,10 @@ CKingdomInterface::CHeroItem::CHeroItem(int num, CKingdomInterface * Owner)
|
|
|
primarySkills[i]->pos = genRect(45, 32, pos.x+77 + 36*i, pos.y+26);
|
|
|
primarySkills[i]->text = CGI->generaltexth->arraytxt[2+i];
|
|
|
primarySkills[i]->type = i;
|
|
|
- primarySkills[i]->baseType = 0;
|
|
|
+ primarySkills[i]->baseType = 0;
|
|
|
sprintf(bufor, CGI->generaltexth->heroscrn[1].c_str(), CGI->generaltexth->primarySkillNames[i].c_str());
|
|
|
primarySkills[i]->hoverText = std::string(bufor);
|
|
|
- };
|
|
|
+ };
|
|
|
experience = new LRClickableAreaWText();
|
|
|
experience->pos = genRect(33, 49, pos.x+322, pos.y+4);
|
|
|
experience->hoverText = CGI->generaltexth->heroscrn[9];
|
|
|
@@ -655,77 +656,82 @@ CKingdomInterface::CHeroItem::CHeroItem(int num, CKingdomInterface * Owner)
|
|
|
luck->pos = genRect(20,32,pos.x+221,pos.y+28);
|
|
|
|
|
|
spellPoints = new LRClickableAreaWText();
|
|
|
- spellPoints->pos = genRect(32, 48, pos.x+271, pos.y+4);
spellPoints->hoverText = CGI->generaltexth->heroscrn[22];
|
|
|
-
|
|
|
+ spellPoints->pos = genRect(32, 48, pos.x+271, pos.y+4);
|
|
|
+ spellPoints->hoverText = CGI->generaltexth->heroscrn[22];
|
|
|
+
|
|
|
speciality = new LRClickableAreaWText();
|
|
|
- speciality->pos = genRect(32, 48, pos.x+271, pos.y+4);
speciality->hoverText = CGI->generaltexth->heroscrn[27];
|
|
|
+ speciality->pos = genRect(32, 48, pos.x+271, pos.y+4);
|
|
|
+ speciality->hoverText = CGI->generaltexth->heroscrn[27];
|
|
|
|
|
|
for(int i=0; i<8; ++i)
|
|
|
{
|
|
|
- secondarySkills.push_back(new LRClickableAreaWTextComp());
secondarySkills[i]->pos = genRect(32, 32, pos.x+410+i*37, pos.y+4);
|
|
|
+ secondarySkills.push_back(new LRClickableAreaWTextComp());
|
|
|
+ secondarySkills[i]->pos = genRect(32, 32, pos.x+410+i*37, pos.y+4);
|
|
|
secondarySkills[i]->baseType = 1;
|
|
|
- };
|
|
|
-
|
|
|
- for (int i=0; i<18;i++)
|
|
|
- {
|
|
|
- artifacts.push_back(new CArtPlace(this));
artifacts[i]->pos = genRect(44, 44, pos.x+268+(i%9)*48, pos.y+66);
|
|
|
- artifacts[i]->baseType = SComponent::artifact;
|
|
|
- };
|
|
|
-
|
|
|
- for (int i=0; i<8;i++)
|
|
|
- {
|
|
|
- backpack.push_back(new CArtPlace(this));
backpack[i]->pos = genRect(44, 44, pos.x+293+(i%9)*48, pos.y+66);
|
|
|
- backpack[i]->baseType = SComponent::artifact;
|
|
|
- };
|
|
|
-
|
|
|
+ };
|
|
|
+
|
|
|
+ for (int i=0; i<18;i++)
|
|
|
+ {
|
|
|
+ artifacts.push_back(new CArtPlace(this));
|
|
|
+ artifacts[i]->pos = genRect(44, 44, pos.x+268+(i%9)*48, pos.y+66);
|
|
|
+ artifacts[i]->baseType = SComponent::artifact;
|
|
|
+ };
|
|
|
+
|
|
|
+ for (int i=0; i<8;i++)
|
|
|
+ {
|
|
|
+ backpack.push_back(new CArtPlace(this));
|
|
|
+ backpack[i]->pos = genRect(44, 44, pos.x+293+(i%9)*48, pos.y+66);
|
|
|
+ backpack[i]->baseType = SComponent::artifact;
|
|
|
+ };
|
|
|
+
|
|
|
}
|
|
|
|
|
|
CKingdomInterface::CHeroItem::~CHeroItem()
|
|
|
-{
|
|
|
- delete artButtons;
|
|
|
-}
|
|
|
-
|
|
|
-void CKingdomInterface::CHeroItem::setHero(const CGHeroInstance * newHero)
|
|
|
-{
|
|
|
- BLOCK_CAPTURING;
|
|
|
- delete garr;
|
|
|
- hero = newHero;
|
|
|
- if (!hero)
|
|
|
- {
|
|
|
- return;
|
|
|
- garr = NULL;
|
|
|
- }
|
|
|
- char bufor[400];
|
|
|
- artLeft->block(hero->artifacts.size() <= 8);
|
|
|
- artRight->block(hero->artifacts.size() <= 8);
|
|
|
- garr = new CGarrisonInt(pos.x+6, pos.y+78, 4, Point(), owner->bg, Point(29,104), hero, NULL, false, true);
|
|
|
- garr->update = false;
|
|
|
-
|
|
|
- for (int i=0; i<artifacts.size(); i++)
|
|
|
- {
|
|
|
- artifacts[i]->type = hero->getArtAtPos(i);
|
|
|
- if (artifacts[i]->type<0)
|
|
|
- artifacts[i]->hoverText = CGI->generaltexth->heroscrn[11];
|
|
|
- else
|
|
|
- {
|
|
|
- artifacts[i]->text = CGI->generaltexth->artifDescriptions[artifacts[i]->type];
|
|
|
- artifacts[i]->hoverText = boost::str(boost::format(CGI->generaltexth->heroscrn[1].c_str()) % CGI->arth->artifacts[artifacts[i]->type].Name());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- for (int i=0; i<backpack.size(); i++)
|
|
|
- {
|
|
|
- backpack[i]->type = hero->getArtAtPos(19+i);
|
|
|
- if (backpack[i]->type<0)
|
|
|
- backpack[i]->hoverText ="";
|
|
|
- else
|
|
|
- {
|
|
|
- backpack[i]->text = CGI->generaltexth->artifDescriptions[backpack[i]->type];
|
|
|
- backpack[i]->hoverText = boost::str(boost::format(CGI->generaltexth->heroscrn[1].c_str()) % CGI->arth->artifacts[backpack[i]->type].Name());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- sprintf(bufor, CGI->generaltexth->allTexts[15].c_str(), hero->name.c_str(), hero->type->heroClass->name.c_str());
|
|
|
+{
|
|
|
+ delete artButtons;
|
|
|
+}
|
|
|
+
|
|
|
+void CKingdomInterface::CHeroItem::setHero(const CGHeroInstance * newHero)
|
|
|
+{
|
|
|
+ BLOCK_CAPTURING;
|
|
|
+ delete garr;
|
|
|
+ hero = newHero;
|
|
|
+ if (!hero)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ garr = NULL;
|
|
|
+ }
|
|
|
+ char bufor[400];
|
|
|
+ artLeft->block(hero->artifacts.size() <= 8);
|
|
|
+ artRight->block(hero->artifacts.size() <= 8);
|
|
|
+ garr = new CGarrisonInt(pos.x+6, pos.y+78, 4, Point(), owner->bg, Point(29,104), hero, NULL, false, true);
|
|
|
+ garr->update = false;
|
|
|
+
|
|
|
+ for (int i=0; i<artifacts.size(); i++)
|
|
|
+ {
|
|
|
+ artifacts[i]->type = hero->getArtAtPos(i);
|
|
|
+ if (artifacts[i]->type<0)
|
|
|
+ artifacts[i]->hoverText = CGI->generaltexth->heroscrn[11];
|
|
|
+ else
|
|
|
+ {
|
|
|
+ artifacts[i]->text = CGI->generaltexth->artifDescriptions[artifacts[i]->type];
|
|
|
+ artifacts[i]->hoverText = boost::str(boost::format(CGI->generaltexth->heroscrn[1].c_str()) % CGI->arth->artifacts[artifacts[i]->type].Name());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i=0; i<backpack.size(); i++)
|
|
|
+ {
|
|
|
+ backpack[i]->type = hero->getArtAtPos(19+i);
|
|
|
+ if (backpack[i]->type<0)
|
|
|
+ backpack[i]->hoverText ="";
|
|
|
+ else
|
|
|
+ {
|
|
|
+ backpack[i]->text = CGI->generaltexth->artifDescriptions[backpack[i]->type];
|
|
|
+ backpack[i]->hoverText = boost::str(boost::format(CGI->generaltexth->heroscrn[1].c_str()) % CGI->arth->artifacts[backpack[i]->type].Name());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ sprintf(bufor, CGI->generaltexth->allTexts[15].c_str(), hero->name.c_str(), hero->type->heroClass->name.c_str());
|
|
|
portrait->hoverText = std::string(bufor);
|
|
|
portrait->text = hero->getBiography();
|
|
|
|
|
|
@@ -733,24 +739,24 @@ void CKingdomInterface::CHeroItem::setHero(const CGHeroInstance * newHero)
|
|
|
for(size_t g=0; g<primarySkills.size(); ++g)
|
|
|
primarySkills[g]->bonus = hero->getPrimSkillLevel(g);
|
|
|
|
|
|
- //secondary skills
|
|
|
+ //secondary skills
|
|
|
for(size_t g=0; g<std::min(secondarySkills.size(),hero->secSkills.size()); ++g)
|
|
|
{
|
|
|
int skill = hero->secSkills[g].first,
|
|
|
- level = hero->secSkills[g].second;
|
|
|
+ level = hero->secSkills[g].second;
|
|
|
secondarySkills[g]->type = skill;
|
|
|
secondarySkills[g]->bonus = level;
|
|
|
secondarySkills[g]->text = CGI->generaltexth->skillInfoTexts[skill][level-1];
|
|
|
sprintf(bufor, CGI->generaltexth->heroscrn[21].c_str(), CGI->generaltexth->levels[level-1].c_str(), CGI->generaltexth->skillName[skill].c_str());
|
|
|
secondarySkills[g]->hoverText = std::string(bufor);
|
|
|
- }
|
|
|
+ }
|
|
|
//experience
|
|
|
experience->text = CGI->generaltexth->allTexts[2].c_str();
|
|
|
boost::replace_first(experience->text, "%d", boost::lexical_cast<std::string>(hero->level));
|
|
|
boost::replace_first(experience->text, "%d", boost::lexical_cast<std::string>(CGI->heroh->reqExp(hero->level+1)));
|
|
|
boost::replace_first(experience->text, "%d", boost::lexical_cast<std::string>(hero->exp));
|
|
|
|
|
|
- //spell points
|
|
|
+ //spell points
|
|
|
sprintf(bufor, CGI->generaltexth->allTexts[205].c_str(), hero->name.c_str(), hero->mana, hero->manaLimit());
|
|
|
spellPoints->text = std::string(bufor);
|
|
|
|
|
|
@@ -776,25 +782,25 @@ void CKingdomInterface::CHeroItem::setHero(const CGHeroInstance * newHero)
|
|
|
luck->text = CGI->generaltexth->arraytxt[62];
|
|
|
boost::algorithm::replace_first(luck->text,"%s",CGI->generaltexth->arraytxt[60-mrlt]);
|
|
|
for(int it=0; it < mrl.size(); it++)
|
|
|
- luck->text += mrl[it].second;
|
|
|
-// redrawCurBack();
|
|
|
-}
|
|
|
-
|
|
|
-void CKingdomInterface::CHeroItem::scrollArts(int move)
|
|
|
-{
|
|
|
- backpackPos = ( backpackPos + move + hero->artifacts.size()) % hero->artifacts.size();
|
|
|
- for (int i=0; i<backpack.size(); i++)
|
|
|
- {
|
|
|
- backpack[i]->type = hero->getArtAtPos(19+(backpackPos + i)%hero->artifacts.size());
|
|
|
- if (backpack[i]->type<0)
|
|
|
- backpack[i]->hoverText ="";
|
|
|
- else
|
|
|
- {
|
|
|
- backpack[i]->text = CGI->generaltexth->artifDescriptions[backpack[i]->type];
|
|
|
- backpack[i]->hoverText = boost::str(boost::format(CGI->generaltexth->heroscrn[1].c_str()) % CGI->arth->artifacts[backpack[i]->type].Name());
|
|
|
- }
|
|
|
- }
|
|
|
- GH.totalRedraw();
|
|
|
+ luck->text += mrl[it].second;
|
|
|
+// redrawCurBack();
|
|
|
+}
|
|
|
+
|
|
|
+void CKingdomInterface::CHeroItem::scrollArts(int move)
|
|
|
+{
|
|
|
+ backpackPos = ( backpackPos + move + hero->artifacts.size()) % hero->artifacts.size();
|
|
|
+ for (int i=0; i<backpack.size(); i++)
|
|
|
+ {
|
|
|
+ backpack[i]->type = hero->getArtAtPos(19+(backpackPos + i)%hero->artifacts.size());
|
|
|
+ if (backpack[i]->type<0)
|
|
|
+ backpack[i]->hoverText ="";
|
|
|
+ else
|
|
|
+ {
|
|
|
+ backpack[i]->text = CGI->generaltexth->artifDescriptions[backpack[i]->type];
|
|
|
+ backpack[i]->hoverText = boost::str(boost::format(CGI->generaltexth->heroscrn[1].c_str()) % CGI->arth->artifacts[backpack[i]->type].Name());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ GH.totalRedraw();
|
|
|
}
|
|
|
|
|
|
void CKingdomInterface::CHeroItem::showAll(SDL_Surface * to)
|
|
|
@@ -807,9 +813,9 @@ void CKingdomInterface::CHeroItem::showAll(SDL_Surface * to)
|
|
|
blitAt(slots->ourImages[(artGroup!=2)?owner->PicCount:(owner->PicCount+1)].bitmap,pos.x,pos.y,to);
|
|
|
//text "Artifacts"
|
|
|
CSDL_Ext::printAtMiddle(CGI->generaltexth->overview[2],pos.x+320,pos.y+55,GEOR13,zwykly,to);
|
|
|
- blitAt(graphics->portraitLarge[hero->portrait],pos.x+5,pos.y+6,to);
|
|
|
-
|
|
|
- garr->show(to);
|
|
|
+ blitAt(graphics->portraitLarge[hero->portrait],pos.x+5,pos.y+6,to);
|
|
|
+
|
|
|
+ garr->show(to);
|
|
|
//hero name
|
|
|
CSDL_Ext::printAt(hero->name,pos.x+73,pos.y+7,GEOR13,zwykly,to);
|
|
|
for (int i = 0; i<6; i++)
|
|
|
@@ -840,8 +846,8 @@ void CKingdomInterface::CHeroItem::showAll(SDL_Surface * to)
|
|
|
level = hero->secSkills[i].second;
|
|
|
blitAt(graphics->abils32->ourImages[skill*3+level+2].bitmap,pos.x+411+i*36,pos.y+6,to);
|
|
|
}
|
|
|
-
|
|
|
- artButtons->show(to);
|
|
|
+
|
|
|
+ artButtons->show(to);
|
|
|
|
|
|
int iter=0;
|
|
|
switch (artGroup)
|
|
|
@@ -855,96 +861,96 @@ void CKingdomInterface::CHeroItem::showAll(SDL_Surface * to)
|
|
|
blitAt(graphics->artDefs->ourImages[artID].bitmap,pos.x+268+48*(i%9),pos.y+66,to);
|
|
|
}
|
|
|
break;
|
|
|
- case 2:
|
|
|
- artLeft->show(to);
|
|
|
- artRight->show(to);
|
|
|
- int max = hero->artifacts.size();
|
|
|
- iter = std::min(8, max);
|
|
|
- for (size_t it = 0 ; it<iter;it++)
|
|
|
- blitAt(graphics->artDefs->ourImages[hero->artifacts[(it+backpackPos)%max]].bitmap,pos.x+293+48*it,pos.y+66,to);
|
|
|
+ case 2:
|
|
|
+ artLeft->show(to);
|
|
|
+ artRight->show(to);
|
|
|
+ int max = hero->artifacts.size();
|
|
|
+ iter = std::min(8, max);
|
|
|
+ for (size_t it = 0 ; it<iter;it++)
|
|
|
+ blitAt(graphics->artDefs->ourImages[hero->artifacts[(it+backpackPos)%max]].bitmap,pos.x+293+48*it,pos.y+66,to);
|
|
|
break;
|
|
|
- }
|
|
|
+ }
|
|
|
show(to);
|
|
|
-}
|
|
|
+}
|
|
|
|
|
|
void CKingdomInterface::CHeroItem::onArtChange(int newstate)
|
|
|
-{
|
|
|
- if (!hero)
|
|
|
- return;
|
|
|
- deactivate();
|
|
|
- artGroup = newstate;
|
|
|
- activate();
|
|
|
+{
|
|
|
+ if (!hero)
|
|
|
+ return;
|
|
|
+ deactivate();
|
|
|
+ artGroup = newstate;
|
|
|
+ activate();
|
|
|
GH.totalRedraw();
|
|
|
}
|
|
|
|
|
|
void CKingdomInterface::CHeroItem::activate()
|
|
|
-{
|
|
|
- if (!hero)
|
|
|
- return;
|
|
|
- artButtons->activate();
|
|
|
- garr->activate();
|
|
|
- if ( artGroup == 2 )
|
|
|
- {
|
|
|
- artLeft->activate();
|
|
|
- artRight->activate();
|
|
|
- for (size_t i=0; i<8;i++)
|
|
|
- backpack[i]->activate();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- for (size_t i=artGroup*9; i<9+artGroup*9;i++)
|
|
|
- artifacts[i]->activate();
|
|
|
- }
|
|
|
- portrait->activate();
|
|
|
- experience->activate();
|
|
|
- morale->activate();
|
|
|
- luck->activate();
|
|
|
- spellPoints->activate();
|
|
|
- speciality->activate();
|
|
|
-
|
|
|
- for (size_t i=0; i<primarySkills.size();i++)
|
|
|
- primarySkills[i]->activate();
|
|
|
-
|
|
|
- for (size_t i=0; i<std::min(secondarySkills.size(),hero->secSkills.size());i++)
|
|
|
- secondarySkills[i]->activate();
|
|
|
+{
|
|
|
+ if (!hero)
|
|
|
+ return;
|
|
|
+ artButtons->activate();
|
|
|
+ garr->activate();
|
|
|
+ if ( artGroup == 2 )
|
|
|
+ {
|
|
|
+ artLeft->activate();
|
|
|
+ artRight->activate();
|
|
|
+ for (size_t i=0; i<8;i++)
|
|
|
+ backpack[i]->activate();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ for (size_t i=artGroup*9; i<9+artGroup*9;i++)
|
|
|
+ artifacts[i]->activate();
|
|
|
+ }
|
|
|
+ portrait->activate();
|
|
|
+ experience->activate();
|
|
|
+ morale->activate();
|
|
|
+ luck->activate();
|
|
|
+ spellPoints->activate();
|
|
|
+ speciality->activate();
|
|
|
+
|
|
|
+ for (size_t i=0; i<primarySkills.size();i++)
|
|
|
+ primarySkills[i]->activate();
|
|
|
+
|
|
|
+ for (size_t i=0; i<std::min(secondarySkills.size(),hero->secSkills.size());i++)
|
|
|
+ secondarySkills[i]->activate();
|
|
|
}
|
|
|
|
|
|
void CKingdomInterface::CHeroItem::deactivate()
|
|
|
-{
|
|
|
- if (!hero)
|
|
|
- return;
|
|
|
- artButtons->deactivate();
|
|
|
- garr->deactivate();
|
|
|
- if ( artGroup == 2 )
|
|
|
- {
|
|
|
- artLeft->deactivate();
|
|
|
- artRight->deactivate();
|
|
|
- for (size_t i=0; i<8;i++)
|
|
|
- backpack[i]->deactivate();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- for (size_t i=artGroup*9; i<9+artGroup*9;i++)
|
|
|
- artifacts[i]->deactivate();
|
|
|
- }
|
|
|
-
|
|
|
- portrait->deactivate();
|
|
|
- experience->deactivate();
|
|
|
- morale->deactivate();
|
|
|
- luck->deactivate();
|
|
|
- spellPoints->deactivate();
|
|
|
- speciality->deactivate();
|
|
|
- for (size_t i=0; i<primarySkills.size();i++)
|
|
|
- primarySkills[i]->deactivate();
|
|
|
-
|
|
|
- for (size_t i=0; i<std::min(secondarySkills.size(),hero->secSkills.size());i++)
|
|
|
- secondarySkills[i]->deactivate();
|
|
|
-}
|
|
|
-
|
|
|
+{
|
|
|
+ if (!hero)
|
|
|
+ return;
|
|
|
+ artButtons->deactivate();
|
|
|
+ garr->deactivate();
|
|
|
+ if ( artGroup == 2 )
|
|
|
+ {
|
|
|
+ artLeft->deactivate();
|
|
|
+ artRight->deactivate();
|
|
|
+ for (size_t i=0; i<8;i++)
|
|
|
+ backpack[i]->deactivate();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ for (size_t i=artGroup*9; i<9+artGroup*9;i++)
|
|
|
+ artifacts[i]->deactivate();
|
|
|
+ }
|
|
|
+
|
|
|
+ portrait->deactivate();
|
|
|
+ experience->deactivate();
|
|
|
+ morale->deactivate();
|
|
|
+ luck->deactivate();
|
|
|
+ spellPoints->deactivate();
|
|
|
+ speciality->deactivate();
|
|
|
+ for (size_t i=0; i<primarySkills.size();i++)
|
|
|
+ primarySkills[i]->deactivate();
|
|
|
+
|
|
|
+ for (size_t i=0; i<std::min(secondarySkills.size(),hero->secSkills.size());i++)
|
|
|
+ secondarySkills[i]->deactivate();
|
|
|
+}
|
|
|
+
|
|
|
CKingdomInterface::CHeroItem::CArtPlace::CArtPlace(CHeroItem * owner)
|
|
|
-{
|
|
|
- hero = owner;
|
|
|
- used = LCLICK | RCLICK | HOVER;
|
|
|
+{
|
|
|
+ hero = owner;
|
|
|
+ used = LCLICK | RCLICK | HOVER;
|
|
|
}
|
|
|
|
|
|
void CKingdomInterface::CHeroItem::CArtPlace::activate()
|
|
|
@@ -955,12 +961,12 @@ void CKingdomInterface::CHeroItem::CArtPlace::activate()
|
|
|
void CKingdomInterface::CHeroItem::CArtPlace::clickLeft(tribool down, bool previousState)
|
|
|
{tlog1<<pos.x<<" "<<type<<"\n";
|
|
|
if (!down && previousState && type>=0)
|
|
|
- {
|
|
|
+ {
|
|
|
if(type == 0)
|
|
|
- {
|
|
|
+ {
|
|
|
CSpellWindow * spellWindow = new CSpellWindow(genRect(595, 620, (screen->w - 620)/2, (screen->h - 595)/2), hero->hero);
|
|
|
GH.pushInt(spellWindow);
|
|
|
- }
|
|
|
+ }
|
|
|
else
|
|
|
LRClickableAreaWTextComp::clickLeft(down,previousState);
|
|
|
}
|
|
|
@@ -975,4 +981,4 @@ void CKingdomInterface::CHeroItem::CArtPlace::clickRight(tribool down, bool prev
|
|
|
void CKingdomInterface::CHeroItem::CArtPlace::deactivate()
|
|
|
{
|
|
|
LRClickableAreaWTextComp::deactivate();
|
|
|
-}
|
|
|
+}
|