CDefHandler.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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, fullWidth, fullHeight;
  17. bool allowRepaint;
  18. int length;
  19. BMPPalette palette[256];
  20. unsigned int * RWEntries;
  21. int * RLEntries;
  22. struct SEntry
  23. {
  24. std::string name;
  25. int offset;
  26. int group;
  27. } ;
  28. std::vector<SEntry> SEntries ;
  29. char id[2];
  30. public:
  31. static CLodHandler * Spriteh;
  32. std::string defName, curDir;
  33. std::vector<Cimage> ourImages;
  34. bool alphaTransformed;
  35. bool notFreeImgs;
  36. CDefHandler();
  37. ~CDefHandler();
  38. static void print (std::ostream & stream, int nr, int bytcon);
  39. int readNormalNr (int pos, int bytCon, unsigned char * str=NULL, bool cyclic=false);
  40. static unsigned char *writeNormalNr (int nr, int bytCon);
  41. SDL_Surface * getSprite (int SIndex, unsigned char * FDef); //zapisuje klatke o zadanym numerze do "testtt.bmp"
  42. void openDef(std::string name);
  43. void expand(unsigned char N,unsigned char & BL, unsigned char & BR);
  44. void openFromMemory(unsigned char * table, std::string name);
  45. CDefEssential * essentialize();
  46. static CDefHandler * giveDef(std::string defName, CLodHandler * spriteh=NULL);
  47. static CDefEssential * giveDefEss(std::string defName, CLodHandler * spriteh=NULL);
  48. };
  49. class CDefEssential //DefHandler with images only
  50. {
  51. public:
  52. std::vector<Cimage> ourImages;
  53. ~CDefEssential();
  54. };
  55. #endif // CDEFHANDLER_H