2015-08-24 19:54:02 +12:00
|
|
|
#ifndef GAME_MWCLASS_MOBILE_H
|
|
|
|
#define GAME_MWCLASS_MOBILE_H
|
|
|
|
|
|
|
|
#include "../mwworld/class.hpp"
|
|
|
|
|
2022-07-16 16:37:31 +02:00
|
|
|
#include "../mwmechanics/magiceffects.hpp"
|
|
|
|
|
2022-01-22 15:58:41 +01:00
|
|
|
#include <components/esm3/loadmgef.hpp>
|
2022-07-16 16:37:31 +02:00
|
|
|
#include <components/esm3/loadskil.hpp>
|
2020-06-14 18:01:22 +02:00
|
|
|
|
2015-08-24 19:54:02 +12:00
|
|
|
namespace ESM
|
|
|
|
{
|
|
|
|
struct GameSetting;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace MWClass
|
|
|
|
{
|
|
|
|
/// \brief Class holding functionality common to Creature and NPC
|
2015-08-25 18:19:16 +12:00
|
|
|
class Actor : public MWWorld::Class
|
2015-08-24 19:54:02 +12:00
|
|
|
{
|
|
|
|
protected:
|
2022-04-04 02:44:53 +02:00
|
|
|
explicit Actor(unsigned type)
|
|
|
|
: Class(type)
|
|
|
|
{
|
|
|
|
}
|
2015-08-24 19:54:02 +12:00
|
|
|
|
2020-06-14 18:01:22 +02:00
|
|
|
template <class GMST>
|
|
|
|
float getSwimSpeedImpl(const MWWorld::Ptr& ptr, const GMST& gmst, const MWMechanics::MagicEffects& mageffects,
|
|
|
|
float baseSpeed) const
|
|
|
|
{
|
2023-05-23 19:06:08 +02:00
|
|
|
return baseSpeed * (1.0f + 0.01f * mageffects.getOrDefault(ESM::MagicEffect::SwiftSwim).getMagnitude())
|
2020-06-14 18:01:22 +02:00
|
|
|
* (gmst.fSwimRunBase->mValue.getFloat()
|
|
|
|
+ 0.01f * getSkill(ptr, ESM::Skill::Athletics) * gmst.fSwimRunAthleticsMult->mValue.getFloat());
|
|
|
|
}
|
|
|
|
|
2015-08-24 19:54:02 +12:00
|
|
|
public:
|
2021-02-05 14:55:42 +01:00
|
|
|
~Actor() override = default;
|
2015-08-24 19:54:02 +12:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void adjustPosition(const MWWorld::Ptr& ptr, bool force) const override;
|
2015-08-24 19:54:02 +12: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 22:58:16 +02:00
|
|
|
void insertObject(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation,
|
|
|
|
MWPhysics::PhysicsSystem& physics) const override;
|
2015-08-24 19:54:02 +12:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
bool useAnim() const override;
|
2017-02-20 19:04:02 +01:00
|
|
|
|
2020-10-16 22:18:54 +04: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 19:54:02 +12:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
float getEncumbrance(const MWWorld::Ptr& ptr) const override;
|
2015-08-24 19:54:02 +12: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 22:18:54 +04:00
|
|
|
bool allowTelekinesis(const MWWorld::ConstPtr& ptr) const override;
|
2016-07-07 00:03:14 +09:00
|
|
|
///< Return whether this class of object can be activated with telekinesis
|
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
bool isActor() const override;
|
2016-09-15 16:47:50 +02:00
|
|
|
|
2020-08-27 11:48:59 +00:00
|
|
|
/// Return current movement speed.
|
2020-10-16 22:18:54 +04:00
|
|
|
float getCurrentSpeed(const MWWorld::Ptr& ptr) const override;
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2023-10-01 11:22:20 +02:00
|
|
|
bool consume(const MWWorld::Ptr& consumable, const MWWorld::Ptr& actor) const override;
|
|
|
|
|
2015-08-24 19:54:02 +12:00
|
|
|
// not implemented
|
2021-02-05 14:55:42 +01:00
|
|
|
Actor(const Actor&) = delete;
|
|
|
|
Actor& operator=(const Actor&) = delete;
|
2015-08-24 19:54:02 +12:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|