Merge pull request #74 from OpenMW/master

Add OpenMW commits up to 5 Oct
pull/76/head
David Cernat 8 years ago committed by GitHub
commit 6eae017561

@ -824,8 +824,8 @@ void MwIniImporter::importArchives(multistrmap &cfg, const multistrmap &ini) con
// does not appears in the ini file
cfg["fallback-archive"].push_back("Morrowind.bsa");
for(std::vector<std::string>::const_iterator it=archives.begin(); it!=archives.end(); ++it) {
cfg["fallback-archive"].push_back(*it);
for(std::vector<std::string>::const_iterator iter=archives.begin(); iter!=archives.end(); ++iter) {
cfg["fallback-archive"].push_back(*iter);
}
}
@ -865,8 +865,8 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, const multistrmap &ini, co
// this will sort files by time order first, then alphabetical (maybe), I suspect non ASCII filenames will be stuffed.
sort(contentFiles.begin(), contentFiles.end());
for(std::vector<std::pair<std::time_t, std::string> >::const_iterator it=contentFiles.begin(); it!=contentFiles.end(); ++it) {
cfg["content"].push_back(it->second);
for(std::vector<std::pair<std::time_t, std::string> >::const_iterator iter=contentFiles.begin(); iter!=contentFiles.end(); ++iter) {
cfg["content"].push_back(iter->second);
}
}

@ -217,7 +217,7 @@ namespace MWBase
virtual bool toggleSky() = 0;
///< \return Resulting mode
virtual void changeWeather(const std::string& region, unsigned int id) = 0;
virtual void changeWeather(const std::string& region, const unsigned int id) = 0;
virtual int getCurrentWeather() const = 0;

@ -146,9 +146,6 @@ namespace MWClass
float epsilon = 0.0005f;
if (ref->mBase->mData.mWeight == 0)
return ESM::Skill::Unarmored;
if (ref->mBase->mData.mWeight <= iWeight * gmst.find ("fLightMaxMod")->getFloat() + epsilon)
return ESM::Skill::LightArmor;
@ -220,16 +217,19 @@ namespace MWClass
std::string text;
// get armor type string (light/medium/heavy)
int armorType = getEquipmentSkill(ptr);
std::string typeText;
if (armorType == ESM::Skill::LightArmor)
typeText = "#{sLight}";
else if (armorType == ESM::Skill::MediumArmor)
typeText = "#{sMedium}";
else if (armorType == ESM::Skill::HeavyArmor)
typeText = "#{sHeavy}";
else // if (armorType == ESM::Skill::Unarmored)
if (ref->mBase->mData.mWeight == 0)
typeText = "";
else
{
int armorType = getEquipmentSkill(ptr);
if (armorType == ESM::Skill::LightArmor)
typeText = "#{sLight}";
else if (armorType == ESM::Skill::MediumArmor)
typeText = "#{sMedium}";
else
typeText = "#{sHeavy}";
}
text += "\n#{sArmorRating}: " + MWGui::ToolTips::toString(getEffectiveArmorRating(ptr,
MWMechanics::getPlayer()));

@ -1202,7 +1202,6 @@ namespace MWClass
switch(boots->getClass().getEquipmentSkill(*boots))
{
case ESM::Skill::Unarmored:
case ESM::Skill::LightArmor:
return (name == "left") ? "FootLightLeft" : "FootLightRight";
case ESM::Skill::MediumArmor:

@ -157,7 +157,7 @@ struct TypesetBookImpl : TypesetBook
StyleImpl * hitTestWithMargin (int left, int top)
{
StyleImpl * hit = hitTest(left, top);
if (hit && hit->mInteractiveId > 0)
if (hit && hit->mInteractiveId != 0)
return hit;
const int maxMargin = 10;
@ -174,7 +174,7 @@ struct TypesetBookImpl : TypesetBook
else
hit = hitTest(left+margin, top);
if (hit && hit->mInteractiveId > 0)
if (hit && hit->mInteractiveId != 0)
return hit;
}
}

