summaryrefslogtreecommitdiff
path: root/src/KingSystem/ActorSystem
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2021-10-16 14:51:18 +0200
committerLéo Lam <leo@leolam.fr>2021-10-16 16:15:18 +0200
commit89939a23004d79e607ee2878a092abb36827309e (patch)
tree48732247dd703e14e6fe885d20dd5bc843914aed /src/KingSystem/ActorSystem
parent892baf877f3551e30b277164bcab14218c8de4c1 (diff)
ksys: Start adding PhysicsUserTag
Diffstat (limited to 'src/KingSystem/ActorSystem')
-rw-r--r--src/KingSystem/ActorSystem/CMakeLists.txt2
-rw-r--r--src/KingSystem/ActorSystem/actPhysicsUserTag.cpp34
-rw-r--r--src/KingSystem/ActorSystem/actPhysicsUserTag.h36
3 files changed, 72 insertions, 0 deletions
diff --git a/src/KingSystem/ActorSystem/CMakeLists.txt b/src/KingSystem/ActorSystem/CMakeLists.txt
index c071fdf2..5c6a1b47 100644
--- a/src/KingSystem/ActorSystem/CMakeLists.txt
+++ b/src/KingSystem/ActorSystem/CMakeLists.txt
@@ -107,6 +107,8 @@ target_sources(uking PRIVATE
actInstParamPack.cpp
actInstParamPack.h
actLifeRecoveryInfo.h
+ actPhysicsUserTag.cpp
+ actPhysicsUserTag.h
actPlayerInfo.cpp
actPlayerInfo.h
actTag.h
diff --git a/src/KingSystem/ActorSystem/actPhysicsUserTag.cpp b/src/KingSystem/ActorSystem/actPhysicsUserTag.cpp
new file mode 100644
index 00000000..12f2f879
--- /dev/null
+++ b/src/KingSystem/ActorSystem/actPhysicsUserTag.cpp
@@ -0,0 +1,34 @@
+#include "KingSystem/ActorSystem/actPhysicsUserTag.h"
+#include "KingSystem/ActorSystem/actActor.h"
+#include "KingSystem/ActorSystem/actActorLinkConstDataAccess.h"
+#include "KingSystem/ActorSystem/actBaseProcMgr.h"
+
+namespace ksys::act {
+
+PhysicsUserTag::PhysicsUserTag(Actor* actor) : mActor(actor) {}
+
+PhysicsUserTag::~PhysicsUserTag() = default;
+
+Actor* PhysicsUserTag::getActor(ActorLinkConstDataAccess* accessor, Actor* other_actor) const {
+ if (mActor != nullptr) {
+ if (mActor != other_actor && !BaseProcMgr::instance()->isAccessingProcSafe(mActor, nullptr))
+ return mActor;
+ if (!acquireProc(accessor, mActor, "act::PhysicsUserTag"))
+ return nullptr;
+ }
+ return mActor;
+}
+
+bool PhysicsUserTag::acquireActor(ActorLinkConstDataAccess* accessor) const {
+ return accessor->acquire(mActor);
+}
+
+const sead::SafeString& PhysicsUserTag::getName() const {
+ return mActor->getName();
+}
+
+const sead::SafeString& PhysicsUserTag::getName2() const {
+ return getName();
+}
+
+} // namespace ksys::act
diff --git a/src/KingSystem/ActorSystem/actPhysicsUserTag.h b/src/KingSystem/ActorSystem/actPhysicsUserTag.h
new file mode 100644
index 00000000..0c47e866
--- /dev/null
+++ b/src/KingSystem/ActorSystem/actPhysicsUserTag.h
@@ -0,0 +1,36 @@
+#pragma once
+
+#include "KingSystem/Physics/System/physUserTag.h"
+#include "KingSystem/Utils/Types.h"
+
+namespace ksys::act {
+
+class Actor;
+class ActorLinkConstDataAccess;
+
+class PhysicsUserTag : public phys::UserTag {
+ SEAD_RTTI_OVERRIDE(PhysicsUserTag, phys::UserTag)
+
+public:
+ explicit PhysicsUserTag(Actor* actor);
+ ~PhysicsUserTag() override;
+
+ Actor* getActor(ActorLinkConstDataAccess* accessor, Actor* other_actor) const;
+ bool acquireActor(ActorLinkConstDataAccess* accessor) const;
+
+ void m2(void* a) override;
+ void m3(void* a, void* b, float c) override;
+ void m4() override;
+ void m5() override;
+ const sead::SafeString& getName() const override;
+ void m7() override;
+ const sead::SafeString& getName2() const override;
+
+private:
+ Actor* mActor = nullptr;
+ int _10 = -1;
+ u16 _14 = 0;
+};
+KSYS_CHECK_SIZE_NX150(PhysicsUserTag, 0x18);
+
+} // namespace ksys::act