Tools/ Vmap4assembler rework PR
This commit is contained in:
@@ -288,23 +288,32 @@ namespace VMAP
|
|||||||
|
|
||||||
uint32 x, y;
|
uint32 x, y;
|
||||||
StaticMapTree::unpackTileID(tileId, x, y);
|
StaticMapTree::unpackTileID(tileId, x, y);
|
||||||
|
auto tileFile = OpenFile(mapDestDir / Trinity::StringFormat("{:04}_{:02}_{:02}.vmtile", data.MapId, x, y), "wb");
|
||||||
auto tileSpawnIndicesFile = OpenFile(mapDestDir / Trinity::StringFormat("{:04}_{:02}_{:02}.vmtileidx", data.MapId, x, y), "wb");
|
auto tileSpawnIndicesFile = OpenFile(mapDestDir / Trinity::StringFormat("{:04}_{:02}_{:02}.vmtileidx", data.MapId, x, y), "wb");
|
||||||
if (tileSpawnIndicesFile)
|
if (tileFile && tileSpawnIndicesFile)
|
||||||
{
|
{
|
||||||
uint32 nSpawns = spawns.size();
|
uint32 nSpawns = spawns.size();
|
||||||
|
|
||||||
// file header
|
// file header
|
||||||
|
if (fwrite(VMAP_MAGIC, 1, 8, tileFile.get()) != 8)
|
||||||
|
return false;
|
||||||
if (fwrite(VMAP_MAGIC, 1, 8, tileSpawnIndicesFile.get()) != 8)
|
if (fwrite(VMAP_MAGIC, 1, 8, tileSpawnIndicesFile.get()) != 8)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// write number of tile spawns
|
// write number of tile spawns
|
||||||
|
if (fwrite(&nSpawns, sizeof(uint32), 1, tileFile.get()) != 1)
|
||||||
|
return false;
|
||||||
if (fwrite(&nSpawns, sizeof(uint32), 1, tileSpawnIndicesFile.get()) != 1)
|
if (fwrite(&nSpawns, sizeof(uint32), 1, tileSpawnIndicesFile.get()) != 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// write tile spawns
|
// write tile spawns
|
||||||
for (uint32 spawnId : spawns)
|
for (uint32 spawnId : spawns)
|
||||||
|
{
|
||||||
|
if (!ModelSpawn::writeToFile(tileFile.get(), data.UniqueEntries[spawnId]))
|
||||||
|
return false;
|
||||||
if (fwrite(&modelNodeIdx[spawnId], sizeof(uint32), 1, tileSpawnIndicesFile.get()) != 1)
|
if (fwrite(&modelNodeIdx[spawnId], sizeof(uint32), 1, tileSpawnIndicesFile.get()) != 1)
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user