1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-28 11:09:40 +00:00

Fix invisibility/chameleon alpha (thanks Hrnchamd)

This commit is contained in:
Alexei Dobrohotov 2019-06-30 16:13:11 +03:00 committed by GitHub
parent 19dc01232c
commit 9dfee1dfe2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2675,14 +2675,14 @@ void CharacterController::setVisibility(float visibility)
if (mPtr.getClass().getCreatureStats(mPtr).getMagicEffects().get(ESM::MagicEffect::Invisibility).getModifier()) // Ignore base magnitude (see bug #3555).
{
if (mPtr == getPlayer())
alpha = 0.4f;
alpha = 0.25f;
else
alpha = 0.f;
alpha = 0.05f;
}
float chameleon = mPtr.getClass().getCreatureStats(mPtr).getMagicEffects().get(ESM::MagicEffect::Chameleon).getMagnitude();
if (chameleon)
{
alpha *= std::max(0.2f, (100.f - chameleon)/100.f);
alpha *= std::min(0.75f, std::max(0.25f, (100.f - chameleon)/100.f));
}
visibility = std::min(visibility, alpha);