From 1617a4f7d94bd53be80be3d50323b9f972c5e076 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 20 Jan 2014 17:31:08 +0100 Subject: [PATCH] Use fCombatDistance --- apps/openmw/mwclass/creature.cpp | 6 ++++-- apps/openmw/mwclass/npc.cpp | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp index b0caccc73..20b37833a 100644 --- a/apps/openmw/mwclass/creature.cpp +++ b/apps/openmw/mwclass/creature.cpp @@ -225,8 +225,10 @@ namespace MWClass // TODO: where is the distance defined? float dist = 200.f; if (!weapon.isEmpty()) - dist = 100.f * weapon.get()->mBase->mData.mReach; - + { + const float fCombatDistance = gmst.find("fCombatDistance")->getFloat(); + dist = fCombatDistance * weapon.get()->mBase->mData.mReach; + } std::pair result = MWBase::Environment::get().getWorld()->getHitContact(ptr, dist); if (result.first.isEmpty()) return; // Didn't hit anything diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index ef45fa28a..4b955373c 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -467,10 +467,11 @@ namespace MWClass fatigue.setCurrent(fatigue.getCurrent() - fatigueLoss); getCreatureStats(ptr).setFatigue(fatigue); - - float dist = 100.0f * (!weapon.isEmpty() ? + const float fCombatDistance = gmst.find("fCombatDistance")->getFloat(); + float dist = fCombatDistance * (!weapon.isEmpty() ? weapon.get()->mBase->mData.mReach : gmst.find("fHandToHandReach")->getFloat()); + // TODO: Use second to work out the hit angle std::pair result = world->getHitContact(ptr, dist); MWWorld::Ptr victim = result.first;