MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / dumpPck

Function dumpPck

tools/dump_everything/dump_everything.cpp:1109–1139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1107}
1108
1109static void dumpPck(fs::path outDir, const UString &prefix, const UString &paletteString,
1110 const UString &type)
1111{
1112 auto basePath = outDir / prefix.str();
1113 fs::create_directories(basePath);
1114 auto imageString = type + ":" + prefix + ".pck:" + prefix + ".tab";
1115 LogWarning("Reading \"%s\"", imageString);
1116 auto imgSet = fw().data->loadImageSet(imageString);
1117 if (!imgSet)
1118 {
1119 LogError("Failed to load image set \"%s\"", prefix);
1120 return;
1121 }
1122 auto palette = fw().data->loadPalette(paletteString);
1123 if (!palette)
1124 {
1125 LogError("Failed to load palette \"%s\"", paletteString);
1126 return;
1127 }
1128
1129 int count = 0;
1130 for (auto &img : imgSet->images)
1131 {
1132 auto fullPath = basePath;
1133 auto imgName = format("%d.png", count);
1134 fullPath /= imgName.str();
1135 if (img)
1136 fw().data->writeImage(fullPath.native(), img, palette);
1137 count++;
1138 }
1139}
1140
1141static void dumpPcx(fs::path outDir, const UString &prefix)
1142{

Callers 1

mainFunction · 0.85

Calls 4

formatFunction · 0.85
loadImageSetMethod · 0.80
loadPaletteMethod · 0.80
writeImageMethod · 0.45

Tested by

no test coverage detected