1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-09 13:13:34 +00:00
OpenMW/components/esm3/projectilestate.cpp

74 lines
1.9 KiB
C++
Raw Normal View History

2014-05-17 05:21:17 +02:00
#include "projectilestate.hpp"
#include "esmreader.hpp"
2022-09-22 21:26:05 +03:00
#include "esmwriter.hpp"
2014-05-17 05:21:17 +02:00
namespace ESM
{
2022-09-22 21:26:05 +03:00
void BaseProjectileState::save(ESMWriter& esm) const
2014-05-17 05:21:17 +02:00
{
2022-09-22 21:26:05 +03:00
esm.writeHNString("ID__", mId);
esm.writeHNT("VEC3", mPosition);
esm.writeHNT("QUAT", mOrientation);
esm.writeHNT("ACTO", mActorId);
2014-05-17 05:21:17 +02:00
}
2022-09-22 21:26:05 +03:00
void BaseProjectileState::load(ESMReader& esm)
2014-05-17 05:21:17 +02:00
{
mId = esm.getHNString("ID__");
2022-09-22 21:26:05 +03:00
esm.getHNT(mPosition, "VEC3");
esm.getHNT(mOrientation, "QUAT");
esm.getHNT(mActorId, "ACTO");
2014-05-17 05:21:17 +02:00
}
2022-09-22 21:26:05 +03:00
void MagicBoltState::save(ESMWriter& esm) const
2014-05-17 05:21:17 +02:00
{
BaseProjectileState::save(esm);
2022-09-22 21:26:05 +03:00
esm.writeHNString("SPEL", mSpellId);
esm.writeHNT("SPED", mSpeed);
esm.writeHNT("SLOT", mSlot);
2014-05-17 05:21:17 +02:00
}
2022-09-22 21:26:05 +03:00
void MagicBoltState::load(ESMReader& esm)
2014-05-17 05:21:17 +02:00
{
BaseProjectileState::load(esm);
mSpellId = esm.getHNString("SPEL");
if (esm.isNextSub("SRCN")) // for backwards compatibility
esm.skipHSub();
EffectList().load(esm); // for backwards compatibility
2022-09-22 21:26:05 +03:00
esm.getHNT(mSpeed, "SPED");
if (esm.getFormat() < 17)
mSlot = 0;
else
esm.getHNT(mSlot, "SLOT");
if (esm.isNextSub("STCK")) // for backwards compatibility
esm.skipHSub();
if (esm.isNextSub("SOUN")) // for backwards compatibility
esm.skipHSub();
2014-05-17 05:21:17 +02:00
}
2022-09-22 21:26:05 +03:00
void ProjectileState::save(ESMWriter& esm) const
2014-05-17 05:21:17 +02:00
{
BaseProjectileState::save(esm);
2022-09-22 21:26:05 +03:00
esm.writeHNString("BOW_", mBowId);
esm.writeHNT("VEL_", mVelocity);
esm.writeHNT("STR_", mAttackStrength);
2014-05-17 05:21:17 +02:00
}
2022-09-22 21:26:05 +03:00
void ProjectileState::load(ESMReader& esm)
2014-05-17 05:21:17 +02:00
{
BaseProjectileState::load(esm);
2022-09-22 21:26:05 +03:00
mBowId = esm.getHNString("BOW_");
esm.getHNT(mVelocity, "VEL_");
mAttackStrength = 1.f;
esm.getHNOT(mAttackStrength, "STR_");
2014-05-17 05:21:17 +02:00
}
}