diff options
| author | Léo Lam <leo@leolam.fr> | 2021-10-16 14:51:18 +0200 |
|---|---|---|
| committer | Léo Lam <leo@leolam.fr> | 2021-10-16 16:15:18 +0200 |
| commit | 89939a23004d79e607ee2878a092abb36827309e (patch) | |
| tree | 48732247dd703e14e6fe885d20dd5bc843914aed /src | |
| parent | 892baf877f3551e30b277164bcab14218c8de4c1 (diff) | |
ksys: Start adding PhysicsUserTag
Diffstat (limited to 'src')
| -rw-r--r-- | src/KingSystem/ActorSystem/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/KingSystem/ActorSystem/actPhysicsUserTag.cpp | 34 | ||||
| -rw-r--r-- | src/KingSystem/ActorSystem/actPhysicsUserTag.h | 36 | ||||
| -rw-r--r-- | src/KingSystem/Physics/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/KingSystem/Physics/System/physUserTag.cpp | 19 | ||||
| -rw-r--r-- | src/KingSystem/Physics/System/physUserTag.h | 27 |
6 files changed, 120 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 diff --git a/src/KingSystem/Physics/CMakeLists.txt b/src/KingSystem/Physics/CMakeLists.txt index 738ff5d9..48a5745b 100644 --- a/src/KingSystem/Physics/CMakeLists.txt +++ b/src/KingSystem/Physics/CMakeLists.txt @@ -28,4 +28,6 @@ target_sources(uking PRIVATE System/physRagdollControllerKeyList.cpp System/physShapeParam.cpp System/physShapeParam.h + System/physUserTag.cpp + System/physUserTag.h ) diff --git a/src/KingSystem/Physics/System/physUserTag.cpp b/src/KingSystem/Physics/System/physUserTag.cpp new file mode 100644 index 00000000..165f8493 --- /dev/null +++ b/src/KingSystem/Physics/System/physUserTag.cpp @@ -0,0 +1,19 @@ +#include "KingSystem/Physics/System/physUserTag.h" + +namespace ksys::phys { + +void UserTag::m2(void* a) { + // FIXME +} + +void UserTag::m3(void* a, void* b, float c) { + // FIXME +} + +void UserTag::m4() {} + +void UserTag::m5() {} + +void UserTag::m7() {} + +} // namespace ksys::phys diff --git a/src/KingSystem/Physics/System/physUserTag.h b/src/KingSystem/Physics/System/physUserTag.h new file mode 100644 index 00000000..e4fb471f --- /dev/null +++ b/src/KingSystem/Physics/System/physUserTag.h @@ -0,0 +1,27 @@ +#pragma once + +#include <prim/seadRuntimeTypeInfo.h> +#include <prim/seadSafeString.h> +#include "KingSystem/Utils/Types.h" + +namespace ksys::phys { + +class UserTag { + SEAD_RTTI_BASE(UserTag) +public: + UserTag() = default; + + // FIXME: names and types + virtual void m2(void* a); + // a and b are probably physics bodies? + virtual void m3(void* a, void* b, float c); + virtual void m4(); + virtual void m5(); + virtual const sead::SafeString& getName() const { return sead::SafeString::cEmptyString; } + virtual void m7(); + virtual const sead::SafeString& getName2() const { return sead::SafeString::cEmptyString; } + virtual ~UserTag() = default; +}; +KSYS_CHECK_SIZE_NX150(UserTag, 0x8); + +} // namespace ksys::phys |
