summaryrefslogtreecommitdiff
path: root/src/00_Core/Player
diff options
context:
space:
mode:
authorAetias <aetias@outlook.com>2025-05-22 22:05:31 +0200
committerAetias <aetias@outlook.com>2025-05-22 22:05:31 +0200
commit0ae9b8c14902a59341ec84730d417eabe595f2de (patch)
tree03ce8d268435e7165017374eaee15fbc37b1ace6 /src/00_Core/Player
parent4a764f9d58cb16343c02afb3592aad7aabf66d6d (diff)
parent3f6a81d03dec2bd7c8394b508dbe4f017a5244b9 (diff)
Merge remote-tracking branch 'zeldaret/main' into decomp-PlayerControl
Diffstat (limited to 'src/00_Core/Player')
-rw-r--r--src/00_Core/Player/LinkStateBase.cpp6
-rw-r--r--src/00_Core/Player/LinkStateMove.cpp77
-rw-r--r--src/00_Core/Player/PlayerLinkBase.cpp2
-rw-r--r--src/00_Core/Player/TouchControl.cpp34
4 files changed, 104 insertions, 15 deletions
diff --git a/src/00_Core/Player/LinkStateBase.cpp b/src/00_Core/Player/LinkStateBase.cpp
index 7479667e..37215e6f 100644
--- a/src/00_Core/Player/LinkStateBase.cpp
+++ b/src/00_Core/Player/LinkStateBase.cpp
@@ -16,7 +16,7 @@ void LinkStateBase::UpdateSwordShieldInUse() {}
void LinkStateBase::func_ov00_020a81b8(unk32 param1, unk32 param2) {}
LinkStateItem *LinkStateBase::GetLinkItemState() {}
void LinkStateBase::LookAt(Vec3p *target) {}
-void LinkStateBase::func_ov00_020a81fc() {}
+void LinkStateBase::func_ov00_020a81fc(Vec3p *param1, unk32 param2) {}
void LinkStateBase::AddHealth(s16 amount) {}
void LinkStateBase::func_ov00_020a8224(unk32 param1) {}
void LinkStateBase::TurnTo(s16 angle, unk32 param2, unk32 speed) {}
@@ -38,7 +38,7 @@ bool LinkStateBase::func_ov00_020a8638(unk32 param1) {}
void LinkStateBase::Clear_PlayerLinkBase_Unk48(u16 flags) {}
void LinkStateBase::func_ov00_020a8680(unk32 param1, unk16 param2, bool param3) {}
void LinkStateBase::PlayerLinkBase_func_ov00_020bccc8() {}
-bool LinkStateBase::PlayerLinkBase_vfunc_58() {}
+bool LinkStateBase::PlayerLinkBase_vfunc_58(unk32 param1, ActorRef *param2) {}
bool LinkStateBase::func_ov00_020a8704(s16 *pAngle) {}
bool LinkStateBase::func_ov00_020a8774(Vec3p *param1, s32 angle) {}
void LinkStateBase::func_ov00_020a8844(Vec3p *param1, bool param2, bool param3) {}
@@ -46,7 +46,7 @@ void LinkStateBase::func_ov00_020a8954(bool param1, unk32 *param2) {}
void LinkStateBase::func_ov00_020a8994() {}
void LinkStateBase::func_ov00_020a89bc(unk32 param1, unk32 param2) {}
void LinkStateBase::func_ov00_020a8a08(unk32 param1) {}
-void LinkStateBase::func_ov00_020a8a4c(unk32 param1, unk32 param2) {}
+void LinkStateBase::func_ov00_020a8a4c(const void *param1, unk32 param2) {}
void LinkStateBase::func_ov00_020a8a90(unk32 param1) {}
void LinkStateBase::func_ov00_020a8ab0(unk32 param1) {}
void LinkStateBase::func_ov00_020a8ad0(unk32 param1) {}
diff --git a/src/00_Core/Player/LinkStateMove.cpp b/src/00_Core/Player/LinkStateMove.cpp
index 918a92fe..5509be66 100644
--- a/src/00_Core/Player/LinkStateMove.cpp
+++ b/src/00_Core/Player/LinkStateMove.cpp
@@ -1,10 +1,71 @@
#include "Player/LinkStateMove.hpp"
-void LinkStateMove::vfunc_00() {}
-LinkStateId LinkStateMove::GetId() {}
-void LinkStateMove::CreateDebugHierarchy() {}
-void LinkStateMove::OnStateEnter() {}
-void LinkStateMove::OnStateLeave(s32 param1) {}
-bool LinkStateMove::vfunc_24(s32 param1) {}
-bool LinkStateMove::func_ov00_020a8f2c() {}
-bool LinkStateMove::func_ov00_020a8f4c() {}
+unk32 LinkStateMove::data_ov000_020e56f0 = 0x800;
+
+THUMB void LinkStateMove::vfunc_00() {}
+
+ARM LinkStateId LinkStateMove::GetId() {
+ return LinkStateId_Move;
+}
+
+THUMB void LinkStateMove::CreateDebugHierarchy() {
+ unk32 id = 'LMOV';
+ // Breath volume decay rate "息吹きボリューム低下率"
+ const char *description = "\x91\xa7\x90\x81\x82\xab\x83{\x83\x8a\x83\x85\x81[\x83\x80\x92\xe1\x89\xba\x97\xa6";
+
+ DebugHierarchy *debugHierarchy = this->GetDebugHierarchy0();
+ debugHierarchy->vfunc_3c(id, &data_ov000_020e56f0);
+
+ debugHierarchy->GetChildNode(1, description, id, &data_ov000_020e56f0, 8, 0, 0x1000, 0);
+}
+
+extern u32 data_ov000_020eec9c;
+extern "C" void func_ov000_020d77e4(void *param1, s32 param2);
+
+ARM void LinkStateMove::OnStateEnter() {
+ this->mUnk_0c = 0;
+ this->mUnk_10 = 0;
+ this->mUnk_12 = 0;
+ if (this->mUnk_14 == 0) {
+ return;
+ }
+
+ EquipItem *sword = this->GetEquipItem(ItemFlag_OshusSword);
+ sword->UpdateInUse(1);
+ EquipItem *shield = this->GetEquipItem(ItemFlag_WoodenShield);
+ shield->UpdateInUse(1);
+
+ PlayerBase::GetEquipSword()->func_ov000_020c06b0(-1);
+ func_ov000_020d77e4(&data_ov000_020eec9c, 0xD);
+}
+
+ARM void LinkStateMove::OnStateLeave(s32 param1) {
+ LinkStateBase::OnStateLeave(param1);
+ this->mUnk_14 = 0;
+ this->mUnk_15 = 0;
+ this->mUnk_16 = 0;
+}
+
+ARM bool LinkStateMove::vfunc_24(s32 param1) {
+ if (this->GetHealth() > 0) {
+ return LinkStateBase::vfunc_24(param1);
+ }
+ switch (param1) {
+ case 2: return true;
+ default: return false;
+ }
+}
+
+ARM bool LinkStateMove::func_ov00_020a8f2c() {
+ static unk32 data_ov000_020e56f4 = 0x100;
+ return this->mUnk_0c > data_ov000_020e56f4;
+}
+
+ARM bool LinkStateMove::func_ov00_020a8f4c() {
+ if (this->mUnk_15) {
+ return false;
+ }
+ this->mUnk_15 = true;
+ this->mUnk_16 = false;
+ return true;
+}
diff --git a/src/00_Core/Player/PlayerLinkBase.cpp b/src/00_Core/Player/PlayerLinkBase.cpp
index 897932c8..bc248044 100644
--- a/src/00_Core/Player/PlayerLinkBase.cpp
+++ b/src/00_Core/Player/PlayerLinkBase.cpp
@@ -20,7 +20,7 @@ bool PlayerLinkBase::func_ov000_020bba00() {}
bool PlayerLinkBase::func_ov000_020bba14() {}
bool PlayerLinkBase::func_ov000_020bba28() {}
void PlayerLinkBase::func_ov000_020bba48() {}
-void PlayerLinkBase::vfunc_18(s32 param1) {}
+bool PlayerLinkBase::vfunc_18(s32 param1) {}
bool PlayerLinkBase::CanMove() {}
bool PlayerLinkBase::vfunc_58() {}
bool PlayerLinkBase::vfunc_5c() {}
diff --git a/src/00_Core/Player/TouchControl.cpp b/src/00_Core/Player/TouchControl.cpp
index 5cae75a5..9630de1a 100644
--- a/src/00_Core/Player/TouchControl.cpp
+++ b/src/00_Core/Player/TouchControl.cpp
@@ -1,11 +1,39 @@
#include "Player/TouchControl.hpp"
TouchControl::TouchControl() {}
-void TouchControl::IncreaseSpeed(s16 increase) {}
+
+void TouchControl::IncreaseSpeed(s16 increase) {
+ this->mFlags = 0;
+ this->mSpeed += increase;
+}
+
void TouchControl::UpdateFlags(u16 speed) {}
void TouchControl::UpdateWithStateFlags(TouchStateFlags *state, u16 speed) {}
void TouchControl::Update(TouchState *state, u16 speed) {}
-bool TouchControl::func_ov00_0207aeac() {}
+bool TouchControl::func_ov00_0207aeac() {
+ return ((*data_0207aecc & 0x8000) >> 15) == 1;
+}
void TouchControl::UpdateConditionally(TouchState *state, u16 speed) {}
-void TouchControl::func_ov00_0207af38(u16 speed, bool param2) {}
+
+void TouchControl::func_ov00_0207af38(u16 speedIncrease, bool shouldIncrease) {
+ TouchStateFlags touchState;
+
+ if (shouldIncrease) {
+ IncreaseSpeed(speedIncrease); /* TODO: IncreaseSpeed expects an s16 variable,
+ while speedIncrease is a u16. As a result, the function
+ performs a conversion that is not present in the binary. */
+ return;
+ }
+
+ u32 result = TouchControl::func_ov00_0207aeac();
+ if (result != 0) {
+ Fill16(0, &touchState.touchX, 8);
+ } else {
+
+ GetTouchStateFlags(&touchState);
+ }
+
+ UpdateWithStateFlags(&touchState, speedIncrease);
+}
+
TouchControl::~TouchControl() {}