mirror of
https://github.com/kwsch/NHSE.git
synced 2026-07-17 08:42:59 -05:00
980KB -> 12KB when compressed, seems legit just an array of tile definitions (32x32 style), sequential acres (undefined acres are all zeroed) tiles aren't displated as granular as possible, only sets as 16x16 tiles instead of larger 32x32, but it should be a good enough color hint to people for editing big thanks to ninji for the color mapping in his disassembly and the pbc->tile parse
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using NHSE.Core;
|
|
|
|
namespace NHSE.Parsing
|
|
{
|
|
public static class GamePBCDumper
|
|
{
|
|
public static void DumpOutsideAcrePixels(string modelPath, string path)
|
|
{
|
|
var files = Directory.EnumerateFiles(modelPath, "*.pbc", SearchOption.AllDirectories);
|
|
|
|
const int acreSize = 32 * 32 * 4;
|
|
var maxAcre = Enum.GetValues(typeof(OutsideAcre)).Cast<OutsideAcre>().Max();
|
|
var result = new byte[acreSize * ((int)maxAcre + 1)];
|
|
|
|
foreach (var f in files)
|
|
{
|
|
var fn = Path.GetFileNameWithoutExtension(f);
|
|
if (fn == null)
|
|
continue;
|
|
if (!Enum.TryParse<OutsideAcre>(fn, out var acre))
|
|
continue;
|
|
|
|
var data = File.ReadAllBytes(f);
|
|
var pbc = new PBC(data);
|
|
|
|
var index = (int)acre;
|
|
var offset = acreSize * index;
|
|
pbc.Tiles.CopyTo(result, offset);
|
|
}
|
|
File.WriteAllBytes(path, result);
|
|
}
|
|
}
|
|
}
|