aboutsummaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorSubv <s.v.h21@hotmail.com>2012-08-22 18:00:58 -0500
committerSubv <s.v.h21@hotmail.com>2012-08-22 18:00:58 -0500
commit4c765aad3ddb0e8a890ee163cf3162d14c396d7e (patch)
tree6f7bd29d72cba61c83a79665fade90b93df5783a /src/tools
parentc3f75cdf1d8c686a3061ef6c8b63a92bae5954c8 (diff)
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
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/map_extractor/System.cpp19
-rw-r--r--src/tools/mmaps_generator/TerrainBuilder.cpp11
2 files changed, 21 insertions, 9 deletions
diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp
index e34bc4221e7..ad9a663ac27 100644
--- a/src/tools/map_extractor/System.cpp
+++ b/src/tools/map_extractor/System.cpp
@@ -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);
diff --git a/src/tools/mmaps_generator/TerrainBuilder.cpp b/src/tools/mmaps_generator/TerrainBuilder.cpp
index e16dd16707b..7ee4dc7f46c 100644
--- a/src/tools/mmaps_generator/TerrainBuilder.cpp
+++ b/src/tools/mmaps_generator/TerrainBuilder.cpp
@@ -159,9 +159,12 @@ namespace MMAP
}
// hole data
- memset(holes, 0, fheader.holesSize);
- fseek(mapFile, fheader.holesOffset, SEEK_SET);
- fread(holes, fheader.holesSize, 1, mapFile);
+ if (fheader.holesSize != 0)
+ {
+ memset(holes, 0, fheader.holesSize);
+ fseek(mapFile, fheader.holesOffset, SEEK_SET);
+ fread(holes, fheader.holesSize, 1, mapFile);
+ }
int count = meshData.solidVerts.size() / 3;
float xoffset = (float(tileX)-32)*GRID_SIZE;
@@ -379,7 +382,7 @@ namespace MMAP
}
// if there is a hole here, don't use the terrain
- if (useTerrain)
+ if (useTerrain && fheader.holesSize != 0)
useTerrain = !isHole(i, holes);
// we use only one terrain kind per quad - pick higher one