Merge pull request #141 from OpenMW/master

Add OpenMW commits up to 5 Feb 2017
coverity_scan^2
David Cernat 8 years ago committed by GitHub
commit 3a29b2d41d

@ -67,20 +67,30 @@ namespace MWGui
void ItemWidget::setIcon(const std::string &icon)
{
if (mItemShadow)
mItemShadow->setImageTexture(icon);
if (mItem)
mItem->setImageTexture(icon);
if (mCurrentIcon != icon)
{
mCurrentIcon = icon;
if (mItemShadow)
mItemShadow->setImageTexture(icon);
if (mItem)
mItem->setImageTexture(icon);
}
}
void ItemWidget::setFrame(const std::string &frame, const MyGUI::IntCoord &coord)
{
if (mFrame)
{
mFrame->setImageTexture(frame);
mFrame->setImageTile(MyGUI::IntSize(coord.width, coord.height)); // Why is this needed? MyGUI bug?
mFrame->setImageCoord(coord);
}
if (mCurrentFrame != frame)
{
mCurrentFrame = frame;
mFrame->setImageTexture(frame);
}
}
void ItemWidget::setIcon(const MWWorld::Ptr &ptr)
@ -105,6 +115,8 @@ namespace MWGui
mItemShadow->setImageTexture("");
mItem->setImageTexture("");
mText->setCaption("");
mCurrentIcon.clear();
mCurrentFrame.clear();
return;
}

@ -47,6 +47,9 @@ namespace MWGui
MyGUI::ImageBox* mItemShadow;
MyGUI::ImageBox* mFrame;
MyGUI::TextBox* mText;
std::string mCurrentIcon;
std::string mCurrentFrame;
};
}

@ -401,7 +401,6 @@ namespace MWMechanics
{
updateDrowning(ptr, duration);
calculateNpcStatModifiers(ptr, duration);
updateEquippedLight(ptr, duration);
}
void Actors::adjustMagicEffects (const MWWorld::Ptr& creature)
@ -738,11 +737,19 @@ namespace MWMechanics
}
}
UpdateSummonedCreatures updateSummonedCreatures(ptr);
creatureStats.getActiveSpells().visitEffectSources(updateSummonedCreatures);
if (ptr.getClass().hasInventoryStore(ptr))
ptr.getClass().getInventoryStore(ptr).visitEffectSources(updateSummonedCreatures);
updateSummonedCreatures.process();
bool hasSummonEffect = false;
for (MagicEffects::Collection::const_iterator it = effects.begin(); it != effects.end(); ++it)
if (it->first.mId >= ESM::MagicEffect::SummonScamp && it->first.mId <= ESM::MagicEffect::SummonStormAtronach)
hasSummonEffect = true;
if (!creatureStats.getSummonedCreatureMap().empty() || !creatureStats.getSummonedCreatureGraveyard().empty() || hasSummonEffect)
{
UpdateSummonedCreatures updateSummonedCreatures(ptr);
creatureStats.getActiveSpells().visitEffectSources(updateSummonedCreatures);
if (ptr.getClass().hasInventoryStore(ptr))
ptr.getClass().getInventoryStore(ptr).visitEffectSources(updateSummonedCreatures);
updateSummonedCreatures.process();
}
}
void Actors::calculateNpcStatModifiers (const MWWorld::Ptr& ptr, float duration)
@ -1027,10 +1034,13 @@ namespace MWMechanics
{
static float timerUpdateAITargets = 0;
static float timerUpdateHeadTrack = 0;
static float timerUpdateEquippedLight = 0;
const float updateEquippedLightInterval = 1.0f;
// target lists get updated once every 1.0 sec
if (timerUpdateAITargets >= 1.0f) timerUpdateAITargets = 0;
if (timerUpdateHeadTrack >= 0.3f) timerUpdateHeadTrack = 0;
if (timerUpdateEquippedLight >= updateEquippedLightInterval) timerUpdateEquippedLight = 0;
MWWorld::Ptr player = getPlayer();
@ -1116,7 +1126,12 @@ namespace MWMechanics
}
if(iter->first.getTypeName() == typeid(ESM::NPC).name())
{
updateNpc(iter->first, duration);
if (timerUpdateEquippedLight == 0)
updateEquippedLight(iter->first, updateEquippedLightInterval);
}
}
}

