CAdvmapInterface.cpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #include "stdafx.h"
  2. #include "CAdvmapInterface.h"
  3. CAdvMapInt::CAdvMapInt(int Player)
  4. :player(Player)
  5. {
  6. bg = CGI->bitmaph->loadBitmap("ADVMAP.bmp");
  7. blueToPlayersAdv(bg,player);
  8. scrollingLeft = false;
  9. scrollingRight = false;
  10. scrollingUp = false ;
  11. scrollingDown = false ;
  12. updateScreen = false;
  13. anim=0;
  14. animValHitCount=0; //animation frame
  15. gems.push_back(CGI->spriteh->giveDef("agemLL.def"));
  16. gems.push_back(CGI->spriteh->giveDef("agemLR.def"));
  17. gems.push_back(CGI->spriteh->giveDef("agemUL.def"));
  18. gems.push_back(CGI->spriteh->giveDef("agemUR.def"));
  19. }
  20. CAdvMapInt::~CAdvMapInt()
  21. {
  22. SDL_FreeSurface(bg);
  23. }
  24. void AdventureMapButton::clickLeft (tribool down)
  25. {
  26. if (down)
  27. state=1;
  28. else state=0;
  29. show();
  30. int i;
  31. }
  32. void AdventureMapButton::clickRight (tribool down)
  33. {
  34. //TODO: show/hide infobox
  35. }
  36. void AdventureMapButton::hover (bool on)
  37. {
  38. //TODO: print info in statusbar
  39. }
  40. void AdventureMapButton::activate()
  41. {
  42. ClickableL::activate();
  43. Hoverable::activate();
  44. KeyInterested::activate();
  45. }
  46. void AdventureMapButton::keyPressed (SDL_KeyboardEvent & key)
  47. {
  48. //TODO: check if it's shortcut
  49. }
  50. void AdventureMapButton::deactivate()
  51. {
  52. ClickableL::deactivate();
  53. Hoverable::deactivate();
  54. KeyInterested::deactivate();
  55. }
  56. AdventureMapButton::AdventureMapButton ()
  57. {
  58. type=2;
  59. abs=true;
  60. active=false;
  61. ourObj=NULL;
  62. state=0;
  63. }
  64. void CList::activate()
  65. {
  66. ClickableL::activate();
  67. ClickableR::activate();
  68. Hoverable::activate();
  69. KeyInterested::activate();
  70. };
  71. void CList::deactivate()
  72. {
  73. ClickableL::deactivate();
  74. ClickableR::deactivate();
  75. Hoverable::deactivate();
  76. KeyInterested::deactivate();
  77. };
  78. void CList::clickLeft(tribool down)
  79. {
  80. };
  81. void CTerrainRect::activate()
  82. {
  83. ClickableL::activate();
  84. ClickableR::activate();
  85. Hoverable::activate();
  86. KeyInterested::activate();
  87. };
  88. void CTerrainRect::deactivate()
  89. {
  90. ClickableL::deactivate();
  91. ClickableR::deactivate();
  92. Hoverable::deactivate();
  93. KeyInterested::deactivate();
  94. };
  95. void CTerrainRect::clickLeft(tribool down){}
  96. void CTerrainRect::clickRight(tribool down){}
  97. void CTerrainRect::hover(bool on){}
  98. void CTerrainRect::keyPressed (SDL_KeyboardEvent & key){}
  99. void CTerrainRect::show()
  100. {
  101. SDL_Surface * teren = CGI->mh->terrainRect
  102. (CURPLINT->adventureInt->position.x,CURPLINT->adventureInt->position.y,
  103. 19,18,CURPLINT->adventureInt->position.z,CURPLINT->adventureInt->anim);
  104. SDL_BlitSurface(teren,&genRect(547,594,0,0),ekran,&genRect(547,594,7,6));
  105. SDL_FreeSurface(teren);
  106. }
  107. void CAdvMapInt::show()
  108. {
  109. blitAt(bg,0,0);
  110. SDL_Flip(ekran);
  111. }
  112. void CAdvMapInt::update()
  113. {
  114. terrain.show();
  115. blitAt(gems[2]->ourImages[CURPLINT->playerID].bitmap,6,6);
  116. blitAt(gems[0]->ourImages[CURPLINT->playerID].bitmap,6,508);
  117. blitAt(gems[1]->ourImages[CURPLINT->playerID].bitmap,556,508);
  118. blitAt(gems[3]->ourImages[CURPLINT->playerID].bitmap,556,6);
  119. updateRect(&genRect(550,600,6,6));
  120. }