2015-08-24 07:54:02 +00:00
|
|
|
#ifndef GAME_MWCLASS_MOBILE_H
|
|
|
|
#define GAME_MWCLASS_MOBILE_H
|
|
|
|
|
|
|
|
#include "../mwworld/class.hpp"
|
|
|
|
|
2020-06-14 16:01:22 +00:00
|
|
|
#include <components/esm/loadmgef.hpp>
|
|
|
|
|
2015-08-24 07:54:02 +00:00
|
|
|
namespace ESM
|
|
|
|
{
|
|
|
|
struct GameSetting;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace MWClass
|
|
|
|
{
|
|
|
|
/// \brief Class holding functionality common to Creature and NPC
|
2015-08-25 06:19:16 +00:00
|
|
|
class Actor : public MWWorld::Class
|
2015-08-24 07:54:02 +00:00
|
|
|
{
|
|
|
|
protected:
|
|
|
|
|
2021-02-05 13:55:42 +00:00
|
|
|
Actor() = default;
|
2015-08-24 07:54:02 +00:00
|
|
|
|
2020-06-14 16:01:22 +00:00
|
|
|
template <class GMST>
|
|
|
|
float getSwimSpeedImpl(const MWWorld::Ptr& ptr, const GMST& gmst, const MWMechanics::MagicEffects& mageffects, float baseSpeed) const
|
|
|
|
{
|
|
|
|
return baseSpeed
|
|
|
|
* (1.0f + 0.01f * mageffects.get(ESM::MagicEffect::SwiftSwim).getMagnitude())
|
|
|
|
* (gmst.fSwimRunBase->mValue.getFloat()
|
|
|
|
+ 0.01f * getSkill(ptr, ESM::Skill::Athletics) * gmst.fSwimRunAthleticsMult->mValue.getFloat());
|
|
|
|
}
|
|
|
|
|
2015-08-24 07:54:02 +00:00
|
|
|
public:
|
2021-02-05 13:55:42 +00:00
|
|
|
~Actor() override = default;
|
2015-08-24 07:54:02 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
void adjustPosition(const MWWorld::Ptr& ptr, bool force) const override;
|
2015-08-24 07:54:02 +00:00
|
|
|
///< Adjust position to stand on ground. Must be called post model load
|
|
|
|
/// @param force do this even if the ptr is flying
|
|
|
|
|
2021-09-30 20:58:16 +00:00
|
|
|
void insertObject(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation, MWPhysics::PhysicsSystem& physics) const override;
|
2015-08-24 07:54:02 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
bool useAnim() const override;
|
2017-02-20 18:04:02 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
void block(const MWWorld::Ptr &ptr) const override;
|
2015-08-24 07:54:02 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
osg::Vec3f getRotationVector(const MWWorld::Ptr& ptr) const override;
|
2020-08-27 11:48:59 +00:00
|
|
|
///< Return desired rotations, as euler angles. Sets getMovementSettings(ptr).mRotation to zero.
|
2015-08-24 07:54:02 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
float getEncumbrance(const MWWorld::Ptr& ptr) const override;
|
2015-08-24 07:54:02 +00:00
|
|
|
///< Returns total weight of objects inside this object (including modifications from magic
|
|
|
|
/// effects). Throws an exception, if the object can't hold other objects.
|
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
bool allowTelekinesis(const MWWorld::ConstPtr& ptr) const override;
|
2016-07-06 15:03:14 +00:00
|
|
|
///< Return whether this class of object can be activated with telekinesis
|
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
bool isActor() const override;
|
2016-09-15 14:47:50 +00:00
|
|
|
|
2020-08-27 11:48:59 +00:00
|
|
|
/// Return current movement speed.
|
2020-10-16 18:18:54 +00:00
|
|
|
float getCurrentSpeed(const MWWorld::Ptr& ptr) const override;
|
2020-08-27 11:48:59 +00:00
|
|
|
|
2015-08-24 07:54:02 +00:00
|
|
|
// not implemented
|
2021-02-05 13:55:42 +00:00
|
|
|
Actor(const Actor&) = delete;
|
|
|
|
Actor& operator= (const Actor&) = delete;
|
2015-08-24 07:54:02 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|