1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-20 22:23:52 +00:00

Use fCombatDistance

This commit is contained in:
scrawl 2014-01-20 17:31:08 +01:00
parent a4404054bb
commit 1617a4f7d9
2 changed files with 7 additions and 4 deletions

View file

@ -225,8 +225,10 @@ namespace MWClass
// TODO: where is the distance defined?
float dist = 200.f;
if (!weapon.isEmpty())
dist = 100.f * weapon.get<ESM::Weapon>()->mBase->mData.mReach;
{
const float fCombatDistance = gmst.find("fCombatDistance")->getFloat();
dist = fCombatDistance * weapon.get<ESM::Weapon>()->mBase->mData.mReach;
}
std::pair<MWWorld::Ptr, Ogre::Vector3> result = MWBase::Environment::get().getWorld()->getHitContact(ptr, dist);
if (result.first.isEmpty())
return; // Didn't hit anything

View file

@ -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<ESM::Weapon>()->mBase->mData.mReach :
gmst.find("fHandToHandReach")->getFloat());
// TODO: Use second to work out the hit angle
std::pair<MWWorld::Ptr, Ogre::Vector3> result = world->getHitContact(ptr, dist);
MWWorld::Ptr victim = result.first;