summaryrefslogtreecommitdiff
path: root/src/KingSystem/ActorSystem
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2020-09-17 17:47:32 +0200
committerLéo Lam <leo@leolam.fr>2020-09-17 18:31:36 +0200
commit76378caa60cee9373416259d2b53a4abcedfe369 (patch)
treeba8ca36f53692409da6a2a13efbe9017ef7d82ed /src/KingSystem/ActorSystem
parent7226150ed73479695230c0b9747923c1a851512c (diff)
ksys/act: Add more ActorConstDataAccess functions
Implements a couple of simple wrappers around BaseProc member functions
Diffstat (limited to 'src/KingSystem/ActorSystem')
-rw-r--r--src/KingSystem/ActorSystem/actActorConstDataAccess.cpp37
-rw-r--r--src/KingSystem/ActorSystem/actActorConstDataAccess.h6
2 files changed, 43 insertions, 0 deletions
diff --git a/src/KingSystem/ActorSystem/actActorConstDataAccess.cpp b/src/KingSystem/ActorSystem/actActorConstDataAccess.cpp
index ff3ccf22..1765c745 100644
--- a/src/KingSystem/ActorSystem/actActorConstDataAccess.cpp
+++ b/src/KingSystem/ActorSystem/actActorConstDataAccess.cpp
@@ -44,6 +44,43 @@ void ActorConstDataAccess::debugLog(s32, const sead::SafeString&) const {
// Intentionally left empty.
}
+const sead::SafeString& ActorConstDataAccess::getName() const {
+ auto* proc = getProcIfActor(mProc);
+ if (!proc)
+ return sead::SafeString::cEmptyString;
+ return proc->getName();
+}
+
+u32 ActorConstDataAccess::getId() const {
+ auto* proc = getProcIfActor(mProc);
+ if (!proc)
+ return 0xffffffff;
+ return proc->getId();
+}
+
+bool ActorConstDataAccess::acquireConnectedCalcParent(ActorLinkConstDataAccess* accessor) const {
+ auto* proc = getProcIfActor(mProc);
+ if (!proc)
+ return false;
+
+ accessor->acquire(sead::DynamicCast<Actor>(proc->getConnectedCalcParent()));
+ return accessor->mProc != nullptr;
+}
+
+bool ActorConstDataAccess::acquireConnectedCalcChild(ActorLinkConstDataAccess* accessor) const {
+ auto* proc = getProcIfActor(mProc);
+ if (!proc)
+ return false;
+
+ accessor->acquire(sead::DynamicCast<Actor>(proc->getConnectedCalcChild()));
+ return accessor->mProc != nullptr;
+}
+
+bool ActorConstDataAccess::hasConnectedCalcParent() const {
+ auto* proc = getProcIfActor(mProc);
+ return proc && sead::DynamicCast<Actor>(proc->getConnectedCalcParent()) != nullptr;
+}
+
bool acquireActor(BaseProcLink* link, ActorConstDataAccess* accessor) {
return link->getProcInContext([accessor](BaseProc* proc, bool valid) {
if (!proc) {
diff --git a/src/KingSystem/ActorSystem/actActorConstDataAccess.h b/src/KingSystem/ActorSystem/actActorConstDataAccess.h
index 75dba7ce..5b1ff203 100644
--- a/src/KingSystem/ActorSystem/actActorConstDataAccess.h
+++ b/src/KingSystem/ActorSystem/actActorConstDataAccess.h
@@ -20,6 +20,12 @@ public:
bool linkAcquireImmediately(BaseProcLink* link) const;
void debugLog(s32, const sead::SafeString& method_name) const;
+
+ const sead::SafeString& getName() const;
+ u32 getId() const;
+ bool acquireConnectedCalcParent(ActorLinkConstDataAccess* accessor) const;
+ bool acquireConnectedCalcChild(ActorLinkConstDataAccess* accessor) const;
+ bool hasConnectedCalcParent() const;
};
bool acquireActor(BaseProcLink* link, ActorConstDataAccess* accessor);