Save new projectile state

new-script-api
Miloslav Číž 7 years ago
parent de42aa9d03
commit 2b9a0a7732

@ -567,6 +567,9 @@ namespace MWWorld
state.mVelocity = it->mVelocity; state.mVelocity = it->mVelocity;
state.mAttackStrength = it->mAttackStrength; state.mAttackStrength = it->mAttackStrength;
state.mThrown = it->mThrown;
state.mTime = it->mTime;
state.save(writer); state.save(writer);
writer.endRecord(ESM::REC_PROJ); writer.endRecord(ESM::REC_PROJ);
@ -604,6 +607,8 @@ namespace MWWorld
state.mVelocity = esm.mVelocity; state.mVelocity = esm.mVelocity;
state.mIdArrow = esm.mId; state.mIdArrow = esm.mId;
state.mAttackStrength = esm.mAttackStrength; state.mAttackStrength = esm.mAttackStrength;
state.mThrown = esm.mThrown;
state.mTime = esm.mTime;
std::string model; std::string model;
try try

@ -52,6 +52,8 @@ namespace ESM
esm.writeHNString ("BOW_", mBowId); esm.writeHNString ("BOW_", mBowId);
esm.writeHNT ("VEL_", mVelocity); esm.writeHNT ("VEL_", mVelocity);
esm.writeHNT ("STR_", mAttackStrength); esm.writeHNT ("STR_", mAttackStrength);
esm.writeHNT ("THR_", mThrown);
esm.writeHNT ("TIM_", mTime);
} }
void ProjectileState::load(ESMReader &esm) void ProjectileState::load(ESMReader &esm)
@ -63,6 +65,12 @@ namespace ESM
mAttackStrength = 1.f; mAttackStrength = 1.f;
esm.getHNOT(mAttackStrength, "STR_"); esm.getHNOT(mAttackStrength, "STR_");
mThrown = false;
esm.getHNOT (mThrown, "THR_");
mTime = 0.f;
esm.getHNOT (mTime, "TIM_");
} }
} }

@ -42,6 +42,8 @@ namespace ESM
std::string mBowId; std::string mBowId;
Vector3 mVelocity; Vector3 mVelocity;
float mAttackStrength; float mAttackStrength;
float mTime;
bool mThrown;
void load (ESMReader &esm); void load (ESMReader &esm);
void save (ESMWriter &esm) const; void save (ESMWriter &esm) const;

Loading…
Cancel
Save