private void ExportAllUsedShapes() { // Reading Palette FDPalette palette = new FDPalette(@".\color"); ShapeDataFile shapeData = new ShapeDataFile(@".\FDSHAP.DAT"); shapeData.LoadData(); FieldDataFile fieldData = new FieldDataFile(@".\FDFIELD.DAT"); fieldData.LoadData(); for (int m = 0; m < 33; m++) { FieldMap map = fieldData.GetField(m); HashSet <int> shapes = map.GetAllShapeIndexes(); ShapePanel panel = shapeData.GetPanel(m); string outputFolder = string.Format(@"D:\GitRoot\toneyisnow\windingtale\Resources\Original\Shapes\ShapePanel{0}\Used", m); if (!Directory.Exists(outputFolder)) { Directory.CreateDirectory(outputFolder); } foreach (int shape in shapes) { var shapeInfo = panel.Shapes[shape]; ImageDataExporter exporter = new ImageDataExporter(shapeInfo.Image.GenerateBitmap(palette)); exporter.ExportToPng(Path.Combine(outputFolder, string.Format(@"Shape_{0}_{1}.png", m, shape))); } } }
private void GenerateAllVoxes() { FDPalette palette = new FDPalette(@".\color"); ShapeDataFile shapeData = new ShapeDataFile(@".\FDSHAP.DAT"); shapeData.LoadData(); FieldDataFile fieldData = new FieldDataFile(@".\FDFIELD.DAT"); fieldData.LoadData(); byte[] header = File.ReadAllBytes(@".\vox_header.dat"); byte[] footer = File.ReadAllBytes(@".\vox_footer.dat"); var paletteMapping = LoadVoxPaletteMapping(); // For each map, generate the vox files for (int m = 1; m < 2; m++) { FieldMap map = fieldData.GetField(m); HashSet <int> shapes = map.GetAllShapeIndexes(); ShapePanel panel = shapeData.GetPanel(m); string outputFolder = string.Format(@"D:\GitRoot\toneyisnow\windingtale\Resources\Remastered\Shapes\ShapePanel{0}", m); if (!Directory.Exists(outputFolder)) { Directory.CreateDirectory(outputFolder); } //string mappingText = File.ReadAllText(Path.Combine(outputFolder, "shape-mapping-1.json")); //ShapeMapping mapping = JsonConvert.DeserializeObject<ShapeMapping>(mappingText); foreach (int shape in shapes) { //if (mapping.ContainsValue(shape)) { // continue; } var shapeInfo = panel.Shapes[shape]; string outputFileName = string.Format(@"Shape_{0}_{1}.vox", m, shape); GenerateShapeVoxFile(shapeInfo.Image, Path.Combine(outputFolder, outputFileName), header, footer, paletteMapping); } } }