Merged pull request #1843

remotes/1728160796594174844/tmp_0.7.0-alpha
Marc Zinnschlag 7 years ago
commit 4d280add81

@ -1221,11 +1221,11 @@ bool CharacterController::updateWeaponState()
bool isStillWeapon = weaptype > WeapType_HandToHand && weaptype < WeapType_Spell && bool isStillWeapon = weaptype > WeapType_HandToHand && weaptype < WeapType_Spell &&
mWeaponType > WeapType_HandToHand && mWeaponType < WeapType_Spell; mWeaponType > WeapType_HandToHand && mWeaponType < WeapType_Spell;
if(weaptype != mWeaponType && !isKnockedOut() && if(!isKnockedOut() && !isKnockedDown() && !isRecovery())
!isKnockedDown() && !isRecovery())
{ {
std::string weapgroup; std::string weapgroup;
if ((!isWerewolf || mWeaponType != WeapType_Spell) if ((!isWerewolf || mWeaponType != WeapType_Spell)
&& weaptype != mWeaponType
&& mUpperBodyState != UpperCharState_UnEquipingWeap && mUpperBodyState != UpperCharState_UnEquipingWeap
&& !isStillWeapon) && !isStillWeapon)
{ {
@ -1250,7 +1250,12 @@ bool CharacterController::updateWeaponState()
float complete; float complete;
bool animPlaying = mAnimation->getInfo(mCurrentWeapon, &complete); bool animPlaying = mAnimation->getInfo(mCurrentWeapon, &complete);
if (!animPlaying || complete >= 1.0f) if (!animPlaying || complete >= 1.0f)
{
// Weapon is changed, no current animation (e.g. unequipping or attack).
// Start equipping animation now.
if (weaptype != mWeaponType)
{ {
forcestateupdate = true; forcestateupdate = true;
mAnimation->showCarriedLeft(updateCarriedLeftVisible(weaptype)); mAnimation->showCarriedLeft(updateCarriedLeftVisible(weaptype));
@ -1260,12 +1265,8 @@ bool CharacterController::updateWeaponState()
if (!isStillWeapon) if (!isStillWeapon)
{ {
if (weaptype == WeapType_None)
{
// Disable current weapon animation manually
mAnimation->disable(mCurrentWeapon); mAnimation->disable(mCurrentWeapon);
} if (weaptype != WeapType_None)
else
{ {
mAnimation->showWeapons(false); mAnimation->showWeapons(false);
mAnimation->play(weapgroup, priorityWeapon, mAnimation->play(weapgroup, priorityWeapon,
@ -1295,6 +1296,16 @@ bool CharacterController::updateWeaponState()
sndMgr->playSound3D(mPtr, upSoundId, 1.0f, 1.0f); sndMgr->playSound3D(mPtr, upSoundId, 1.0f, 1.0f);
} }
} }
// Make sure that we disabled unequipping animation
if (mUpperBodyState == UpperCharState_UnEquipingWeap)
{
mUpperBodyState = UpperCharState_Nothing;
mAnimation->disable(mCurrentWeapon);
mWeaponType = WeapType_None;
getWeaponGroup(mWeaponType, mCurrentWeapon);
}
}
} }
if(isWerewolf) if(isWerewolf)

@ -315,14 +315,14 @@ namespace MWMechanics
return true; return true;
} }
CastSpell::CastSpell(const MWWorld::Ptr &caster, const MWWorld::Ptr &target, const bool fromProjectile, const bool isScripted) CastSpell::CastSpell(const MWWorld::Ptr &caster, const MWWorld::Ptr &target, const bool fromProjectile, const bool manualSpell)
: mCaster(caster) : mCaster(caster)
, mTarget(target) , mTarget(target)
, mStack(false) , mStack(false)
, mHitPosition(0,0,0) , mHitPosition(0,0,0)
, mAlwaysSucceed(false) , mAlwaysSucceed(false)
, mFromProjectile(fromProjectile) , mFromProjectile(fromProjectile)
, mIsScripted(isScripted) , mManualSpell(manualSpell)
{ {
} }
@ -864,7 +864,7 @@ namespace MWMechanics
bool godmode = mCaster == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState(); bool godmode = mCaster == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState();
if (mCaster.getClass().isActor() && !mAlwaysSucceed && !mIsScripted) if (mCaster.getClass().isActor() && !mAlwaysSucceed && !mManualSpell)
{ {
school = getSpellSchool(spell, mCaster); school = getSpellSchool(spell, mCaster);
@ -1037,7 +1037,7 @@ namespace MWMechanics
bool CastSpell::spellIncreasesSkill() bool CastSpell::spellIncreasesSkill()
{ {
if (mIsScripted) if (mManualSpell)
return false; return false;
return MWMechanics::spellIncreasesSkill(mId); return MWMechanics::spellIncreasesSkill(mId);

@ -88,10 +88,10 @@ namespace MWMechanics
osg::Vec3f mHitPosition; // Used for spawning area orb osg::Vec3f mHitPosition; // Used for spawning area orb
bool mAlwaysSucceed; // Always succeed spells casted by NPCs/creatures regardless of their chance (default: false) bool mAlwaysSucceed; // Always succeed spells casted by NPCs/creatures regardless of their chance (default: false)
bool mFromProjectile; // True if spell is cast by enchantment of some projectile (arrow, bolt or thrown weapon) bool mFromProjectile; // True if spell is cast by enchantment of some projectile (arrow, bolt or thrown weapon)
bool mIsScripted; // True if spell is casted from script and ignores some checks (mana level, success chance, etc.) bool mManualSpell; // True if spell is casted from script and ignores some checks (mana level, success chance, etc.)
public: public:
CastSpell(const MWWorld::Ptr& caster, const MWWorld::Ptr& target, const bool fromProjectile=false, const bool isScripted=false); CastSpell(const MWWorld::Ptr& caster, const MWWorld::Ptr& target, const bool fromProjectile=false, const bool manualSpell=false);
bool cast (const ESM::Spell* spell); bool cast (const ESM::Spell* spell);

Loading…
Cancel
Save