@ -193,9 +193,8 @@ namespace MWGui
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
std::vector<std::pair<std::string, std::string> > items; // class id, class name
MWWorld::Store<ESM::Class>::iterator it = store.get<ESM::Class>().begin();
for (; it != store.get<ESM::Class>().end(); ++it)
std::vector<std::pair<std::string, std::string> > items; // class id, class name
for (MWWorld::Store<ESM::Class>::iterator it = store.get<ESM::Class>().begin(); it != store.get<ESM::Class>().end(); ++it)
{
bool playable = (it->mData.mIsPlayable != 0);
if (!playable) // Only display playable classes

@ -494,8 +494,8 @@ namespace MWGui
if (!mFactions.empty())
{
MWWorld::Ptr player = MWMechanics::getPlayer();
const MWMechanics::NpcStats &PCstats = player.getClass().getNpcStats(player);
MWWorld::Ptr playerPtr = MWMechanics::getPlayer();
const MWMechanics::NpcStats &PCstats = playerPtr.getClass().getNpcStats(playerPtr);
const std::set<std::string> &expelled = PCstats.getExpelled();
bool firstFaction=true;

@ -735,9 +735,7 @@ namespace MWGui
std::vector<std::string> abilities, powers, spells;
std::vector<std::string>::const_iterator it = sign->mPowers.mList.begin();
std::vector<std::string>::const_iterator end = sign->mPowers.mList.end();
for (; it != end; ++it)
for (std::vector<std::string>::const_iterator it = sign->mPowers.mList.begin(); it != sign->mPowers.mList.end(); ++it)
{
const std::string &spellId = *it;
const ESM::Spell *spell = store.get<ESM::Spell>().search(spellId);

@ -1546,7 +1546,7 @@ namespace MWMechanics
for(std::vector<MWWorld::Ptr>::const_iterator iter(neighbors.begin());iter != neighbors.end();++iter)
{
const CreatureStats &stats = iter->getClass().getCreatureStats(*iter);
if (stats.isDead() || *iter == actor)
if (stats.isDead() || *iter == actor || iter->getClass().isPureWaterCreature(*iter))
continue;
const bool isFollower = std::find(followers.begin(), followers.end(), *iter) != followers.end();
if (stats.getAiSequence().isInCombat(actor) || (MWBase::Environment::get().getMechanicsManager()->isAggressive(*iter, actor) && !isFollower))

@ -229,6 +229,9 @@ namespace MWMechanics
osg::Vec3f vAimDir = MWBase::Environment::get().getWorld()->aimToTarget(actor, target);
float distToTarget = MWBase::Environment::get().getWorld()->getHitDistance(actor, target);
if (!currentAction)
return;
storage.mReadyToAttack = (currentAction->isAttackingOrSpell() && distToTarget <= rangeAttack);
// can't fight if attacker can't go where target is. E.g. A fish can't attack person on land.

@ -47,7 +47,7 @@ AiFollow::AiFollow(const std::string &actorId, bool commanded)
}
AiFollow::AiFollow(const ESM::AiSequence::AiFollow *follow)
: mCommanded(follow->mCommanded), mRemainingDuration(follow->mRemainingDuration)
: mAlwaysFollow(follow->mAlwaysFollow), mCommanded(follow->mCommanded), mRemainingDuration(follow->mRemainingDuration)
, mX(follow->mData.mX), mY(follow->mData.mY), mZ(follow->mData.mZ)
, mActorRefId(follow->mTargetId), mActorId(-1)
, mCellId(follow->mCellId), mActive(follow->mActive), mFollowIndex(mFollowIndexCounter++)

@ -465,7 +465,7 @@ void CharacterController::refreshMovementAnims(const WeaponInfo* weap, Character
}
mAnimation->play(mCurrentMovement, Priority_Movement, movemask, false,
1.f, ((mode!=2)?"start":"loop start"), "stop", 0.0f, ~0ul);
1.f, ((mode!=2)?"start":"loop start"), "stop", 0.0f, ~0ul, true);
}
}
}
@ -694,6 +694,7 @@ CharacterController::CharacterController(const MWWorld::Ptr &ptr, MWRender::Anim
, mAnimation(anim)
, mIdleState(CharState_None)
, mMovementState(CharState_None)
, mMovementAnimSpeed(0.f)
, mAdjustMovementAnimSpeed(false)
, mHasMovedInXY(false)
, mMovementAnimationControlled(true)
@ -2301,7 +2302,7 @@ void CharacterController::updateHeadTracking(float duration)
node = anim->getNode("Bip01 Head");
if (node != NULL)
{
osg::NodePathList nodepaths = node->getParentalNodePaths();
nodepaths = node->getParentalNodePaths();
if (!nodepaths.empty())
direction = osg::computeLocalToWorld(nodepaths[0]).getTrans() - headPos;
}

@ -83,7 +83,6 @@ void Repair::repair(const MWWorld::Ptr &itemToRepair)
// tool used up?
if (mTool.getCellRef().getCharge() == 0)
{
MWWorld::Ptr player = getPlayer();
MWWorld::ContainerStore& store = player.getClass().getContainerStore(player);
store.remove(mTool, 1, player);

@ -338,7 +338,6 @@ namespace MWMechanics
ESM::EffectList reflectedEffects;
std::vector<ActiveSpells::ActiveEffect> appliedLastingEffects;
bool anyHarmfulEffect = false;
// HACK: cache target's magic effects here, and add any applied effects to it. Use the cached effects for determining resistance.
// This is required for Weakness effects in a spell to apply to any subsequent effects in the spell.
@ -414,17 +413,15 @@ namespace MWMechanics
float magnitudeMult = 1;
if (magicEffect->mData.mFlags & ESM::MagicEffect::Harmful && target.getClass().isActor())
{
anyHarmfulEffect = true;
// Notify the target actor they've been hit
if (target != caster && !caster.isEmpty())
target.getClass().onHit(target, 0.0f, true, MWWorld::Ptr(), caster, osg::Vec3f(), true);
if (absorbed) // Absorbed, and we know there was a harmful effect (figuring that out is the only reason we are in this loop)
break;
// If player is attempting to cast a harmful spell, show the target's HP bar
if (castByPlayer && target != caster)
MWBase::Environment::get().getWindowManager()->setEnemy(target);
if (absorbed)
continue;
// Try reflecting
if (!reflected && magnitudeMult > 0 && !caster.isEmpty() && caster != target && !(magicEffect->mData.mFlags & ESM::MagicEffect::Unreflectable))
if (!reflected && !caster.isEmpty() && caster != target && !(magicEffect->mData.mFlags & ESM::MagicEffect::Unreflectable))
{
float reflect = target.getClass().getCreatureStats(target).getMagicEffects().get(ESM::MagicEffect::Reflect).getMagnitude();
bool isReflected = (Misc::Rng::roll0to99() < reflect);
@ -434,23 +431,24 @@ namespace MWMechanics
MWBase::Environment::get().getWorld()->getAnimation(target)->addEffect(
"meshes\\" + reflectStatic->mModel, ESM::MagicEffect::Reflect, false, "");
reflectedEffects.mList.push_back(*effectIt);
magnitudeMult = 0;
continue;
}
}
// Try resisting
if (magnitudeMult > 0 && target.getClass().isActor())
magnitudeMult = MWMechanics::getEffectMultiplier(effectIt->mEffectID, target, caster, spell, &targetEffects);
if (magnitudeMult == 0)
{
magnitudeMult = MWMechanics::getEffectMultiplier(effectIt->mEffectID, target, caster, spell, &targetEffects);
if (magnitudeMult == 0)
{
// Fully resisted, show message
if (target == getPlayer())
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicPCResisted}");
else if (castByPlayer)
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicTargetResisted}");
}
// Fully resisted, show message
if (target == getPlayer())
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicPCResisted}");
else if (castByPlayer)
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicTargetResisted}");
}
// If player is attempting to cast a harmful spell, show the target's HP bar
if (castByPlayer && target != caster)
MWBase::Environment::get().getWindowManager()->setEnemy(target);
}
if (magnitudeMult > 0 && !absorbed)
@ -569,10 +567,6 @@ namespace MWMechanics
target.getClass().getCreatureStats(target).getActiveSpells().addSpell(mId, mStack, appliedLastingEffects,
mSourceName, casterActorId);
}
// Notify the target actor they've been hit
if (anyHarmfulEffect && target.getClass().isActor() && target != caster && !caster.isEmpty() && caster.getClass().isActor())
target.getClass().onHit(target, 0.0f, true, MWWorld::Ptr(), caster, osg::Vec3f(), true);
}
bool CastSpell::applyInstantEffect(const MWWorld::Ptr &target, const MWWorld::Ptr &caster, const MWMechanics::EffectKey& effect, float magnitude)

