aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVenugh <venugh@gmx.net>2012-04-09 15:52:00 +0200
committerVenugh <venugh@gmx.net>2012-04-09 15:52:00 +0200
commit710a617a3cf7b0f59c268fd0a6396d1e6e7393ba (patch)
tree38b3c46d28d103139a7b0f34e2858a69b01857f9 /src
parent973adf112bff7d8ec0aeb09f9fd2545d82943868 (diff)
Core/Tools: Store hole data.
Diffstat (limited to 'src')
-rw-r--r--src/tools/map_extractor/System.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp
index bbde9f4675e..29836506861 100644
--- a/src/tools/map_extractor/System.cpp
+++ b/src/tools/map_extractor/System.cpp
@@ -292,6 +292,8 @@ struct map_fileheader
uint32 heightMapSize;
uint32 liquidMapOffset;
uint32 liquidMapSize;
+ uint32 holesOffset;
+ uint32 holesSize;
};
#define MAP_AREA_NO_AREA 0x0001
@@ -826,6 +828,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)
@@ -875,6 +899,9 @@ 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;