ResourceConverter.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * ResourceConverter.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. namespace bfs = boost::filesystem;
  12. // Struct for holding all Convertor Options
  13. struct ConversionOptions
  14. {
  15. bool splitDefs = false; // splits TwCrPort, CPRSMALL, FlagPort, ITPA, ITPt, Un32 and Un44 into individual PNG's
  16. bool convertPcxToPng = false; // converts single Images (found in Images folder) from .pcx to png.
  17. bool deleteOriginals = false; // delete original files, for the ones splitted / converted.
  18. };
  19. // Struct for holding all Resource Extractor / Converter options
  20. struct ExtractionOptions
  21. {
  22. bool extractArchives = false; // if set, original H3 archives will be extracted into a separate folder
  23. ConversionOptions conversionOptions;
  24. };
  25. class ResourceConverter
  26. {
  27. public:
  28. // Splits def files that are shared between factions and converts pcx to bmp depending on Extraction Options
  29. static void convertExtractedResourceFiles(ConversionOptions conversionOptions);
  30. private:
  31. // converts all pcx files from /Images into PNG
  32. static void doConvertPcxToPng(bool deleteOriginals);
  33. // splits a def file into individual parts and converts the output to PNG format
  34. static void splitDefFile(const std::string& fileName, const bfs::path& spritesPath, bool deleteOriginals);
  35. // splits def files (TwCrPort, CPRSMALL, FlagPort, ITPA, ITPt, Un32 and Un44) so that faction resources are independent
  36. // (town creature portraits, hero army creature portraits, adventure map dwellings, small town icons, big town icons,
  37. // hero speciality small icons, hero speciality large icons)
  38. static void splitDefFiles(bool deleteOriginals);
  39. };