Update ESM4 LTEX loading

Load grasses into a list
Fix FO4 loading
Load Havok parameters for FNV
macos_ci_fix
Alexei Kotov 1 year ago
parent d74df61ce5
commit a2ed295f1f

@ -35,8 +35,6 @@ void ESM4::LandTexture::load(ESM4::Reader& reader)
{
mId = reader.getFormIdFromHeader();
mFlags = reader.hdr().record.flags;
std::uint32_t esmVer = reader.esmVersion();
bool isFONV = esmVer == ESM::VER_132 || esmVer == ESM::VER_133 || esmVer == ESM::VER_134;
while (reader.getSubRecordHeader())
{
@ -48,26 +46,23 @@ void ESM4::LandTexture::load(ESM4::Reader& reader)
break;
case ESM4::SUB_HNAM:
{
if (isFONV)
{
reader.skipSubRecordData(); // FIXME: skip FONV for now
break;
}
if ((reader.esmVersion() == ESM::VER_094 || reader.esmVersion() == ESM::VER_170)
&& subHdr.dataSize == 2) // FO3 is VER_094 but dataSize 3
// TES5+
if (subHdr.dataSize == 2)
{
reader.get(mHavokFriction);
reader.get(mHavokRestitution);
}
else
// TES4, FO3, FNV
else if (subHdr.dataSize == 3)
{
if (subHdr.dataSize != 3)
throw std::runtime_error("LTEX unexpected HNAM size, expected 3");
reader.get(mHavokMaterial);
reader.get(mHavokFriction);
reader.get(mHavokRestitution);
}
else
{
reader.skipSubRecordData();
}
break;
}
case ESM4::SUB_ICON:
@ -77,14 +72,14 @@ void ESM4::LandTexture::load(ESM4::Reader& reader)
reader.get(mTextureSpecular);
break;
case ESM4::SUB_GNAM:
reader.getFormId(mGrass);
reader.getFormId(mGrass.emplace_back());
break;
case ESM4::SUB_TNAM:
reader.getFormId(mTexture);
break; // TES5 only
break; // TES5, FO4
case ESM4::SUB_MNAM:
reader.getFormId(mMaterial);
break; // TES5 only
break; // TES5, FO4
default:
throw std::runtime_error("ESM4::LTEX::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -49,14 +49,14 @@ namespace ESM4
std::uint8_t mHavokRestitution;
std::uint8_t mTextureSpecular; // default 30
ESM::FormId mGrass;
std::vector<ESM::FormId> mGrass;
// ------ TES4 only -----
std::string mTextureFile;
std::uint8_t mHavokMaterial;
// ------ TES5 only -----
// ------ TES5, FO4 -----
ESM::FormId mTexture;
ESM::FormId mMaterial;

Loading…
Cancel
Save