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)
|
|
|
|
{
|
|
|
|
heroList.push_back(new AdventureMapButton<CHeroWindow>(std::string(), std::string(), &CHeroWindow::switchHero, 677, 95+g*54, "hsbtns5.def", this));
|
|
|
|
}
|
|
|
|
|
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-20 15:53:11 +02:00
|
|
|
portraitArea = new LClickableAreaWText();
|
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-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;
|
|
|
|
|
|
|
|
for(int g=0; g<heroList.size(); ++g)
|
|
|
|
delete heroList[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-10 21:01:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CHeroWindow::show(SDL_Surface *to)
|
|
|
|
{
|
|
|
|
if(!to)
|
|
|
|
to=ekran;
|
2008-01-12 14:55:45 +02:00
|
|
|
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)
|
|
|
|
{
|
|
|
|
curHero = hero;
|
2008-01-20 15:53:11 +02:00
|
|
|
portraitArea->text = hero->biography;
|
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-20 15:53:11 +02:00
|
|
|
artFeet->activate();
|
2008-01-19 15:19:58 +02:00
|
|
|
artHead = new CArtPlace(hero->artHead);
|
|
|
|
artHead->pos.x = 509;
|
|
|
|
artHead->pos.y = 30;
|
|
|
|
artHead->pos.h = artHead->pos.h = 44;
|
2008-01-20 15:53:11 +02:00
|
|
|
artHead->activate();
|
2008-01-19 15:19:58 +02:00
|
|
|
artLHand = new CArtPlace(hero->artLHand);
|
|
|
|
artLHand->pos.x = 564;
|
|
|
|
artLHand->pos.y = 183;
|
|
|
|
artLHand->pos.h = artLHand->pos.h = 44;
|
2008-01-20 15:53:11 +02:00
|
|
|
artLHand->activate();
|
2008-01-19 15:19:58 +02:00
|
|
|
artLRing = new CArtPlace(hero->artLRing);
|
|
|
|
artLRing->pos.x = 610;
|
|
|
|
artLRing->pos.y = 183;
|
|
|
|
artLRing->pos.h = artLRing->pos.h = 44;
|
2008-01-20 15:53:11 +02:00
|
|
|
artLRing->activate();
|
2008-01-19 15:19:58 +02:00
|
|
|
artMach1 = new CArtPlace(hero->artMach1);
|
|
|
|
artMach1->pos.x = 564;
|
|
|
|
artMach1->pos.y = 30;
|
|
|
|
artMach1->pos.h = artMach1->pos.h = 44;
|
2008-01-20 15:53:11 +02:00
|
|
|
artMach1->activate();
|
2008-01-19 15:19:58 +02:00
|
|
|
artMach2 = new CArtPlace(hero->artMach2);
|
|
|
|
artMach2->pos.x = 610;
|
|
|
|
artMach2->pos.y = 30;
|
|
|
|
artMach2->pos.h = artMach2->pos.h = 44;
|
2008-01-20 15:53:11 +02:00
|
|
|
artMach2->activate();
|
2008-01-19 15:19:58 +02:00
|
|
|
artMach3 = new CArtPlace(hero->artMach3);
|
|
|
|
artMach3->pos.x = 610;
|
|
|
|
artMach3->pos.y = 76;
|
|
|
|
artMach3->pos.h = artMach3->pos.h = 44;
|
2008-01-20 15:53:11 +02:00
|
|
|
artMach3->activate();
|
2008-01-19 15:19:58 +02:00
|
|
|
artMach4 = new CArtPlace(hero->artMach4);
|
|
|
|
artMach4->pos.x = 610;
|
|
|
|
artMach4->pos.y = 122;
|
|
|
|
artMach4->pos.h = artMach4->pos.h = 44;
|
2008-01-20 15:53:11 +02:00
|
|
|
artMach4->activate();
|
2008-01-19 15:19:58 +02:00
|
|
|
artMisc1 = new CArtPlace(hero->artMisc1);
|
|
|
|
artMisc1->pos.x = 383;
|
|
|
|
artMisc1->pos.y = 143;
|
|
|
|
artMisc1->pos.h = artMisc1->pos.h = 44;
|
2008-01-20 15:53:11 +02:00
|
|
|
artMisc1->activate();
|
2008-01-19 15:19:58 +02:00
|
|
|
artMisc2 = new CArtPlace(hero->artMisc2);
|
|
|
|
artMisc2->pos.x = 399;
|
|
|
|
artMisc2->pos.y = 194;
|
|
|
|
artMisc2->pos.h = artMisc2->pos.h = 44;
|
2008-01-20 15:53:11 +02:00
|
|
|
artMisc2->activate();
|
2008-01-19 15:19:58 +02:00
|
|
|
artMisc3 = new CArtPlace(hero->artMisc3);
|
|
|
|
artMisc3->pos.x = 415;
|
|
|
|
artMisc3->pos.y = 245;
|
|
|
|
artMisc3->pos.h = artMisc3->pos.h = 44;
|
2008-01-20 15:53:11 +02:00
|
|
|
artMisc3->activate();
|
2008-01-19 15:19:58 +02:00
|
|
|
artMisc4 = new CArtPlace(hero->artMisc4);
|
|
|
|
artMisc4->pos.x = 431;
|
|
|
|
artMisc4->pos.y = 296;
|
|
|
|
artMisc4->pos.h = artMisc4->pos.h = 44;
|
2008-01-20 15:53:11 +02:00
|
|
|
artMisc4->activate();
|
2008-01-19 15:19:58 +02:00
|
|
|
artMisc5 = new CArtPlace(hero->artMisc5);
|
|
|
|
artMisc5->pos.x = 381;
|
|
|
|
artMisc5->pos.y = 296;
|
|
|
|
artMisc5->pos.h = artMisc5->pos.h = 44;
|
2008-01-20 15:53:11 +02:00
|
|
|
artMisc5->activate();
|
2008-01-19 15:19:58 +02:00
|
|
|
artNeck = new CArtPlace(hero->artNeck);
|
|
|
|
artNeck->pos.x = 508;
|
|
|
|
artNeck->pos.y = 79;
|
|
|
|
artNeck->pos.h = artNeck->pos.h = 44;
|
2008-01-20 15:53:11 +02:00
|
|
|
artNeck->activate();
|
2008-01-19 15:19:58 +02:00
|
|
|
artRhand = new CArtPlace(hero->artRhand);
|
|
|
|
artRhand->pos.x = 383;
|
|
|
|
artRhand->pos.y = 68;
|
|
|
|
artRhand->pos.h = artRhand->pos.h = 44;
|
2008-01-20 15:53:11 +02:00
|
|
|
artRhand->activate();
|
2008-01-19 15:19:58 +02:00
|
|
|
artRRing = new CArtPlace(hero->artRRing);
|
|
|
|
artRRing->pos.x = 431;
|
|
|
|
artRRing->pos.y = 68;
|
|
|
|
artRRing->pos.h = artRRing->pos.h = 44;
|
2008-01-20 15:53:11 +02:00
|
|
|
artRRing->activate();
|
2008-01-19 15:19:58 +02:00
|
|
|
artShoulders = new CArtPlace(hero->artShoulders);
|
|
|
|
artShoulders->pos.x = 567;
|
|
|
|
artShoulders->pos.y = 240;
|
|
|
|
artShoulders->pos.h = artShoulders->pos.h = 44;
|
2008-01-20 15:53:11 +02:00
|
|
|
artShoulders->activate();
|
2008-01-19 15:19:58 +02:00
|
|
|
artSpellBook = new CArtPlace(hero->artSpellBook);
|
|
|
|
artSpellBook->pos.x = 610;
|
|
|
|
artSpellBook->pos.y = 310;
|
|
|
|
artSpellBook->pos.h = artSpellBook->pos.h = 44;
|
2008-01-20 15:53:11 +02:00
|
|
|
artSpellBook->activate();
|
2008-01-19 15:19:58 +02:00
|
|
|
artTorso = new CArtPlace(hero->artTorso);
|
|
|
|
artTorso->pos.x = 509;
|
|
|
|
artTorso->pos.y = 130;
|
|
|
|
artTorso->pos.h = artTorso->pos.h = 44;
|
2008-01-20 15:53:11 +02:00
|
|
|
artTorso->activate();
|
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;
|
|
|
|
add->pos.h = add->pos.h = 44;
|
2008-01-20 15:53:11 +02:00
|
|
|
add->activate();
|
2008-01-19 20:58:24 +02:00
|
|
|
backpack.push_back(add);
|
|
|
|
}
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
quitButton->deactivate();
|
2008-01-12 14:55:45 +02:00
|
|
|
dismissButton->deactivate();
|
|
|
|
questlogButton->deactivate();
|
2008-01-13 18:24:24 +02:00
|
|
|
gar1button->deactivate();
|
|
|
|
gar2button->deactivate();
|
|
|
|
gar3button->deactivate();
|
|
|
|
gar4button->deactivate();
|
2008-01-13 21:42:21 +02:00
|
|
|
leftArtRoll->deactivate();
|
|
|
|
rightArtRoll->deactivate();
|
|
|
|
for(int g=0; g<heroList.size(); ++g)
|
|
|
|
{
|
|
|
|
heroList[g]->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 20:58:24 +02:00
|
|
|
portraitArea->deactivate();
|
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-13 21:42:21 +02:00
|
|
|
for(int g=0; g<heroList.size(); ++g)
|
|
|
|
{
|
|
|
|
heroList[g]->activate();
|
|
|
|
}
|
2008-01-15 20:50:52 +02:00
|
|
|
redrawCurBack();
|
2008-01-20 15:53:11 +02:00
|
|
|
|
|
|
|
artFeet->activate();
|
|
|
|
artHead->activate();
|
|
|
|
artLHand->activate();
|
|
|
|
artLRing->activate();
|
|
|
|
artMach1->activate();
|
|
|
|
artMach2->activate();
|
|
|
|
artMach3->activate();
|
|
|
|
artMach4->activate();
|
|
|
|
artMisc1->activate();
|
|
|
|
artMisc2->activate();
|
|
|
|
artMisc3->activate();
|
|
|
|
artMisc4->activate();
|
|
|
|
artMisc5->activate();
|
|
|
|
artNeck->activate();
|
|
|
|
artRhand->activate();
|
|
|
|
artRRing->activate();
|
|
|
|
artShoulders->activate();
|
|
|
|
artSpellBook->activate();
|
|
|
|
artTorso->activate();
|
|
|
|
for(int f=0; f<backpack.size(); ++f)
|
|
|
|
{
|
|
|
|
backpack[f]->activate();
|
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
for(int g=0; g<heroList.size(); ++g)
|
|
|
|
{
|
|
|
|
heroList[g]->deactivate();
|
|
|
|
}
|
2008-01-20 15:53:11 +02:00
|
|
|
|
|
|
|
artFeet->deactivate();
|
|
|
|
artHead->deactivate();
|
|
|
|
artLHand->deactivate();
|
|
|
|
artLRing->deactivate();
|
|
|
|
artMach1->deactivate();
|
|
|
|
artMach2->deactivate();
|
|
|
|
artMach3->deactivate();
|
|
|
|
artMach4->deactivate();
|
|
|
|
artMisc1->deactivate();
|
|
|
|
artMisc2->deactivate();
|
|
|
|
artMisc3->deactivate();
|
|
|
|
artMisc4->deactivate();
|
|
|
|
artMisc5->deactivate();
|
|
|
|
artNeck->deactivate();
|
|
|
|
artRhand->deactivate();
|
|
|
|
artRRing->deactivate();
|
|
|
|
artShoulders->deactivate();
|
|
|
|
artSpellBook->deactivate();
|
|
|
|
artTorso->deactivate();
|
|
|
|
for(int f=0; f<backpack.size(); ++f)
|
|
|
|
{
|
|
|
|
backpack[f]->deactivate();
|
|
|
|
}
|
2008-01-20 14:34:39 +02:00
|
|
|
}
|
|
|
|
|
2008-01-15 20:50:52 +02:00
|
|
|
void CHeroWindow::dismissCurrent()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
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-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-15 20:50:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CHeroWindow::switchHero()
|
|
|
|
{
|
|
|
|
int y;
|
|
|
|
SDL_GetMouseState(NULL, &y);
|
|
|
|
for(int g=0; g<heroList.size(); ++g)
|
|
|
|
{
|
|
|
|
if(y>=94+54*g)
|
|
|
|
{
|
|
|
|
//quit();
|
|
|
|
setHero(LOCPLINT->cb->getHeroInfo(player, g, false));
|
|
|
|
//LOCPLINT->openHeroWindow(curHero);
|
|
|
|
redrawCurBack();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
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)
|
|
|
|
{
|
|
|
|
ClickableL::activate();
|
|
|
|
active = true;
|
|
|
|
}
|
2008-01-19 15:19:58 +02:00
|
|
|
}
|
|
|
|
void CArtPlace::clickLeft(boost::logic::tribool down)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void CArtPlace::deactivate()
|
|
|
|
{
|
2008-01-20 17:26:34 +02:00
|
|
|
if(active)
|
|
|
|
{
|
|
|
|
active = false;
|
|
|
|
ClickableL::deactivate();
|
|
|
|
}
|
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
|
|
|
|
|
|
|
void LClickableAreaWText::clickLeft(boost::logic::tribool down)
|
|
|
|
{
|
|
|
|
if(!down)
|
|
|
|
{
|
|
|
|
LOCPLINT->showInfoDialog(text, std::vector<SComponent*>());
|
|
|
|
}
|
|
|
|
}
|