CDefHandler.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. BMPHeader(){_h1=_h2=0;for(int i=0;i<8;i++)_c5[i]=0;};
  13. };
  14. struct BMPPalette
  15. {
  16. unsigned char R,G,B,F;
  17. };
  18. class CDefHandler
  19. {
  20. private:
  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::string defName, curDir;
  39. std::vector<Cimage> ourImages;
  40. bool alphaTransformed;
  41. static void print (std::ostream & stream, int nr, int bytcon);
  42. int readNormalNr (int pos, int bytCon, unsigned char * str=NULL, bool cyclic=false);
  43. static unsigned char * CDefHandler::writeNormalNr (int nr, int bytCon);
  44. SDL_Surface * getSprite (int SIndex); //zapisuje klastke o zadanym numerze do "testtt.bmp"
  45. void openDef(std::string name);
  46. void expand(unsigned char N,unsigned char & BL, unsigned char & BR);
  47. void openFromMemory(unsigned char * table, int size, std::string name);
  48. CDefEssential * essentialize();
  49. };
  50. class CDefEssential //DefHandler with images only
  51. {
  52. public:
  53. std::vector<Cimage> ourImages;
  54. };
  55. #endif // CDEFHANDLER_H