ksys/act: Add more ActorConstDataAccess functions

Implements a couple of simple wrappers around BaseProc member functions
This commit is contained in:
Léo Lam 2020-09-17 17:47:32 +02:00
parent 7226150ed7
commit 76378caa60
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
3 changed files with 48 additions and 5 deletions

View File

@ -71184,7 +71184,7 @@
0x0000007100d0df3c,act::acc::Actor::isNPCClass,136,
0x0000007100d0dfc4,sub_7100D0DFC4,136,
0x0000007100d0e04c,ActorAccessor::getActorProfile,156,
0x0000007100d0e0e8,ActorAccessor::getName,156,
0x0000007100d0e0e8,ActorAccessor::getName,156,_ZNK4ksys3act20ActorConstDataAccess7getNameEv
0x0000007100d0e184,sub_7100D0E184,176,
0x0000007100d0e234,sub_7100D0E234,180,
0x0000007100d0e2e8,sub_7100D0E2E8,180,
@ -71192,9 +71192,9 @@
0x0000007100d0e43c,act::acc::Actor::hasTagByName,160,
0x0000007100d0e4dc,act::acc::Actor::hasTag,160,
0x0000007100d0e57c,sub_7100D0E57C,148,
0x0000007100d0e610,ActorAccessor::getId,140,
0x0000007100d0e69c,sub_7100D0E69C,280,
0x0000007100d0e7b4,sub_7100D0E7B4,280,
0x0000007100d0e610,ActorAccessor::getId,140,_ZNK4ksys3act20ActorConstDataAccess5getIdEv
0x0000007100d0e69c,sub_7100D0E69C,280,_ZNK4ksys3act20ActorConstDataAccess26acquireConnectedCalcParentEPNS0_24ActorLinkConstDataAccessE
0x0000007100d0e7b4,sub_7100D0E7B4,280,_ZNK4ksys3act20ActorConstDataAccess25acquireConnectedCalcChildEPNS0_24ActorLinkConstDataAccessE
0x0000007100d0e8cc,sub_7100D0E8CC,152,
0x0000007100d0e964,act::act::Actor::deleteLater,156,
0x0000007100d0ea00,act::acc::Actor::fadeOutDelete,164,
@ -71232,7 +71232,7 @@
0x0000007100d0ff48,sub_7100D0FF48,148,
0x0000007100d0ffdc,sub_7100D0FFDC,196,
0x0000007100d100a0,sub_7100D100A0,152,
0x0000007100d10138,sub_7100D10138,248,
0x0000007100d10138,sub_7100D10138,248,_ZNK4ksys3act20ActorConstDataAccess22hasConnectedCalcParentEv
0x0000007100d10230,sub_7100D10230,368,
0x0000007100d103a0,act::acc::Actor::x,168,
0x0000007100d10448,sub_7100D10448,168,

Can't render this file because it is too large.

View File

@ -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) {

View File

@ -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);