mirror of https://github.com/zeldaret/botw.git
ksys/evt: Add ActorBinding
This commit is contained in:
parent
4b0a72025c
commit
ae60e06e4b
|
@ -75796,11 +75796,11 @@
|
|||
0x0000007100dc4348,sub_7100DC4348,52,
|
||||
0x0000007100dc437c,sub_7100DC437C,92,
|
||||
0x0000007100dc43d8,sub_7100DC43D8,52,
|
||||
0x0000007100dc440c,evt::ActorBinding::bindAction,60,
|
||||
0x0000007100dc4448,evt::ActorBinding::x,52,
|
||||
0x0000007100dc447c,evt::ActorBinding::getActorName,32,
|
||||
0x0000007100dc449c,evt::ActorBinding::getActorSubName,32,
|
||||
0x0000007100dc44bc,evt::ActorBinding::actorCreateStuff,1792,
|
||||
0x0000007100dc440c,evt::ActorBinding::bindAction,60,_ZN4ksys3evt12ActorBinding10bindActionEPKN4evfl9ResActionE
|
||||
0x0000007100dc4448,evt::ActorBinding::x,52,_ZN4ksys3evt12ActorBinding9bindQueryEPKN4evfl8ResQueryE
|
||||
0x0000007100dc447c,evt::ActorBinding::getActorName,32,_ZNK4ksys3evt12ActorBinding12getActorNameEv
|
||||
0x0000007100dc449c,evt::ActorBinding::getActorSubName,32,_ZNK4ksys3evt12ActorBinding15getActorSubNameEv
|
||||
0x0000007100dc44bc,evt::ActorBinding::actorCreateStuff,1792,_ZNK4ksys3evt12ActorBinding18getActorCreateModeEPKNS_3act5ActorE
|
||||
0x0000007100dc4bbc,evt::ActorBindings::allocActors,32,
|
||||
0x0000007100dc4bdc,evt::ActorBindings::allocActorActions,108,
|
||||
0x0000007100dc4c48,evt::ActorBindings::allocActorQueries,108,
|
||||
|
|
Can't render this file because it is too large.
|
|
@ -1 +1 @@
|
|||
Subproject commit 791199e37dc32a433632349056c8c9cad76f3077
|
||||
Subproject commit acfea6688dc1e3fc6f5dd7f6ea3aff3e5f3f2fc6
|
2
lib/sead
2
lib/sead
|
@ -1 +1 @@
|
|||
Subproject commit 99836715158ebf25dc32de417e050b25b0ed3122
|
||||
Subproject commit f787c2fbe4238fcb2922fa811921aefea000c676
|
|
@ -1,4 +1,8 @@
|
|||
target_sources(uking PRIVATE
|
||||
evtActorBinding.cpp
|
||||
evtActorBinding.h
|
||||
evtActorBindings.cpp
|
||||
evtActorBindings.h
|
||||
evtDemoInfo.cpp
|
||||
evtDemoInfo.h
|
||||
evtEvent.cpp
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
#include "KingSystem/Event/evtActorBinding.h"
|
||||
#include <evfl/ResActor.h>
|
||||
#include <ore/ResMetaData.h>
|
||||
#include "KingSystem/ActorSystem/actActor.h"
|
||||
#include "KingSystem/ActorSystem/actInfoData.h"
|
||||
#include "KingSystem/Event/evtActorBindings.h"
|
||||
|
||||
namespace ksys::evt {
|
||||
|
||||
void ActorBinding::bindAction(const evfl::ResAction* action) {
|
||||
if (mActions.isBufferReady())
|
||||
mActions.pushBack(action);
|
||||
else
|
||||
++mNumActionsToAlloc;
|
||||
}
|
||||
|
||||
void ActorBinding::bindQuery(const evfl::ResQuery* query) {
|
||||
if (mQueries.isBufferReady())
|
||||
mQueries.pushBack(query);
|
||||
else
|
||||
++mNumQueriesToAlloc;
|
||||
}
|
||||
|
||||
sead::SafeString ActorBinding::getActorName() const {
|
||||
return mResActor->name.Get()->data();
|
||||
}
|
||||
|
||||
sead::SafeString ActorBinding::getActorSubName() const {
|
||||
return mResActor->secondary_name.Get()->data();
|
||||
}
|
||||
|
||||
static bool isSelfOrStarter(const sead::SafeString& name) {
|
||||
return name.findIndex("Self") == 0 || name.findIndex("Starter") == 0;
|
||||
}
|
||||
|
||||
ActorBinding::ActorCreateMode ActorBinding::getActorCreateMode(const act::Actor* actor) const {
|
||||
if (getActorName() == "GameROMPlayer")
|
||||
return ActorCreateMode::k4;
|
||||
|
||||
if (getActorName() == "GameRomCamera")
|
||||
return ActorCreateMode::k5;
|
||||
|
||||
if (getActorName() == "Current")
|
||||
return ActorCreateMode::k8;
|
||||
|
||||
if (getActorName() == "Argument")
|
||||
return ActorCreateMode::k8;
|
||||
|
||||
if (isSelfOrStarter(getActorName()))
|
||||
return ActorCreateMode::k7;
|
||||
|
||||
if (getActorName() == "SignalFlowchart")
|
||||
return ActorCreateMode::k7;
|
||||
|
||||
const sead::SafeString actor_name = getActorName();
|
||||
if (actor_name == "DemoXLinkActor")
|
||||
return ActorCreateMode::k6;
|
||||
|
||||
if (mResActor->HasArgumentName())
|
||||
return ActorCreateMode::k7;
|
||||
|
||||
const auto* params = mResActor->params.Get();
|
||||
if (!params)
|
||||
return ActorCreateMode::k7;
|
||||
|
||||
auto* create_mode = params->Get("CreateMode", ore::ResMetaData::DataType::kInt);
|
||||
if (!create_mode)
|
||||
return ActorCreateMode::k0;
|
||||
|
||||
switch (create_mode->value.i) {
|
||||
case 0: {
|
||||
if (!mParent->isInitialized())
|
||||
return ActorCreateMode::k0;
|
||||
|
||||
const char* profile_c;
|
||||
act::InfoData::instance()->getActorProfile(&profile_c, actor_name.cstr());
|
||||
const sead::SafeString profile = profile_c;
|
||||
|
||||
if (actor && actor->getName() == getActorName() && getActorSubName().isEmpty())
|
||||
return ActorCreateMode::k7;
|
||||
|
||||
if (profile == "EventSystem" || profile == "ComplexTag" || profile == "SoleTag" ||
|
||||
profile == "System" || profile == "EventTag") {
|
||||
return ActorCreateMode::k0;
|
||||
}
|
||||
|
||||
return ActorCreateMode::k1;
|
||||
}
|
||||
case 1:
|
||||
return ActorCreateMode::k0;
|
||||
case 2:
|
||||
default:
|
||||
return ActorCreateMode::k1;
|
||||
case 3:
|
||||
return ActorCreateMode::k2;
|
||||
case 4:
|
||||
return ActorCreateMode::k3;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ksys::evt
|
|
@ -0,0 +1,50 @@
|
|||
#pragma once
|
||||
|
||||
#include <container/seadPtrArray.h>
|
||||
#include <prim/seadEnum.h>
|
||||
#include <prim/seadSafeString.h>
|
||||
|
||||
namespace evfl {
|
||||
struct ResAction;
|
||||
struct ResActor;
|
||||
struct ResQuery;
|
||||
} // namespace evfl
|
||||
|
||||
namespace ksys::act {
|
||||
class Actor;
|
||||
}
|
||||
|
||||
namespace ksys::evt {
|
||||
|
||||
class ActorBindings;
|
||||
|
||||
class ActorBinding {
|
||||
public:
|
||||
// TODO: rename these values after figuring out what they do
|
||||
SEAD_ENUM(ActorCreateMode, k0, k1, k2, k3, k4, k5, k6, k7, k8)
|
||||
|
||||
ActorBinding(const evfl::ResActor* res, ActorBindings* parent) : mResActor(res), mParent(parent) {}
|
||||
|
||||
void bindAction(const evfl::ResAction* action);
|
||||
void bindQuery(const evfl::ResQuery* query);
|
||||
|
||||
sead::SafeString getActorName() const;
|
||||
sead::SafeString getActorSubName() const;
|
||||
ActorCreateMode getActorCreateMode(const act::Actor* actor) const;
|
||||
|
||||
const evfl::ResActor* getRes() const { return mResActor; }
|
||||
const sead::PtrArray<const evfl::ResAction>& getActions() const { return mActions; }
|
||||
const sead::PtrArray<const evfl::ResQuery>& getQueries() const { return mQueries; }
|
||||
ActorBindings* getParent() const { return mParent; }
|
||||
|
||||
private:
|
||||
const evfl::ResActor* mResActor = nullptr;
|
||||
sead::PtrArray<const evfl::ResAction> mActions;
|
||||
sead::PtrArray<const evfl::ResQuery> mQueries;
|
||||
ActorBindings* mParent = nullptr;
|
||||
int _30 = 0;
|
||||
int mNumActionsToAlloc = 0;
|
||||
int mNumQueriesToAlloc = 0;
|
||||
};
|
||||
|
||||
} // namespace ksys::evt
|
|
@ -0,0 +1 @@
|
|||
#include "KingSystem/Event/evtActorBindings.h"
|
|
@ -0,0 +1,24 @@
|
|||
#pragma once
|
||||
|
||||
#include <container/seadPtrArray.h>
|
||||
|
||||
namespace ksys::evt {
|
||||
|
||||
class ActorBinding;
|
||||
|
||||
// TODO
|
||||
class ActorBindings {
|
||||
public:
|
||||
ActorBindings();
|
||||
virtual ~ActorBindings();
|
||||
|
||||
int getNumActors() const { return mNumActors; }
|
||||
int isInitialized() const { return mInitialized; }
|
||||
|
||||
private:
|
||||
sead::PtrArray<ActorBinding> mBindings;
|
||||
int mNumActors = 0;
|
||||
int mInitialized = 0;
|
||||
};
|
||||
|
||||
} // namespace ksys::evt
|
Loading…
Reference in New Issue