mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-15 01:24:45 +02:00
bugfix, a bit more of hero window
This commit is contained in:
@ -17,20 +17,33 @@ CHeroWindow::CHeroWindow(int playerColor)
|
|||||||
pos.w = background->w;
|
pos.w = background->w;
|
||||||
|
|
||||||
quitButton = new AdventureMapButton<CHeroWindow>(std::string(), std::string(), &CHeroWindow::quit, 674, 524, "hsbtns.def", this);
|
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()
|
CHeroWindow::~CHeroWindow()
|
||||||
{
|
{
|
||||||
SDL_FreeSurface(background);
|
SDL_FreeSurface(background);
|
||||||
delete quitButton;
|
delete quitButton;
|
||||||
|
delete dismissButton;
|
||||||
|
delete questlogButton;
|
||||||
|
|
||||||
|
if(curBack)
|
||||||
|
SDL_FreeSurface(curBack);
|
||||||
|
|
||||||
|
delete skillpics;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHeroWindow::show(SDL_Surface *to)
|
void CHeroWindow::show(SDL_Surface *to)
|
||||||
{
|
{
|
||||||
if(!to)
|
if(!to)
|
||||||
to=ekran;
|
to=ekran;
|
||||||
blitAt(background,pos.x,pos.y,to);
|
blitAt(curBack,pos.x,pos.y,to);
|
||||||
quitButton->show();
|
quitButton->show();
|
||||||
|
dismissButton->show();
|
||||||
|
questlogButton->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHeroWindow::setHero(const CGHeroInstance *hero)
|
void CHeroWindow::setHero(const CGHeroInstance *hero)
|
||||||
@ -48,10 +61,33 @@ void CHeroWindow::quit()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
quitButton->deactivate();
|
quitButton->deactivate();
|
||||||
|
dismissButton->deactivate();
|
||||||
|
questlogButton->deactivate();
|
||||||
LOCPLINT->adventureInt->show();
|
LOCPLINT->adventureInt->show();
|
||||||
|
|
||||||
|
SDL_FreeSurface(curBack);
|
||||||
|
curBack = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHeroWindow::activate()
|
void CHeroWindow::activate()
|
||||||
{
|
{
|
||||||
quitButton->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;
|
template <typename T> class AdventureMapButton;
|
||||||
class SDL_Surface;
|
class SDL_Surface;
|
||||||
class CGHeroInstance;
|
class CGHeroInstance;
|
||||||
|
class CDefHandler;
|
||||||
|
|
||||||
class CHeroWindow: public IShowable, public virtual CIntObject
|
class CHeroWindow: public IShowable, public virtual CIntObject
|
||||||
{
|
{
|
||||||
SDL_Surface * background;
|
SDL_Surface * background, * curBack;
|
||||||
const CGHeroInstance * curHero;
|
const CGHeroInstance * curHero;
|
||||||
|
|
||||||
|
//general graphics
|
||||||
|
CDefHandler * skillpics;
|
||||||
|
|
||||||
//buttons
|
//buttons
|
||||||
AdventureMapButton<CHeroWindow> * quitButton;
|
AdventureMapButton<CHeroWindow> * quitButton, * dismissButton, * questlogButton;
|
||||||
public:
|
public:
|
||||||
CHeroWindow(int playerColor); //c-tor
|
CHeroWindow(int playerColor); //c-tor
|
||||||
~CHeroWindow(); //d-tor
|
~CHeroWindow(); //d-tor
|
||||||
@ -19,4 +23,6 @@ public:
|
|||||||
void activate(); //activates hero window;
|
void activate(); //activates hero window;
|
||||||
virtual void show(SDL_Surface * to = NULL); //shows hero window
|
virtual void show(SDL_Surface * to = NULL); //shows hero window
|
||||||
void quit(); //stops displaying 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;
|
int lvl = atoi(di->name.substr(7, 8).c_str()) - 1;
|
||||||
return creGenNames[fraction][lvl];
|
return creGenNames[fraction][lvl];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user