2
0

CDefHandler.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef CDEFHANDLER_H
  2. #define CDEFHANDLER_H
  3. #include "../client/CBitmapHandler.h"
  4. struct SDL_Surface;
  5. class CDefEssential;
  6. class CLodHandler;
  7. struct Cimage
  8. {
  9. int groupNumber;
  10. std::string imName; //name without extension
  11. SDL_Surface * bitmap;
  12. };
  13. class CDefHandler
  14. {
  15. private:
  16. int totalEntries, DEFType, totalBlocks;
  17. bool allowRepaint;
  18. int length;
  19. unsigned int * RWEntries;
  20. struct SEntry
  21. {
  22. std::string name;
  23. int offset;
  24. int group;
  25. } ;
  26. std::vector<SEntry> SEntries ;
  27. public:
  28. int width, height; //width and height
  29. static CLodHandler * Spriteh;
  30. std::string defName, curDir;
  31. std::vector<Cimage> ourImages;
  32. bool alphaTransformed;
  33. bool notFreeImgs;
  34. CDefHandler();
  35. ~CDefHandler();
  36. static void print (std::ostream & stream, int nr, int bytcon);
  37. int readNormalNr (int pos, int bytCon, unsigned char * str=NULL, bool cyclic=false);
  38. static unsigned char *writeNormalNr (int nr, int bytCon);
  39. SDL_Surface * getSprite (int SIndex, unsigned char * FDef, BMPPalette * palette); //zapisuje klatke o zadanym numerze do "testtt.bmp"
  40. void openDef(std::string name);
  41. void expand(unsigned char N,unsigned char & BL, unsigned char & BR);
  42. void openFromMemory(unsigned char * table, std::string name);
  43. CDefEssential * essentialize();
  44. static CDefHandler * giveDef(std::string defName, CLodHandler * spriteh=NULL);
  45. static CDefEssential * giveDefEss(std::string defName, CLodHandler * spriteh=NULL);
  46. };
  47. class CDefEssential //DefHandler with images only
  48. {
  49. public:
  50. std::vector<Cimage> ourImages;
  51. ~CDefEssential();
  52. };
  53. #endif // CDEFHANDLER_H