CDefHandler.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. 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. static CLodHandler * Spriteh;
  29. std::string defName, curDir;
  30. std::vector<Cimage> ourImages;
  31. bool alphaTransformed;
  32. bool notFreeImgs;
  33. CDefHandler();
  34. ~CDefHandler();
  35. static void print (std::ostream & stream, int nr, int bytcon);
  36. int readNormalNr (int pos, int bytCon, unsigned char * str=NULL, bool cyclic=false);
  37. static unsigned char *writeNormalNr (int nr, int bytCon);
  38. SDL_Surface * getSprite (int SIndex, unsigned char * FDef, BMPPalette * palette); //zapisuje klatke o zadanym numerze do "testtt.bmp"
  39. void openDef(std::string name);
  40. void expand(unsigned char N,unsigned char & BL, unsigned char & BR);
  41. void openFromMemory(unsigned char * table, std::string name);
  42. CDefEssential * essentialize();
  43. static CDefHandler * giveDef(std::string defName, CLodHandler * spriteh=NULL);
  44. static CDefEssential * giveDefEss(std::string defName, CLodHandler * spriteh=NULL);
  45. };
  46. class CDefEssential //DefHandler with images only
  47. {
  48. public:
  49. std::vector<Cimage> ourImages;
  50. ~CDefEssential();
  51. };
  52. #endif // CDEFHANDLER_H