Add a variadic getHNOT

macos_ci_fix
Evil Eye 1 year ago
parent 9f38ee82f4
commit 3e101ab409

@ -45,23 +45,14 @@ namespace ESSImport
bool isDeleted = false; bool isDeleted = false;
ESM::CellRef::loadData(esm, isDeleted); ESM::CellRef::loadData(esm, isDeleted);
mActorData.mHasACDT = false; mActorData.mHasACDT
if (esm.isNextSub("ACDT")) = esm.getHNOT("ACDT", mActorData.mACDT.mUnknown, mActorData.mACDT.mFlags, mActorData.mACDT.mBreathMeter,
{
mActorData.mHasACDT = true;
esm.getHT(mActorData.mACDT.mUnknown, mActorData.mACDT.mFlags, mActorData.mACDT.mBreathMeter,
mActorData.mACDT.mUnknown2, mActorData.mACDT.mDynamic, mActorData.mACDT.mUnknown3, mActorData.mACDT.mUnknown2, mActorData.mACDT.mDynamic, mActorData.mACDT.mUnknown3,
mActorData.mACDT.mAttributes, mActorData.mACDT.mMagicEffects, mActorData.mACDT.mUnknown4, mActorData.mACDT.mAttributes, mActorData.mACDT.mMagicEffects, mActorData.mACDT.mUnknown4,
mActorData.mACDT.mGoldPool, mActorData.mACDT.mCountDown, mActorData.mACDT.mUnknown5); mActorData.mACDT.mGoldPool, mActorData.mACDT.mCountDown, mActorData.mACDT.mUnknown5);
}
mActorData.mHasACSC = false; mActorData.mHasACSC = esm.getHNOT("ACSC", mActorData.mACSC.mUnknown1, mActorData.mACSC.mFlags,
if (esm.isNextSub("ACSC")) mActorData.mACSC.mUnknown2, mActorData.mACSC.mCorpseClearCountdown, mActorData.mACSC.mUnknown3);
{
mActorData.mHasACSC = true;
esm.getHT(mActorData.mACSC.mUnknown1, mActorData.mACSC.mFlags, mActorData.mACSC.mUnknown2,
mActorData.mACSC.mCorpseClearCountdown, mActorData.mACSC.mUnknown3);
}
if (esm.isNextSub("ACSL")) if (esm.isNextSub("ACSL"))
esm.skipHSubSize(112); esm.skipHSubSize(112);
@ -127,23 +118,17 @@ namespace ESSImport
} }
// FIXME: not all actors have this, add flag // FIXME: not all actors have this, add flag
if (esm.isNextSub("CHRD")) // npc only esm.getHNOT("CHRD", mActorData.mSkills); // npc only
esm.getHExact(mActorData.mSkills, 27 * 2 * sizeof(int));
if (esm.isNextSub("CRED")) // creature only esm.getHNOT("CRED", mActorData.mCombatStats); // creature only
esm.getHExact(mActorData.mCombatStats, 3 * 2 * sizeof(int));
mActorData.mSCRI.load(esm); mActorData.mSCRI.load(esm);
if (esm.isNextSub("ND3D")) if (esm.isNextSub("ND3D"))
esm.skipHSub(); esm.skipHSub();
mActorData.mHasANIS = false; mActorData.mHasANIS
if (esm.isNextSub("ANIS")) = esm.getHNOT("ANIS", mActorData.mANIS.mGroupIndex, mActorData.mANIS.mUnknown, mActorData.mANIS.mTime);
{
mActorData.mHasANIS = true;
esm.getHT(mActorData.mANIS.mGroupIndex, mActorData.mANIS.mUnknown, mActorData.mANIS.mTime);
}
if (esm.isNextSub("LVCR")) if (esm.isNextSub("LVCR"))
{ {
@ -161,10 +146,7 @@ namespace ESSImport
// I've seen DATA *twice* on a creature record, and with the exact same content too! weird // I've seen DATA *twice* on a creature record, and with the exact same content too! weird
// alarmvoi0000.ess // alarmvoi0000.ess
for (int i = 0; i < 2; ++i) for (int i = 0; i < 2; ++i)
{ esm.getHNOT("DATA", mPos.pos, mPos.rot);
if (esm.isNextSub("DATA"))
esm.getHNT("DATA", mPos.pos, mPos.rot);
}
mDeleted = 0; mDeleted = 0;
if (esm.isNextSub("DELE")) if (esm.isNextSub("DELE"))

@ -55,12 +55,7 @@ namespace ESSImport
if (esm.isNextSub("NAM3")) if (esm.isNextSub("NAM3"))
esm.skipHSub(); esm.skipHSub();
mHasENAM = false; mHasENAM = esm.getHNOT("ENAM", mENAM.mCellX, mENAM.mCellY);
if (esm.isNextSub("ENAM"))
{
mHasENAM = true;
esm.getHT(mENAM.mCellX, mENAM.mCellY);
}
if (esm.isNextSub("LNAM")) if (esm.isNextSub("LNAM"))
esm.skipHSub(); esm.skipHSub();
@ -73,12 +68,7 @@ namespace ESSImport
mFactions.push_back(fnam); mFactions.push_back(fnam);
} }
mHasAADT = false; mHasAADT = esm.getHNOT("AADT", mAADT.animGroupIndex, mAADT.mUnknown5); // Attack animation data?
if (esm.isNextSub("AADT")) // Attack animation data?
{
mHasAADT = true;
esm.getHT(mAADT.animGroupIndex, mAADT.mUnknown5);
}
if (esm.isNextSub("KNAM")) if (esm.isNextSub("KNAM"))
esm.skipHSub(); // assigned Quick Keys, I think esm.skipHSub(); // assigned Quick Keys, I think

