CBattleInterface.cpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #include "CBattleInterface.h"
  2. #include "CGameInfo.h"
  3. #include "hch\CLodHandler.h"
  4. #include "SDL_Extensions.h"
  5. #include "CAdvmapInterface.h"
  6. #include "AdventureMapButton.h"
  7. CBattleInterface::CBattleInterface(CCreatureSet * army1, CCreatureSet * army2, int3 tile, CGHeroInstance *hero1, CGHeroInstance *hero2)
  8. {
  9. std::vector< std::string > & backref = CGI->mh->battleBacks[ CGI->mh->ttiles[tile.x][tile.y][tile.z].terType ];
  10. background = CGI->bitmaph->loadBitmap(backref[ rand() % backref.size()] );
  11. menu = CGI->bitmaph->loadBitmap("CBAR.BMP");
  12. CSDL_Ext::blueToPlayersAdv(menu, hero1->tempOwner);
  13. blitAt(background, 0, 0);
  14. blitAt(menu, 0, 556);
  15. CSDL_Ext::update();
  16. bOptions = new AdventureMapButton<CBattleInterface> (std::string(), std::string(), &CBattleInterface::bOptionsf, 3, 561, "icm003.def", this, false, NULL, false);
  17. bSurrender = new AdventureMapButton<CBattleInterface> (std::string(), std::string(), &CBattleInterface::bSurrenderf, 54, 561, "icm001.def", this, false, NULL, false);
  18. bFlee = new AdventureMapButton<CBattleInterface> (std::string(), std::string(), &CBattleInterface::bFleef, 105, 561, "icm002.def", this, false, NULL, false);
  19. bAutofight = new AdventureMapButton<CBattleInterface> (std::string(), std::string(), &CBattleInterface::bAutofightf, 157, 561, "icm004.def", this, false, NULL, false);
  20. bSpell = new AdventureMapButton<CBattleInterface> (std::string(), std::string(), &CBattleInterface::bSpellf, 645, 561, "icm005.def", this, false, NULL, false);
  21. bWait = new AdventureMapButton<CBattleInterface> (std::string(), std::string(), &CBattleInterface::bWaitf, 696, 561, "icm006.def", this, false, NULL, false);
  22. bDefence = new AdventureMapButton<CBattleInterface> (std::string(), std::string(), &CBattleInterface::bDefencef, 747, 561, "icm007.def", this, false, NULL, false);
  23. //bOptions->activate();
  24. }
  25. CBattleInterface::~CBattleInterface()
  26. {
  27. SDL_FreeSurface(background);
  28. SDL_FreeSurface(menu);
  29. delete bOptions;
  30. delete bSurrender;
  31. delete bFlee;
  32. delete bAutofight;
  33. delete bSpell;
  34. delete bWait;
  35. delete bDefence;
  36. }
  37. void CBattleInterface::activate()
  38. {
  39. bOptions->activate();
  40. bSurrender->activate();
  41. bFlee->activate();
  42. bAutofight->activate();
  43. bSpell->activate();
  44. bWait->activate();
  45. bDefence->activate();
  46. }
  47. void CBattleInterface::deactivate()
  48. {
  49. bOptions->deactivate();
  50. bSurrender->deactivate();
  51. bFlee->deactivate();
  52. bAutofight->deactivate();
  53. bSpell->deactivate();
  54. bWait->deactivate();
  55. bDefence->deactivate();
  56. }
  57. void CBattleInterface::show(SDL_Surface * to)
  58. {
  59. blitAt(background, 0, 0, to);
  60. blitAt(menu, 0, 556, to);
  61. bOptions->show(to);
  62. }
  63. void CBattleInterface::bOptionsf()
  64. {
  65. }
  66. void CBattleInterface::bSurrenderf()
  67. {
  68. }
  69. void CBattleInterface::bFleef()
  70. {
  71. }
  72. void CBattleInterface::bAutofightf()
  73. {
  74. }
  75. void CBattleInterface::bSpellf()
  76. {
  77. }
  78. void CBattleInterface::bWaitf()
  79. {
  80. }
  81. void CBattleInterface::bDefencef()
  82. {
  83. }
  84. void CBattleInterface::bConsoleUpf()
  85. {
  86. }
  87. void CBattleInterface::bConsoleDownf()
  88. {
  89. }