From b25f36e736d6e9a5935a2701b669f3bf00270ae5 Mon Sep 17 00:00:00 2001 From: Catobat <69204835+Catobat@users.noreply.github.com> Date: Thu, 27 Apr 2023 16:14:29 +0200 Subject: [PATCH] struct_03003DF0 seems to use struct_03003DF8 --- include/structures.h | 2 +- src/menu/kinstoneMenu.c | 2 +- src/object/cameraTarget.c | 27 ++++++++++++++------------- src/playerUtils.c | 14 +++++++------- 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/include/structures.h b/include/structures.h index 8de98b91..49282475 100644 --- a/include/structures.h +++ b/include/structures.h @@ -272,7 +272,7 @@ typedef struct { /*0x01*/ u8 unk_1; /*0x02*/ u8 unk_2; // TODO kinstoneId, sub_0801DFB4 /*0x03*/ u8 unk_3; - /*0x04*/ u8* unk_4; + /*0x04*/ struct_03003DF8* unk_4; /*0x08*/ struct_03003DF8 array[0x20]; } struct_03003DF0; diff --git a/src/menu/kinstoneMenu.c b/src/menu/kinstoneMenu.c index 62621f7e..8fa799bb 100644 --- a/src/menu/kinstoneMenu.c +++ b/src/menu/kinstoneMenu.c @@ -607,7 +607,7 @@ u32 sub_080A4418(u32 param_1, u32 param_2) { void KinstoneMenu_080A4468(void) { gUnk_03003DF0.unk_2 = 0; - gUnk_03003DF0.unk_4[3] = 0; + gUnk_03003DF0.unk_4->unk_3 = 0; NotifyFusersOnFusionDone(gFuseInfo.kinstoneId); RemoveKinstoneFromBag(gKinstoneMenu.unk2a); } diff --git a/src/object/cameraTarget.c b/src/object/cameraTarget.c index 86321cbb..c86735ac 100644 --- a/src/object/cameraTarget.c +++ b/src/object/cameraTarget.c @@ -53,16 +53,17 @@ void CameraTarget(Entity* this) { case 0: case 1: case 2: - if ((gMessage.doTextBox & 0x7f) != 0) { - default: - if (gUnk_03003DF0.unk_4[3] == 50) { - if (CheckKinstoneFused(KINSTONE_32) == 0) { - uVar2 = 0; - break; - } - } - uVar2 = 1; + if ((gMessage.doTextBox & 0x7f) == 0) { + break; } + default: + if (gUnk_03003DF0.unk_4->unk_3 == KINSTONE_32) { + if (CheckKinstoneFused(KINSTONE_32) == 0) { + uVar2 = 0; + break; + } + } + uVar2 = 1; break; } @@ -102,8 +103,8 @@ void CameraTarget_Action1(Entity* this) { if (this->timer) { this->timer--; } else { - if ((*(Entity**)(gUnk_03003DF0.unk_4 + 8) != NULL) && ((u8)(gUnk_03003DF0.unk_4[3] - 1) < 100)) { - this->child = *(Entity**)(gUnk_03003DF0.unk_4 + 8); + if ((gUnk_03003DF0.unk_4->entity != NULL) && ((u8)(gUnk_03003DF0.unk_4->unk_3 - 1) < 100)) { + this->child = gUnk_03003DF0.unk_4->entity; this->interactType = gUnk_03003DF0.unk_3; sub_08083A40(this); } @@ -119,7 +120,7 @@ void CameraTarget_Action2(Entity* this) { const KinstoneWorldEvent* ptr; if ((this->type != 1) && - (((u8)(gUnk_03003DF0.unk_4[3] - 1) >= 100 || (this->child != *(Entity**)(gUnk_03003DF0.unk_4 + 8))))) { + (((u8)(gUnk_03003DF0.unk_4->unk_3 - 1) >= 100 || (this->child != gUnk_03003DF0.unk_4->entity)))) { sub_080838DC(this); } else { this->x = this->child->x; @@ -128,7 +129,7 @@ void CameraTarget_Action2(Entity* this) { if (this->frame == 1) { this->frame = 0; if (this->type == 0) { - bVar2 = gUnk_03003DF0.unk_4[3]; + bVar2 = gUnk_03003DF0.unk_4->unk_3; } else { bVar2 = this->type2; } diff --git a/src/playerUtils.c b/src/playerUtils.c index 30d37295..c8ed16b7 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -658,8 +658,8 @@ bool32 (*const gPlayerChargeActions[])(ChargeState*) = { sub_08078008, sub_08078124, sub_08078140, sub_08078070, sub_080780E0, sub_08078108, }; -const u8 gUnk_0811C000[] = { - 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +const struct_03003DF8 gUnk_0811C000 = { + 0, 255, 0, 0, 0, 0, }; const u8 gUnk_0811C00C[] = { 0, 238, 14, 255, 0, 10, 241, 255, @@ -1088,11 +1088,11 @@ bool32 sub_080782C0(void) { return FALSE; } } - if (((gPlayerState.playerInput.newInput & PLAYER_INPUT_1000) != 0) && ((u8)(gUnk_03003DF0.unk_4[3] - 1) < 100)) { + if (((gPlayerState.playerInput.newInput & PLAYER_INPUT_1000) != 0) && ((u8)(gUnk_03003DF0.unk_4->unk_3 - 1) < 100)) { AddKinstoneToBag(0); if (gSave.kinstoneAmounts[0] != 0) { - gUnk_03003DF0.unk_2 = gUnk_03003DF0.unk_4[3]; - *(u8*)(*(int*)(gUnk_03003DF0.unk_4 + 8) + 0x39) = 2; + gUnk_03003DF0.unk_2 = gUnk_03003DF0.unk_4->unk_3; + gUnk_03003DF0.unk_4->entity->interactType = 2; gPlayerState.queued_action = PLAYER_08070E9C; } else { CreateEzloHint(TEXT_INDEX(TEXT_EZLO, 0x65), 0); @@ -1103,7 +1103,7 @@ bool32 sub_080782C0(void) { if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0) { return FALSE; } - switch (gUnk_03003DF0.unk_4[1]) { + switch (gUnk_03003DF0.unk_4->unk_1) { default: case 0: return TRUE; @@ -1133,7 +1133,7 @@ bool32 sub_080782C0(void) { void sub_080784C8(void) { MemClear(&gUnk_03003DF0, sizeof(gUnk_03003DF0)); - gUnk_03003DF0.unk_4 = (u8*)gUnk_0811C000; + gUnk_03003DF0.unk_4 = (struct_03003DF8*)&gUnk_0811C000; } ASM_FUNC("asm/non_matching/playerUtils/sub_080784E4.inc", struct_03003DF8* sub_080784E4(void))