summaryrefslogtreecommitdiff
path: root/src/KingSystem/ActorSystem
diff options
context:
space:
mode:
authornotyourav <65437533+notyourav@users.noreply.github.com>2022-10-17 23:27:57 -0700
committerGitHub <noreply@github.com>2022-10-18 08:27:57 +0200
commit2f62d26424fbef67733b452073c606062e2368f6 (patch)
tree5b6dc75968647ce89a42fe2bd6d205567c2505b9 /src/KingSystem/ActorSystem
parentbc6fe73df15b2e31131df68164ea7c8b26017d2b (diff)
Decompile some Action classes (#104)
* various action classes * rename instanceset fns * rename isFork -> isChangeable
Diffstat (limited to 'src/KingSystem/ActorSystem')
-rw-r--r--src/KingSystem/ActorSystem/CMakeLists.txt241
-rw-r--r--src/KingSystem/ActorSystem/actActor.h14
-rw-r--r--src/KingSystem/ActorSystem/actAiActionBase.h12
-rw-r--r--src/KingSystem/ActorSystem/actAiAi.cpp6
-rw-r--r--src/KingSystem/ActorSystem/actAiAi.h2
-rw-r--r--src/KingSystem/ActorSystem/actAiRoot.h2
-rw-r--r--src/KingSystem/ActorSystem/actCCAccessor.h26
-rw-r--r--src/KingSystem/ActorSystem/actionDummyAction.cpp2
-rw-r--r--src/KingSystem/ActorSystem/aiDummyAi.h2
9 files changed, 175 insertions, 132 deletions
diff --git a/src/KingSystem/ActorSystem/CMakeLists.txt b/src/KingSystem/ActorSystem/CMakeLists.txt
index 57acd6df..79574c50 100644
--- a/src/KingSystem/ActorSystem/CMakeLists.txt
+++ b/src/KingSystem/ActorSystem/CMakeLists.txt
@@ -1,126 +1,127 @@
target_sources(uking PRIVATE
- Attention/actAttention.cpp
- Attention/actAttention.h
+ Attention/actAttention.cpp
+ Attention/actAttention.h
- Awareness/actAwareness.cpp
- Awareness/actAwareness.h
- Awareness/actAwarenessDefs.cpp
- Awareness/actAwarenessDefs.h
- Awareness/actAwarenessInstance.cpp
- Awareness/actAwarenessInstance.h
+ Awareness/actAwareness.cpp
+ Awareness/actAwareness.h
+ Awareness/actAwarenessDefs.cpp
+ Awareness/actAwarenessDefs.h
+ Awareness/actAwarenessInstance.cpp
+ Awareness/actAwarenessInstance.h
- LOD/actLodState.cpp
- LOD/actLodState.h
+ LOD/actLodState.cpp
+ LOD/actLodState.h
- Profiles/actPlayerBase.cpp
- Profiles/actPlayerBase.h
- Profiles/actRopeBase.cpp
- Profiles/actRopeBase.h
+ Profiles/actPlayerBase.cpp
+ Profiles/actPlayerBase.h
+ Profiles/actRopeBase.cpp
+ Profiles/actRopeBase.h
- actActor.cpp
- actActor.h
- actActorCaptureMgr.cpp
- actActorCaptureMgr.h
- actActorConstDataAccess.cpp
- actActorConstDataAccess.h
- actActorCreator.cpp
- actActorCreator.h
- actActorEditorNode.cpp
- actActorEditorNode.h
- actActorFactory.cpp
- actActorFactory.h
- actActorHeapUtil.cpp
- actActorHeapUtil.h
- actActorLimiter.cpp
- actActorLimiter.h
- actActorLinkConstDataAccess.cpp
- actActorLinkConstDataAccess.h
- actActorParam.cpp
- actActorParam.h
- actActorParamMgr.cpp
- actActorParamMgr.h
- actActorSystem.cpp
- actActorSystem.h
- actActorTemplate.cpp
- actActorTemplate.h
- actActorUtil.cpp
- actActorUtil.h
- actAiAction.cpp
- actAiAction.h
- actAiActionBase.cpp
- actAiActionBase.h
- actAiAi.cpp
- actAiAi.h
- actAiBehavior.cpp
- actAiBehavior.h
- actAiClassDef.cpp
- actAiClassDef.h
- actAiInlineParam.h
- actAiParam.cpp
- actAiParam.h
- actAiQuery.cpp
- actAiQuery.h
- actAiQueries.cpp
- actAiQueries.h
- actAiRoot.cpp
- actAiRoot.h
- actASSetting.cpp
- actASSetting.h
- actBaseProc.cpp
- actBaseProc.h
- actBaseProcCreateTask.cpp
- actBaseProcCreateTask.h
- actBaseProcCreateTaskSelector.cpp
- actBaseProcCreateTaskSelector.h
- actBaseProcDeleter.cpp
- actBaseProcDeleter.h
- actBaseProcHandle.cpp
- actBaseProcHandle.h
- actBaseProcHeapMgr.cpp
- actBaseProcHeapMgr.h
- actBaseProcInitializer.cpp
- actBaseProcInitializer.h
- actBaseProcJob.cpp
- actBaseProcJob.h
- actBaseProcJobHandler.cpp
- actBaseProcJobHandler.h
- actBaseProcJobQue.cpp
- actBaseProcJobQue.h
- actBaseProcLink.cpp
- actBaseProcLink.h
- actBaseProcMap.cpp
- actBaseProcMap.h
- actBaseProcMgr.cpp
- actBaseProcMgr.h
- actBaseProcUnit.cpp
- actBaseProcUnit.h
- actClusteredRenderer.cpp
- actClusteredRenderer.h
- actDebug.cpp
- actDebug.h
- actGlobalParameter.cpp
- actGlobalParameter.h
- actInfoCommon.cpp
- actInfoCommon.h
- actInfoData.cpp
- actInfoData.h
- actInstParamPack.cpp
- actInstParamPack.h
- actLifeRecoveryInfo.h
- actPhysicsConstraints.cpp
- actPhysicsConstraints.h
- actPhysicsUserTag.cpp
- actPhysicsUserTag.h
- actPlayerInfo.cpp
- actPlayerInfo.h
- actTag.h
+ actActor.cpp
+ actActor.h
+ actActorCaptureMgr.cpp
+ actActorCaptureMgr.h
+ actActorConstDataAccess.cpp
+ actActorConstDataAccess.h
+ actActorCreator.cpp
+ actActorCreator.h
+ actActorEditorNode.cpp
+ actActorEditorNode.h
+ actActorFactory.cpp
+ actActorFactory.h
+ actActorHeapUtil.cpp
+ actActorHeapUtil.h
+ actActorLimiter.cpp
+ actActorLimiter.h
+ actActorLinkConstDataAccess.cpp
+ actActorLinkConstDataAccess.h
+ actActorParam.cpp
+ actActorParam.h
+ actActorParamMgr.cpp
+ actActorParamMgr.h
+ actActorSystem.cpp
+ actActorSystem.h
+ actActorTemplate.cpp
+ actActorTemplate.h
+ actActorUtil.cpp
+ actActorUtil.h
+ actAiAction.cpp
+ actAiAction.h
+ actAiActionBase.cpp
+ actAiActionBase.h
+ actAiAi.cpp
+ actAiAi.h
+ actAiBehavior.cpp
+ actAiBehavior.h
+ actAiClassDef.cpp
+ actAiClassDef.h
+ actAiInlineParam.h
+ actAiParam.cpp
+ actAiParam.h
+ actAiQuery.cpp
+ actAiQuery.h
+ actAiQueries.cpp
+ actAiQueries.h
+ actAiRoot.cpp
+ actAiRoot.h
+ actASSetting.cpp
+ actASSetting.h
+ actBaseProc.cpp
+ actBaseProc.h
+ actBaseProcCreateTask.cpp
+ actBaseProcCreateTask.h
+ actBaseProcCreateTaskSelector.cpp
+ actBaseProcCreateTaskSelector.h
+ actBaseProcDeleter.cpp
+ actBaseProcDeleter.h
+ actBaseProcHandle.cpp
+ actBaseProcHandle.h
+ actBaseProcHeapMgr.cpp
+ actBaseProcHeapMgr.h
+ actBaseProcInitializer.cpp
+ actBaseProcInitializer.h
+ actBaseProcJob.cpp
+ actBaseProcJob.h
+ actBaseProcJobHandler.cpp
+ actBaseProcJobHandler.h
+ actBaseProcJobQue.cpp
+ actBaseProcJobQue.h
+ actBaseProcLink.cpp
+ actBaseProcLink.h
+ actBaseProcMap.cpp
+ actBaseProcMap.h
+ actBaseProcMgr.cpp
+ actBaseProcMgr.h
+ actBaseProcUnit.cpp
+ actBaseProcUnit.h
+ actCCAccessor.h
+ actClusteredRenderer.cpp
+ actClusteredRenderer.h
+ actDebug.cpp
+ actDebug.h
+ actGlobalParameter.cpp
+ actGlobalParameter.h
+ actInfoCommon.cpp
+ actInfoCommon.h
+ actInfoData.cpp
+ actInfoData.h
+ actInstParamPack.cpp
+ actInstParamPack.h
+ actLifeRecoveryInfo.h
+ actPhysicsConstraints.cpp
+ actPhysicsConstraints.h
+ actPhysicsUserTag.cpp
+ actPhysicsUserTag.h
+ actPlayerInfo.cpp
+ actPlayerInfo.h
+ actTag.h
- actionDummyAction.cpp
- actionDummyAction.h
- aiDummyAi.cpp
- aiDummyAi.h
- behaviorDummyBehavior.cpp
- behaviorDummyBehavior.h
- queryDummyQuery.cpp
- queryDummyQuery.h
-)
+ actionDummyAction.cpp
+ actionDummyAction.h
+ aiDummyAi.cpp
+ aiDummyAi.h
+ behaviorDummyBehavior.cpp
+ behaviorDummyBehavior.h
+ queryDummyQuery.cpp
+ queryDummyQuery.h
+ )
diff --git a/src/KingSystem/ActorSystem/actActor.h b/src/KingSystem/ActorSystem/actActor.h
index 4868e101..7a3d2093 100644
--- a/src/KingSystem/ActorSystem/actActor.h
+++ b/src/KingSystem/ActorSystem/actActor.h
@@ -40,9 +40,10 @@ class UMii;
namespace phys {
class StaticCompoundRigidBodyGroup;
-class Physics;
+class InstanceSet;
class Reaction;
class RigidBody;
+class CharacterController;
} // namespace phys
namespace res {
@@ -112,6 +113,7 @@ public:
enum class ActorFlag2 {
InstEvent = 0x8,
+ _20 = 0x20,
NoDistanceCheck = 0x80,
Alive = 0x4000000,
};
@@ -140,12 +142,19 @@ public:
const sead::Vector3f& getVelocity() const { return mVelocity; }
const sead::Vector3f& getAngVelocity() const { return mAngVelocity; }
const sead::Vector3f& getScale() const { return mScale; }
+ phys::RigidBody* getMainBody() const { return mMainBody; }
+ phys::RigidBody* getTgtBody() const { return mTgtBody; }
+
+ const MesTransceiverId* getMesTransceiverId() const { return mMsgTransceiver.getId(); }
+
f32 getDeleteDistance() const {
return sead::Mathf::sqrt(sead::Mathf::clampMin(mDeleteDistanceSq, 0.0f));
}
void setDeleteDistance(f32 distance) { mDeleteDistanceSq = sead::Mathf::square(distance); }
+ phys::CharacterController* getCharacterController();
+
void clearFlag(ActorFlag flag);
bool checkFlag(ActorFlag flag) const;
void setFlag(ActorFlag flag);
@@ -278,6 +287,7 @@ public:
void emitBasicSigOn();
void emitBasicSigOff();
+ bool checkBasicSig() const;
void nullsub_4649(); // Some kind of logging which has been excluded from the build?
@@ -386,7 +396,7 @@ protected:
/* 0x560 */ as::ASList* mASList = nullptr;
/* 0x568 */ xlink::XLink* mXLink = nullptr;
/* 0x570 */ ActorParam* mActorParam = nullptr;
- /* 0x578 */ phys::Physics* mPhysics = nullptr;
+ /* 0x578 */ phys::InstanceSet* mPhysics = nullptr;
/* 0x580 */ PhysicsConstraints mConstraints;
/* 0x598 */ void* _598 = nullptr;
/* 0x5a0 */ BoneControl* mBoneControl = nullptr;
diff --git a/src/KingSystem/ActorSystem/actAiActionBase.h b/src/KingSystem/ActorSystem/actAiActionBase.h
index 9aa2db19..db47be42 100644
--- a/src/KingSystem/ActorSystem/actAiActionBase.h
+++ b/src/KingSystem/ActorSystem/actAiActionBase.h
@@ -13,6 +13,7 @@ struct AIDefSet;
class Message;
class MessageAck;
struct MesTransceiverId;
+struct MessageType;
} // namespace ksys
namespace ksys::res {
@@ -69,6 +70,8 @@ public:
void leave();
bool oneShot(InlineParamPack* params);
+ bool sendMessage(const MesTransceiverId& dest, const MessageType& type, void* user_data);
+
Action* getCurrentAction();
bool handleMessage(const Message& message);
bool handleAck(const MessageAck& message);
@@ -78,9 +81,12 @@ public:
const char* getClassName() const;
const char* getName() const;
+ void playAS(const char* name, bool repeat, u32 slot, u32 seq_bank, f32 t);
+ bool isFinishedAS(u32 slot, u32 seq_bank);
+
virtual bool isFailed() const { return mFlags.isOn(Flag::Failed); }
virtual bool isFinished() const { return mFlags.isOn(Flag::Finished); }
- virtual bool isFlag4Set() const { return mFlags.isOn(Flag::_4); }
+ virtual bool isChangeable() const { return mFlags.isOn(Flag::Changeable); }
virtual bool hasPreDeleteCb() { return false; }
virtual bool hasUpdateForPreDeleteCb() { return false; }
@@ -123,7 +129,7 @@ protected:
enum class Flag : u8 {
Finished = 1,
Failed = 2,
- _4 = 4,
+ Changeable = 4,
TriggerAction = 8,
DynamicParamChild = 0x10,
_20 = 0x20,
@@ -154,7 +160,7 @@ protected:
void resetFlags() {
mFlags.reset(Flag::Failed);
mFlags.reset(Flag::Finished);
- mFlags.reset(Flag::_4);
+ mFlags.reset(Flag::Changeable);
}
res::AIProgram* getAIProg() const;
diff --git a/src/KingSystem/ActorSystem/actAiAi.cpp b/src/KingSystem/ActorSystem/actAiAi.cpp
index c96bea6e..632e3873 100644
--- a/src/KingSystem/ActorSystem/actAiAi.cpp
+++ b/src/KingSystem/ActorSystem/actAiAi.cpp
@@ -186,12 +186,12 @@ bool Ai::reenter(ActionBase* other, const sead::SafeString& context) {
return child->takeOver(other_child, getName());
}
-bool Ai::isFlag4Set() const {
+bool Ai::isChangeable() const {
auto* child = getCurrentChild();
if (child)
- return child->isFlag4Set();
+ return child->isChangeable();
- return mFlags.isOn(Flag::_4);
+ return mFlags.isOn(Flag::Changeable);
}
ActionBase* Ai::getCurrentChild() const {
diff --git a/src/KingSystem/ActorSystem/actAiAi.h b/src/KingSystem/ActorSystem/actAiAi.h
index 518c8b7a..af1ad8a5 100644
--- a/src/KingSystem/ActorSystem/actAiAi.h
+++ b/src/KingSystem/ActorSystem/actAiAi.h
@@ -11,7 +11,7 @@ public:
explicit Ai(const InitArg& arg);
~Ai() override;
- bool isFlag4Set() const override;
+ bool isChangeable() const override;
void calc() override;
ActionBase* changeChildLater(const sead::SafeString& name) override;
void getParams(ParamNameTypePairs* pairs, bool update_use_count) const override;
diff --git a/src/KingSystem/ActorSystem/actAiRoot.h b/src/KingSystem/ActorSystem/actAiRoot.h
index 20f7e285..1365b8c2 100644
--- a/src/KingSystem/ActorSystem/actAiRoot.h
+++ b/src/KingSystem/ActorSystem/actAiRoot.h
@@ -30,7 +30,7 @@ public:
explicit RootAi(const InitArg& arg);
~RootAi() override;
- bool isFlag4Set() const override { return true; }
+ bool isChangeable() const override { return true; }
bool init_(sead::Heap* heap) override;
void enter_(InlineParamPack* params) override;
void leave_() override;
diff --git a/src/KingSystem/ActorSystem/actCCAccessor.h b/src/KingSystem/ActorSystem/actCCAccessor.h
new file mode 100644
index 00000000..cfe0b829
--- /dev/null
+++ b/src/KingSystem/ActorSystem/actCCAccessor.h
@@ -0,0 +1,26 @@
+#pragma once
+
+namespace ksys::phys {
+class CharacterController;
+};
+
+namespace ksys::act {
+
+class Actor;
+
+// todo: move?
+enum class MotionType {
+ Hover = 3,
+};
+
+class CCAccessor {
+public:
+ CCAccessor();
+ ~CCAccessor();
+
+ void changeMotionType(phys::CharacterController* cc, MotionType motion_type);
+ void resetRigidBodyMotion(Actor* actor);
+ void resetMotionType(phys::CharacterController* cc);
+};
+
+} // namespace ksys::act
diff --git a/src/KingSystem/ActorSystem/actionDummyAction.cpp b/src/KingSystem/ActorSystem/actionDummyAction.cpp
index 48544236..8d5637ce 100644
--- a/src/KingSystem/ActorSystem/actionDummyAction.cpp
+++ b/src/KingSystem/ActorSystem/actionDummyAction.cpp
@@ -5,7 +5,7 @@ namespace ksys::act::ai {
DummyAction::DummyAction(const InitArg& arg) : Action(arg) {}
void DummyAction::enter_(InlineParamPack* params) {
- mFlags.set(ActionBase::Flag::_4);
+ mFlags.set(ActionBase::Flag::Changeable);
}
void DummyAction::calc_() {}
diff --git a/src/KingSystem/ActorSystem/aiDummyAi.h b/src/KingSystem/ActorSystem/aiDummyAi.h
index 340a13e1..c7bdc7e2 100644
--- a/src/KingSystem/ActorSystem/aiDummyAi.h
+++ b/src/KingSystem/ActorSystem/aiDummyAi.h
@@ -9,7 +9,7 @@ class DummyAi : public Ai {
public:
explicit DummyAi(const InitArg& arg);
- bool isFlag4Set() const override { return true; }
+ bool isChangeable() const override { return true; }
void enter_(InlineParamPack* params) override;
protected: