ksys: Start adding PhysicsUserTag

This commit is contained in:
Léo Lam
2021-10-16 14:51:18 +02:00
parent 892baf877f
commit 89939a2300
7 changed files with 136 additions and 16 deletions
@@ -107,6 +107,8 @@ target_sources(uking PRIVATE
actInstParamPack.cpp
actInstParamPack.h
actLifeRecoveryInfo.h
actPhysicsUserTag.cpp
actPhysicsUserTag.h
actPlayerInfo.cpp
actPlayerInfo.h
actTag.h
@@ -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
@@ -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
+2
View File
@@ -28,4 +28,6 @@ target_sources(uking PRIVATE
System/physRagdollControllerKeyList.cpp
System/physShapeParam.cpp
System/physShapeParam.h
System/physUserTag.cpp
System/physUserTag.h
)
@@ -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
@@ -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