@ -1882,10 +1882,14 @@ void CharacterController::update(float duration)
{
if(mHitState != CharState_KnockDown && mHitState != CharState_KnockOut)
{
world->rotateObject(mPtr, rot.x(), rot.y(), rot.z(), true);
if (rot != osg::Vec3f())
world->rotateObject(mPtr, rot.x(), rot.y(), rot.z(), true);
}
else //avoid z-rotating for knockdown
world->rotateObject(mPtr, rot.x(), rot.y(), 0.0f, true);
{
if (rot.x() != 0 && rot.y() != 0)
world->rotateObject(mPtr, rot.x(), rot.y(), 0.0f, true);
}
if (!mMovementAnimationControlled)
world->queueMovement(mPtr, vec);

@ -575,6 +575,8 @@ namespace MWRender
mAccumCtrl = NULL;
mAnimSources.clear();
mAnimVelocities.clear();
}
bool Animation::hasAnimation(const std::string &anim) const
@ -952,6 +954,10 @@ namespace MWRender
if (!mAccumRoot)
return 0.0f;
std::map<std::string, float>::const_iterator found = mAnimVelocities.find(groupname);
if (found != mAnimVelocities.end())
return found->second;
// Look in reverse; last-inserted source has priority.
AnimSourceList::const_reverse_iterator animsrc(mAnimSources.rbegin());
for(;animsrc != mAnimSources.rend();++animsrc)
@ -999,6 +1005,8 @@ namespace MWRender
}
}
mAnimVelocities.insert(std::make_pair(groupname, velocity));
return velocity;
}

@ -274,6 +274,8 @@ protected:
float mAlpha;
mutable std::map<std::string, float> mAnimVelocities;
osg::ref_ptr<SceneUtil::LightListCallback> mLightListCallback;
const NodeMap& getNodeMap() const;

