diff options
| author | Léo Lam <leo@leolam.fr> | 2025-06-22 23:48:19 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-22 23:48:19 +0200 |
| commit | 5dda15014c0ae35c31b7b0dc6c56c828752baba1 (patch) | |
| tree | 3db6e21a0025e9a0b20d88199e781c95c7947878 /src/KingSystem/ActorSystem | |
| parent | 71530ca9b1b9a5d974f28a97ebe52ae8b29c208f (diff) | |
| parent | 3d920314042fc84ccffc5f4b503e85e3b77fc4a2 (diff) | |
Merge pull request #141 from Pistonight/cpeam
CreatePlayerEquipActorMgr
Diffstat (limited to 'src/KingSystem/ActorSystem')
| -rw-r--r-- | src/KingSystem/ActorSystem/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/KingSystem/ActorSystem/Profiles/actWeaponBase.cpp | 23 | ||||
| -rw-r--r-- | src/KingSystem/ActorSystem/Profiles/actWeaponBase.h | 21 | ||||
| -rw-r--r-- | src/KingSystem/ActorSystem/actActorCreator.h | 1 | ||||
| -rw-r--r-- | src/KingSystem/ActorSystem/actActorLinkConstDataAccess.cpp | 15 | ||||
| -rw-r--r-- | src/KingSystem/ActorSystem/actActorLinkConstDataAccess.h | 4 | ||||
| -rw-r--r-- | src/KingSystem/ActorSystem/actBaseProcHandle.h | 1 | ||||
| -rw-r--r-- | src/KingSystem/ActorSystem/actInstParamPack.h | 1 | ||||
| -rw-r--r-- | src/KingSystem/ActorSystem/actPlayerInfo.h | 1 |
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, ¶ms, 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); |
