Binary_Z - widberg/fmtk GitHub Wiki
Chum World TXT
ImZouna Binary_Z
See also: Map
struct Binary_Z : ResourceObject_Z {
DynArray_Z<u8> data;
};
The internal representation of the data follows this struct. These store float lookup tables that map x
and z
coordinates to a y
coordinate. This is used for a low-resolution height map and defining terrain types. There is a program to decode these files into images in the fuel-map repository's heightmap directory. There are pre-decoded images in the binary_maps directory.
bitfield LookupDescription {
horizon : 12;
altitudes_index : 20;
};
bitfield AltitudePack {
odd : 4;
even : 4;
};
struct AltitudesPacked {
AltitudePack altitudes[8];
};
struct AltitudesUnpacked {
u8 altitudes[16];
};
struct Internal {
u32 width;
u32 height;
std::assert(width == height, "width != height");
u32 lookup_width = width / 4;
f32 two;
std::assert(two == 2, "two != 2");
i32 negative_one;
std::assert(negative_one == -1, "negative_one != -1");
f32 denominator;
u32 altitudes_packed_size;
u32 altitudes_total_size;
AltitudesPacked altitudes_packed[altitudes_packed_size];
AltitudesUnpacked altitudes_unpacked[((altitudes_total_size - 1) * 4 - sizeof(altitudes_packed)) / 16];
LookupDescription lookup[lookup_width * lookup_width];
};
struct Binary_Z : ResourceObject_Z {
u32 data_size;
Internal data;
std::assert(sizeof(data) == data_size, "sizeof(data) != data_size");
};