mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
bugfix, a bit more of hero window
This commit is contained in:
parent
b976857c6c
commit
7968aebe1a
@ -17,20 +17,33 @@ CHeroWindow::CHeroWindow(int playerColor)
|
||||
pos.w = background->w;
|
||||
|
||||
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);
|
||||
questlogButton = new AdventureMapButton<CHeroWindow>(std::string(), std::string(), &CHeroWindow::questlog, 379, 437, "hsbtns4.def", this);
|
||||
|
||||
skillpics = CGI->spriteh->giveDef("pskil42.def");
|
||||
}
|
||||
|
||||
CHeroWindow::~CHeroWindow()
|
||||
{
|
||||
SDL_FreeSurface(background);
|
||||
delete quitButton;
|
||||
delete dismissButton;
|
||||
delete questlogButton;
|
||||
|
||||
if(curBack)
|
||||
SDL_FreeSurface(curBack);
|
||||
|
||||
delete skillpics;
|
||||
}
|
||||
|
||||
void CHeroWindow::show(SDL_Surface *to)
|
||||
{
|
||||
if(!to)
|
||||
to=ekran;
|
||||
blitAt(background,pos.x,pos.y,to);
|
||||
blitAt(curBack,pos.x,pos.y,to);
|
||||
quitButton->show();
|
||||
dismissButton->show();
|
||||
questlogButton->show();
|
||||
}
|
||||
|
||||
void CHeroWindow::setHero(const CGHeroInstance *hero)
|
||||
@ -48,10 +61,33 @@ void CHeroWindow::quit()
|
||||
}
|
||||
}
|
||||
quitButton->deactivate();
|
||||
dismissButton->deactivate();
|
||||
questlogButton->deactivate();
|
||||
LOCPLINT->adventureInt->show();
|
||||
|
||||
SDL_FreeSurface(curBack);
|
||||
curBack = NULL;
|
||||
}
|
||||
|
||||
void CHeroWindow::activate()
|
||||
{
|
||||
quitButton->activate();
|
||||
dismissButton->activate();
|
||||
questlogButton->activate();
|
||||
|
||||
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);
|
||||
blitAt(skillpics->ourImages[5].bitmap, 242, 111, curBack);
|
||||
blitAt(skillpics->ourImages[4].bitmap, 20, 230, curBack);
|
||||
blitAt(skillpics->ourImages[3].bitmap, 162, 230, curBack);
|
||||
}
|
||||
|
||||
void CHeroWindow::dismissCurrent()
|
||||
{
|
||||
}
|
||||
|
||||
void CHeroWindow::questlog()
|
||||
{
|
||||
}
|
||||
|
@ -4,14 +4,18 @@
|
||||
template <typename T> class AdventureMapButton;
|
||||
class SDL_Surface;
|
||||
class CGHeroInstance;
|
||||
class CDefHandler;
|
||||
|
||||
class CHeroWindow: public IShowable, public virtual CIntObject
|
||||
{
|
||||
SDL_Surface * background;
|
||||
SDL_Surface * background, * curBack;
|
||||
const CGHeroInstance * curHero;
|
||||
|
||||
//general graphics
|
||||
CDefHandler * skillpics;
|
||||
|
||||
//buttons
|
||||
AdventureMapButton<CHeroWindow> * quitButton;
|
||||
AdventureMapButton<CHeroWindow> * quitButton, * dismissButton, * questlogButton;
|
||||
public:
|
||||
CHeroWindow(int playerColor); //c-tor
|
||||
~CHeroWindow(); //d-tor
|
||||
@ -19,4 +23,6 @@ public:
|
||||
void activate(); //activates hero window;
|
||||
virtual void show(SDL_Surface * to = NULL); //shows hero window
|
||||
void quit(); //stops displaying hero window
|
||||
void dismissCurrent(); //dissmissed currently displayed hero (curHero) //TODO: make it working
|
||||
void questlog(); //show quest log in
|
||||
};
|
@ -1880,6 +1880,10 @@ std::string CMapHandler::getRandomizedDefName(CGDefInfo *di, CGObjectInstance *
|
||||
}
|
||||
}
|
||||
}
|
||||
if(fraction == -1)
|
||||
{
|
||||
fraction = rand()%F_NUMBER; //TODO: check it more
|
||||
}
|
||||
int lvl = atoi(di->name.substr(7, 8).c_str()) - 1;
|
||||
return creGenNames[fraction][lvl];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user