mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-05-07 11:14:08 +03:00
parent
fa4718283d
commit
b95748d044
14 changed files with 87 additions and 47 deletions
|
@ -46,12 +46,12 @@ void ESM::CellRef::loadData(ESMReader &esm)
|
|||
esm.getHNOT (mFactionRank, "INDX");
|
||||
|
||||
mGoldValue = 1;
|
||||
mChargeInt = -1;
|
||||
mCharge = -1;
|
||||
mEnchantmentCharge = -1;
|
||||
|
||||
esm.getHNOT (mEnchantmentCharge, "XCHG");
|
||||
|
||||
esm.getHNOT (mChargeInt, "INTV");
|
||||
esm.getHNOT (mCharge, "INTV");
|
||||
|
||||
esm.getHNOT (mGoldValue, "NAM9");
|
||||
|
||||
|
@ -106,8 +106,8 @@ void ESM::CellRef::save (ESMWriter &esm, bool wideRefNum, bool inInventory) cons
|
|||
if (mEnchantmentCharge != -1)
|
||||
esm.writeHNT("XCHG", mEnchantmentCharge);
|
||||
|
||||
if (mChargeInt != -1)
|
||||
esm.writeHNT("INTV", mChargeInt);
|
||||
if (mCharge != -1)
|
||||
esm.writeHNT("INTV", mCharge);
|
||||
|
||||
if (mGoldValue != 1) {
|
||||
esm.writeHNT("NAM9", mGoldValue);
|
||||
|
@ -146,7 +146,7 @@ void ESM::CellRef::blank()
|
|||
mSoul.clear();
|
||||
mFaction.clear();
|
||||
mFactionRank = -2;
|
||||
mChargeInt = -1;
|
||||
mCharge = -1;
|
||||
mEnchantmentCharge = -1;
|
||||
mGoldValue = 0;
|
||||
mDestCell.clear();
|
||||
|
|
|
@ -59,11 +59,7 @@ namespace ESM
|
|||
|
||||
// For weapon or armor, this is the remaining item health.
|
||||
// For tools (lockpicks, probes, repair hammer) it is the remaining uses.
|
||||
union
|
||||
{
|
||||
int mChargeInt;
|
||||
float mChargeFloat;
|
||||
};
|
||||
int mCharge;
|
||||
|
||||
// Remaining enchantment charge. This could be -1 if the charge was not touched yet (i.e. full).
|
||||
float mEnchantmentCharge;
|
||||
|
|
|
@ -24,9 +24,9 @@ void ESM::ObjectState::load (ESMReader &esm)
|
|||
|
||||
esm.getHNOT (mLocalRotation, "LROT", 12);
|
||||
|
||||
// obsolete
|
||||
int unused;
|
||||
esm.getHNOT(unused, "LTIM");
|
||||
// used for lights only
|
||||
mTime = 0;
|
||||
esm.getHNOT (mTime, "LTIM");
|
||||
|
||||
// FIXME: assuming "false" as default would make more sense, but also break compatibility with older save files
|
||||
mHasCustomState = true;
|
||||
|
@ -55,6 +55,9 @@ void ESM::ObjectState::save (ESMWriter &esm, bool inInventory) const
|
|||
esm.writeHNT ("LROT", mLocalRotation, 12);
|
||||
}
|
||||
|
||||
if (mTime)
|
||||
esm.writeHNT ("LTIM", mTime);
|
||||
|
||||
if (!mHasCustomState)
|
||||
esm.writeHNT ("HCUS", false);
|
||||
}
|
||||
|
@ -71,6 +74,7 @@ void ESM::ObjectState::blank()
|
|||
mPosition.rot[i] = 0;
|
||||
mLocalRotation[i] = 0;
|
||||
}
|
||||
mTime = 0;
|
||||
mHasCustomState = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@ namespace ESM
|
|||
ESM::Position mPosition;
|
||||
float mLocalRotation[3];
|
||||
|
||||
float mTime; // Used for lights only. Overhead should not be so awful, besides CellRef isn't OO either
|
||||
|
||||
// Is there any class-specific state following the ObjectState
|
||||
bool mHasCustomState;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue