mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-13 06:15:36 -04:00
Merge branch 'encumbrance' into 'master'
Properly detect overencumbrance for zero capacity again See merge request OpenMW/openmw!4883
This commit is contained in:
commit
b0a27fd041
@ -953,7 +953,8 @@ namespace MWClass
|
|||||||
|
|
||||||
float Npc::getJump(const MWWorld::Ptr& ptr) const
|
float Npc::getJump(const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
if (getEncumbrance(ptr) > getCapacity(ptr))
|
const float normalizedEncumbrance = getNormalizedEncumbrance(ptr);
|
||||||
|
if (normalizedEncumbrance > 1.0f)
|
||||||
return 0.f;
|
return 0.f;
|
||||||
|
|
||||||
const MWMechanics::NpcStats& stats = getNpcStats(ptr);
|
const MWMechanics::NpcStats& stats = getNpcStats(ptr);
|
||||||
@ -963,7 +964,7 @@ namespace MWClass
|
|||||||
const GMST& gmst = getGmst();
|
const GMST& gmst = getGmst();
|
||||||
const MWMechanics::MagicEffects& mageffects = stats.getMagicEffects();
|
const MWMechanics::MagicEffects& mageffects = stats.getMagicEffects();
|
||||||
const float encumbranceTerm = gmst.fJumpEncumbranceBase->mValue.getFloat()
|
const float encumbranceTerm = gmst.fJumpEncumbranceBase->mValue.getFloat()
|
||||||
+ gmst.fJumpEncumbranceMultiplier->mValue.getFloat() * (1.0f - Npc::getNormalizedEncumbrance(ptr));
|
+ gmst.fJumpEncumbranceMultiplier->mValue.getFloat() * (1.0f - normalizedEncumbrance);
|
||||||
|
|
||||||
float a = getSkill(ptr, ESM::Skill::Acrobatics);
|
float a = getSkill(ptr, ESM::Skill::Acrobatics);
|
||||||
float b = 0.0f;
|
float b = 0.0f;
|
||||||
|
@ -481,11 +481,16 @@ namespace MWWorld
|
|||||||
float capacity = getCapacity(ptr);
|
float capacity = getCapacity(ptr);
|
||||||
float encumbrance = getEncumbrance(ptr);
|
float encumbrance = getEncumbrance(ptr);
|
||||||
|
|
||||||
|
// Intentional deviation: Morrowind doesn't do this
|
||||||
|
// but handling (0 / 0) as 1.0 encumbrance feels like a clear oversight
|
||||||
if (encumbrance == 0)
|
if (encumbrance == 0)
|
||||||
return 0.f;
|
return 0.f;
|
||||||
|
|
||||||
|
// Another deviation: handle (non-zero encumbrance / zero capacity) as "overencumbered"
|
||||||
|
// Morrowind uses 1, but this means that for zero capacity,
|
||||||
|
// normalized encumbrance cannot be used to detect overencumbrance
|
||||||
if (capacity == 0)
|
if (capacity == 0)
|
||||||
return 1.f;
|
return 1.f + 1e-6f;
|
||||||
|
|
||||||
return encumbrance / capacity;
|
return encumbrance / capacity;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user