| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- #include "CBattleInterface.h"
- #include "CGameInfo.h"
- #include "hch\CLodHandler.h"
- #include "SDL_Extensions.h"
- #include "CAdvmapInterface.h"
- #include "AdventureMapButton.h"
- CBattleInterface::CBattleInterface(CCreatureSet * army1, CCreatureSet * army2, int3 tile, CGHeroInstance *hero1, CGHeroInstance *hero2)
- {
- std::vector< std::string > & backref = CGI->mh->battleBacks[ CGI->mh->ttiles[tile.x][tile.y][tile.z].terType ];
- background = CGI->bitmaph->loadBitmap(backref[ rand() % backref.size()] );
- menu = CGI->bitmaph->loadBitmap("CBAR.BMP");
- CSDL_Ext::blueToPlayersAdv(menu, hero1->tempOwner);
- blitAt(background, 0, 0);
- blitAt(menu, 0, 556);
- CSDL_Ext::update();
-
- bOptions = new AdventureMapButton<CBattleInterface> (std::string(), std::string(), &CBattleInterface::bOptionsf, 3, 561, "icm003.def", this, false, NULL, false);
- bSurrender = new AdventureMapButton<CBattleInterface> (std::string(), std::string(), &CBattleInterface::bSurrenderf, 54, 561, "icm001.def", this, false, NULL, false);
- bFlee = new AdventureMapButton<CBattleInterface> (std::string(), std::string(), &CBattleInterface::bFleef, 105, 561, "icm002.def", this, false, NULL, false);
- bAutofight = new AdventureMapButton<CBattleInterface> (std::string(), std::string(), &CBattleInterface::bAutofightf, 157, 561, "icm004.def", this, false, NULL, false);
- bSpell = new AdventureMapButton<CBattleInterface> (std::string(), std::string(), &CBattleInterface::bSpellf, 645, 561, "icm005.def", this, false, NULL, false);
- bWait = new AdventureMapButton<CBattleInterface> (std::string(), std::string(), &CBattleInterface::bWaitf, 696, 561, "icm006.def", this, false, NULL, false);
- bDefence = new AdventureMapButton<CBattleInterface> (std::string(), std::string(), &CBattleInterface::bDefencef, 747, 561, "icm007.def", this, false, NULL, false);
- //bOptions->activate();
- }
- CBattleInterface::~CBattleInterface()
- {
- SDL_FreeSurface(background);
- SDL_FreeSurface(menu);
- delete bOptions;
- delete bSurrender;
- delete bFlee;
- delete bAutofight;
- delete bSpell;
- delete bWait;
- delete bDefence;
- }
- void CBattleInterface::activate()
- {
- bOptions->activate();
- bSurrender->activate();
- bFlee->activate();
- bAutofight->activate();
- bSpell->activate();
- bWait->activate();
- bDefence->activate();
- }
- void CBattleInterface::deactivate()
- {
- bOptions->deactivate();
- bSurrender->deactivate();
- bFlee->deactivate();
- bAutofight->deactivate();
- bSpell->deactivate();
- bWait->deactivate();
- bDefence->deactivate();
- }
- void CBattleInterface::show(SDL_Surface * to)
- {
- blitAt(background, 0, 0, to);
- blitAt(menu, 0, 556, to);
- bOptions->show(to);
- }
- void CBattleInterface::bOptionsf()
- {
- }
- void CBattleInterface::bSurrenderf()
- {
- }
- void CBattleInterface::bFleef()
- {
- }
- void CBattleInterface::bAutofightf()
- {
- }
- void CBattleInterface::bSpellf()
- {
- }
- void CBattleInterface::bWaitf()
- {
- }
- void CBattleInterface::bDefencef()
- {
- }
- void CBattleInterface::bConsoleUpf()
- {
- }
- void CBattleInterface::bConsoleDownf()
- {
- }
|