parent
3374630e7b
commit
b65f379b7f
@ -0,0 +1,37 @@
|
||||
#include "animationstate.hpp"
|
||||
|
||||
#include "esmreader.hpp"
|
||||
#include "esmwriter.hpp"
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
void AnimationState::load(ESMReader& esm)
|
||||
{
|
||||
mScriptedAnims.clear();
|
||||
|
||||
while (esm.isNextSub("ANIS"))
|
||||
{
|
||||
ScriptedAnimation anim;
|
||||
|
||||
anim.mGroup = esm.getHString();
|
||||
esm.getHNOT(anim.mTime, "TIME");
|
||||
esm.getHNOT(anim.mAbsolute, "ABST");
|
||||
esm.getHNT(anim.mLoopCount, "COUN");
|
||||
|
||||
mScriptedAnims.push_back(anim);
|
||||
}
|
||||
}
|
||||
|
||||
void AnimationState::save(ESMWriter& esm) const
|
||||
{
|
||||
for (ScriptedAnimations::const_iterator iter = mScriptedAnims.begin(); iter != mScriptedAnims.end(); ++iter)
|
||||
{
|
||||
esm.writeHNString("ANIS", iter->mGroup);
|
||||
if (iter->mTime > 0)
|
||||
esm.writeHNT("TIME", iter->mTime);
|
||||
if (iter->mAbsolute)
|
||||
esm.writeHNT("ABST", iter->mAbsolute);
|
||||
esm.writeHNT("COUN", iter->mLoopCount);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
#ifndef OPENMW_ESM_ANIMATIONSTATE_H
|
||||
#define OPENMW_ESM_ANIMATIONSTATE_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
class ESMReader;
|
||||
class ESMWriter;
|
||||
|
||||
// format 0, saved games only
|
||||
struct AnimationState
|
||||
{
|
||||
struct ScriptedAnimation
|
||||
{
|
||||
ScriptedAnimation()
|
||||
: mTime(0.f), mAbsolute(false), mLoopCount(0) {}
|
||||
|
||||
std::string mGroup;
|
||||
float mTime;
|
||||
bool mAbsolute;
|
||||
size_t mLoopCount;
|
||||
};
|
||||
|
||||
typedef std::vector<ScriptedAnimation> ScriptedAnimations;
|
||||
ScriptedAnimations mScriptedAnims;
|
||||
|
||||
void load(ESMReader& esm);
|
||||
void save(ESMWriter& esm) const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue