mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:53:50 +00:00
Fix CellRef to load current weapon/armor health correctly, also show it in the tooltips
This commit is contained in:
parent
feaf2b43fb
commit
8e2f9f5186
9 changed files with 25 additions and 33 deletions
|
@ -227,7 +227,7 @@ void loadCell(ESM::Cell &cell, ESM::ESMReader &esm, Arguments& info)
|
||||||
std::cout << " Refnum: " << ref.mRefnum << std::endl;
|
std::cout << " Refnum: " << ref.mRefnum << std::endl;
|
||||||
std::cout << " ID: '" << ref.mRefID << "'\n";
|
std::cout << " ID: '" << ref.mRefID << "'\n";
|
||||||
std::cout << " Owner: '" << ref.mOwner << "'\n";
|
std::cout << " Owner: '" << ref.mOwner << "'\n";
|
||||||
std::cout << " INTV: " << ref.mIntv << " NAM9: " << ref.mIntv << std::endl;
|
std::cout << " Uses/health: " << ref.mCharge << " NAM9: " << ref.mNam9 << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -247,8 +247,9 @@ namespace MWClass
|
||||||
|
|
||||||
text += "\n#{sArmorRating}: " + MWGui::ToolTips::toString(ref->mBase->mData.mArmor);
|
text += "\n#{sArmorRating}: " + MWGui::ToolTips::toString(ref->mBase->mData.mArmor);
|
||||||
|
|
||||||
/// \todo store the current armor health somewhere
|
int remainingHealth = (ptr.getCellRef().mCharge != -1) ? ptr.getCellRef().mCharge : ref->mBase->mData.mHealth;
|
||||||
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(ref->mBase->mData.mHealth);
|
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(remainingHealth) + "/"
|
||||||
|
+ MWGui::ToolTips::toString(ref->mBase->mData.mHealth);
|
||||||
|
|
||||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight) + " (" + typeText + ")";
|
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight) + " (" + typeText + ")";
|
||||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||||
|
|
|
@ -142,9 +142,9 @@ namespace MWClass
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
|
|
||||||
/// \todo store remaining uses somewhere
|
int remainingUses = (ptr.getCellRef().mCharge != -1) ? ptr.getCellRef().mCharge : ref->mBase->mData.mUses;
|
||||||
|
|
||||||
text += "\n#{sUses}: " + MWGui::ToolTips::toString(ref->mBase->mData.mUses);
|
text += "\n#{sUses}: " + MWGui::ToolTips::toString(remainingUses);
|
||||||
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->mBase->mData.mQuality);
|
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->mBase->mData.mQuality);
|
||||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
||||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||||
|
|
|
@ -141,9 +141,9 @@ namespace MWClass
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
|
|
||||||
/// \todo store remaining uses somewhere
|
int remainingUses = (ptr.getCellRef().mCharge != -1) ? ptr.getCellRef().mCharge : ref->mBase->mData.mUses;
|
||||||
|
|
||||||
text += "\n#{sUses}: " + MWGui::ToolTips::toString(ref->mBase->mData.mUses);
|
text += "\n#{sUses}: " + MWGui::ToolTips::toString(remainingUses);
|
||||||
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->mBase->mData.mQuality);
|
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->mBase->mData.mQuality);
|
||||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
||||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||||
|
|
|
@ -131,9 +131,9 @@ namespace MWClass
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
|
|
||||||
/// \todo store remaining uses somewhere
|
int remainingUses = (ptr.getCellRef().mCharge != -1) ? ptr.getCellRef().mCharge : ref->mBase->mData.mUses;
|
||||||
|
|
||||||
text += "\n#{sUses}: " + MWGui::ToolTips::toString(ref->mBase->mData.mUses);
|
text += "\n#{sUses}: " + MWGui::ToolTips::toString(remainingUses);
|
||||||
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->mBase->mData.mQuality);
|
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->mBase->mData.mQuality);
|
||||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
||||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||||
|
|
|
@ -334,9 +334,12 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \todo store the current weapon health somewhere
|
|
||||||
if (ref->mBase->mData.mType < 11) // thrown weapons and arrows/bolts don't have health, only quantity
|
if (ref->mBase->mData.mType < 11) // thrown weapons and arrows/bolts don't have health, only quantity
|
||||||
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(ref->mBase->mData.mHealth);
|
{
|
||||||
|
int remainingHealth = (ptr.getCellRef().mCharge != -1) ? ptr.getCellRef().mCharge : ref->mBase->mData.mHealth;
|
||||||
|
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(remainingHealth) + "/"
|
||||||
|
+ MWGui::ToolTips::toString(ref->mBase->mData.mHealth);
|
||||||
|
}
|
||||||
|
|
||||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
||||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||||
|
|
|
@ -68,8 +68,7 @@ namespace MWWorld
|
||||||
cellRef.mRefnum = -1;
|
cellRef.mRefnum = -1;
|
||||||
cellRef.mScale = 1;
|
cellRef.mScale = 1;
|
||||||
cellRef.mFactIndex = 0;
|
cellRef.mFactIndex = 0;
|
||||||
cellRef.mCharge = 0;
|
cellRef.mCharge = -1;
|
||||||
cellRef.mIntv = 0;
|
|
||||||
cellRef.mNam9 = 0;
|
cellRef.mNam9 = 0;
|
||||||
cellRef.mTeleport = false;
|
cellRef.mTeleport = false;
|
||||||
cellRef.mLockLevel = 0;
|
cellRef.mLockLevel = 0;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
namespace ESM
|
namespace ESM
|
||||||
{
|
{
|
||||||
|
|
||||||
/// Some overloaded copare operators.
|
/// Some overloaded compare operators.
|
||||||
bool operator==(const MovedCellRef& ref, int pRefnum)
|
bool operator==(const MovedCellRef& ref, int pRefnum)
|
||||||
{
|
{
|
||||||
return (ref.mRefnum == pRefnum);
|
return (ref.mRefnum == pRefnum);
|
||||||
|
@ -43,13 +43,9 @@ void CellRef::save(ESMWriter &esm)
|
||||||
esm.writeHNT("INDX", mFactIndex);
|
esm.writeHNT("INDX", mFactIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mCharge != -1.0) {
|
if (mCharge != -1)
|
||||||
esm.writeHNT("XCHG", mCharge);
|
esm.writeHNT("INTV", mCharge);
|
||||||
}
|
|
||||||
|
|
||||||
if (mIntv != -1) {
|
|
||||||
esm.writeHNT("INTV", mIntv);
|
|
||||||
}
|
|
||||||
if (mNam9 != 0) {
|
if (mNam9 != 0) {
|
||||||
esm.writeHNT("NAM9", mNam9);
|
esm.writeHNT("NAM9", mNam9);
|
||||||
}
|
}
|
||||||
|
@ -285,12 +281,9 @@ bool Cell::getNextRef(ESMReader &esm, CellRef &ref)
|
||||||
ref.mFactIndex = -2;
|
ref.mFactIndex = -2;
|
||||||
esm.getHNOT(ref.mFactIndex, "INDX");
|
esm.getHNOT(ref.mFactIndex, "INDX");
|
||||||
|
|
||||||
ref.mCharge = -1.0;
|
|
||||||
esm.getHNOT(ref.mCharge, "XCHG");
|
|
||||||
|
|
||||||
ref.mIntv = -1;
|
|
||||||
ref.mNam9 = 0;
|
ref.mNam9 = 0;
|
||||||
esm.getHNOT(ref.mIntv, "INTV");
|
ref.mCharge = -1;
|
||||||
|
esm.getHNOT(ref.mCharge, "INTV");
|
||||||
esm.getHNOT(ref.mNam9, "NAM9");
|
esm.getHNOT(ref.mNam9, "NAM9");
|
||||||
|
|
||||||
// Present for doors that teleport you to another cell.
|
// Present for doors that teleport you to another cell.
|
||||||
|
|
|
@ -52,15 +52,11 @@ public:
|
||||||
// is -1, which I assume means "any rank".
|
// is -1, which I assume means "any rank".
|
||||||
int mFactIndex;
|
int mFactIndex;
|
||||||
|
|
||||||
// Depends on context - possibly weapon health, number of uses left
|
// For weapon or armor, this is the remaining item health.
|
||||||
// or weapon magic charge?
|
// For tools (lockpicks, probes, repair hammer) it is the remaining uses.
|
||||||
float mCharge;
|
int mCharge;
|
||||||
|
|
||||||
// I have no idea, these are present some times, often along with
|
int mNam9;
|
||||||
// owner (ANAM) and sometimes otherwise. They are often (but not
|
|
||||||
// always) 1. INTV is big for lights (possibly a float?), might have
|
|
||||||
// something to do with remaining light "charge".
|
|
||||||
int mIntv, mNam9;
|
|
||||||
|
|
||||||
// For doors - true if this door teleports to somewhere else, false
|
// For doors - true if this door teleports to somewhere else, false
|
||||||
// if it should open through animation.
|
// if it should open through animation.
|
||||||
|
|
Loading…
Reference in a new issue