CDefHandler.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef CDEFHANDLER_H
  2. #define CDEFHANDLER_H
  3. #include "SDL.h"
  4. #include "CSemiDefHandler.h"
  5. class CDefEssential;
  6. struct BMPHeader
  7. {
  8. int fullSize, _h1, _h2, _h3, _c1, _c2, _c3, _c4, x, y,
  9. dataSize1, dataSize2; //DataSize=X*Y+2*Y
  10. unsigned char _c5[8];
  11. void print(std::ostream & out);
  12. };
  13. struct BMPPalette
  14. {
  15. unsigned char R,G,B,F;
  16. };
  17. class CDefHandler
  18. {
  19. private:
  20. std::string defName, curDir;
  21. int totalEntries, DEFType, totalBlocks, fullWidth, fullHeight;
  22. unsigned char fbuffer[800];
  23. bool allowRepaint;
  24. int length;
  25. unsigned char * FDef;
  26. BMPPalette palette[256];
  27. unsigned int * RWEntries;
  28. int * RLEntries;
  29. struct SEntry
  30. {
  31. std::string name;
  32. int offset;
  33. int group;
  34. } ;
  35. std::vector<SEntry> SEntries ;
  36. char id[2];
  37. public:
  38. std::vector<Cimage> ourImages;
  39. static void print (std::ostream & stream, int nr, int bytcon);
  40. int readNormalNr (int pos, int bytCon, unsigned char * str=NULL, bool cyclic=false);
  41. static unsigned char * CDefHandler::writeNormalNr (int nr, int bytCon);
  42. SDL_Surface * getSprite (int SIndex); //zapisuje klastke o zadanym numerze do "testtt.bmp"
  43. void openDef(std::string name);
  44. void expand(unsigned char N,unsigned char & BL, unsigned char & BR);
  45. void openFromMemory(unsigned char * table, int size, std::string name);
  46. CDefEssential * essentialize();
  47. };
  48. class CDefEssential //DefHandler with images only
  49. {
  50. public:
  51. std::vector<Cimage> ourImages;
  52. };
  53. #endif // CDEFHANDLER_H