summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2020-11-08 00:48:51 +0100
committerLéo Lam <leo@leolam.fr>2020-11-08 00:56:14 +0100
commitf9456b5b1cda7f8a2b2fb53080d8f2ebaf544e61 (patch)
treeeef8c2aff1bb85dc78988e25a774508b141406b0 /src
parent3bd9d7a599a54519ca766f2e7ae476d35d13f67a (diff)
ksys: Fix ActorParam struct
Diffstat (limited to 'src')
-rw-r--r--src/KingSystem/ActorSystem/CMakeLists.txt2
-rw-r--r--src/KingSystem/ActorSystem/actActorParam.cpp21
-rw-r--r--src/KingSystem/ActorSystem/actActorParam.h106
-rw-r--r--src/KingSystem/ActorSystem/actActorParamMgr.h25
-rw-r--r--src/KingSystem/ActorSystem/actBaseProcJob.h2
-rw-r--r--src/KingSystem/Damage/dmgDamageManagerBase.cpp4
6 files changed, 133 insertions, 27 deletions
diff --git a/src/KingSystem/ActorSystem/CMakeLists.txt b/src/KingSystem/ActorSystem/CMakeLists.txt
index a72504fa..3eb27a0f 100644
--- a/src/KingSystem/ActorSystem/CMakeLists.txt
+++ b/src/KingSystem/ActorSystem/CMakeLists.txt
@@ -8,6 +8,8 @@ target_sources(uking PRIVATE
actActorFactory.h
actActorLinkConstDataAccess.cpp
actActorLinkConstDataAccess.h
+ actActorParam.cpp
+ actActorParam.h
actActorParamMgr.h
actAiAction.cpp
actAiAction.h
diff --git a/src/KingSystem/ActorSystem/actActorParam.cpp b/src/KingSystem/ActorSystem/actActorParam.cpp
new file mode 100644
index 00000000..a615f2db
--- /dev/null
+++ b/src/KingSystem/ActorSystem/actActorParam.cpp
@@ -0,0 +1,21 @@
+#include "KingSystem/ActorSystem/actActorParam.h"
+
+namespace ksys::act {
+
+ActorParam::Resources ActorParam::sDummyResources;
+
+void ActorParam::resetDummyResources() {
+ sDummyResources = {};
+}
+
+ActorParam::ActorParam() {
+ mRes = {};
+ mNumHandles1 = mNumHandles2 = 0;
+ mEvent.resetSignal();
+}
+
+ActorParam::~ActorParam() {
+ finalize();
+}
+
+} // namespace ksys::act
diff --git a/src/KingSystem/ActorSystem/actActorParam.h b/src/KingSystem/ActorSystem/actActorParam.h
new file mode 100644
index 00000000..cba01e0a
--- /dev/null
+++ b/src/KingSystem/ActorSystem/actActorParam.h
@@ -0,0 +1,106 @@
+#pragma once
+
+#include <container/seadBuffer.h>
+#include <heap/seadDisposer.h>
+#include <hostio/seadHostIONode.h>
+#include <prim/seadSafeString.h>
+#include <thread/seadCriticalSection.h>
+#include "KingSystem/ActorSystem/actBaseProcJob.h"
+#include "KingSystem/Resource/resHandle.h"
+#include "KingSystem/Utils/Thread/Event.h"
+
+namespace ksys {
+
+namespace res {
+class ActorLink;
+class AIProgram;
+class AISchedule;
+class AnimationInfo;
+class ASList;
+class AttClientList;
+class Awareness;
+class BoneControl;
+class Chemical;
+class DamageParam;
+class Drop;
+class EventFlow;
+class GParamList;
+class LifeCondition;
+class Lod;
+class ModelList;
+class Physics;
+class RagdollBlendWeight;
+class RagdollConfig;
+class RagdollConfigList;
+class Recipe;
+class Shop;
+class UMii;
+} // namespace res
+
+namespace act {
+
+// FIXME: incomplete
+class ActorParam : public sead::hostio::Node {
+public:
+ struct Resources {
+ res::ActorLink* mActorLink;
+ res::ModelList* mModelList;
+ res::ASList* mASList;
+ res::AIProgram* mAIProgram;
+ res::GParamList* mGParamList;
+ res::Physics* mPhysics;
+ res::Chemical* mChemical;
+ res::AttClientList* mAttClientList;
+ res::AISchedule* mAISchedule;
+ res::EventFlow* mEventFlow;
+ res::DamageParam* mDamageParam;
+ res::RagdollConfigList* mRagdollConfigList;
+ res::RagdollBlendWeight* mRagdollBlendWeight;
+ res::Awareness* mAwareness;
+ void* mResource14;
+ void* mResource15;
+ void* mResource16;
+ res::Drop* mDropTable;
+ res::Shop* mShopData;
+ res::Recipe* mRecipe;
+ res::Lod* mLod;
+ res::BoneControl* mBoneControl;
+ res::LifeCondition* mLifeCondition;
+ res::UMii* mUMii;
+ res::AnimationInfo* mAnimationInfo;
+ };
+ KSYS_CHECK_SIZE_NX150(Resources, 0xc8);
+
+ ActorParam();
+ virtual ~ActorParam();
+
+ u16 _8 = 0;
+ u8 _a = 0;
+ sead::FixedSafeString<64> mActorName;
+ sead::SafeString mProfile;
+ const char* mClassName{};
+ Priority mPriority = Priority::AllAfter;
+ u32 _74 = 2;
+ Resources mRes;
+ sead::Buffer<res::Handle> mHandles1;
+ sead::Buffer<res::Handle> mHandles2;
+ s32 mNumHandles1;
+ s32 mNumHandles2;
+ u32 _168{};
+
+ static void resetDummyResources();
+
+ static Resources sDummyResources;
+
+private:
+ void finalize();
+
+ sead::CriticalSection mCS{nullptr};
+ util::Event mEvent{nullptr,
+ sead::IDisposer::HeapNullOption::DoNotAppendDisposerIfNoHeapSpecified, true};
+};
+KSYS_CHECK_SIZE_NX150(ActorParam, 0x200);
+
+} // namespace act
+
+} // namespace ksys
diff --git a/src/KingSystem/ActorSystem/actActorParamMgr.h b/src/KingSystem/ActorSystem/actActorParamMgr.h
index faae022a..df1e5cac 100644
--- a/src/KingSystem/ActorSystem/actActorParamMgr.h
+++ b/src/KingSystem/ActorSystem/actActorParamMgr.h
@@ -6,34 +6,11 @@ namespace ksys {
namespace res {
class GParamList;
-}
+} // namespace res
namespace act {
// FIXME: incomplete
-class ActorParam {
-public:
- // FIXME: incomplete
- struct Data {
- public:
- u8 TEMP1[0xA0];
-
- res::GParamList* mGParamList;
- u8 TEMP2[0x18];
- void* mDamageParam;
- u8 TEMP3[0x128];
- };
- KSYS_CHECK_SIZE_NX150(ActorParam::Data, 0x1F0);
-
- // vtable is still unknown
- virtual void TEMP_VTABLE();
-
- u64 TEMP; // Unknown number of fields(2+)
- Data mData;
-};
-KSYS_CHECK_SIZE_NX150(ActorParam, 0x200);
-
-// FIXME: incomplete
class ActorParamMgr {
SEAD_SINGLETON_DISPOSER(ActorParamMgr)
public:
diff --git a/src/KingSystem/ActorSystem/actBaseProcJob.h b/src/KingSystem/ActorSystem/actBaseProcJob.h
index bd30b23e..be5a219d 100644
--- a/src/KingSystem/ActorSystem/actBaseProcJob.h
+++ b/src/KingSystem/ActorSystem/actBaseProcJob.h
@@ -7,7 +7,7 @@ namespace ksys::act {
class BaseProc;
-enum class Priority : u8 {
+enum class Priority {
PlayerBefore = 0,
Player = 2,
PlayerAfter = 2,
diff --git a/src/KingSystem/Damage/dmgDamageManagerBase.cpp b/src/KingSystem/Damage/dmgDamageManagerBase.cpp
index 15332a97..68fe41a8 100644
--- a/src/KingSystem/Damage/dmgDamageManagerBase.cpp
+++ b/src/KingSystem/Damage/dmgDamageManagerBase.cpp
@@ -2,7 +2,7 @@
#include "Game/DLC/aoc2.h"
#include "KingSystem/ActorSystem/actActor.h"
#include "KingSystem/ActorSystem/actActorConstDataAccess.h"
-#include "KingSystem/ActorSystem/actActorParamMgr.h"
+#include "KingSystem/ActorSystem/actActorParam.h"
#include "KingSystem/ActorSystem/actLifeRecoveryInfo.h"
#include "KingSystem/Resource/GeneralParamList/resGParamListObjectGeneral.h"
#include "KingSystem/Resource/resResourceGParamList.h"
@@ -104,7 +104,7 @@ void DamageManagerBase::removeDamageCallback(DamageCallback* callback) {
}
bool DamageManagerBase::applyDamage(s32& life) {
- auto* param_list = mActor->mActorParam->mData.mGParamList;
+ auto* param_list = mActor->mActorParam->mRes.mGParamList;
const res::GParamListObjectGeneral& params = param_list->getGeneral();
if (params.mIsLifeInfinite.ref()) {