mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
changes seem to cover almost everything on heroes' artifacts in hero screen
a part of code has been refactored for simpler support by other parts of code
This commit is contained in:
parent
b675de7ca5
commit
ed0bbcfe11
@ -453,6 +453,32 @@ int CCallback::getMySerial()
|
||||
return gs->players[player].serial;
|
||||
}
|
||||
|
||||
bool CCallback::swapArifacts(const CGHeroInstance * hero1, bool worn1, int pos1, const CGHeroInstance * hero2, bool worn2, int pos2)
|
||||
{
|
||||
if(!hero1 || !hero2) //incorrect data
|
||||
return false;
|
||||
CGHeroInstance * Uhero1 = const_cast<CGHeroInstance *>(hero1);
|
||||
CGHeroInstance * Uhero2 = const_cast<CGHeroInstance *>(hero2);
|
||||
|
||||
if(worn1 && worn2)
|
||||
{
|
||||
std::swap(Uhero1->artifWorn[pos1], Uhero2->artifWorn[pos2]);
|
||||
}
|
||||
else if(worn1 && !worn2)
|
||||
{
|
||||
std::swap(Uhero1->artifWorn[pos1], Uhero2->artifacts[pos2]);
|
||||
}
|
||||
else if(!worn1 && worn2)
|
||||
{
|
||||
std::swap(Uhero1->artifacts[pos1], Uhero2->artifWorn[pos2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::swap(Uhero1->artifacts[pos1], Uhero2->artifacts[pos2]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int3 CScriptCallback::getPos(CGObjectInstance * ob)
|
||||
{
|
||||
|
@ -39,6 +39,7 @@ public:
|
||||
virtual int splitStack(const CGObjectInstance *s1, const CGObjectInstance *s2, int p1, int p2, int val)=0;//split creatures from the first stack
|
||||
virtual bool dismissHero(const CGHeroInstance * hero)=0; //dismisses diven hero; true - successfuly, false - not successfuly
|
||||
virtual const CCreatureSet* getGarrison(const CGObjectInstance *obj)=0;
|
||||
virtual bool swapArifacts(const CGHeroInstance * hero1, bool worn1, int pos1, const CGHeroInstance * hero2, bool worn2, int pos2)=0; //swaps artifacts between two given heroes
|
||||
};
|
||||
|
||||
struct HeroMoveDetails
|
||||
@ -88,6 +89,7 @@ public:
|
||||
int splitStack(const CGObjectInstance *s1, const CGObjectInstance *s2, int p1, int p2, int val);
|
||||
bool dismissHero(const CGHeroInstance * hero);
|
||||
const CCreatureSet* getGarrison(const CGObjectInstance *obj);
|
||||
bool swapArifacts(const CGHeroInstance * hero1, bool worn1, int pos1, const CGHeroInstance * hero2, bool worn2, int pos2);
|
||||
|
||||
//friends
|
||||
friend int _tmain(int argc, _TCHAR* argv[]);
|
||||
|
677
CHeroWindow.cpp
677
CHeroWindow.cpp
@ -14,12 +14,10 @@
|
||||
extern SDL_Surface * screen;
|
||||
extern TTF_Font * GEOR16;
|
||||
|
||||
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),
|
||||
artRRing(0), artShoulders(0), artSpellBook(0), artTorso(0),
|
||||
CHeroWindow::CHeroWindow(int playerColor):
|
||||
backpackPos(0), player(playerColor)
|
||||
{
|
||||
artWorn.resize(19);
|
||||
background = CGI->bitmaph->loadBitmap("HEROSCR4.bmp");
|
||||
CSDL_Ext::blueToPlayersAdv(background, playerColor);
|
||||
pos.x = 65;
|
||||
@ -28,6 +26,7 @@ CHeroWindow::CHeroWindow(int playerColor): artFeet(0), artHead(0), artLHand(0),
|
||||
pos.w = background->w;
|
||||
curBack = NULL;
|
||||
curHero = NULL;
|
||||
activeArtPlace = NULL;
|
||||
|
||||
quitButton = new AdventureMapButton<CHeroWindow>(std::string(), std::string(), &CHeroWindow::quit, 674, 524, "hsbtns.def", this);
|
||||
dismissButton = new AdventureMapButton<CHeroWindow>(std::string(), std::string(), &CHeroWindow::dismissCurrent, 519, 437, "hsbtns2.def", this);
|
||||
@ -118,25 +117,11 @@ CHeroWindow::~CHeroWindow()
|
||||
delete skillpics;
|
||||
delete flags;
|
||||
|
||||
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;
|
||||
for(int g=0; g<artWorn.size(); ++g)
|
||||
{
|
||||
delete artWorn[g];
|
||||
}
|
||||
artWorn.clear();
|
||||
for(int g=0; g<backpack.size(); ++g)
|
||||
{
|
||||
delete backpack[g];
|
||||
@ -172,25 +157,10 @@ void CHeroWindow::show(SDL_Surface *to)
|
||||
leftArtRoll->show();
|
||||
rightArtRoll->show();
|
||||
|
||||
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);
|
||||
for(int d=0; d<artWorn.size(); ++d)
|
||||
{
|
||||
artWorn[d]->show(to);
|
||||
}
|
||||
for(int d=0; d<backpack.size(); ++d)
|
||||
{
|
||||
backpack[d]->show(to);
|
||||
@ -241,193 +211,267 @@ void CHeroWindow::setHero(const CGHeroInstance *hero)
|
||||
spellPointsArea->text = std::string(th);
|
||||
delete [] th;
|
||||
|
||||
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;
|
||||
for(int g=0; g<artWorn.size(); ++g)
|
||||
{
|
||||
delete artWorn[g];
|
||||
}
|
||||
for(int g=0; g<backpack.size(); ++g)
|
||||
{
|
||||
delete backpack[g];
|
||||
}
|
||||
backpack.clear();
|
||||
|
||||
artFeet = new CArtPlace(hero->artFeet);
|
||||
artFeet->pos.x = 515;
|
||||
artFeet->pos.y = 295;
|
||||
artFeet->pos.h = artFeet->pos.w = 44;
|
||||
if(hero->artFeet)
|
||||
artFeet->text = hero->artFeet->description;
|
||||
artWorn[8] = new CArtPlace(hero->artifWorn[8]);
|
||||
artWorn[8]->pos.x = 515;
|
||||
artWorn[8]->pos.y = 295;
|
||||
artWorn[8]->pos.h = artWorn[8]->pos.w = 44;
|
||||
if(hero->artifWorn[8])
|
||||
artWorn[8]->text = hero->artifWorn[8]->description;
|
||||
else
|
||||
artFeet->text = std::string();
|
||||
artHead = new CArtPlace(hero->artHead);
|
||||
artHead->pos.x = 509;
|
||||
artHead->pos.y = 30;
|
||||
artHead->pos.h = artHead->pos.w = 44;
|
||||
if(hero->artHead)
|
||||
artHead->text = hero->artHead->description;
|
||||
artWorn[8]->text = std::string();
|
||||
artWorn[8]->ourWindow = this;
|
||||
artWorn[8]->feet = true;
|
||||
|
||||
artWorn[0] = new CArtPlace(hero->artifWorn[0]);
|
||||
artWorn[0]->pos.x = 509;
|
||||
artWorn[0]->pos.y = 30;
|
||||
artWorn[0]->pos.h = artWorn[0]->pos.w = 44;
|
||||
if(hero->artifWorn[0])
|
||||
artWorn[0]->text = hero->artifWorn[0]->description;
|
||||
else
|
||||
artHead->text = std::string();
|
||||
artLHand = new CArtPlace(hero->artLHand);
|
||||
artLHand->pos.x = 564;
|
||||
artLHand->pos.y = 183;
|
||||
artLHand->pos.h = artLHand->pos.w = 44;
|
||||
if(hero->artLHand)
|
||||
artLHand->text = hero->artLHand->description;
|
||||
artWorn[0]->text = std::string();
|
||||
artWorn[0]->ourWindow = this;
|
||||
artWorn[0]->head = true;
|
||||
|
||||
artWorn[4] = new CArtPlace(hero->artifWorn[4]);
|
||||
artWorn[4]->pos.x = 564;
|
||||
artWorn[4]->pos.y = 183;
|
||||
artWorn[4]->pos.h = artWorn[4]->pos.w = 44;
|
||||
if(hero->artifWorn[4])
|
||||
artWorn[4]->text = hero->artifWorn[4]->description;
|
||||
else
|
||||
artLHand->text = std::string();
|
||||
artLRing = new CArtPlace(hero->artLRing);
|
||||
artLRing->pos.x = 610;
|
||||
artLRing->pos.y = 183;
|
||||
artLRing->pos.h = artLRing->pos.w = 44;
|
||||
if(hero->artLRing)
|
||||
artLRing->text = hero->artLRing->description;
|
||||
artWorn[4]->text = std::string();
|
||||
artWorn[4]->ourWindow = this;
|
||||
artWorn[4]->lHand = true;
|
||||
|
||||
artWorn[7] = new CArtPlace(hero->artifWorn[7]);
|
||||
artWorn[7]->pos.x = 610;
|
||||
artWorn[7]->pos.y = 183;
|
||||
artWorn[7]->pos.h = artWorn[7]->pos.w = 44;
|
||||
if(hero->artifWorn[7])
|
||||
artWorn[7]->text = hero->artifWorn[7]->description;
|
||||
else
|
||||
artLRing->text = std::string();
|
||||
artMach1 = new CArtPlace(hero->artMach1);
|
||||
artMach1->pos.x = 564;
|
||||
artMach1->pos.y = 30;
|
||||
artMach1->pos.h = artMach1->pos.w = 44;
|
||||
if(hero->artMach1)
|
||||
artMach1->text = hero->artMach1->description;
|
||||
artWorn[7]->text = std::string();
|
||||
artWorn[7]->ourWindow = this;
|
||||
artWorn[7]->lRing = true;
|
||||
|
||||
artWorn[13] = new CArtPlace(hero->artifWorn[13]);
|
||||
artWorn[13]->pos.x = 564;
|
||||
artWorn[13]->pos.y = 30;
|
||||
artWorn[13]->pos.h = artWorn[13]->pos.w = 44;
|
||||
if(hero->artifWorn[13])
|
||||
artWorn[13]->text = hero->artifWorn[13]->description;
|
||||
else
|
||||
artMach1->text = std::string();
|
||||
artMach2 = new CArtPlace(hero->artMach2);
|
||||
artMach2->pos.x = 610;
|
||||
artMach2->pos.y = 30;
|
||||
artMach2->pos.h = artMach2->pos.w = 44;
|
||||
if(hero->artMach2)
|
||||
artMach2->text = hero->artMach2->description;
|
||||
artWorn[13]->text = std::string();
|
||||
artWorn[13]->ourWindow = this;
|
||||
artWorn[13]->warMachine1 = true;
|
||||
|
||||
artWorn[14] = new CArtPlace(hero->artifWorn[14]);
|
||||
artWorn[14]->pos.x = 610;
|
||||
artWorn[14]->pos.y = 30;
|
||||
artWorn[14]->pos.h = artWorn[14]->pos.w = 44;
|
||||
if(hero->artifWorn[14])
|
||||
artWorn[14]->text = hero->artifWorn[14]->description;
|
||||
else
|
||||
artMach2->text = std::string();
|
||||
artMach3 = new CArtPlace(hero->artMach3);
|
||||
artMach3->pos.x = 610;
|
||||
artMach3->pos.y = 76;
|
||||
artMach3->pos.h = artMach3->pos.w = 44;
|
||||
if(hero->artMach3)
|
||||
artMach3->text = hero->artMach3->description;
|
||||
artWorn[14]->text = std::string();
|
||||
artWorn[14]->ourWindow = this;
|
||||
artWorn[14]->warMachine2 = true;
|
||||
|
||||
artWorn[15] = new CArtPlace(hero->artifWorn[15]);
|
||||
artWorn[15]->pos.x = 610;
|
||||
artWorn[15]->pos.y = 76;
|
||||
artWorn[15]->pos.h = artWorn[15]->pos.w = 44;
|
||||
if(hero->artifWorn[15])
|
||||
artWorn[15]->text = hero->artifWorn[15]->description;
|
||||
else
|
||||
artMach3->text = std::string();
|
||||
artMach4 = new CArtPlace(hero->artMach4);
|
||||
artMach4->pos.x = 610;
|
||||
artMach4->pos.y = 122;
|
||||
artMach4->pos.h = artMach4->pos.w = 44;
|
||||
if(hero->artMach4)
|
||||
artMach4->text = hero->artMach4->description;
|
||||
artWorn[15]->text = std::string();
|
||||
artWorn[15]->ourWindow = this;
|
||||
artWorn[15]->warMachine3 = true;
|
||||
|
||||
artWorn[16] = new CArtPlace(hero->artifWorn[16]);
|
||||
artWorn[16]->pos.x = 610;
|
||||
artWorn[16]->pos.y = 122;
|
||||
artWorn[16]->pos.h = artWorn[16]->pos.w = 44;
|
||||
if(hero->artifWorn[16])
|
||||
artWorn[16]->text = hero->artifWorn[16]->description;
|
||||
else
|
||||
artMach4->text = std::string();
|
||||
artMisc1 = new CArtPlace(hero->artMisc1);
|
||||
artMisc1->pos.x = 383;
|
||||
artMisc1->pos.y = 143;
|
||||
artMisc1->pos.h = artMisc1->pos.w = 44;
|
||||
if(hero->artMisc1)
|
||||
artMisc1->text = hero->artMisc1->description;
|
||||
artWorn[16]->text = std::string();
|
||||
artWorn[16]->ourWindow = this;
|
||||
artWorn[16]->warMachine4 = true;
|
||||
|
||||
artWorn[9] = new CArtPlace(hero->artifWorn[9]);
|
||||
artWorn[9]->pos.x = 383;
|
||||
artWorn[9]->pos.y = 143;
|
||||
artWorn[9]->pos.h = artWorn[9]->pos.w = 44;
|
||||
if(hero->artifWorn[9])
|
||||
artWorn[9]->text = hero->artifWorn[9]->description;
|
||||
else
|
||||
artMisc1->text = std::string();
|
||||
artMisc2 = new CArtPlace(hero->artMisc2);
|
||||
artMisc2->pos.x = 399;
|
||||
artMisc2->pos.y = 194;
|
||||
artMisc2->pos.h = artMisc2->pos.w = 44;
|
||||
if(hero->artMisc2)
|
||||
artMisc2->text = hero->artMisc2->description;
|
||||
artWorn[9]->text = std::string();
|
||||
artWorn[9]->ourWindow = this;
|
||||
artWorn[9]->misc1 = true;
|
||||
|
||||
artWorn[10] = new CArtPlace(hero->artifWorn[10]);
|
||||
artWorn[10]->pos.x = 399;
|
||||
artWorn[10]->pos.y = 194;
|
||||
artWorn[10]->pos.h = artWorn[10]->pos.w = 44;
|
||||
if(hero->artifWorn[10])
|
||||
artWorn[10]->text = hero->artifWorn[10]->description;
|
||||
else
|
||||
artMisc2->text = std::string();
|
||||
artMisc3 = new CArtPlace(hero->artMisc3);
|
||||
artMisc3->pos.x = 415;
|
||||
artMisc3->pos.y = 245;
|
||||
artMisc3->pos.h = artMisc3->pos.w = 44;
|
||||
if(hero->artMisc3)
|
||||
artMisc3->text = hero->artMisc3->description;
|
||||
artWorn[10]->text = std::string();
|
||||
artWorn[10]->ourWindow = this;
|
||||
artWorn[10]->misc1 = true;
|
||||
|
||||
artWorn[11] = new CArtPlace(hero->artifWorn[11]);
|
||||
artWorn[11]->pos.x = 415;
|
||||
artWorn[11]->pos.y = 245;
|
||||
artWorn[11]->pos.h = artWorn[11]->pos.w = 44;
|
||||
if(hero->artifWorn[11])
|
||||
artWorn[11]->text = hero->artifWorn[11]->description;
|
||||
else
|
||||
artMisc3->text = std::string();
|
||||
artMisc4 = new CArtPlace(hero->artMisc4);
|
||||
artMisc4->pos.x = 431;
|
||||
artMisc4->pos.y = 296;
|
||||
artMisc4->pos.h = artMisc4->pos.w = 44;
|
||||
if(hero->artMisc4)
|
||||
artMisc4->text = hero->artMisc4->description;
|
||||
artWorn[11]->text = std::string();
|
||||
artWorn[11]->ourWindow = this;
|
||||
artWorn[11]->misc3 = true;
|
||||
|
||||
artWorn[12] = new CArtPlace(hero->artifWorn[12]);
|
||||
artWorn[12]->pos.x = 431;
|
||||
artWorn[12]->pos.y = 296;
|
||||
artWorn[12]->pos.h = artWorn[12]->pos.w = 44;
|
||||
if(hero->artifWorn[12])
|
||||
artWorn[12]->text = hero->artifWorn[12]->description;
|
||||
else
|
||||
artMisc4->text = std::string();
|
||||
artMisc5 = new CArtPlace(hero->artMisc5);
|
||||
artMisc5->pos.x = 381;
|
||||
artMisc5->pos.y = 296;
|
||||
artMisc5->pos.h = artMisc5->pos.w = 44;
|
||||
if(hero->artMisc5)
|
||||
artMisc5->text = hero->artMisc5->description;
|
||||
artWorn[12]->text = std::string();
|
||||
artWorn[12]->ourWindow = this;
|
||||
artWorn[12]->misc4 = true;
|
||||
|
||||
artWorn[18] = new CArtPlace(hero->artifWorn[18]);
|
||||
artWorn[18]->pos.x = 381;
|
||||
artWorn[18]->pos.y = 296;
|
||||
artWorn[18]->pos.h = artWorn[18]->pos.w = 44;
|
||||
if(hero->artifWorn[18])
|
||||
artWorn[18]->text = hero->artifWorn[18]->description;
|
||||
else
|
||||
artMisc5->text = std::string();
|
||||
artNeck = new CArtPlace(hero->artNeck);
|
||||
artNeck->pos.x = 508;
|
||||
artNeck->pos.y = 79;
|
||||
artNeck->pos.h = artNeck->pos.w = 44;
|
||||
if(hero->artNeck)
|
||||
artNeck->text = hero->artNeck->description;
|
||||
artWorn[18]->text = std::string();
|
||||
artWorn[18]->ourWindow = this;
|
||||
artWorn[18]->misc5 = true;
|
||||
|
||||
artWorn[2] = new CArtPlace(hero->artifWorn[2]);
|
||||
artWorn[2]->pos.x = 508;
|
||||
artWorn[2]->pos.y = 79;
|
||||
artWorn[2]->pos.h = artWorn[2]->pos.w = 44;
|
||||
if(hero->artifWorn[2])
|
||||
artWorn[2]->text = hero->artifWorn[2]->description;
|
||||
else
|
||||
artNeck->text = std::string();
|
||||
artRhand = new CArtPlace(hero->artRhand);
|
||||
artRhand->pos.x = 383;
|
||||
artRhand->pos.y = 68;
|
||||
artRhand->pos.h = artRhand->pos.w = 44;
|
||||
if(hero->artRhand)
|
||||
artRhand->text = hero->artRhand->description;
|
||||
artWorn[2]->text = std::string();
|
||||
artWorn[2]->ourWindow = this;
|
||||
artWorn[2]->neck = true;
|
||||
|
||||
artWorn[3] = new CArtPlace(hero->artifWorn[3]);
|
||||
artWorn[3]->pos.x = 383;
|
||||
artWorn[3]->pos.y = 68;
|
||||
artWorn[3]->pos.h = artWorn[3]->pos.w = 44;
|
||||
if(hero->artifWorn[3])
|
||||
artWorn[3]->text = hero->artifWorn[3]->description;
|
||||
else
|
||||
artRhand->text = std::string();
|
||||
artRRing = new CArtPlace(hero->artRRing);
|
||||
artRRing->pos.x = 431;
|
||||
artRRing->pos.y = 68;
|
||||
artRRing->pos.h = artRRing->pos.w = 44;
|
||||
if(hero->artRRing)
|
||||
artRRing->text = hero->artRRing->description;
|
||||
artWorn[3]->text = std::string();
|
||||
artWorn[3]->ourWindow = this;
|
||||
artWorn[3]->rHand = true;
|
||||
|
||||
artWorn[6] = new CArtPlace(hero->artifWorn[6]);
|
||||
artWorn[6]->pos.x = 431;
|
||||
artWorn[6]->pos.y = 68;
|
||||
artWorn[6]->pos.h = artWorn[6]->pos.w = 44;
|
||||
if(hero->artifWorn[6])
|
||||
artWorn[6]->text = hero->artifWorn[6]->description;
|
||||
else
|
||||
artRRing->text = std::string();
|
||||
artShoulders = new CArtPlace(hero->artShoulders);
|
||||
artShoulders->pos.x = 567;
|
||||
artShoulders->pos.y = 240;
|
||||
artShoulders->pos.h = artShoulders->pos.w = 44;
|
||||
if(hero->artShoulders)
|
||||
artShoulders->text = hero->artShoulders->description;
|
||||
artWorn[6]->text = std::string();
|
||||
artWorn[6]->ourWindow = this;
|
||||
artWorn[6]->rRing = true;
|
||||
|
||||
artWorn[1] = new CArtPlace(hero->artifWorn[1]);
|
||||
artWorn[1]->pos.x = 567;
|
||||
artWorn[1]->pos.y = 240;
|
||||
artWorn[1]->pos.h = artWorn[1]->pos.w = 44;
|
||||
if(hero->artifWorn[1])
|
||||
artWorn[1]->text = hero->artifWorn[1]->description;
|
||||
else
|
||||
artShoulders->text = std::string();
|
||||
artSpellBook = new CArtPlace(hero->artSpellBook);
|
||||
artSpellBook->pos.x = 610;
|
||||
artSpellBook->pos.y = 310;
|
||||
artSpellBook->pos.h = artSpellBook->pos.w = 44;
|
||||
if(hero->artSpellBook)
|
||||
artSpellBook->text = hero->artSpellBook->description;
|
||||
artWorn[1]->text = std::string();
|
||||
artWorn[1]->ourWindow = this;
|
||||
artWorn[1]->shoulders = true;
|
||||
|
||||
artWorn[17] = new CArtPlace(hero->artifWorn[17]);
|
||||
artWorn[17]->pos.x = 610;
|
||||
artWorn[17]->pos.y = 310;
|
||||
artWorn[17]->pos.h = artWorn[17]->pos.w = 44;
|
||||
if(hero->artifWorn[17])
|
||||
artWorn[17]->text = hero->artifWorn[17]->description;
|
||||
else
|
||||
artSpellBook->text = std::string();
|
||||
artTorso = new CArtPlace(hero->artTorso);
|
||||
artTorso->pos.x = 509;
|
||||
artTorso->pos.y = 130;
|
||||
artTorso->pos.h = artTorso->pos.w = 44;
|
||||
if(hero->artTorso)
|
||||
artTorso->text = hero->artTorso->description;
|
||||
artWorn[17]->text = std::string();
|
||||
artWorn[17]->ourWindow = this;
|
||||
artWorn[17]->spellBook = true;
|
||||
|
||||
artWorn[5] = new CArtPlace(hero->artifWorn[5]);
|
||||
artWorn[5]->pos.x = 509;
|
||||
artWorn[5]->pos.y = 130;
|
||||
artWorn[5]->pos.h = artWorn[5]->pos.w = 44;
|
||||
if(hero->artifWorn[5])
|
||||
artWorn[5]->text = hero->artifWorn[5]->description;
|
||||
else
|
||||
artTorso->text = std::string();
|
||||
for(int s=0; s<5 && s<curHero->artifacts.size(); ++s)
|
||||
artWorn[5]->text = std::string();
|
||||
artWorn[5]->ourWindow = this;
|
||||
artWorn[5]->torso = true;
|
||||
|
||||
for(int g=0; g<artWorn.size(); ++g)
|
||||
{
|
||||
CArtPlace * add = new CArtPlace(curHero->artifacts[(s+backpackPos) % curHero->artifacts.size() ]);
|
||||
artWorn[g]->myNumber = g;
|
||||
artWorn[g]->backNumber = -1;
|
||||
}
|
||||
|
||||
for(int s=0; s<5; ++s)
|
||||
{
|
||||
CArtPlace * add;
|
||||
if( s < curHero->artifacts.size() )
|
||||
add = new CArtPlace(curHero->artifacts[(s+backpackPos) % curHero->artifacts.size() ]);
|
||||
else
|
||||
add = new CArtPlace(NULL);
|
||||
add->pos.x = 403 + 46*s;
|
||||
add->pos.y = 365;
|
||||
add->pos.h = add->pos.w = 44;
|
||||
if(hero->artifacts[s])
|
||||
if(s<hero->artifacts.size() && hero->artifacts[s])
|
||||
add->text = hero->artifacts[s]->description;
|
||||
else
|
||||
add->text = std::string();
|
||||
add->ourWindow = this;
|
||||
add->spellBook = true;
|
||||
add->warMachine1 = true;
|
||||
add->warMachine2 = true;
|
||||
add->warMachine3 = true;
|
||||
add->warMachine4 = true;
|
||||
add->misc1 = true;
|
||||
add->misc2 = true;
|
||||
add->misc3 = true;
|
||||
add->misc4 = true;
|
||||
add->misc5 = true;
|
||||
add->feet = true;
|
||||
add->lRing = true;
|
||||
add->rRing = true;
|
||||
add->torso = true;
|
||||
add->lHand = true;
|
||||
add->rHand = true;
|
||||
add->neck = true;
|
||||
add->shoulders = true;
|
||||
add->head = true;
|
||||
add->myNumber = -1;
|
||||
add->backNumber = s;
|
||||
backpack.push_back(add);
|
||||
}
|
||||
redrawCurBack();
|
||||
@ -454,47 +498,15 @@ void CHeroWindow::quit()
|
||||
LOCPLINT->lclickable.erase(LOCPLINT->lclickable.begin()+v);
|
||||
}*/
|
||||
|
||||
delete artFeet;
|
||||
artFeet = 0;
|
||||
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<artWorn.size(); ++g)
|
||||
{
|
||||
delete artWorn[g];
|
||||
artWorn[g] = NULL;
|
||||
}
|
||||
for(int g=0; g<backpack.size(); ++g)
|
||||
{
|
||||
delete backpack[g];
|
||||
backpack[g] = NULL;
|
||||
}
|
||||
backpack.clear();
|
||||
}
|
||||
@ -524,44 +536,11 @@ void CHeroWindow::activate()
|
||||
}
|
||||
redrawCurBack();
|
||||
|
||||
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();
|
||||
for(int f=0; f<artWorn.size(); ++f)
|
||||
{
|
||||
if(artWorn[f])
|
||||
artWorn[f]->activate();
|
||||
}
|
||||
for(int f=0; f<backpack.size(); ++f)
|
||||
{
|
||||
if(backpack[f])
|
||||
@ -598,44 +577,11 @@ void CHeroWindow::deactivate()
|
||||
secSkillAreas[v]->deactivate();
|
||||
}
|
||||
|
||||
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();
|
||||
for(int f=0; f<artWorn.size(); ++f)
|
||||
{
|
||||
if(artWorn[f])
|
||||
artWorn[f]->deactivate();
|
||||
}
|
||||
for(int f=0; f<backpack.size(); ++f)
|
||||
{
|
||||
if(backpack[f])
|
||||
@ -682,7 +628,10 @@ void CHeroWindow::leftArtRoller()
|
||||
for(int s=0; s<5 && s<curHero->artifacts.size(); ++s) //set new data
|
||||
{
|
||||
backpack[s]->ourArt = curHero->artifacts[(s+backpackPos) % curHero->artifacts.size() ];
|
||||
backpack[s]->text = backpack[s]->ourArt->description;
|
||||
if(backpack[s]->ourArt)
|
||||
backpack[s]->text = backpack[s]->ourArt->description;
|
||||
else
|
||||
backpack[s]->text = std::string();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -696,7 +645,10 @@ void CHeroWindow::rightArtRoller()
|
||||
for(int s=0; s<5 && s<curHero->artifacts.size(); ++s) //set new data
|
||||
{
|
||||
backpack[s]->ourArt = curHero->artifacts[(s+backpackPos) % curHero->artifacts.size() ];
|
||||
backpack[s]->text = backpack[s]->ourArt->description;
|
||||
if(backpack[s]->ourArt)
|
||||
backpack[s]->text = backpack[s]->ourArt->description;
|
||||
else
|
||||
backpack[s]->text = std::string();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -874,7 +826,11 @@ void CHeroWindow::redrawCurBack()
|
||||
CSDL_Ext::printAt(manastr.str(), 212, 247, GEOR16, zwykly, curBack);
|
||||
}
|
||||
|
||||
CArtPlace::CArtPlace(CArtifact *art): ourArt(art), active(false){}
|
||||
CArtPlace::CArtPlace(const CArtifact * const & art): ourArt(art), active(false), clicked(false),
|
||||
spellBook(false), warMachine1(false), warMachine2(false), warMachine3(false),
|
||||
warMachine4(false),misc1(false), misc2(false), misc3(false), misc4(false),
|
||||
misc5(false), feet(false), lRing(false), rRing(false), torso(false),
|
||||
lHand(false), rHand(false), neck(false), shoulders(false), head(false) {}
|
||||
void CArtPlace::activate()
|
||||
{
|
||||
if(!active)
|
||||
@ -887,6 +843,67 @@ void CArtPlace::activate()
|
||||
void CArtPlace::clickLeft(boost::logic::tribool down)
|
||||
{
|
||||
//LRClickableAreaWTextComp::clickLeft(down);
|
||||
if(!down && !clicked) //not clicked before
|
||||
{
|
||||
if(!ourWindow->activeArtPlace) //nothing has benn clicked
|
||||
{
|
||||
clicked = true;
|
||||
ourWindow->activeArtPlace = this;
|
||||
}
|
||||
else //perform artifact substitution
|
||||
{
|
||||
//chceck if swap is possible
|
||||
if(this->fitsHere(ourWindow->activeArtPlace->ourArt) && ourWindow->activeArtPlace->fitsHere(this->ourArt))
|
||||
{
|
||||
//swap artifacts
|
||||
|
||||
LOCPLINT->cb->swapArifacts(
|
||||
ourWindow->curHero,
|
||||
this->myNumber>=0,
|
||||
this->myNumber>=0 ? this->myNumber : (this->backNumber + ourWindow->backpackPos)%ourWindow->curHero->artifacts.size(),
|
||||
ourWindow->curHero,
|
||||
ourWindow->activeArtPlace->myNumber>=0,
|
||||
ourWindow->activeArtPlace->myNumber>=0 ? ourWindow->activeArtPlace->myNumber : (ourWindow->activeArtPlace->backNumber + ourWindow->backpackPos)%ourWindow->curHero->artifacts.size());
|
||||
|
||||
const CArtifact * pmh = ourArt;
|
||||
ourArt = ourWindow->activeArtPlace->ourArt;
|
||||
ourWindow->activeArtPlace->ourArt = pmh;
|
||||
|
||||
//set texts
|
||||
if(pmh)
|
||||
ourWindow->activeArtPlace->text = pmh->description;
|
||||
else
|
||||
ourWindow->activeArtPlace->text = std::string();
|
||||
text = ourArt->description;
|
||||
|
||||
ourWindow->activeArtPlace->clicked = false;
|
||||
ourWindow->activeArtPlace = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool backID = -1;
|
||||
for(int g=0; g<ourWindow->backpack.size(); ++g)
|
||||
{
|
||||
if(ourWindow->backpack[g]==this) //if user wants to put something to backpack
|
||||
{
|
||||
backID = g;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(backID>=0) //put to backpack
|
||||
{
|
||||
/*ourWindow->activeArtPlace->ourArt = NULL;
|
||||
ourWindow->activeArtPlace->clicked = false;
|
||||
ourWindow->activeArtPlace = NULL;*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(!down && clicked)
|
||||
{
|
||||
clicked = false;
|
||||
ourWindow->activeArtPlace = NULL;
|
||||
}
|
||||
}
|
||||
void CArtPlace::clickRight(boost::logic::tribool down)
|
||||
{
|
||||
@ -908,6 +925,38 @@ void CArtPlace::show(SDL_Surface *to)
|
||||
{
|
||||
blitAt(CGI->arth->artDefs->ourImages[ourArt->id].bitmap, pos.x, pos.y, to);
|
||||
}
|
||||
if(clicked && active)
|
||||
{
|
||||
for(int i=0; i<pos.h; ++i)
|
||||
{
|
||||
for(int j=0; j<pos.w; ++j)
|
||||
{
|
||||
if(i==0 || j==0 || i==pos.h-1 || j==pos.w-1)
|
||||
{
|
||||
CSDL_Ext::SDL_PutPixel(to, pos.x+j, pos.y+i, 240, 220, 120);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
bool CArtPlace::fitsHere(const CArtifact * art)
|
||||
{
|
||||
if(!art)
|
||||
return true; //you can have no artifact somewhere
|
||||
if( this->spellBook && art->spellBook || this->warMachine1 && art->warMachine1 ||
|
||||
this->warMachine2 && art->warMachine2 || this->warMachine3 && art->warMachine3 ||
|
||||
this->warMachine4 && art->warMachine4 || this->misc1 && art->misc1 ||
|
||||
this->misc2 && art->misc2 || this->misc3 && art->misc3 ||
|
||||
this->misc4 && art->misc4 || this->misc5 && art->misc5 ||
|
||||
this->feet && art->feet || this->lRing && art->lRing ||
|
||||
this->rRing && art->rRing || this->torso && art->torso ||
|
||||
this->lHand && art->lHand || this->rHand && art->rHand ||
|
||||
this->neck && art->neck || this->shoulders && art->shoulders ||
|
||||
this->head && art->head )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
CArtPlace::~CArtPlace()
|
||||
{
|
||||
|
@ -55,18 +55,27 @@ public:
|
||||
virtual void clickRight (tribool down);
|
||||
};
|
||||
|
||||
class CArtPlace: public ClickableL, public IShowable, public LRClickableAreaWTextComp
|
||||
class CArtPlace: public IShowable, public LRClickableAreaWTextComp
|
||||
{
|
||||
private:
|
||||
bool active;
|
||||
public:
|
||||
bool spellBook, warMachine1, warMachine2, warMachine3, warMachine4,
|
||||
misc1, misc2, misc3, misc4, misc5, feet, lRing, rRing, torso,
|
||||
lHand, rHand, neck, shoulders, head; //my types
|
||||
int myNumber;
|
||||
int backNumber; //number of artifact if this is backpack artplace
|
||||
|
||||
bool clicked;
|
||||
CHeroWindow * ourWindow;
|
||||
const CArtifact * ourArt;
|
||||
CArtPlace(CArtifact * art);
|
||||
CArtPlace(const CArtifact * const & art);
|
||||
void clickLeft (tribool down);
|
||||
void clickRight (tribool down);
|
||||
void activate();
|
||||
void deactivate();
|
||||
void show(SDL_Surface * to = NULL);
|
||||
bool fitsHere(const CArtifact * art); //returns true if given artifact can be placed here
|
||||
~CArtPlace();
|
||||
};
|
||||
|
||||
@ -86,12 +95,14 @@ class CHeroWindow: public IActivable, public IShowable, public virtual CIntObjec
|
||||
std::vector<LClickableAreaHero *> heroListMi; //new better list of heroes
|
||||
|
||||
//artifact places
|
||||
CArtPlace * artHead, * artLRing, * artRRing, * artLHand, * artRhand,
|
||||
* artFeet, * artSpellBook, * artMach1, * artMach2, * artMach3,
|
||||
* artMach4, * artMisc1, * artMisc2, * artMisc3, * artMisc4,
|
||||
* artMisc5, * artTorso, * artNeck, * artShoulders; //heroes' artifacts
|
||||
//CArtPlace * artHead, * artLRing, * artRRing, * artLHand, * artRhand,
|
||||
// * artFeet, * artSpellBook, * artMach1, * artMach2, * artMach3,
|
||||
// * artMach4, * artMisc1, * artMisc2, * artMisc3, * artMisc4,
|
||||
// * artMisc5, * artTorso, * artNeck, * artShoulders; //hero's artifacts
|
||||
std::vector<CArtPlace *> artWorn; // 0 - head; 1 - shoulders; 2 - neck; 3 - right hand; 4 - left hand; 5 - torso; 6 - right ring; 7 - left ring; 8 - feet; 9 - misc1; 10 - misc2; 11 - misc3; 12 - misc4; 13 - mach1; 14 - mach2; 15 - mach3; 16 - mach4; 17 - spellbook; 18 - misc5
|
||||
std::vector<CArtPlace *> backpack; //hero's visible backpack (only 5 elements!)
|
||||
int backpackPos; //unmber of first art visible in backpack (in hero's vector)
|
||||
CArtPlace * activeArtPlace;
|
||||
//clickable areas
|
||||
LRClickableAreaWText * portraitArea;
|
||||
std::vector<LRClickableAreaWTextComp *> primSkillAreas;
|
||||
@ -117,4 +128,7 @@ public:
|
||||
void leftArtRoller(); //scrolls artifacts in bag left
|
||||
void rightArtRoller(); //scrolls artifacts in bag right
|
||||
void switchHero(); //changes displayed hero
|
||||
|
||||
//friends
|
||||
friend void CArtPlace::clickLeft(tribool down);
|
||||
};
|
||||
|
@ -780,104 +780,105 @@ void CAmbarCendamo::deh3m()
|
||||
bool artSet = bufor[i]; ++i; //true if artifact set is not default (hero has some artifacts)
|
||||
int artmask = map.version == RoE ? 0xff : 0xffff;
|
||||
int artidlen = map.version == RoE ? 1 : 2;
|
||||
spec->artifWorn.resize(19);
|
||||
if(artSet)
|
||||
{
|
||||
//head art //1
|
||||
int id = readNormalNr(i, artidlen); i+=artidlen;
|
||||
if(id!=artmask)
|
||||
spec->artHead = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
spec->artifWorn[0] = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
else
|
||||
spec->artHead = NULL;
|
||||
spec->artifWorn[0] = NULL;
|
||||
//shoulders art //2
|
||||
id = readNormalNr(i, artidlen); i+=artidlen;
|
||||
if(id!=artmask)
|
||||
spec->artShoulders = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
spec->artifWorn[1] = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
else
|
||||
spec->artShoulders = NULL;
|
||||
spec->artifWorn[1] = NULL;
|
||||
//neck art //3
|
||||
id = readNormalNr(i, artidlen); i+=artidlen;
|
||||
if(id!=artmask)
|
||||
spec->artNeck = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
spec->artifWorn[2] = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
else
|
||||
spec->artNeck = NULL;
|
||||
spec->artifWorn[2] = NULL;
|
||||
//right hand art //4
|
||||
id = readNormalNr(i, artidlen); i+=artidlen;
|
||||
if(id!=artmask)
|
||||
spec->artRhand = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
spec->artifWorn[3] = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
else
|
||||
spec->artRhand = NULL;
|
||||
spec->artifWorn[3] = NULL;
|
||||
//left hand art //5
|
||||
id = readNormalNr(i, artidlen); i+=artidlen;
|
||||
if(id!=artmask)
|
||||
spec->artLHand = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
spec->artifWorn[4] = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
else
|
||||
spec->artLHand = NULL;
|
||||
spec->artifWorn[4] = NULL;
|
||||
//torso art //6
|
||||
id = readNormalNr(i, artidlen); i+=artidlen;
|
||||
if(id!=artmask)
|
||||
spec->artTorso = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
spec->artifWorn[5] = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
else
|
||||
spec->artTorso = NULL;
|
||||
spec->artifWorn[5] = NULL;
|
||||
//right hand ring //7
|
||||
id = readNormalNr(i, artidlen); i+=artidlen;
|
||||
if(id!=artmask)
|
||||
spec->artRRing = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
spec->artifWorn[6] = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
else
|
||||
spec->artRRing = NULL;
|
||||
spec->artifWorn[6] = NULL;
|
||||
//left hand ring //8
|
||||
id = readNormalNr(i, artidlen); i+=artidlen;
|
||||
if(id!=artmask)
|
||||
spec->artLRing = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
spec->artifWorn[7] = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
else
|
||||
spec->artLRing = NULL;
|
||||
spec->artifWorn[7] = NULL;
|
||||
//feet art //9
|
||||
id = readNormalNr(i, artidlen); i+=artidlen;
|
||||
if(id!=artmask)
|
||||
spec->artFeet = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
spec->artifWorn[8] = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
else
|
||||
spec->artFeet = NULL;
|
||||
spec->artifWorn[8] = NULL;
|
||||
//misc1 art //10
|
||||
id = readNormalNr(i, artidlen); i+=artidlen;
|
||||
if(id!=artmask)
|
||||
spec->artMisc1 = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
spec->artifWorn[9] = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
else
|
||||
spec->artMisc1 = NULL;
|
||||
spec->artifWorn[9] = NULL;
|
||||
//misc2 art //11
|
||||
id = readNormalNr(i, artidlen); i+=artidlen;
|
||||
if(id!=artmask)
|
||||
spec->artMisc2 = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
spec->artifWorn[10] = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
else
|
||||
spec->artMisc2 = NULL;
|
||||
spec->artifWorn[10] = NULL;
|
||||
//misc3 art //12
|
||||
id = readNormalNr(i, artidlen); i+=artidlen;
|
||||
if(id!=artmask)
|
||||
spec->artMisc3 = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
spec->artifWorn[11] = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
else
|
||||
spec->artMisc3 = NULL;
|
||||
spec->artifWorn[11] = NULL;
|
||||
//misc4 art //13
|
||||
id = readNormalNr(i, artidlen); i+=artidlen;
|
||||
if(id!=artmask)
|
||||
spec->artMisc4 = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
spec->artifWorn[12] = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
else
|
||||
spec->artMisc4 = NULL;
|
||||
spec->artifWorn[12] = NULL;
|
||||
//machine1 art //14
|
||||
id = readNormalNr(i, artidlen); i+=artidlen;
|
||||
if(id!=artmask)
|
||||
spec->artMach1 = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
spec->artifWorn[13] = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
else
|
||||
spec->artMach1 = NULL;
|
||||
spec->artifWorn[13] = NULL;
|
||||
//machine2 art //15
|
||||
id = readNormalNr(i, artidlen); i+=artidlen;
|
||||
if(id!=artmask)
|
||||
spec->artMach2 = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
spec->artifWorn[14] = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
else
|
||||
spec->artMach2 = NULL;
|
||||
spec->artifWorn[14] = NULL;
|
||||
//machine3 art //16
|
||||
id = readNormalNr(i, artidlen); i+=artidlen;
|
||||
if(id!=artmask)
|
||||
spec->artMach3 = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
spec->artifWorn[15] = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
else
|
||||
spec->artMach3 = NULL;
|
||||
spec->artifWorn[15] = NULL;
|
||||
//misc5 art //17
|
||||
if(map.version>=SoD)
|
||||
{
|
||||
@ -891,17 +892,17 @@ void CAmbarCendamo::deh3m()
|
||||
//spellbook
|
||||
id = readNormalNr(i, artidlen); i+=artidlen;
|
||||
if(id!=artmask)
|
||||
spec->artSpellBook = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
spec->artifWorn[17] = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
else
|
||||
spec->artSpellBook = NULL;
|
||||
spec->artifWorn[17] = NULL;
|
||||
//19 //???what is that? gap in file or what? - it's probably fifth slot..
|
||||
if(map.version>RoE)
|
||||
{
|
||||
id = readNormalNr(i, artidlen); i+=artidlen;
|
||||
if(id!=artmask)
|
||||
spec->artMisc5 = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
spec->artifWorn[18] = &(CGameInfo::mainObj->arth->artifacts[id]);
|
||||
else
|
||||
spec->artMisc5 = NULL;
|
||||
spec->artifWorn[18] = NULL;
|
||||
}
|
||||
else
|
||||
i+=1;
|
||||
@ -918,28 +919,30 @@ void CAmbarCendamo::deh3m()
|
||||
spec->artifacts.push_back(NULL);
|
||||
}
|
||||
}
|
||||
for(int t=spec->artifacts.size(); t<10; ++t)
|
||||
spec->artifacts.push_back(NULL);
|
||||
} //artifacts
|
||||
else
|
||||
{
|
||||
spec->artFeet = NULL;
|
||||
spec->artHead = NULL;
|
||||
spec->artLHand = NULL;
|
||||
spec->artLRing = NULL;
|
||||
spec->artMach1 = NULL;
|
||||
spec->artMach2 = NULL;
|
||||
spec->artMach3 = NULL;
|
||||
spec->artMach4 = NULL;
|
||||
spec->artMisc1 = NULL;
|
||||
spec->artMisc2 = NULL;
|
||||
spec->artMisc3 = NULL;
|
||||
spec->artMisc4 = NULL;
|
||||
spec->artMisc5 = NULL;
|
||||
spec->artNeck = NULL;
|
||||
spec->artRhand = NULL;
|
||||
spec->artRRing = NULL;
|
||||
spec->artShoulders = NULL;
|
||||
spec->artSpellBook = NULL;
|
||||
spec->artTorso = NULL;
|
||||
spec->artifWorn[8] = NULL;
|
||||
spec->artifWorn[0] = NULL;
|
||||
spec->artifWorn[4] = NULL;
|
||||
spec->artifWorn[7] = NULL;
|
||||
spec->artifWorn[13] = NULL;
|
||||
spec->artifWorn[14] = NULL;
|
||||
spec->artifWorn[15] = NULL;
|
||||
spec->artifWorn[16] = NULL;
|
||||
spec->artifWorn[9] = NULL;
|
||||
spec->artifWorn[10] = NULL;
|
||||
spec->artifWorn[11] = NULL;
|
||||
spec->artifWorn[12] = NULL;
|
||||
spec->artifWorn[18] = NULL;
|
||||
spec->artifWorn[2] = NULL;
|
||||
spec->artifWorn[3] = NULL;
|
||||
spec->artifWorn[6] = NULL;
|
||||
spec->artifWorn[1] = NULL;
|
||||
spec->artifWorn[17] = NULL;
|
||||
spec->artifWorn[5] = NULL;
|
||||
}
|
||||
spec->guardRange = readNormalNr(i, 1); ++i;
|
||||
if(spec->guardRange == 0xff)
|
||||
@ -1025,6 +1028,7 @@ void CAmbarCendamo::deh3m()
|
||||
nhi->exp = spec->experience;
|
||||
nhi->level = CGI->heroh->level(nhi->exp);
|
||||
nhi->primSkills.resize(PRIMARY_SKILLS);
|
||||
nhi->artifWorn.resize(19);
|
||||
nhi->primSkills[0] = spec->attack;
|
||||
nhi->primSkills[1] = spec->defence;
|
||||
nhi->primSkills[2] = spec->power;
|
||||
@ -1037,26 +1041,26 @@ void CAmbarCendamo::deh3m()
|
||||
nhi->type = spec->type;
|
||||
nhi->army = spec->garrison;
|
||||
nhi->portrait = -1; // TODO: przypisywac portret
|
||||
nhi->artFeet = spec->artFeet;
|
||||
nhi->artHead = spec->artHead;
|
||||
nhi->artifWorn[8] = spec->artifWorn[8];
|
||||
nhi->artifWorn[0] = spec->artifWorn[0];
|
||||
nhi->artifacts = spec->artifacts;
|
||||
nhi->artLHand = spec->artLHand;
|
||||
nhi->artLRing = spec->artLRing;
|
||||
nhi->artMach1 = spec->artMach1;
|
||||
nhi->artMach2 = spec->artMach2;
|
||||
nhi->artMach3 = spec->artMach3;
|
||||
nhi->artMach4 = spec->artMach4 = new CArtifact(CGI->arth->artifacts[3]);
|
||||
nhi->artMisc1 = spec->artMisc1;
|
||||
nhi->artMisc2 = spec->artMisc2;
|
||||
nhi->artMisc3 = spec->artMisc3;
|
||||
nhi->artMisc4 = spec->artMisc4;
|
||||
nhi->artMisc5 = spec->artMisc5;
|
||||
nhi->artNeck = spec->artNeck;
|
||||
nhi->artRhand = spec->artRhand;
|
||||
nhi->artRRing = spec->artRRing;
|
||||
nhi->artShoulders = spec->artShoulders;
|
||||
nhi->artSpellBook = spec->artSpellBook;
|
||||
nhi->artTorso = spec->artTorso;
|
||||
nhi->artifWorn[4] = spec->artifWorn[4];
|
||||
nhi->artifWorn[7] = spec->artifWorn[7];
|
||||
nhi->artifWorn[13] = spec->artifWorn[13];
|
||||
nhi->artifWorn[14] = spec->artifWorn[14];
|
||||
nhi->artifWorn[15] = spec->artifWorn[15];
|
||||
nhi->artifWorn[16] = spec->artifWorn[16] = new CArtifact(CGI->arth->artifacts[3]);
|
||||
nhi->artifWorn[9] = spec->artifWorn[9];
|
||||
nhi->artifWorn[10] = spec->artifWorn[10];
|
||||
nhi->artifWorn[11] = spec->artifWorn[11];
|
||||
nhi->artifWorn[12] = spec->artifWorn[12];
|
||||
nhi->artifWorn[18] = spec->artifWorn[18];
|
||||
nhi->artifWorn[2] = spec->artifWorn[2];
|
||||
nhi->artifWorn[3] = spec->artifWorn[3];
|
||||
nhi->artifWorn[6] = spec->artifWorn[6];
|
||||
nhi->artifWorn[1] = spec->artifWorn[1];
|
||||
nhi->artifWorn[17] = spec->artifWorn[17];
|
||||
nhi->artifWorn[5] = spec->artifWorn[5];
|
||||
for(int qq=0; qq<spec->abilities.size(); ++qq)
|
||||
{
|
||||
nhi->secSkills.push_back(std::make_pair(spec->abilities[qq]->idNumber, spec->abilityLevels[qq]-1));
|
||||
|
@ -24,62 +24,100 @@ void CArtHandler::loadArtifacts()
|
||||
nart.price=atoi(pom.c_str());
|
||||
|
||||
CGeneralTextHandler::loadToIt(pom,buf,it,4);
|
||||
if (pom.length())
|
||||
if (pom[0]=='x')
|
||||
nart.spellBook=true;
|
||||
else
|
||||
nart.spellBook = false;
|
||||
CGeneralTextHandler::loadToIt(pom,buf,it,4);
|
||||
if (pom.length())
|
||||
if (pom[0]=='x')
|
||||
nart.warMachine4=true;
|
||||
else
|
||||
nart.warMachine4 = false;
|
||||
CGeneralTextHandler::loadToIt(pom,buf,it,4);
|
||||
if (pom.length())
|
||||
if (pom[0]=='x')
|
||||
nart.warMachine3=true;
|
||||
else
|
||||
nart.warMachine3 = false;
|
||||
CGeneralTextHandler::loadToIt(pom,buf,it,4);
|
||||
if (pom.length())
|
||||
if (pom[0]=='x')
|
||||
nart.warMachine2=true;
|
||||
else
|
||||
nart.warMachine2 = false;
|
||||
CGeneralTextHandler::loadToIt(pom,buf,it,4);
|
||||
if (pom.length())
|
||||
if (pom[0]=='x')
|
||||
nart.warMachine1=true;
|
||||
else
|
||||
nart.warMachine1 = false;
|
||||
CGeneralTextHandler::loadToIt(pom,buf,it,4);
|
||||
if (pom.length())
|
||||
if (pom[0]=='x')
|
||||
nart.misc5=true;
|
||||
else
|
||||
nart.misc5 = false;
|
||||
CGeneralTextHandler::loadToIt(pom,buf,it,4);
|
||||
if (pom.length())
|
||||
if (pom[0]=='x')
|
||||
nart.misc4=true;
|
||||
else
|
||||
nart.misc4 = false;
|
||||
CGeneralTextHandler::loadToIt(pom,buf,it,4);
|
||||
if (pom.length())
|
||||
if (pom[0]=='x')
|
||||
nart.misc3=true;
|
||||
else
|
||||
nart.misc3 = false;
|
||||
CGeneralTextHandler::loadToIt(pom,buf,it,4);
|
||||
if (pom.length())
|
||||
if (pom[0]=='x')
|
||||
nart.misc2=true;
|
||||
else
|
||||
nart.misc2 = false;
|
||||
CGeneralTextHandler::loadToIt(pom,buf,it,4);
|
||||
if (pom.length())
|
||||
if (pom[0]=='x')
|
||||
nart.misc1=true;
|
||||
else
|
||||
nart.misc1 = false;
|
||||
CGeneralTextHandler::loadToIt(pom,buf,it,4);
|
||||
if (pom.length())
|
||||
if (pom[0]=='x')
|
||||
nart.feet=true;
|
||||
else
|
||||
nart.feet = false;
|
||||
CGeneralTextHandler::loadToIt(pom,buf,it,4);
|
||||
if (pom.length())
|
||||
if (pom[0]=='x')
|
||||
nart.lRing=true;
|
||||
else
|
||||
nart.lRing = false;
|
||||
CGeneralTextHandler::loadToIt(pom,buf,it,4);
|
||||
if (pom.length())
|
||||
if (pom[0]=='x')
|
||||
nart.rRing=true;
|
||||
else
|
||||
nart.rRing = false;
|
||||
CGeneralTextHandler::loadToIt(pom,buf,it,4);
|
||||
if (pom.length())
|
||||
if (pom[0]=='x')
|
||||
nart.torso=true;
|
||||
else
|
||||
nart.torso = false;
|
||||
CGeneralTextHandler::loadToIt(pom,buf,it,4);
|
||||
if (pom.length())
|
||||
if (pom[0]=='x')
|
||||
nart.lHand=true;
|
||||
else
|
||||
nart.lHand = false;
|
||||
CGeneralTextHandler::loadToIt(pom,buf,it,4);
|
||||
if (pom.length())
|
||||
if (pom[0]=='x')
|
||||
nart.rHand=true;
|
||||
else
|
||||
nart.rHand = false;
|
||||
CGeneralTextHandler::loadToIt(pom,buf,it,4);
|
||||
if (pom.length())
|
||||
if (pom[0]=='x')
|
||||
nart.neck=true;
|
||||
else
|
||||
nart.neck = false;
|
||||
CGeneralTextHandler::loadToIt(pom,buf,it,4);
|
||||
if (pom.length())
|
||||
if (pom[0]=='x')
|
||||
nart.shoulders=true;
|
||||
else
|
||||
nart.shoulders = false;
|
||||
CGeneralTextHandler::loadToIt(pom,buf,it,4);
|
||||
if (pom.length())
|
||||
if (pom[0]=='x')
|
||||
nart.head=true;
|
||||
else
|
||||
nart.head = false;
|
||||
|
||||
CGeneralTextHandler::loadToIt(pom,buf,it,4);
|
||||
switch (pom[0])
|
||||
|
@ -58,7 +58,8 @@ public:
|
||||
bool standardGarrison; //true if hero has standard garrison
|
||||
CCreatureSet garrison; //hero's army
|
||||
std::vector<CArtifact *> artifacts; //hero's artifacts from bag
|
||||
CArtifact * artHead, * artLRing, * artRRing, * artLHand, * artRhand, * artFeet, * artSpellBook, * artMach1, * artMach2, * artMach3, * artMach4, * artMisc1, * artMisc2, * artMisc3, * artMisc4, * artMisc5, * artTorso, * artNeck, * artShoulders; //working artifacts
|
||||
//CArtifact * artHead, * artLRing, * artRRing, * artLHand, * artRhand, * artFeet, * artSpellBook, * artMach1, * artMach2, * artMach3, * artMach4, * artMisc1, * artMisc2, * artMisc3, * artMisc4, * artMisc5, * artTorso, * artNeck, * artShoulders; //working artifactsstd::vector<CArtifact *> artifWorn; // 0 - head; 1 - shoulders; 2 - neck; 3 - right hand; 4 - left hand; 5 - torso; 6 - right ring; 7 - left ring; 8 - feet; 9 - misc1; 10 - misc2; 11 - misc3; 12 - misc4; 13 - mach1; 14 - mach2; 15 - mach3; 16 - mach4; 17 - spellbook; 18 - misc5
|
||||
std::vector<CArtifact *> artifWorn; // 0 - head; 1 - shoulders; 2 - neck; 3 - right hand; 4 - left hand; 5 - torso; 6 - right ring; 7 - left ring; 8 - feet; 9 - misc1; 10 - misc2; 11 - misc3; 12 - misc4; 13 - mach1; 14 - mach2; 15 - mach3; 16 - mach4; 17 - spellbook; 18 - misc5
|
||||
bool isGuarding;
|
||||
int guardRange; //range of hero's guard
|
||||
std::string biography; //if nonstandard
|
||||
@ -404,11 +405,12 @@ public:
|
||||
bool inTownGarrison; // if hero is in town garrison
|
||||
|
||||
std::vector<CArtifact *> artifacts; //hero's artifacts from bag
|
||||
CArtifact * artHead, * artLRing, * artRRing, * artLHand,
|
||||
* artRhand, * artFeet, * artSpellBook, * artMach1,
|
||||
* artMach2, * artMach3, * artMach4, * artMisc1, * artMisc2,
|
||||
* artMisc3, * artMisc4, * artMisc5, * artTorso, * artNeck,
|
||||
* artShoulders; //working artifacts
|
||||
//CArtifact * artHead, * artLRing, * artRRing, * artLHand,
|
||||
// * artRhand, * artFeet, * artSpellBook, * artMach1,
|
||||
// * artMach2, * artMach3, * artMach4, * artMisc1, * artMisc2,
|
||||
// * artMisc3, * artMisc4, * artMisc5, * artTorso, * artNeck,
|
||||
// * artShoulders; //working artifacts
|
||||
std::vector<CArtifact *> artifWorn; // 0 - head; 1 - shoulders; 2 - neck; 3 - right hand; 4 - left hand; 5 - torso; 6 - right ring; 7 - left ring; 8 - feet; 9 - misc1; 10 - misc2; 11 - misc3; 12 - misc4; 13 - mach1; 14 - mach2; 15 - mach3; 16 - mach4; 17 - spellbook; 18 - misc5
|
||||
|
||||
virtual bool isHero() const;
|
||||
unsigned int getTileCost(EterrainType & ttype, Eroad & rdtype, Eriver & rvtype);
|
||||
|
Loading…
Reference in New Issue
Block a user