Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[11904] Fix Liquid Extraction and better hole support

  • Loading branch information...
commit f76c13fbf6b1a6e90b205a6a87b3facc86b401bc 1 parent 0b49afa
@vermie vermie authored Schmoozerd committed
View
33 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;
View
5 contrib/extractor/loadlib/adt.h
@@ -93,7 +93,8 @@ class adt_MCNK
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 @@ class ADT_file : public FileLoader{
adt_MHDR *a_grid;
};
+bool isHole(int holes, int i, int j);
+
#endif
View
2  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
View
2  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__
Please sign in to comment.
Something went wrong with that request. Please try again.