1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-03 17:37:18 +00:00
OpenMW/apps/essimporter/importsplm.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
1.4 KiB
C++
Raw Normal View History

#include "importsplm.h"
#include <components/esm3/esmreader.hpp>
namespace ESSImport
{
void SPLM::load(ESM::ESMReader& esm)
{
while (esm.isNextSub("NAME"))
{
ActiveSpell spell;
esm.getHT(spell.mIndex);
2023-12-17 13:03:45 +00:00
esm.getHNT("SPDT", spell.mSPDT.mType, spell.mSPDT.mId.mData, spell.mSPDT.mUnknown,
spell.mSPDT.mCasterId.mData, spell.mSPDT.mSourceId.mData, spell.mSPDT.mUnknown2);
spell.mTarget = esm.getHNOString("TNAM");
2022-09-22 18:26:05 +00:00
while (esm.isNextSub("NPDT"))
2022-09-22 18:26:05 +00:00
{
ActiveEffect effect;
2023-12-17 13:03:45 +00:00
esm.getHT(effect.mNPDT.mAffectedActorId.mData, effect.mNPDT.mUnknown, effect.mNPDT.mMagnitude,
effect.mNPDT.mSecondsActive, effect.mNPDT.mUnknown2);
2022-09-22 18:26:05 +00:00
// Effect-specific subrecords can follow:
// - INAM for disintegration and bound effects
// - CNAM for summoning and command effects
// - VNAM for vampirism
// NOTE: There can be multiple INAMs per effect.
// TODO: Needs more research.
2022-09-22 18:26:05 +00:00
esm.skipHSubUntil("NAM0"); // sentinel
esm.getSubName();
esm.skipHSub();
2022-09-22 18:26:05 +00:00
spell.mActiveEffects.push_back(effect);
2022-09-22 18:26:05 +00:00
}
unsigned char xnam; // sentinel
esm.getHNT(xnam, "XNAM");
2022-09-22 18:26:05 +00:00
mActiveSpells.push_back(spell);
}
}
}