summaryrefslogtreecommitdiff
path: root/src/KingSystem/ActorSystem
diff options
context:
space:
mode:
authorPistonight <pistonknight@outlook.com>2025-05-03 21:27:10 -0700
committerPistonight <pistonknight@outlook.com>2025-06-19 12:18:30 -0700
commit3d920314042fc84ccffc5f4b503e85e3b77fc4a2 (patch)
tree2be90adf201ed3e7ea9c9da68cf4699d1c190f5e /src/KingSystem/ActorSystem
parentf18a3f4f9410e6eedb85b0434dbedc119e49d81b (diff)
CreatePlayerEquipActorMgr
Diffstat (limited to 'src/KingSystem/ActorSystem')
-rw-r--r--src/KingSystem/ActorSystem/CMakeLists.txt2
-rw-r--r--src/KingSystem/ActorSystem/Profiles/actWeaponBase.cpp23
-rw-r--r--src/KingSystem/ActorSystem/Profiles/actWeaponBase.h21
-rw-r--r--src/KingSystem/ActorSystem/actActorCreator.h1
-rw-r--r--src/KingSystem/ActorSystem/actActorLinkConstDataAccess.cpp15
-rw-r--r--src/KingSystem/ActorSystem/actActorLinkConstDataAccess.h4
-rw-r--r--src/KingSystem/ActorSystem/actBaseProcHandle.h1
-rw-r--r--src/KingSystem/ActorSystem/actInstParamPack.h1
-rw-r--r--src/KingSystem/ActorSystem/actPlayerInfo.h1
9 files changed, 68 insertions, 1 deletions
diff --git a/src/KingSystem/ActorSystem/CMakeLists.txt b/src/KingSystem/ActorSystem/CMakeLists.txt
index d956ebfa..5a5dd758 100644
--- a/src/KingSystem/ActorSystem/CMakeLists.txt
+++ b/src/KingSystem/ActorSystem/CMakeLists.txt
@@ -20,6 +20,8 @@ target_sources(uking PRIVATE
Profiles/actPlayerBase.h
Profiles/actRopeBase.cpp
Profiles/actRopeBase.h
+ Profiles/actWeaponBase.cpp
+ Profiles/actWeaponBase.h
actActor.cpp
actActor.h
diff --git a/src/KingSystem/ActorSystem/Profiles/actWeaponBase.cpp b/src/KingSystem/ActorSystem/Profiles/actWeaponBase.cpp
new file mode 100644
index 00000000..d206224e
--- /dev/null
+++ b/src/KingSystem/ActorSystem/Profiles/actWeaponBase.cpp
@@ -0,0 +1,23 @@
+#include "KingSystem/ActorSystem/Profiles/actWeaponBase.h"
+#include "KingSystem/ActorSystem/actActorCreator.h"
+#include "KingSystem/ActorSystem/actInstParamPack.h"
+
+namespace ksys::act {
+
+void WeaponBase::requestCreateWeaponActor(const char* actor, const sead::Matrix34f& matrix,
+ f32 scale, sead::Heap* heap,
+ ksys::act::BaseProcHandle* handle, s32 life,
+ ksys::act::InstParamPack* params_in, s32 task_lane_id) {
+ ksys::act::InstParamPack params;
+ if (params_in) {
+ params = *params_in;
+ }
+
+ ksys::act::ActorCreator::addScale(params, scale);
+ params->add(life, "Life");
+ params->addMatrix(matrix);
+ ksys::act::ActorCreator::instance()->requestCreateActor(actor, heap, handle, &params, nullptr,
+ task_lane_id);
+}
+
+} // namespace ksys::act
diff --git a/src/KingSystem/ActorSystem/Profiles/actWeaponBase.h b/src/KingSystem/ActorSystem/Profiles/actWeaponBase.h
new file mode 100644
index 00000000..ca13d0aa
--- /dev/null
+++ b/src/KingSystem/ActorSystem/Profiles/actWeaponBase.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#include "KingSystem/ActorSystem/actActor.h"
+
+namespace ksys::act {
+
+class BaseProcHandle;
+class InstParamPack;
+
+// TODO
+class WeaponBase : public Actor {
+public:
+ bool areExtraActorsReady() const;
+
+ static void requestCreateWeaponActor(const char* actor, const sead::Matrix34f& matrix,
+ f32 scale, sead::Heap* heap,
+ ksys::act::BaseProcHandle* handle, s32 life,
+ ksys::act::InstParamPack* params, s32 task_lane_id);
+};
+
+} // namespace ksys::act
diff --git a/src/KingSystem/ActorSystem/actActorCreator.h b/src/KingSystem/ActorSystem/actActorCreator.h
index ae80dd23..3368e765 100644
--- a/src/KingSystem/ActorSystem/actActorCreator.h
+++ b/src/KingSystem/ActorSystem/actActorCreator.h
@@ -12,7 +12,6 @@
namespace ksys::map {
class MubinIter;
class Object;
-;
} // namespace ksys::map
namespace ksys::act {
diff --git a/src/KingSystem/ActorSystem/actActorLinkConstDataAccess.cpp b/src/KingSystem/ActorSystem/actActorLinkConstDataAccess.cpp
index c44d5717..06694bbf 100644
--- a/src/KingSystem/ActorSystem/actActorLinkConstDataAccess.cpp
+++ b/src/KingSystem/ActorSystem/actActorLinkConstDataAccess.cpp
@@ -1,4 +1,6 @@
#include "KingSystem/ActorSystem/actActorLinkConstDataAccess.h"
+#include <prim/seadRuntimeTypeInfo.h>
+#include "KingSystem/ActorSystem/actActor.h"
#include "KingSystem/ActorSystem/actBaseProc.h"
#include "KingSystem/ActorSystem/actBaseProcMgr.h"
#include "KingSystem/Utils/Debug.h"
@@ -25,6 +27,19 @@ bool ActorLinkConstDataAccess::acquire(BaseProc* proc) {
return proc && proc->acquire(*this);
}
+const Actor* ActorLinkConstDataAccess::getActor() const {
+ if (!mProc)
+ return nullptr;
+ return sead::DynamicCast<Actor>(mProc);
+}
+
+const sead::Matrix34f& ActorLinkConstDataAccess::getActorMtx() {
+ const Actor* actor = getActor();
+ if (actor)
+ return actor->getMtx();
+ return sead::Matrix34f::ident;
+}
+
bool acquireProc(ActorLinkConstDataAccess* accessor, BaseProc* proc, const sead::SafeString& from,
s32) {
bool acquired = false;
diff --git a/src/KingSystem/ActorSystem/actActorLinkConstDataAccess.h b/src/KingSystem/ActorSystem/actActorLinkConstDataAccess.h
index c17eadb8..4c67c686 100644
--- a/src/KingSystem/ActorSystem/actActorLinkConstDataAccess.h
+++ b/src/KingSystem/ActorSystem/actActorLinkConstDataAccess.h
@@ -1,12 +1,14 @@
#pragma once
#include <basis/seadTypes.h>
+#include <math/seadMatrix.h>
#include <prim/seadSafeString.h>
namespace ksys {
struct MesTransceiverId;
namespace act {
+class Actor;
class BaseProc;
/// Provides read-only access to actor data for safe, multi-threaded access.
@@ -37,6 +39,8 @@ public:
bool hasProc() const { return mProc != nullptr; }
const MesTransceiverId* getMessageTransceiverId() const;
+ const Actor* getActor() const;
+ const sead::Matrix34f& getActorMtx();
protected:
friend class ActorConstDataAccess;
diff --git a/src/KingSystem/ActorSystem/actBaseProcHandle.h b/src/KingSystem/ActorSystem/actBaseProcHandle.h
index 5911cb64..68964e78 100644
--- a/src/KingSystem/ActorSystem/actBaseProcHandle.h
+++ b/src/KingSystem/ActorSystem/actBaseProcHandle.h
@@ -26,6 +26,7 @@ public:
bool isProcReady() const;
bool hasProcCreationFailed() const;
bool isProcCreationCancelled() const;
+ bool isAllocatedOrFailed() const { return mUnit || mFailed; }
void deleteProcIfFailed();
void deleteProc();
diff --git a/src/KingSystem/ActorSystem/actInstParamPack.h b/src/KingSystem/ActorSystem/actInstParamPack.h
index 0e68dfb6..52d47479 100644
--- a/src/KingSystem/ActorSystem/actInstParamPack.h
+++ b/src/KingSystem/ActorSystem/actInstParamPack.h
@@ -147,6 +147,7 @@ public:
InstParamPack() = default;
virtual ~InstParamPack() = default;
+ InstParamPack& operator=(const InstParamPack& other) = default;
Buffer& getBuffer() { return mBuffer; }
const Buffer& getBuffer() const { return mBuffer; }
diff --git a/src/KingSystem/ActorSystem/actPlayerInfo.h b/src/KingSystem/ActorSystem/actPlayerInfo.h
index 317b126b..a47475c9 100644
--- a/src/KingSystem/ActorSystem/actPlayerInfo.h
+++ b/src/KingSystem/ActorSystem/actPlayerInfo.h
@@ -22,6 +22,7 @@ class PlayerInfo : public PlayerInfoBase {
~PlayerInfo() override;
public:
+ BaseProcLink& getPlayerLink() { return mPlayerLink; }
bool init();
void setAndAcquirePlayer(PlayerBase* player); // requires PlayerOrEnemy and PlayerBase
void resetPlayer(PlayerBase* player);