mapHandler.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef MAPHANDLER_H
  2. #define MAPHANDLER_H
  3. #include "CAmbarCendamo.h"
  4. #include "CSemiDefHandler.h"
  5. #include "CGameInfo.h"
  6. #include "CDefHandler.h"
  7. #include <boost/logic/tribool.hpp>
  8. const int Woff = 4; //width of map's frame
  9. const int Hoff = 4;
  10. struct TerrainTile2
  11. {
  12. int3 pos; //this tile's position
  13. EterrainType terType; //type of terrain tile
  14. Eroad malle; //type of road
  15. unsigned char roaddir; //type of road tile
  16. Eriver nuine; //type of river
  17. unsigned char rivdir; //type of river tile
  18. std::vector<SDL_Surface *> terbitmap; //frames of terrain animation
  19. std::vector<SDL_Surface *> rivbitmap; //frames of river animation
  20. std::vector<SDL_Surface *> roadbitmap; //frames of road animation
  21. bool visitable; //false = not visitable; true = visitable
  22. bool blocked; //false = free; true = blocked;
  23. std::vector < std::pair<CObjectInstance*,SDL_Rect> > objects; //poiters to objects being on this tile with rects to be easier to blit this tile on screen
  24. std::vector <CObjectInstance*> visitableObjects; //pointers to objects hero is visiting being on this tile
  25. };
  26. //pathfinder
  27. // map<int,int> iDTerenu=>koszt_pola
  28. // map<int,int> IDdrogi=>koszt_drogi
  29. class CMapHandler
  30. {
  31. public:
  32. std::vector< std::vector< std::vector<TerrainTile2> > > ttiles;
  33. CAmbarCendamo * reader;
  34. SDL_Surface * terrainRect(int x, int y, int dx, int dy, int level=0, unsigned char anim=0);
  35. SDL_Surface * terrBitmap(int x, int y);
  36. SDL_Surface * undTerrBitmap(int x, int y);
  37. CDefHandler * fullHide;
  38. CDefHandler * partialHide;
  39. std::vector< std::vector<char> > visibility; //true means that pointed place is visible
  40. std::vector< std::vector<char> > undVisibility; //true means that pointed place is visible
  41. std::vector<CDefHandler *> roadDefs;
  42. std::vector<CDefHandler *> staticRiverDefs;
  43. char & visAccess(int x, int y);
  44. char & undVisAccess(int x, int y);
  45. SDL_Surface mirrorImage(SDL_Surface *src); //what is this??
  46. SDL_Surface * getVisBitmap(int x, int y, std::vector< std::vector<char> > & visibility);
  47. void init();
  48. };
  49. #endif //MAPHANDLER_H