mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 03:23:54 +00:00
Improve const-correctness in Animation
This commit is contained in:
parent
3749821809
commit
0efbdb25ee
4 changed files with 17 additions and 17 deletions
|
@ -227,7 +227,7 @@ public:
|
|||
{ return weap.type == type; }
|
||||
};
|
||||
|
||||
std::string CharacterController::chooseRandomGroup (const std::string& prefix, int* num)
|
||||
std::string CharacterController::chooseRandomGroup (const std::string& prefix, int* num) const
|
||||
{
|
||||
int numAnims=0;
|
||||
while (mAnimation->hasAnimation(prefix + toString(numAnims+1)))
|
||||
|
@ -629,7 +629,7 @@ void CharacterController::playDeath(float startpoint, CharacterState death)
|
|||
false, 1.0f, "start", "stop", startpoint, 0);
|
||||
}
|
||||
|
||||
CharacterState CharacterController::chooseRandomDeathState()
|
||||
CharacterState CharacterController::chooseRandomDeathState() const
|
||||
{
|
||||
int selected=0;
|
||||
chooseRandomGroup("death", &selected);
|
||||
|
|
|
@ -207,12 +207,12 @@ class CharacterController : public MWRender::Animation::TextKeyListener
|
|||
void updateMagicEffects();
|
||||
|
||||
void playDeath(float startpoint, CharacterState death);
|
||||
CharacterState chooseRandomDeathState();
|
||||
CharacterState chooseRandomDeathState() const;
|
||||
void playRandomDeath(float startpoint = 0.0f);
|
||||
|
||||
/// choose a random animation group with \a prefix and numeric suffix
|
||||
/// @param num if non-NULL, the chosen animation number will be written here
|
||||
std::string chooseRandomGroup (const std::string& prefix, int* num = NULL);
|
||||
std::string chooseRandomGroup (const std::string& prefix, int* num = NULL) const;
|
||||
|
||||
bool updateCarriedLeftVisible(WeaponType weaptype) const;
|
||||
|
||||
|
|
|
@ -259,7 +259,7 @@ namespace MWRender
|
|||
|
||||
ControllerMap mControllerMap[Animation::sNumBlendMasks];
|
||||
|
||||
const std::multimap<float, std::string>& getTextKeys();
|
||||
const std::multimap<float, std::string>& getTextKeys() const;
|
||||
};
|
||||
|
||||
class ResetAccumRootCallback : public osg::NodeCallback
|
||||
|
@ -314,7 +314,7 @@ namespace MWRender
|
|||
mInsert->removeChild(mObjectRoot);
|
||||
}
|
||||
|
||||
MWWorld::Ptr Animation::getPtr()
|
||||
MWWorld::ConstPtr Animation::getPtr() const
|
||||
{
|
||||
return mPtr;
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ namespace MWRender
|
|||
mResetAccumRootCallback->setAccumulate(mAccumulate);
|
||||
}
|
||||
|
||||
size_t Animation::detectBlendMask(osg::Node* node)
|
||||
size_t Animation::detectBlendMask(const osg::Node* node) const
|
||||
{
|
||||
static const char sBlendMaskRoots[sNumBlendMasks][32] = {
|
||||
"", /* Lower body / character root */
|
||||
|
@ -364,7 +364,7 @@ namespace MWRender
|
|||
return 0;
|
||||
}
|
||||
|
||||
const std::multimap<float, std::string> &Animation::AnimSource::getTextKeys()
|
||||
const std::multimap<float, std::string> &Animation::AnimSource::getTextKeys() const
|
||||
{
|
||||
return mKeyframes->mTextKeys;
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ namespace MWRender
|
|||
mAnimSources.clear();
|
||||
}
|
||||
|
||||
bool Animation::hasAnimation(const std::string &anim)
|
||||
bool Animation::hasAnimation(const std::string &anim) const
|
||||
{
|
||||
AnimSourceList::const_iterator iter(mAnimSources.begin());
|
||||
for(;iter != mAnimSources.end();++iter)
|
||||
|
@ -1098,7 +1098,7 @@ namespace MWRender
|
|||
}
|
||||
|
||||
// TODO: Should not be here
|
||||
osg::Vec4f Animation::getEnchantmentColor(MWWorld::Ptr item)
|
||||
osg::Vec4f Animation::getEnchantmentColor(const MWWorld::ConstPtr& item) const
|
||||
{
|
||||
osg::Vec4f result(1,1,1,1);
|
||||
std::string enchantmentName = item.getClass().getEnchantment(item);
|
||||
|
@ -1198,9 +1198,9 @@ namespace MWRender
|
|||
}
|
||||
}
|
||||
|
||||
void Animation::getLoopingEffects(std::vector<int> &out)
|
||||
void Animation::getLoopingEffects(std::vector<int> &out) const
|
||||
{
|
||||
for (std::vector<EffectParams>::iterator it = mEffects.begin(); it != mEffects.end(); ++it)
|
||||
for (std::vector<EffectParams>::const_iterator it = mEffects.begin(); it != mEffects.end(); ++it)
|
||||
{
|
||||
if (it->mLoop)
|
||||
out.push_back(it->mEffectId);
|
||||
|
|
|
@ -270,7 +270,7 @@ protected:
|
|||
*/
|
||||
void resetActiveGroups();
|
||||
|
||||
size_t detectBlendMask(osg::Node* node);
|
||||
size_t detectBlendMask(const osg::Node* node) const;
|
||||
|
||||
/* Updates the position of the accum root node for the given time, and
|
||||
* returns the wanted movement vector from the previous time. */
|
||||
|
@ -315,7 +315,7 @@ protected:
|
|||
*/
|
||||
virtual void addControllers();
|
||||
|
||||
osg::Vec4f getEnchantmentColor(MWWorld::Ptr item);
|
||||
osg::Vec4f getEnchantmentColor(const MWWorld::ConstPtr& item) const;
|
||||
|
||||
void addGlow(osg::ref_ptr<osg::Node> node, osg::Vec4f glowColor);
|
||||
|
||||
|
@ -327,7 +327,7 @@ public:
|
|||
Animation(const MWWorld::Ptr &ptr, osg::ref_ptr<osg::Group> parentNode, Resource::ResourceSystem* resourceSystem);
|
||||
virtual ~Animation();
|
||||
|
||||
MWWorld::Ptr getPtr();
|
||||
MWWorld::ConstPtr getPtr() const;
|
||||
|
||||
/// Set active flag on the object skeleton, if one exists.
|
||||
/// @see SceneUtil::Skeleton::setActive
|
||||
|
@ -349,11 +349,11 @@ public:
|
|||
*/
|
||||
void addEffect (const std::string& model, int effectId, bool loop = false, const std::string& bonename = "", std::string texture = "");
|
||||
void removeEffect (int effectId);
|
||||
void getLoopingEffects (std::vector<int>& out);
|
||||
void getLoopingEffects (std::vector<int>& out) const;
|
||||
|
||||
virtual void updatePtr(const MWWorld::Ptr &ptr);
|
||||
|
||||
bool hasAnimation(const std::string &anim);
|
||||
bool hasAnimation(const std::string &anim) const;
|
||||
|
||||
// Specifies the axis' to accumulate on. Non-accumulated axis will just
|
||||
// move visually, but not affect the actual movement. Each x/y/z value
|
||||
|
|
Loading…
Reference in a new issue