mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Minor rewrite, make "open" spells play glow effect
This commit is contained in:
parent
e132b52a69
commit
35c14bb9bb
@ -122,14 +122,10 @@ namespace MWClass
|
||||
|
||||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::MagicEffect *effect;
|
||||
effect = store.get<ESM::MagicEffect>().find(59);
|
||||
int index = effect->effectStringToId("sEffectTelekinesis");
|
||||
effect = store.get<ESM::MagicEffect>().find(index);
|
||||
|
||||
osg::Vec4f glowcolor(1,1,1,1);
|
||||
glowcolor.x() = effect->mData.mRed / 255.f;
|
||||
glowcolor.y() = effect->mData.mGreen / 255.f;
|
||||
glowcolor.z() = effect->mData.mBlue / 255.f;
|
||||
|
||||
animation->addSpellCastGlow(glowcolor); // TODO: Telekinesis glow should only be as long as the door animation
|
||||
animation->addSpellCastGlow(effect); // TODO: Telekinesis glow should only be as long as the door animation
|
||||
}
|
||||
|
||||
// make key id lowercase
|
||||
|
@ -584,6 +584,12 @@ namespace MWMechanics
|
||||
}
|
||||
else if (effectId == ESM::MagicEffect::Open)
|
||||
{
|
||||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::MagicEffect *magiceffect;
|
||||
magiceffect = store.get<ESM::MagicEffect>().find(effectId);
|
||||
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(target);
|
||||
animation->addSpellCastGlow(magiceffect);
|
||||
|
||||
if (target.getCellRef().getLockLevel() <= magnitude)
|
||||
{
|
||||
if (target.getCellRef().getLockLevel() > 0)
|
||||
@ -837,7 +843,7 @@ namespace MWMechanics
|
||||
mCaster.getClass().skillUsageSucceeded(mCaster,
|
||||
spellSchoolToSkill(school), 0);
|
||||
|
||||
// A non-actor doesn't play its effects from a character controller, so play spell casting effects here
|
||||
// A non-actor doesn't play its spell cast effects from a character controller, so play them here
|
||||
if (!mCaster.getClass().isActor())
|
||||
playSpellCastingEffects(mId);
|
||||
|
||||
@ -945,7 +951,7 @@ namespace MWMechanics
|
||||
|
||||
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(mCaster);
|
||||
|
||||
if (mCaster.getClass().isActor()) // TODO: Non-actors (except for large statics?) should also create a visual casting effect
|
||||
if (mCaster.getClass().isActor()) // TODO: Non-actors (except for large statics?) should also create a spell cast vfx
|
||||
{
|
||||
const ESM::Static* castStatic;
|
||||
if (!effect->mCasting.empty())
|
||||
@ -957,14 +963,7 @@ namespace MWMechanics
|
||||
}
|
||||
|
||||
if (!mCaster.getClass().isActor())
|
||||
{
|
||||
osg::Vec4f glowcolor(1,1,1,1);
|
||||
glowcolor.x() = effect->mData.mRed / 255.f;
|
||||
glowcolor.y() = effect->mData.mGreen / 255.f;
|
||||
glowcolor.z() = effect->mData.mBlue / 255.f;
|
||||
|
||||
animation->addSpellCastGlow(glowcolor);
|
||||
}
|
||||
animation->addSpellCastGlow(effect);
|
||||
|
||||
static const std::string schools[] = {
|
||||
"alteration", "conjuration", "destruction", "illusion", "mysticism", "restoration"
|
||||
|
@ -159,9 +159,9 @@ namespace
|
||||
else
|
||||
writableStateSet = osg::clone(mNode->getStateSet(), osg::CopyOp::SHALLOW_COPY);
|
||||
|
||||
for (size_t index = 0; index < mTextures.size(); index++)
|
||||
for (size_t i = 0; i < mTextures.size(); i++)
|
||||
{
|
||||
writableStateSet->removeTextureAttribute(mTexUnit, mTextures[index]);
|
||||
writableStateSet->removeTextureAttribute(mTexUnit, mTextures[i]);
|
||||
}
|
||||
|
||||
writableStateSet->removeUniform(mUniform); // remove the uniform given to the temporary glow in addglow()
|
||||
@ -1194,7 +1194,13 @@ namespace MWRender
|
||||
int mLowestUnusedTexUnit;
|
||||
};
|
||||
|
||||
void Animation::addSpellCastGlow(osg::Vec4f glowColor){
|
||||
void Animation::addSpellCastGlow(const ESM::MagicEffect *effect){
|
||||
|
||||
osg::Vec4f glowColor = {1,1,1,1};
|
||||
glowColor.x() = effect->mData.mRed / 255.f;
|
||||
glowColor.y() = effect->mData.mGreen / 255.f;
|
||||
glowColor.z() = effect->mData.mBlue / 255.f;
|
||||
|
||||
if (!mObjectRoot->getUpdateCallback()) // If there is no glow on object
|
||||
addGlow(mObjectRoot, glowColor, 1.5); // Glow length measured from in-game as about 1.5 seconds
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
namespace ESM
|
||||
{
|
||||
struct Light;
|
||||
struct MagicEffect;
|
||||
}
|
||||
|
||||
namespace Resource
|
||||
@ -351,7 +352,7 @@ public:
|
||||
void removeEffect (int effectId);
|
||||
void getLoopingEffects (std::vector<int>& out) const;
|
||||
|
||||
void addSpellCastGlow(osg::Vec4f glowColor);
|
||||
void addSpellCastGlow(const ESM::MagicEffect *effect);
|
||||
|
||||
virtual void updatePtr(const MWWorld::Ptr &ptr);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user