17#include <welder/vocabulary.hpp>
26 =welder::doc(
"Per-cell MCNK header flag bits (SMChunk.flags).")
28 HasMcsh [[=welder::doc(
"The cell has a baked shadow map (MCSH sub-chunk).")
30 Impassable [[=welder::doc(
"Impassable terrain (no walking).")]] = 0x2,
31 LqRiver [[=welder::doc(
"Legacy (MCLQ) river liquid present.")]] = 0x4,
32 LqOcean [[=welder::doc(
"Legacy (MCLQ) ocean liquid present.")]] = 0x8,
33 LqMagma [[=welder::doc(
"Legacy (MCLQ) magma liquid present.")]] = 0x10,
34 LqSlime [[=welder::doc(
"Legacy (MCLQ) slime liquid present.")]] = 0x20,
36 welder::doc(
"The cell has vertex colors (MCCV sub-chunk, WotLK+).")]] =
40 R
"(The MCAL/MCSH maps are stored in their full
41 64x64 form rather than the 63x63 "unfixed"
42 form the client repairs on load. wowlib always
43 stores the full 64x64 edit surface and sets this
44 flag on write.)")]] = 0x8000,
46 R"(The cell uses the 64-bit high-resolution hole mask
47 (stored in the 8 bytes at header offset 0x14, ~5.3+)
48 instead of the 16-bit holes_low_res field.)")
58 =welder::weld_as(
"SMChunk"),
60 A terrain cell header (MCNK, 128 bytes): the flags, its (x, y) position in
61 the 16x16 cell grid, the area id, the terrain hole mask and the origin.
62 The sub-chunk offset/size/count fields are binary bookkeeping wowlib derives
63 on write, so they are not exposed. See https://wowdev.wiki/ADT/v18#MCNK_chunk.)")
65 [[=welder::doc("Flags; MapChunkFlags bits.")]]
68 [[=welder::doc(
"The cell's column index in the 16x16 grid (0-15).")]]
71 [[=welder::doc(
"The cell's row index in the 16x16 grid (0-15).")]]
74 [[=welder::mark::exclude]] std::uint32_t
nLayers = 0;
75 [[=welder::mark::exclude]] std::uint32_t
nDoodadRefs = 0;
78 [[=welder::mark::exclude]] std::uint32_t
ofsHeight = 0;
79 [[=welder::mark::exclude]] std::uint32_t
ofsNormal = 0;
80 [[=welder::mark::exclude]] std::uint32_t
ofsLayer = 0;
81 [[=welder::mark::exclude]] std::uint32_t
ofsRefs = 0;
82 [[=welder::mark::exclude]] std::uint32_t
ofsAlpha = 0;
83 [[=welder::mark::exclude]] std::uint32_t
sizeAlpha = 0;
84 [[=welder::mark::exclude]] std::uint32_t
ofsShadow = 0;
85 [[=welder::mark::exclude]] std::uint32_t
sizeShadow = 0;
88 "The cell's area id (a foreign key into AreaTable; in the alpha "
89 "clients, packed zone/subzone u16s).")]]
92 [[=welder::mark::exclude]] std::uint32_t
nMapObjRefs = 0;
95 "The 16-bit low-resolution terrain hole mask (a 4x4 bitfield); used "
96 "unless the high_res_holes flag selects holes_high_res.")]]
99 [[=welder::doc(
"Unknown but written (padding in the alpha clients).")]]
103 R
"(The "really low quality" predominant-texture map: an 8x8 grid of
104 2-bit layer indices (16 bytes), naming the detail doodads to
105 show per sub-cell.)")]]
109 "An 8x8 bitfield (8 bytes): 1 disables detail doodads in that "
110 "sub-cell (WoD may store it as an explicit MCDD chunk).")]]
111 std::array<std::uint8_t, 8> noEffectDoodad{};
113 [[=welder::mark::exclude]] std::uint32_t ofsSndEmitters = 0;
114 [[=welder::mark::exclude]] std::uint32_t nSndEmitters = 0;
115 [[=welder::mark::exclude]] std::uint32_t ofsLiquid = 0;
116 [[=welder::mark::exclude]] std::uint32_t sizeLiquid = 0;
119 "The cell origin in world space; MCVT heights are relative to it.")]]
122 [[=welder::mark::exclude]] std::uint32_t ofsMccv = 0;
123 [[=welder::mark::exclude]] std::uint32_t ofsMclv = 0;
124 [[=welder::mark::exclude]] std::uint32_t
unused = 0;
129 "The 64-bit high-resolution hole mask (the 8 bytes at header offset "
130 "0x14), valid when the high_res_holes flag is set.")]]
131 std::uint64_t holesHighRes()
const {
132 return (
static_cast<std::uint64_t
>(ofsNormal) << 32) | ofsHeight;
136 "Set the 64-bit high-resolution hole mask (and the high_res_holes "
138 void setHolesHighRes(std::uint64_t holes) {
139 ofsHeight =
static_cast<std::uint32_t
>(holes & 0xFFFFFFFF);
140 ofsNormal =
static_cast<std::uint32_t
>(holes >> 32);
144 bool operator==(
const SMChunk&)
const =
default;
147 static_assert(
sizeof(
SMChunk) == 0x80);
152 =welder::doc(
"Tile header flag bits (MHDRData.flags).")
154 HasMfbo [[=welder::doc(
"The tile has a flying bounds chunk (MFBO).")]] = 0x1,
155 Northrend [[=welder::doc(
"Set on some Northrend tiles; meaning unknown.")]] = 0x2
163 =welder::weld_as(
"MHDRData"),
165 The tile header (MHDR, 64 bytes): flags plus offsets to the tile's other
166 chunks. wowlib derives every offset from the written layout, so only the
167 flags and the Cata+ inline MAMP alpha-downscale value are exposed. See
168 https://wowdev.wiki/ADT/v18#MHDR_chunk.)")
170 [[=welder::doc("Flags; MapHeaderFlags bits.")]]
173 [[=welder::mark::exclude]] std::uint32_t ofsMcin = 0;
174 [[=welder::mark::exclude]] std::uint32_t ofsMtex = 0;
175 [[=welder::mark::exclude]] std::uint32_t ofsMmdx = 0;
176 [[=welder::mark::exclude]] std::uint32_t ofsMmid = 0;
177 [[=welder::mark::exclude]] std::uint32_t ofsMwmo = 0;
178 [[=welder::mark::exclude]] std::uint32_t ofsMwid = 0;
179 [[=welder::mark::exclude]] std::uint32_t ofsMddf = 0;
180 [[=welder::mark::exclude]] std::uint32_t ofsModf = 0;
181 [[=welder::mark::exclude]] std::uint32_t ofsMfbo = 0;
182 [[=welder::mark::exclude]] std::uint32_t ofsMh2O = 0;
183 [[=welder::mark::exclude]] std::uint32_t ofsMtxf = 0;
186 "The inline MAMP alpha-map downscale value (Cata+): the alpha texture "
187 "size is 64 / (2^value); an explicit MAMP chunk overrides it.")]]
188 std::uint8_t mampValue = 0;
190 [[=welder::mark::exclude]] std::array<std::uint8_t, 3> padding{};
191 [[=welder::mark::exclude]] std::array<std::uint32_t, 3> unused{};
193 bool operator==(
const MHDRData&)
const =
default;
196 static_assert(
sizeof(MHDRData) == 0x40);
203 The flying bounds (MFBO, BC+): a maximum and a minimum plane, each a 3x3
204 grid of int16 heights, limiting where a player may fly on this tile.)")
206 [[=welder::doc("The maximum plane: 3x3 int16 heights (row-major).")]]
207 std::array<std::int16_t, 9> maximum{};
209 [[=welder::doc(
"The minimum plane: 3x3 int16 heights (row-major).")]]
210 std::array<std::int16_t, 9> minimum{};
212 bool operator==(
const MFBOPlanes&)
const =
default;
Flag-testing convenience for the binary formats' bit-mask enums.
The binary-level math and color primitives shared across WoW file formats (wowdev....