CMapChunk::Load
function · terrain · orchestration
- Address
0x6af5f0· 366 bytes, up to0x6af75d- Signature
void __thiscall (CMapChunk *this, const void *record, uint32_t first)- Meaning
- Reads a chunk's MCNK header and builds its vertices, normals, liquid, layers, references and textures
- Confidence
- verified, proof one
- Finding
- terrain/chunk#mcnk-header
Finding: MCNK header in terrain: chunk
CMapChunk::Load (0x6af5f0) keeps the record, resolves eight sub-record pointers, and reads the
header: flags +0x00, layer count +0x0c, doodad references +0x10, area id +0x34, object
references +0x38, the 16-byte low-resolution texture map +0x40, the 8-byte doodad map +0x50,
sound emitters +0x5c and position +0x68. In order it builds vertices, normals, liquid, sound
emitters and neighbour links; sets the chunk flag word +0xc to 0x40 when flags bit 1 is set, else
0; then reads references and layers, the shadow map when flags bit 0 is set and world flag 0x40
is on, the combined texture under either shader flag, links lights, and files the chunk in the
area's table.
| header | sub-record | chunk field |
|---|---|---|
| +0x14 | heights (MCVT) | +0xf14 |
| +0x18 | normals (MCNR) | +0xf18 |
| +0x1c | layers (MCLY) | +0xf20 |
| +0x20 | references (MCRF) | +0xf28 |
| +0x24 | alpha maps (MCAL) | +0xf24 |
| +0x2c | shadow map (MCSH) | +0xf1c |
| +0x58 | sound emitters (MCSE) | +0xf30 |
| +0x60 | liquid (MCLQ) | +0xf2c |
The derivation is in the doc.
Callers 1
- CreateAreaChunk terrain
Callees 11
- CMapChunk::LoadLiquids terrain
- CMapChunk::LoadSoundEmitters terrain
- CMapChunk::FixupRecordPointers terrain
- CMapChunk::LinkLights terrain
- CMapChunk::LoadNormals terrain
- CMapChunk::AddLayer terrain
- CMapChunk::CreateShadowTexture terrain
- CMapChunk::CreateCombinedTexture terrain
- CMapChunk::LoadReferences terrain
- CMapChunk::BuildVertices terrain
- CMapChunk::LinkNeighbours terrain
Calls and jumps by a bare address, from tables/calls.tsv.