| 1107 | } |
| 1108 | |
| 1109 | static 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 | |
| 1141 | static void dumpPcx(fs::path outDir, const UString &prefix) |
| 1142 | { |
no test coverage detected