|
|
@@ -8,9 +8,11 @@
|
|
|
#include "SDL_Extensions.h"
|
|
|
#include "CAdvmapInterface.h"
|
|
|
#include "AdventureMapButton.h"
|
|
|
+#include "CMessage.h"
|
|
|
#include <sstream>
|
|
|
|
|
|
extern SDL_Surface * ekran;
|
|
|
+extern TTF_Font * GEOR16;
|
|
|
|
|
|
CHeroWindow::CHeroWindow(int playerColor)
|
|
|
{
|
|
|
@@ -21,6 +23,8 @@ CHeroWindow::CHeroWindow(int playerColor)
|
|
|
pos.y = 8;
|
|
|
pos.h = background->h;
|
|
|
pos.w = background->w;
|
|
|
+ curBack = NULL;
|
|
|
+ curHero = 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);
|
|
|
@@ -131,8 +135,63 @@ void CHeroWindow::activate()
|
|
|
{
|
|
|
heroList[g]->activate();
|
|
|
}
|
|
|
+ redrawCurBack();
|
|
|
+}
|
|
|
+
|
|
|
+void CHeroWindow::dismissCurrent()
|
|
|
+{
|
|
|
+}
|
|
|
+
|
|
|
+void CHeroWindow::questlog()
|
|
|
+{
|
|
|
+}
|
|
|
+
|
|
|
+void CHeroWindow::gar1()
|
|
|
+{
|
|
|
+}
|
|
|
+
|
|
|
+void CHeroWindow::gar2()
|
|
|
+{
|
|
|
+}
|
|
|
+
|
|
|
+void CHeroWindow::gar3()
|
|
|
+{
|
|
|
+}
|
|
|
+
|
|
|
+void CHeroWindow::gar4()
|
|
|
+{
|
|
|
+}
|
|
|
+
|
|
|
+void CHeroWindow::leftArtRoller()
|
|
|
+{
|
|
|
+}
|
|
|
+
|
|
|
+void CHeroWindow::rightArtRoller()
|
|
|
+{
|
|
|
+}
|
|
|
+
|
|
|
+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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
+void CHeroWindow::redrawCurBack()
|
|
|
+{
|
|
|
+ if(curBack)
|
|
|
+ SDL_FreeSurface(curBack);
|
|
|
curBack = CSDL_Ext::copySurface(background);
|
|
|
+
|
|
|
blitAt(skillpics->ourImages[0].bitmap, 32, 111, curBack);
|
|
|
blitAt(skillpics->ourImages[1].bitmap, 102, 111, curBack);
|
|
|
blitAt(skillpics->ourImages[2].bitmap, 172, 111, curBack);
|
|
|
@@ -148,12 +207,38 @@ void CHeroWindow::activate()
|
|
|
secondLine<<"Level "<<curHero->level<<" "<<curHero->type->heroClass->name;
|
|
|
CSDL_Ext::printAtMiddle(secondLine.str(), 190, 66, TNRB16, zwykly, curBack);
|
|
|
|
|
|
- //TODO: find missing texts and remove these ugly hardcoded names
|
|
|
- CSDL_Ext::printAtMiddle("Attack", 53, 98, GEOR13, tytulowy, curBack);
|
|
|
- CSDL_Ext::printAtMiddle("Defence", 123, 98, GEOR13, tytulowy, curBack);
|
|
|
- CSDL_Ext::printAtMiddle("Power", 193, 98, GEOR13, tytulowy, curBack);
|
|
|
- CSDL_Ext::printAtMiddle("Knowledge", 263, 98, GEOR13, tytulowy, curBack);
|
|
|
+ //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);
|
|
|
|
|
|
+ //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
|
|
|
std::stringstream primarySkill1;
|
|
|
primarySkill1<<curHero->primSkills[0];
|
|
|
CSDL_Ext::printAtMiddle(primarySkill1.str(), 53, 165, TNRB16, zwykly, curBack);
|
|
|
@@ -193,51 +278,67 @@ void CHeroWindow::activate()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
-
|
|
|
-void CHeroWindow::dismissCurrent()
|
|
|
-{
|
|
|
-}
|
|
|
-
|
|
|
-void CHeroWindow::questlog()
|
|
|
-{
|
|
|
-}
|
|
|
-
|
|
|
-void CHeroWindow::gar1()
|
|
|
-{
|
|
|
-}
|
|
|
-
|
|
|
-void CHeroWindow::gar2()
|
|
|
-{
|
|
|
-}
|
|
|
-
|
|
|
-void CHeroWindow::gar3()
|
|
|
-{
|
|
|
-}
|
|
|
-
|
|
|
-void CHeroWindow::gar4()
|
|
|
-{
|
|
|
-}
|
|
|
-
|
|
|
-void CHeroWindow::leftArtRoller()
|
|
|
-{
|
|
|
-}
|
|
|
|
|
|
-void CHeroWindow::rightArtRoller()
|
|
|
-{
|
|
|
-}
|
|
|
-
|
|
|
-void CHeroWindow::switchHero()
|
|
|
-{
|
|
|
- int y;
|
|
|
- SDL_GetMouseState(NULL, &y);
|
|
|
- for(int g=0; g<heroList.size(); ++g)
|
|
|
+ //secondary skills
|
|
|
+ if(curHero->secSkills.size()>=1)
|
|
|
{
|
|
|
- if(y>=94+54*g)
|
|
|
- {
|
|
|
- quit();
|
|
|
- setHero(LOCPLINT->cb->getHeroInfo(player, g, false));
|
|
|
- LOCPLINT->openHeroWindow(curHero);
|
|
|
- }
|
|
|
+ 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);
|
|
|
}
|
|
|
-}
|
|
|
+ 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);
|
|
|
+}
|