Fix LMAP parsing and don't resolve till after ptr is ready.

This commit is contained in:
njohnson
2026-05-16 09:54:26 +02:00
committed by Jan Laupetin
parent 4208bab758
commit 336c9d8d86
10 changed files with 79 additions and 48 deletions
@@ -10,9 +10,17 @@ namespace light_def
{
const auto* lightDef = asset.Asset();
const auto assetFile = context.OpenAssetFile(GetFileNameForAsset(asset.m_name));
if (!assetFile || lightDef->attenuation.image == nullptr || lightDef->attenuation.image->name == nullptr)
if (!assetFile)
{
con::error("Could not open GfxLightDef file for dumping!");
return;
}
if (lightDef->attenuation.image == nullptr || lightDef->attenuation.image->name == nullptr)
{
con::error("GfxLightDef attenuation data was invalid!");
return;
}
auto& stream = *assetFile;
@@ -20,6 +28,6 @@ namespace light_def
if (imageName[0] == ',')
imageName = &imageName[1];
stream << lightDef->attenuation.samplerState << imageName << static_cast<char>(lightDef->lmapLookupStart);
stream << lightDef->attenuation.samplerState << imageName << '\0';
}
} // namespace light_def