mirror of
https://github.com/zeldaret/botw
synced 2026-05-26 23:47:16 -04:00
ksys/act: Start adding RootAi
This commit is contained in:
@@ -35,6 +35,8 @@ target_sources(uking PRIVATE
|
||||
actAiParam.h
|
||||
actAiQuery.cpp
|
||||
actAiQuery.h
|
||||
actAiRoot.cpp
|
||||
actAiRoot.h
|
||||
actAttention.cpp
|
||||
actAttention.h
|
||||
actBaseProc.cpp
|
||||
|
||||
@@ -8,6 +8,10 @@ namespace ksys {
|
||||
|
||||
namespace act {
|
||||
|
||||
namespace ai {
|
||||
class RootAi;
|
||||
}
|
||||
|
||||
class LifeRecoverInfo;
|
||||
class ActorParam;
|
||||
|
||||
@@ -39,7 +43,10 @@ public:
|
||||
const sead::TypedBitFlag<StasisFlag>& getStasisFlags() const { return mStasisFlags; }
|
||||
|
||||
protected:
|
||||
/* 0x008 */ u8 TEMP_0x008[0x3F4]; // FIXME
|
||||
/* 0x180 */ u8 TEMP_0x180[0x3D8]; // FIXME
|
||||
/* 0x558 */ ai::RootAi* mRootAi;
|
||||
/* 0x560 */ void* mASList; // FIXME
|
||||
/* 0x568 */ void* mEffects; // FIXME
|
||||
/* 0x570 */ ActorParam* mActorParam;
|
||||
/* 0x578 */ u8 TEMP_0x578[0x648 - 0x578];
|
||||
/* 0x648 */ map::MubinIter mMapObjIter;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "KingSystem/ActorSystem/actAiAction.h"
|
||||
#include "KingSystem/ActorSystem/actAiRoot.h"
|
||||
|
||||
namespace ksys::act::ai {
|
||||
|
||||
@@ -8,4 +9,6 @@ void Action::calc() {
|
||||
calc_();
|
||||
}
|
||||
|
||||
template class ClassContainer<Action>;
|
||||
|
||||
} // namespace ksys::act::ai
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "KingSystem/ActorSystem/actAiAi.h"
|
||||
#include "KingSystem/ActorSystem/actAiRoot.h"
|
||||
|
||||
namespace ksys::act::ai {
|
||||
|
||||
@@ -44,4 +45,6 @@ void Ai::updateChildIdx(u16 new_idx) {
|
||||
mPendingChildIdx = InvalidIdx;
|
||||
}
|
||||
|
||||
template class ClassContainer<Ai>;
|
||||
|
||||
} // namespace ksys::act::ai
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
#include "KingSystem/ActorSystem/actAiBehavior.h"
|
||||
#include "KingSystem/ActorSystem/actAiRoot.h"
|
||||
|
||||
namespace ksys::act::ai {
|
||||
|
||||
Behavior::Behavior(const InitArg& arg)
|
||||
: mActor(arg.actor), mDefIdx(static_cast<u16>(arg.def_idx)) {}
|
||||
|
||||
template class ClassContainer<Behavior>;
|
||||
|
||||
} // namespace ksys::act::ai
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#include "KingSystem/ActorSystem/actAiQuery.h"
|
||||
#include "KingSystem/ActorSystem/actAiRoot.h"
|
||||
|
||||
namespace ksys::act::ai {
|
||||
|
||||
Query::Query(const InitArg& arg) : mActor(arg.actor), mDefIdx(arg.def_idx) {}
|
||||
|
||||
template class ClassContainer<Query>;
|
||||
|
||||
} // namespace ksys::act::ai
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#include "KingSystem/ActorSystem/actAiRoot.h"
|
||||
|
||||
namespace ksys::act::ai {
|
||||
|
||||
RootAi::RootAi(const InitArg& arg) : Ai(arg) {
|
||||
mBehaviorsByStopAndCalcTiming[0].fill({});
|
||||
mBehaviorsByStopAndCalcTiming[1].fill({});
|
||||
}
|
||||
|
||||
RootAi::~RootAi() {
|
||||
mQueries.finalize();
|
||||
mBehaviors.finalize();
|
||||
mAis.finalize();
|
||||
mActions.finalize();
|
||||
if (_140)
|
||||
delete _140;
|
||||
}
|
||||
|
||||
} // namespace ksys::act::ai
|
||||
@@ -0,0 +1,87 @@
|
||||
#pragma once
|
||||
|
||||
#include "KingSystem/ActorSystem/actAiAi.h"
|
||||
#include "KingSystem/ActorSystem/actAiParam.h"
|
||||
#include "KingSystem/Utils/Types.h"
|
||||
|
||||
namespace ksys::act::ai {
|
||||
|
||||
class Action;
|
||||
class Ai;
|
||||
class Behavior;
|
||||
class Query;
|
||||
|
||||
class IRootAi {
|
||||
public:
|
||||
virtual ~IRootAi() = default;
|
||||
};
|
||||
|
||||
template <typename Class>
|
||||
class ClassContainer {
|
||||
public:
|
||||
ClassContainer();
|
||||
~ClassContainer();
|
||||
|
||||
void finalize();
|
||||
|
||||
private:
|
||||
sead::Buffer<Class> classes;
|
||||
// TODO: rename
|
||||
sead::Buffer<Class> x;
|
||||
// TODO: rename
|
||||
sead::Buffer<Class> y;
|
||||
};
|
||||
|
||||
class RootAi : public Ai, public IRootAi {
|
||||
SEAD_RTTI_OVERRIDE(RootAi, Ai)
|
||||
public:
|
||||
explicit RootAi(const InitArg& arg);
|
||||
~RootAi() override;
|
||||
|
||||
bool isFlag4Set() const override { return true; }
|
||||
bool init_(sead::Heap* heap) override;
|
||||
void enter_(InlineParamPack* params) override;
|
||||
void leave_() override;
|
||||
bool m16() override;
|
||||
void calc() override;
|
||||
|
||||
const ParamPack& getMapUnitParams() const { return mMapUnitParams; }
|
||||
const ParamPack& getAiTreeParams() const { return mAiTreeParams; }
|
||||
|
||||
private:
|
||||
// TODO: rename and put this in a different translation unit
|
||||
struct SomeStruct {
|
||||
SomeStruct();
|
||||
virtual ~SomeStruct();
|
||||
|
||||
void* _8{};
|
||||
};
|
||||
KSYS_CHECK_SIZE_NX150(SomeStruct, 0x10);
|
||||
|
||||
void calc_() override;
|
||||
|
||||
f32 _40 = 1.0;
|
||||
u32 _44{};
|
||||
ClassContainer<Action> mActions;
|
||||
ClassContainer<Ai> mAis;
|
||||
ClassContainer<Behavior> mBehaviors;
|
||||
ClassContainer<Query> mQueries;
|
||||
sead::SafeArray<Behavior*, 3> mBehaviorsByStopAndCalcTiming[2]{};
|
||||
void* _138{};
|
||||
SomeStruct* _140{};
|
||||
u32 mMA_I{};
|
||||
u16 mAt{};
|
||||
u8 _14e{};
|
||||
void* _150{};
|
||||
void* _158{};
|
||||
void* _160{};
|
||||
// TODO: is this really an atomic?
|
||||
sead::Atomic<f32> _168 = 1.0;
|
||||
u16 _16c{};
|
||||
u16 _16e{};
|
||||
ParamPack mMapUnitParams;
|
||||
ParamPack mAiTreeParams;
|
||||
};
|
||||
KSYS_CHECK_SIZE_NX150(RootAi, 0x180);
|
||||
|
||||
} // namespace ksys::act::ai
|
||||
Reference in New Issue
Block a user