mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-23 20:11:34 +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();
|
mId = reader.getFormIdFromHeader();
|
||||||
mFlags = reader.hdr().record.flags;
|
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())
|
while (reader.getSubRecordHeader())
|
||||||
{
|
{
|
||||||
|
@ -48,25 +46,22 @@ void ESM4::LandTexture::load(ESM4::Reader& reader)
|
||||||
break;
|
break;
|
||||||
case ESM4::SUB_HNAM:
|
case ESM4::SUB_HNAM:
|
||||||
{
|
{
|
||||||
if (isFONV)
|
// TES5+
|
||||||
|
if (subHdr.dataSize == 2)
|
||||||
{
|
{
|
||||||
reader.skipSubRecordData(); // FIXME: skip FONV for now
|
reader.get(mHavokFriction);
|
||||||
break;
|
reader.get(mHavokRestitution);
|
||||||
}
|
}
|
||||||
|
// TES4, FO3, FNV
|
||||||
if ((reader.esmVersion() == ESM::VER_094 || reader.esmVersion() == ESM::VER_170)
|
else if (subHdr.dataSize == 3)
|
||||||
&& subHdr.dataSize == 2) // FO3 is VER_094 but dataSize 3
|
|
||||||
{
|
{
|
||||||
|
reader.get(mHavokMaterial);
|
||||||
reader.get(mHavokFriction);
|
reader.get(mHavokFriction);
|
||||||
reader.get(mHavokRestitution);
|
reader.get(mHavokRestitution);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (subHdr.dataSize != 3)
|
reader.skipSubRecordData();
|
||||||
throw std::runtime_error("LTEX unexpected HNAM size, expected 3");
|
|
||||||
reader.get(mHavokMaterial);
|
|
||||||
reader.get(mHavokFriction);
|
|
||||||
reader.get(mHavokRestitution);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -77,14 +72,14 @@ void ESM4::LandTexture::load(ESM4::Reader& reader)
|
||||||
reader.get(mTextureSpecular);
|
reader.get(mTextureSpecular);
|
||||||
break;
|
break;
|
||||||
case ESM4::SUB_GNAM:
|
case ESM4::SUB_GNAM:
|
||||||
reader.getFormId(mGrass);
|
reader.getFormId(mGrass.emplace_back());
|
||||||
break;
|
break;
|
||||||
case ESM4::SUB_TNAM:
|
case ESM4::SUB_TNAM:
|
||||||
reader.getFormId(mTexture);
|
reader.getFormId(mTexture);
|
||||||
break; // TES5 only
|
break; // TES5, FO4
|
||||||
case ESM4::SUB_MNAM:
|
case ESM4::SUB_MNAM:
|
||||||
reader.getFormId(mMaterial);
|
reader.getFormId(mMaterial);
|
||||||
break; // TES5 only
|
break; // TES5, FO4
|
||||||
default:
|
default:
|
||||||
throw std::runtime_error("ESM4::LTEX::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
|
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 mHavokRestitution;
|
||||||
|
|
||||||
std::uint8_t mTextureSpecular; // default 30
|
std::uint8_t mTextureSpecular; // default 30
|
||||||
ESM::FormId mGrass;
|
std::vector<ESM::FormId> mGrass;
|
||||||
|
|
||||||
// ------ TES4 only -----
|
// ------ TES4 only -----
|
||||||
|
|
||||||
std::string mTextureFile;
|
std::string mTextureFile;
|
||||||
std::uint8_t mHavokMaterial;
|
std::uint8_t mHavokMaterial;
|
||||||
|
|
||||||
// ------ TES5 only -----
|
// ------ TES5, FO4 -----
|
||||||
|
|
||||||
ESM::FormId mTexture;
|
ESM::FormId mTexture;
|
||||||
ESM::FormId mMaterial;
|
ESM::FormId mMaterial;
|
||||||
|
|
Loading…
Reference in a new issue