From 4b49d692fadcae15b5ed5b4e1f907bdb468522bb Mon Sep 17 00:00:00 2001 From: gromchek Date: Sat, 6 Sep 2025 20:46:19 +0300 Subject: [PATCH] feat(profile): CMapArea and CMapChunk structs --- profile/3.3.5a-windows-386/include/main.h | 2 + .../include/map/ADTchunks.h | 164 +++++++++++++++++ .../3.3.5a-windows-386/include/map/CMapArea.h | 165 ++++++++++++++++++ 3 files changed, 331 insertions(+) create mode 100644 profile/3.3.5a-windows-386/include/map/ADTchunks.h create mode 100644 profile/3.3.5a-windows-386/include/map/CMapArea.h diff --git a/profile/3.3.5a-windows-386/include/main.h b/profile/3.3.5a-windows-386/include/main.h index e808773..2698b9f 100644 --- a/profile/3.3.5a-windows-386/include/main.h +++ b/profile/3.3.5a-windows-386/include/main.h @@ -78,6 +78,8 @@ #include "m2/shared.h" #include "m2/types.h" +#include "map/ADTchunks.h" +#include "map/CMapArea.h" #include "map/WMOchunks.h" #include "map/CMapObj.h" diff --git a/profile/3.3.5a-windows-386/include/map/ADTchunks.h b/profile/3.3.5a-windows-386/include/map/ADTchunks.h new file mode 100644 index 0000000..9f59c25 --- /dev/null +++ b/profile/3.3.5a-windows-386/include/map/ADTchunks.h @@ -0,0 +1,164 @@ +#ifndef ADTCHUNKS_H +#define ADTCHUNKS_H + +DECLARE_STRUCT(SMMapHeader); +DECLARE_STRUCT(SMChunkInfo); +DECLARE_STRUCT(SMDoodadDef); +DECLARE_STRUCT(SMMapObjDef); +DECLARE_STRUCT(SMChunk); +DECLARE_STRUCT(SMLayer); +DECLARE_STRUCT(SMLiquidChunk); +DECLARE_STRUCT(CWSoundEmitter); + +#include "tempest/vector.h" +#include "tempest/box.h" +#include "tempest/sphere.h" + +struct SMMapHeader +{ + uint32_t flags; + uint32_t mcin; // MCIN*, Cata+: obviously gone. probably all offsets gone, except mh2o(which remains in root file). + uint32_t mtex; // MTEX* + uint32_t mmdx; // MMDX* + uint32_t mmid; // MMID* + uint32_t mwmo; // MWMO* + uint32_t mwid; // MWID* + uint32_t mddf; // MDDF* + uint32_t modf; // MODF* + uint32_t mfbo; // MFBO* this is only set if flags & mhdr_MFBO. + uint32_t mh2o; // MH2O* + uint32_t mtxf; // MTXF* + uint8_t mamp_value; // Cata+, explicit MAMP chunk overrides data + uint8_t padding[3]; + uint32_t unused[3]; +}; + +struct SMChunkInfo +{ + uint32_t offset; // absolute offset. + uint32_t size; // the size of the MCNK chunk, this is refering to. + uint32_t flags; // always 0. only set in the client., FLAG_LOADED = 1 + union + { + char pad[4]; + uint32_t asyncId; // not in the adt file. client use only + }; +}; + +struct SMDoodadDef +{ + uint32_t nameId; // references an entry in the MMID chunk, specifying the model t // if flag mddf_entry_is_filedata_id is set, a file data id instead, ignoring MMID. + uint32_t uniqueId; // this ID should be unique for all ADTs currently loaded. Best, they are unique for the whole map. Blizzar // these unique for the whole game. + C3Vector position; // This is relative to a corner of the map. Subtract 17066 from the non vertical values and you should start t // something that makes sense. You'll then likely have to negate one of the non vertical values in wha // coordinate system you're using to finally move it into place. + C3Vector rotation; // degrees. This is not the same coordinate system orientation like the ADT itself! (see history.) + uint16_t scale; // 1024 is the default size equaling 1.0f. + uint16_t flags; // values from enum MDDFFlags. +}; + +struct SMMapObjDef +{ + uint32_t nameId; // references an entry in the MWID chunk, specifying the model to use. + uint32_t uniqueId; // this ID should be unique for all ADTs currently loaded. Best, they are unique for the whole map. + C3Vector position; + C3Vector rotation; // same as in MDDF. + CAaBox extents; // position plus the transformed wmo bounding box. used for defining if they are rendered as well as collision. + uint16_t flags; // values from enum MODFFlags. + uint16_t doodadSet; // which WMO doodad set is used. Traditionally references WMO#MODS_chunk, if modf_use_sets_from_mwds is set, references #MWDR_.28Shadowlands.2B.29 + uint16_t nameSet; // which WMO name set is used. Used for renaming goldshire inn to northshire inn while using the same model. + uint16_t scale; // Legion+: scale, 1024 means 1 (same as MDDF). Padding in 0.5.3 alpha. +}; + +struct SMChunk +{ + uint32_t flags; + C2iVector index; + uint32_t nLayers; + uint32_t nDoodadRefs; + uint32_t ofsHeight; + uint32_t ofsNormal; + uint32_t ofsLayer; + uint32_t ofsRefs; + uint32_t ofsAlpha; + uint32_t sizeAlpha; + uint32_t ofsShadow; + uint32_t sizeShadow; + uint32_t areaid; + uint32_t nMapObjRefs; + uint32_t holes; + uint8_t low_quality_texture_map[0x10]; + uint32_t predTex; + uint32_t nEffectDoodad; + uint32_t ofsSndEmitters; + uint32_t nSndEmitters; + uint32_t ofsLiquid; + uint32_t sizeLiquid; + C3Vector position; + uint32_t ofsMCCV; + uint32_t unused1; + uint32_t unused2; +}; + +struct SMLayer +{ + uint32_t textureId; + uint32_t flags; + uint32_t offsetInMCAL; + uint32_t offectId; +}; + +struct SMLiquidChunk +{ + float minHeight; + float maxHeight; + struct SLVert + { + union + { + struct SWVert + { + char depth; + char flow0Pct; + char flow1Pct; + char filler; + float height; + } waterVert; + struct SOVert + { + char depth; + char foam; + char wet; + char filler; + } oceanVert; + struct SMVert + { + uint16_t s; + uint16_t t; + float height; + } magmaVert; + }; + } verts[9*9]; + + struct SLTiles + { + char tiles[8][8]; + } tiles; + + uint32_t nFlowvs; + struct SWFlowv + { + CAaSphere sphere; + C3Vector dir; + float velocity; + float amplitude; + float frequency; + } flowvs[2]; +}; + +struct CWSoundEmitter +{ + uint32_t entry_id; + C3Vector position; + C3Vector size; +}; + +#endif \ No newline at end of file diff --git a/profile/3.3.5a-windows-386/include/map/CMapArea.h b/profile/3.3.5a-windows-386/include/map/CMapArea.h new file mode 100644 index 0000000..a2db346 --- /dev/null +++ b/profile/3.3.5a-windows-386/include/map/CMapArea.h @@ -0,0 +1,165 @@ +#ifndef CMAPAREA_H +#define CMAPAREA_H + +DECLARE_STRUCT(CMapArea); +DECLARE_STRUCT(CMapChunk); +DECLARE_STRUCT(CMapAreaTexture); + +struct CMapAreaTexture +{ + char* textureName; + CTexture* texture; +}; + +struct CMapChunk; + +#include "async/object.h" +#include "ADTchunks.h" +#include "storm/array.h" +#include "texture/texture.h" + +STORM_TS_GROWABLE_ARRAY(CMapAreaTexture); + +struct CMapArea +{ + void** vtable; + int32_t objectIndex; + uint16_t flags; + uint16_t pad_0A; + int32_t unk_0C; + + CMapArea* perv; + CMapArea* next; + + int32_t TSExplicitList__m_linkoffset_18; + void* TSExplicitList__ptr_1C; + void* TSExplicitList__ptr2_20; + + C3Vector bottomRight; + C3Vector topLeft; + C3Vector topLeft2; + + C2iVector index; + C2iVector tileChunkIndex; + + TSGrowableArray_CMapAreaTexture textures; + + SMMapHeader* header; + + int32_t unk_6C; + CAsyncObject* asyncObject; + + int32_t TSExplicitList__m_linkoffset_unk_74; + void* TSExplicitList__ptr_unk_78; + void* TSExplicitList__ptr2_unk_7C; + + void* filePtr; + int32_t fileSize; + + SMChunkInfo* chunkInfo; + int32_t unk_8C; + SMDoodadDef* doodadDef; + SMMapObjDef* mapObjDef; + int32_t doodadDefCount; + int32_t mapObjDefCount; + char* m2FileNames; + char* wmoFileNames; + uint32_t* modelFilenamesOffsets; + uint32_t* wmoFilenamesOffsets; + int16_t* flyingBbox; + int32_t* textureFlags; + uint8_t* unk_B8; //MH20 + + CMapChunk mapChunks[256]; +}; + +struct CMapChunk +{ + void** vtable; + int32_t objectIndex; + int32_t unk_08; + + int32_t TSExplicitList__m_linkoffset_0C; + void* TSExplicitList__ptr1_10; + void* TSExplicitList__ptr2_14; + + int32_t TSExplicitList__m_linkoffset_18; + void* TSExplicitList__ptr1_1C; + void* TSExplicitList__ptr2_20; + + C2iVector aIndex; + C2iVector sOffset; + C2iVector cOffset; + + C3Vector center; + float radius; + CAaBox bbox; + C3Vector bottomRight; + C3Vector topLeft; + C3Vector topLeftCoords; + float distToCamera; + CAaBox bbox2; + + void* detailDoodadInstPtr; + void* renderChunkPtr; + + int32_t unk_AC; + int32_t areaId; + int32_t unk_B4; + int32_t unk_B8; + int32_t unk_BC; + int32_t unk_C0; + + // CMapDoodadDef + int32_t TSExplicitList__m_linkoffset_C4; + void* TSExplicitList__ptr_C8; + void* TSExplicitList__ptr2_CC; + + // CMapObjDef + int32_t TSExplicitList__m_linkoffset_D0; + void* TSExplicitList__ptr_D4; + void* TSExplicitList__ptr2_D8; + + int32_t TSExplicitList__m_linkoffset_DC; + void* TSExplicitList__ptr_E0; + void* TSExplicitList__ptr2_E4; + + // Light + int32_t TSExplicitList__m_linkoffset_E8; + void* TSExplicitList__ptr_EC; + void* TSExplicitList__ptr2_F0; + + // CMapSoundEmitter + int32_t TSExplicitList__m_linkoffset_F4; + void* TSExplicitList__ptr_F8; + void* TSExplicitList__ptr2_FC; + + // CChunkLiquid + int32_t TSExplicitList__m_linkoffset_100; + void* TSExplicitList__ptr_104; + void* TSExplicitList__ptr2_108; + + uint8_t* chunkInfoBeginPtr; + SMChunk* header; + uint8_t* lowQualityTexMap; + uint8_t* predTexture; + float* vertices; + uint32_t* vertexShading; + int8_t* normals; + uint8_t* shadowMap; + SMLayer* layers; + uint8_t* additionalShadowmap; + uint8_t* MCRF_ptr; + SMLiquidChunk* liquid; + CWSoundEmitter* soundEmitters; + + // liquid related fields + int32_t unk_140; + int32_t unk_144; + int32_t unk_148; + int32_t unk_14C; + int32_t unk_150; + int32_t unk_154; +}; + +#endif \ No newline at end of file