diff --git a/contrib/extractor/System.cpp b/contrib/extractor/System.cpp index 3a9650c2c..d1af9e12b 100644 --- a/contrib/extractor/System.cpp +++ b/contrib/extractor/System.cpp @@ -60,6 +60,7 @@ enum Extract // Select data for extract int CONF_extract = EXTRACT_MAP | EXTRACT_DBC; // This option allow limit minimum height to some value (Allow save some memory) +// see contrib/mmap/src/Tilebuilder.h, INVALID_MAP_LIQ_HEIGHT bool CONF_allow_height_limit = true; float CONF_use_minHeight = -500.0f; @@ -292,6 +293,8 @@ struct map_fileheader uint32 heightMapSize; uint32 liquidMapOffset; uint32 liquidMapSize; + uint32 holesOffset; + uint32 holesSize; }; #define MAP_AREA_NO_AREA 0x0001 @@ -795,8 +798,8 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32 liquidHeader.liquidType = 0; liquidHeader.offsetX = minX; liquidHeader.offsetY = minY; - liquidHeader.width = maxX - minX + 1; - liquidHeader.height = maxY - minY + 1; + liquidHeader.width = maxX - minX + 1 + 1; + liquidHeader.height = maxY - minY + 1 + 1; liquidHeader.liquidLevel = minHeight; if (maxHeight == minHeight) @@ -818,6 +821,28 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32 map.liquidMapSize += sizeof(float)*liquidHeader.width*liquidHeader.height; } + // map hole info + uint16 holes[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID]; + + if(map.liquidMapOffset) + map.holesOffset = map.liquidMapOffset + map.liquidMapSize; + else + map.holesOffset = map.heightMapOffset + map.heightMapSize; + + map.holesSize = sizeof(holes); + memset(holes, 0, map.holesSize); + + for(int i = 0; i < ADT_CELLS_PER_GRID; ++i) + { + for(int j = 0; j < ADT_CELLS_PER_GRID; ++j) + { + adt_MCNK * cell = cells->getMCNK(i,j); + if(!cell) + continue; + holes[i][j] = cell->holes; + } + } + // Ok all data prepared - store it FILE *output=fopen(filename2, "wb"); if(!output) @@ -864,6 +889,10 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32 fwrite(&liquid_height[y+liquidHeader.offsetY][liquidHeader.offsetX], sizeof(float), liquidHeader.width, output); } } + + // store hole data + fwrite(holes, map.holesSize, 1, output); + fclose(output); return true; diff --git a/contrib/extractor/loadlib/adt.h b/contrib/extractor/loadlib/adt.h index 729412ada..9c9167376 100644 --- a/contrib/extractor/loadlib/adt.h +++ b/contrib/extractor/loadlib/adt.h @@ -93,7 +93,8 @@ public: uint32 sizeMCSH; uint32 areaid; uint32 nMapObjRefs; - uint32 holes; + uint16 holes; // locations where models pierce the heightmap + uint16 pad; uint16 s[2]; uint32 data1; uint32 data2; @@ -286,4 +287,6 @@ public: adt_MHDR *a_grid; }; +bool isHole(int holes, int i, int j); + #endif diff --git a/src/game/GridMap.h b/src/game/GridMap.h index 278329794..12693ad21 100644 --- a/src/game/GridMap.h +++ b/src/game/GridMap.h @@ -48,6 +48,8 @@ struct GridMapFileHeader uint32 heightMapSize; uint32 liquidMapOffset; uint32 liquidMapSize; + uint32 holesOffset; + uint32 holesSize; }; #define MAP_AREA_NO_AREA 0x0001 diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index c64d72ef8..a868aab59 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11903" + #define REVISION_NR "11904" #endif // __REVISION_NR_H__