CDefHandler.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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__