mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 07:45:39 +00:00
Update ESM4 LTEX loading
Load grasses into a list Fix FO4 loading Load Havok parameters for FNV
This commit is contained in:
parent
d74df61ce5
commit
a2ed295f1f
2 changed files with 13 additions and 18 deletions
|
@ -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,25 +46,22 @@ void ESM4::LandTexture::load(ESM4::Reader& reader)
|
|||
break;
|
||||
case ESM4::SUB_HNAM:
|
||||
{
|
||||
if (isFONV)
|
||||
// TES5+
|
||||
if (subHdr.dataSize == 2)
|
||||
{
|
||||
reader.skipSubRecordData(); // FIXME: skip FONV for now
|
||||
break;
|
||||
reader.get(mHavokFriction);
|
||||
reader.get(mHavokRestitution);
|
||||
}
|
||||
|
||||
if ((reader.esmVersion() == ESM::VER_094 || reader.esmVersion() == ESM::VER_170)
|
||||
&& subHdr.dataSize == 2) // FO3 is VER_094 but dataSize 3
|
||||
// TES4, FO3, FNV
|
||||
else if (subHdr.dataSize == 3)
|
||||
{
|
||||
reader.get(mHavokMaterial);
|
||||
reader.get(mHavokFriction);
|
||||
reader.get(mHavokRestitution);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (subHdr.dataSize != 3)
|
||||
throw std::runtime_error("LTEX unexpected HNAM size, expected 3");
|
||||
reader.get(mHavokMaterial);
|
||||
reader.get(mHavokFriction);
|
||||
reader.get(mHavokRestitution);
|
||||
reader.skipSubRecordData();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -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…
Reference in a new issue