1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-30 22:45:36 +00:00

Maybe load FO4 ammunition records

This commit is contained in:
Alexei Kotov 2023-08-16 09:05:14 +03:00
parent dcb791083e
commit e9f9da98cf
2 changed files with 16 additions and 0 deletions

View file

@ -75,6 +75,12 @@ void ESM4::Ammunition::load(ESM4::Reader& reader)
if (subHdr.dataSize == 20) if (subHdr.dataSize == 20)
reader.get(mData.mWeight); reader.get(mData.mWeight);
} }
// FO4
else if (subHdr.dataSize == 8)
{
reader.get(mData.mValue);
reader.get(mData.mWeight);
}
else else
{ {
reader.skipSubRecordData(); reader.skipSubRecordData();
@ -94,6 +100,13 @@ void ESM4::Ammunition::load(ESM4::Reader& reader)
reader.skipSubRecordData(); reader.skipSubRecordData();
} }
break; break;
case ESM4::SUB_DNAM:
reader.getFormId(mData.mProjectile);
reader.get(mData.mFlags);
mData.mFlags &= 0xFF;
reader.get(mData.mDamage);
reader.get(mData.mHealth);
break;
case ESM4::SUB_ICON: case ESM4::SUB_ICON:
reader.getZString(mIcon); reader.getZString(mIcon);
break; break;
@ -150,6 +163,8 @@ void ESM4::Ammunition::load(ESM4::Reader& reader)
case ESM4::SUB_DSTD: case ESM4::SUB_DSTD:
case ESM4::SUB_DSTF: // Destructible end case ESM4::SUB_DSTF: // Destructible end
case ESM4::SUB_PTRN: // FO4 case ESM4::SUB_PTRN: // FO4
case ESM4::SUB_NAM1: // FO4 casing model data
case ESM4::SUB_NAM2: //
reader.skipSubRecordData(); reader.skipSubRecordData();
break; break;
default: default:

View file

@ -53,6 +53,7 @@ namespace ESM4
ESM::FormId mProjectile; ESM::FormId mProjectile;
ESM::FormId mConsumedAmmo; ESM::FormId mConsumedAmmo;
float mConsumedPercentage{ 0.f }; float mConsumedPercentage{ 0.f };
std::uint32_t mHealth{ 0u };
}; };
ESM::FormId mId; // from the header ESM::FormId mId; // from the header