|
|
@ -1850,7 +1850,8 @@ void CharacterController::update(float duration)
|
|
|
|
if (isKnockedOut())
|
|
|
|
if (isKnockedOut())
|
|
|
|
mTimeUntilWake -= duration;
|
|
|
|
mTimeUntilWake -= duration;
|
|
|
|
|
|
|
|
|
|
|
|
bool godmode = mPtr == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState();
|
|
|
|
bool isPlayer = mPtr == MWMechanics::getPlayer();
|
|
|
|
|
|
|
|
bool godmode = isPlayer && MWBase::Environment::get().getWorld()->getGodModeState();
|
|
|
|
|
|
|
|
|
|
|
|
if(!cls.isActor())
|
|
|
|
if(!cls.isActor())
|
|
|
|
updateAnimQueue();
|
|
|
|
updateAnimQueue();
|
|
|
@ -1915,7 +1916,7 @@ void CharacterController::update(float duration)
|
|
|
|
isrunning = isrunning && mHasMovedInXY;
|
|
|
|
isrunning = isrunning && mHasMovedInXY;
|
|
|
|
|
|
|
|
|
|
|
|
// advance athletics
|
|
|
|
// advance athletics
|
|
|
|
if(mHasMovedInXY && mPtr == getPlayer())
|
|
|
|
if(mHasMovedInXY && isPlayer)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(inwater)
|
|
|
|
if(inwater)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -2011,8 +2012,12 @@ void CharacterController::update(float duration)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// advance acrobatics
|
|
|
|
// advance acrobatics
|
|
|
|
if (mPtr == getPlayer())
|
|
|
|
// also set jumping flag to allow GetPCJumping works
|
|
|
|
|
|
|
|
if (isPlayer)
|
|
|
|
|
|
|
|
{
|
|
|
|
cls.skillUsageSucceeded(mPtr, ESM::Skill::Acrobatics, 0);
|
|
|
|
cls.skillUsageSucceeded(mPtr, ESM::Skill::Acrobatics, 0);
|
|
|
|
|
|
|
|
MWBase::Environment::get().getWorld()->getPlayer().setJumping(true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// decrease fatigue
|
|
|
|
// decrease fatigue
|
|
|
|
const float fatigueJumpBase = gmst.find("fFatigueJumpBase")->mValue.getFloat();
|
|
|
|
const float fatigueJumpBase = gmst.find("fFatigueJumpBase")->mValue.getFloat();
|
|
|
@ -2035,7 +2040,7 @@ void CharacterController::update(float duration)
|
|
|
|
jumpstate = JumpState_Landing;
|
|
|
|
jumpstate = JumpState_Landing;
|
|
|
|
vec.z() = 0.0f;
|
|
|
|
vec.z() = 0.0f;
|
|
|
|
|
|
|
|
|
|
|
|
float height = cls.getCreatureStats(mPtr).land();
|
|
|
|
float height = cls.getCreatureStats(mPtr).land(isPlayer);
|
|
|
|
float healthLost = getFallDamage(mPtr, height);
|
|
|
|
float healthLost = getFallDamage(mPtr, height);
|
|
|
|
|
|
|
|
|
|
|
|
if (healthLost > 0.0f)
|
|
|
|
if (healthLost > 0.0f)
|
|
|
@ -2058,7 +2063,7 @@ void CharacterController::update(float duration)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// report acrobatics progression
|
|
|
|
// report acrobatics progression
|
|
|
|
if (mPtr == getPlayer())
|
|
|
|
if (isPlayer)
|
|
|
|
cls.skillUsageSucceeded(mPtr, ESM::Skill::Acrobatics, 1);
|
|
|
|
cls.skillUsageSucceeded(mPtr, ESM::Skill::Acrobatics, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2080,7 +2085,7 @@ void CharacterController::update(float duration)
|
|
|
|
// Do not play turning animation for player if rotation speed is very slow.
|
|
|
|
// Do not play turning animation for player if rotation speed is very slow.
|
|
|
|
// Actual threshold should take framerate in account.
|
|
|
|
// Actual threshold should take framerate in account.
|
|
|
|
float rotationThreshold = 0;
|
|
|
|
float rotationThreshold = 0;
|
|
|
|
if (mPtr == getPlayer())
|
|
|
|
if (isPlayer)
|
|
|
|
rotationThreshold = 0.015 * 60 * duration;
|
|
|
|
rotationThreshold = 0.015 * 60 * duration;
|
|
|
|
|
|
|
|
|
|
|
|
if(std::abs(vec.x()/2.0f) > std::abs(vec.y()))
|
|
|
|
if(std::abs(vec.x()/2.0f) > std::abs(vec.y()))
|
|
|
@ -2109,7 +2114,7 @@ void CharacterController::update(float duration)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// It seems only bipedal actors use turning animations.
|
|
|
|
// It seems only bipedal actors use turning animations.
|
|
|
|
// Also do not use turning animations in the first-person view and when sneaking.
|
|
|
|
// Also do not use turning animations in the first-person view and when sneaking.
|
|
|
|
bool isFirstPlayer = mPtr == getPlayer() && MWBase::Environment::get().getWorld()->isFirstPerson();
|
|
|
|
bool isFirstPlayer = isPlayer && MWBase::Environment::get().getWorld()->isFirstPerson();
|
|
|
|
if (!sneak && !isFirstPlayer && mPtr.getClass().isBipedal(mPtr))
|
|
|
|
if (!sneak && !isFirstPlayer && mPtr.getClass().isBipedal(mPtr))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(rot.z() > rotationThreshold)
|
|
|
|
if(rot.z() > rotationThreshold)
|
|
|
@ -2121,7 +2126,7 @@ void CharacterController::update(float duration)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Player can not use smooth turning as NPCs, so we play turning animation a bit to avoid jittering
|
|
|
|
// Player can not use smooth turning as NPCs, so we play turning animation a bit to avoid jittering
|
|
|
|
if (mPtr == getPlayer())
|
|
|
|
if (isPlayer)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
float threshold = mCurrentMovement.find("swim") == std::string::npos ? 0.4f : 0.8f;
|
|
|
|
float threshold = mCurrentMovement.find("swim") == std::string::npos ? 0.4f : 0.8f;
|
|
|
|
float complete;
|
|
|
|
float complete;
|
|
|
|