@ -32,6 +32,26 @@
namespace
{
void setNodeRotation(const MWWorld::Ptr& ptr, MWRender::RenderingManager& rendering, bool inverseRotationOrder)
{
if (!ptr.getRefData().getBaseNode())
return;
osg::Quat worldRotQuat(ptr.getRefData().getPosition().rot[2], osg::Vec3(0,0,-1));
if (!ptr.getClass().isActor())
{
float xr = ptr.getRefData().getPosition().rot[0];
float yr = ptr.getRefData().getPosition().rot[1];
if (!inverseRotationOrder)
worldRotQuat = worldRotQuat * osg::Quat(yr, osg::Vec3(0,-1,0)) *
osg::Quat(xr, osg::Vec3(-1,0,0));
else
worldRotQuat = osg::Quat(xr, osg::Vec3(-1,0,0)) * osg::Quat(yr, osg::Vec3(0,-1,0)) * worldRotQuat;
}
rendering.rotateObject(ptr, worldRotQuat);
}
void addObject(const MWWorld::Ptr& ptr, MWPhysics::PhysicsSystem& physics,
MWRender::RenderingManager& rendering)
{
@ -40,6 +60,8 @@ namespace
if (id == "prisonmarker" || id == "divinemarker" || id == "templemarker" || id == "northmarker")
model = ""; // marker objects that have a hardcoded function in the game logic, should be hidden from the player
ptr.getClass().insertObjectRendering(ptr, model, rendering);
setNodeRotation(ptr, rendering, false);
ptr.getClass().insertObject (ptr, model, physics);
if (ptr.getClass().isActor())
@ -49,23 +71,8 @@ namespace
void updateObjectRotation (const MWWorld::Ptr& ptr, MWPhysics::PhysicsSystem& physics,
MWRender::RenderingManager& rendering, bool inverseRotationOrder)
{
if (ptr.getRefData().getBaseNode() != NULL)
{
osg::Quat worldRotQuat(ptr.getRefData().getPosition().rot[2], osg::Vec3(0,0,-1));
if (!ptr.getClass().isActor())
{
float xr = ptr.getRefData().getPosition().rot[0];
float yr = ptr.getRefData().getPosition().rot[1];
if (!inverseRotationOrder)
worldRotQuat = worldRotQuat * osg::Quat(yr, osg::Vec3(0,-1,0)) *
osg::Quat(xr, osg::Vec3(-1,0,0));
else
worldRotQuat = osg::Quat(xr, osg::Vec3(-1,0,0)) * osg::Quat(yr, osg::Vec3(0,-1,0)) * worldRotQuat;
}
rendering.rotateObject(ptr, worldRotQuat);
physics.updateRotation(ptr);
}
setNodeRotation(ptr, rendering, inverseRotationOrder);
physics.updateRotation(ptr);
}
void updateObjectScale(const MWWorld::Ptr& ptr, MWPhysics::PhysicsSystem& physics,
@ -133,7 +140,6 @@ namespace
try
{
addObject(ptr, mPhysics, mRendering);
updateObjectRotation(ptr, mPhysics, mRendering, false);
}
catch (const std::exception& e)
{
@ -629,7 +635,6 @@ namespace MWWorld
try
{
addObject(ptr, *mPhysics, mRendering);
updateObjectRotation(ptr, false);
MWBase::Environment::get().getWorld()->scaleObject(ptr, ptr.getCellRef().getScale());
}
catch (std::exception& e)

@ -61,14 +61,14 @@
<Resource type="ResourceSkin" name="MW_EnergyBar_Magic" size="64 12">
<Property key="TrackSkin" value="MW_BarTrack_Magic"/>
<Property key="TrackWidth" value="1"/>
<Property key="TrackFill" value="1"/>
<Child type="Widget" skin="MW_Box" offset="0 0 64 12" align="Stretch"/>
<Child type="Widget" skin="BlackBG" offset="2 2 60 8" align="Stretch" name="Client"/>
</Resource>
<Resource type="ResourceSkin" name="MW_EnergyBar_Weapon" size="64 12">
<Property key="TrackSkin" value="MW_BarTrack_Weapon"/>
<Property key="TrackWidth" value="1"/>
<Property key="TrackFill" value="1"/>
<Child type="Widget" skin="MW_Box" offset="0 0 64 12" align="Stretch"/>
<Child type="Widget" skin="BlackBG" offset="2 2 60 8" align="Stretch" name="Client"/>
@ -76,7 +76,7 @@
<Resource type="ResourceSkin" name="MW_EnergyBar_Red" size="64 12">
<Property key="TrackSkin" value="MW_BarTrack_Red"/>
<Property key="TrackWidth" value="1"/>
<Property key="TrackFill" value="1"/>
<Child type="Widget" skin="MW_Box" offset="0 0 64 12" align="Stretch"/>
<Child type="Widget" skin="BlackBG" offset="2 2 60 8" align="Stretch" name="Client"/>
@ -84,7 +84,7 @@
<Resource type="ResourceSkin" name="MW_EnergyBar_Green" size="64 12">
<Property key="TrackSkin" value="MW_BarTrack_Green"/>
<Property key="TrackWidth" value="1"/>
<Property key="TrackFill" value="1"/>
<Child type="Widget" skin="MW_Box" offset="0 0 64 12" align="Stretch"/>
<Child type="Widget" skin="BlackBG" offset="2 2 60 8" align="Stretch" name="Client"/>
@ -92,7 +92,7 @@
<Resource type="ResourceSkin" name="MW_EnergyBar_Blue" size="64 12">
<Property key="TrackSkin" value="MW_BarTrack_Blue"/>
<Property key="TrackWidth" value="1"/>
<Property key="TrackFill" value="1"/>
<Child type="Widget" skin="MW_Box" offset="0 0 64 12" align="Stretch"/>
<Child type="Widget" skin="BlackBG" offset="2 2 60 8" align="Stretch" name="Client"/>
@ -100,7 +100,7 @@
<Resource type="ResourceSkin" name="MW_EnergyBar_Yellow" size="64 12">
<Property key="TrackSkin" value="MW_BarTrack_Yellow"/>
<Property key="TrackWidth" value="1"/>
<Property key="TrackFill" value="1"/>
<Child type="Widget" skin="MW_Box" offset="0 0 64 12" align="Stretch"/>
<Child type="Widget" skin="BlackBG" offset="2 2 60 8" align="Stretch" name="Client"/>

@ -9,6 +9,7 @@
<Property key="MinTrackSize" value="14"/>
<Property key="VerticalAlignment" value="false"/>
<Property key="MoveToClick" value="true"/>
<Property key="TrackFill" value="1"/>
<Property key="WheelPage" value="36"/>
<Property key="ViewPage" value="36"/>
@ -50,6 +51,7 @@
<Property key="TrackRangeMargins" value="20 19"/>
<Property key="MinTrackSize" value="14"/>
<Property key="MoveToClick" value="true"/>
<Property key="TrackFill" value="1"/>
<Property key="WheelPage" value="36"/>
<Property key="ViewPage" value="36"/>

@ -54,7 +54,7 @@
<Resource type="ResourceSkin" name="MW_Progress_Red" size="64 12">
<Property key="TrackSkin" value="MW_Track_Red"/>
<Property key="TrackWidth" value="1"/>
<Property key="TrackFill" value="1"/>
<Child type="Widget" skin="MW_Box" offset="0 0 64 12" align="Stretch"/>
<Child type="Widget" skin="BlackBG" offset="2 2 60 8" align="Stretch" name="Client"/>
@ -62,7 +62,7 @@
<Resource type="ResourceSkin" name="MW_Progress_Green" size="64 12">
<Property key="TrackSkin" value="MW_Track_Green"/>
<Property key="TrackWidth" value="1"/>
<Property key="TrackFill" value="1"/>
<Child type="Widget" skin="MW_Box" offset="0 0 64 12" align="Stretch"/>
<Child type="Widget" skin="BlackBG" offset="2 2 60 8" align="Stretch" name="Client"/>
@ -70,7 +70,7 @@
<Resource type="ResourceSkin" name="MW_Progress_Blue" size="64 12">
<Property key="TrackSkin" value="MW_Track_Blue"/>
<Property key="TrackWidth" value="1"/>
<Property key="TrackFill" value="1"/>
<Child type="Widget" skin="MW_Box" offset="0 0 64 12" align="Stretch"/>
<Child type="Widget" skin="BlackBG" offset="2 2 60 8" align="Stretch" name="Client"/>
@ -78,18 +78,19 @@
<Resource type="ResourceSkin" name="MW_Progress_LightBlue" size="64 6">
<Property key="TrackSkin" value="MW_BigTrack_Progress_Blue_Small"/>
<Property key="TrackWidth" value="1"/>
<Property key="TrackFill" value="1"/>
<Child type="Widget" skin="MW_Box" offset="0 0 64 6" align="Stretch"/>
<Child type="Widget" skin="BlackBG" offset="2 2 60 2" align="Stretch" name="Client"/>
</Resource>
<Resource type="ResourceSkin" name="MW_Progress_Drowning" size="64 6">
<Child type="Widget" skin="MW_BigTrack_Progress_Red_Small" offset="0 0 64 6" align="Stretch"/>
<Property key="TrackSkin" value="MW_BigTrack_Progress_Red_Small"/>
<Property key="TrackFill" value="1"/>
</Resource>
<Resource type="ResourceSkin" name="MW_ProgressScroll_Loading" size="64 6">
<Property key="TrackWidth" value="1"/>
<Property key="TrackFill" value="1"/>
<Property key="TrackRangeMargins" value="0 0"/>
<Property key="MinTrackSize" value="1"/>
<Property key="VerticalAlignment" value="false"/>

Loading…
Cancel
Save