mirror of https://github.com/zeldaret/botw.git
ksys/act: Start adding RootAi
This commit is contained in:
parent
cd10f3774b
commit
fcbe17a3f0
|
|
@ -74287,11 +74287,11 @@
|
||||||
0x0000007100d6422c,AI_AIForkAI::m31,316,
|
0x0000007100d6422c,AI_AIForkAI::m31,316,
|
||||||
0x0000007100d64368,AI_AIForkAI::rtti1,288,
|
0x0000007100d64368,AI_AIForkAI::rtti1,288,
|
||||||
0x0000007100d64488,AI_AIForkAI::rtti2,92,
|
0x0000007100d64488,AI_AIForkAI::rtti2,92,
|
||||||
0x0000007100d644e4,ai::ActorAI::ctor,152,
|
0x0000007100d644e4,ai::ActorAI::ctor,152,_ZN4ksys3act2ai6RootAiC1ERKNS1_10ActionBase7InitArgE
|
||||||
0x0000007100d6457c,ai::ActorAI::dtor,188,
|
0x0000007100d6457c,ai::ActorAI::dtor,188,_ZN4ksys3act2ai6RootAiD1Ev
|
||||||
0x0000007100d64638,sub_7100D64638,8,
|
0x0000007100d64638,sub_7100D64638,8,_ZThn56_N4ksys3act2ai6RootAiD1Ev
|
||||||
0x0000007100d64640,ai::ActorAI::dtorDelete,36,
|
0x0000007100d64640,ai::ActorAI::dtorDelete,36,_ZN4ksys3act2ai6RootAiD0Ev
|
||||||
0x0000007100d64664,sub_7100D64664,40,
|
0x0000007100d64664,sub_7100D64664,40,_ZThn56_N4ksys3act2ai6RootAiD0Ev
|
||||||
0x0000007100d6468c,ai::ActorAI::createAiClass,996,
|
0x0000007100d6468c,ai::ActorAI::createAiClass,996,
|
||||||
0x0000007100d64a70,ai::loadActorParamsIntoClassDef,592,
|
0x0000007100d64a70,ai::loadActorParamsIntoClassDef,592,
|
||||||
0x0000007100d64cc0,ai::ActorAI::loadMapUnitParams,36,
|
0x0000007100d64cc0,ai::ActorAI::loadMapUnitParams,36,
|
||||||
|
|
@ -74332,9 +74332,9 @@
|
||||||
0x0000007100d66b48,sub_7100D66B48,68,
|
0x0000007100d66b48,sub_7100D66B48,68,
|
||||||
0x0000007100d66b8c,sub_7100D66B8C,8,
|
0x0000007100d66b8c,sub_7100D66B8C,8,
|
||||||
0x0000007100d66b94,sub_7100D66B94,176,
|
0x0000007100d66b94,sub_7100D66B94,176,
|
||||||
0x0000007100d66c44,ai::ActorAI::rtti1,288,
|
0x0000007100d66c44,ai::ActorAI::rtti1,288,_ZNK4ksys3act2ai6RootAi27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE
|
||||||
0x0000007100d66d64,ai::ActorAI::rtti2,92,
|
0x0000007100d66d64,ai::ActorAI::rtti2,92,_ZNK4ksys3act2ai6RootAi18getRuntimeTypeInfoEv
|
||||||
0x0000007100d66dc0,ai::ActorAI::m6,8,
|
0x0000007100d66dc0,ai::ActorAI::m6,8,_ZNK4ksys3act2ai6RootAi10isFlag4SetEv
|
||||||
0x0000007100d66dc8,sub_7100D66DC8,160,
|
0x0000007100d66dc8,sub_7100D66DC8,160,
|
||||||
0x0000007100d66e68,AI_BehaviorDummy::ctor,48,
|
0x0000007100d66e68,AI_BehaviorDummy::ctor,48,
|
||||||
0x0000007100d66e98,AI_BehaviorDummy::rtti1,204,
|
0x0000007100d66e98,AI_BehaviorDummy::rtti1,204,
|
||||||
|
|
|
||||||
|
Can't render this file because it is too large.
|
|
|
@ -35,6 +35,8 @@ target_sources(uking PRIVATE
|
||||||
actAiParam.h
|
actAiParam.h
|
||||||
actAiQuery.cpp
|
actAiQuery.cpp
|
||||||
actAiQuery.h
|
actAiQuery.h
|
||||||
|
actAiRoot.cpp
|
||||||
|
actAiRoot.h
|
||||||
actAttention.cpp
|
actAttention.cpp
|
||||||
actAttention.h
|
actAttention.h
|
||||||
actBaseProc.cpp
|
actBaseProc.cpp
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,10 @@ namespace ksys {
|
||||||
|
|
||||||
namespace act {
|
namespace act {
|
||||||
|
|
||||||
|
namespace ai {
|
||||||
|
class RootAi;
|
||||||
|
}
|
||||||
|
|
||||||
class LifeRecoverInfo;
|
class LifeRecoverInfo;
|
||||||
class ActorParam;
|
class ActorParam;
|
||||||
|
|
||||||
|
|
@ -39,7 +43,10 @@ public:
|
||||||
const sead::TypedBitFlag<StasisFlag>& getStasisFlags() const { return mStasisFlags; }
|
const sead::TypedBitFlag<StasisFlag>& getStasisFlags() const { return mStasisFlags; }
|
||||||
|
|
||||||
protected:
|
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;
|
/* 0x570 */ ActorParam* mActorParam;
|
||||||
/* 0x578 */ u8 TEMP_0x578[0x648 - 0x578];
|
/* 0x578 */ u8 TEMP_0x578[0x648 - 0x578];
|
||||||
/* 0x648 */ map::MubinIter mMapObjIter;
|
/* 0x648 */ map::MubinIter mMapObjIter;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include "KingSystem/ActorSystem/actAiAction.h"
|
#include "KingSystem/ActorSystem/actAiAction.h"
|
||||||
|
#include "KingSystem/ActorSystem/actAiRoot.h"
|
||||||
|
|
||||||
namespace ksys::act::ai {
|
namespace ksys::act::ai {
|
||||||
|
|
||||||
|
|
@ -8,4 +9,6 @@ void Action::calc() {
|
||||||
calc_();
|
calc_();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template class ClassContainer<Action>;
|
||||||
|
|
||||||
} // namespace ksys::act::ai
|
} // namespace ksys::act::ai
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include "KingSystem/ActorSystem/actAiAi.h"
|
#include "KingSystem/ActorSystem/actAiAi.h"
|
||||||
|
#include "KingSystem/ActorSystem/actAiRoot.h"
|
||||||
|
|
||||||
namespace ksys::act::ai {
|
namespace ksys::act::ai {
|
||||||
|
|
||||||
|
|
@ -44,4 +45,6 @@ void Ai::updateChildIdx(u16 new_idx) {
|
||||||
mPendingChildIdx = InvalidIdx;
|
mPendingChildIdx = InvalidIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template class ClassContainer<Ai>;
|
||||||
|
|
||||||
} // namespace ksys::act::ai
|
} // namespace ksys::act::ai
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
#include "KingSystem/ActorSystem/actAiBehavior.h"
|
#include "KingSystem/ActorSystem/actAiBehavior.h"
|
||||||
|
#include "KingSystem/ActorSystem/actAiRoot.h"
|
||||||
|
|
||||||
namespace ksys::act::ai {
|
namespace ksys::act::ai {
|
||||||
|
|
||||||
Behavior::Behavior(const InitArg& arg)
|
Behavior::Behavior(const InitArg& arg)
|
||||||
: mActor(arg.actor), mDefIdx(static_cast<u16>(arg.def_idx)) {}
|
: mActor(arg.actor), mDefIdx(static_cast<u16>(arg.def_idx)) {}
|
||||||
|
|
||||||
|
template class ClassContainer<Behavior>;
|
||||||
|
|
||||||
} // namespace ksys::act::ai
|
} // namespace ksys::act::ai
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
#include "KingSystem/ActorSystem/actAiQuery.h"
|
#include "KingSystem/ActorSystem/actAiQuery.h"
|
||||||
|
#include "KingSystem/ActorSystem/actAiRoot.h"
|
||||||
|
|
||||||
namespace ksys::act::ai {
|
namespace ksys::act::ai {
|
||||||
|
|
||||||
Query::Query(const InitArg& arg) : mActor(arg.actor), mDefIdx(arg.def_idx) {}
|
Query::Query(const InitArg& arg) : mActor(arg.actor), mDefIdx(arg.def_idx) {}
|
||||||
|
|
||||||
|
template class ClassContainer<Query>;
|
||||||
|
|
||||||
} // namespace ksys::act::ai
|
} // 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
|
||||||
Loading…
Reference in New Issue