blob: e6c9a7e4d68ebe15e397525dc487be5c4948afa5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#pragma once
#include <basis/seadTypes.h>
#include <container/seadBuffer.h>
#include "KingSystem/ActorSystem/actAiActionBase.h"
#include "KingSystem/Utils/Types.h"
namespace ksys::act::ai {
class Action : public ActionBase {
SEAD_RTTI_OVERRIDE(Action, ActionBase)
public:
explicit Action(const InitArg& arg);
void calc() override;
ActionType getType() const override { return ActionType::Action; }
protected:
virtual void calc_() {}
};
KSYS_CHECK_SIZE_NX150(Action, 0x20);
struct ActionFactory {
using CreateFn = Action* (*)(const Action::InitArg& arg, sead::Heap* heap);
u32 hash;
CreateFn create_fn;
template <typename T>
static Action* make(const Action::InitArg& arg, sead::Heap* heap) {
return new (heap) T(arg);
}
};
class Actions {
public:
Actions();
~Actions();
void finalize();
bool init(Actor* actor, sead::Heap* heap);
bool updateForPreDelete() const;
void onPreDelete() const;
const sead::Buffer<Action*>& getClasses() const { return mClasses; }
static Action* clone(const Action& action, sead::Heap* heap);
static ActionFactory* getFactory(const sead::SafeString& name);
static void setFactories(int count, ActionFactory* factories);
private:
static sead::Buffer<ActionFactory> sFactories;
sead::Buffer<Action*> mClasses;
// Non-owning buffer.
sead::Buffer<Action*> mOnPreDeleteCbs;
// Non-owning buffer.
sead::Buffer<Action*> mUpdateForPreDeleteCbs;
};
} // namespace ksys::act::ai
|