Core/Maps: Reduce the output map file size in the maps extractor for maps that do not have any hole information
Core/Mmaps: Fixed swimming creatures stuck in water. (Thanks Vlad and @Chevron ) Note: Re-extract maps
This commit is contained in:
1 parent
c3f75cdf1d
commit
4c765aad3d
4 files changed
+33
-33
No files matched your search
@@ -276,7 +276,7 @@ void ReadLiquidTypeTableDBC()
|
||||
|
||||
// Map file format data
|
||||
static char const* MAP_MAGIC = "MAPS";
|
||||
static char const* MAP_VERSION_MAGIC = "v1.2";
|
||||
static char const* MAP_VERSION_MAGIC = "v1.3";
|
||||
static char const* MAP_AREA_MAGIC = "AREA";
|
||||
static char const* MAP_HEIGHT_MAGIC = "MHGT";
|
||||
static char const* MAP_LIQUID_MAGIC = "MLIQ";
|
||||
@@ -836,8 +836,8 @@ bool ConvertADT(char *filename, char *filename2, int /*cell_y*/, int /*cell_x*/,
|
||||
else
|
||||
map.holesOffset = map.heightMapOffset + map.heightMapSize;
|
||||
|
||||
map.holesSize = sizeof(holes);
|
||||
memset(holes, 0, map.holesSize);
|
||||
bool hasHoles = false;
|
||||
|
||||
for (int i = 0; i < ADT_CELLS_PER_GRID; ++i)
|
||||
{
|
||||
@@ -847,12 +847,19 @@ bool ConvertADT(char *filename, char *filename2, int /*cell_y*/, int /*cell_x*/,
|
||||
if (!cell)
|
||||
continue;
|
||||
holes[i][j] = cell->holes;
|
||||
if (!hasHoles && cell->holes != 0)
|
||||
hasHoles = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasHoles)
|
||||
map.holesSize = sizeof(holes);
|
||||
else
|
||||
map.holesSize = 0;
|
||||
|
||||
// Ok all data prepared - store it
|
||||
FILE *output=fopen(filename2, "wb");
|
||||
if(!output)
|
||||
FILE* output = fopen(filename2, "wb");
|
||||
if (!output)
|
||||
{
|
||||
printf("Can't create the output file '%s'\n", filename2);
|
||||
return false;
|
||||
@@ -899,8 +906,10 @@ bool ConvertADT(char *filename, char *filename2, int /*cell_y*/, int /*cell_x*/,
|
||||
fwrite(&liquid_height[y+liquidHeader.offsetY][liquidHeader.offsetX], sizeof(float), liquidHeader.width, output);
|
||||
}
|
||||
}
|
||||
|
||||
// store hole data
|
||||
fwrite(holes, map.holesSize, 1, output);
|
||||
if (hasHoles)
|
||||
fwrite(holes, map.holesSize, 1, output);
|
||||
|
||||
fclose(output);
|
||||
|
||||
|
||||
Reference in new issue
Block a user