mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-03 16:49:54 +00:00
Merge pull request #155 from OpenMW/master
Add OpenMW commits up to 17 Feb 2017, part 2
This commit is contained in:
commit
0d75264221
8 changed files with 33 additions and 31 deletions
|
@ -231,8 +231,8 @@ namespace MWClass
|
||||||
typeText = "#{sHeavy}";
|
typeText = "#{sHeavy}";
|
||||||
}
|
}
|
||||||
|
|
||||||
text += "\n#{sArmorRating}: " + MWGui::ToolTips::toString(getEffectiveArmorRating(ptr,
|
text += "\n#{sArmorRating}: " + MWGui::ToolTips::toString(static_cast<int>(getEffectiveArmorRating(ptr,
|
||||||
MWMechanics::getPlayer()));
|
MWMechanics::getPlayer())));
|
||||||
|
|
||||||
int remainingHealth = getItemHealth(ptr);
|
int remainingHealth = getItemHealth(ptr);
|
||||||
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(remainingHealth) + "/"
|
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(remainingHealth) + "/"
|
||||||
|
@ -277,7 +277,7 @@ namespace MWClass
|
||||||
return record->mId;
|
return record->mId;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Armor::getEffectiveArmorRating(const MWWorld::ConstPtr &ptr, const MWWorld::Ptr &actor) const
|
float Armor::getEffectiveArmorRating(const MWWorld::ConstPtr &ptr, const MWWorld::Ptr &actor) const
|
||||||
{
|
{
|
||||||
const MWWorld::LiveCellRef<ESM::Armor> *ref = ptr.get<ESM::Armor>();
|
const MWWorld::LiveCellRef<ESM::Armor> *ref = ptr.get<ESM::Armor>();
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ namespace MWClass
|
||||||
if(ref->mBase->mData.mWeight == 0)
|
if(ref->mBase->mData.mWeight == 0)
|
||||||
return ref->mBase->mData.mArmor;
|
return ref->mBase->mData.mArmor;
|
||||||
else
|
else
|
||||||
return ref->mBase->mData.mArmor * armorSkill / iBaseArmorSkill;
|
return ref->mBase->mData.mArmor * armorSkill / static_cast<float>(iBaseArmorSkill);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<int, std::string> Armor::canBeEquipped(const MWWorld::ConstPtr &ptr, const MWWorld::Ptr &npc) const
|
std::pair<int, std::string> Armor::canBeEquipped(const MWWorld::ConstPtr &ptr, const MWWorld::Ptr &npc) const
|
||||||
|
|
|
@ -84,7 +84,7 @@ namespace MWClass
|
||||||
virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
|
virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
|
||||||
|
|
||||||
/// Get the effective armor rating, factoring in the actor's skills, for the given armor.
|
/// Get the effective armor rating, factoring in the actor's skills, for the given armor.
|
||||||
virtual int getEffectiveArmorRating(const MWWorld::ConstPtr& armor, const MWWorld::Ptr& actor) const;
|
virtual float getEffectiveArmorRating(const MWWorld::ConstPtr& armor, const MWWorld::Ptr& actor) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1133,14 +1133,14 @@ namespace MWClass
|
||||||
float fUnarmoredBase2 = store.find("fUnarmoredBase2")->getFloat();
|
float fUnarmoredBase2 = store.find("fUnarmoredBase2")->getFloat();
|
||||||
int unarmoredSkill = stats.getSkill(ESM::Skill::Unarmored).getModified();
|
int unarmoredSkill = stats.getSkill(ESM::Skill::Unarmored).getModified();
|
||||||
|
|
||||||
int ratings[MWWorld::InventoryStore::Slots];
|
float ratings[MWWorld::InventoryStore::Slots];
|
||||||
for(int i = 0;i < MWWorld::InventoryStore::Slots;i++)
|
for(int i = 0;i < MWWorld::InventoryStore::Slots;i++)
|
||||||
{
|
{
|
||||||
MWWorld::ContainerStoreIterator it = invStore.getSlot(i);
|
MWWorld::ContainerStoreIterator it = invStore.getSlot(i);
|
||||||
if (it == invStore.end() || it->getTypeName() != typeid(ESM::Armor).name())
|
if (it == invStore.end() || it->getTypeName() != typeid(ESM::Armor).name())
|
||||||
{
|
{
|
||||||
// unarmored
|
// unarmored
|
||||||
ratings[i] = static_cast<int>((fUnarmoredBase1 * unarmoredSkill) * (fUnarmoredBase2 * unarmoredSkill));
|
ratings[i] = (fUnarmoredBase1 * unarmoredSkill) * (fUnarmoredBase2 * unarmoredSkill);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,8 +45,8 @@ namespace MWMechanics
|
||||||
, mCellY(std::numeric_limits<int>::max())
|
, mCellY(std::numeric_limits<int>::max())
|
||||||
{
|
{
|
||||||
// mDuration isn't saved in the save file, so just giving it "1" for now if the package has a duration.
|
// mDuration isn't saved in the save file, so just giving it "1" for now if the package has a duration.
|
||||||
// The exact value of mDuration only matters for repeating packages
|
// The exact value of mDuration only matters for repeating packages.
|
||||||
if (mRemainingDuration != 0)
|
if (mRemainingDuration > 0) // Previously mRemainingDuration could be negative even when mDuration was 0. Checking for > 0 should fix old saves.
|
||||||
mDuration = 1;
|
mDuration = 1;
|
||||||
else
|
else
|
||||||
mDuration = 0;
|
mDuration = 0;
|
||||||
|
@ -62,7 +62,7 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
// If AiEscort has ran for as long or longer then the duration specified
|
// If AiEscort has ran for as long or longer then the duration specified
|
||||||
// and the duration is not infinite, the package is complete.
|
// and the duration is not infinite, the package is complete.
|
||||||
if(mDuration > 0)
|
if (mDuration > 0)
|
||||||
{
|
{
|
||||||
mRemainingDuration -= ((duration*MWBase::Environment::get().getWorld()->getTimeScaleFactor()) / 3600);
|
mRemainingDuration -= ((duration*MWBase::Environment::get().getWorld()->getTimeScaleFactor()) / 3600);
|
||||||
if (mRemainingDuration <= 0)
|
if (mRemainingDuration <= 0)
|
||||||
|
@ -90,13 +90,13 @@ namespace MWMechanics
|
||||||
(differenceBetween[0] * differenceBetween[0]) + (differenceBetween[1] * differenceBetween[1]) + (differenceBetween[2] *
|
(differenceBetween[0] * differenceBetween[0]) + (differenceBetween[1] * differenceBetween[1]) + (differenceBetween[2] *
|
||||||
differenceBetween[2]);
|
differenceBetween[2]);
|
||||||
|
|
||||||
if(distanceBetweenResult <= mMaxDist * mMaxDist)
|
if (distanceBetweenResult <= mMaxDist * mMaxDist)
|
||||||
{
|
{
|
||||||
ESM::Pathgrid::Point point(static_cast<int>(mX), static_cast<int>(mY), static_cast<int>(mZ));
|
ESM::Pathgrid::Point point(static_cast<int>(mX), static_cast<int>(mY), static_cast<int>(mZ));
|
||||||
point.mAutogenerated = 0;
|
point.mAutogenerated = 0;
|
||||||
point.mConnectionNum = 0;
|
point.mConnectionNum = 0;
|
||||||
point.mUnknown = 0;
|
point.mUnknown = 0;
|
||||||
if(pathTo(actor,point,duration)) //Returns true on path complete
|
if (pathTo(actor,point,duration)) //Returns true on path complete
|
||||||
{
|
{
|
||||||
mRemainingDuration = mDuration;
|
mRemainingDuration = mDuration;
|
||||||
return true;
|
return true;
|
||||||
|
@ -140,10 +140,11 @@ namespace MWMechanics
|
||||||
sequence.mPackages.push_back(package);
|
sequence.mPackages.push_back(package);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AiEscort::fastForward(const MWWorld::Ptr& actor, AiState &state)
|
void AiEscort::fastForward(const MWWorld::Ptr& actor, AiState &state)
|
||||||
{
|
{
|
||||||
// Update duration counter
|
// Update duration counter if this package has a duration
|
||||||
mRemainingDuration--;
|
if (mDuration > 0)
|
||||||
}
|
mRemainingDuration--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,9 +52,9 @@ AiFollow::AiFollow(const ESM::AiSequence::AiFollow *follow)
|
||||||
, mActorRefId(follow->mTargetId), mActorId(-1)
|
, mActorRefId(follow->mTargetId), mActorId(-1)
|
||||||
, mCellId(follow->mCellId), mActive(follow->mActive), mFollowIndex(mFollowIndexCounter++)
|
, mCellId(follow->mCellId), mActive(follow->mActive), mFollowIndex(mFollowIndexCounter++)
|
||||||
{
|
{
|
||||||
// mDuration isn't saved in the save file, so just giving it "1" for now if the package has a duration.
|
// mDuration isn't saved in the save file, so just giving it "1" for now if the package had a duration.
|
||||||
// The exact value of mDuration only matters for repeating packages
|
// The exact value of mDuration only matters for repeating packages.
|
||||||
if (mRemainingDuration != 0)
|
if (mRemainingDuration > 0) // Previously mRemainingDuration could be negative even when mDuration was 0. Checking for > 0 should fix old saves.
|
||||||
mDuration = 1;
|
mDuration = 1;
|
||||||
else
|
else
|
||||||
mDuration = 0;
|
mDuration = 0;
|
||||||
|
@ -104,10 +104,10 @@ bool AiFollow::execute (const MWWorld::Ptr& actor, CharacterController& characte
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!mAlwaysFollow) //Update if you only follow for a bit
|
if (!mAlwaysFollow) //Update if you only follow for a bit
|
||||||
{
|
{
|
||||||
//Check if we've run out of time
|
//Check if we've run out of time
|
||||||
if (mDuration != 0)
|
if (mDuration > 0)
|
||||||
{
|
{
|
||||||
mRemainingDuration -= ((duration*MWBase::Environment::get().getWorld()->getTimeScaleFactor()) / 3600);
|
mRemainingDuration -= ((duration*MWBase::Environment::get().getWorld()->getTimeScaleFactor()) / 3600);
|
||||||
if (mRemainingDuration <= 0)
|
if (mRemainingDuration <= 0)
|
||||||
|
@ -117,18 +117,18 @@ bool AiFollow::execute (const MWWorld::Ptr& actor, CharacterController& characte
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((pos.pos[0]-mX)*(pos.pos[0]-mX) +
|
if ((pos.pos[0]-mX)*(pos.pos[0]-mX) +
|
||||||
(pos.pos[1]-mY)*(pos.pos[1]-mY) +
|
(pos.pos[1]-mY)*(pos.pos[1]-mY) +
|
||||||
(pos.pos[2]-mZ)*(pos.pos[2]-mZ) < followDistance*followDistance) //Close-ish to final position
|
(pos.pos[2]-mZ)*(pos.pos[2]-mZ) < followDistance*followDistance) //Close-ish to final position
|
||||||
{
|
{
|
||||||
if(actor.getCell()->isExterior()) //Outside?
|
if (actor.getCell()->isExterior()) //Outside?
|
||||||
{
|
{
|
||||||
if(mCellId == "") //No cell to travel to
|
if (mCellId == "") //No cell to travel to
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(mCellId == actor.getCell()->getCell()->mName) //Cell to travel to
|
if (mCellId == actor.getCell()->getCell()->mName) //Cell to travel to
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,8 +228,9 @@ int AiFollow::getFollowIndex() const
|
||||||
|
|
||||||
void AiFollow::fastForward(const MWWorld::Ptr& actor, AiState &state)
|
void AiFollow::fastForward(const MWWorld::Ptr& actor, AiState &state)
|
||||||
{
|
{
|
||||||
// Update duration counter
|
// Update duration counter if this package has a duration
|
||||||
mRemainingDuration--;
|
if (mDuration > 0)
|
||||||
|
mRemainingDuration--;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -482,7 +482,7 @@ namespace MWWorld
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Class::getEffectiveArmorRating(const ConstPtr &armor, const Ptr &actor) const
|
float Class::getEffectiveArmorRating(const ConstPtr &armor, const Ptr &actor) const
|
||||||
{
|
{
|
||||||
throw std::runtime_error("class does not support armor ratings");
|
throw std::runtime_error("class does not support armor ratings");
|
||||||
}
|
}
|
||||||
|
|
|
@ -353,7 +353,7 @@ namespace MWWorld
|
||||||
virtual int getPrimaryFactionRank (const MWWorld::ConstPtr& ptr) const;
|
virtual int getPrimaryFactionRank (const MWWorld::ConstPtr& ptr) const;
|
||||||
|
|
||||||
/// Get the effective armor rating, factoring in the actor's skills, for the given armor.
|
/// Get the effective armor rating, factoring in the actor's skills, for the given armor.
|
||||||
virtual int getEffectiveArmorRating(const MWWorld::ConstPtr& armor, const MWWorld::Ptr& actor) const;
|
virtual float getEffectiveArmorRating(const MWWorld::ConstPtr& armor, const MWWorld::Ptr& actor) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -251,7 +251,7 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& actor)
|
||||||
static float fUnarmoredBase2 = store.find("fUnarmoredBase2")->getFloat();
|
static float fUnarmoredBase2 = store.find("fUnarmoredBase2")->getFloat();
|
||||||
int unarmoredSkill = stats.getSkill(ESM::Skill::Unarmored).getModified();
|
int unarmoredSkill = stats.getSkill(ESM::Skill::Unarmored).getModified();
|
||||||
|
|
||||||
float unarmoredRating = static_cast<int>((fUnarmoredBase1 * unarmoredSkill) * (fUnarmoredBase2 * unarmoredSkill));
|
float unarmoredRating = (fUnarmoredBase1 * unarmoredSkill) * (fUnarmoredBase2 * unarmoredSkill);
|
||||||
|
|
||||||
TSlots slots_;
|
TSlots slots_;
|
||||||
initSlots (slots_);
|
initSlots (slots_);
|
||||||
|
|
Loading…
Reference in a new issue