wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
adt.hpp File Reference

The ADT terrain-tile entity (namespace wowlib::formats::adt): ADT<V>, one map tile, unified across the split ADT files it is stored in. More...

#include <array>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <format>
#include <optional>
#include <span>
#include <string>
#include <string_view>
#include <tuple>
#include <utility>
#include <vector>
#include <welder/vocabulary.hpp>
#include <wowlib/core/buffer.hpp>
#include <wowlib/core/client_builds.hpp>
#include <wowlib/core/client_version.hpp>
#include <wowlib/core/error.hpp>
#include <wowlib/core/file_key.hpp>
#include <wowlib/core/lang.hpp>
#include <wowlib/formats/adt/boundaries.hpp>
#include <wowlib/formats/adt/chunks/header.hpp>
#include <wowlib/formats/adt/chunks/texture.hpp>
#include <wowlib/formats/adt/liquid.hpp>
#include <wowlib/formats/adt/map_chunk.hpp>
#include <wowlib/formats/common/file_entity.hpp>
#include <wowlib/formats/common/annotations.hpp>
#include <wowlib/formats/common/chunked_file.hpp>
#include <wowlib/formats/common/flags.hpp>
#include <wowlib/formats/common/fourcc.hpp>
#include <wowlib/formats/common/map_placements.hpp>
#include <wowlib/formats/common/string_block.hpp>
#include <wowlib/formats/common/version_range.hpp>
#include <wowlib/formats/common/version_slot.hpp>
#include <wowlib/fs/filesystem.hpp>
Include dependency graph for adt.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  wowlib::formats::adt::ADTBase
 The version-agnostic base of every ADT<V> (welded as "ADT"): the language bindings attach for_version/read/write/convert here. More...
struct  wowlib::formats::adt::detail::ADTFlying
 The flying bounds (MFBO), BC+. More...
struct  wowlib::formats::adt::detail::ADTWotlk
 WotLK+ tile chunks: the water (MH2O) and the texture flags (MTXF). More...
struct  wowlib::formats::adt::detail::ADTSplit
 Cataclysm+ split-file tile chunks (the tile now spans root/_tex0/_obj0/ _obj1/_lod files). More...
struct  wowlib::formats::adt::detail::ADTTexFdids
 The 8.1+ FileDataID texture tables (_tex0), which replace MTEX names on height-texturing maps. More...
struct  wowlib::formats::adt::detail::ADT< V >
 A terrain tile for one client version. More...

Namespaces

namespace  wowlib
namespace  wowlib::formats
namespace  wowlib::formats::adt
namespace  wowlib::formats::adt::detail

Typedefs

template<ClientVersion V>
using wowlib::formats::adt::ADT = detail::ADT<canonicalVersion(V, AdtPivots, AdtVersions)>
 A terrain tile — the canonicalizing face of detail::ADT.

Detailed Description

The ADT terrain-tile entity (namespace wowlib::formats::adt): ADT<V>, one map tile, unified across the split ADT files it is stored in.

A tile is 16x16 = 256 terrain chunks (MapChunk) plus tile-wide texture, model and placement tables. Pre-Cataclysm it is a single .adt; Cataclysm split it into a root .adt and _tex0/_obj0/_obj1(/_lod) split files, DISTRIBUTING the same chunks (and each terrain chunk's MCNK sub-chunks) across them. wowlib models ONE ADT<V> holding everything: the reader loads every file of the tile and merges them, the writer re-distributes on save — so user code adds a texture or a doodad without caring which file it lands in. Version-gated tile chunks live in conditionally-inherited trait bases (adt::detail).

Even though ADT is NOT a ChunkedFile (the MCNK stream needs a multi-arg per-file readFrom, merges across files, and routes chunks to different physical files on write — none of which the chunk engine expresses; see adt-architecture.md), the TILE-LEVEL chunks are uniform, so their members carry chunk() + inFile() annotations and parseFile/writeFile are driven by reflection over them. MCNK and the derived MHDR/MCIN offset tables are the only hand-written cases.

The on-disk MCAL alpha-map bit depth is a per-MAP property (the WDT MPHD big-alpha flags) that wowlib does NOT resolve for you — the caller passes the AlphaFormat to read() and write() explicitly. ADT does not guarantee a byte-identical round-trip (alpha maps are re-encoded, the MHDR/MCIN/MCNK offset tables are re-derived): the contract is a semantic round-trip, parse(write(x)) == parse(x).

Definition in file adt.hpp.