|
|
@ -35,9 +35,7 @@ void ESM4::Armor::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();
|
|
|
|
uint16_t currentIndex = 0xFFFF;
|
|
|
|
mIsFONV = esmVer == ESM::VER_132 || esmVer == ESM::VER_133 || esmVer == ESM::VER_134;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (reader.getSubRecordHeader())
|
|
|
|
while (reader.getSubRecordHeader())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const ESM4::SubRecordHeader& subHdr = reader.subRecordHeader();
|
|
|
|
const ESM4::SubRecordHeader& subHdr = reader.subRecordHeader();
|
|
|
@ -51,32 +49,51 @@ void ESM4::Armor::load(ESM4::Reader& reader)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case ESM4::SUB_DATA:
|
|
|
|
case ESM4::SUB_DATA:
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// if (reader.esmVersion() == ESM::VER_094 || reader.esmVersion() == ESM::VER_170)
|
|
|
|
// TES5
|
|
|
|
if (subHdr.dataSize == 8) // FO3 has 12 bytes even though VER_094
|
|
|
|
if (subHdr.dataSize == 8)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
reader.get(mData.value);
|
|
|
|
reader.get(mData.value);
|
|
|
|
reader.get(mData.weight);
|
|
|
|
reader.get(mData.weight);
|
|
|
|
mIsFO3 = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (mIsFONV || subHdr.dataSize == 12)
|
|
|
|
// FO3, FNV, FO4
|
|
|
|
|
|
|
|
else if (subHdr.dataSize == 12)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
reader.get(mData.value);
|
|
|
|
reader.get(mData.value);
|
|
|
|
reader.get(mData.health);
|
|
|
|
reader.get(mData.health);
|
|
|
|
reader.get(mData.weight);
|
|
|
|
reader.get(mData.weight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// TES4
|
|
|
|
|
|
|
|
else if (subHdr.dataSize == 14)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
reader.get(mData);
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
reader.get(mData); // TES4
|
|
|
|
reader.skipSubRecordData();
|
|
|
|
mIsTES4 = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case ESM4::SUB_MODL: // seems only for Dawnguard/Dragonborn?
|
|
|
|
case ESM4::SUB_INDX: // FO4
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// if (esmVer == ESM::VER_094 || esmVer == ESM::VER_170 || isFONV)
|
|
|
|
reader.get(currentIndex);
|
|
|
|
if (subHdr.dataSize == 4) // FO3 has zstring even though VER_094
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
case ESM4::SUB_MODL:
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (subHdr.dataSize == 4)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// Assuming TES5
|
|
|
|
|
|
|
|
if (currentIndex == 0xFFFF)
|
|
|
|
reader.getFormId(mAddOns.emplace_back());
|
|
|
|
reader.getFormId(mAddOns.emplace_back());
|
|
|
|
|
|
|
|
// FO4
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (mAddOns.size() <= currentIndex)
|
|
|
|
|
|
|
|
mAddOns.resize(currentIndex + 1);
|
|
|
|
|
|
|
|
reader.getFormId(mAddOns[currentIndex]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!reader.getZString(mModelMale))
|
|
|
|
if (!reader.getZString(mModelMale))
|
|
|
@ -135,10 +152,21 @@ void ESM4::Armor::load(ESM4::Reader& reader)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case ESM4::SUB_BOD2:
|
|
|
|
case ESM4::SUB_BOD2:
|
|
|
|
|
|
|
|
// FO4, TES5
|
|
|
|
|
|
|
|
if (subHdr.dataSize == 4 || subHdr.dataSize == 8)
|
|
|
|
|
|
|
|
{
|
|
|
|
reader.get(mArmorFlags);
|
|
|
|
reader.get(mArmorFlags);
|
|
|
|
|
|
|
|
if (subHdr.dataSize == 8)
|
|
|
|
|
|
|
|
{
|
|
|
|
reader.get(mGeneralFlags);
|
|
|
|
reader.get(mGeneralFlags);
|
|
|
|
mGeneralFlags &= 0x0000000f; // 0 (light), 1 (heavy) or 2 (none)
|
|
|
|
mGeneralFlags &= 0x0000000f; // 0 (light), 1 (heavy) or 2 (none)
|
|
|
|
mGeneralFlags |= TYPE_TES5;
|
|
|
|
mGeneralFlags |= TYPE_TES5;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
reader.skipSubRecordData();
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case ESM4::SUB_SCRI:
|
|
|
|
case ESM4::SUB_SCRI:
|
|
|
|
reader.getFormId(mScriptId);
|
|
|
|
reader.getFormId(mScriptId);
|
|
|
@ -200,7 +228,15 @@ void ESM4::Armor::load(ESM4::Reader& reader)
|
|
|
|
case ESM4::SUB_DSTA:
|
|
|
|
case ESM4::SUB_DSTA:
|
|
|
|
case ESM4::SUB_DSTD:
|
|
|
|
case ESM4::SUB_DSTD:
|
|
|
|
case ESM4::SUB_DSTF: // Destructible end
|
|
|
|
case ESM4::SUB_DSTF: // Destructible end
|
|
|
|
|
|
|
|
case ESM4::SUB_APPR: // FO4
|
|
|
|
|
|
|
|
case ESM4::SUB_DAMA: // FO4
|
|
|
|
|
|
|
|
case ESM4::SUB_FNAM: // FO4
|
|
|
|
|
|
|
|
case ESM4::SUB_INRD: // FO4
|
|
|
|
case ESM4::SUB_PTRN: // FO4
|
|
|
|
case ESM4::SUB_PTRN: // FO4
|
|
|
|
|
|
|
|
case ESM4::SUB_OBTE: // FO4 object template start
|
|
|
|
|
|
|
|
case ESM4::SUB_OBTF:
|
|
|
|
|
|
|
|
case ESM4::SUB_OBTS:
|
|
|
|
|
|
|
|
case ESM4::SUB_STOP: // FO4 object template end
|
|
|
|
reader.skipSubRecordData();
|
|
|
|
reader.skipSubRecordData();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|