1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-30 03:32:36 +00:00

Maybe load FO4 book records

This commit is contained in:
Alexei Kotov 2023-08-16 05:41:13 +03:00
parent aedcc28294
commit d9ebdc6e41

View File

@ -53,22 +53,31 @@ void ESM4::Book::load(ESM4::Reader& reader)
break;
case ESM4::SUB_DATA:
{
reader.get(mData.flags);
// if (reader.esmVersion() == ESM::VER_094 || reader.esmVersion() == ESM::VER_170)
if (subHdr.dataSize == 16) // FO3 has 10 bytes even though VER_094
if (subHdr.dataSize == 8 || subHdr.dataSize == 10 || subHdr.dataSize == 16)
{
static std::uint8_t dummy;
reader.get(mData.type);
reader.get(dummy);
reader.get(dummy);
reader.get(mData.teaches);
// TES4, FO3, FNV
if (subHdr.dataSize == 10)
{
reader.get(mData.flags);
reader.get(mData.bookSkill);
}
// TES5
else if (subHdr.dataSize == 16)
{
reader.get(mData.flags);
reader.get(mData.type);
std::uint16_t dummy;
reader.get(dummy);
reader.get(mData.teaches);
}
// else: FO4
reader.get(mData.value);
reader.get(mData.weight);
}
else
{
reader.get(mData.bookSkill);
reader.skipSubRecordData();
}
reader.get(mData.value);
reader.get(mData.weight);
break;
}
case ESM4::SUB_ICON:
@ -94,8 +103,11 @@ void ESM4::Book::load(ESM4::Reader& reader)
break;
case ESM4::SUB_ZNAM:
reader.getFormId(mDropSound);
break; // TODO: does this exist?
case ESM4::SUB_MODT:
break;
case ESM4::SUB_MODT: // Model data
case ESM4::SUB_MODC:
case ESM4::SUB_MODS:
case ESM4::SUB_MODF: // Model data end
case ESM4::SUB_OBND:
case ESM4::SUB_KSIZ:
case ESM4::SUB_KWDA:
@ -111,6 +123,9 @@ void ESM4::Book::load(ESM4::Reader& reader)
case ESM4::SUB_DSTA:
case ESM4::SUB_DSTD:
case ESM4::SUB_DSTF: // Destructible end
case ESM4::SUB_DNAM: // FO4
case ESM4::SUB_FIMD: // FO4
case ESM4::SUB_MICO: // FO4
case ESM4::SUB_PTRN: // FO4
reader.skipSubRecordData();
break;