1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-11 00:39:59 +00:00
OpenMW/apps/openmw/mwrender/creatureanimation.hpp
scrawl 882e359008 Move attackStrength to the CharacterController, where it should have been to begin with
Only relevant for actors in active cells, so doesn't belong in CreatureStats. This change should slightly reduce the game's memory usage.
2015-06-26 05:15:07 +02:00

69 lines
2.2 KiB
C++

#ifndef GAME_RENDER_CREATUREANIMATION_H
#define GAME_RENDER_CREATUREANIMATION_H
#include "animation.hpp"
#include "weaponanimation.hpp"
#include "../mwworld/inventorystore.hpp"
namespace MWWorld
{
class Ptr;
}
namespace MWRender
{
class CreatureAnimation : public Animation
{
public:
CreatureAnimation(const MWWorld::Ptr &ptr, const std::string& model, Resource::ResourceSystem* resourceSystem);
virtual ~CreatureAnimation() {}
};
// For creatures with weapons and shields
// Animation is already virtual anyway, so might as well make a separate class.
// Most creatures don't need weapons/shields, so this will save some memory.
class CreatureWeaponAnimation : public Animation, public WeaponAnimation, public MWWorld::InventoryStoreListener
{
public:
CreatureWeaponAnimation(const MWWorld::Ptr &ptr, const std::string& model, Resource::ResourceSystem* resourceSystem);
virtual ~CreatureWeaponAnimation() {}
virtual void equipmentChanged() { updateParts(); }
virtual void showWeapons(bool showWeapon);
virtual void showCarriedLeft(bool show);
void updateParts();
void updatePart(PartHolderPtr& scene, int slot);
virtual void attachArrow();
virtual void releaseArrow(float attackStrength);
// WeaponAnimation
virtual osg::Group* getArrowBone();
virtual osg::Node* getWeaponNode();
virtual Resource::ResourceSystem* getResourceSystem();
virtual void showWeapon(bool show) { showWeapons(show); }
virtual void setWeaponGroup(const std::string& group) { mWeaponAnimationTime->setGroup(group); }
virtual void addControllers();
virtual osg::Vec3f runAnimation(float duration);
/// A relative factor (0-1) that decides if and how much the skeleton should be pitched
/// to indicate the facing orientation of the character.
virtual void setPitchFactor(float factor) { mPitchFactor = factor; }
private:
PartHolderPtr mWeapon;
PartHolderPtr mShield;
bool mShowWeapons;
bool mShowCarriedLeft;
boost::shared_ptr<WeaponAnimationTime> mWeaponAnimationTime;
};
}
#endif