2008-01-10 21:01:25 +02:00
|
|
|
#include "stdafx.h"
|
2008-01-13 18:24:24 +02:00
|
|
|
#include "global.h"
|
2008-01-10 21:01:25 +02:00
|
|
|
#include "CHeroWindow.h"
|
2008-01-13 18:24:24 +02:00
|
|
|
#include "CGameInfo.h"
|
|
|
|
#include "hch\CHeroHandler.h"
|
|
|
|
#include "hch\CGeneralTextHandler.h"
|
2008-01-10 21:01:25 +02:00
|
|
|
#include "SDL.h"
|
|
|
|
#include "SDL_Extensions.h"
|
2008-01-11 20:56:39 +02:00
|
|
|
#include "CAdvmapInterface.h"
|
|
|
|
#include "AdventureMapButton.h"
|
2008-01-15 20:50:52 +02:00
|
|
|
#include "CMessage.h"
|
2008-01-13 18:24:24 +02:00
|
|
|
#include <sstream>
|
2008-01-10 21:01:25 +02:00
|
|
|
|
2008-01-19 15:19:58 +02:00
|
|
|
extern SDL_Surface * screen;
|
2008-01-15 20:50:52 +02:00
|
|
|
extern TTF_Font * GEOR16;
|
2008-01-10 21:01:25 +02:00
|
|
|
|
2008-01-19 15:19:58 +02:00
|
|
|
CHeroWindow::CHeroWindow(int playerColor): artFeet(0), artHead(0), artLHand(0),
|
|
|
|
artLRing(0), artMach1(0), artMach2(0), artMach3(0), artMach4(0), artMisc1(0),
|
|
|
|
artMisc2(0), artMisc3(0), artMisc4(0), artMisc5(0), artNeck(0), artRhand(0),
|
2008-01-19 20:58:24 +02:00
|
|
|
artRRing(0), artShoulders(0), artSpellBook(0), artTorso(0),
|
|
|
|
backpackPos(0), player(playerColor)
|
2008-01-10 21:01:25 +02:00
|
|
|
{
|
2008-01-11 21:28:43 +02:00
|
|
|
background = CGI->bitmaph->loadBitmap("HEROSCR4.bmp");
|
2008-01-11 20:56:39 +02:00
|
|
|
CSDL_Ext::blueToPlayersAdv(background, playerColor);
|
|
|
|
pos.x = 65;
|
|
|
|
pos.y = 8;
|
2008-01-10 21:01:25 +02:00
|
|
|
pos.h = background->h;
|
|
|
|
pos.w = background->w;
|
2008-01-15 20:50:52 +02:00
|
|
|
curBack = NULL;
|
|
|
|
curHero = NULL;
|
2008-01-11 20:56:39 +02:00
|
|
|
|
|
|
|
quitButton = new AdventureMapButton<CHeroWindow>(std::string(), std::string(), &CHeroWindow::quit, 674, 524, "hsbtns.def", this);
|
2008-01-12 14:55:45 +02:00
|
|
|
dismissButton = new AdventureMapButton<CHeroWindow>(std::string(), std::string(), &CHeroWindow::dismissCurrent, 519, 437, "hsbtns2.def", this);
|
|
|
|
questlogButton = new AdventureMapButton<CHeroWindow>(std::string(), std::string(), &CHeroWindow::questlog, 379, 437, "hsbtns4.def", this);
|
|
|
|
|
2008-01-13 18:24:24 +02:00
|
|
|
gar1button = new AdventureMapButton<CHeroWindow>(std::string(), std::string(), &CHeroWindow::gar1, 546, 491, "hsbtns6.def", this);
|
|
|
|
gar2button = new AdventureMapButton<CHeroWindow>(std::string(), std::string(), &CHeroWindow::gar2, 604, 491, "hsbtns8.def", this);
|
|
|
|
gar3button = new AdventureMapButton<CHeroWindow>(std::string(), std::string(), &CHeroWindow::gar3, 546, 527, "hsbtns7.def", this);
|
|
|
|
gar4button = new AdventureMapButton<CHeroWindow>(std::string(), std::string(), &CHeroWindow::gar4, 604, 527, "hsbtns9.def", this);
|
|
|
|
|
2008-01-13 21:42:21 +02:00
|
|
|
leftArtRoll = new AdventureMapButton<CHeroWindow>(std::string(), std::string(), &CHeroWindow::leftArtRoller, 379, 364, "hsbtns3.def", this);
|
|
|
|
rightArtRoll = new AdventureMapButton<CHeroWindow>(std::string(), std::string(), &CHeroWindow::rightArtRoller, 632, 364, "hsbtns5.def", this);
|
|
|
|
|
|
|
|
for(int g=0; g<8; ++g)
|
|
|
|
{
|
2008-01-25 21:09:41 +02:00
|
|
|
//heroList.push_back(new AdventureMapButton<CHeroWindow>(std::string(), std::string(), &CHeroWindow::switchHero, 677, 95+g*54, "hsbtns5.def", this));
|
|
|
|
heroListMi.push_back(new LClickableAreaHero());
|
|
|
|
heroListMi[g]->pos.x = 677;
|
|
|
|
heroListMi[g]->pos.y = 95+g*54;
|
|
|
|
heroListMi[g]->pos.h = 32;
|
|
|
|
heroListMi[g]->pos.w = 48;
|
|
|
|
heroListMi[g]->owner = this;
|
|
|
|
heroListMi[g]->id = g;
|
2008-01-13 21:42:21 +02:00
|
|
|
}
|
|
|
|
|
2008-01-12 14:55:45 +02:00
|
|
|
skillpics = CGI->spriteh->giveDef("pskil42.def");
|
2008-01-13 18:24:24 +02:00
|
|
|
flags = CGI->spriteh->giveDef("CREST58.DEF");
|
2008-01-19 20:58:24 +02:00
|
|
|
//areas
|
2008-01-27 18:07:27 +02:00
|
|
|
portraitArea = new LRClickableAreaWText();
|
2008-01-19 20:58:24 +02:00
|
|
|
portraitArea->pos.x = 83;
|
|
|
|
portraitArea->pos.y = 26;
|
|
|
|
portraitArea->pos.w = 58;
|
|
|
|
portraitArea->pos.h = 64;
|
2008-01-27 18:07:27 +02:00
|
|
|
for(int v=0; v<4; ++v)
|
|
|
|
{
|
|
|
|
primSkillAreas.push_back(new LRClickableAreaWTextComp());
|
|
|
|
primSkillAreas[v]->pos.x = 95 + 70*v;
|
|
|
|
primSkillAreas[v]->pos.y = 111;
|
|
|
|
primSkillAreas[v]->pos.w = 42;
|
|
|
|
primSkillAreas[v]->pos.h = 42;
|
|
|
|
primSkillAreas[v]->text = CGI->generaltexth->arraytxt[2+v].substr(1, CGI->generaltexth->arraytxt[2+v].size()-2);
|
|
|
|
primSkillAreas[v]->type = v;
|
|
|
|
primSkillAreas[v]->bonus = -1; // to be initilized when hero is being set
|
2008-01-28 14:28:18 +02:00
|
|
|
primSkillAreas[v]->baseType = 0;
|
2008-01-27 18:07:27 +02:00
|
|
|
}
|
|
|
|
expArea = new LRClickableAreaWText();
|
|
|
|
expArea->pos.x = 83;
|
|
|
|
expArea->pos.y = 236;
|
|
|
|
expArea->pos.w = 136;
|
|
|
|
expArea->pos.h = 42;
|
2008-01-29 15:55:14 +02:00
|
|
|
|
|
|
|
spellPointsArea = new LRClickableAreaWText();
|
|
|
|
spellPointsArea->pos.x = 227;
|
|
|
|
spellPointsArea->pos.y = 236;
|
|
|
|
spellPointsArea->pos.w = 136;
|
|
|
|
spellPointsArea->pos.h = 42;
|
|
|
|
|
2008-01-28 14:28:18 +02:00
|
|
|
for(int i=0; i<8; ++i)
|
|
|
|
{
|
|
|
|
secSkillAreas.push_back(new LRClickableAreaWTextComp());
|
|
|
|
secSkillAreas[i]->pos.x = (i%2==0) ? (83) : (227);
|
|
|
|
secSkillAreas[i]->pos.y = 284 + 48 * (i/2);
|
|
|
|
secSkillAreas[i]->pos.w = 136;
|
|
|
|
secSkillAreas[i]->pos.h = 42;
|
|
|
|
secSkillAreas[i]->baseType = 1;
|
|
|
|
}
|
2008-01-10 21:01:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
CHeroWindow::~CHeroWindow()
|
|
|
|
{
|
|
|
|
SDL_FreeSurface(background);
|
2008-01-11 20:56:39 +02:00
|
|
|
delete quitButton;
|
2008-01-12 14:55:45 +02:00
|
|
|
delete dismissButton;
|
|
|
|
delete questlogButton;
|
2008-01-13 18:24:24 +02:00
|
|
|
delete gar1button;
|
|
|
|
delete gar2button;
|
|
|
|
delete gar3button;
|
|
|
|
delete gar4button;
|
2008-01-13 21:42:21 +02:00
|
|
|
delete leftArtRoll;
|
|
|
|
delete rightArtRoll;
|
|
|
|
|
2008-01-25 21:09:41 +02:00
|
|
|
for(int g=0; g<heroListMi.size(); ++g)
|
|
|
|
delete heroListMi[g];
|
2008-01-12 14:55:45 +02:00
|
|
|
|
|
|
|
if(curBack)
|
|
|
|
SDL_FreeSurface(curBack);
|
|
|
|
|
|
|
|
delete skillpics;
|
2008-01-13 18:24:24 +02:00
|
|
|
delete flags;
|
2008-01-19 15:19:58 +02:00
|
|
|
|
|
|
|
delete artFeet;
|
|
|
|
delete artHead;
|
|
|
|
delete artLHand;
|
|
|
|
delete artLRing;
|
|
|
|
delete artMach1;
|
|
|
|
delete artMach2;
|
|
|
|
delete artMach3;
|
|
|
|
delete artMach4;
|
|
|
|
delete artMisc1;
|
|
|
|
delete artMisc2;
|
|
|
|
delete artMisc3;
|
|
|
|
delete artMisc4;
|
|
|
|
delete artMisc5;
|
|
|
|
delete artNeck;
|
|
|
|
delete artRhand;
|
|
|
|
delete artRRing;
|
|
|
|
delete artShoulders;
|
|
|
|
delete artSpellBook;
|
|
|
|
delete artTorso;
|
2008-01-19 20:58:24 +02:00
|
|
|
for(int g=0; g<backpack.size(); ++g)
|
|
|
|
{
|
|
|
|
delete backpack[g];
|
|
|
|
}
|
|
|
|
backpack.clear();
|
|
|
|
|
|
|
|
delete portraitArea;
|
2008-01-27 18:07:27 +02:00
|
|
|
delete expArea;
|
2008-01-29 15:55:14 +02:00
|
|
|
delete spellPointsArea;
|
2008-01-27 18:07:27 +02:00
|
|
|
for(int v=0; v<primSkillAreas.size(); ++v)
|
|
|
|
{
|
|
|
|
delete primSkillAreas[v];
|
|
|
|
}
|
2008-01-28 14:28:18 +02:00
|
|
|
for(int v=0; v<secSkillAreas.size(); ++v)
|
|
|
|
{
|
|
|
|
delete secSkillAreas[v];
|
|
|
|
}
|
2008-01-10 21:01:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CHeroWindow::show(SDL_Surface *to)
|
|
|
|
{
|
|
|
|
if(!to)
|
|
|
|
to=ekran;
|
2008-01-26 21:36:31 +02:00
|
|
|
if(curBack)
|
|
|
|
blitAt(curBack,pos.x,pos.y,to);
|
2008-01-11 20:56:39 +02:00
|
|
|
quitButton->show();
|
2008-01-12 14:55:45 +02:00
|
|
|
dismissButton->show();
|
|
|
|
questlogButton->show();
|
2008-01-13 18:24:24 +02:00
|
|
|
gar1button->show();
|
|
|
|
gar2button->show();
|
|
|
|
gar3button->show();
|
|
|
|
gar4button->show();
|
2008-01-13 21:42:21 +02:00
|
|
|
leftArtRoll->show();
|
|
|
|
rightArtRoll->show();
|
2008-01-19 15:19:58 +02:00
|
|
|
|
|
|
|
artFeet->show(to);
|
|
|
|
artHead->show(to);
|
|
|
|
artLHand->show(to);
|
|
|
|
artLRing->show(to);
|
|
|
|
artMach1->show(to);
|
|
|
|
artMach2->show(to);
|
|
|
|
artMach3->show(to);
|
|
|
|
artMach4->show(to);
|
|
|
|
artMisc1->show(to);
|
|
|
|
artMisc2->show(to);
|
|
|
|
artMisc3->show(to);
|
|
|
|
artMisc4->show(to);
|
|
|
|
artMisc5->show(to);
|
|
|
|
artNeck->show(to);
|
|
|
|
artRhand->show(to);
|
|
|
|
artRRing->show(to);
|
|
|
|
artShoulders->show(to);
|
|
|
|
artSpellBook->show(to);
|
|
|
|
artTorso->show(to);
|
2008-01-19 20:58:24 +02:00
|
|
|
for(int d=0; d<backpack.size(); ++d)
|
|
|
|
{
|
|
|
|
backpack[d]->show(to);
|
|
|
|
}
|
2008-01-10 21:01:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CHeroWindow::setHero(const CGHeroInstance *hero)
|
|
|
|
{
|
2008-01-28 14:28:18 +02:00
|
|
|
if(!hero) //something strange... no hero? it shouldn't happen
|
2008-01-25 21:09:41 +02:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2008-01-10 21:01:25 +02:00
|
|
|
curHero = hero;
|
2008-01-20 15:53:11 +02:00
|
|
|
portraitArea->text = hero->biography;
|
2008-01-19 15:19:58 +02:00
|
|
|
|
2008-01-27 18:07:27 +02:00
|
|
|
for(int g=0; g<primSkillAreas.size(); ++g)
|
|
|
|
{
|
|
|
|
primSkillAreas[g]->bonus = hero->primSkills[g];
|
|
|
|
}
|
2008-01-29 15:55:14 +02:00
|
|
|
for(int g=0; g<hero->secSkills.size(); ++g)
|
2008-01-28 14:28:18 +02:00
|
|
|
{
|
|
|
|
secSkillAreas[g]->type = hero->secSkills[g].first;
|
|
|
|
secSkillAreas[g]->bonus = hero->secSkills[g].second;
|
2008-01-29 15:55:14 +02:00
|
|
|
std::string hlp;
|
|
|
|
switch(hero->secSkills[g].second)
|
|
|
|
{
|
|
|
|
case 0: //basic level
|
|
|
|
hlp = CGI->abilh->abilities[ hero->secSkills[g].first ]->basicText;
|
|
|
|
secSkillAreas[g]->text = hlp.substr(1, hlp.size()-2);
|
|
|
|
break;
|
|
|
|
case 1: //adv level
|
|
|
|
hlp = CGI->abilh->abilities[ hero->secSkills[g].first ]->advText;
|
|
|
|
secSkillAreas[g]->text = hlp.substr(1, hlp.size()-2);
|
|
|
|
break;
|
|
|
|
case 2: //expert level
|
|
|
|
hlp = CGI->abilh->abilities[ hero->secSkills[g].first ]->expText;
|
|
|
|
secSkillAreas[g]->text = hlp.substr(1, hlp.size()-2);
|
|
|
|
break;
|
|
|
|
}
|
2008-01-28 14:28:18 +02:00
|
|
|
}
|
2008-01-27 18:07:27 +02:00
|
|
|
|
|
|
|
char * th = new char[200];
|
2008-01-29 15:55:14 +02:00
|
|
|
sprintf(th, CGI->generaltexth->allTexts[2].substr(1, CGI->generaltexth->allTexts[2].size()-2).c_str(), hero->level, CGI->heroh->reqExp(hero->level+1), hero->exp);
|
2008-01-27 18:07:27 +02:00
|
|
|
expArea->text = std::string(th);
|
|
|
|
delete [] th;
|
2008-01-29 15:55:14 +02:00
|
|
|
th = new char[400];
|
|
|
|
sprintf(th, CGI->generaltexth->allTexts[205].substr(1, CGI->generaltexth->allTexts[205].size()-2).c_str(), hero->name.c_str(), hero->mana, hero->primSkills[3]*10);
|
|
|
|
spellPointsArea->text = std::string(th);
|
|
|
|
delete [] th;
|
2008-01-27 18:07:27 +02:00
|
|
|
|
2008-01-19 15:19:58 +02:00
|
|
|
delete artFeet;
|
|
|
|
delete artHead;
|
|
|
|
delete artLHand;
|
|
|
|
delete artLRing;
|
|
|
|
delete artMach1;
|
|
|
|
delete artMach2;
|
|
|
|
delete artMach3;
|
|
|
|
delete artMach4;
|
|
|
|
delete artMisc1;
|
|
|
|
delete artMisc2;
|
|
|
|
delete artMisc3;
|
|
|
|
delete artMisc4;
|
|
|
|
delete artMisc5;
|
|
|
|
delete artNeck;
|
|
|
|
delete artRhand;
|
|
|
|
delete artRRing;
|
|
|
|
delete artShoulders;
|
|
|
|
delete artSpellBook;
|
|
|
|
delete artTorso;
|
2008-01-19 20:58:24 +02:00
|
|
|
for(int g=0; g<backpack.size(); ++g)
|
|
|
|
{
|
|
|
|
delete backpack[g];
|
|
|
|
}
|
|
|
|
backpack.clear();
|
2008-01-19 15:19:58 +02:00
|
|
|
|
|
|
|
artFeet = new CArtPlace(hero->artFeet);
|
|
|
|
artFeet->pos.x = 515;
|
|
|
|
artFeet->pos.y = 295;
|
|
|
|
artFeet->pos.h = artFeet->pos.w = 44;
|
2008-01-29 15:55:14 +02:00
|
|
|
if(hero->artFeet)
|
|
|
|
artFeet->text = hero->artFeet->description;
|
|
|
|
else
|
|
|
|
artFeet->text = std::string();
|
2008-01-19 15:19:58 +02:00
|
|
|
artHead = new CArtPlace(hero->artHead);
|
|
|
|
artHead->pos.x = 509;
|
|
|
|
artHead->pos.y = 30;
|
2008-01-29 15:55:14 +02:00
|
|
|
artHead->pos.h = artHead->pos.w = 44;
|
|
|
|
if(hero->artHead)
|
|
|
|
artHead->text = hero->artHead->description;
|
|
|
|
else
|
|
|
|
artHead->text = std::string();
|
2008-01-19 15:19:58 +02:00
|
|
|
artLHand = new CArtPlace(hero->artLHand);
|
|
|
|
artLHand->pos.x = 564;
|
|
|
|
artLHand->pos.y = 183;
|
2008-01-29 15:55:14 +02:00
|
|
|
artLHand->pos.h = artLHand->pos.w = 44;
|
|
|
|
if(hero->artLHand)
|
|
|
|
artLHand->text = hero->artLHand->description;
|
|
|
|
else
|
|
|
|
artLHand->text = std::string();
|
2008-01-19 15:19:58 +02:00
|
|
|
artLRing = new CArtPlace(hero->artLRing);
|
|
|
|
artLRing->pos.x = 610;
|
|
|
|
artLRing->pos.y = 183;
|
2008-01-29 15:55:14 +02:00
|
|
|
artLRing->pos.h = artLRing->pos.w = 44;
|
|
|
|
if(hero->artLRing)
|
|
|
|
artLRing->text = hero->artLRing->description;
|
|
|
|
else
|
|
|
|
artLRing->text = std::string();
|
2008-01-19 15:19:58 +02:00
|
|
|
artMach1 = new CArtPlace(hero->artMach1);
|
|
|
|
artMach1->pos.x = 564;
|
|
|
|
artMach1->pos.y = 30;
|
2008-01-29 15:55:14 +02:00
|
|
|
artMach1->pos.h = artMach1->pos.w = 44;
|
|
|
|
if(hero->artMach1)
|
|
|
|
artMach1->text = hero->artMach1->description;
|
|
|
|
else
|
|
|
|
artMach1->text = std::string();
|
2008-01-19 15:19:58 +02:00
|
|
|
artMach2 = new CArtPlace(hero->artMach2);
|
|
|
|
artMach2->pos.x = 610;
|
|
|
|
artMach2->pos.y = 30;
|
2008-01-29 15:55:14 +02:00
|
|
|
artMach2->pos.h = artMach2->pos.w = 44;
|
|
|
|
if(hero->artMach2)
|
|
|
|
artMach2->text = hero->artMach2->description;
|
|
|
|
else
|
|
|
|
artMach2->text = std::string();
|
2008-01-19 15:19:58 +02:00
|
|
|
artMach3 = new CArtPlace(hero->artMach3);
|
|
|
|
artMach3->pos.x = 610;
|
|
|
|
artMach3->pos.y = 76;
|
2008-01-29 15:55:14 +02:00
|
|
|
artMach3->pos.h = artMach3->pos.w = 44;
|
|
|
|
if(hero->artMach3)
|
|
|
|
artMach3->text = hero->artMach3->description;
|
|
|
|
else
|
|
|
|
artMach3->text = std::string();
|
2008-01-19 15:19:58 +02:00
|
|
|
artMach4 = new CArtPlace(hero->artMach4);
|
|
|
|
artMach4->pos.x = 610;
|
|
|
|
artMach4->pos.y = 122;
|
2008-01-29 15:55:14 +02:00
|
|
|
artMach4->pos.h = artMach4->pos.w = 44;
|
|
|
|
if(hero->artMach4)
|
|
|
|
artMach4->text = hero->artMach4->description;
|
|
|
|
else
|
|
|
|
artMach4->text = std::string();
|
2008-01-19 15:19:58 +02:00
|
|
|
artMisc1 = new CArtPlace(hero->artMisc1);
|
|
|
|
artMisc1->pos.x = 383;
|
|
|
|
artMisc1->pos.y = 143;
|
2008-01-29 15:55:14 +02:00
|
|
|
artMisc1->pos.h = artMisc1->pos.w = 44;
|
|
|
|
if(hero->artMisc1)
|
|
|
|
artMisc1->text = hero->artMisc1->description;
|
|
|
|
else
|
|
|
|
artMisc1->text = std::string();
|
2008-01-19 15:19:58 +02:00
|
|
|
artMisc2 = new CArtPlace(hero->artMisc2);
|
|
|
|
artMisc2->pos.x = 399;
|
|
|
|
artMisc2->pos.y = 194;
|
2008-01-29 15:55:14 +02:00
|
|
|
artMisc2->pos.h = artMisc2->pos.w = 44;
|
|
|
|
if(hero->artMisc2)
|
|
|
|
artMisc2->text = hero->artMisc2->description;
|
|
|
|
else
|
|
|
|
artMisc2->text = std::string();
|
2008-01-19 15:19:58 +02:00
|
|
|
artMisc3 = new CArtPlace(hero->artMisc3);
|
|
|
|
artMisc3->pos.x = 415;
|
|
|
|
artMisc3->pos.y = 245;
|
2008-01-29 15:55:14 +02:00
|
|
|
artMisc3->pos.h = artMisc3->pos.w = 44;
|
|
|
|
if(hero->artMisc3)
|
|
|
|
artMisc3->text = hero->artMisc3->description;
|
|
|
|
else
|
|
|
|
artMisc3->text = std::string();
|
2008-01-19 15:19:58 +02:00
|
|
|
artMisc4 = new CArtPlace(hero->artMisc4);
|
|
|
|
artMisc4->pos.x = 431;
|
|
|
|
artMisc4->pos.y = 296;
|
2008-01-29 15:55:14 +02:00
|
|
|
artMisc4->pos.h = artMisc4->pos.w = 44;
|
|
|
|
if(hero->artMisc4)
|
|
|
|
artMisc4->text = hero->artMisc4->description;
|
|
|
|
else
|
|
|
|
artMisc4->text = std::string();
|
2008-01-19 15:19:58 +02:00
|
|
|
artMisc5 = new CArtPlace(hero->artMisc5);
|
|
|
|
artMisc5->pos.x = 381;
|
|
|
|
artMisc5->pos.y = 296;
|
2008-01-29 15:55:14 +02:00
|
|
|
artMisc5->pos.h = artMisc5->pos.w = 44;
|
|
|
|
if(hero->artMisc5)
|
|
|
|
artMisc5->text = hero->artMisc5->description;
|
|
|
|
else
|
|
|
|
artMisc5->text = std::string();
|
2008-01-19 15:19:58 +02:00
|
|
|
artNeck = new CArtPlace(hero->artNeck);
|
|
|
|
artNeck->pos.x = 508;
|
|
|
|
artNeck->pos.y = 79;
|
2008-01-29 15:55:14 +02:00
|
|
|
artNeck->pos.h = artNeck->pos.w = 44;
|
|
|
|
if(hero->artNeck)
|
|
|
|
artNeck->text = hero->artNeck->description;
|
|
|
|
else
|
|
|
|
artNeck->text = std::string();
|
2008-01-19 15:19:58 +02:00
|
|
|
artRhand = new CArtPlace(hero->artRhand);
|
|
|
|
artRhand->pos.x = 383;
|
|
|
|
artRhand->pos.y = 68;
|
2008-01-29 15:55:14 +02:00
|
|
|
artRhand->pos.h = artRhand->pos.w = 44;
|
|
|
|
if(hero->artRhand)
|
|
|
|
artRhand->text = hero->artRhand->description;
|
|
|
|
else
|
|
|
|
artRhand->text = std::string();
|
2008-01-19 15:19:58 +02:00
|
|
|
artRRing = new CArtPlace(hero->artRRing);
|
|
|
|
artRRing->pos.x = 431;
|
|
|
|
artRRing->pos.y = 68;
|
2008-01-29 15:55:14 +02:00
|
|
|
artRRing->pos.h = artRRing->pos.w = 44;
|
|
|
|
if(hero->artRRing)
|
|
|
|
artRRing->text = hero->artRRing->description;
|
|
|
|
else
|
|
|
|
artRRing->text = std::string();
|
2008-01-19 15:19:58 +02:00
|
|
|
artShoulders = new CArtPlace(hero->artShoulders);
|
|
|
|
artShoulders->pos.x = 567;
|
|
|
|
artShoulders->pos.y = 240;
|
2008-01-29 15:55:14 +02:00
|
|
|
artShoulders->pos.h = artShoulders->pos.w = 44;
|
|
|
|
if(hero->artShoulders)
|
|
|
|
artShoulders->text = hero->artShoulders->description;
|
|
|
|
else
|
|
|
|
artShoulders->text = std::string();
|
2008-01-19 15:19:58 +02:00
|
|
|
artSpellBook = new CArtPlace(hero->artSpellBook);
|
|
|
|
artSpellBook->pos.x = 610;
|
|
|
|
artSpellBook->pos.y = 310;
|
2008-01-29 15:55:14 +02:00
|
|
|
artSpellBook->pos.h = artSpellBook->pos.w = 44;
|
|
|
|
if(hero->artSpellBook)
|
|
|
|
artSpellBook->text = hero->artSpellBook->description;
|
|
|
|
else
|
|
|
|
artSpellBook->text = std::string();
|
2008-01-19 15:19:58 +02:00
|
|
|
artTorso = new CArtPlace(hero->artTorso);
|
|
|
|
artTorso->pos.x = 509;
|
|
|
|
artTorso->pos.y = 130;
|
2008-01-29 15:55:14 +02:00
|
|
|
artTorso->pos.h = artTorso->pos.w = 44;
|
|
|
|
if(hero->artTorso)
|
|
|
|
artTorso->text = hero->artTorso->description;
|
|
|
|
else
|
|
|
|
artTorso->text = std::string();
|
2008-01-19 20:58:24 +02:00
|
|
|
for(int s=0; s<5 && s<curHero->artifacts.size(); ++s)
|
|
|
|
{
|
|
|
|
CArtPlace * add = new CArtPlace(curHero->artifacts[(s+backpackPos) % curHero->artifacts.size() ]);
|
|
|
|
add->pos.x = 403 + 46*s;
|
|
|
|
add->pos.y = 365;
|
2008-01-29 15:55:14 +02:00
|
|
|
add->pos.h = add->pos.w = 44;
|
|
|
|
if(hero->artifacts[s])
|
|
|
|
add->text = hero->artifacts[s]->description;
|
|
|
|
else
|
|
|
|
add->text = std::string();
|
2008-01-19 20:58:24 +02:00
|
|
|
backpack.push_back(add);
|
|
|
|
}
|
2008-01-26 21:36:31 +02:00
|
|
|
redrawCurBack();
|
2008-01-11 20:56:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CHeroWindow::quit()
|
|
|
|
{
|
|
|
|
for(int i=0; i<LOCPLINT->objsToBlit.size(); ++i)
|
|
|
|
{
|
|
|
|
if( dynamic_cast<CHeroWindow*>( LOCPLINT->objsToBlit[i] ) )
|
|
|
|
{
|
|
|
|
LOCPLINT->objsToBlit.erase(LOCPLINT->objsToBlit.begin()+i);
|
|
|
|
}
|
|
|
|
}
|
2008-01-26 21:36:31 +02:00
|
|
|
deactivate();
|
2008-01-13 18:24:24 +02:00
|
|
|
|
2008-01-11 20:56:39 +02:00
|
|
|
LOCPLINT->adventureInt->show();
|
2008-01-12 14:55:45 +02:00
|
|
|
|
|
|
|
SDL_FreeSurface(curBack);
|
|
|
|
curBack = NULL;
|
2008-01-20 17:26:34 +02:00
|
|
|
/*for(int v=0; v<LOCPLINT->lclickable.size(); ++v)
|
2008-01-19 15:19:58 +02:00
|
|
|
{
|
|
|
|
if(dynamic_cast<CArtPlace*>(LOCPLINT->lclickable[v]))
|
|
|
|
LOCPLINT->lclickable.erase(LOCPLINT->lclickable.begin()+v);
|
2008-01-20 17:26:34 +02:00
|
|
|
}*/
|
2008-01-19 15:19:58 +02:00
|
|
|
|
|
|
|
delete artFeet;
|
|
|
|
artFeet = 0;
|
2008-01-19 20:58:24 +02:00
|
|
|
delete artHead;
|
|
|
|
artHead = 0;
|
|
|
|
delete artLHand;
|
|
|
|
artLHand = 0;
|
|
|
|
delete artLRing;
|
|
|
|
artLRing = 0;
|
|
|
|
delete artMach1;
|
|
|
|
artMach1 = 0;
|
|
|
|
delete artMach2;
|
|
|
|
artMach2 = 0;
|
|
|
|
delete artMach3;
|
|
|
|
artMach3 = 0;
|
|
|
|
delete artMach4;
|
|
|
|
artMach4 = 0;
|
|
|
|
delete artMisc1;
|
|
|
|
artMisc1 = 0;
|
|
|
|
delete artMisc2;
|
|
|
|
artMisc2 = 0;
|
|
|
|
delete artMisc3;
|
|
|
|
artMisc3 = 0;
|
|
|
|
delete artMisc4;
|
|
|
|
artMisc4 = 0;
|
|
|
|
delete artMisc5;
|
|
|
|
artMisc5 = 0;
|
|
|
|
delete artNeck;
|
|
|
|
artNeck = 0;
|
|
|
|
delete artRhand;
|
|
|
|
artRhand = 0;
|
|
|
|
delete artRRing;
|
|
|
|
artRRing = 0;
|
|
|
|
delete artShoulders;
|
|
|
|
artShoulders = 0;
|
|
|
|
delete artSpellBook;
|
|
|
|
artSpellBook = 0;
|
|
|
|
delete artTorso;
|
|
|
|
artTorso = 0;
|
|
|
|
for(int g=0; g<backpack.size(); ++g)
|
|
|
|
{
|
|
|
|
delete backpack[g];
|
|
|
|
}
|
|
|
|
backpack.clear();
|
2008-01-11 20:56:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CHeroWindow::activate()
|
|
|
|
{
|
2008-01-20 14:34:39 +02:00
|
|
|
LOCPLINT->curint = this;
|
2008-01-11 20:56:39 +02:00
|
|
|
quitButton->activate();
|
2008-01-12 14:55:45 +02:00
|
|
|
dismissButton->activate();
|
|
|
|
questlogButton->activate();
|
2008-01-13 18:24:24 +02:00
|
|
|
gar1button->activate();
|
|
|
|
gar2button->activate();
|
|
|
|
gar3button->activate();
|
|
|
|
gar4button->activate();
|
2008-01-13 21:42:21 +02:00
|
|
|
leftArtRoll->activate();
|
|
|
|
rightArtRoll->activate();
|
2008-01-19 20:58:24 +02:00
|
|
|
portraitArea->activate();
|
2008-01-27 18:07:27 +02:00
|
|
|
expArea->activate();
|
2008-01-29 15:55:14 +02:00
|
|
|
spellPointsArea->activate();
|
2008-01-27 18:07:27 +02:00
|
|
|
for(int v=0; v<primSkillAreas.size(); ++v)
|
|
|
|
{
|
|
|
|
primSkillAreas[v]->activate();
|
|
|
|
}
|
2008-01-28 14:28:18 +02:00
|
|
|
for(int v=0; v<curHero->secSkills.size(); ++v)
|
2008-01-13 21:42:21 +02:00
|
|
|
{
|
2008-01-28 14:28:18 +02:00
|
|
|
secSkillAreas[v]->activate();
|
2008-01-13 21:42:21 +02:00
|
|
|
}
|
2008-01-15 20:50:52 +02:00
|
|
|
redrawCurBack();
|
2008-01-20 15:53:11 +02:00
|
|
|
|
2008-01-25 21:09:41 +02:00
|
|
|
if(artFeet)
|
|
|
|
artFeet->activate();
|
|
|
|
if(artHead)
|
|
|
|
artHead->activate();
|
|
|
|
if(artLHand)
|
|
|
|
artLHand->activate();
|
|
|
|
if(artLRing)
|
|
|
|
artLRing->activate();
|
|
|
|
if(artMach1)
|
|
|
|
artMach1->activate();
|
|
|
|
if(artMach2)
|
|
|
|
artMach2->activate();
|
|
|
|
if(artMach3)
|
|
|
|
artMach3->activate();
|
|
|
|
if(artMach4)
|
|
|
|
artMach4->activate();
|
|
|
|
if(artMisc1)
|
|
|
|
artMisc1->activate();
|
|
|
|
if(artMisc2)
|
|
|
|
artMisc2->activate();
|
|
|
|
if(artMisc3)
|
|
|
|
artMisc3->activate();
|
|
|
|
if(artMisc4)
|
|
|
|
artMisc4->activate();
|
|
|
|
if(artMisc5)
|
|
|
|
artMisc5->activate();
|
|
|
|
if(artNeck)
|
|
|
|
artNeck->activate();
|
|
|
|
if(artRhand)
|
|
|
|
artRhand->activate();
|
|
|
|
if(artRRing)
|
|
|
|
artRRing->activate();
|
|
|
|
if(artShoulders)
|
|
|
|
artShoulders->activate();
|
|
|
|
if(artSpellBook)
|
|
|
|
artSpellBook->activate();
|
|
|
|
if(artTorso)
|
|
|
|
artTorso->activate();
|
2008-01-20 15:53:11 +02:00
|
|
|
for(int f=0; f<backpack.size(); ++f)
|
|
|
|
{
|
2008-01-25 21:09:41 +02:00
|
|
|
if(backpack[f])
|
|
|
|
backpack[f]->activate();
|
2008-01-20 15:53:11 +02:00
|
|
|
}
|
2008-01-26 21:36:31 +02:00
|
|
|
for(int e=0; e<heroListMi.size(); ++e)
|
|
|
|
{
|
|
|
|
heroListMi[e]->activate();
|
|
|
|
}
|
2008-01-20 15:53:11 +02:00
|
|
|
|
2008-01-19 15:19:58 +02:00
|
|
|
//LOCPLINT->lclickable.push_back(artFeet);
|
2008-01-15 20:50:52 +02:00
|
|
|
}
|
|
|
|
|
2008-01-20 14:34:39 +02:00
|
|
|
void CHeroWindow::deactivate()
|
|
|
|
{
|
|
|
|
quitButton->deactivate();
|
|
|
|
dismissButton->deactivate();
|
|
|
|
questlogButton->deactivate();
|
|
|
|
gar1button->deactivate();
|
|
|
|
gar2button->deactivate();
|
|
|
|
gar3button->deactivate();
|
|
|
|
gar4button->deactivate();
|
|
|
|
leftArtRoll->deactivate();
|
|
|
|
rightArtRoll->deactivate();
|
|
|
|
portraitArea->deactivate();
|
2008-01-27 18:07:27 +02:00
|
|
|
expArea->deactivate();
|
2008-01-29 15:55:14 +02:00
|
|
|
spellPointsArea->deactivate();
|
2008-01-27 18:07:27 +02:00
|
|
|
for(int v=0; v<primSkillAreas.size(); ++v)
|
|
|
|
{
|
|
|
|
primSkillAreas[v]->deactivate();
|
|
|
|
}
|
2008-01-29 15:55:14 +02:00
|
|
|
for(int v=0; v<curHero->secSkills.size(); ++v)
|
2008-01-25 21:09:41 +02:00
|
|
|
{
|
2008-01-28 14:28:18 +02:00
|
|
|
secSkillAreas[v]->deactivate();
|
2008-01-25 21:09:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if(artFeet)
|
|
|
|
artFeet->deactivate();
|
|
|
|
if(artHead)
|
|
|
|
artHead->deactivate();
|
|
|
|
if(artLHand)
|
|
|
|
artLHand->deactivate();
|
|
|
|
if(artLRing)
|
|
|
|
artLRing->deactivate();
|
|
|
|
if(artMach1)
|
|
|
|
artMach1->deactivate();
|
|
|
|
if(artMach2)
|
|
|
|
artMach2->deactivate();
|
|
|
|
if(artMach3)
|
|
|
|
artMach3->deactivate();
|
|
|
|
if(artMach4)
|
|
|
|
artMach4->deactivate();
|
|
|
|
if(artMisc1)
|
|
|
|
artMisc1->deactivate();
|
|
|
|
if(artMisc2)
|
|
|
|
artMisc2->deactivate();
|
|
|
|
if(artMisc3)
|
|
|
|
artMisc3->deactivate();
|
|
|
|
if(artMisc4)
|
|
|
|
artMisc4->deactivate();
|
|
|
|
if(artMisc5)
|
|
|
|
artMisc5->deactivate();
|
|
|
|
if(artNeck)
|
|
|
|
artNeck->deactivate();
|
|
|
|
if(artRhand)
|
|
|
|
artRhand->deactivate();
|
|
|
|
if(artRRing)
|
|
|
|
artRRing->deactivate();
|
|
|
|
if(artShoulders)
|
|
|
|
artShoulders->deactivate();
|
|
|
|
if(artSpellBook)
|
|
|
|
artSpellBook->deactivate();
|
|
|
|
if(artTorso)
|
|
|
|
artTorso->deactivate();
|
2008-01-20 15:53:11 +02:00
|
|
|
for(int f=0; f<backpack.size(); ++f)
|
2008-01-25 21:09:41 +02:00
|
|
|
{
|
|
|
|
if(backpack[f])
|
|
|
|
backpack[f]->deactivate();
|
2008-01-20 15:53:11 +02:00
|
|
|
}
|
2008-01-26 21:36:31 +02:00
|
|
|
for(int e=0; e<heroListMi.size(); ++e)
|
|
|
|
{
|
|
|
|
heroListMi[e]->deactivate();
|
|
|
|
}
|
2008-01-20 14:34:39 +02:00
|
|
|
}
|
|
|
|
|
2008-01-15 20:50:52 +02:00
|
|
|
void CHeroWindow::dismissCurrent()
|
|
|
|
{
|
2008-01-27 18:07:27 +02:00
|
|
|
LOCPLINT->cb->dismissHero(curHero);
|
|
|
|
quit();
|
2008-01-15 20:50:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CHeroWindow::questlog()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void CHeroWindow::gar1()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void CHeroWindow::gar2()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void CHeroWindow::gar3()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void CHeroWindow::gar4()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void CHeroWindow::leftArtRoller()
|
|
|
|
{
|
2008-01-19 20:58:24 +02:00
|
|
|
if(curHero->artifacts.size()>5) //if it is <=5, we have nothing to scroll
|
|
|
|
{
|
|
|
|
backpackPos+=curHero->artifacts.size()-1; //set new offset
|
|
|
|
|
|
|
|
for(int s=0; s<5 && s<curHero->artifacts.size(); ++s) //set new data
|
|
|
|
{
|
|
|
|
backpack[s]->ourArt = curHero->artifacts[(s+backpackPos) % curHero->artifacts.size() ];
|
2008-01-29 15:55:14 +02:00
|
|
|
backpack[s]->text = backpack[s]->ourArt->description;
|
2008-01-19 20:58:24 +02:00
|
|
|
}
|
|
|
|
}
|
2008-01-15 20:50:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CHeroWindow::rightArtRoller()
|
|
|
|
{
|
2008-01-19 20:58:24 +02:00
|
|
|
if(curHero->artifacts.size()>5) //if it is <=5, we have nothing to scroll
|
|
|
|
{
|
|
|
|
backpackPos+=1; //set new offset
|
|
|
|
|
|
|
|
for(int s=0; s<5 && s<curHero->artifacts.size(); ++s) //set new data
|
|
|
|
{
|
|
|
|
backpack[s]->ourArt = curHero->artifacts[(s+backpackPos) % curHero->artifacts.size() ];
|
2008-01-29 15:55:14 +02:00
|
|
|
backpack[s]->text = backpack[s]->ourArt->description;
|
2008-01-19 20:58:24 +02:00
|
|
|
}
|
|
|
|
}
|
2008-01-15 20:50:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CHeroWindow::switchHero()
|
|
|
|
{
|
2008-01-25 21:09:41 +02:00
|
|
|
//int y;
|
|
|
|
//SDL_GetMouseState(NULL, &y);
|
|
|
|
//for(int g=0; g<heroListMi.size(); ++g)
|
|
|
|
//{
|
|
|
|
// if(y>=94+54*g)
|
|
|
|
// {
|
|
|
|
// //quit();
|
|
|
|
// setHero(LOCPLINT->cb->getHeroInfo(player, g, false));
|
|
|
|
// //LOCPLINT->openHeroWindow(curHero);
|
|
|
|
// redrawCurBack();
|
|
|
|
// }
|
|
|
|
//}
|
2008-01-15 20:50:52 +02:00
|
|
|
}
|
2008-01-12 14:55:45 +02:00
|
|
|
|
2008-01-15 20:50:52 +02:00
|
|
|
void CHeroWindow::redrawCurBack()
|
|
|
|
{
|
|
|
|
if(curBack)
|
|
|
|
SDL_FreeSurface(curBack);
|
2008-01-12 14:55:45 +02:00
|
|
|
curBack = CSDL_Ext::copySurface(background);
|
2008-01-15 20:50:52 +02:00
|
|
|
|
2008-01-12 14:55:45 +02:00
|
|
|
blitAt(skillpics->ourImages[0].bitmap, 32, 111, curBack);
|
|
|
|
blitAt(skillpics->ourImages[1].bitmap, 102, 111, curBack);
|
|
|
|
blitAt(skillpics->ourImages[2].bitmap, 172, 111, curBack);
|
|
|
|
blitAt(skillpics->ourImages[5].bitmap, 242, 111, curBack);
|
|
|
|
blitAt(skillpics->ourImages[4].bitmap, 20, 230, curBack);
|
|
|
|
blitAt(skillpics->ourImages[3].bitmap, 162, 230, curBack);
|
2008-01-13 18:24:24 +02:00
|
|
|
|
|
|
|
blitAt(curHero->type->portraitLarge, 19, 19, curBack);
|
|
|
|
|
|
|
|
CSDL_Ext::printAtMiddle(curHero->name, 190, 40, GEORXX, tytulowy, curBack);
|
|
|
|
|
|
|
|
std::stringstream secondLine;
|
|
|
|
secondLine<<"Level "<<curHero->level<<" "<<curHero->type->heroClass->name;
|
|
|
|
CSDL_Ext::printAtMiddle(secondLine.str(), 190, 66, TNRB16, zwykly, curBack);
|
|
|
|
|
2008-01-15 20:50:52 +02:00
|
|
|
//primary skliis names
|
|
|
|
CSDL_Ext::printAtMiddle(CGI->generaltexth->jktexts[1], 53, 98, GEOR13, tytulowy, curBack);
|
|
|
|
CSDL_Ext::printAtMiddle(CGI->generaltexth->jktexts[2], 123, 98, GEOR13, tytulowy, curBack);
|
|
|
|
CSDL_Ext::printAtMiddle(CGI->generaltexth->jktexts[3], 193, 98, GEOR13, tytulowy, curBack);
|
|
|
|
CSDL_Ext::printAtMiddle(CGI->generaltexth->jktexts[4], 263, 98, GEOR13, tytulowy, curBack);
|
2008-01-13 18:24:24 +02:00
|
|
|
|
2008-01-15 20:50:52 +02:00
|
|
|
//dismiss / quest log
|
|
|
|
std::vector<std::string> * toPrin = CMessage::breakText(CGI->generaltexth->jktexts[8].substr(1, CGI->generaltexth->jktexts[8].size()-2));
|
|
|
|
if(toPrin->size()==1)
|
|
|
|
{
|
|
|
|
CSDL_Ext::printAt((*toPrin)[0], 372, 440, GEOR13, zwykly, curBack);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CSDL_Ext::printAt((*toPrin)[0], 372, 431, GEOR13, zwykly, curBack);
|
|
|
|
CSDL_Ext::printAt((*toPrin)[1], 372, 447, GEOR13, zwykly, curBack);
|
|
|
|
}
|
|
|
|
delete toPrin;
|
|
|
|
|
|
|
|
toPrin = CMessage::breakText(CGI->generaltexth->jktexts[9].substr(1, CGI->generaltexth->jktexts[9].size()-2));
|
|
|
|
if(toPrin->size()==1)
|
|
|
|
{
|
|
|
|
CSDL_Ext::printAt((*toPrin)[0], 512, 440, GEOR13, zwykly, curBack);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CSDL_Ext::printAt((*toPrin)[0], 512, 431, GEOR13, zwykly, curBack);
|
|
|
|
CSDL_Ext::printAt((*toPrin)[1], 512, 447, GEOR13, zwykly, curBack);
|
|
|
|
}
|
|
|
|
delete toPrin;
|
|
|
|
|
|
|
|
//printing primary skills' amounts
|
2008-01-13 18:24:24 +02:00
|
|
|
std::stringstream primarySkill1;
|
|
|
|
primarySkill1<<curHero->primSkills[0];
|
|
|
|
CSDL_Ext::printAtMiddle(primarySkill1.str(), 53, 165, TNRB16, zwykly, curBack);
|
|
|
|
|
|
|
|
std::stringstream primarySkill2;
|
|
|
|
primarySkill2<<curHero->primSkills[1];
|
|
|
|
CSDL_Ext::printAtMiddle(primarySkill2.str(), 123, 165, TNRB16, zwykly, curBack);
|
|
|
|
|
|
|
|
std::stringstream primarySkill3;
|
|
|
|
primarySkill3<<curHero->primSkills[2];
|
|
|
|
CSDL_Ext::printAtMiddle(primarySkill3.str(), 193, 165, TNRB16, zwykly, curBack);
|
|
|
|
|
|
|
|
std::stringstream primarySkill4;
|
|
|
|
primarySkill4<<curHero->primSkills[3];
|
|
|
|
CSDL_Ext::printAtMiddle(primarySkill4.str(), 263, 165, TNRB16, zwykly, curBack);
|
|
|
|
|
|
|
|
blitAt(LOCPLINT->luck42->ourImages[curHero->getCurrentLuck()+3].bitmap, 239, 182, curBack);
|
|
|
|
blitAt(LOCPLINT->morale42->ourImages[curHero->getCurrentMorale()+3].bitmap, 181, 182, curBack);
|
|
|
|
|
|
|
|
blitAt(flags->ourImages[player].bitmap, 606, 8, curBack);
|
2008-01-13 21:42:21 +02:00
|
|
|
|
|
|
|
//hero list blitting
|
|
|
|
for(int g=0; g<LOCPLINT->cb->howManyHeroes(); ++g)
|
|
|
|
{
|
|
|
|
const CGHeroInstance * cur = LOCPLINT->cb->getHeroInfo(player, g, false);
|
|
|
|
blitAt(cur->type->portraitSmall, 611, 87+g*54, curBack);
|
|
|
|
//printing yellow border
|
|
|
|
if(cur->name == curHero->name)
|
|
|
|
{
|
|
|
|
for(int f=0; f<cur->type->portraitSmall->w; ++f)
|
|
|
|
{
|
|
|
|
for(int h=0; h<cur->type->portraitSmall->h; ++h)
|
|
|
|
if(f==0 || h==0 || f==cur->type->portraitSmall->w-1 || h==cur->type->portraitSmall->h-1)
|
|
|
|
{
|
|
|
|
CSDL_Ext::SDL_PutPixel(curBack, 611+f, 87+g*54+h, 240, 220, 120);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-15 20:50:52 +02:00
|
|
|
//secondary skills
|
|
|
|
if(curHero->secSkills.size()>=1)
|
2008-01-13 21:42:21 +02:00
|
|
|
{
|
2008-01-15 20:50:52 +02:00
|
|
|
blitAt(CGI->abilh->abils44->ourImages[curHero->secSkills[0].first*3+3+curHero->secSkills[0].second].bitmap, 18, 276, curBack);
|
|
|
|
CSDL_Ext::printAt(CGI->abilh->levels[curHero->secSkills[0].second], 69, 279, GEOR13, zwykly, curBack);
|
|
|
|
CSDL_Ext::printAt(CGI->abilh->abilities[curHero->secSkills[0].first]->name, 69, 299, GEOR13, zwykly, curBack);
|
2008-01-13 21:42:21 +02:00
|
|
|
}
|
2008-01-15 20:50:52 +02:00
|
|
|
if(curHero->secSkills.size()>=2)
|
|
|
|
{
|
|
|
|
blitAt(CGI->abilh->abils44->ourImages[curHero->secSkills[1].first*3+3+curHero->secSkills[1].second].bitmap, 161, 276, curBack);
|
|
|
|
CSDL_Ext::printAt(CGI->abilh->levels[curHero->secSkills[1].second], 213, 279, GEOR13, zwykly, curBack);
|
|
|
|
CSDL_Ext::printAt(CGI->abilh->abilities[curHero->secSkills[1].first]->name, 213, 299, GEOR13, zwykly, curBack);
|
|
|
|
}
|
|
|
|
if(curHero->secSkills.size()>=3)
|
|
|
|
{
|
|
|
|
blitAt(CGI->abilh->abils44->ourImages[curHero->secSkills[2].first*3+3+curHero->secSkills[2].second].bitmap, 18, 324, curBack);
|
|
|
|
CSDL_Ext::printAt(CGI->abilh->levels[curHero->secSkills[2].second], 69, 327, GEOR13, zwykly, curBack);
|
|
|
|
CSDL_Ext::printAt(CGI->abilh->abilities[curHero->secSkills[2].first]->name, 69, 347, GEOR13, zwykly, curBack);
|
|
|
|
}
|
|
|
|
if(curHero->secSkills.size()>=4)
|
|
|
|
{
|
|
|
|
blitAt(CGI->abilh->abils44->ourImages[curHero->secSkills[3].first*3+3+curHero->secSkills[3].second].bitmap, 161, 324, curBack);
|
|
|
|
CSDL_Ext::printAt(CGI->abilh->levels[curHero->secSkills[3].second], 213, 327, GEOR13, zwykly, curBack);
|
|
|
|
CSDL_Ext::printAt(CGI->abilh->abilities[curHero->secSkills[3].first]->name, 213, 347, GEOR13, zwykly, curBack);
|
|
|
|
}
|
|
|
|
if(curHero->secSkills.size()>=5)
|
|
|
|
{
|
|
|
|
blitAt(CGI->abilh->abils44->ourImages[curHero->secSkills[4].first*3+3+curHero->secSkills[4].second].bitmap, 18, 372, curBack);
|
|
|
|
CSDL_Ext::printAt(CGI->abilh->levels[curHero->secSkills[4].second], 69, 375, GEOR13, zwykly, curBack);
|
|
|
|
CSDL_Ext::printAt(CGI->abilh->abilities[curHero->secSkills[4].first]->name, 69, 395, GEOR13, zwykly, curBack);
|
|
|
|
}
|
|
|
|
if(curHero->secSkills.size()>=6)
|
|
|
|
{
|
|
|
|
blitAt(CGI->abilh->abils44->ourImages[curHero->secSkills[5].first*3+3+curHero->secSkills[5].second].bitmap, 161, 372, curBack);
|
|
|
|
CSDL_Ext::printAt(CGI->abilh->levels[curHero->secSkills[5].second], 213, 375, GEOR13, zwykly, curBack);
|
|
|
|
CSDL_Ext::printAt(CGI->abilh->abilities[curHero->secSkills[5].first]->name, 213, 395, GEOR13, zwykly, curBack);
|
|
|
|
}
|
|
|
|
if(curHero->secSkills.size()>=7)
|
|
|
|
{
|
|
|
|
blitAt(CGI->abilh->abils44->ourImages[curHero->secSkills[6].first*3+3+curHero->secSkills[6].second].bitmap, 18, 420, curBack);
|
|
|
|
CSDL_Ext::printAt(CGI->abilh->levels[curHero->secSkills[6].second], 69, 423, GEOR13, zwykly, curBack);
|
|
|
|
CSDL_Ext::printAt(CGI->abilh->abilities[curHero->secSkills[6].first]->name, 69, 443, GEOR13, zwykly, curBack);
|
|
|
|
}
|
|
|
|
if(curHero->secSkills.size()>=8)
|
|
|
|
{
|
|
|
|
blitAt(CGI->abilh->abils44->ourImages[curHero->secSkills[7].first*3+3+curHero->secSkills[7].second].bitmap, 161, 420, curBack);
|
|
|
|
CSDL_Ext::printAt(CGI->abilh->levels[curHero->secSkills[7].second], 213, 423, GEOR13, zwykly, curBack);
|
|
|
|
CSDL_Ext::printAt(CGI->abilh->abilities[curHero->secSkills[7].first]->name, 213, 443, GEOR13, zwykly, curBack);
|
|
|
|
}
|
|
|
|
|
|
|
|
//printing special ability
|
|
|
|
blitAt(CGI->heroh->un44->ourImages[curHero->subID].bitmap, 18, 180, curBack);
|
|
|
|
|
|
|
|
//printing necessery texts
|
|
|
|
CSDL_Ext::printAt(CGI->generaltexth->jktexts[6].substr(1, CGI->generaltexth->jktexts[6].size()-2), 69, 231, GEOR13, tytulowy, curBack);
|
|
|
|
std::stringstream expstr;
|
|
|
|
expstr<<curHero->exp;
|
|
|
|
CSDL_Ext::printAt(expstr.str(), 69, 247, GEOR16, zwykly, curBack);
|
|
|
|
CSDL_Ext::printAt(CGI->generaltexth->jktexts[7].substr(1, CGI->generaltexth->jktexts[7].size()-2), 212, 231, GEOR13, tytulowy, curBack);
|
|
|
|
std::stringstream manastr;
|
|
|
|
manastr<<curHero->mana<<'/'<<curHero->primSkills[3]*10;
|
|
|
|
CSDL_Ext::printAt(manastr.str(), 212, 247, GEOR16, zwykly, curBack);
|
2008-01-19 15:19:58 +02:00
|
|
|
}
|
|
|
|
|
2008-01-20 17:26:34 +02:00
|
|
|
CArtPlace::CArtPlace(CArtifact *art): ourArt(art), active(false){}
|
2008-01-19 15:19:58 +02:00
|
|
|
void CArtPlace::activate()
|
|
|
|
{
|
2008-01-20 17:26:34 +02:00
|
|
|
if(!active)
|
|
|
|
{
|
2008-01-29 15:55:14 +02:00
|
|
|
//ClickableL::activate();
|
|
|
|
LRClickableAreaWTextComp::activate();
|
2008-01-20 17:26:34 +02:00
|
|
|
active = true;
|
|
|
|
}
|
2008-01-19 15:19:58 +02:00
|
|
|
}
|
|
|
|
void CArtPlace::clickLeft(boost::logic::tribool down)
|
|
|
|
{
|
2008-01-29 15:55:14 +02:00
|
|
|
//LRClickableAreaWTextComp::clickLeft(down);
|
|
|
|
}
|
|
|
|
void CArtPlace::clickRight(boost::logic::tribool down)
|
|
|
|
{
|
|
|
|
if(text.size()) //if there is no description, do nothing ;]
|
|
|
|
LRClickableAreaWTextComp::clickRight(down);
|
2008-01-19 15:19:58 +02:00
|
|
|
}
|
|
|
|
void CArtPlace::deactivate()
|
|
|
|
{
|
2008-01-20 17:26:34 +02:00
|
|
|
if(active)
|
|
|
|
{
|
|
|
|
active = false;
|
2008-01-29 15:55:14 +02:00
|
|
|
//ClickableL::deactivate();
|
|
|
|
LRClickableAreaWTextComp::deactivate();
|
2008-01-20 17:26:34 +02:00
|
|
|
}
|
2008-01-19 15:19:58 +02:00
|
|
|
}
|
|
|
|
void CArtPlace::show(SDL_Surface *to)
|
|
|
|
{
|
|
|
|
if(ourArt)
|
|
|
|
{
|
|
|
|
blitAt(CGI->arth->artDefs->ourImages[ourArt->id].bitmap, pos.x, pos.y, to);
|
|
|
|
}
|
|
|
|
}
|
2008-01-20 15:53:11 +02:00
|
|
|
CArtPlace::~CArtPlace()
|
|
|
|
{
|
2008-01-20 17:26:34 +02:00
|
|
|
deactivate();
|
2008-01-20 15:53:11 +02:00
|
|
|
}
|
2008-01-19 20:58:24 +02:00
|
|
|
|
|
|
|
void LClickableArea::activate()
|
|
|
|
{
|
|
|
|
ClickableL::activate();
|
|
|
|
}
|
|
|
|
void LClickableArea::deactivate()
|
|
|
|
{
|
|
|
|
ClickableL::deactivate();
|
|
|
|
}
|
|
|
|
void LClickableArea::clickLeft(boost::logic::tribool down)
|
|
|
|
{
|
|
|
|
if(!down)
|
|
|
|
{
|
|
|
|
LOCPLINT->showInfoDialog("TEST TEST AAA", std::vector<SComponent*>());
|
|
|
|
}
|
|
|
|
}
|
2008-01-20 15:53:11 +02:00
|
|
|
|
2008-01-27 18:07:27 +02:00
|
|
|
void RClickableArea::activate()
|
|
|
|
{
|
|
|
|
ClickableR::activate();
|
|
|
|
}
|
|
|
|
void RClickableArea::deactivate()
|
|
|
|
{
|
|
|
|
ClickableR::deactivate();
|
|
|
|
}
|
|
|
|
void RClickableArea::clickRight(boost::logic::tribool down)
|
|
|
|
{
|
|
|
|
if(!down)
|
|
|
|
{
|
|
|
|
LOCPLINT->showInfoDialog("TEST TEST AAA", std::vector<SComponent*>());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void LRClickableAreaWText::clickLeft(boost::logic::tribool down)
|
2008-01-20 15:53:11 +02:00
|
|
|
{
|
|
|
|
if(!down)
|
|
|
|
{
|
|
|
|
LOCPLINT->showInfoDialog(text, std::vector<SComponent*>());
|
|
|
|
}
|
|
|
|
}
|
2008-01-27 18:07:27 +02:00
|
|
|
void LRClickableAreaWText::clickRight(boost::logic::tribool down)
|
|
|
|
{
|
|
|
|
LOCPLINT->adventureInt->handleRightClick(text, down, this);
|
|
|
|
}
|
|
|
|
void LRClickableAreaWText::activate()
|
|
|
|
{
|
|
|
|
LClickableArea::activate();
|
|
|
|
RClickableArea::activate();
|
|
|
|
}
|
|
|
|
void LRClickableAreaWText::deactivate()
|
|
|
|
{
|
|
|
|
LClickableArea::deactivate();
|
|
|
|
RClickableArea::deactivate();
|
|
|
|
}
|
2008-01-25 21:09:41 +02:00
|
|
|
|
|
|
|
void LClickableAreaHero::clickLeft(boost::logic::tribool down)
|
|
|
|
{
|
|
|
|
if(!down)
|
|
|
|
{
|
2008-01-26 21:36:31 +02:00
|
|
|
owner->deactivate();
|
2008-01-25 21:09:41 +02:00
|
|
|
const CGHeroInstance * buf = LOCPLINT->cb->getHeroInfo(owner->player, id, false);
|
|
|
|
owner->setHero(buf);
|
|
|
|
owner->redrawCurBack();
|
2008-01-26 21:36:31 +02:00
|
|
|
owner->activate();
|
2008-01-25 21:09:41 +02:00
|
|
|
}
|
|
|
|
}
|
2008-01-27 18:07:27 +02:00
|
|
|
|
|
|
|
void LRClickableAreaWTextComp::clickLeft(boost::logic::tribool down)
|
|
|
|
{
|
2008-01-28 14:36:46 +02:00
|
|
|
if((!down) && pressedL)
|
2008-01-27 18:07:27 +02:00
|
|
|
{
|
2008-01-28 14:28:18 +02:00
|
|
|
LOCPLINT->showInfoDialog(text, std::vector<SComponent*>(1, new SComponent(SComponent::Etype(baseType), type, bonus)));
|
2008-01-27 18:07:27 +02:00
|
|
|
}
|
2008-01-28 14:36:46 +02:00
|
|
|
ClickableL::clickLeft(down);
|
2008-01-27 18:07:27 +02:00
|
|
|
}
|
|
|
|
void LRClickableAreaWTextComp::clickRight(boost::logic::tribool down)
|
|
|
|
{
|
|
|
|
LOCPLINT->adventureInt->handleRightClick(text, down, this);
|
|
|
|
}
|
|
|
|
void LRClickableAreaWTextComp::activate()
|
|
|
|
{
|
|
|
|
LClickableArea::activate();
|
|
|
|
RClickableArea::activate();
|
|
|
|
}
|
|
|
|
void LRClickableAreaWTextComp::deactivate()
|
|
|
|
{
|
|
|
|
LClickableArea::deactivate();
|
|
|
|
RClickableArea::deactivate();
|
|
|
|
}
|
|
|
|
|