@ -511,11 +511,13 @@ void Water::createSimpleWaterStateSet(osg::Node* node, float alpha)
// use a shader to render the simple water, ensuring that fog is applied per pixel as required.
// this could be removed if a more detailed water mesh, using some sort of paging solution, is implemented.
#if !defined(OPENGL_ES) && !defined(ANDROID)
Resource::SceneManager* sceneManager = mResourceSystem->getSceneManager();
bool oldValue = sceneManager->getForceShaders();
sceneManager->setForceShaders(true);
sceneManager->recreateShaders(node);
sceneManager->setForceShaders(oldValue);
#endif
}
void Water::createShaderWaterStateSet(osg::Node* node, Reflection* reflection, Refraction* refraction)

@ -2498,9 +2498,9 @@ namespace MWWorld
}
if (0 != source) {
// Find door leading to our current teleport door
// and use it destination to position inside cell.
const DoorList &doors = source->getReadOnlyDoors().mList;
for (DoorList::const_iterator jt = doors.begin(); jt != doors.end(); ++jt) {
// and use its destination to position inside cell.
const DoorList &destinationDoors = source->getReadOnlyDoors().mList;
for (DoorList::const_iterator jt = destinationDoors.begin(); jt != destinationDoors.end(); ++jt) {
if (it->mRef.getTeleport() &&
Misc::StringUtils::ciEqual(name, jt->mRef.getDestCell()))
{
@ -3268,9 +3268,9 @@ namespace MWWorld
cast.mId = id;
cast.mSourceName = sourceName;
cast.mStack = false;
ESM::EffectList effects;
effects.mList = apply->second;
cast.inflict(apply->first, caster, effects, rangeType, false, true);
ESM::EffectList effectsToApply;
effectsToApply.mList = apply->second;
cast.inflict(apply->first, caster, effectsToApply, rangeType, false, true);
}
}

@ -316,7 +316,7 @@ namespace MWWorld
virtual bool toggleSky();
///< \return Resulting mode
virtual void changeWeather (const std::string& region, unsigned int id);
virtual void changeWeather (const std::string& region, const unsigned int id);
virtual int getCurrentWeather() const;

@ -777,16 +777,16 @@ namespace NifOsg
if (ctrl->recType == Nif::RC_NiAlphaController)
{
const Nif::NiAlphaController* alphactrl = static_cast<const Nif::NiAlphaController*>(ctrl.getPtr());
osg::ref_ptr<AlphaController> ctrl(new AlphaController(alphactrl->data.getPtr()));
setupController(alphactrl, ctrl, animflags);
composite->addController(ctrl);
osg::ref_ptr<AlphaController> osgctrl(new AlphaController(alphactrl->data.getPtr()));
setupController(alphactrl, osgctrl, animflags);
composite->addController(osgctrl);
}
else if (ctrl->recType == Nif::RC_NiMaterialColorController)
{
const Nif::NiMaterialColorController* matctrl = static_cast<const Nif::NiMaterialColorController*>(ctrl.getPtr());
osg::ref_ptr<MaterialColorController> ctrl(new MaterialColorController(matctrl->data.getPtr()));
setupController(matctrl, ctrl, animflags);
composite->addController(ctrl);
osg::ref_ptr<MaterialColorController> osgctrl(new MaterialColorController(matctrl->data.getPtr()));
setupController(matctrl, osgctrl, animflags);
composite->addController(osgctrl);
}
else
std::cerr << "Unexpected material controller " << ctrl->recType << " in " << mFilename << std::endl;

Loading…
Cancel
Save