summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/uking_functions.csv16
-rw-r--r--src/KingSystem/ActorSystem/CMakeLists.txt2
-rw-r--r--src/KingSystem/ActorSystem/actActor.h9
-rw-r--r--src/KingSystem/ActorSystem/actAiAction.cpp3
-rw-r--r--src/KingSystem/ActorSystem/actAiAi.cpp3
-rw-r--r--src/KingSystem/ActorSystem/actAiBehavior.cpp3
-rw-r--r--src/KingSystem/ActorSystem/actAiQuery.cpp3
-rw-r--r--src/KingSystem/ActorSystem/actAiRoot.cpp19
-rw-r--r--src/KingSystem/ActorSystem/actAiRoot.h87
9 files changed, 136 insertions, 9 deletions
diff --git a/data/uking_functions.csv b/data/uking_functions.csv
index 89c96cb3..a6f7394e 100644
--- a/data/uking_functions.csv
+++ b/data/uking_functions.csv
@@ -74287,11 +74287,11 @@
0x0000007100d6422c,AI_AIForkAI::m31,316,
0x0000007100d64368,AI_AIForkAI::rtti1,288,
0x0000007100d64488,AI_AIForkAI::rtti2,92,
-0x0000007100d644e4,ai::ActorAI::ctor,152,
-0x0000007100d6457c,ai::ActorAI::dtor,188,
-0x0000007100d64638,sub_7100D64638,8,
-0x0000007100d64640,ai::ActorAI::dtorDelete,36,
-0x0000007100d64664,sub_7100D64664,40,
+0x0000007100d644e4,ai::ActorAI::ctor,152,_ZN4ksys3act2ai6RootAiC1ERKNS1_10ActionBase7InitArgE
+0x0000007100d6457c,ai::ActorAI::dtor,188,_ZN4ksys3act2ai6RootAiD1Ev
+0x0000007100d64638,sub_7100D64638,8,_ZThn56_N4ksys3act2ai6RootAiD1Ev
+0x0000007100d64640,ai::ActorAI::dtorDelete,36,_ZN4ksys3act2ai6RootAiD0Ev
+0x0000007100d64664,sub_7100D64664,40,_ZThn56_N4ksys3act2ai6RootAiD0Ev
0x0000007100d6468c,ai::ActorAI::createAiClass,996,
0x0000007100d64a70,ai::loadActorParamsIntoClassDef,592,
0x0000007100d64cc0,ai::ActorAI::loadMapUnitParams,36,
@@ -74332,9 +74332,9 @@
0x0000007100d66b48,sub_7100D66B48,68,
0x0000007100d66b8c,sub_7100D66B8C,8,
0x0000007100d66b94,sub_7100D66B94,176,
-0x0000007100d66c44,ai::ActorAI::rtti1,288,
-0x0000007100d66d64,ai::ActorAI::rtti2,92,
-0x0000007100d66dc0,ai::ActorAI::m6,8,
+0x0000007100d66c44,ai::ActorAI::rtti1,288,_ZNK4ksys3act2ai6RootAi27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE
+0x0000007100d66d64,ai::ActorAI::rtti2,92,_ZNK4ksys3act2ai6RootAi18getRuntimeTypeInfoEv
+0x0000007100d66dc0,ai::ActorAI::m6,8,_ZNK4ksys3act2ai6RootAi10isFlag4SetEv
0x0000007100d66dc8,sub_7100D66DC8,160,
0x0000007100d66e68,AI_BehaviorDummy::ctor,48,
0x0000007100d66e98,AI_BehaviorDummy::rtti1,204,
diff --git a/src/KingSystem/ActorSystem/CMakeLists.txt b/src/KingSystem/ActorSystem/CMakeLists.txt
index 2d47558e..97df84d5 100644
--- a/src/KingSystem/ActorSystem/CMakeLists.txt
+++ b/src/KingSystem/ActorSystem/CMakeLists.txt
@@ -35,6 +35,8 @@ target_sources(uking PRIVATE
actAiParam.h
actAiQuery.cpp
actAiQuery.h
+ actAiRoot.cpp
+ actAiRoot.h
actAttention.cpp
actAttention.h
actBaseProc.cpp
diff --git a/src/KingSystem/ActorSystem/actActor.h b/src/KingSystem/ActorSystem/actActor.h
index 2fa71ca5..b910671a 100644
--- a/src/KingSystem/ActorSystem/actActor.h
+++ b/src/KingSystem/ActorSystem/actActor.h
@@ -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;
diff --git a/src/KingSystem/ActorSystem/actAiAction.cpp b/src/KingSystem/ActorSystem/actAiAction.cpp
index 674a2e39..742605ad 100644
--- a/src/KingSystem/ActorSystem/actAiAction.cpp
+++ b/src/KingSystem/ActorSystem/actAiAction.cpp
@@ -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
diff --git a/src/KingSystem/ActorSystem/actAiAi.cpp b/src/KingSystem/ActorSystem/actAiAi.cpp
index d22e5c82..5dee7b68 100644
--- a/src/KingSystem/ActorSystem/actAiAi.cpp
+++ b/src/KingSystem/ActorSystem/actAiAi.cpp
@@ -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
diff --git a/src/KingSystem/ActorSystem/actAiBehavior.cpp b/src/KingSystem/ActorSystem/actAiBehavior.cpp
index ea86c732..c6e5b327 100644
--- a/src/KingSystem/ActorSystem/actAiBehavior.cpp
+++ b/src/KingSystem/ActorSystem/actAiBehavior.cpp
@@ -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
diff --git a/src/KingSystem/ActorSystem/actAiQuery.cpp b/src/KingSystem/ActorSystem/actAiQuery.cpp
index f38ab676..ca97fc67 100644
--- a/src/KingSystem/ActorSystem/actAiQuery.cpp
+++ b/src/KingSystem/ActorSystem/actAiQuery.cpp
@@ -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
diff --git a/src/KingSystem/ActorSystem/actAiRoot.cpp b/src/KingSystem/ActorSystem/actAiRoot.cpp
new file mode 100644
index 00000000..041ab86c
--- /dev/null
+++ b/src/KingSystem/ActorSystem/actAiRoot.cpp
@@ -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
diff --git a/src/KingSystem/ActorSystem/actAiRoot.h b/src/KingSystem/ActorSystem/actAiRoot.h
new file mode 100644
index 00000000..e80ec01b
--- /dev/null
+++ b/src/KingSystem/ActorSystem/actAiRoot.h
@@ -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