1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-20 05:53:50 +00:00

Merge pull request #63 from OpenMW/master

Add OpenMW commits up to 23 Sep
This commit is contained in:
David Cernat 2016-09-24 00:53:06 +03:00 committed by GitHub
commit 10d391a1fd
3 changed files with 36 additions and 10 deletions

View file

@ -17,7 +17,7 @@ Programmers
aegis aegis
Aleksandar Jovanov Aleksandar Jovanov
Alex Haddad (rainChu) Alex Haddad (rainChu)
Alex McKibben (WeirdSexy) Alex McKibben
alexanderkjall alexanderkjall
Alexander Nadeau (wareya) Alexander Nadeau (wareya)
Alexander Olofsson (Ace) Alexander Olofsson (Ace)
@ -159,7 +159,6 @@ Packagers
Public Relations and Translations Public Relations and Translations
--------------------------------- ---------------------------------
Alex McKibben (WeirdSexy) - Podcaster
Artem Kotsynyak (greye) - Russian News Writer Artem Kotsynyak (greye) - Russian News Writer
Jim Clauwaert (Zedd) - Public Outreach Jim Clauwaert (Zedd) - Public Outreach
Julien Voisin (jvoisin/ap0) - French News Writer Julien Voisin (jvoisin/ap0) - French News Writer

View file

@ -1030,12 +1030,7 @@ namespace MWWorld
facedObject = getFacedObject(getMaxActivationDistance() * 50, false); facedObject = getFacedObject(getMaxActivationDistance() * 50, false);
else else
{ {
float telekinesisRangeBonus = float activationDistance = getActivationDistancePlusTelekinesis();
mPlayer->getPlayer().getClass().getCreatureStats(mPlayer->getPlayer()).getMagicEffects()
.get(ESM::MagicEffect::Telekinesis).getMagnitude();
telekinesisRangeBonus = feetToGameUnits(telekinesisRangeBonus);
float activationDistance = getMaxActivationDistance() + telekinesisRangeBonus;
facedObject = getFacedObject(activationDistance, true); facedObject = getFacedObject(activationDistance, true);
@ -2663,7 +2658,8 @@ namespace MWWorld
// Get the target to use for "on touch" effects, using the facing direction from Head node // Get the target to use for "on touch" effects, using the facing direction from Head node
MWWorld::Ptr target; MWWorld::Ptr target;
float distance = 192.f; // ?? float distance = getActivationDistancePlusTelekinesis();
osg::Vec3f hitPosition = actor.getRefData().getPosition().asVec3(); osg::Vec3f hitPosition = actor.getRefData().getPosition().asVec3();
osg::Vec3f origin = getActorHeadTransform(actor).getTrans(); osg::Vec3f origin = getActorHeadTransform(actor).getTrans();
@ -2694,11 +2690,25 @@ namespace MWWorld
{ {
target = result1.mHitObject; target = result1.mHitObject;
hitPosition = result1.mHitPos; hitPosition = result1.mHitPos;
if (dist1 > getMaxActivationDistance() && !target.isEmpty() && (target.getClass().isActor() || !target.getClass().canBeActivated(target)))
target = NULL;
} }
else if (result2.mHit) else if (result2.mHit)
{ {
target = result2.mHitObject; target = result2.mHitObject;
hitPosition = result2.mHitPointWorld; hitPosition = result2.mHitPointWorld;
if (dist2 > getMaxActivationDistance() && !target.isEmpty() && (target.getClass().isActor() || !target.getClass().canBeActivated(target)))
target = NULL;
}
// When targeting an actor that is in combat with an "on touch" spell,
// compare against the minimum of activation distance and combat distance.
if (!target.isEmpty() && target.getClass().isActor() && target.getClass().getCreatureStats (target).getAiSequence().isInCombat())
{
distance = std::min (distance, getStore().get<ESM::GameSetting>().find("fCombatDistance")->getFloat());
if (distance < dist1 && distance < dist2)
target = NULL;
} }
std::string selectedSpell = stats.getSpells().getSelectedSpell(); std::string selectedSpell = stats.getSpells().getSelectedSpell();
@ -3021,6 +3031,18 @@ namespace MWWorld
return feet * 22; return feet * 22;
} }
float World::getActivationDistancePlusTelekinesis()
{
float telekinesisRangeBonus =
mPlayer->getPlayer().getClass().getCreatureStats(mPlayer->getPlayer()).getMagicEffects()
.get(ESM::MagicEffect::Telekinesis).getMagnitude();
telekinesisRangeBonus = feetToGameUnits(telekinesisRangeBonus);
float activationDistance = getMaxActivationDistance() + telekinesisRangeBonus;
return activationDistance;
}
MWWorld::Ptr World::getPlayerPtr() MWWorld::Ptr World::getPlayerPtr()
{ {
return mPlayer->getPlayer(); return mPlayer->getPlayer();
@ -3186,6 +3208,9 @@ namespace MWWorld
if (effectIt->mRange != rangeType || (effectIt->mArea <= 0 && !ignore.isEmpty() && ignore.getClass().isActor())) if (effectIt->mRange != rangeType || (effectIt->mArea <= 0 && !ignore.isEmpty() && ignore.getClass().isActor()))
continue; // Not right range type, or not area effect and hit an actor continue; // Not right range type, or not area effect and hit an actor
if (effectIt->mRange == ESM::RT_Touch && (!ignore.isEmpty()) && (!ignore.getClass().isActor() && !ignore.getClass().canBeActivated(ignore)))
continue; // Don't play explosion for touch spells on non-activatable objects
// Spawn the explosion orb effect // Spawn the explosion orb effect
const ESM::Static* areaStatic; const ESM::Static* areaStatic;
if (!effect->mArea.empty()) if (!effect->mArea.empty())
@ -3197,6 +3222,7 @@ namespace MWWorld
if (effectIt->mArea <= 0) if (effectIt->mArea <= 0)
{ {
if (effectIt->mRange == ESM::RT_Target)
mRendering->spawnEffect("meshes\\" + areaStatic->mModel, texture, origin, 1.0f); mRendering->spawnEffect("meshes\\" + areaStatic->mModel, texture, origin, 1.0f);
continue; continue;
} }

View file

@ -168,6 +168,7 @@ namespace MWWorld
int mDaysInPrison; int mDaysInPrison;
float feetToGameUnits(float feet); float feetToGameUnits(float feet);
float getActivationDistancePlusTelekinesis();
MWWorld::ConstPtr getClosestMarker( const MWWorld::Ptr &ptr, const std::string &id ); MWWorld::ConstPtr getClosestMarker( const MWWorld::Ptr &ptr, const std::string &id );
MWWorld::ConstPtr getClosestMarkerFromExteriorPosition( const osg::Vec3f& worldPos, const std::string &id ); MWWorld::ConstPtr getClosestMarkerFromExteriorPosition( const osg::Vec3f& worldPos, const std::string &id );