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;
ESM::CellRef::loadData(esm, isDeleted);
mActorData.mHasACDT = false;
if (esm.isNextSub("ACDT"))
{
mActorData.mHasACDT = true;
esm.getHT(mActorData.mACDT.mUnknown, mActorData.mACDT.mFlags, mActorData.mACDT.mBreathMeter,
mActorData.mHasACDT
= esm.getHNOT("ACDT", mActorData.mACDT.mUnknown, mActorData.mACDT.mFlags, mActorData.mACDT.mBreathMeter,
mActorData.mACDT.mUnknown2, mActorData.mACDT.mDynamic, mActorData.mACDT.mUnknown3,
mActorData.mACDT.mAttributes, mActorData.mACDT.mMagicEffects, mActorData.mACDT.mUnknown4,
mActorData.mACDT.mGoldPool, mActorData.mACDT.mCountDown, mActorData.mACDT.mUnknown5);
}
mActorData.mHasACSC = false;
if (esm.isNextSub("ACSC"))
{
mActorData.mHasACSC = true;
esm.getHT(mActorData.mACSC.mUnknown1, mActorData.mACSC.mFlags, mActorData.mACSC.mUnknown2,
mActorData.mACSC.mCorpseClearCountdown, mActorData.mACSC.mUnknown3);
}
mActorData.mHasACSC = esm.getHNOT("ACSC", mActorData.mACSC.mUnknown1, mActorData.mACSC.mFlags,
mActorData.mACSC.mUnknown2, mActorData.mACSC.mCorpseClearCountdown, mActorData.mACSC.mUnknown3);
if (esm.isNextSub("ACSL"))
esm.skipHSubSize(112);
@ -127,23 +118,17 @@ namespace ESSImport
}
// FIXME: not all actors have this, add flag
if (esm.isNextSub("CHRD")) // npc only
esm.getHExact(mActorData.mSkills, 27 * 2 * sizeof(int));
esm.getHNOT("CHRD", mActorData.mSkills); // npc only
if (esm.isNextSub("CRED")) // creature only
esm.getHExact(mActorData.mCombatStats, 3 * 2 * sizeof(int));
esm.getHNOT("CRED", mActorData.mCombatStats); // creature only
mActorData.mSCRI.load(esm);
if (esm.isNextSub("ND3D"))
esm.skipHSub();
mActorData.mHasANIS = false;
if (esm.isNextSub("ANIS"))
{
mActorData.mHasANIS = true;
esm.getHT(mActorData.mANIS.mGroupIndex, mActorData.mANIS.mUnknown, mActorData.mANIS.mTime);
}
mActorData.mHasANIS
= esm.getHNOT("ANIS", mActorData.mANIS.mGroupIndex, mActorData.mANIS.mUnknown, mActorData.mANIS.mTime);
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
// alarmvoi0000.ess
for (int i = 0; i < 2; ++i)
{
if (esm.isNextSub("DATA"))
esm.getHNT("DATA", mPos.pos, mPos.rot);
}
esm.getHNOT("DATA", mPos.pos, mPos.rot);
mDeleted = 0;
if (esm.isNextSub("DELE"))

@ -55,12 +55,7 @@ namespace ESSImport
if (esm.isNextSub("NAM3"))
esm.skipHSub();
mHasENAM = false;
if (esm.isNextSub("ENAM"))
{
mHasENAM = true;
esm.getHT(mENAM.mCellX, mENAM.mCellY);
}
mHasENAM = esm.getHNOT("ENAM", mENAM.mCellX, mENAM.mCellY);
if (esm.isNextSub("LNAM"))
esm.skipHSub();
@ -73,12 +68,7 @@ namespace ESSImport
mFactions.push_back(fnam);
}
mHasAADT = false;
if (esm.isNextSub("AADT")) // Attack animation data?
{
mHasAADT = true;
esm.getHT(mAADT.animGroupIndex, mAADT.mUnknown5);
}
mHasAADT = esm.getHNOT("AADT", mAADT.animGroupIndex, mAADT.mUnknown5); // Attack animation data?
if (esm.isNextSub("KNAM"))
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("STAR", mDurationData.mRemainingDuration, mDurationData.unused); // was mStartTime
mStoredInitialActorPosition = false;
if (esm.isNextSub("POS_"))
{
mStoredInitialActorPosition = true;
esm.getHT(mInitialActorPosition.mValues);
}
mStoredInitialActorPosition = esm.getHNOT("POS_", mInitialActorPosition.mValues);
}
void AiWander::save(ESMWriter& esm) const

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

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

@ -20,10 +20,8 @@ namespace 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"))
{
@ -43,11 +41,8 @@ namespace ESM
mMaster.push_back(m);
}
if (esm.isNextSub("GMDT"))
{
esm.getHT(mGameData.mCurrentHealth, mGameData.mMaximumHealth, mGameData.mHour, mGameData.unknown1,
mGameData.mCurrentCell.mData, mGameData.unknown2, mGameData.mPlayerName.mData);
}
esm.getHNOT("GMDT", mGameData.mCurrentHealth, mGameData.mMaximumHealth, mGameData.mHour, mGameData.unknown1,
mGameData.mCurrentCell.mData, mGameData.unknown2, mGameData.mPlayerName.mData);
if (esm.isNextSub("SCRD"))
{
esm.getSubHeader();

@ -32,15 +32,8 @@ namespace ESM
mCount = 1;
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;
esm.getHNOT(mFlags, "FLAG");

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

Loading…
Cancel
Save