2014-06-12 23:27:04 +02:00
|
|
|
#ifndef OPENMW_COMPONENTS_ESM_AISEQUENCE_H
|
|
|
|
#define OPENMW_COMPONENTS_ESM_AISEQUENCE_H
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
2022-02-23 00:39:30 +01:00
|
|
|
#include <memory>
|
2014-06-12 23:27:04 +02:00
|
|
|
|
2022-01-22 15:58:41 +01:00
|
|
|
#include "components/esm/defs.hpp"
|
2014-06-12 23:27:04 +02:00
|
|
|
|
2022-01-22 15:58:41 +01:00
|
|
|
#include "components/esm/util.hpp"
|
2014-12-31 21:27:19 +01:00
|
|
|
|
2014-06-12 23:27:04 +02:00
|
|
|
namespace ESM
|
|
|
|
{
|
|
|
|
class ESMReader;
|
|
|
|
class ESMWriter;
|
|
|
|
|
|
|
|
namespace AiSequence
|
|
|
|
{
|
|
|
|
|
|
|
|
// format 0, saved games only
|
|
|
|
// As opposed to AiPackageList, this stores the "live" version of AI packages.
|
|
|
|
|
|
|
|
enum AiPackages
|
|
|
|
{
|
2022-04-12 00:18:39 +02:00
|
|
|
Ai_Wander = fourCC("WAND"),
|
|
|
|
Ai_Travel = fourCC("TRAV"),
|
|
|
|
Ai_Escort = fourCC("ESCO"),
|
|
|
|
Ai_Follow = fourCC("FOLL"),
|
|
|
|
Ai_Activate = fourCC("ACTI"),
|
|
|
|
Ai_Combat = fourCC("COMB"),
|
|
|
|
Ai_Pursue = fourCC("PURS")
|
2014-06-12 23:27:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct AiPackage
|
|
|
|
{
|
|
|
|
virtual ~AiPackage() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#pragma pack(push,1)
|
|
|
|
struct AiWanderData
|
|
|
|
{
|
|
|
|
short mDistance;
|
|
|
|
short mDuration;
|
|
|
|
unsigned char mTimeOfDay;
|
|
|
|
unsigned char mIdle[8];
|
|
|
|
unsigned char mShouldRepeat;
|
|
|
|
};
|
2016-06-10 00:56:01 +09:00
|
|
|
struct AiWanderDuration
|
|
|
|
{
|
|
|
|
float mRemainingDuration;
|
|
|
|
int unused;
|
|
|
|
};
|
2014-06-12 23:27:04 +02:00
|
|
|
struct AiTravelData
|
|
|
|
{
|
|
|
|
float mX, mY, mZ;
|
|
|
|
};
|
|
|
|
struct AiEscortData
|
|
|
|
{
|
|
|
|
float mX, mY, mZ;
|
|
|
|
short mDuration;
|
|
|
|
};
|
|
|
|
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
struct AiWander : AiPackage
|
|
|
|
{
|
|
|
|
AiWanderData mData;
|
2022-04-12 00:18:39 +02:00
|
|
|
AiWanderDuration mDurationData; // was TimeStamp mStartTime
|
2014-06-12 23:27:04 +02:00
|
|
|
|
2014-12-31 21:27:19 +01:00
|
|
|
bool mStoredInitialActorPosition;
|
2022-04-12 00:18:39 +02:00
|
|
|
Vector3 mInitialActorPosition;
|
2014-12-31 21:27:19 +01:00
|
|
|
|
2014-06-12 23:27:04 +02:00
|
|
|
/// \todo add more AiWander state
|
|
|
|
|
|
|
|
void load(ESMReader &esm);
|
|
|
|
void save(ESMWriter &esm) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct AiTravel : AiPackage
|
|
|
|
{
|
|
|
|
AiTravelData mData;
|
2018-05-25 19:31:31 +04:00
|
|
|
bool mHidden;
|
2021-11-17 20:44:55 +01:00
|
|
|
bool mRepeat;
|
2014-06-12 23:27:04 +02:00
|
|
|
|
|
|
|
void load(ESMReader &esm);
|
|
|
|
void save(ESMWriter &esm) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct AiEscort : AiPackage
|
|
|
|
{
|
|
|
|
AiEscortData mData;
|
|
|
|
|
2017-11-21 20:00:51 +04:00
|
|
|
int mTargetActorId;
|
2014-06-12 23:27:04 +02:00
|
|
|
std::string mTargetId;
|
|
|
|
std::string mCellId;
|
|
|
|
float mRemainingDuration;
|
2021-11-17 20:44:55 +01:00
|
|
|
bool mRepeat;
|
2014-06-12 23:27:04 +02:00
|
|
|
|
|
|
|
void load(ESMReader &esm);
|
|
|
|
void save(ESMWriter &esm) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct AiFollow : AiPackage
|
|
|
|
{
|
|
|
|
AiEscortData mData;
|
|
|
|
|
2017-11-21 20:00:51 +04:00
|
|
|
int mTargetActorId;
|
2014-06-12 23:27:04 +02:00
|
|
|
std::string mTargetId;
|
|
|
|
std::string mCellId;
|
|
|
|
float mRemainingDuration;
|
|
|
|
|
|
|
|
bool mAlwaysFollow;
|
2014-08-06 21:16:14 +02:00
|
|
|
bool mCommanded;
|
2014-06-12 23:27:04 +02:00
|
|
|
|
2014-12-09 22:25:28 +01:00
|
|
|
bool mActive;
|
2021-11-17 20:44:55 +01:00
|
|
|
bool mRepeat;
|
2014-12-09 22:25:28 +01:00
|
|
|
|
2014-06-12 23:27:04 +02:00
|
|
|
void load(ESMReader &esm);
|
|
|
|
void save(ESMWriter &esm) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct AiActivate : AiPackage
|
|
|
|
{
|
|
|
|
std::string mTargetId;
|
2021-11-17 20:44:55 +01:00
|
|
|
bool mRepeat;
|
2014-06-12 23:27:04 +02:00
|
|
|
|
|
|
|
void load(ESMReader &esm);
|
|
|
|
void save(ESMWriter &esm) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct AiCombat : AiPackage
|
|
|
|
{
|
|
|
|
int mTargetActorId;
|
|
|
|
|
|
|
|
void load(ESMReader &esm);
|
|
|
|
void save(ESMWriter &esm) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct AiPursue : AiPackage
|
|
|
|
{
|
|
|
|
int mTargetActorId;
|
|
|
|
|
|
|
|
void load(ESMReader &esm);
|
|
|
|
void save(ESMWriter &esm) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct AiPackageContainer
|
|
|
|
{
|
|
|
|
int mType;
|
|
|
|
|
2022-02-23 00:39:30 +01:00
|
|
|
std::unique_ptr<AiPackage> mPackage;
|
2014-06-12 23:27:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct AiSequence
|
|
|
|
{
|
2018-05-25 20:07:08 +04:00
|
|
|
AiSequence()
|
|
|
|
{
|
|
|
|
mLastAiPackage = -1;
|
|
|
|
}
|
2014-06-12 23:27:04 +02:00
|
|
|
|
|
|
|
std::vector<AiPackageContainer> mPackages;
|
2018-05-25 20:07:08 +04:00
|
|
|
int mLastAiPackage;
|
2014-06-12 23:27:04 +02:00
|
|
|
|
|
|
|
void load (ESMReader &esm);
|
|
|
|
void save (ESMWriter &esm) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
AiSequence(const AiSequence&);
|
|
|
|
AiSequence& operator=(const AiSequence&);
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|