diff options
| author | Aetias <aetias@outlook.com> | 2025-01-06 22:09:32 +0100 |
|---|---|---|
| committer | Aetias <aetias@outlook.com> | 2025-01-06 22:09:32 +0100 |
| commit | 6b9c7701fe475de8456b7fd67969486c604fc834 (patch) | |
| tree | 81c71cf7ef959850d1bf760571d0c15d5a73e91d /src/00_Core | |
| parent | 247d86247501565d6b9e2461eefdbbd6291c0cc1 (diff) | |
PlayerControl: Decomp 5%
Diffstat (limited to 'src/00_Core')
| -rw-r--r-- | src/00_Core/Actor/Actor.cpp | 8 | ||||
| -rw-r--r-- | src/00_Core/Actor/ActorManager.cpp | 5 | ||||
| -rw-r--r-- | src/00_Core/Item/ItemManager.cpp | 8 | ||||
| -rw-r--r-- | src/00_Core/Player/PlayerControl.cpp | 124 |
4 files changed, 120 insertions, 25 deletions
diff --git a/src/00_Core/Actor/Actor.cpp b/src/00_Core/Actor/Actor.cpp index 3f1f2850..2508b381 100644 --- a/src/00_Core/Actor/Actor.cpp +++ b/src/00_Core/Actor/Actor.cpp @@ -5,6 +5,7 @@ extern "C" { #include "Actor/Actor.hpp" #include "Actor/ActorManager.hpp" #include "Actor/ActorPlayerDummy.hpp" +#include "DTCM/UnkStruct_027e077c.hpp" #include "Item/ItemManager.hpp" #include "Map/MapManager.hpp" #include "Player/EquipSword.hpp" @@ -255,13 +256,6 @@ ARM bool Actor::func_ov00_020c195c() { return true; } -struct UnkStruct2 { - /* 0 */ u32 mUnk_0; - /* 4 */ u32 mUnk_4; - /* 8 */ -}; -extern UnkStruct2 data_027e077c; -extern u8 data_02056be4[]; extern "C" bool func_ov05_02103f4c(s32 param1); extern s32 data_027e103c; ARM bool Actor::func_ov00_020c198c() { diff --git a/src/00_Core/Actor/ActorManager.cpp b/src/00_Core/Actor/ActorManager.cpp index 73ab6bbb..4b5fee76 100644 --- a/src/00_Core/Actor/ActorManager.cpp +++ b/src/00_Core/Actor/ActorManager.cpp @@ -1,4 +1,5 @@ #include "Actor/ActorManager.hpp" +#include "DTCM/UnkStruct_027e077c.hpp" #include "DTCM/UnkStruct_027e103c.hpp" #include "Map/MapManager.hpp" @@ -8,8 +9,6 @@ extern "C" Cylinder *func_ov000_020c3ef0(void *, u32 index); extern "C" bool func_ov000_020c3f08(void *, u32 index); extern "C" void func_ov000_020c3f3c(void *, u32 index, Cylinder *cylinder); extern "C" void func_ov000_020c3f54(void *, u32 param2); -extern s32 data_027e077c; -extern u8 data_02056be4[]; ARM void ActorManager::DeleteActor(u32 index, bool param2) { if (!param2) { @@ -52,7 +51,7 @@ ARM void ActorManager::func_ov00_020c3484(ActorRef *ref, ActorManager *actorMgr, q20 minDistance = 0x7fffffff; Actor **actorIter = actorMgr->mActorTable; - u8 unkByte = data_02056be4[data_027e077c]; + u8 unkByte = data_02056be4[data_027e077c.mUnk_0]; bool unk1 = (unkByte & 1) != 0; Actor **actorTableEnd = actorIter + actorMgr->mMaxActorIndex; diff --git a/src/00_Core/Item/ItemManager.cpp b/src/00_Core/Item/ItemManager.cpp index 9b4a71fb..1e92b51b 100644 --- a/src/00_Core/Item/ItemManager.cpp +++ b/src/00_Core/Item/ItemManager.cpp @@ -1,4 +1,5 @@ #include "Item/ItemManager.hpp"
+#include "DTCM/UnkStruct_027e0d38.hpp"
#include "Player/PlayerLinkBase.hpp"
static const char *sShipPartTypes[] = {"anc", "bow", "hul", "can", "dco", "pdl", "fnl", "brg"};
@@ -124,7 +125,6 @@ ARM ActorNavi *ItemManager::GetFairy(FairyId id) const { return mFairies[id];
}
-extern UnkStruct_027e0d38 *data_027e0d38;
extern unk32 gPlayerAnimHandler;
extern "C" void LoadEquipItemModel(unk32 param1, ItemFlag param2);
extern "C" void _ZNK11ItemManager15GetEquippedItemEv();
@@ -232,15 +232,11 @@ ARM void ItemManager::GiveAmmo(ItemFlag equipId, u16 amount) { (*mAmmo)[equipId] = this->GetMaxAmmo(equipId);
}
-extern "C" unk32 func_ov00_02078b40(UnkStruct_027e0d38 *param1);
extern void *data_027e10a4;
extern "C" bool func_ov15_02136670(void *param1);
extern unk8 data_ov29_0217a4ac[];
-extern "C" bool _ZN14PlayerLinkBase18func_ov00_020bbd80Ei(unk32 param1, unk32 param2);
-extern "C" bool _ZNK11ItemManager7HasItemEi();
-extern "C" void _ZN11ItemManager12GetEquipItemEi();
ARM bool ItemManager::func_ov00_020ad790(unk32 param1) {
- unk32 unk1 = func_ov00_02078b40(data_027e0d38);
+ unk32 unk1 = data_027e0d38->func_ov00_02078b40();
if (unk1 == 2) return func_ov15_02136670(data_027e10a4);
if (data_027e0d38->mUnk_14 == 1) return false;
// NONMATCH: OverlayId_29 should be in constant pool
diff --git a/src/00_Core/Player/PlayerControl.cpp b/src/00_Core/Player/PlayerControl.cpp index 6cf39bda..32bc4098 100644 --- a/src/00_Core/Player/PlayerControl.cpp +++ b/src/00_Core/Player/PlayerControl.cpp @@ -1,14 +1,120 @@ #include "Player/PlayerControl.hpp" +#include "Actor/ActorManager.hpp" +#include "DTCM/UnkStruct_027e05f8.hpp" +#include "DTCM/UnkStruct_027e077c.hpp" +#include "DTCM/UnkStruct_027e0c68.hpp" +#include "DTCM/UnkStruct_027e0d38.hpp" +#include "DTCM/UnkStruct_027e103c.hpp" +#include "Item/ItemManager.hpp" +#include "Save/AdventureFlags.hpp" + +ARM bool PlayerControl::func_ov00_020aeeac() { + unk32 index = data_027e077c.mUnk_0; + if (((data_02056be4[index] & 1) != 0) || ((data_02056be4[index] & 4) != 0)) { + return false; + } + return index == data_027e077c.mUnk_4; +} + +ARM bool PlayerControl::func_ov00_020aeef8() { + unk32 index = data_027e077c.mUnk_0; + if (index == 0x37 || index == 0x3b) { + return false; + } + if (index == 0x3d) { + return true; + } + return func_ov00_020aeeac(); +} + +THUMB void PlayerControl::func_ov00_020aef30() { + this->ResetTouchWorld(); + if (mDebug) { + // 操作 = Operation + mDebug->vfunc_20(0, "\x91\x80\x8d\xec", 'PCTL', 'PLYR', 0, 0); + } +} + +THUMB void PlayerControl::UpdateAim() { + ResetTouchWorld(); + mAimWorld.x = 0; + mAimWorld.y = 0; + mAimWorld.z = 0; + mUnk_80 = false; + mUnk_82 = 0; + mFollowRef.Reset(); + mNextFollowRef.Reset(); + mFollowing = false; + mAim = gVec3p_ZERO; + s32 iVar2 = data_027e0d38->func_ov000_02078b40(); + if (iVar2 == 2) { + data_027e103c->func_ov000_020cf2b8(); + } + mUnk_c8 = -1; + mUnk_cc = -1; +} + +ARM Actor *PlayerControl::GetFollowActor() { + return gActorManager->GetActor(&mFollowRef); +} + +ARM bool PlayerControl::func_ov00_020af01c(unk8 *param1) { + if (mFollowing) { + param1[0] = mUnk_9c; + param1[1] = mUnk_9d; + return true; + } + return false; +} + +ARM void PlayerControl::SetUnk_80() { + mUnk_80 = true; +} + +ARM void PlayerControl::StopFollowing() { + mFollowRef.Reset(); + mFollowing = false; + mFollowActor = NULL; +} + +ARM void PlayerControl::func_ov00_020af06c() { + if (!mUnk_78) { + mUsingEquipItem = false; + return; + } + if (mUnk_7a) { + mUnk_7b = mUsingEquipItem; + } + if (gAdventureFlags->func_ov00_02097738() || data_027e0c68->mUnk_04 != 0) { + if (data_027e0d38->func_ov000_02078b40() != 2) { + mUsingEquipItem = false; + } + return; + } + if (gItemManager->mEquippedItem == ItemFlag_PotionA) { + if (gItemManager->HasPotion(0)) { + mUsingEquipItem = true; + return; + } + } else if (gItemManager->mEquippedItem == ItemFlag_PotionB) { + if (gItemManager->HasPotion(1)) { + mUsingEquipItem = true; + return; + } + } + if (data_027e0d38->func_ov000_02078b40() == 2) { + mUnk_7b = false; + mUnk_7b = (mUnk_7b & gItemManager->func_ov00_020ad790(1)) != 0; + } else { + if (((data_027e05f8.mUnk_0 & 0x300) == 0) || !func_ov00_020aeef8()) { + if (((data_027e05f8.mUnk_0 & 0x300) == 0) && mUnk_83) { + mUnk_7b = false; + } else { + } + } + } +} -bool PlayerControl::func_ov00_020aeeac() {} -void PlayerControl::func_ov00_020aeef8() {} -void PlayerControl::func_ov00_020aef30() {} -void PlayerControl::UpdateAim() {} -Actor *PlayerControl::GetFollowActor() {} -bool PlayerControl::func_ov00_020af01c(unk8 *param1) {} -void PlayerControl::SetUnk_80() {} -void PlayerControl::StopFollowing() {} -void PlayerControl::func_ov00_020af06c() {} void PlayerControl::UpdateUsingEquipItem() {} bool PlayerControl::func_ov00_020af2d4(u32 param1, bool param2) {} bool PlayerControl::CheckTouchedNow(u32 param1) {} |
