mirror of https://github.com/zeldaret/botw.git
ksys: Replace ClassContainer<T> with 4 different classes
Some functions look really similar but other functions have significant differences, so it is probably not a class template.
This commit is contained in:
parent
19ef291d20
commit
058cca1a3f
|
@ -9,6 +9,4 @@ void Action::calc() {
|
|||
calc_();
|
||||
}
|
||||
|
||||
template class ClassContainer<Action>;
|
||||
|
||||
} // namespace ksys::act::ai
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <container/seadBuffer.h>
|
||||
#include "KingSystem/ActorSystem/actAiActionBase.h"
|
||||
#include "KingSystem/Utils/Types.h"
|
||||
|
||||
|
@ -18,4 +19,18 @@ protected:
|
|||
};
|
||||
KSYS_CHECK_SIZE_NX150(Action, 0x20);
|
||||
|
||||
class Actions {
|
||||
public:
|
||||
Actions();
|
||||
~Actions();
|
||||
|
||||
void finalize();
|
||||
|
||||
sead::Buffer<Action*> classes;
|
||||
// TODO: rename
|
||||
sead::Buffer<Action*> x;
|
||||
// TODO: rename
|
||||
sead::Buffer<Action*> y;
|
||||
};
|
||||
|
||||
} // namespace ksys::act::ai
|
||||
|
|
|
@ -105,6 +105,4 @@ void Ai::updateChildIdx(u16 new_idx) {
|
|||
mPendingChildIdx = InvalidIdx;
|
||||
}
|
||||
|
||||
template class ClassContainer<Ai>;
|
||||
|
||||
} // namespace ksys::act::ai
|
||||
|
|
|
@ -46,4 +46,18 @@ private:
|
|||
};
|
||||
KSYS_CHECK_SIZE_NX150(Ai, 0x38);
|
||||
|
||||
class Ais {
|
||||
public:
|
||||
Ais();
|
||||
~Ais();
|
||||
|
||||
void finalize();
|
||||
|
||||
sead::Buffer<Ai*> classes;
|
||||
// TODO: rename
|
||||
sead::Buffer<Ai*> x;
|
||||
// TODO: rename
|
||||
sead::Buffer<Ai*> y;
|
||||
};
|
||||
|
||||
} // namespace ksys::act::ai
|
||||
|
|
|
@ -6,6 +6,4 @@ 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,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <basis/seadTypes.h>
|
||||
#include <container/seadBuffer.h>
|
||||
#include <prim/seadRuntimeTypeInfo.h>
|
||||
#include "KingSystem/Utils/Types.h"
|
||||
|
||||
|
@ -45,4 +46,18 @@ protected:
|
|||
};
|
||||
KSYS_CHECK_SIZE_NX150(Behavior, 0x28);
|
||||
|
||||
class Behaviors {
|
||||
public:
|
||||
Behaviors();
|
||||
~Behaviors();
|
||||
|
||||
void finalize();
|
||||
|
||||
sead::Buffer<Behavior*> classes;
|
||||
// TODO: rename
|
||||
sead::Buffer<Behavior*> x;
|
||||
// TODO: rename
|
||||
sead::Buffer<Behavior*> y;
|
||||
};
|
||||
|
||||
} // namespace ksys::act::ai
|
||||
|
|
|
@ -77,6 +77,4 @@ bool Query::getAITreeVariable(void** value, const sead::SafeString& param) const
|
|||
return mActor->getRootAi()->getAITreeVariable(value, param);
|
||||
}
|
||||
|
||||
template class ClassContainer<Query>;
|
||||
|
||||
} // namespace ksys::act::ai
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <basis/seadTypes.h>
|
||||
#include <container/seadBuffer.h>
|
||||
#include <prim/seadRuntimeTypeInfo.h>
|
||||
#include "KingSystem/ActorSystem/actAiParam.h"
|
||||
#include "KingSystem/Utils/Types.h"
|
||||
|
@ -79,4 +80,18 @@ protected:
|
|||
};
|
||||
KSYS_CHECK_SIZE_NX150(Query, 0x20);
|
||||
|
||||
class Queries {
|
||||
public:
|
||||
Queries();
|
||||
~Queries();
|
||||
|
||||
void finalize();
|
||||
|
||||
sead::Buffer<Query*> classes;
|
||||
// TODO: rename
|
||||
sead::Buffer<Query*> x;
|
||||
// TODO: rename
|
||||
sead::Buffer<Query*> y;
|
||||
};
|
||||
|
||||
} // namespace ksys::act::ai
|
||||
|
|
|
@ -1,37 +1,20 @@
|
|||
#pragma once
|
||||
|
||||
#include <prim/seadTypedBitFlag.h>
|
||||
#include "KingSystem/ActorSystem/actAiAction.h"
|
||||
#include "KingSystem/ActorSystem/actAiAi.h"
|
||||
#include "KingSystem/ActorSystem/actAiBehavior.h"
|
||||
#include "KingSystem/ActorSystem/actAiParam.h"
|
||||
#include "KingSystem/ActorSystem/actAiQuery.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();
|
||||
|
||||
sead::Buffer<Class*> classes;
|
||||
// TODO: rename
|
||||
sead::Buffer<Class*> x;
|
||||
// TODO: rename
|
||||
sead::Buffer<Class*> y;
|
||||
};
|
||||
|
||||
enum class RootAiFlag : u16 {
|
||||
_100 = 0x100, // 8
|
||||
};
|
||||
|
@ -57,10 +40,10 @@ public:
|
|||
u32 getI() const { return mI; }
|
||||
bool isActorDeletedOrDeleting() const;
|
||||
|
||||
const ClassContainer<Action>& getActions() const { return mActions; }
|
||||
const ClassContainer<Ai>& getAis() const { return mAis; }
|
||||
const ClassContainer<Behavior>& getBehaviors() const { return mBehaviors; }
|
||||
const ClassContainer<Query>& getQueries() const { return mQueries; }
|
||||
const Actions& getActions() const { return mActions; }
|
||||
const Ais& getAis() const { return mAis; }
|
||||
const Behaviors& getBehaviors() const { return mBehaviors; }
|
||||
const Queries& getQueries() const { return mQueries; }
|
||||
|
||||
bool loadMapUnitParams(const AIDef& def, sead::Heap* heap);
|
||||
bool loadAITreeParams(const AIDef& def, sead::Heap* heap);
|
||||
|
@ -102,10 +85,10 @@ private:
|
|||
|
||||
f32 _40 = 1.0;
|
||||
u32 _44{};
|
||||
ClassContainer<Action> mActions;
|
||||
ClassContainer<Ai> mAis;
|
||||
ClassContainer<Behavior> mBehaviors;
|
||||
ClassContainer<Query> mQueries;
|
||||
Actions mActions;
|
||||
Ais mAis;
|
||||
Behaviors mBehaviors;
|
||||
Queries mQueries;
|
||||
sead::SafeArray<Behavior*, 3> mBehaviorsByStopAndCalcTiming[2]{};
|
||||
void* _138{};
|
||||
SomeStruct* _140{};
|
||||
|
|
Loading…
Reference in New Issue