mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[11904] Fix Liquid Extraction and better hole support
This commit is contained in:
parent
deb97590a1
commit
73b3ae889d
4 changed files with 38 additions and 4 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue