mirror of https://github.com/zeldaret/botw.git
ksys/evt: Implement ActorBindings
This commit is contained in:
parent
5794d424c2
commit
1f628bb94a
|
@ -75801,12 +75801,12 @@
|
||||||
0x0000007100dc447c,evt::ActorBinding::getActorName,32,_ZNK4ksys3evt12ActorBinding12getActorNameEv
|
0x0000007100dc447c,evt::ActorBinding::getActorName,32,_ZNK4ksys3evt12ActorBinding12getActorNameEv
|
||||||
0x0000007100dc449c,evt::ActorBinding::getActorSubName,32,_ZNK4ksys3evt12ActorBinding15getActorSubNameEv
|
0x0000007100dc449c,evt::ActorBinding::getActorSubName,32,_ZNK4ksys3evt12ActorBinding15getActorSubNameEv
|
||||||
0x0000007100dc44bc,evt::ActorBinding::actorCreateStuff,1792,_ZNK4ksys3evt12ActorBinding18getActorCreateModeEPKNS_3act5ActorE
|
0x0000007100dc44bc,evt::ActorBinding::actorCreateStuff,1792,_ZNK4ksys3evt12ActorBinding18getActorCreateModeEPKNS_3act5ActorE
|
||||||
0x0000007100dc4bbc,evt::ActorBindings::allocActors,32,
|
0x0000007100dc4bbc,evt::ActorBindings::allocActors,32,_ZN4ksys3evt13ActorBindings13allocBindingsEPN4sead4HeapE
|
||||||
0x0000007100dc4bdc,evt::ActorBindings::allocActorActions,108,
|
0x0000007100dc4bdc,evt::ActorBindings::allocActorActions,108,_ZN4ksys3evt13ActorBindings20allocBindingsActionsEPN4sead4HeapE
|
||||||
0x0000007100dc4c48,evt::ActorBindings::allocActorQueries,108,
|
0x0000007100dc4c48,evt::ActorBindings::allocActorQueries,108,_ZN4ksys3evt13ActorBindings20allocBindingsQueriesEPN4sead4HeapE
|
||||||
0x0000007100dc4cb4,evt::ActorBindings::dtor,160,
|
0x0000007100dc4cb4,evt::ActorBindings::dtor,160,_ZN4ksys3evt13ActorBindingsD1Ev
|
||||||
0x0000007100dc4d54,evt::ActorBindings::dtorDelete,168,
|
0x0000007100dc4d54,evt::ActorBindings::dtorDelete,168,_ZN4ksys3evt13ActorBindingsD0Ev
|
||||||
0x0000007100dc4dfc,evt::ActorBindings::bindActor,448,
|
0x0000007100dc4dfc,evt::ActorBindings::bindActor,448,_ZN4ksys3evt13ActorBindings9bindActorEPKN4evfl8ResActorEPN4sead4HeapE
|
||||||
0x0000007100dc4fbc,ResourceFlowchart::ctor,216,
|
0x0000007100dc4fbc,ResourceFlowchart::ctor,216,
|
||||||
0x0000007100dc5094,sub_7100DC5094,312,
|
0x0000007100dc5094,sub_7100DC5094,312,
|
||||||
0x0000007100dc51cc,sub_7100DC51CC,36,
|
0x0000007100dc51cc,sub_7100DC51CC,36,
|
||||||
|
|
Can't render this file because it is too large.
|
|
@ -38,6 +38,23 @@ public:
|
||||||
const sead::PtrArray<const evfl::ResQuery>& getQueries() const { return mQueries; }
|
const sead::PtrArray<const evfl::ResQuery>& getQueries() const { return mQueries; }
|
||||||
ActorBindings* getParent() const { return mParent; }
|
ActorBindings* getParent() const { return mParent; }
|
||||||
|
|
||||||
|
void allocActions(sead::Heap* heap) {
|
||||||
|
if (mNumActionsToAlloc > 0)
|
||||||
|
mActions.allocBuffer(mNumActionsToAlloc, heap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void allocQueries(sead::Heap* heap) {
|
||||||
|
if (mNumQueriesToAlloc > 0)
|
||||||
|
mQueries.allocBuffer(mNumQueriesToAlloc, heap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void finalize() {
|
||||||
|
if (mActions.isBufferReady())
|
||||||
|
mActions.freeBuffer();
|
||||||
|
if (mQueries.isBufferReady())
|
||||||
|
mQueries.freeBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const evfl::ResActor* mResActor = nullptr;
|
const evfl::ResActor* mResActor = nullptr;
|
||||||
sead::PtrArray<const evfl::ResAction> mActions;
|
sead::PtrArray<const evfl::ResAction> mActions;
|
||||||
|
@ -46,6 +63,7 @@ private:
|
||||||
int _30 = 0;
|
int _30 = 0;
|
||||||
int mNumActionsToAlloc = 0;
|
int mNumActionsToAlloc = 0;
|
||||||
int mNumQueriesToAlloc = 0;
|
int mNumQueriesToAlloc = 0;
|
||||||
|
bool _3c = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ksys::evt
|
} // namespace ksys::evt
|
||||||
|
|
|
@ -1 +1,52 @@
|
||||||
#include "KingSystem/Event/evtActorBindings.h"
|
#include "KingSystem/Event/evtActorBindings.h"
|
||||||
|
#include <evfl/ResActor.h>
|
||||||
|
#include "KingSystem/Event/evtActorBinding.h"
|
||||||
|
|
||||||
|
namespace ksys::evt {
|
||||||
|
|
||||||
|
void ActorBindings::allocBindings(sead::Heap* heap) {
|
||||||
|
if (mNumActorsToAlloc != 0)
|
||||||
|
mBindings.allocBuffer(mNumActorsToAlloc, heap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ActorBindings::allocBindingsActions(sead::Heap* heap) {
|
||||||
|
for (int i = 0; i < mBindings.size(); ++i)
|
||||||
|
mBindings[i]->allocActions(heap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ActorBindings::allocBindingsQueries(sead::Heap* heap) {
|
||||||
|
for (int i = 0; i < mBindings.size(); ++i)
|
||||||
|
mBindings[i]->allocQueries(heap);
|
||||||
|
}
|
||||||
|
|
||||||
|
ActorBindings::~ActorBindings() {
|
||||||
|
for (int i = 0; i < mBindings.size(); ++i) {
|
||||||
|
mBindings[i]->finalize();
|
||||||
|
delete mBindings[i];
|
||||||
|
}
|
||||||
|
mBindings.freeBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
|
ActorBinding* ActorBindings::bindActor(const evfl::ResActor* res_actor, sead::Heap* heap) {
|
||||||
|
if (mBindings.isBufferReady()) {
|
||||||
|
for (int i = 0; i < mBindings.size(); ++i) {
|
||||||
|
const char* name = res_actor->name.Get()->data();
|
||||||
|
const char* sub_name = res_actor->secondary_name.Get()->data();
|
||||||
|
|
||||||
|
if (sead::SafeString(mBindings[i]->getRes()->name.Get()->data()) != name)
|
||||||
|
continue;
|
||||||
|
if (sead::SafeString(mBindings[i]->getRes()->secondary_name.Get()->data()) != sub_name)
|
||||||
|
continue;
|
||||||
|
return mBindings[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
auto* binding = new (heap) ActorBinding(res_actor, this);
|
||||||
|
mBindings.pushBack(binding);
|
||||||
|
return binding;
|
||||||
|
}
|
||||||
|
|
||||||
|
++mNumActorsToAlloc;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ksys::evt
|
||||||
|
|
|
@ -2,22 +2,33 @@
|
||||||
|
|
||||||
#include <container/seadPtrArray.h>
|
#include <container/seadPtrArray.h>
|
||||||
|
|
||||||
|
namespace evfl {
|
||||||
|
struct ResActor;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace sead {
|
||||||
|
class Heap;
|
||||||
|
}
|
||||||
|
|
||||||
namespace ksys::evt {
|
namespace ksys::evt {
|
||||||
|
|
||||||
class ActorBinding;
|
class ActorBinding;
|
||||||
|
|
||||||
// TODO
|
|
||||||
class ActorBindings {
|
class ActorBindings {
|
||||||
public:
|
public:
|
||||||
ActorBindings();
|
ActorBindings() = default;
|
||||||
virtual ~ActorBindings();
|
virtual ~ActorBindings();
|
||||||
|
|
||||||
int getNumActors() const { return mNumActors; }
|
void allocBindings(sead::Heap* heap);
|
||||||
|
void allocBindingsActions(sead::Heap* heap);
|
||||||
|
void allocBindingsQueries(sead::Heap* heap);
|
||||||
|
ActorBinding* bindActor(const evfl::ResActor* res_actor, sead::Heap* heap);
|
||||||
|
|
||||||
int isInitialized() const { return mInitialized; }
|
int isInitialized() const { return mInitialized; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
sead::PtrArray<ActorBinding> mBindings;
|
sead::PtrArray<ActorBinding> mBindings;
|
||||||
int mNumActors = 0;
|
int mNumActorsToAlloc = 0;
|
||||||
int mInitialized = 0;
|
int mInitialized = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue