Tools/ Vmap4assembler rework PR

This commit is contained in:
luis
2026-09-20 16:47:28 -03:00
parent 7ac30d7e38
commit bc3139d921
+10 -1
View File
@@ -288,25 +288,34 @@ 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;
} }
} }
}
return true; return true;
} }