feat(Tools/Vmapextractor): Improved vmap detail level by extracting w… (#4922)

This commit is contained in:
UltraNix
2021-04-05 11:51:51 +02:00
committed by GitHub
parent 1b4c36ec52
commit 0528e0b485
20 changed files with 514 additions and 369 deletions

View File

@@ -387,6 +387,7 @@ uint16 liquid_entry[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID];
uint8 liquid_flags[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID];
bool liquid_show[ADT_GRID_SIZE][ADT_GRID_SIZE];
float liquid_height[ADT_GRID_SIZE + 1][ADT_GRID_SIZE + 1];
uint16 holes[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID];
int16 flight_box_max[3][3];
int16 flight_box_min[3][3];
@@ -409,6 +410,8 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
memset(liquid_flags, 0, sizeof(liquid_flags));
memset(liquid_entry, 0, sizeof(liquid_entry));
memset(holes, 0, sizeof(holes));
// Prepare map header
map_fileheader map;
map.mapMagic = *reinterpret_cast<uint32 const*>(MAP_MAGIC);
@@ -861,15 +864,6 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
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;
memset(holes, 0, sizeof(holes));
bool hasHoles = false;
for (int i = 0; i < ADT_CELLS_PER_GRID; ++i)
@@ -886,9 +880,19 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
}
if (hasHoles)
{
if (map.liquidMapOffset)
map.holesOffset = map.liquidMapOffset + map.liquidMapSize;
else
map.holesOffset = map.heightMapOffset + map.heightMapSize;
map.holesSize = sizeof(holes);
}
else
{
map.holesOffset = 0;
map.holesSize = 0;
}
// Ok all data prepared - store it
FILE* output = fopen(outputPath.c_str(), "wb");