diff options
| author | Léo Lam <leo@leolam.fr> | 2021-10-16 18:05:41 +0200 |
|---|---|---|
| committer | Léo Lam <leo@leolam.fr> | 2021-10-17 23:32:24 +0200 |
| commit | 5580b4934565823844a7fa02ad0eb62cc7e3ab55 (patch) | |
| tree | 66b81437bf05550e6e6e50a7e9ebe4f2ade81c30 /src/KingSystem/ActorSystem/actActor.cpp | |
| parent | 8056fb38813a42a429673f5a444f14fbd211c1b5 (diff) | |
ksys/act: Add more Actor members
Diffstat (limited to 'src/KingSystem/ActorSystem/actActor.cpp')
| -rw-r--r-- | src/KingSystem/ActorSystem/actActor.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/KingSystem/ActorSystem/actActor.cpp b/src/KingSystem/ActorSystem/actActor.cpp index 7d93a0a5..8346b964 100644 --- a/src/KingSystem/ActorSystem/actActor.cpp +++ b/src/KingSystem/ActorSystem/actActor.cpp @@ -1,6 +1,8 @@ #include "KingSystem/ActorSystem/actActor.h" #include "KingSystem/ActorSystem/actActorParam.h" +#include "KingSystem/ActorSystem/actAiRoot.h" #include "KingSystem/ActorSystem/actBaseProcLink.h" +#include "KingSystem/ActorSystem/actBaseProcMgr.h" namespace ksys::act { @@ -12,8 +14,71 @@ BaseProcLink& getDummyBaseProcLink() { return sDummyBaseProcLink; } +Actor::Actor(const CreateArg& arg) : BaseProc(arg) { + mJobHandlers[BaseProcMgr::getConstant0()] = &mJob0; + mJobHandlers[BaseProcMgr::getConstant1()] = &mJob1; + mJobHandlers[BaseProcMgr::getConstant2()] = &mJob2; + mJobHandlers[BaseProcMgr::getConstant4()] = &mJob4; + + mUnk1.actor = this; + mUnk1._4 = 0; +} + +Actor::~Actor() { + // FIXME +} + +void Actor::clearFlag(Actor::ActorFlag flag) { + mActorFlags.resetBit(flag); +} + +bool Actor::checkFlag(Actor::ActorFlag flag) const { + return mActorFlags.isOnBit(flag); +} + +void Actor::setFlag(Actor::ActorFlag flag) { + setFlag(flag, true); +} + +void Actor::setFlag(Actor::ActorFlag flag, bool on) { + mActorFlags.changeBit(flag, on); +} + const sead::SafeString& Actor::getProfile() const { return mActorParam->getProfile(); } +const char* Actor::getUniqueName() const { + const char* unique_name = nullptr; + + if (mMapObjIter.tryGetParamStringByKey(&unique_name, "UniqueName")) + return unique_name; + + if (mUniqueName && mUniqueName->unique_name) + unique_name = mUniqueName->unique_name->cstr(); + + return unique_name; +} + +void Actor::handleAck(const MessageAck& ack) { + if (m80()) + return; + + if (mRootAi) + mRootAi->handleAck(ack); +} + +int Actor::handleMessage(const Message& message) { + const auto result = doHandleMessage_(message); + switch (result) { + default: + return 0; + case HandleMessageResult::_1: + return 1; + case HandleMessageResult::_2: + m107(); + return 1; + } +} + } // namespace ksys::act |
