Use the actual sneak state to determine visibility of indicator (Fixes #2915)

sceneinput
scrawl 9 years ago
parent 4d94f38f4b
commit 84747fbdd7

@ -1094,7 +1094,7 @@ namespace MWMechanics
static float sneakTimer = 0.f; // times update of sneak icon
// if player is in sneak state see if anyone detects him
if (player.getClass().getCreatureStats(player).getMovementFlag(MWMechanics::CreatureStats::Flag_Sneak))
if (playerCharacter && playerCharacter->isSneaking())
{
static float sneakSkillTimer = 0.f; // times sneak skill progress from "avoid notice"

@ -1768,7 +1768,7 @@ void CharacterController::update(float duration)
if(mAnimQueue.empty() || inwater || sneak)
{
idlestate = (inwater ? CharState_IdleSwim : (sneak ? CharState_IdleSneak : CharState_Idle));
idlestate = (inwater ? CharState_IdleSwim : (sneak && !inJump ? CharState_IdleSneak : CharState_Idle));
}
else if(mAnimQueue.size() > 1)
{
@ -2048,6 +2048,15 @@ bool CharacterController::isKnockedOut() const
return mHitState == CharState_KnockOut;
}
bool CharacterController::isSneaking() const
{
return mIdleState == CharState_IdleSneak ||
mMovementState == CharState_SneakForward ||
mMovementState == CharState_SneakBack ||
mMovementState == CharState_SneakLeft ||
mMovementState == CharState_SneakRight;
}
void CharacterController::setAttackingOrSpell(bool attackingOrSpell)
{
mAttackingOrSpell = attackingOrSpell;

@ -241,6 +241,7 @@ public:
bool isReadyToBlock() const;
bool isKnockedOut() const;
bool isSneaking() const;
void setAttackingOrSpell(bool attackingOrSpell);

Loading…
Cancel
Save