@ -15,12 +15,7 @@ namespace ESM
{ {
esm.getHNT("DATA", mData.mDistance, mData.mDuration, mData.mTimeOfDay, mData.mIdle, mData.mShouldRepeat); esm.getHNT("DATA", mData.mDistance, mData.mDuration, mData.mTimeOfDay, mData.mIdle, mData.mShouldRepeat);
esm.getHNT("STAR", mDurationData.mRemainingDuration, mDurationData.unused); // was mStartTime esm.getHNT("STAR", mDurationData.mRemainingDuration, mDurationData.unused); // was mStartTime
mStoredInitialActorPosition = false; mStoredInitialActorPosition = esm.getHNOT("POS_", mInitialActorPosition.mValues);
if (esm.isNextSub("POS_"))
{
mStoredInitialActorPosition = true;
esm.getHT(mInitialActorPosition.mValues);
}
} }
void AiWander::save(ESMWriter& esm) const void AiWander::save(ESMWriter& esm) const

@ -11,17 +11,9 @@ namespace ESM
{ {
mWorldspace = esm.getHNString("SPAC"); mWorldspace = esm.getHNString("SPAC");
if (esm.isNextSub("CIDX"))
{
esm.getHT(mIndex.mX, mIndex.mY);
mPaged = true;
}
else
{
mPaged = false;
mIndex.mX = 0; mIndex.mX = 0;
mIndex.mY = 0; mIndex.mY = 0;
} mPaged = esm.getHNOT("CIDX", mIndex.mX, mIndex.mY);
} }
void CellId::save(ESMWriter& esm) const void CellId::save(ESMWriter& esm) const

@ -151,9 +151,19 @@ namespace ESM
// Optional version of getHNT // Optional version of getHNT
template <typename X> template <typename X>
void getHNOT(X& x, NAME name) void getHNOT(X& x, NAME name)
{
getHNOT(name, x);
}
template <class... Args>
bool getHNOT(NAME name, Args&... args)
{ {
if (isNextSub(name)) if (isNextSub(name))
getHT(x); {
getHT(args...);
return true;
}
return false;
} }
// Get data of a given type/size, including subrecord header // Get data of a given type/size, including subrecord header

@ -20,10 +20,8 @@ namespace ESM
void Header::load(ESMReader& esm) void Header::load(ESMReader& esm)
{ {
if (esm.isNextSub("FORM"))
esm.getHT(mFormatVersion);
else
mFormatVersion = DefaultFormatVersion; mFormatVersion = DefaultFormatVersion;
esm.getHNOT("FORM", mFormatVersion);
if (esm.isNextSub("HEDR")) if (esm.isNextSub("HEDR"))
{ {
@ -43,11 +41,8 @@ namespace ESM
mMaster.push_back(m); mMaster.push_back(m);
} }
if (esm.isNextSub("GMDT")) esm.getHNOT("GMDT", mGameData.mCurrentHealth, mGameData.mMaximumHealth, mGameData.mHour, mGameData.unknown1,
{
esm.getHT(mGameData.mCurrentHealth, mGameData.mMaximumHealth, mGameData.mHour, mGameData.unknown1,
mGameData.mCurrentCell.mData, mGameData.unknown2, mGameData.mPlayerName.mData); mGameData.mCurrentCell.mData, mGameData.unknown2, mGameData.mPlayerName.mData);
}
if (esm.isNextSub("SCRD")) if (esm.isNextSub("SCRD"))
{ {
esm.getSubHeader(); esm.getSubHeader();

@ -32,15 +32,8 @@ namespace ESM
mCount = 1; mCount = 1;
esm.getHNOT(mCount, "COUN"); esm.getHNOT(mCount, "COUN");
if (esm.isNextSub("POS_"))
{
std::array<float, 6> pos;
esm.getHT(pos);
memcpy(mPosition.pos, pos.data(), sizeof(float) * 3);
memcpy(mPosition.rot, pos.data() + 3, sizeof(float) * 3);
}
else
mPosition = mRef.mPos; mPosition = mRef.mPos;
esm.getHNOT("POS_", mPosition.pos, mPosition.rot);
mFlags = 0; mFlags = 0;
esm.getHNOT(mFlags, "FLAG"); esm.getHNOT(mFlags, "FLAG");

@ -15,14 +15,9 @@ namespace ESM
esm.getHNT("LKEP", mLastKnownExteriorPosition); esm.getHNT("LKEP", mLastKnownExteriorPosition);
if (esm.isNextSub("MARK")) mHasMark = esm.getHNOT("MARK", mMarkedPosition.pos, mMarkedPosition.rot);
{ if (mHasMark)
mHasMark = true;
esm.getHT(mMarkedPosition.pos, mMarkedPosition.rot);
mMarkedCell = esm.getCellId(); mMarkedCell = esm.getCellId();
}
else
mHasMark = false;
// Automove, no longer used. // Automove, no longer used.
if (esm.isNextSub("AMOV")) if (esm.isNextSub("AMOV"))

Loading…
Cancel
Save