Tools/Extractors: Updated map extractor to cataclysm, enjoy new maps

This commit is contained in:
Shauren committed 2012-02-20 21:40:31 +01:00
1 parent b1e4a1b14f
commit 5ced6edbcf
3 files changed
+39 -33

No files matched your search

+21
View File
@@ -48,6 +48,27 @@ bool ADT_file::prepareLoadedData()
if (!a_grid->prepareLoadedData())
return false;
// funny offsets calculations because there is no mapping for them and they have variable lengths
uint8* ptr = (uint8*)a_grid + a_grid->size + 8;
uint32 mcnk_count = 0;
memset(cells, 0, ADT_CELLS_PER_GRID * ADT_CELLS_PER_GRID * sizeof(adt_MCNK*));
while (ptr < GetData() + GetDataSize())
{
uint32 header = *(uint32*)ptr;
uint32 size = *(uint32*)(ptr + 4);
if (header == 'MCNK')
{
cells[mcnk_count / ADT_CELLS_PER_GRID][mcnk_count % ADT_CELLS_PER_GRID] = (adt_MCNK*)ptr;
++mcnk_count;
}
// move to next chunk
ptr += size + 8;
}
if (mcnk_count != ADT_CELLS_PER_GRID * ADT_CELLS_PER_GRID)
return false;
return true;
}