From c65587558492f0cdd699fea5249149228602a858 Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 20 Apr 2017 00:28:27 +0900 Subject: [PATCH 1/5] Change mWaterEnabled from float to bool --- apps/openmw/mwphysics/physicssystem.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwphysics/physicssystem.hpp b/apps/openmw/mwphysics/physicssystem.hpp index 3312f10a0..81385d675 100644 --- a/apps/openmw/mwphysics/physicssystem.hpp +++ b/apps/openmw/mwphysics/physicssystem.hpp @@ -211,7 +211,7 @@ namespace MWPhysics float mTimeAccum; float mWaterHeight; - float mWaterEnabled; + bool mWaterEnabled; std::auto_ptr mWaterCollisionObject; std::auto_ptr mWaterCollisionShape; From 5a00b239accf24367860e2217918c861ce9532de Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 20 Apr 2017 00:35:27 +0900 Subject: [PATCH 2/5] Reduce scope of variables --- apps/openmw/mwmechanics/aicombat.cpp | 6 ++++-- apps/openmw/mwrender/animation.cpp | 4 +--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwmechanics/aicombat.cpp b/apps/openmw/mwmechanics/aicombat.cpp index 17005f235..d111eb127 100644 --- a/apps/openmw/mwmechanics/aicombat.cpp +++ b/apps/openmw/mwmechanics/aicombat.cpp @@ -500,8 +500,7 @@ namespace MWMechanics { // get the range of the target's weapon float rangeAttackOfTarget = 0.f; - bool isRangedCombat = false; - MWWorld::Ptr targetWeapon = MWWorld::Ptr(); + MWWorld::Ptr targetWeapon = MWWorld::Ptr(); const MWWorld::Class& targetClass = target.getClass(); if (targetClass.hasInventoryStore(target)) @@ -516,7 +515,10 @@ namespace MWMechanics boost::shared_ptr targetWeaponAction (new ActionWeapon(targetWeapon)); if (targetWeaponAction.get()) + { + bool isRangedCombat = false; rangeAttackOfTarget = targetWeaponAction->getCombatRange(isRangedCombat); + } // apply sideway movement (kind of dodging) with some probability // if actor is within range of target's weapon diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index ba4307c89..fe20ac437 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -1058,11 +1058,9 @@ namespace MWRender float timepassed = duration * state.mSpeedMult; while(state.mPlaying) { - float targetTime; - if (!state.shouldLoop()) { - targetTime = state.getTime() + timepassed; + float targetTime = state.getTime() + timepassed; if(textkey == textkeys.end() || textkey->first > targetTime) { if(mAccumCtrl && state.mTime == mAnimationTimePtr[0]->getTimePtr()) From f299f26720004e2e7b3f8ed0ebb65d29ea60ced4 Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 20 Apr 2017 00:42:53 +0900 Subject: [PATCH 3/5] Remove unused variable --- apps/openmw/mwworld/scene.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index e27c0b585..2467af646 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -538,13 +538,9 @@ namespace MWWorld std::cout << "Changing to interior\n"; // unload - int current = 0; CellStoreCollection::iterator active = mActiveCells.begin(); while (active!=mActiveCells.end()) - { unloadCell (active++); - ++current; - } int refsToLoad = cell->count(); loadingListener->setProgressRange(refsToLoad); From 60a2625b897cc5d56ab8c7b8b98bef93166efb2e Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 20 Apr 2017 01:32:36 +0900 Subject: [PATCH 4/5] Add parentheses to clarify calculations --- apps/openmw/mwmechanics/alchemy.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwmechanics/alchemy.cpp b/apps/openmw/mwmechanics/alchemy.cpp index 783bbf573..e6e3b4c4e 100644 --- a/apps/openmw/mwmechanics/alchemy.cpp +++ b/apps/openmw/mwmechanics/alchemy.cpp @@ -171,10 +171,10 @@ void MWMechanics::Alchemy::updateEffects() if (fPotionT1DurMult<=0) throw std::runtime_error ("invalid gmst: fPotionT1DurMult"); - float magnitude = magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude ? - 1 : (x / fPotionT1MagMul) / magicEffect->mData.mBaseCost; - float duration = magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration ? - 1 : (x / fPotionT1DurMult) / magicEffect->mData.mBaseCost; + float magnitude = (magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude) ? + 1.0f : (x / fPotionT1MagMul) / magicEffect->mData.mBaseCost; + float duration = (magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration) ? + 1.0f : (x / fPotionT1DurMult) / magicEffect->mData.mBaseCost; if (!(magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude)) applyTools (magicEffect->mData.mFlags, magnitude); From e87d2aa1af635f47e4870605312a9ec693cacffd Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 20 Apr 2017 01:47:30 +0900 Subject: [PATCH 5/5] Remove unused function --- apps/openmw/mwphysics/physicssystem.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index 5e79e2a09..40805a4b1 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -230,13 +230,6 @@ namespace MWPhysics return direction - project(direction, planeNormal); } - static inline osg::Vec3f reflect(const osg::Vec3& velocity, const osg::Vec3f& normal) - { - return velocity - (normal * (normal * velocity)) * 2; - // ^ dot product - } - - public: static osg::Vec3f traceDown(const MWWorld::Ptr &ptr, const osg::Vec3f& position, Actor* actor, btCollisionWorld* collisionWorld, float maxHeight) {