CDefHandler.h 2.4 KB

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