1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-27 00:40:21 +00:00
OpenMW/apps/openmw/mwmechanics/aitravel.hpp

73 lines
1.9 KiB
C++
Raw Normal View History

#ifndef GAME_MWMECHANICS_AITRAVEL_H
#define GAME_MWMECHANICS_AITRAVEL_H
#include "typedaipackage.hpp"
namespace ESM
{
2022-09-22 21:26:05 +03:00
namespace AiSequence
{
struct AiTravel;
}
}
namespace MWMechanics
{
struct AiInternalTravel;
/// \brief Causes the AI to travel to the specified point
class AiTravel : public TypedAiPackage<AiTravel>
{
2022-09-22 21:26:05 +03:00
public:
AiTravel(float x, float y, float z, bool repeat, AiTravel* derived);
2022-09-22 21:26:05 +03:00
AiTravel(float x, float y, float z, AiInternalTravel* derived);
2022-09-22 21:26:05 +03:00
AiTravel(float x, float y, float z, bool repeat);
2022-09-22 21:26:05 +03:00
explicit AiTravel(const ESM::AiSequence::AiTravel* travel);
2022-09-22 21:26:05 +03:00
/// Simulates the passing of time
void fastForward(const MWWorld::Ptr& actor, AiState& state) override;
2022-09-22 21:26:05 +03:00
void writeState(ESM::AiSequence::AiSequence& sequence) const override;
2022-09-22 21:26:05 +03:00
bool execute(const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state,
float duration) override;
2022-09-22 21:26:05 +03:00
static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::Travel; }
2022-09-22 21:26:05 +03:00
static constexpr Options makeDefaultOptions()
{
AiPackage::Options options;
options.mUseVariableSpeed = true;
options.mAlwaysActive = true;
return options;
}
2022-09-22 21:26:05 +03:00
osg::Vec3f getDestination() const override { return osg::Vec3f(mX, mY, mZ); }
2022-09-22 21:26:05 +03:00
private:
const float mX;
const float mY;
const float mZ;
2022-09-22 21:26:05 +03:00
const bool mHidden;
2022-09-22 21:26:05 +03:00
float mDestinationTimer;
};
struct AiInternalTravel final : public AiTravel
{
AiInternalTravel(float x, float y, float z);
explicit AiInternalTravel(const ESM::AiSequence::AiTravel* travel);
static constexpr AiPackageTypeId getTypeId() { return AiPackageTypeId::InternalTravel; }
std::unique_ptr<AiPackage> clone() const override;
};
}
#endif