diff --git a/asm/non_matching/playerUtils/sub_080784E4.inc b/asm/non_matching/playerUtils/sub_080784E4.inc index 109b7fd3..14b6afbb 100644 --- a/asm/non_matching/playerUtils/sub_080784E4.inc +++ b/asm/non_matching/playerUtils/sub_080784E4.inc @@ -4,7 +4,7 @@ mov r6, sb mov r5, r8 push {r5, r6, r7} - ldr r0, _080784FC @ =gUnk_03003DF0 + ldr r0, _080784FC @ =gPossibleInteraction ldrb r1, [r0] mov r8, r0 cmp r1, #0 @@ -12,7 +12,7 @@ ldr r0, [r0, #4] b _0807876A .align 2, 0 -_080784FC: .4byte gUnk_03003DF0 +_080784FC: .4byte gPossibleInteraction _08078500: ldr r2, _08078528 @ =gPlayerState adds r0, r2, #0 @@ -74,27 +74,27 @@ _08078598: movs r0, #0xff mov r1, r8 strb r0, [r1, #3] - ldr r0, _080785AC @ =gUnk_0811C000 + ldr r0, _080785AC @ =gNoInteraction str r0, [r1, #4] movs r1, #1 mov r2, r8 strb r1, [r2] b _0807876A .align 2, 0 -_080785AC: .4byte gUnk_0811C000 +_080785AC: .4byte gNoInteraction _080785B0: ldr r0, [r2, #0x30] movs r1, #0x80 ands r0, r1 cmp r0, #0 bne _080785F0 - bl HasDungeonMap + bl HasDungeonSmallKey cmp r0, #0 beq _080785C4 movs r0, #1 _080785C4: adds r7, r0, #0 - bl HasDungeonCompass + bl HasDungeonBigKey cmp r0, #0 beq _080785D2 movs r0, #2 @@ -104,21 +104,21 @@ _080785D2: ldrb r0, [r3, #0x14] movs r1, #6 ands r1, r0 - ldr r0, _080785E8 @ =gUnk_0811C00C + ldr r0, _080785E8 @ =gPlayerInteractHitboxOffsetNormal adds r2, r1, r0 - ldr r5, _080785EC @ =gUnk_03003DF0 + ldr r5, _080785EC @ =gPossibleInteraction mov r8, r5 b _080785FE .align 2, 0 _080785E4: .4byte gPlayerEntity -_080785E8: .4byte gUnk_0811C00C -_080785EC: .4byte gUnk_03003DF0 +_080785E8: .4byte gPlayerInteractHitboxOffsetNormal +_080785EC: .4byte gPossibleInteraction _080785F0: ldr r3, _08078624 @ =gPlayerEntity ldrb r0, [r3, #0x14] movs r1, #6 ands r1, r0 - ldr r0, _08078628 @ =gUnk_0811C014 + ldr r0, _08078628 @ =gPlayerInteractHitboxOffsetMinish adds r2, r1, r0 movs r7, #0 _080785FE: @@ -138,12 +138,12 @@ _080785FE: adds r1, r1, r0 mov sb, r1 movs r6, #0 - ldr r5, _0807862C @ =gUnk_03003DF8 + ldr r5, _0807862C @ =gInteractableObjects b _08078724 .align 2, 0 _08078624: .4byte gPlayerEntity -_08078628: .4byte gUnk_0811C014 -_0807862C: .4byte gUnk_03003DF8 +_08078628: .4byte gPlayerInteractHitboxOffsetMinish +_0807862C: .4byte gInteractableObjects _08078630: ldrb r1, [r5] movs r3, #1 @@ -264,7 +264,7 @@ _08078714: lsls r0, r6, #1 adds r0, r0, r6 lsls r0, r0, #2 - ldr r3, _08078754 @ =gUnk_03003DF8 + ldr r3, _08078754 @ =gInteractableObjects adds r5, r0, r3 _08078724: ldr r2, [r5, #8] @@ -292,12 +292,12 @@ _0807873A: str r0, [r5, #4] b _08078762 .align 2, 0 -_08078754: .4byte gUnk_03003DF8 +_08078754: .4byte gInteractableObjects _08078758: movs r0, #0xff mov r1, r8 strb r0, [r1, #3] - ldr r0, _08078774 @ =gUnk_0811C000 + ldr r0, _08078774 @ =gNoInteraction str r0, [r1, #4] _08078762: movs r0, #1 @@ -311,5 +311,5 @@ _0807876A: mov sl, r5 pop {r4, r5, r6, r7, pc} .align 2, 0 -_08078774: .4byte gUnk_0811C000 +_08078774: .4byte gNoInteraction .syntax divided diff --git a/asm/src/code_08001A7C.s b/asm/src/code_08001A7C.s index a3b5224d..dfaa3ad4 100644 --- a/asm/src/code_08001A7C.s +++ b/asm/src/code_08001A7C.s @@ -786,9 +786,13 @@ gUnk_08002325:: @ 08002325 gUnk_0800232C:: @ 0800232C .incbin "code_080011C4/gUnk_0800232C.bin" +@ used for business scrub fusers, together with first 4 bytes of next table +@ each entry contains 6 bytes, the first 3 describe which entities are described by this, +@ the last 3 contain fuser id and text id for fuser name gUnk_0800232E:: @ 0800232E .incbin "code_080011C4/gUnk_0800232E.bin" +@ same as above, but for other fusers gUnk_08002342:: @ 08002342 .incbin "code_080011C4/gUnk_08002342.bin" @@ -798,11 +802,12 @@ GetFuserId: @ 0x08002632 ldr r4, _0800269C @ =gUnk_0800232E ldrb r3, [r0, #8] cmp r3, #3 - beq _08002642 + beq enemy cmp r3, #7 - bne _08002684 + bne not_found +npc: @ 0x08002640 ldr r4, _080026A0 @ =gUnk_08002342 -_08002642: +enemy: @ 0x08002642 ldrb r3, [r0, #9] lsls r1, r3, #0x10 ldrb r3, [r0, #0xa] @@ -810,43 +815,48 @@ _08002642: orrs r1, r3 ldrb r3, [r0, #0xb] orrs r1, r3 - add r6, pc, #0x38 -_08002652: + add r6, pc, #(entity_type_bitmasks - next - 2) @ pointer to entity_type_bitmasks +next: @ 0x08002652 adds r4, #6 - ldrb r3, [r4] + ldrb r3, [r4] @ entity id lsls r2, r3, #0x10 - beq _08002684 + beq not_found @ end of list reached movs r5, #0 - ldrb r3, [r4, #1] + ldrb r3, [r4, #1] @ entity type, or 0xff for any cmp r3, #0xff - bne _08002664 + bne must_match_entity_type movs r5, #8 -_08002664: +must_match_entity_type: @ 0x08002664 lsls r3, r3, #8 orrs r2, r3 - ldrb r3, [r4, #2] + ldrb r3, [r4, #2] @ entity type2, or 0xff for any cmp r3, #0xff - bne _08002670 + bne must_match_entity_type2 adds r5, #4 -_08002670: +must_match_entity_type2: @ 0x08002670 orrs r2, r3 ldr r5, [r6, r5] adds r3, r1, #0 ands r3, r5 ands r2, r5 cmp r3, r2 - bne _08002652 - ldrb r0, [r4, #3] - ldrh r1, [r4, #4] + bne next +match: @ 0x0800267E + ldrb r0, [r4, #3] @ fuser id + ldrh r1, [r4, #4] @ text id for fuser name, used in KinstoneMenu_080A4494 pop {r4, r5, r6, r7, pc} -_08002684: +not_found: @ 0x08002684 movs r0, #0 movs r1, #0 pop {r4, r5, r6, r7, pc} .align 2, 0 -_0800268C: +entity_type_bitmasks: @ 0x0800268C +@ each 0xFF means that entity member must match +@ type2 type id .byte 0xFF, 0xFF, 0xFF, 0x00 - .byte 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00 + .byte 0x00, 0xFF, 0xFF, 0x00 + .byte 0xFF, 0x00, 0xFF, 0x00 + .byte 0x00, 0x00, 0xFF, 0x00 _0800269C: .4byte gUnk_0800232E _080026A0: .4byte gUnk_08002342 diff --git a/data/scripts/cloudTops/script_GregalHealthy.inc b/data/scripts/cloudTops/script_GregalHealthy.inc index cbd342aa..10e0f160 100644 --- a/data/scripts/cloudTops/script_GregalHealthy.inc +++ b/data/scripts/cloudTops/script_GregalHealthy.inc @@ -1,7 +1,7 @@ @ Cloud Tops Gregal healthy SCRIPT_START script_GregalHealthy BeginBlock - Call sub_0806CD58 + Call Gregal_MakeInteractable DoPostScriptAction 0x000a SetAnimationState 0x0004 SetAnimation 0x0006 diff --git a/data/scripts/cloudTops/script_Npc4EFirstCloud.inc b/data/scripts/cloudTops/script_Npc4EFirstCloud.inc index 126ad33e..76d025fa 100644 --- a/data/scripts/cloudTops/script_Npc4EFirstCloud.inc +++ b/data/scripts/cloudTops/script_Npc4EFirstCloud.inc @@ -5,15 +5,15 @@ SCRIPT_START script_Npc4EFirstCloud SetAnimationState 0x0004 DoPostScriptAction 0x000b DoPostScriptAction 0x0008 - Call sub_0806DAAC + Call NPC4E_IsKinstoneFused JumpIf script_0800D6AE - Call sub_0806DAD0 - CallWithArg sub_0806DA04, 0x00000002 + Call NPC4E_MakeFuserInteractable + CallWithArg NPC4E_ChangeInteractableHitbox, 0x00000002 EndBlock script_0800D636: _0807EA4C _0807E9F0 - Call sub_0806DAAC + Call NPC4E_IsKinstoneFused JumpIf script_0800D650 Call EnablePauseMenu EnablePlayerControl @@ -28,9 +28,9 @@ script_0800D650: CameraTargetEntity _0807EDD4 0x01e8, 0x01b8 Wait 0x003c - Call sub_0806DAE8 + Call NPC4E_SetPinwheelFlag Wait 0x0078 - Call sub_0806DB44 + Call NPC4E_IsEveryPinwheelActivated JumpIfNot script_Npc4EKinstoneFused LoadRoomEntityList gUnk_080DD730 DoPostScriptAction 0x0006 diff --git a/data/scripts/cloudTops/script_Siroc.inc b/data/scripts/cloudTops/script_Siroc.inc index ba0c3e98..55efc778 100644 --- a/data/scripts/cloudTops/script_Siroc.inc +++ b/data/scripts/cloudTops/script_Siroc.inc @@ -1,7 +1,7 @@ @ Cloud Tops Windtribespeople Leader Siroc SCRIPT_START script_Siroc BeginBlock - Call sub_0806C870 + Call WindTribespeople_MakeInteractable DoPostScriptAction 0x000a EndBlock script_08014AD2: diff --git a/data/scripts/cloudTops/script_WindTribespeople1.inc b/data/scripts/cloudTops/script_WindTribespeople1.inc index 4b962633..e39b027f 100644 --- a/data/scripts/cloudTops/script_WindTribespeople1.inc +++ b/data/scripts/cloudTops/script_WindTribespeople1.inc @@ -1,7 +1,7 @@ @ Cloud Tops WindTribespeople blocking exit SCRIPT_START script_WindTribespeople1 BeginBlock - Call sub_0806C870 + Call WindTribespeople_MakeInteractable DoPostScriptAction 0x000a CheckGlobalFlag WARP_EVENT_END JumpIf script_08014976 diff --git a/data/scripts/cloudTops/script_WindTribespeople2.inc b/data/scripts/cloudTops/script_WindTribespeople2.inc index 37a99ee1..3eb9d71b 100644 --- a/data/scripts/cloudTops/script_WindTribespeople2.inc +++ b/data/scripts/cloudTops/script_WindTribespeople2.inc @@ -1,7 +1,7 @@ @ Cloud Top Windtribespeople woman on first floor SCRIPT_START script_WindTribespeople2 BeginBlock - Call sub_0806C870 + Call WindTribespeople_MakeInteractable DoPostScriptAction 0x000a CheckGlobalFlag WARP_EVENT_END JumpIfNot script_080149C6 diff --git a/data/scripts/cloudTops/script_WindTribespeople3.inc b/data/scripts/cloudTops/script_WindTribespeople3.inc index 84c60935..ba5b01cc 100644 --- a/data/scripts/cloudTops/script_WindTribespeople3.inc +++ b/data/scripts/cloudTops/script_WindTribespeople3.inc @@ -2,7 +2,7 @@ SCRIPT_START script_WindTribespeople3 BeginBlock SetEntitySpeed 0x0080 - Call sub_0806C870 + Call WindTribespeople_MakeInteractable DoPostScriptAction 0x000a EndBlock script_080149DE: diff --git a/data/scripts/cloudTops/script_WindTribespeople4.inc b/data/scripts/cloudTops/script_WindTribespeople4.inc index ba6fb854..33f31fe1 100644 --- a/data/scripts/cloudTops/script_WindTribespeople4.inc +++ b/data/scripts/cloudTops/script_WindTribespeople4.inc @@ -1,7 +1,7 @@ @ Cloud Tops Windtribespeople blocking way up SCRIPT_START script_WindTribespeople4 BeginBlock - Call sub_0806C870 + Call WindTribespeople_MakeInteractable DoPostScriptAction 0x000a EndBlock script_08014A36: diff --git a/data/scripts/cloudTops/script_WindTribespeople5.inc b/data/scripts/cloudTops/script_WindTribespeople5.inc index 698f9bb2..cb93bd49 100644 --- a/data/scripts/cloudTops/script_WindTribespeople5.inc +++ b/data/scripts/cloudTops/script_WindTribespeople5.inc @@ -1,7 +1,7 @@ @ Cloud Tops Windtribespeople at the bed SCRIPT_START script_WindTribespeople5 BeginBlock - Call sub_0806C870 + Call WindTribespeople_MakeInteractable DoPostScriptAction 0x000a EndBlock script_08014A62: diff --git a/data/scripts/cloudTops/script_WindTribespeople7.inc b/data/scripts/cloudTops/script_WindTribespeople7.inc index 36fc4fed..eb33c128 100644 --- a/data/scripts/cloudTops/script_WindTribespeople7.inc +++ b/data/scripts/cloudTops/script_WindTribespeople7.inc @@ -3,7 +3,7 @@ SCRIPT_START script_WindTribespeople7 BeginBlock CheckGlobalFlag KUMOTATSUMAKI JumpIf script_08014CD4 - Call sub_0806C870 + Call WindTribespeople_MakeInteractable DoPostScriptAction 0x000a DoPostScriptAction 0x0000 EndBlock diff --git a/data/scripts/cutscene/kinstones/script_HurdyGurdyManFirstKinstone.inc b/data/scripts/cutscene/kinstones/script_HurdyGurdyManFirstKinstone.inc index fa1a008d..101f2432 100644 --- a/data/scripts/cutscene/kinstones/script_HurdyGurdyManFirstKinstone.inc +++ b/data/scripts/cutscene/kinstones/script_HurdyGurdyManFirstKinstone.inc @@ -17,7 +17,7 @@ SCRIPT_START script_HurdyGurdyManFirstKinstone _0807E8E4_0 SetSyncFlag 0x00000040 WaitForSyncFlagAndClear 0x00000002 - Call sub_0806E440 + Call HurdyGurdyMan_MakeInteractable Wait 0x0078 SetSyncFlag 0x00000040 WaitForSyncFlagAndClear 0x00000002 diff --git a/data/scripts/dhc/script_MinishterPothoStone.inc b/data/scripts/dhc/script_MinishterPothoStone.inc index b4fa78a8..d09d7a9b 100644 --- a/data/scripts/dhc/script_MinishterPothoStone.inc +++ b/data/scripts/dhc/script_MinishterPothoStone.inc @@ -32,7 +32,7 @@ script_0800E0DE: WaitUntilTextboxCloses SetLocalFlag 0x0093 script_0800E12E: - Call sub_080668F0 + Call MinisterPotho_MakeInteractable EnablePlayerControl EndBlock script_0800E138: diff --git a/data/scripts/dhc/script_MinisterPothoCell.inc b/data/scripts/dhc/script_MinisterPothoCell.inc index 4fabc7ad..428097ae 100644 --- a/data/scripts/dhc/script_MinisterPothoCell.inc +++ b/data/scripts/dhc/script_MinisterPothoCell.inc @@ -3,7 +3,7 @@ SCRIPT_START script_MinisterPothoCell BeginBlock SetAnimationState 0x0002 DoPostScriptAction 0x000a - Call sub_080668F0 + Call MinisterPotho_MakeInteractable EndBlock script_0800E41A: CheckEntityInteractType diff --git a/data/scripts/graveyard/script_DampeInside2.inc b/data/scripts/graveyard/script_DampeInside2.inc index fba10fd3..eb800d94 100644 --- a/data/scripts/graveyard/script_DampeInside2.inc +++ b/data/scripts/graveyard/script_DampeInside2.inc @@ -1,7 +1,7 @@ @ Graveyard Dampe in house 2? SCRIPT_START script_DampeInside2 BeginBlock - Call sub_0806BE3C + Call Dampe_MakeInteractable DoPostScriptAction 0x000a DoPostScriptAction 0x0007 EndBlock diff --git a/data/scripts/graveyard/script_DampeOuside.inc b/data/scripts/graveyard/script_DampeOuside.inc index b1cede54..ff39fe74 100644 --- a/data/scripts/graveyard/script_DampeOuside.inc +++ b/data/scripts/graveyard/script_DampeOuside.inc @@ -14,7 +14,7 @@ script_08009646: Call sub_0806BF44 JumpIf script_08009646 EndBlock - Call sub_0806BE3C + Call Dampe_MakeInteractable DoPostScriptAction 0x000a DoPostScriptAction 0x0007 script_08009660: diff --git a/data/scripts/graveyard/script_GhostBrothers.inc b/data/scripts/graveyard/script_GhostBrothers.inc index b9fed2f1..5f9c6d81 100644 --- a/data/scripts/graveyard/script_GhostBrothers.inc +++ b/data/scripts/graveyard/script_GhostBrothers.inc @@ -1,7 +1,7 @@ @ Graveyard GhostBrothers SCRIPT_START script_GhostBrothers BeginBlock - Call sub_08065D00 + Call GhostBrothers_MakeInteractable SetAnimationState 0x0004 DoPostScriptAction 0x0000 DoPostScriptAction 0x000a diff --git a/data/scripts/hyruleCastle/script_KingDaltus.inc b/data/scripts/hyruleCastle/script_KingDaltus.inc index 09965292..d62653a3 100644 --- a/data/scripts/hyruleCastle/script_KingDaltus.inc +++ b/data/scripts/hyruleCastle/script_KingDaltus.inc @@ -3,7 +3,7 @@ SCRIPT_START script_KingDaltus BeginBlock SetAnimationState 0x0004 DoPostScriptAction 0x0000 - Call sub_0806672C + Call KingDaltus_MakeInteractable DoPostScriptAction 0x000a EndBlock Jump script_0800917C diff --git a/data/scripts/hyruleCastle/script_MinisterPotho.inc b/data/scripts/hyruleCastle/script_MinisterPotho.inc index 6bd64932..a5b4e11c 100644 --- a/data/scripts/hyruleCastle/script_MinisterPotho.inc +++ b/data/scripts/hyruleCastle/script_MinisterPotho.inc @@ -4,7 +4,7 @@ SCRIPT_START script_MinisterPotho SetAnimationState 0x0004 DoPostScriptAction 0x0000 script_0800927E: - Call sub_080668F0 + Call MinisterPotho_MakeInteractable DoPostScriptAction 0x000a EndBlock script_0800928A: diff --git a/data/scripts/hyruleTown/script_Anju.inc b/data/scripts/hyruleTown/script_Anju.inc index 09bf74c8..bf743b41 100644 --- a/data/scripts/hyruleTown/script_Anju.inc +++ b/data/scripts/hyruleTown/script_Anju.inc @@ -2,7 +2,7 @@ SCRIPT_START script_Anju BeginBlock DoPostScriptAction 0x0001 - Call sub_0806C354 + Call Anju_MakeInteractable DoPostScriptAction 0x000a EndBlock script_0801015A: diff --git a/data/scripts/hyruleTown/script_Beedle.inc b/data/scripts/hyruleTown/script_Beedle.inc index 49342981..d7c28c23 100644 --- a/data/scripts/hyruleTown/script_Beedle.inc +++ b/data/scripts/hyruleTown/script_Beedle.inc @@ -19,7 +19,7 @@ script_08010502: MessageNoOverlap TEXT_PICOLYTE, 0x10 WaitUntilTextboxCloses script_0801052E: - Call sub_080634E4 + Call Beedle_GetObjectType JumpTable script_08010544, script_08010558, script_08010570, script_08010570, script_0801054C, script_08010564, script_08010570 script_08010544: MessageNoOverlap TEXT_PICOLYTE, 0x0d @@ -37,7 +37,7 @@ script_08010564: JumpIfNot script_080105DC Jump script_08010570 script_08010570: - Call sub_080634EC + Call Beedle_ConfirmBuyItem CallWithArg ScriptCommand_SaleItemConfirmMessage, 0x00000000 WaitUntilTextboxCloses CheckTextboxResult @@ -46,7 +46,7 @@ script_08010570: JumpIfNot script_080105C4 CheckBottleContaining ITEM_BOTTLE_EMPTY JumpIfNot script_080105CC - Call sub_08063504 + Call Beedle_IsBottleInInventory JumpIf script_080105D4 MessageNoOverlap TEXT_PICOLYTE, 0x07 WaitUntilTextboxCloses diff --git a/data/scripts/hyruleTown/script_Brocco.inc b/data/scripts/hyruleTown/script_Brocco.inc index f01bc951..3637207a 100644 --- a/data/scripts/hyruleTown/script_Brocco.inc +++ b/data/scripts/hyruleTown/script_Brocco.inc @@ -3,7 +3,7 @@ SCRIPT_START script_Brocco BeginBlock SetAnimationState 0x0004 SetAnimation 0x0000 - Call sub_080636F4 + Call Brocco_MakeInteractable DoPostScriptAction 0x000a Call SetPriorityMessage EndBlock diff --git a/data/scripts/hyruleTown/script_Carpenter.inc b/data/scripts/hyruleTown/script_Carpenter.inc index 9a29615b..3358f344 100644 --- a/data/scripts/hyruleTown/script_Carpenter.inc +++ b/data/scripts/hyruleTown/script_Carpenter.inc @@ -4,7 +4,7 @@ SCRIPT_START script_Carpenter SetAnimationState 0x0004 CallWithArg sub_080672B0, 0x00000000 DoPostScriptAction 0x000a - Call sub_08067314 + Call Carpenter_MakeInteractable EndBlock script_08010AB4: CheckEntityInteractType diff --git a/data/scripts/hyruleTown/script_CatPerson.inc b/data/scripts/hyruleTown/script_CatPerson.inc index 73cfba96..975ff68d 100644 --- a/data/scripts/hyruleTown/script_CatPerson.inc +++ b/data/scripts/hyruleTown/script_CatPerson.inc @@ -1,7 +1,7 @@ @ Hyrule Townsperson house with cat SCRIPT_START script_CatPerson BeginBlock - Call sub_08061E70 + Call Townsperson_MakeInteractable DoPostScriptAction 0x000a SetAnimationState 0x0004 Call sub_08061FD8 diff --git a/data/scripts/hyruleTown/script_CatPersonTalkingToDogPerson.inc b/data/scripts/hyruleTown/script_CatPersonTalkingToDogPerson.inc index f81c9e64..2ef2df5a 100644 --- a/data/scripts/hyruleTown/script_CatPersonTalkingToDogPerson.inc +++ b/data/scripts/hyruleTown/script_CatPersonTalkingToDogPerson.inc @@ -1,7 +1,7 @@ @ Hyrule Town Cat person talking to Dog person SCRIPT_START script_CatPersonTalkingToDogPerson BeginBlock - Call sub_08061E70 + Call Townsperson_MakeInteractable DoPostScriptAction 0x000a SetAnimationState 0x0002 Call sub_08061FD8 diff --git a/data/scripts/hyruleTown/script_Din.inc b/data/scripts/hyruleTown/script_Din.inc index 3382477f..64cce82b 100644 --- a/data/scripts/hyruleTown/script_Din.inc +++ b/data/scripts/hyruleTown/script_Din.inc @@ -1,7 +1,7 @@ @ Hyrule Town Din SCRIPT_START script_Din BeginBlock - Call sub_08064828 + Call Din_MakeInteractable SetAnimationState 0x0004 DoPostScriptAction 0x0001 DoPostScriptAction 0x000a diff --git a/data/scripts/hyruleTown/script_Din2.inc b/data/scripts/hyruleTown/script_Din2.inc index cf4f02a1..19993357 100644 --- a/data/scripts/hyruleTown/script_Din2.inc +++ b/data/scripts/hyruleTown/script_Din2.inc @@ -1,7 +1,7 @@ @ Hyrule Town Din when one of them has moved in SCRIPT_START script_Din2 BeginBlock - Call sub_08064828 + Call Din_MakeInteractable SetAnimationState 0x0004 DoPostScriptAction 0x0001 DoPostScriptAction 0x000a diff --git a/data/scripts/hyruleTown/script_DinAlone.inc b/data/scripts/hyruleTown/script_DinAlone.inc index 61ddd2c3..1e035f0a 100644 --- a/data/scripts/hyruleTown/script_DinAlone.inc +++ b/data/scripts/hyruleTown/script_DinAlone.inc @@ -1,7 +1,7 @@ @ Din completely alone SCRIPT_START script_DinAlone BeginBlock - Call sub_08064828 + Call Din_MakeInteractable SetAnimationState 0x0004 DoPostScriptAction 0x0001 DoPostScriptAction 0x000a diff --git a/data/scripts/hyruleTown/script_DinMovedIn.inc b/data/scripts/hyruleTown/script_DinMovedIn.inc index 578f3182..e4b269a1 100644 --- a/data/scripts/hyruleTown/script_DinMovedIn.inc +++ b/data/scripts/hyruleTown/script_DinMovedIn.inc @@ -1,7 +1,7 @@ @ Hyrule Town Din moved in SCRIPT_START script_DinMovedIn BeginBlock - Call sub_08064828 + Call Din_MakeInteractable SetAnimationState 0x0004 DoPostScriptAction 0x0001 DoPostScriptAction 0x000a diff --git a/data/scripts/hyruleTown/script_DogPersonInCatHouse.inc b/data/scripts/hyruleTown/script_DogPersonInCatHouse.inc index 2cc56734..ddb3beef 100644 --- a/data/scripts/hyruleTown/script_DogPersonInCatHouse.inc +++ b/data/scripts/hyruleTown/script_DogPersonInCatHouse.inc @@ -1,7 +1,7 @@ @ Hyrule Town Dog person talking to Cat person SCRIPT_START script_DogPersonInCatHouse BeginBlock - Call sub_08061E70 + Call Townsperson_MakeInteractable DoPostScriptAction 0x000a SetAnimationState 0x0006 Call sub_08061FD8 @@ -19,7 +19,7 @@ script_0800EB7C: Call sub_08061FD8 Jump script_0800EB7C BeginBlock - Call sub_08061E70 + Call Townsperson_MakeInteractable DoPostScriptAction 0x000a SetAnimationState 0x0002 Call sub_08061FD8 diff --git a/data/scripts/hyruleTown/script_Farore.inc b/data/scripts/hyruleTown/script_Farore.inc index 3477a9fb..5fc0a12b 100644 --- a/data/scripts/hyruleTown/script_Farore.inc +++ b/data/scripts/hyruleTown/script_Farore.inc @@ -1,7 +1,7 @@ @ Hyrule Town Farore SCRIPT_START script_Farore BeginBlock - Call sub_08064A28 + Call Farore_MakeInteractable SetAnimationState 0x0004 DoPostScriptAction 0x0001 DoPostScriptAction 0x000a diff --git a/data/scripts/hyruleTown/script_Farore2.inc b/data/scripts/hyruleTown/script_Farore2.inc index 0f3e9303..252b83c8 100644 --- a/data/scripts/hyruleTown/script_Farore2.inc +++ b/data/scripts/hyruleTown/script_Farore2.inc @@ -1,7 +1,7 @@ @ Hyrule Town Farore when one of them has moved in SCRIPT_START script_Farore2 BeginBlock - Call sub_08064A28 + Call Farore_MakeInteractable SetAnimationState 0x0004 DoPostScriptAction 0x0001 DoPostScriptAction 0x000a diff --git a/data/scripts/hyruleTown/script_FaroreAlone.inc b/data/scripts/hyruleTown/script_FaroreAlone.inc index 03a869de..30b0b454 100644 --- a/data/scripts/hyruleTown/script_FaroreAlone.inc +++ b/data/scripts/hyruleTown/script_FaroreAlone.inc @@ -1,7 +1,7 @@ @ Farore completely alone SCRIPT_START script_FaroreAlone BeginBlock - Call sub_08064A28 + Call Farore_MakeInteractable SetAnimationState 0x0004 DoPostScriptAction 0x0001 DoPostScriptAction 0x000a diff --git a/data/scripts/hyruleTown/script_FaroreMovedIn.inc b/data/scripts/hyruleTown/script_FaroreMovedIn.inc index 1ea10abe..5437e6ef 100644 --- a/data/scripts/hyruleTown/script_FaroreMovedIn.inc +++ b/data/scripts/hyruleTown/script_FaroreMovedIn.inc @@ -1,7 +1,7 @@ @ Farore moved in SCRIPT_START script_FaroreMovedIn BeginBlock - Call sub_08064A28 + Call Farore_MakeInteractable SetAnimationState 0x0004 DoPostScriptAction 0x0001 DoPostScriptAction 0x000a diff --git a/data/scripts/hyruleTown/script_ForestMinish11.inc b/data/scripts/hyruleTown/script_ForestMinish11.inc index 9d5214c7..48fed47e 100644 --- a/data/scripts/hyruleTown/script_ForestMinish11.inc +++ b/data/scripts/hyruleTown/script_ForestMinish11.inc @@ -1,7 +1,7 @@ @ Forest Minish above cafe SCRIPT_START script_ForestMinish11 BeginBlock - Call sub_08060090 + Call ForestMinish_MakeInteractable DoPostScriptAction 0x000a EndBlock script_0800E6BE: diff --git a/data/scripts/hyruleTown/script_HurdyGurdyMan.inc b/data/scripts/hyruleTown/script_HurdyGurdyMan.inc index 7daf6e2c..1ebc20b4 100644 --- a/data/scripts/hyruleTown/script_HurdyGurdyMan.inc +++ b/data/scripts/hyruleTown/script_HurdyGurdyMan.inc @@ -4,7 +4,7 @@ SCRIPT_START script_HurdyGurdyMan DoPostScriptAction 0x000a SetAnimationState 0x0004 SetAnimation 0x0008 - Call sub_0806E440 + Call HurdyGurdyMan_MakeInteractable EndBlock script_08010BCA: CheckEntityInteractType diff --git a/data/scripts/hyruleTown/script_Kid1.inc b/data/scripts/hyruleTown/script_Kid1.inc index 732289b5..1b1af5dd 100644 --- a/data/scripts/hyruleTown/script_Kid1.inc +++ b/data/scripts/hyruleTown/script_Kid1.inc @@ -2,7 +2,7 @@ SCRIPT_START script_Kid1 BeginBlock DoPostScriptAction 0x0000 - Call sub_08062A48 + Call Kid_MakeInteractable DoPostScriptAction 0x000a EndBlock script_080102A6: diff --git a/data/scripts/hyruleTown/script_Kid2.inc b/data/scripts/hyruleTown/script_Kid2.inc index 65a9125b..a0c65639 100644 --- a/data/scripts/hyruleTown/script_Kid2.inc +++ b/data/scripts/hyruleTown/script_Kid2.inc @@ -2,7 +2,7 @@ SCRIPT_START script_Kid2 BeginBlock DoPostScriptAction 0x0000 - Call sub_08062A48 + Call Kid_MakeInteractable DoPostScriptAction 0x000a EndBlock script_080102F2: diff --git a/data/scripts/hyruleTown/script_Kid4.inc b/data/scripts/hyruleTown/script_Kid4.inc index da188edd..4b15c564 100644 --- a/data/scripts/hyruleTown/script_Kid4.inc +++ b/data/scripts/hyruleTown/script_Kid4.inc @@ -2,7 +2,7 @@ SCRIPT_START script_Kid4 BeginBlock DoPostScriptAction 0x0000 - Call sub_08062A48 + Call Kid_MakeInteractable DoPostScriptAction 0x000a EndBlock script_080103C2: diff --git a/data/scripts/hyruleTown/script_Kid5.inc b/data/scripts/hyruleTown/script_Kid5.inc index 4465b197..ac7006a4 100644 --- a/data/scripts/hyruleTown/script_Kid5.inc +++ b/data/scripts/hyruleTown/script_Kid5.inc @@ -3,7 +3,7 @@ SCRIPT_START script_Kid5 BeginBlock SetAnimation 0x0008 script_08010622: - Call sub_08062A48 + Call Kid_MakeInteractable DoPostScriptAction 0x000a EndBlock script_0801062E: diff --git a/data/scripts/hyruleTown/script_KidInn.inc b/data/scripts/hyruleTown/script_KidInn.inc index 43a709a2..1ba953ad 100644 --- a/data/scripts/hyruleTown/script_KidInn.inc +++ b/data/scripts/hyruleTown/script_KidInn.inc @@ -2,7 +2,7 @@ SCRIPT_START script_KidInn BeginBlock DoPostScriptAction 0x000a - Call sub_08062A48 + Call Kid_MakeInteractable DoPostScriptAction 0x0000 script_0800D5AC: EndBlock diff --git a/data/scripts/hyruleTown/script_LibraryVisitor.inc b/data/scripts/hyruleTown/script_LibraryVisitor.inc index 1d0d7132..680ac8e4 100644 --- a/data/scripts/hyruleTown/script_LibraryVisitor.inc +++ b/data/scripts/hyruleTown/script_LibraryVisitor.inc @@ -2,7 +2,7 @@ SCRIPT_START script_LibraryVisitor BeginBlock Call sub_08061FD8 - Call sub_08061E70 + Call Townsperson_MakeInteractable DoPostScriptAction 0x000a EndBlock script_08008DA0: diff --git a/data/scripts/hyruleTown/script_Mama.inc b/data/scripts/hyruleTown/script_Mama.inc index c286a0d2..f8ab1a20 100644 --- a/data/scripts/hyruleTown/script_Mama.inc +++ b/data/scripts/hyruleTown/script_Mama.inc @@ -1,7 +1,7 @@ @ Hyrule Town Mama SCRIPT_START script_Mama BeginBlock - Call sub_0806C4F8 + Call Mama_MakeInteractable DoPostScriptAction 0x000a SetAnimationState 0x0000 EndBlock diff --git a/data/scripts/hyruleTown/script_Mayor.inc b/data/scripts/hyruleTown/script_Mayor.inc index 1761b2cf..5b04586a 100644 --- a/data/scripts/hyruleTown/script_Mayor.inc +++ b/data/scripts/hyruleTown/script_Mayor.inc @@ -1,7 +1,7 @@ @ Hyrule Town Mayor Hagen SCRIPT_START script_Mayor BeginBlock - Call sub_0806CE5C + Call MayorHagen_MakeInteractable DoPostScriptAction 0x000a SetAnimationState 0x0004 SetAnimation 0x0008 diff --git a/data/scripts/hyruleTown/script_MutohInMill.inc b/data/scripts/hyruleTown/script_MutohInMill.inc index ee10eeba..ef84ee3e 100644 --- a/data/scripts/hyruleTown/script_MutohInMill.inc +++ b/data/scripts/hyruleTown/script_MutohInMill.inc @@ -1,7 +1,7 @@ @ Hyrule Town Mutoh SCRIPT_START script_MutohInMill BeginBlock - Call sub_08067100 + Call Mutoh_MakeInteractable DoPostScriptAction 0x000a SetAnimationState 0x0004 DoPostScriptAction 0x0000 diff --git a/data/scripts/hyruleTown/script_Nayru.inc b/data/scripts/hyruleTown/script_Nayru.inc index e311efcc..6798b860 100644 --- a/data/scripts/hyruleTown/script_Nayru.inc +++ b/data/scripts/hyruleTown/script_Nayru.inc @@ -1,7 +1,7 @@ @ Hyrule Town Nayru SCRIPT_START script_Nayru BeginBlock - Call sub_08064928 + Call Nayru_MakeInteractable SetAnimationState 0x0004 DoPostScriptAction 0x0001 DoPostScriptAction 0x000a diff --git a/data/scripts/hyruleTown/script_Nayru2.inc b/data/scripts/hyruleTown/script_Nayru2.inc index ab085b28..b4555057 100644 --- a/data/scripts/hyruleTown/script_Nayru2.inc +++ b/data/scripts/hyruleTown/script_Nayru2.inc @@ -1,7 +1,7 @@ @ Hyrule Town Nayru when one of them has moved in SCRIPT_START script_Nayru2 BeginBlock - Call sub_08064928 + Call Nayru_MakeInteractable SetAnimationState 0x0004 DoPostScriptAction 0x0001 DoPostScriptAction 0x000a diff --git a/data/scripts/hyruleTown/script_NayruAlone.inc b/data/scripts/hyruleTown/script_NayruAlone.inc index 6fbd687d..9b72c947 100644 --- a/data/scripts/hyruleTown/script_NayruAlone.inc +++ b/data/scripts/hyruleTown/script_NayruAlone.inc @@ -1,7 +1,7 @@ @ Nayru completely alone SCRIPT_START script_NayruAlone BeginBlock - Call sub_08064928 + Call Nayru_MakeInteractable SetAnimationState 0x0004 DoPostScriptAction 0x0001 DoPostScriptAction 0x000a diff --git a/data/scripts/hyruleTown/script_NayruMovedIn.inc b/data/scripts/hyruleTown/script_NayruMovedIn.inc index 8a143338..50645ef0 100644 --- a/data/scripts/hyruleTown/script_NayruMovedIn.inc +++ b/data/scripts/hyruleTown/script_NayruMovedIn.inc @@ -1,7 +1,7 @@ @ Nayru moved in SCRIPT_START script_NayruMovedIn BeginBlock - Call sub_08064928 + Call Nayru_MakeInteractable SetAnimationState 0x0004 DoPostScriptAction 0x0001 DoPostScriptAction 0x000a diff --git a/data/scripts/hyruleTown/script_OldLadyCatHouse1.inc b/data/scripts/hyruleTown/script_OldLadyCatHouse1.inc index c5905a83..3f6dcb4a 100644 --- a/data/scripts/hyruleTown/script_OldLadyCatHouse1.inc +++ b/data/scripts/hyruleTown/script_OldLadyCatHouse1.inc @@ -1,7 +1,7 @@ @ Older lady in cat persons house SCRIPT_START script_OldLadyCatHouse1 BeginBlock - Call sub_08061E70 + Call Townsperson_MakeInteractable DoPostScriptAction 0x000a SetAnimationState 0x0004 Call sub_08061FD8 diff --git a/data/scripts/hyruleTown/script_OldLadyCatHouse2.inc b/data/scripts/hyruleTown/script_OldLadyCatHouse2.inc index edaf3a11..1c1ce611 100644 --- a/data/scripts/hyruleTown/script_OldLadyCatHouse2.inc +++ b/data/scripts/hyruleTown/script_OldLadyCatHouse2.inc @@ -1,7 +1,7 @@ @ Older lady in cat persons house SCRIPT_START script_OldLadyCatHouse2 BeginBlock - Call sub_08061E70 + Call Townsperson_MakeInteractable DoPostScriptAction 0x000a SetAnimationState 0x0006 Call sub_08061FD8 diff --git a/data/scripts/hyruleTown/script_Phonograph.inc b/data/scripts/hyruleTown/script_Phonograph.inc index 12071bc5..ae6c6ed3 100644 --- a/data/scripts/hyruleTown/script_Phonograph.inc +++ b/data/scripts/hyruleTown/script_Phonograph.inc @@ -1,7 +1,7 @@ @ Phonograph SCRIPT_START script_Phonograph BeginBlock - Call sub_0807F934 + Call MakeCheckableObjectInteractable EndBlock script_0800BA46: CheckEntityInteractType diff --git a/data/scripts/hyruleTown/script_Pina.inc b/data/scripts/hyruleTown/script_Pina.inc index 866ef334..8cfc8f8d 100644 --- a/data/scripts/hyruleTown/script_Pina.inc +++ b/data/scripts/hyruleTown/script_Pina.inc @@ -3,7 +3,7 @@ SCRIPT_START script_Pina BeginBlock SetAnimationState 0x0004 SetAnimation 0x0000 - Call sub_08063CAC + Call Pina_MakeInteractable DoPostScriptAction 0x000a Call SetPriorityMessage EndBlock diff --git a/data/scripts/hyruleTown/script_Postman.inc b/data/scripts/hyruleTown/script_Postman.inc index 1aff3231..36f3a400 100644 --- a/data/scripts/hyruleTown/script_Postman.inc +++ b/data/scripts/hyruleTown/script_Postman.inc @@ -10,7 +10,7 @@ SCRIPT_START script_Postman Call sub_0806075C EndBlock WaitUntilTextboxCloses - Call sub_080606C0 + Call Postman_MakeInteractable script_08010B10: EndBlock Call sub_0806076C diff --git a/data/scripts/hyruleTown/script_Rem.inc b/data/scripts/hyruleTown/script_Rem.inc index fa58f73d..a7384e2a 100644 --- a/data/scripts/hyruleTown/script_Rem.inc +++ b/data/scripts/hyruleTown/script_Rem.inc @@ -1,7 +1,7 @@ @ Hyrule Town Rem SCRIPT_START script_Rem BeginBlock - CallWithArg sub_0806A93C, 0x12345678 + CallWithArg Rem_MakeInteractable, 0x12345678 SetAnimationState 0x0004 SetAnimation 0x0002 CheckInventory1 ITEM_PEGASUS_BOOTS diff --git a/data/scripts/hyruleTown/script_SittingPerson.inc b/data/scripts/hyruleTown/script_SittingPerson.inc index f61560d7..3fecc6df 100644 --- a/data/scripts/hyruleTown/script_SittingPerson.inc +++ b/data/scripts/hyruleTown/script_SittingPerson.inc @@ -1,7 +1,7 @@ @ Hyrule Town SittingPerson SCRIPT_START script_SittingPerson BeginBlock - Call sub_080639D0 + Call SittingPerson_MakeInteractable DoPostScriptAction 0x000a EndBlock BeginBlock diff --git a/data/scripts/hyruleTown/script_SmallTownMinish.inc b/data/scripts/hyruleTown/script_SmallTownMinish.inc index d97d0801..8c3b2727 100644 --- a/data/scripts/hyruleTown/script_SmallTownMinish.inc +++ b/data/scripts/hyruleTown/script_SmallTownMinish.inc @@ -3,7 +3,7 @@ SCRIPT_START script_SmallTownMinish BeginBlock CheckPlayerMinish JumpIfNot script_08010BAC - Call sub_0807F924 + Call MakeInteractableAsMinish SetAnimationState 0x0004 DoPostScriptAction 0x0000 DoPostScriptAction 0x0007 diff --git a/data/scripts/hyruleTown/script_Sturgeon.inc b/data/scripts/hyruleTown/script_Sturgeon.inc index db91eb49..a73997bd 100644 --- a/data/scripts/hyruleTown/script_Sturgeon.inc +++ b/data/scripts/hyruleTown/script_Sturgeon.inc @@ -1,7 +1,7 @@ @ Library Sturgeon SCRIPT_START script_Sturgeon BeginBlock - Call sub_08064CC0 + Call Sturgeon_MakeInteractable DoPostScriptAction 0x000a DoPostScriptAction 0x0007 SetAnimationState 0x0002 diff --git a/data/scripts/hyruleTown/script_Teachers.inc b/data/scripts/hyruleTown/script_Teachers.inc index b7898239..202a48dc 100644 --- a/data/scripts/hyruleTown/script_Teachers.inc +++ b/data/scripts/hyruleTown/script_Teachers.inc @@ -1,7 +1,7 @@ @ Hyrule Town Teachers SCRIPT_START script_Teachers BeginBlock - Call sub_0806C674 + Call Teachers_MakeInteractable DoPostScriptAction 0x000a SetAnimationState 0x0004 EndBlock diff --git a/data/scripts/hyruleTown/script_TownMinish1.inc b/data/scripts/hyruleTown/script_TownMinish1.inc index 248f4c2d..30be6472 100644 --- a/data/scripts/hyruleTown/script_TownMinish1.inc +++ b/data/scripts/hyruleTown/script_TownMinish1.inc @@ -2,7 +2,7 @@ @ also in library, cafe SCRIPT_START script_TownMinish1 BeginBlock - Call sub_0806ADFC + Call TownMinish_MakeInteractable DoPostScriptAction 0x000a script_0800E6F4: EndBlock diff --git a/data/scripts/hyruleTown/script_Townsperson1.inc b/data/scripts/hyruleTown/script_Townsperson1.inc index 259d47b4..55bebc1f 100644 --- a/data/scripts/hyruleTown/script_Townsperson1.inc +++ b/data/scripts/hyruleTown/script_Townsperson1.inc @@ -2,7 +2,7 @@ SCRIPT_START script_Townsperson1 BeginBlock Call sub_08061FE4 - Call sub_08061E70 + Call Townsperson_MakeInteractable DoPostScriptAction 0x000a EndBlock script_080100DC: diff --git a/data/scripts/hyruleTown/script_Townsperson2.inc b/data/scripts/hyruleTown/script_Townsperson2.inc index 535ade2e..f0b2e9ad 100644 --- a/data/scripts/hyruleTown/script_Townsperson2.inc +++ b/data/scripts/hyruleTown/script_Townsperson2.inc @@ -2,7 +2,7 @@ SCRIPT_START script_Townsperson2 BeginBlock Call sub_08061FE4 - Call sub_08061E70 + Call Townsperson_MakeInteractable DoPostScriptAction 0x000a EndBlock script_08010110: diff --git a/data/scripts/hyruleTown/script_TownspersonInDogHouse.inc b/data/scripts/hyruleTown/script_TownspersonInDogHouse.inc index 7be84de5..a3da4d63 100644 --- a/data/scripts/hyruleTown/script_TownspersonInDogHouse.inc +++ b/data/scripts/hyruleTown/script_TownspersonInDogHouse.inc @@ -1,7 +1,7 @@ @ Hyrule Townsperson house with dog SCRIPT_START script_TownspersonInDogHouse BeginBlock - Call sub_08061E70 + Call Townsperson_MakeInteractable DoPostScriptAction 0x000a SetAnimationState 0x0004 Call sub_08061FD8 diff --git a/data/scripts/hyruleTown/script_WindTribespeopleVisitor.inc b/data/scripts/hyruleTown/script_WindTribespeopleVisitor.inc index ce39d48f..a1346c00 100644 --- a/data/scripts/hyruleTown/script_WindTribespeopleVisitor.inc +++ b/data/scripts/hyruleTown/script_WindTribespeopleVisitor.inc @@ -1,7 +1,7 @@ @ Hyrule Town Windstribepeople in house SCRIPT_START script_WindTribespeopleVisitor BeginBlock - Call sub_0806C870 + Call WindTribespeople_MakeInteractable DoPostScriptAction 0x000a SetAnimationState 0x0004 SetAnimation 0x0000 diff --git a/data/scripts/lakeHylia/script_ForestMinish3.inc b/data/scripts/lakeHylia/script_ForestMinish3.inc index 26ad3f5a..4a0ab477 100644 --- a/data/scripts/lakeHylia/script_ForestMinish3.inc +++ b/data/scripts/lakeHylia/script_ForestMinish3.inc @@ -1,7 +1,7 @@ @ Lake Hylia Forest Minish telling us to go to the library SCRIPT_START script_ForestMinish3 BeginBlock - Call sub_08060090 + Call ForestMinish_MakeInteractable DoPostScriptAction 0x000a EndBlock script_0800C5D6: diff --git a/data/scripts/lonLonRanch/script_GoronPunching.inc b/data/scripts/lonLonRanch/script_GoronPunching.inc index ebe77add..992ee9eb 100644 --- a/data/scripts/lonLonRanch/script_GoronPunching.inc +++ b/data/scripts/lonLonRanch/script_GoronPunching.inc @@ -4,7 +4,7 @@ SCRIPT_START script_GoronPunching _0807E9D4 Call sub_080694EC DoPostScriptAction 0x000a - Call sub_080694B0 + Call Goron_MakeInteractable EndBlock script_0800B9CA: Call CheckInteractType diff --git a/data/scripts/minishWoods/script_BombMinish.inc b/data/scripts/minishWoods/script_BombMinish.inc index 2be316b6..5f2b461a 100644 --- a/data/scripts/minishWoods/script_BombMinish.inc +++ b/data/scripts/minishWoods/script_BombMinish.inc @@ -2,7 +2,7 @@ SCRIPT_START script_BombMinish BeginBlock SetAnimationState 0x0004 - Call sub_08060090 + Call ForestMinish_MakeInteractable DoPostScriptAction 0x000a CheckKinstoneFused KINSTONE_1C JumpIf script_08009FD2 diff --git a/data/scripts/minishWoods/script_CutsceneOrchestratorPotionBlue.inc b/data/scripts/minishWoods/script_CutsceneOrchestratorPotionBlue.inc index 3856ef0a..ea855b06 100644 --- a/data/scripts/minishWoods/script_CutsceneOrchestratorPotionBlue.inc +++ b/data/scripts/minishWoods/script_CutsceneOrchestratorPotionBlue.inc @@ -1,7 +1,7 @@ @ Syrup CUTSCENE_ORCHESTRATOR Potion SCRIPT_START script_CutsceneOrchestratorPotionBlue BeginBlock - Call sub_080787B4 + Call AddInteractableCheckableObject EndBlock script_08016146: CheckEntityInteractType diff --git a/data/scripts/minishWoods/script_CutsceneOrchestratorPotionRed.inc b/data/scripts/minishWoods/script_CutsceneOrchestratorPotionRed.inc index 4000dbfb..17b15a7b 100644 --- a/data/scripts/minishWoods/script_CutsceneOrchestratorPotionRed.inc +++ b/data/scripts/minishWoods/script_CutsceneOrchestratorPotionRed.inc @@ -1,7 +1,7 @@ @ CUTSCENE_ORCHESTRATOR in witch hut? SCRIPT_START script_CutsceneOrchestratorPotionRed BeginBlock - Call sub_080787B4 + Call AddInteractableCheckableObject EndBlock script_0801619A: CheckEntityInteractType diff --git a/data/scripts/minishWoods/script_ForestMinish10.inc b/data/scripts/minishWoods/script_ForestMinish10.inc index 9ee0b042..6c3c5fa8 100644 --- a/data/scripts/minishWoods/script_ForestMinish10.inc +++ b/data/scripts/minishWoods/script_ForestMinish10.inc @@ -3,7 +3,7 @@ SCRIPT_START script_ForestMinish10 BeginBlock CheckInventory1 ITEM_JABBERNUT JumpIfNot script_0800C5FE - Call sub_08060090 + Call ForestMinish_MakeInteractable DoPostScriptAction 0x000a EndBlock script_0800CD92: diff --git a/data/scripts/minishWoods/script_ForestMinish4.inc b/data/scripts/minishWoods/script_ForestMinish4.inc index 2663d585..3008312b 100644 --- a/data/scripts/minishWoods/script_ForestMinish4.inc +++ b/data/scripts/minishWoods/script_ForestMinish4.inc @@ -2,7 +2,7 @@ SCRIPT_START script_ForestMinish4 BeginBlock script_0800C5FE: - Call sub_08060090 + Call ForestMinish_MakeInteractable DoPostScriptAction 0x000a EndBlock script_0800C60A: diff --git a/data/scripts/mtCrenel/script_CrenelHermit.inc b/data/scripts/mtCrenel/script_CrenelHermit.inc index 91d499ad..59430538 100644 --- a/data/scripts/mtCrenel/script_CrenelHermit.inc +++ b/data/scripts/mtCrenel/script_CrenelHermit.inc @@ -1,7 +1,7 @@ @ Crenel Hermit SCRIPT_START script_CrenelHermit BeginBlock - Call sub_08061E70 + Call Townsperson_MakeInteractable DoPostScriptAction 0x000a SetAnimationState 0x0004 Call sub_08061FD8 diff --git a/data/scripts/mtCrenel/script_MelariInRoom.inc b/data/scripts/mtCrenel/script_MelariInRoom.inc index 3e5b9e8a..b0581826 100644 --- a/data/scripts/mtCrenel/script_MelariInRoom.inc +++ b/data/scripts/mtCrenel/script_MelariInRoom.inc @@ -1,7 +1,7 @@ @ Mines Melari in his room SCRIPT_START script_MelariInRoom BeginBlock - Call sub_08068884 + Call Melari_MakeInteractable DoPostScriptAction 0x000a SetAnimationState 0x0004 SetAnimation 0x0000 diff --git a/data/scripts/mtCrenel/script_MountainMinish1.inc b/data/scripts/mtCrenel/script_MountainMinish1.inc index 20e946d1..e745e8dd 100644 --- a/data/scripts/mtCrenel/script_MountainMinish1.inc +++ b/data/scripts/mtCrenel/script_MountainMinish1.inc @@ -1,7 +1,7 @@ @ Mines Mountain Minish before beds SCRIPT_START script_MountainMinish1 BeginBlock - Call sub_08068104 + Call MountainMinish_MakeInteractable DoPostScriptAction 0x000a EndBlock script_0800CF5E: diff --git a/data/scripts/mtCrenel/script_MountainMinish2.inc b/data/scripts/mtCrenel/script_MountainMinish2.inc index de34aca9..cdf4e14d 100644 --- a/data/scripts/mtCrenel/script_MountainMinish2.inc +++ b/data/scripts/mtCrenel/script_MountainMinish2.inc @@ -1,7 +1,7 @@ @ Mines Mountain Minish SCRIPT_START script_MountainMinish2 BeginBlock - Call sub_08068104 + Call MountainMinish_MakeInteractable DoPostScriptAction 0x000a EndBlock script_0800CF96: diff --git a/data/scripts/mtCrenel/script_MountainMinish4.inc b/data/scripts/mtCrenel/script_MountainMinish4.inc index f1689e97..1716194d 100644 --- a/data/scripts/mtCrenel/script_MountainMinish4.inc +++ b/data/scripts/mtCrenel/script_MountainMinish4.inc @@ -1,7 +1,7 @@ @ Mines Mountain Minish at exit SCRIPT_START script_MountainMinish4 BeginBlock - Call sub_08068104 + Call MountainMinish_MakeInteractable DoPostScriptAction 0x000a EndBlock script_0800D35E: diff --git a/data/scripts/mtCrenel/script_MountainMinish5.inc b/data/scripts/mtCrenel/script_MountainMinish5.inc index edbf2f01..2d54f64e 100644 --- a/data/scripts/mtCrenel/script_MountainMinish5.inc +++ b/data/scripts/mtCrenel/script_MountainMinish5.inc @@ -2,7 +2,7 @@ SCRIPT_START script_MountainMinish5 BeginBlock SetEntitySpeed 0x0100 - Call sub_08068104 + Call MountainMinish_MakeInteractable DoPostScriptAction 0x000a EndBlock script_0800D426: @@ -42,7 +42,7 @@ script_0800D426: .2byte 0x0000 BeginBlock DoPostScriptAction 0x000a - Call sub_08062A48 + Call Kid_MakeInteractable SetAnimationState 0x0004 DoPostScriptAction 0x0000 script_0800D4E4: diff --git a/data/scripts/northHyruleField/script_CarpenterOutsideTown.inc b/data/scripts/northHyruleField/script_CarpenterOutsideTown.inc index e9af8375..49beaa01 100644 --- a/data/scripts/northHyruleField/script_CarpenterOutsideTown.inc +++ b/data/scripts/northHyruleField/script_CarpenterOutsideTown.inc @@ -2,7 +2,7 @@ @ Hyrule Town Carpenter SCRIPT_START script_CarpenterOutsideTown BeginBlock - Call sub_08067314 + Call Carpenter_MakeInteractable DoPostScriptAction 0x000a SetAnimationState 0x0004 SetIntVariable 0x00000000 diff --git a/data/scripts/northHyruleField/script_MutohOutsideTown.inc b/data/scripts/northHyruleField/script_MutohOutsideTown.inc index 72f84118..a5f0a4f3 100644 --- a/data/scripts/northHyruleField/script_MutohOutsideTown.inc +++ b/data/scripts/northHyruleField/script_MutohOutsideTown.inc @@ -1,7 +1,7 @@ @ Outside Castle Mutoh SCRIPT_START script_MutohOutsideTown BeginBlock - Call sub_08067100 + Call Mutoh_MakeInteractable DoPostScriptAction 0x000a SetAnimationState 0x0004 DoPostScriptAction 0x0000 diff --git a/data/scripts/npc/script_Farmer.inc b/data/scripts/npc/script_Farmer.inc index 9d281c12..11f0566f 100644 --- a/data/scripts/npc/script_Farmer.inc +++ b/data/scripts/npc/script_Farmer.inc @@ -1,7 +1,7 @@ @ Farmer SCRIPT_START script_Farmer BeginBlock - Call sub_0806BCD4 + Call Farmers_MakeInteractable DoPostScriptAction 0x000a CallWithArg sub_0806BC94, 0x00000000 EndBlock @@ -30,9 +30,10 @@ script_0800B134: Call sub_0807F650 _0807E9F0 .ifndef EU + @! @bug: In EU, Eenie is marked as done fusing if kinstone menu is closed without fusing JumpIfNot script_0800B160 .endif - Call sub_0806BCC0 + Call Farmers_MarkEenieFuserDoner script_0800B160: Call EnablePauseMenu EnablePlayerControl diff --git a/data/scripts/npc/script_MysteriousWall.inc b/data/scripts/npc/script_MysteriousWall.inc index aa780c91..28ab2c5e 100644 --- a/data/scripts/npc/script_MysteriousWall.inc +++ b/data/scripts/npc/script_MysteriousWall.inc @@ -3,10 +3,10 @@ SCRIPT_START script_MysteriousWall BeginBlock DoPostScriptAction 0x000b DoPostScriptAction 0x0008 - Call sub_0806DAAC + Call NPC4E_IsKinstoneFused JumpIf script_0800B9AC - Call sub_0806DAD0 - CallWithArg sub_0806DA04, 0x00000005 + Call NPC4E_MakeFuserInteractable + CallWithArg NPC4E_ChangeInteractableHitbox, 0x00000005 EndBlock script_0800B98A: _0807EA4C @@ -16,7 +16,7 @@ script_0800B98A: EnablePlayerControl Jump script_0800B98A script_0800B99E: - Call sub_0806F188 + Call MarkFuserDone Call EnablePauseMenu EnablePlayerControl script_0800B9AC: diff --git a/data/scripts/npc/script_TingleSiblings.inc b/data/scripts/npc/script_TingleSiblings.inc index d5ea4160..0719e620 100644 --- a/data/scripts/npc/script_TingleSiblings.inc +++ b/data/scripts/npc/script_TingleSiblings.inc @@ -1,7 +1,7 @@ @ Tingle Siblings SCRIPT_START script_TingleSiblings BeginBlock - Call sub_08064EA4 + Call TingleSiblings_MakeInteractable SetAnimationState 0x0004 DoPostScriptAction 0x0000 DoPostScriptAction 0x000a diff --git a/data/scripts/npc/script_Windcrest.inc b/data/scripts/npc/script_Windcrest.inc index 130ad98a..37417368 100644 --- a/data/scripts/npc/script_Windcrest.inc +++ b/data/scripts/npc/script_Windcrest.inc @@ -1,8 +1,8 @@ @ All Windcrests SCRIPT_START script_Windcrest BeginBlock - Call sub_0807F934 - Call sub_080A2124 + Call MakeCheckableObjectInteractable + Call Windcrest_ChangeInteractableHitbox DoPostScriptAction 0x000a DoPostScriptAction 0x0007 EndBlock diff --git a/data/scripts/sanctuary/script_CutsceneMiscObjectTextBoard.inc b/data/scripts/sanctuary/script_CutsceneMiscObjectTextBoard.inc index 520adfe2..54bf63fb 100644 --- a/data/scripts/sanctuary/script_CutsceneMiscObjectTextBoard.inc +++ b/data/scripts/sanctuary/script_CutsceneMiscObjectTextBoard.inc @@ -23,7 +23,7 @@ script_08013C2A: script_08013C32: BeginBlock DoPostScriptAction 0x0007 - Call sub_0807F934 + Call MakeCheckableObjectInteractable DoPostScriptAction 0x000a CallWithArg sub_080962F8, 0x00000000 .ifndef EU diff --git a/data/scripts/sanctuary/script_Npc4ELookAtPictureAgain.inc b/data/scripts/sanctuary/script_Npc4ELookAtPictureAgain.inc index 50f58794..f1f81b23 100644 --- a/data/scripts/sanctuary/script_Npc4ELookAtPictureAgain.inc +++ b/data/scripts/sanctuary/script_Npc4ELookAtPictureAgain.inc @@ -7,8 +7,8 @@ script_0801427C: CheckLocalFlag 0x0078 JumpIfNot script_0801427C BeginBlock - Call sub_0807F934 - CallWithArg sub_0806DA04, 0x00000008 + Call MakeCheckableObjectInteractable + CallWithArg NPC4E_ChangeInteractableHitbox, 0x00000008 EndBlock script_08014298: CheckEntityInteractType diff --git a/data/scripts/sanctuary/script_Npc4EPedestal.inc b/data/scripts/sanctuary/script_Npc4EPedestal.inc index 12cce538..415d4c04 100644 --- a/data/scripts/sanctuary/script_Npc4EPedestal.inc +++ b/data/scripts/sanctuary/script_Npc4EPedestal.inc @@ -4,8 +4,8 @@ SCRIPT_START script_Npc4EPedestal DoPostScriptAction 0x0008 EndBlock BeginBlock - Call sub_0807F92C - CallWithArg sub_0806DA04, 0x00000003 + Call MakePedestalInteractable + CallWithArg NPC4E_ChangeInteractableHitbox, 0x00000003 EndBlock script_080134F8: CheckEntityInteractType diff --git a/data/scripts/sanctuary/script_Npc4ESecondSanctuary.inc b/data/scripts/sanctuary/script_Npc4ESecondSanctuary.inc index 5da4a9ad..181600cc 100644 --- a/data/scripts/sanctuary/script_Npc4ESecondSanctuary.inc +++ b/data/scripts/sanctuary/script_Npc4ESecondSanctuary.inc @@ -4,8 +4,8 @@ SCRIPT_START script_Npc4ESecondSanctuary DoPostScriptAction 0x0008 EndBlock BeginBlock - Call sub_0807F92C - CallWithArg sub_0806DA04, 0x00000003 + Call MakePedestalInteractable + CallWithArg NPC4E_ChangeInteractableHitbox, 0x00000003 EndBlock script_0801373C: CheckEntityInteractType diff --git a/data/scripts/sanctuary/script_Npc4EThirdSanctuary.inc b/data/scripts/sanctuary/script_Npc4EThirdSanctuary.inc index abe02e5b..ffb033f9 100644 --- a/data/scripts/sanctuary/script_Npc4EThirdSanctuary.inc +++ b/data/scripts/sanctuary/script_Npc4EThirdSanctuary.inc @@ -4,8 +4,8 @@ SCRIPT_START script_Npc4EThirdSanctuary DoPostScriptAction 0x0008 EndBlock BeginBlock - Call sub_0807F92C - CallWithArg sub_0806DA04, 0x00000003 + Call MakePedestalInteractable + CallWithArg NPC4E_ChangeInteractableHitbox, 0x00000003 EndBlock script_080138D0: CheckEntityInteractType diff --git a/data/scripts/southHyruleField/script_ForestMinish2.inc b/data/scripts/southHyruleField/script_ForestMinish2.inc index 5fa3a178..3919af08 100644 --- a/data/scripts/southHyruleField/script_ForestMinish2.inc +++ b/data/scripts/southHyruleField/script_ForestMinish2.inc @@ -1,7 +1,7 @@ @ Hyrule Fields? ForestMinish with Beanstock left to Minish Woods SCRIPT_START script_ForestMinish2 BeginBlock - Call sub_08060090 + Call ForestMinish_MakeInteractable DoPostScriptAction 0x000a EndBlock script_0800C592: diff --git a/data/scripts/southHyruleField/script_SmithAtLinksHouse.inc b/data/scripts/southHyruleField/script_SmithAtLinksHouse.inc index 91e708c4..ce69f63d 100644 --- a/data/scripts/southHyruleField/script_SmithAtLinksHouse.inc +++ b/data/scripts/southHyruleField/script_SmithAtLinksHouse.inc @@ -2,8 +2,8 @@ SCRIPT_START script_SmithAtLinksHouse BeginBlock Call SetPriorityMessage - Call sub_08066288 - Call sub_08066274 + Call Smith_MakeInteractable + Call Smith_ChangeInteractableHitbox DoPostScriptAction 0x000a SetAnimation 0x000c SetAction 0x0003 diff --git a/data/scripts/unused/script_08012C68.inc b/data/scripts/unused/script_08012C68.inc index f4c081b7..78e7faf3 100644 --- a/data/scripts/unused/script_08012C68.inc +++ b/data/scripts/unused/script_08012C68.inc @@ -4,7 +4,7 @@ SCRIPT_START script_08012C68 _0807E9D4 DoPostScriptAction 0x0008 SetIntVariable 0x00000000 - Call sub_0806DA04 + Call NPC4E_ChangeInteractableHitbox EndBlock script_08012C7E: CheckEntityInteractType diff --git a/data/scripts/unused/script_08013D04.inc b/data/scripts/unused/script_08013D04.inc index 42887fa3..ee68a6c7 100644 --- a/data/scripts/unused/script_08013D04.inc +++ b/data/scripts/unused/script_08013D04.inc @@ -1,9 +1,9 @@ @ TODO UNUSED? SCRIPT_START script_08013D04 BeginBlock - Call sub_0807F92C + Call MakePedestalInteractable DoPostScriptAction 0x0008 - CallWithArg sub_0806DA04, 0x00000004 + CallWithArg NPC4E_ChangeInteractableHitbox, 0x00000004 EndBlock script_08013D1C: CheckEntityInteractType diff --git a/data/scripts/unused/script_08013D44.inc b/data/scripts/unused/script_08013D44.inc index 98c44d0d..5cdc5f41 100644 --- a/data/scripts/unused/script_08013D44.inc +++ b/data/scripts/unused/script_08013D44.inc @@ -1,9 +1,9 @@ @ TODO UNUSED? SCRIPT_START script_08013D44 BeginBlock - Call sub_0807F92C + Call MakePedestalInteractable DoPostScriptAction 0x0008 - CallWithArg sub_0806DA04, 0x00000004 + CallWithArg NPC4E_ChangeInteractableHitbox, 0x00000004 EndBlock script_08013D5C: CheckEntityInteractType diff --git a/data/scripts/unused/script_08013D84.inc b/data/scripts/unused/script_08013D84.inc index bc67ff99..b46c6696 100644 --- a/data/scripts/unused/script_08013D84.inc +++ b/data/scripts/unused/script_08013D84.inc @@ -1,9 +1,9 @@ @ TODO UNUSED? SCRIPT_START script_08013D84 BeginBlock - Call sub_0807F92C + Call MakePedestalInteractable DoPostScriptAction 0x0008 - CallWithArg sub_0806DA04, 0x00000004 + CallWithArg NPC4E_ChangeInteractableHitbox, 0x00000004 EndBlock script_08013D9C: CheckEntityInteractType diff --git a/data/scripts/unused/script_08013DC4.inc b/data/scripts/unused/script_08013DC4.inc index ac92c6db..4fefe05b 100644 --- a/data/scripts/unused/script_08013DC4.inc +++ b/data/scripts/unused/script_08013DC4.inc @@ -1,9 +1,9 @@ @ TODO UNUSED? SCRIPT_START script_08013DC4 BeginBlock - Call sub_0807F92C + Call MakePedestalInteractable DoPostScriptAction 0x0008 - CallWithArg sub_0806DA04, 0x00000004 + CallWithArg NPC4E_ChangeInteractableHitbox, 0x00000004 EndBlock script_08013DDC: CheckEntityInteractType diff --git a/data/scripts/unused/script_08016384.inc b/data/scripts/unused/script_08016384.inc index b1975a48..0a5eeacf 100644 --- a/data/scripts/unused/script_08016384.inc +++ b/data/scripts/unused/script_08016384.inc @@ -27,7 +27,7 @@ SCRIPT_START script_08016384 FacePlayerAndCheckDist HasRupees 200 CheckTextboxResult - CheckKinstoneFused KINSTONE_1 + CheckKinstoneFused KINSTONE_MYSTERIOUS_CLOUD_TOP_RIGHT BuyItem ITEM_BOMBS10, 0x0000 CheckBottleContaining ITEM_BOTTLE_EMPTY VariableBitSet 0x00000000 diff --git a/data/scripts/unused/script_08016482.inc b/data/scripts/unused/script_08016482.inc index be00febe..70f9b944 100644 --- a/data/scripts/unused/script_08016482.inc +++ b/data/scripts/unused/script_08016482.inc @@ -28,7 +28,7 @@ SCRIPT_START script_08016482 _0807E9D4 _0807E9DC _0807E9E4 0x0000 - _0807EA88 0x0001 + _0807EA88 KINSTONE_MYSTERIOUS_CLOUD_TOP_RIGHT WaitUntilTextboxCloses MessageFromTarget TEXT_LOCATIONS, 0x01 MessageNoOverlap 0x0601 diff --git a/data/scripts/veilFalls/script_MinishVillageObjectLeftStoneOpening.inc b/data/scripts/veilFalls/script_MinishVillageObjectLeftStoneOpening.inc index 3d552cdb..3f5ac7fb 100644 --- a/data/scripts/veilFalls/script_MinishVillageObjectLeftStoneOpening.inc +++ b/data/scripts/veilFalls/script_MinishVillageObjectLeftStoneOpening.inc @@ -1,7 +1,7 @@ @ Waterfalls MINISH_VILLAGE_OBJECT during kinstone cutscene? SCRIPT_START script_MinishVillageObjectLeftStoneOpening BeginBlock - CheckKinstoneFused KINSTONE_9 + CheckKinstoneFused KINSTONE_SOURCE_FLOW JumpIf script_MinishVillageObjectLeftStone EndBlock WaitForSyncFlagAndClear 0x00000001 diff --git a/data/scripts/veilFalls/script_MinishVillageObjectRightStoneOpening.inc b/data/scripts/veilFalls/script_MinishVillageObjectRightStoneOpening.inc index f5194dff..76ea1d57 100644 --- a/data/scripts/veilFalls/script_MinishVillageObjectRightStoneOpening.inc +++ b/data/scripts/veilFalls/script_MinishVillageObjectRightStoneOpening.inc @@ -1,7 +1,7 @@ @ Waterfalls MINISH_VILLAGE_OBJECT during kinstone cutscene? SCRIPT_START script_MinishVillageObjectRightStoneOpening BeginBlock - CheckKinstoneFused KINSTONE_9 + CheckKinstoneFused KINSTONE_SOURCE_FLOW JumpIf script_MinishVillageObjectRightStone EndBlock WaitForSyncFlagAndClear 0x00000002 diff --git a/data/scripts/veilFalls/script_NPC4ESourceOfTheFlow.inc b/data/scripts/veilFalls/script_NPC4ESourceOfTheFlow.inc index 6bac4d40..0c4a11a3 100644 --- a/data/scripts/veilFalls/script_NPC4ESourceOfTheFlow.inc +++ b/data/scripts/veilFalls/script_NPC4ESourceOfTheFlow.inc @@ -2,17 +2,17 @@ SCRIPT_START script_NPC4ESourceOfTheFlow BeginBlock Call sub_0806DB84 - CheckKinstoneFused KINSTONE_9 + CheckKinstoneFused KINSTONE_SOURCE_FLOW JumpIf script_08016028 - _0807EA88 0x0009 - CallWithArg sub_0806DA04, 0x00000007 + _0807EA88 KINSTONE_SOURCE_FLOW + CallWithArg NPC4E_ChangeInteractableHitbox, 0x00000007 DoPostScriptAction 0x000a EndBlock script_08015FE4: _0807EA4C _0807E9F0 SetPlayerIdle - CheckKinstoneFused KINSTONE_9 + CheckKinstoneFused KINSTONE_SOURCE_FLOW JumpIf script_08015FFE Call EnablePauseMenu EnablePlayerControl diff --git a/data/scripts/westernWood/script_ForestMinish1.inc b/data/scripts/westernWood/script_ForestMinish1.inc index 3e681372..62197602 100644 --- a/data/scripts/westernWood/script_ForestMinish1.inc +++ b/data/scripts/westernWood/script_ForestMinish1.inc @@ -1,7 +1,7 @@ @ Western Wood Forest Minish SCRIPT_START script_ForestMinish1 BeginBlock - Call sub_08060090 + Call ForestMinish_MakeInteractable DoPostScriptAction 0x000a EndBlock script_0800C55E: diff --git a/data/scripts/westernWood/script_PercyInside.inc b/data/scripts/westernWood/script_PercyInside.inc index e1c5666a..a6a04076 100644 --- a/data/scripts/westernWood/script_PercyInside.inc +++ b/data/scripts/westernWood/script_PercyInside.inc @@ -4,7 +4,7 @@ SCRIPT_START script_PercyInside SetAnimationState 0x0004 DoPostScriptAction 0x0000 DoPostScriptAction 0x000a - Call sub_0806B60C + Call Percy_MakeInteractable EndBlock script_08012E9E: CheckEntityInteractType diff --git a/data/scripts/westernWood/script_PercyOutside.inc b/data/scripts/westernWood/script_PercyOutside.inc index 612d4b1a..a0f02b15 100644 --- a/data/scripts/westernWood/script_PercyOutside.inc +++ b/data/scripts/westernWood/script_PercyOutside.inc @@ -4,7 +4,7 @@ SCRIPT_START script_PercyOutside SetAnimationState 0x0004 CallWithArg sub_0807F3D8, 0x00000008 DoPostScriptAction 0x000a - Call sub_0806B60C + Call Percy_MakeInteractable EndBlock script_08012EDC: CheckEntityInteractType diff --git a/data/scripts/windRuins/script_Npc4EWindRuinsTextBoard.inc b/data/scripts/windRuins/script_Npc4EWindRuinsTextBoard.inc index 84713eee..3265af54 100644 --- a/data/scripts/windRuins/script_Npc4EWindRuinsTextBoard.inc +++ b/data/scripts/windRuins/script_Npc4EWindRuinsTextBoard.inc @@ -1,10 +1,10 @@ @ After Mazaal NPC4E text board SCRIPT_START script_Npc4EWindRuinsTextBoard BeginBlock - Call sub_0807F934 + Call MakeCheckableObjectInteractable DoPostScriptAction 0x0008 SetIntVariable 0x00000001 - Call sub_0806DA04 + Call NPC4E_ChangeInteractableHitbox EndBlock script_0800D88E: CheckEntityInteractType diff --git a/include/droptables.h b/include/droptables.h index 63213f98..1d7b2bcf 100644 --- a/include/droptables.h +++ b/include/droptables.h @@ -14,9 +14,9 @@ typedef union { s16 bombs; s16 arrows; s16 mysteriousShells; - s16 kinstoneGreen; - s16 kinstoneBlue; s16 kinstoneRed; + s16 kinstoneBlue; + s16 kinstoneGreen; s16 none2; s16 none3; s16 none4; diff --git a/include/game.h b/include/game.h index 0bdc45e2..62584fe1 100644 --- a/include/game.h +++ b/include/game.h @@ -90,32 +90,32 @@ void sub_08052878(void); void ModDungeonKeys(s32 keys); /** - * Check if the current dungeon has a map item. + * Check if the player has at least one small key for the current dungeon. * - * @return True if the current dungeon has a map item. + * @return True if the player has a small key. */ -bool32 HasDungeonMap(void); +bool32 HasDungeonSmallKey(void); /** - * Check if the current dungeon has a compass item. + * Check if the player has the big key for the current dungeon. * - * @return True if the current dungeon has a compass item. - */ -bool32 HasDungeonCompass(void); - -/** - * Check if the current dungeon has a big key item. - * - * @return True if the current dungeon has a big key item. + * @return True if the player has the big key. */ bool32 HasDungeonBigKey(void); /** - * Check if the current dungeon has a small key item. + * Check if the player has the compass for the current dungeon. * - * @return True if the current dungeon has a small key item. + * @return True if the player has the compass. */ -bool32 HasDungeonSmallKey(void); +bool32 HasDungeonCompass(void); + +/** + * Check if the player has the map for the current dungeon. + * + * @return True if the player has the map. + */ +bool32 HasDungeonMap(void); /** * @brief Check if item is a sword. diff --git a/include/kinstone.h b/include/kinstone.h index a5c20d44..ac6b9b83 100644 --- a/include/kinstone.h +++ b/include/kinstone.h @@ -35,16 +35,16 @@ typedef struct { extern const KinstoneWorldEvent gKinstoneWorldEvents[]; typedef enum { - KINSTONE_0, - KINSTONE_1, - KINSTONE_2, - KINSTONE_3, - KINSTONE_4, - KINSTONE_5, + KINSTONE_NONE, + KINSTONE_MYSTERIOUS_CLOUD_TOP_RIGHT, + KINSTONE_MYSTERIOUS_CLOUD_BOTTOM_LEFT, + KINSTONE_MYSTERIOUS_CLOUD_TOP_LEFT, + KINSTONE_MYSTERIOUS_CLOUD_MIDDLE, + KINSTONE_MYSTERIOUS_CLOUD_BOTTOM_RIGHT, KINSTONE_CASTOR_WILDS_STATUE_LEFT, KINSTONE_CASTOR_WILDS_STATUE_MIDDLE, KINSTONE_CASTOR_WILDS_STATUE_RIGHT, - KINSTONE_9, + KINSTONE_SOURCE_FLOW, KINSTONE_A, KINSTONE_B, KINSTONE_C, @@ -131,6 +131,16 @@ typedef enum { KINSTONE_5D, KINSTONE_5E, KINSTONE_5F, + KINSTONE_60, + KINSTONE_61, + KINSTONE_62, + KINSTONE_63, + KINSTONE_64, + /* some special values, mostly for fusers */ + KINSTONE_NEEDS_REPLACEMENT = 0xF1, + KINSTONE_JUST_FUSED = 0xF2, + KINSTONE_FUSER_DONE = 0xF3, + KINSTONE_RANDOM = 0xFF, } KinstoneId; typedef struct { diff --git a/include/npc.h b/include/npc.h index 6588f1d4..6b9e5cb5 100644 --- a/include/npc.h +++ b/include/npc.h @@ -74,7 +74,7 @@ void sub_0806EE04(Entity* ent, void* a2, u32 a3); u32 sub_0806EE20(Entity* ent); s32 sub_0806F078(Entity* ent, s32 a2); void sub_0806F118(Entity* ent); -void sub_0806F188(Entity* ent); +void MarkFuserDone(Entity* ent); void ShowNPCDialogue(Entity* ent, const Dialog* dia); Entity* CreateNPC(u32 subtype, u32 form, u32 parameter); @@ -84,12 +84,12 @@ void NPCInit(Entity* ent); void CollideFollowers(void); // TODO move? -void sub_08078784(Entity* ent, u32 arg1); +void AddInteractableWhenBigFuser(Entity* ent, u32 kinstoneId); u32 sub_0806F5A4(u32); u32 GetFusionToOffer(Entity*); -void sub_08078778(Entity*); +void AddInteractableWhenBigObject(Entity*); void sub_0807000C(Entity*); -void sub_080787A8(Entity*, u32); +void AddInteractableAsMinishFuser(Entity* ent, u32 kinstoneId); enum NPC { /*0x00*/ NPC_NONE_0, diff --git a/include/object.h b/include/object.h index 4d312d43..34160b18 100644 --- a/include/object.h +++ b/include/object.h @@ -14,8 +14,8 @@ #include "entity.h" #include "player.h" -void sub_080787C0(Entity*); -void sub_080787B4(Entity*); +void AddInteractablePedestal(Entity*); +void AddInteractableCheckableObject(Entity*); void sub_0808C650(Entity*, u32); u32 sub_0808C67C(void); void sub_0808C688(void); diff --git a/include/player.h b/include/player.h index 6c31cf38..eb347479 100644 --- a/include/player.h +++ b/include/player.h @@ -12,7 +12,7 @@ enum PlayerActions { PLAYER_JUMP, PLAYER_PUSH, PLAYER_BOUNCE, - PLAYER_08070E9C, // sub_080782C0, only when PLAYER_INPUT_1000 is newInput + PLAYER_08070E9C, // sub_080782C0, only when pressing L to start a Kinstone Fusion PLAYER_ITEMGET, PLAYER_MINISH, PLAYER_MINISHDIE, @@ -254,12 +254,12 @@ typedef enum { } PlayerInputState; typedef struct { - /*0x90*/ u16 heldInput; /**< Input currently held @see PlayerInputState */ - /*0x92*/ u16 newInput; /**< New input this frame @see PlayerInputState */ - /*0x94*/ u32 field_0x94; - /*0x98*/ u16 playerMacroWaiting; - /*0x9a*/ u16 playerMacroHeldKeys; - /*0x9c*/ PlayerMacroEntry* playerMacro; + /*0x0*/ u16 heldInput; /**< Input currently held @see PlayerInputState */ + /*0x2*/ u16 newInput; /**< New input this frame @see PlayerInputState */ + /*0x4*/ u32 field_0x94; + /*0x8*/ u16 playerMacroWaiting; + /*0xa*/ u16 playerMacroHeldKeys; + /*0xc*/ PlayerMacroEntry* playerMacro; } PlayerInput; typedef enum { @@ -276,7 +276,7 @@ typedef enum { typedef struct { /*0x00*/ u8 prevAnim; - /*0x00*/ u8 grab_status; + /*0x01*/ u8 grab_status; /*0x02*/ u8 jump_status; /*0x03*/ u8 shield_status; /*0x04*/ u8 attack_status; @@ -437,6 +437,37 @@ s32 ModHealth(s32 delta); void ModRupees(s32 delta); void ModBombs(s32 delta); +typedef enum { + INTERACTION_NONE, + INTERACTION_TALK, + INTERACTION_FUSE, + INTERACTION_OPEN_CHEST, + INTERACTION_UNUSED, + INTERACTION_USE_SMALL_KEY, + INTERACTION_USE_BIG_KEY, + INTERACTION_TALK_MINISH, + INTERACTION_LIFT_SHOP_ITEM, + INTERACTION_CHECK, + INTERACTION_DROP_PEDESTAL, + INTERACTION_NULL = 0xFF, +} InteractionType; + +typedef enum { + R_ACTION_NONE, + R_ACTION_CANCEL, + R_ACTION_DROP, + R_ACTION_THROW, + R_ACTION_READ, + R_ACTION_CHECK, + R_ACTION_OPEN, + R_ACTION_SPEAK, + R_ACTION_GRAB, + R_ACTION_LIFT, + R_ACTION_GROW, + R_ACTION_SHRINK, + R_ACTION_ROLL, +} ActionRButton; + // playerUtils.c void DeleteClones(void); void CreateItemEquippedAtSlot(/*EquipSlot*/ u32 equipSlot); @@ -469,13 +500,13 @@ void UpdatePlayerSkills(void); u32 sub_0807AC54(Entity*); void sub_080792D8(void); u32 sub_08078F74(Entity*); -void sub_0807879C(Entity*); +void AddInteractableAsMinishObject(Entity*); void sub_08078D60(void); void PlayerSetNormalAndCollide(void); bool32 PlayerTryDropObject(ItemBehavior* arg0, u32 unk); void InitItemGetSequence(u32, u32, u32); void sub_0807B7D8(u32, u32, u32); -void sub_08078850(Entity*, u32, u32, const void*); +void SetInteractableObjectCollision(Entity*, u32, u32, const void*); void sub_08079D84(void); u32 sub_0807953C(void); void sub_0807BB68(const s16*, u32, u32); @@ -503,14 +534,14 @@ bool32 IsItemActive(ItemBehavior*); bool32 IsItemActivatedThisFrame(ItemBehavior*); bool32 IsItemActiveByInput(ItemBehavior*, PlayerInputState); bool32 sub_08077FEC(u32); -void sub_08078180(void); -void sub_080784C8(); -void sub_08078790(Entity*, u32); -void sub_080787CC(Entity*); -s32 sub_08078800(Entity*); -s32 sub_0807887C(Entity*, u32, u32); -void sub_080788E0(Entity*); -s32 sub_08078904(); +void DetermineRButtonInteraction(void); +void ResetPossibleInteraction(); +void AddInteractableFuser(Entity*, u32); +void AddInteractableSmallKeyLock(Entity*); +s32 AddInteractableBossDoor(Entity*); +s32 AddInteractableObject(Entity*, u32, u32); +void RemoveInteractableObject(Entity*); +s32 GetInteractableObjectIndex(); void sub_08078AC0(u32, u32, u32); void sub_08078B48(void); void sub_08078E84(Entity*, Entity*); diff --git a/include/save.h b/include/save.h index 5193e692..aa206fe5 100644 --- a/include/save.h +++ b/include/save.h @@ -34,7 +34,7 @@ extern SaveResult HandleSave(u32 idx); */ typedef struct { /*0x000*/ u8 invalid; /**< File is invalid. */ - /*0x000*/ u8 initialized; /**< File is initialized. */ + /*0x001*/ u8 initialized; /**< File is initialized. */ /*0x002*/ u8 msg_speed; /**< Message speed. */ /*0x003*/ u8 brightness; /**< Brightness. */ /*0x004*/ u8 filler4[0x2]; @@ -69,7 +69,7 @@ typedef struct { /*0x25C*/ u8 flags[0x200]; /**< Flags. */ /*0x45C*/ u8 dungeonKeys[0x10]; // TODO Indexed by dungeon id, keys per dungeon /*0x46C*/ u8 dungeonItems[0x10]; // TODO items in the dungeon. 4: compass, 2: big key, 1: small key - /*0x46C*/ u8 dungeonWarps[0x10]; // TODO indexed by dungeon id, EnableDungeonWarp, IsDungeonWarpActive + /*0x47C*/ u8 dungeonWarps[0x10]; // TODO indexed by dungeon id, EnableDungeonWarp, IsDungeonWarpActive /*0x48C*/ u32 timers[7]; /*0x4A8*/ u32 demo_timer; /**< Demo timer. */ /*0x4AC*/ u8 filler4ac[0x8]; diff --git a/include/structures.h b/include/structures.h index 8de98b91..0cbe9c71 100644 --- a/include/structures.h +++ b/include/structures.h @@ -117,12 +117,11 @@ typedef struct { u8 filler22[0x2]; u8 ezloNagFuncIndex; u8 filler25[7]; - u8 unk_2c; - u8 unk_2d; - u8 unk_2e; - u8 unk_2f; - u8 unk_30[2]; - u8 unk_32; + u8 rActionInteractObject; // used as R button UI frame index + u8 rActionInteractTile; + u8 rActionGrabbing; + u8 rActionPlayerState; // if not 0, overrides other R actions + u8 buttonText[3]; u8 unk_33; UIElement elements[MAX_UI_ELEMENTS]; } struct_0200AF00; @@ -157,6 +156,7 @@ typedef struct { /*0x06*/ u16 paletteIndex; /*0x08*/ const void* palettePointer; } GfxSlot; + typedef struct { /*0x00*/ u8 unk0; /*0x01*/ u8 unk_1; @@ -259,26 +259,35 @@ typedef struct { } struct_020227E8; typedef struct { - /*0x00*/ u8 unk_0; - /*0x01*/ u8 unk_1; - /*0x02*/ u8 unk_2; - /*0x03*/ u8 unk_3; - /*0x04*/ const u8* unk_4; - /*0x08*/ Entity* entity; -} struct_03003DF8; + s8 x; + s8 y; + s8 width; + s8 height; +} Rect; typedef struct { - /*0x00*/ u8 unk_0; - /*0x01*/ u8 unk_1; - /*0x02*/ u8 unk_2; // TODO kinstoneId, sub_0801DFB4 - /*0x03*/ u8 unk_3; - /*0x04*/ u8* unk_4; - /*0x08*/ struct_03003DF8 array[0x20]; -} struct_03003DF0; + /*0x00*/ u8 ignoreLayer; /* if bit 0 set, skip layer check for collision */ + /*0x01*/ u8 type; + /*0x02*/ u8 interactDirections; /* lower 4 bits determine Link's allowed facing directions to interact, 0 to allow + (0000WSEN) */ + /*0x03*/ u8 kinstoneId; + /*0x04*/ const Rect* customHitbox; /* optional custom rectangle */ + /*0x08*/ Entity* entity; +} InteractableObject; -static_assert(sizeof(struct_03003DF0) == 0x188); +typedef struct { + /*0x00*/ u8 isUpdated; + /*0x01*/ u8 unused; + /*0x02*/ u8 kinstoneId; + /*0x03*/ u8 currentIndex; /* index of currentObject in candidate list, or 0xFF */ + /*0x04*/ InteractableObject* currentObject; + /*0x08*/ InteractableObject + candidates[0x20]; /* contains the loaded NPCs, key doors, windcrests and other objects */ +} PossibleInteraction; -extern struct_03003DF0 gUnk_03003DF0; +static_assert(sizeof(PossibleInteraction) == 0x188); + +extern PossibleInteraction gPossibleInteraction; typedef struct { u8 numTiles; @@ -351,11 +360,4 @@ typedef struct { u8 frame; u8 frameIndex; } PACKED FrameStruct; - -typedef struct { - s8 x; - s8 y; - s8 width; - s8 height; -} Rect; #endif // STRUCTURES_H diff --git a/linker.ld b/linker.ld index 039ac9c5..d6e46ee3 100644 --- a/linker.ld +++ b/linker.ld @@ -143,8 +143,8 @@ SECTIONS { . = 0x00003DD0; gUpdateContext = .; . = 0x00003DE0; gUnk_03003DE0 = .; . = 0x00003DE4; gUnk_03003DE4 = .; - . = 0x00003DF0; gUnk_03003DF0 = .; - . = 0x00003DF8; gUnk_03003DF8 = .; + . = 0x00003DF0; gPossibleInteraction = .; + . = 0x00003DF8; gInteractableObjects = .; . = 0x00003F80; gPlayerState = .; . = 0x00004030; gDiggingCaveEntranceTransition = .; . = 0x00004040; gPlayerClones = .; diff --git a/src/beanstalkSubtask.c b/src/beanstalkSubtask.c index d09ea3cd..f1f85a4a 100644 --- a/src/beanstalkSubtask.c +++ b/src/beanstalkSubtask.c @@ -204,7 +204,8 @@ u32 UpdatePlayerCollision(void) { ptr1 = &gUnk_080B4490[index * 2]; if (sub_080B1B44(COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr1[0], -ptr1[1]), gPlayerEntity.collisionLayer) == 0xff) { - if ((((gPlayerState.flags & 0x10002) != 0) || ((gPlayerState.sword_state & 0x10) != 0)) || + if ((((gPlayerState.flags & (PL_FLAGS10000 | PL_FLAGS2)) != 0) || + ((gPlayerState.sword_state & 0x10) != 0)) || ((sub_080806BC(gPlayerEntity.x.HALF.HI - gRoomControls.origin_x, gPlayerEntity.y.HALF.HI - gRoomControls.origin_y, index, 5) == 0 && (((gPlayerState.heldObject != 0 || ((gPlayerState.field_0x1c & 0xf) != 0)) || @@ -234,19 +235,19 @@ u32 UpdatePlayerCollision(void) { return 0; } layer->mapData[position] = 0x4001 + (gPlayerEntity.animationState >> 1); - if ((gPlayerState.flags & 0x80) != 0) { + if ((gPlayerState.flags & PL_MINISH) != 0) { gPlayerState.pushedObject = 0xc0; } else { gPlayerState.pushedObject = 0xa0; } gPlayerState.queued_action = PLAYER_PUSH; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); return 1; case 0x28: - if ((gPlayerState.flags & 0x80) != 0) { + if ((gPlayerState.flags & PL_MINISH) != 0) { return 0; } gPlayerEntity.action = gPlayerEntity.action; @@ -286,7 +287,7 @@ u32 UpdatePlayerCollision(void) { layer->mapData[position] = 0x401c + (gPlayerEntity.animationState >> 1); gPlayerState.pushedObject = 0xa0; gPlayerState.queued_action = PLAYER_PUSH; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); @@ -304,13 +305,13 @@ u32 UpdatePlayerCollision(void) { case 0x3a: case 0x5b: case 0x4051: - if ((gPlayerState.flags & 0x80) != 0) { + if ((gPlayerState.flags & PL_MINISH) != 0) { return 0; } if (gPlayerEntity.animationState != 0) { return 0; } - gUnk_0200AF00.unk_2d = 4; + gUnk_0200AF00.rActionInteractTile = R_ACTION_READ; if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_40)) == 0) { return 0; } @@ -321,10 +322,10 @@ u32 UpdatePlayerCollision(void) { if ((animationState1 & 0xff) != 0) { return 0; } - if ((gPlayerState.flags & 0x4080) != 0) { + if ((gPlayerState.flags & (PL_DRUGGED | PL_MINISH)) != 0) { return 0; } - gUnk_0200AF00.unk_2d = 6; + gUnk_0200AF00.rActionInteractTile = R_ACTION_OPEN; if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0) { return 0; } @@ -332,10 +333,10 @@ u32 UpdatePlayerCollision(void) { OpenSmallChest(position, gPlayerEntity.collisionLayer); return 2; case 0x71: - if (HasDungeonMap() == 0) { + if (HasDungeonSmallKey() == 0) { return 0; } - gUnk_0200AF00.unk_2d = 6; + gUnk_0200AF00.rActionInteractTile = R_ACTION_OPEN; if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0) { return 0; } @@ -344,7 +345,7 @@ u32 UpdatePlayerCollision(void) { return 2; case 0x3d: case 0x4040 ... 0x4048: - if ((gPlayerState.flags & 0x4000) != 0) { + if ((gPlayerState.flags & PL_DRUGGED) != 0) { return 0; } if (sub_08079778() == 0) { @@ -365,7 +366,7 @@ u32 UpdatePlayerCollision(void) { return 0; } gPlayerState.jump_status = 0x81; - gPlayerState.flags |= 0x20; + gPlayerState.flags |= PL_USE_PORTAL; gPlayerState.queued_action = PLAYER_USEPORTAL; gPlayerEntity.zVelocity = 0x20000; COLLISION_OFF(&gPlayerEntity); @@ -381,7 +382,7 @@ u32 UpdatePlayerCollision(void) { } gPlayerState.pushedObject = 0xa0; gPlayerState.queued_action = PLAYER_PUSH; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); @@ -393,7 +394,7 @@ u32 UpdatePlayerCollision(void) { layer->mapData[position] = 0x405b + (gPlayerEntity.animationState >> 1); gPlayerState.pushedObject = 0x98; gPlayerState.queued_action = PLAYER_PUSH; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); @@ -405,7 +406,7 @@ u32 UpdatePlayerCollision(void) { layer->mapData[position] = 0x4037 + (gPlayerEntity.animationState >> 1); gPlayerState.pushedObject = 0xa0; gPlayerState.queued_action = PLAYER_PUSH; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); @@ -423,7 +424,7 @@ u32 UpdatePlayerCollision(void) { layer->mapData[position] = 0x403f; gPlayerState.pushedObject = 0x82; gPlayerState.queued_action = PLAYER_PUSH; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); @@ -464,7 +465,7 @@ u32 UpdatePlayerCollision(void) { pushedBlock->collisionLayer = gPlayerEntity.collisionLayer; gPlayerState.pushedObject = 0xa0; gPlayerState.queued_action = PLAYER_PUSH; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; gPlayerEntity.direction = pushedBlock->direction; @@ -472,13 +473,13 @@ u32 UpdatePlayerCollision(void) { case 0x402b ... 0x402d: if (sub_0801A370(layer, position) != 0) { layer->mapData[position] = 0x4030 + ((gPlayerEntity.animationState & 4) >> 2); - if ((gPlayerState.flags & 0x80) != 0) { + if ((gPlayerState.flags & PL_MINISH) != 0) { gPlayerState.pushedObject = 0xa0; } else { gPlayerState.pushedObject = 0x90; } gPlayerState.queued_action = PLAYER_PUSH; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); @@ -491,13 +492,13 @@ u32 UpdatePlayerCollision(void) { return 0; } layer->mapData[position] = 0x404b + (gPlayerEntity.animationState >> 1); - if ((gPlayerState.flags & 0x80) != 0) { + if ((gPlayerState.flags & PL_MINISH) != 0) { gPlayerState.pushedObject = 0xc0; } else { gPlayerState.pushedObject = 0xa0; } gPlayerState.queued_action = PLAYER_PUSH; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); @@ -563,7 +564,7 @@ u32 UpdatePlayerCollision(void) { SetTile(0x4074, position, gPlayerEntity.collisionLayer); gPlayerState.pushedObject = 0xa0; gPlayerState.queued_action = PLAYER_PUSH; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); @@ -831,7 +832,7 @@ bool32 sub_0801AA58(Entity* this, u32 param_2, u32 param_3) { object->collisionLayer = this->collisionLayer; gPlayerState.pushedObject = 0xa0; gPlayerState.queued_action = PLAYER_PUSH; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; this->x.HALF.LO = 0; this->y.HALF.LO = 0; this->direction = param_3; diff --git a/src/code_08049DF4.c b/src/code_08049DF4.c index bbef5e64..a4af4474 100644 --- a/src/code_08049DF4.c +++ b/src/code_08049DF4.c @@ -43,7 +43,7 @@ Entity* sub_08049E4C(void) { } Entity* sub_08049E80(void) { - if ((gPlayerState.field_0x3c != 0) || !(gPlayerState.flags & 0x80)) { + if ((gPlayerState.field_0x3c != 0) || !(gPlayerState.flags & PL_MINISH)) { return NULL; } gUnk_020000B0 = &gPlayerEntity; @@ -51,7 +51,8 @@ Entity* sub_08049E80(void) { } Entity* sub_08049EB0(void) { - if ((gPlayerState.field_0x3c == 0) && !(gPlayerState.flags & 0x80190)) { + if ((gPlayerState.field_0x3c == 0) && + !(gPlayerState.flags & (PL_MOLDWORM_CAPTURED | PL_DISABLE_ITEMS | PL_MINISH | PL_CAPTURED))) { gUnk_020000B0 = &gPlayerEntity; return &gPlayerEntity; } diff --git a/src/common.c b/src/common.c index 64543bd9..1aa305df 100644 --- a/src/common.c +++ b/src/common.c @@ -444,7 +444,7 @@ void DrawDungeonMap(u32 floor, DungeonMapObject* specialData, u32 size) { floorMapData++; } else { flagBankOffset = sub_0801DF10(floorMapData); - if (HasDungeonBigKey()) { + if (HasDungeonCompass()) { while (tileEntity->type != 0) { switch (tileEntity->type) { case SMALL_CHEST: @@ -468,7 +468,8 @@ void DrawDungeonMap(u32 floor, DungeonMapObject* specialData, u32 size) { tileEntity++; } } - if ((HasDungeonBigKey() && ((floorMapData->unk_2 & 2) != 0)) && (!CheckGlobalFlag(gArea.dungeon_idx + 1))) { + if ((HasDungeonCompass() && ((floorMapData->unk_2 & 2) != 0)) && + (!CheckGlobalFlag(gArea.dungeon_idx + 1))) { roomHeader = gAreaRoomHeaders[floorMapData->area] + floorMapData->room; specialData->type = DMO_TYPE_BOSS; tmp1 = ((roomHeader->pixel_width / 2) + roomHeader->map_x) / 16; @@ -536,7 +537,7 @@ void DrawDungeonFeatures(u32 floor, void* data, u32 size) { if (layout->area == gUI.roomControls.area && layout->room == gUI.roomControls.room) { features = 8; } else { - if (HasDungeonSmallKey()) { + if (HasDungeonMap()) { features = 2; } if (IsRoomVisited(tileEntity, bankOffset)) { @@ -624,7 +625,7 @@ void sub_0801DFB4(Entity* entity, u32 textIndex, u32 a3, u32 a4) { gFuseInfo._8 = a3; gFuseInfo._a = a4; gFuseInfo.ent = entity; - gFuseInfo.kinstoneId = gUnk_03003DF0.unk_2; + gFuseInfo.kinstoneId = gPossibleInteraction.kinstoneId; if (entity != NULL) { gFuseInfo.prevUpdatePriority = entity->updatePriority; entity->updatePriority = 2; @@ -831,28 +832,28 @@ void sub_0801E64C(s32 param_1, s32 param_2, s32 param_3, s32 param_4, s32 param_ } } -void NotifyFusersOnFusionDone(u32 kinstoneId) { +void NotifyFusersOnFusionDone(KinstoneId kinstoneId) { u32 tmp; u32 index; if (kinstoneId - 1 < 100) { for (index = 0; index < 0x80; index++) { if (kinstoneId == gSave.fuserOffers[index]) { - gSave.fuserOffers[index] = 0xf1; + gSave.fuserOffers[index] = KINSTONE_NEEDS_REPLACEMENT; } } tmp = GetFuserId(gFuseInfo.ent); - if ((tmp - 1 < 0x7f) && (gSave.fuserOffers[tmp] == 0xf1)) { - gSave.fuserOffers[tmp] = 0xf2; + if ((tmp - 1 < 0x7f) && (gSave.fuserOffers[tmp] == KINSTONE_NEEDS_REPLACEMENT)) { + gSave.fuserOffers[tmp] = KINSTONE_JUST_FUSED; } for (index = 0; index < 0x20; index++) { - if (kinstoneId == gUnk_03003DF0.array[index].unk_3) { - gUnk_03003DF0.array[index].unk_3 = 0xf1; + if (kinstoneId == gPossibleInteraction.candidates[index].kinstoneId) { + gPossibleInteraction.candidates[index].kinstoneId = KINSTONE_NEEDS_REPLACEMENT; } } } } -void AddKinstoneToBag(u32 kinstoneId) { +void AddKinstoneToBag(KinstoneId kinstoneId) { s32 index; s32 tmp; @@ -861,7 +862,7 @@ void AddKinstoneToBag(u32 kinstoneId) { index = GetIndexInKinstoneBag(kinstoneId); if (index < 0) { index = 0; - while (gSave.kinstoneTypes[index] != 0) { + while (gSave.kinstoneTypes[index] != KINSTONE_NONE) { index++; } } @@ -876,19 +877,19 @@ void AddKinstoneToBag(u32 kinstoneId) { } } -void RemoveKinstoneFromBag(u32 kinstoneId) { +void RemoveKinstoneFromBag(KinstoneId kinstoneId) { s32 idx = GetIndexInKinstoneBag(kinstoneId); if (idx >= 0) { s32 next = gSave.kinstoneAmounts[idx] - 1; if (next <= 0) { - gSave.kinstoneTypes[idx] = 0; + gSave.kinstoneTypes[idx] = KINSTONE_NONE; next = 0; } gSave.kinstoneAmounts[idx] = next; } } -u32 GetAmountInKinstoneBag(u32 kinstoneId) { +u32 GetAmountInKinstoneBag(KinstoneId kinstoneId) { s32 index = GetIndexInKinstoneBag(kinstoneId); if (index < 0) { return 0; @@ -896,15 +897,15 @@ u32 GetAmountInKinstoneBag(u32 kinstoneId) { return gSave.kinstoneAmounts[index]; } -u32 CheckKinstoneFused(u32 kinstoneId) { - if (kinstoneId > 100 || kinstoneId < 1) { +u32 CheckKinstoneFused(KinstoneId kinstoneId) { + if (kinstoneId - 1 >= 100) { return 0; } return ReadBit(&gSave.fusedKinstones, kinstoneId); } -bool32 CheckFusionMapMarkerDisabled(u32 kinstoneId) { - if (kinstoneId > 100 || kinstoneId < 1) { +bool32 CheckFusionMapMarkerDisabled(KinstoneId kinstoneId) { + if (kinstoneId - 1 >= 100) { return FALSE; } return ReadBit(&gSave.fusionUnmarked, kinstoneId); @@ -974,7 +975,7 @@ code0_2: #endif } -s32 GetIndexInKinstoneBag(u32 kinstoneId) { +s32 GetIndexInKinstoneBag(KinstoneId kinstoneId) { u32 i; for (i = 0; i < 0x12; ++i) { @@ -1054,7 +1055,7 @@ void UpdateVisibleFusionMapMarkers(void) { extern u8* gUnk_08001DCC[]; -u32 GetFusionToOffer(Entity* entity) { +KinstoneId GetFusionToOffer(Entity* entity) { u8* fuserData; u32 fuserId; u32 offeredFusion; @@ -1065,48 +1066,49 @@ u32 GetFusionToOffer(Entity* entity) { fuserId = GetFuserId(entity); fuserData = gUnk_08001DCC[fuserId]; if (GetInventoryValue(ITEM_KINSTONE_BAG) == 0 || fuserData[0] > gSave.global_progress) { - return 0; + return KINSTONE_NONE; } offeredFusion = gSave.fuserOffers[fuserId]; fuserProgress = gSave.fuserProgress[fuserId]; fuserFusionData = (u8*)(fuserProgress + (u32)fuserData); while (TRUE) { // loop through fusions for this fuser switch (offeredFusion) { - case 0xF1: // offered fusion completed with someone else - case 0x00: // no fusion offered yet + case KINSTONE_NEEDS_REPLACEMENT: // offered fusion completed with someone else + case KINSTONE_NONE: // no fusion offered yet offeredFusion = fuserFusionData[5]; - if (offeredFusion == 0x00 || offeredFusion == 0xFF || CheckKinstoneFused(offeredFusion) == 0) { + if (offeredFusion == KINSTONE_NONE || offeredFusion == KINSTONE_RANDOM || + CheckKinstoneFused(offeredFusion) == 0) { break; } - case 0xF2: // previous fusion completed + case KINSTONE_JUST_FUSED: // previous fusion completed fuserFusionData++; fuserProgress++; offeredFusion = fuserFusionData[5]; } - if (offeredFusion == 0xFF) { // random shared fusion + if (offeredFusion == KINSTONE_RANDOM) { // random shared fusion offeredFusion = GetRandomSharedFusion(fuserData); } - if (offeredFusion == 0x00) { // end of fusion list - offeredFusion = 0xF3; // mark this fuser as done + if (offeredFusion == KINSTONE_NONE) { // end of fusion list + offeredFusion = KINSTONE_FUSER_DONE; // mark this fuser as done break; } - if (offeredFusion == 0xF2) { // previous fusion completed + if (offeredFusion == KINSTONE_JUST_FUSED) { // previous fusion completed continue; } if (CheckKinstoneFused(offeredFusion) == 0) { break; } - offeredFusion = 0xF1; // already completed, try next fusion in the list + offeredFusion = KINSTONE_NEEDS_REPLACEMENT; // already completed, try next fusion in the list } gSave.fuserOffers[fuserId] = offeredFusion; gSave.fuserProgress[fuserId] = fuserProgress; randomMood = Random(); fuserStability = fuserData[1]; if (fuserStability <= randomMood % 100) { - return 0; // fickleness + return KINSTONE_NONE; // fickleness } if (offeredFusion - 1 > 99) { - offeredFusion = 0; + offeredFusion = KINSTONE_NONE; } return offeredFusion; } @@ -1286,5 +1288,5 @@ u32 GetRandomSharedFusion(u8* fuserData) { return kinstoneId; r = (r + 1) % 18; } - return 0xF2; + return KINSTONE_JUST_FUSED; } diff --git a/src/droptables.c b/src/droptables.c index d239a80d..aafd0879 100644 --- a/src/droptables.c +++ b/src/droptables.c @@ -12,9 +12,9 @@ const Droptable gEnemyDroptables[] = { .bombs = -999, .arrows = -999, .mysteriousShells = -999, - .kinstoneGreen = -999, - .kinstoneBlue = -999, .kinstoneRed = -999, + .kinstoneBlue = -999, + .kinstoneGreen = -999, .none2 = -999, .none3 = 0, .none4 = 0, @@ -30,9 +30,9 @@ const Droptable gEnemyDroptables[] = { .bombs = -999, .arrows = -999, .mysteriousShells = -999, - .kinstoneGreen = -999, - .kinstoneBlue = -999, .kinstoneRed = -999, + .kinstoneBlue = -999, + .kinstoneGreen = -999, .none2 = -999, .none3 = 0, .none4 = 0, @@ -48,9 +48,9 @@ const Droptable gEnemyDroptables[] = { .bombs = -999, .arrows = -999, .mysteriousShells = -999, - .kinstoneGreen = -999, - .kinstoneBlue = -999, .kinstoneRed = -999, + .kinstoneBlue = -999, + .kinstoneGreen = -999, .none2 = -999, .none3 = 0, .none4 = 0, @@ -66,9 +66,9 @@ const Droptable gEnemyDroptables[] = { .bombs = -999, .arrows = -999, .mysteriousShells = -999, - .kinstoneGreen = -999, - .kinstoneBlue = -999, .kinstoneRed = -999, + .kinstoneBlue = -999, + .kinstoneGreen = -999, .none2 = -999, .none3 = 0, .none4 = 0, @@ -84,9 +84,9 @@ const Droptable gEnemyDroptables[] = { .bombs = -999, .arrows = -999, .mysteriousShells = 5, - .kinstoneGreen = -999, - .kinstoneBlue = -999, .kinstoneRed = -999, + .kinstoneBlue = -999, + .kinstoneGreen = -999, .none2 = -999, .none3 = 0, .none4 = 0, @@ -102,9 +102,9 @@ const Droptable gEnemyDroptables[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 0, - .kinstoneGreen = 0, - .kinstoneBlue = 0, .kinstoneRed = 0, + .kinstoneBlue = 0, + .kinstoneGreen = 0, .none2 = -999, .none3 = 0, .none4 = 0, @@ -120,9 +120,9 @@ const Droptable gEnemyDroptables[] = { .bombs = 1, .arrows = 1, .mysteriousShells = 0, - .kinstoneGreen = -999, - .kinstoneBlue = -999, .kinstoneRed = -999, + .kinstoneBlue = -999, + .kinstoneGreen = -999, .none2 = -999, .none3 = 0, .none4 = 0, @@ -138,9 +138,9 @@ const Droptable gEnemyDroptables[] = { .bombs = -999, .arrows = -999, .mysteriousShells = -999, - .kinstoneGreen = -999, + .kinstoneRed = -999, .kinstoneBlue = -999, - .kinstoneRed = 10, + .kinstoneGreen = 10, .none2 = -999, .none3 = 0, .none4 = 0, @@ -156,9 +156,9 @@ const Droptable gEnemyDroptables[] = { .bombs = -999, .arrows = -999, .mysteriousShells = -999, - .kinstoneGreen = -999, + .kinstoneRed = -999, .kinstoneBlue = -999, - .kinstoneRed = 15, + .kinstoneGreen = 15, .none2 = -999, .none3 = 0, .none4 = 0, @@ -174,9 +174,9 @@ const Droptable gEnemyDroptables[] = { .bombs = -999, .arrows = 50, .mysteriousShells = 0, - .kinstoneGreen = -999, - .kinstoneBlue = -999, .kinstoneRed = -999, + .kinstoneBlue = -999, + .kinstoneGreen = -999, .none2 = -999, .none3 = 0, .none4 = 0, @@ -192,9 +192,9 @@ const Droptable gEnemyDroptables[] = { .bombs = 100, .arrows = -999, .mysteriousShells = -999, - .kinstoneGreen = -999, - .kinstoneBlue = -999, .kinstoneRed = -999, + .kinstoneBlue = -999, + .kinstoneGreen = -999, .none2 = -999, .none3 = 0, .none4 = 0, @@ -210,9 +210,9 @@ const Droptable gEnemyDroptables[] = { .bombs = -999, .arrows = -999, .mysteriousShells = 10, - .kinstoneGreen = 2, + .kinstoneRed = 2, .kinstoneBlue = 3, - .kinstoneRed = 10, + .kinstoneGreen = 10, .none2 = -999, .none3 = 0, .none4 = 0, @@ -228,9 +228,9 @@ const Droptable gEnemyDroptables[] = { .bombs = -999, .arrows = -999, .mysteriousShells = -999, - .kinstoneGreen = -999, - .kinstoneBlue = -999, .kinstoneRed = -999, + .kinstoneBlue = -999, + .kinstoneGreen = -999, .none2 = -999, .none3 = 0, .none4 = 0, @@ -246,9 +246,9 @@ const Droptable gEnemyDroptables[] = { .bombs = 1, .arrows = 1, .mysteriousShells = 0, - .kinstoneGreen = -999, - .kinstoneBlue = -999, .kinstoneRed = -999, + .kinstoneBlue = -999, + .kinstoneGreen = -999, .none2 = -999, .none3 = 0, .none4 = 0, @@ -264,9 +264,9 @@ const Droptable gEnemyDroptables[] = { .bombs = 20, .arrows = -999, .mysteriousShells = 0, - .kinstoneGreen = -999, - .kinstoneBlue = -999, .kinstoneRed = -999, + .kinstoneBlue = -999, + .kinstoneGreen = -999, .none2 = -999, .none3 = 0, .none4 = 0, @@ -282,9 +282,9 @@ const Droptable gEnemyDroptables[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 0, - .kinstoneGreen = 0, - .kinstoneBlue = 0, .kinstoneRed = 0, + .kinstoneBlue = 0, + .kinstoneGreen = 0, .none2 = -999, .none3 = 0, .none4 = 0, @@ -300,9 +300,9 @@ const Droptable gEnemyDroptables[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 0, - .kinstoneGreen = 2, + .kinstoneRed = 2, .kinstoneBlue = 5, - .kinstoneRed = 10, + .kinstoneGreen = 10, .none2 = 0, .none3 = 0, .none4 = 0, @@ -318,9 +318,9 @@ const Droptable gEnemyDroptables[] = { .bombs = 9, .arrows = 9, .mysteriousShells = 40, - .kinstoneGreen = 9, + .kinstoneRed = 9, .kinstoneBlue = 12, - .kinstoneRed = 16, + .kinstoneGreen = 16, .none2 = 9, .none3 = 0, .none4 = 0, @@ -339,9 +339,9 @@ const Droptable gAreaDroptables[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 10, - .kinstoneGreen = 0, + .kinstoneRed = 0, .kinstoneBlue = 0, - .kinstoneRed = -999, + .kinstoneGreen = -999, .none2 = -999, .none3 = 0, .none4 = 0, @@ -357,9 +357,9 @@ const Droptable gAreaDroptables[] = { .bombs = 200, .arrows = -999, .mysteriousShells = -999, - .kinstoneGreen = -999, - .kinstoneBlue = -999, .kinstoneRed = -999, + .kinstoneBlue = -999, + .kinstoneGreen = -999, .none2 = 0, .none3 = 0, .none4 = 0, @@ -375,9 +375,9 @@ const Droptable gAreaDroptables[] = { .bombs = 35, .arrows = 4, .mysteriousShells = 4, - .kinstoneGreen = 0, + .kinstoneRed = 0, .kinstoneBlue = 0, - .kinstoneRed = 3, + .kinstoneGreen = 3, .none2 = 0, .none3 = 0, .none4 = 0, @@ -393,9 +393,9 @@ const Droptable gAreaDroptables[] = { .bombs = 7, .arrows = 25, .mysteriousShells = 3, - .kinstoneGreen = 0, + .kinstoneRed = 0, .kinstoneBlue = 0, - .kinstoneRed = 9, + .kinstoneGreen = 9, .none2 = 0, .none3 = 0, .none4 = 0, @@ -411,9 +411,9 @@ const Droptable gAreaDroptables[] = { .bombs = 0, .arrows = 23, .mysteriousShells = 2, - .kinstoneGreen = 0, + .kinstoneRed = 0, .kinstoneBlue = 0, - .kinstoneRed = 28, + .kinstoneGreen = 28, .none2 = 0, .none3 = 0, .none4 = 0, @@ -429,9 +429,9 @@ const Droptable gAreaDroptables[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 6, - .kinstoneGreen = 0, + .kinstoneRed = 0, .kinstoneBlue = 0, - .kinstoneRed = 11, + .kinstoneGreen = 11, .none2 = 0, .none3 = 0, .none4 = 0, @@ -447,9 +447,9 @@ const Droptable gAreaDroptables[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 33, - .kinstoneGreen = 0, + .kinstoneRed = 0, .kinstoneBlue = 0, - .kinstoneRed = 6, + .kinstoneGreen = 6, .none2 = 0, .none3 = 0, .none4 = 0, @@ -465,9 +465,9 @@ const Droptable gAreaDroptables[] = { .bombs = 4, .arrows = 4, .mysteriousShells = 3, - .kinstoneGreen = 0, + .kinstoneRed = 0, .kinstoneBlue = 0, - .kinstoneRed = 6, + .kinstoneGreen = 6, .none2 = 20, .none3 = 0, .none4 = 0, @@ -483,9 +483,9 @@ const Droptable gAreaDroptables[] = { .bombs = 1, .arrows = 1, .mysteriousShells = 1, - .kinstoneGreen = 0, + .kinstoneRed = 0, .kinstoneBlue = 0, - .kinstoneRed = 6, + .kinstoneGreen = 6, .none2 = 0, .none3 = 0, .none4 = 0, @@ -501,9 +501,9 @@ const Droptable gAreaDroptables[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 18, - .kinstoneGreen = 0, + .kinstoneRed = 0, .kinstoneBlue = 0, - .kinstoneRed = 5, + .kinstoneGreen = 5, .none2 = 15, .none3 = 0, .none4 = 0, @@ -523,9 +523,9 @@ const Droptable gAreaDroptables[] = { .bombs = 1, .arrows = 1, .mysteriousShells = 40, - .kinstoneGreen = 0, + .kinstoneRed = 0, .kinstoneBlue = 0, - .kinstoneRed = 5, + .kinstoneGreen = 5, .none2 = 0, .none3 = 0, .none4 = 0, @@ -541,9 +541,9 @@ const Droptable gAreaDroptables[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 19, - .kinstoneGreen = 0, + .kinstoneRed = 0, .kinstoneBlue = 0, - .kinstoneRed = 15, + .kinstoneGreen = 15, .none2 = 28, .none3 = 0, .none4 = 0, @@ -559,9 +559,9 @@ const Droptable gAreaDroptables[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 0, - .kinstoneGreen = 0, + .kinstoneRed = 0, .kinstoneBlue = 0, - .kinstoneRed = 9, + .kinstoneGreen = 9, .none2 = 0, .none3 = 0, .none4 = 0, @@ -577,9 +577,9 @@ const Droptable gAreaDroptables[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 1, - .kinstoneGreen = 0, + .kinstoneRed = 0, .kinstoneBlue = 0, - .kinstoneRed = 15, + .kinstoneGreen = 15, .none2 = 0, .none3 = 0, .none4 = 0, @@ -595,9 +595,9 @@ const Droptable gAreaDroptables[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 25, - .kinstoneGreen = 0, + .kinstoneRed = 0, .kinstoneBlue = 0, - .kinstoneRed = 4, + .kinstoneGreen = 4, .none2 = 0, .none3 = 0, .none4 = 0, @@ -613,9 +613,9 @@ const Droptable gAreaDroptables[] = { .bombs = 20, .arrows = 0, .mysteriousShells = 15, - .kinstoneGreen = 0, + .kinstoneRed = 0, .kinstoneBlue = 0, - .kinstoneRed = 10, + .kinstoneGreen = 10, .none2 = -999, .none3 = 0, .none4 = 0, @@ -631,9 +631,9 @@ const Droptable gAreaDroptables[] = { .bombs = 0, .arrows = -999, .mysteriousShells = 0, - .kinstoneGreen = 0, + .kinstoneRed = 0, .kinstoneBlue = 0, - .kinstoneRed = 10, + .kinstoneGreen = 10, .none2 = -999, .none3 = 0, .none4 = 0, @@ -649,9 +649,9 @@ const Droptable gAreaDroptables[] = { .bombs = -999, .arrows = 0, .mysteriousShells = 0, - .kinstoneGreen = 0, + .kinstoneRed = 0, .kinstoneBlue = 0, - .kinstoneRed = 10, + .kinstoneGreen = 10, .none2 = -999, .none3 = 0, .none4 = 0, @@ -667,9 +667,9 @@ const Droptable gAreaDroptables[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 0, - .kinstoneGreen = -999, - .kinstoneBlue = -999, .kinstoneRed = -999, + .kinstoneBlue = -999, + .kinstoneGreen = -999, .none2 = -999, .none3 = 0, .none4 = 0, @@ -687,9 +687,9 @@ const Droptable gObjectDroptables[] = { .bombs = -100, .arrows = -100, .mysteriousShells = 0, - .kinstoneGreen = 0, - .kinstoneBlue = 0, .kinstoneRed = 0, + .kinstoneBlue = 0, + .kinstoneGreen = 0, .none2 = -999, .none3 = 0, .none4 = 0, @@ -705,9 +705,9 @@ const Droptable gObjectDroptables[] = { .bombs = 1, .arrows = 1, .mysteriousShells = 0, - .kinstoneGreen = 0, - .kinstoneBlue = 0, .kinstoneRed = 0, + .kinstoneBlue = 0, + .kinstoneGreen = 0, .none2 = 1, .none3 = 0, .none4 = 0, @@ -723,9 +723,9 @@ const Droptable gObjectDroptables[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 140, - .kinstoneGreen = 0, - .kinstoneBlue = 0, .kinstoneRed = 0, + .kinstoneBlue = 0, + .kinstoneGreen = 0, .none2 = 20, .none3 = 0, .none4 = 0, @@ -741,9 +741,9 @@ const Droptable gObjectDroptables[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 0, - .kinstoneGreen = 0, - .kinstoneBlue = 0, .kinstoneRed = 0, + .kinstoneBlue = 0, + .kinstoneGreen = 0, .none2 = 0, .none3 = 0, .none4 = 0, @@ -759,9 +759,9 @@ const Droptable gObjectDroptables[] = { .bombs = -999, .arrows = -999, .mysteriousShells = -999, - .kinstoneGreen = -999, - .kinstoneBlue = -999, .kinstoneRed = -999, + .kinstoneBlue = -999, + .kinstoneGreen = -999, .none2 = -999, .none3 = 0, .none4 = 0, @@ -777,9 +777,9 @@ const Droptable gObjectDroptables[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 0, - .kinstoneGreen = 0, - .kinstoneBlue = 0, .kinstoneRed = 0, + .kinstoneBlue = 0, + .kinstoneGreen = 0, .none2 = -999, .none3 = 0, .none4 = 0, @@ -796,9 +796,9 @@ const Droptable gObjectDroptables[] = { .bombs = -999, .arrows = 250, .mysteriousShells = -999, - .kinstoneGreen = -999, - .kinstoneBlue = -999, .kinstoneRed = -999, + .kinstoneBlue = -999, + .kinstoneGreen = -999, .none2 = -999, .none3 = 0, .none4 = 0, @@ -815,9 +815,9 @@ const Droptable gObjectDroptables[] = { .bombs = -10, .arrows = -10, .mysteriousShells = 12, - .kinstoneGreen = 1, + .kinstoneRed = 1, .kinstoneBlue = 2, - .kinstoneRed = 10, + .kinstoneGreen = 10, .none2 = 30, .none3 = 0, .none4 = 0, @@ -833,9 +833,9 @@ const Droptable gObjectDroptables[] = { .bombs = -10, .arrows = -10, .mysteriousShells = 24, - .kinstoneGreen = 2, + .kinstoneRed = 2, .kinstoneBlue = 4, - .kinstoneRed = 20, + .kinstoneGreen = 20, .none2 = 10, .none3 = 0, .none4 = 0, @@ -854,9 +854,9 @@ const Droptable gUnk_0800191C[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 0, - .kinstoneGreen = 0, - .kinstoneBlue = 0, .kinstoneRed = 0, + .kinstoneBlue = 0, + .kinstoneGreen = 0, .none2 = 0, .none3 = 0, .none4 = 0, @@ -872,9 +872,9 @@ const Droptable gUnk_0800191C[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 0, - .kinstoneGreen = 0, - .kinstoneBlue = 0, .kinstoneRed = 0, + .kinstoneBlue = 0, + .kinstoneGreen = 0, .none2 = 0, .none3 = 0, .none4 = 0, @@ -890,9 +890,9 @@ const Droptable gUnk_0800191C[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 0, - .kinstoneGreen = 0, - .kinstoneBlue = 0, .kinstoneRed = 0, + .kinstoneBlue = 0, + .kinstoneGreen = 0, .none2 = 0, .none3 = 0, .none4 = 0, @@ -908,9 +908,9 @@ const Droptable gUnk_0800191C[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 0, - .kinstoneGreen = 0, - .kinstoneBlue = 0, .kinstoneRed = 0, + .kinstoneBlue = 0, + .kinstoneGreen = 0, .none2 = 0, .none3 = 0, .none4 = 0, @@ -927,9 +927,9 @@ const Droptable gUnk_0800191C[] = { .bombs = 0, .arrows = 20, .mysteriousShells = -999, - .kinstoneGreen = -999, - .kinstoneBlue = -999, .kinstoneRed = -999, + .kinstoneBlue = -999, + .kinstoneGreen = -999, .none2 = -999, .none3 = 0, .none4 = 0, @@ -945,9 +945,9 @@ const Droptable gUnk_0800191C[] = { .bombs = 0, .arrows = 20, .mysteriousShells = -999, - .kinstoneGreen = -999, - .kinstoneBlue = -999, .kinstoneRed = -999, + .kinstoneBlue = -999, + .kinstoneGreen = -999, .none2 = -999, .none3 = 0, .none4 = 0, @@ -964,9 +964,9 @@ const Droptable gUnk_0800191C[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 0, - .kinstoneGreen = 0, - .kinstoneBlue = 0, .kinstoneRed = 0, + .kinstoneBlue = 0, + .kinstoneGreen = 0, .none2 = -999, .none3 = 0, .none4 = 0, @@ -982,9 +982,9 @@ const Droptable gUnk_0800191C[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 0, - .kinstoneGreen = 0, - .kinstoneBlue = 0, .kinstoneRed = 0, + .kinstoneBlue = 0, + .kinstoneGreen = 0, .none2 = -999, .none3 = 0, .none4 = 0, @@ -1000,9 +1000,9 @@ const Droptable gUnk_0800191C[] = { .bombs = -999, .arrows = -999, .mysteriousShells = -999, - .kinstoneGreen = -999, - .kinstoneBlue = -999, .kinstoneRed = -999, + .kinstoneBlue = -999, + .kinstoneGreen = -999, .none2 = -999, .none3 = 0, .none4 = 0, @@ -1018,9 +1018,9 @@ const Droptable gUnk_0800191C[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 250, - .kinstoneGreen = 0, - .kinstoneBlue = 0, .kinstoneRed = 0, + .kinstoneBlue = 0, + .kinstoneGreen = 0, .none2 = -999, .none3 = 0, .none4 = 0, @@ -1036,9 +1036,9 @@ const Droptable gUnk_0800191C[] = { .bombs = 125, .arrows = 125, .mysteriousShells = 0, - .kinstoneGreen = 0, - .kinstoneBlue = 0, .kinstoneRed = 0, + .kinstoneBlue = 0, + .kinstoneGreen = 0, .none2 = -999, .none3 = 0, .none4 = 0, @@ -1054,9 +1054,9 @@ const Droptable gUnk_0800191C[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 0, - .kinstoneGreen = 20, + .kinstoneRed = 20, .kinstoneBlue = 40, - .kinstoneRed = 190, + .kinstoneGreen = 190, .none2 = -999, .none3 = 0, .none4 = 0, @@ -1077,9 +1077,9 @@ const Droptable gDroptableModifiers[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 0, - .kinstoneGreen = 0, - .kinstoneBlue = 0, .kinstoneRed = 0, + .kinstoneBlue = 0, + .kinstoneGreen = 0, .none2 = 0, .none3 = 0, .none4 = 0, @@ -1096,9 +1096,9 @@ const Droptable gDroptableModifiers[] = { .bombs = 2, .arrows = 2, .mysteriousShells = -999, - .kinstoneGreen = 0, - .kinstoneBlue = 0, .kinstoneRed = 0, + .kinstoneBlue = 0, + .kinstoneGreen = 0, .none2 = 0, .none3 = 0, .none4 = 0, @@ -1115,9 +1115,9 @@ const Droptable gDroptableModifiers[] = { .bombs = 0, .arrows = 0, .mysteriousShells = 0, - .kinstoneGreen = -999, - .kinstoneBlue = -999, .kinstoneRed = -999, + .kinstoneBlue = -999, + .kinstoneGreen = -999, .none2 = 0, .none3 = 0, .none4 = 0, diff --git a/src/enemy/armos.c b/src/enemy/armos.c index 38a30371..e4fa4af1 100644 --- a/src/enemy/armos.c +++ b/src/enemy/armos.c @@ -422,7 +422,7 @@ bool32 sub_0803086C(ArmosEntity* this) { FORCE_REGISTER(u32 r2, r2); if (this->unk_7c != NULL) { - if ((gPlayerState.flags & 0x80) != 0) { + if ((gPlayerState.flags & PL_MINISH) != 0) { centerX = super->x.HALF_U.HI - gRoomControls.origin_x; centerY = super->y.HALF_U.HI - gRoomControls.origin_y; // TODO for some reason the 0x3f of COORD_TO_TILE(super) needs to be forced to r2 here. diff --git a/src/enemy/businessScrub.c b/src/enemy/businessScrub.c index d1333784..aa1001a5 100644 --- a/src/enemy/businessScrub.c +++ b/src/enemy/businessScrub.c @@ -13,6 +13,7 @@ #include "functions.h" #include "game.h" #include "item.h" +#include "kinstone.h" void sub_08028E9C(Entity*); void sub_08028EDC(Entity*); @@ -257,7 +258,7 @@ void sub_08028CE8(Entity* this) { switch (offer->field_0x0 >> 2) { case 0: subtype = offer->field_0x9; - if (subtype == 0xff) { + if (subtype == KINSTONE_RANDOM) { subtype = kinstoneTypes[Random() & 7]; } @@ -547,7 +548,7 @@ void sub_0802922C(Entity* this) { } void sub_0802925C(Entity* this) { - sub_08078784(this, GetFusionToOffer(this)); + AddInteractableWhenBigFuser(this, GetFusionToOffer(this)); } void sub_08029270(Entity* this) { diff --git a/src/entity.c b/src/entity.c index 18f11f75..2ac2b37f 100644 --- a/src/entity.c +++ b/src/entity.c @@ -351,7 +351,7 @@ void DeleteEntity(Entity* ent) { UnloadGFXSlots(ent); UnloadOBJPalette(ent); UnloadOBJPalette2(ent); - sub_080788E0(ent); + RemoveInteractableObject(ent); FreeCarryEntity(ent); sub_0805EC60(ent); sub_08017744(ent); diff --git a/src/gameUtils.c b/src/gameUtils.c index 4f615950..eb2eb7fb 100644 --- a/src/gameUtils.c +++ b/src/gameUtils.c @@ -108,7 +108,7 @@ void InitializePlayer(void) { Entity* pl; - sub_080784C8(); + ResetPossibleInteraction(); MemClear(&gActiveItems, sizeof(gActiveItems)); MemClear(&gPlayerState, sizeof(gPlayerState)); MemFill32(0xffffffff, &gPlayerState.path_memory, sizeof(gPlayerState.path_memory)); @@ -243,7 +243,7 @@ bool32 AreaHasKeys(void) { return (gArea.areaMetadata >> 1) & 1; } -bool32 HasDungeonMap(void) { +bool32 HasDungeonSmallKey(void) { u32 tmp; if (AreaHasKeys()) @@ -251,7 +251,7 @@ bool32 HasDungeonMap(void) { return tmp ? 1 : 0; } -bool32 HasDungeonCompass(void) { +bool32 HasDungeonBigKey(void) { u32 tmp; if (AreaHasKeys()) @@ -259,15 +259,13 @@ bool32 HasDungeonCompass(void) { return tmp ? 1 : 0; } -bool32 HasDungeonBigKey(void) { +bool32 HasDungeonCompass(void) { if (!AreaHasKeys()) return 0; return (gSave.dungeonItems[gArea.dungeon_idx] >> 1) & 1; } -bool32 HasDungeonSmallKey(void) { - u32 tmp; - +bool32 HasDungeonMap(void) { if (!AreaHasKeys()) return 0; return gSave.dungeonItems[gArea.dungeon_idx] & 1; diff --git a/src/interrupts.c b/src/interrupts.c index 33a7d5e7..23934487 100644 --- a/src/interrupts.c +++ b/src/interrupts.c @@ -225,9 +225,9 @@ void PlayerUpdate(Entity* this) { static void HandlePlayerLife(Entity* this) { u32 temp; - gUnk_0200AF00.unk_2f = 0; - gUnk_0200AF00.unk_2d = 0; - gUnk_0200AF00.unk_2e = 0; + gUnk_0200AF00.rActionPlayerState = R_ACTION_NONE; + gUnk_0200AF00.rActionInteractTile = R_ACTION_NONE; + gUnk_0200AF00.rActionGrabbing = R_ACTION_NONE; if ((gPlayerEntity.contactFlags & 0x80) && (gPlayerEntity.iframes > 0)) SoundReq(SFX_86); @@ -240,7 +240,7 @@ static void HandlePlayerLife(Entity* this) { if (sub_08079B24() == 0) sub_08079708(this); - gUnk_03003DF0.unk_0 = 0; + gPossibleInteraction.isUpdated = 0; if (gPlayerState.field_0x27[0] != 0) gPlayerState.field_0x27[0]--; @@ -323,9 +323,9 @@ static void sub_080171F0(void) { sub_080028E0(&gPlayerEntity); if (gPlayerState.flags & PL_CLONING) - gUnk_0200AF00.unk_2f = 1; + gUnk_0200AF00.rActionPlayerState = R_ACTION_CANCEL; - sub_08078180(); + DetermineRButtonInteraction(); gPlayerState.field_0x7 &= ~0x80; gPlayerState.field_0xa &= 0xf; gPlayerState.keepFacing &= ~0x80; diff --git a/src/item/itemSword.c b/src/item/itemSword.c index 87b1070a..5598e0d7 100644 --- a/src/item/itemSword.c +++ b/src/item/itemSword.c @@ -127,7 +127,7 @@ void sub_080754B8(ItemBehavior* this, u32 index) { } if ((this->playerFrame & 0x80) != 0) { - if (((gPlayerState.flags & 0x80) != 0) || ((gPlayerState.skills & SKILL_SPIN_ATTACK) == 0)) { + if (((gPlayerState.flags & PL_MINISH) != 0) || ((gPlayerState.skills & SKILL_SPIN_ATTACK) == 0)) { sub_080759B8(this, index); } else { sub_08075580(this, index); diff --git a/src/item/itemTryPickupObject.c b/src/item/itemTryPickupObject.c index 8a7b40dc..8a1bd692 100644 --- a/src/item/itemTryPickupObject.c +++ b/src/item/itemTryPickupObject.c @@ -95,7 +95,7 @@ void ItemPickupCheck(ItemBehavior* this, u32 index) { carried->subAction = 5; gPlayerState.framestate = PL_STATE_THROW; sub_080762C4(this, carried, 2, index); - gUnk_0200AF00.unk_2e = 8; + gUnk_0200AF00.rActionGrabbing = R_ACTION_GRAB; SoundReq(SFX_102); break; case 1: diff --git a/src/kinstone.c b/src/kinstone.c index 1be80aa3..e6b8f054 100644 --- a/src/kinstone.c +++ b/src/kinstone.c @@ -110,7 +110,7 @@ const struct_gUnk_080B3D20 gUnk_080B3D20[] = { { CHECK_ITEM, ITEM_BLUE_SWORD, 4, 1 }, { LOCAL_BANK_3, LV4_HAKA_08_CAP_0, 4, 2 }, { LOCAL_BANK_3, OUBO_KAKERA, 4, 3 }, - { CHECK_KINSTONE, KINSTONE_9, 4, 4 }, + { CHECK_KINSTONE, KINSTONE_SOURCE_FLOW, 4, 4 }, { LOCAL_BANK_0, TATSUMAKI, 4, 5 }, { LOCAL_BANK_2, SORA_YAKATA_ENTER, 4, 6 }, { LOCAL_BANK_2, SORA_CHIEF_TALK, 4, 7 }, diff --git a/src/menu/kinstoneMenu.c b/src/menu/kinstoneMenu.c index 62621f7e..77b55818 100644 --- a/src/menu/kinstoneMenu.c +++ b/src/menu/kinstoneMenu.c @@ -151,7 +151,7 @@ void KinstoneMenu_Type0(void) { gScreen.bg3.updated = 1; KinstoneMenu_080A4528(); sub_080A4398(); - AddKinstoneToBag(0); + AddKinstoneToBag(KINSTONE_NONE); sub_080A70AC((void*)gUnk_081280DC); SetMenuType(1); SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 8); @@ -606,8 +606,8 @@ u32 sub_080A4418(u32 param_1, u32 param_2) { } void KinstoneMenu_080A4468(void) { - gUnk_03003DF0.unk_2 = 0; - gUnk_03003DF0.unk_4[3] = 0; + gPossibleInteraction.kinstoneId = KINSTONE_NONE; + gPossibleInteraction.currentObject->kinstoneId = KINSTONE_NONE; NotifyFusersOnFusionDone(gFuseInfo.kinstoneId); RemoveKinstoneFromBag(gKinstoneMenu.unk2a); } diff --git a/src/menu/pauseMenu.c b/src/menu/pauseMenu.c index 0b76815b..29c4f3ab 100644 --- a/src/menu/pauseMenu.c +++ b/src/menu/pauseMenu.c @@ -11,6 +11,7 @@ #include "game.h" #include "item.h" #include "itemMetaData.h" +#include "kinstone.h" #include "main.h" #include "menu.h" #include "message.h" @@ -1153,17 +1154,17 @@ void sub_080A5D1C(void) { DrawDirect(DRAW_DIRECT_SPRITE_INDEX, (gMain.ticks & 0x20) != 0 ? 0x78 : 0x79); gOamCmd.y = 0x7e; gOamCmd._8 = 0x4380; - if (HasDungeonSmallKey()) { + if (HasDungeonMap()) { gOamCmd.x = 0x18; frameIndex = gSpriteAnimations_322[0x50]->index; DrawDirect(SUB_080A5D1C_SPRITE_INDEX, frameIndex); } - if (HasDungeonCompass()) { + if (HasDungeonBigKey()) { gOamCmd.x = 0x2e; frameIndex = gSpriteAnimations_322[0x52]->index; DrawDirect(SUB_080A5D1C_SPRITE_INDEX, frameIndex); } - if (HasDungeonBigKey()) { + if (HasDungeonCompass()) { gOamCmd.x = 0x45; gOamCmd._8 = 0x380; frameIndex = gSpriteAnimations_322[0x51]->index; @@ -1281,7 +1282,7 @@ void PauseMenu_Screen_7(void) { void sub_080A6024(void) { sub_080A70AC((KeyButtonLayout*)&gUnk_08128D60); - AddKinstoneToBag(0); + AddKinstoneToBag(KINSTONE_NONE); sub_080A4398(); SetMenuType(1); } diff --git a/src/npc/anju.c b/src/npc/anju.c index 59fa7ce1..fa66f537 100644 --- a/src/npc/anju.c +++ b/src/npc/anju.c @@ -28,9 +28,9 @@ void Anju(Entity* this) { } } -void sub_0806C354(Entity* this) { +void Anju_MakeInteractable(Entity* this) { this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); } void Anju_Fusion(Entity* this) { diff --git a/src/npc/beedle.c b/src/npc/beedle.c index 351a53fb..16ed2ec2 100644 --- a/src/npc/beedle.c +++ b/src/npc/beedle.c @@ -9,22 +9,17 @@ #include "item.h" typedef struct { - s8 unk_00; - u8 unk_01; - u8 unk_02; - u8 unk_03; - s8 unk_04; - s8 unk_05; - s8 unk_06; - s8 unk_07; -} gUnk_0810C89C_struct; + Rect customHitbox; + s8 interactDirections; + u8 unused[3]; +} InteractCollisionData; void sub_080632E0(Entity* this); void sub_08063314(Entity* this); void sub_0806336C(Entity* this); void sub_08063390(Entity* this); -static const u8 gUnk_0810C88C[] = { +static const u8 gBeedleItems[] = { ITEM_NONE, ITEM_BOTTLE_PICOLYTE_BLUE, ITEM_BOTTLE_PICOLYTE_GREEN, @@ -32,10 +27,10 @@ static const u8 gUnk_0810C88C[] = { ITEM_BOTTLE_PICOLYTE_ORANGE, ITEM_BOTTLE_PICOLYTE_YELLOW, ITEM_BOTTLE_PICOLYTE_WHITE, - ITEM_NONE, + 0, }; static const Hitbox gUnk_0810C894 = { 0, 0, { 0, 0, 0, 0 }, 16, 6 }; -static const gUnk_0810C89C_struct gUnk_0810C89C[] = { +static const InteractCollisionData gBeedleCollisionData[] = { { 0, 0, 6, 6, 0, 0, 0, 0 }, { -24, 0, 6, 6, 0, 0, 0, 0 }, { -24, 16, 6, 6, 0, 0, 0, 0 }, { -24, 32, 6, 6, 0, 0, 0, 0 }, { 24, 0, 6, 6, 0, 0, 0, 0 }, { 24, 16, 6, 6, 0, 0, 0, 0 }, { 24, 32, 6, 6, 0, 0, 0, 0 }, @@ -72,7 +67,7 @@ void sub_080632C8(Entity* this) { void sub_080632E0(Entity* this) { if (LoadExtraSpriteData(this, gUnk_0810C8D4)) { InitializeAnimation(this, 0); - sub_08078778(this); + AddInteractableWhenBigObject(this); this->spriteSettings.draw = 1; this->action = 1; } @@ -103,7 +98,7 @@ void sub_08063390(Entity* this) { if (this->frame & ANIM_DONE) { this->action = 1; InitializeAnimation(this, GetAnimationState(this)); - sub_08078778(this); + AddInteractableWhenBigObject(this); } sub_0806ED78(this); } @@ -136,7 +131,7 @@ void sub_08063410(Entity* this) { this->type2 = 0; } sub_0807DD64(this); - sub_08078778(this); + AddInteractableWhenBigObject(this); } if (this->type != 0) { sub_0806346C(this); @@ -146,8 +141,10 @@ void sub_08063410(Entity* this) { GetNextFrame(this); } +// figures out with which of the 7 objects the player interacts with +// based on the player's position and facing direction void sub_0806346C(Entity* this) { - static const u8 gUnk_0810C8F0[][6][4] = { + static const u8 gUnk_0810C8F0[5][6][4] = { { { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, @@ -216,20 +213,20 @@ void sub_0806346C(Entity* this) { bVar1 = gUnk_0810C8F0[iVar2][iVar3][gPlayerEntity.animationState >> 1]; if (bVar1 != this->type2) { - const gUnk_0810C89C_struct* temp = &gUnk_0810C89C[bVar1]; - sub_08078850(this, 1, temp->unk_04, temp); + const InteractCollisionData* data = &gBeedleCollisionData[bVar1]; + SetInteractableObjectCollision(this, 1, data->interactDirections, data); this->type2 = bVar1; } } -void sub_080634E4(Entity* this, ScriptExecutionContext* context) { +void Beedle_GetObjectType(Entity* this, ScriptExecutionContext* context) { context->intVariable = this->type2; } -void sub_080634EC(Entity* this) { - gRoomVars.shopItemType = gUnk_0810C88C[this->type2]; +void Beedle_ConfirmBuyItem(Entity* this) { + gRoomVars.shopItemType = gBeedleItems[this->type2]; } -void sub_08063504(Entity* this, ScriptExecutionContext* context) { - context->condition = !!GetBottleContaining(gUnk_0810C88C[this->type2]); +void Beedle_IsBottleInInventory(Entity* this, ScriptExecutionContext* context) { + context->condition = !!GetBottleContaining(gBeedleItems[this->type2]); } diff --git a/src/npc/bladeBrothers.c b/src/npc/bladeBrothers.c index 93dbfccc..4532cfaf 100644 --- a/src/npc/bladeBrothers.c +++ b/src/npc/bladeBrothers.c @@ -235,7 +235,7 @@ void sub_08068A1C(Entity* this) { bVar1 = 3; } else { - sub_08078778(this); + AddInteractableWhenBigObject(this); offset = 2; bVar1 = 1; } @@ -292,7 +292,7 @@ void sub_08068AFC(Entity* this) { this->action = 1; this->spriteSettings.draw = 1; this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); sub_0807DD50(this); } diff --git a/src/npc/brocco.c b/src/npc/brocco.c index 28edb9a2..e02ca622 100644 --- a/src/npc/brocco.c +++ b/src/npc/brocco.c @@ -30,7 +30,7 @@ void sub_0806355C(Entity* this) { this->action = this->action + 1; this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 4); - sub_08078778(this); + AddInteractableWhenBigObject(this); } void sub_08063584(Entity* this) { @@ -114,9 +114,9 @@ void sub_080636D8(Entity* this) { ShowNPCDialogue(this, &gUnk_0810CAAC[gSave.global_progress]); } -void sub_080636F4(Entity* this) { +void Brocco_MakeInteractable(Entity* this) { this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); } void Brocco_Fusion(Entity* this) { diff --git a/src/npc/carpenter.c b/src/npc/carpenter.c index e7781a50..f54795e0 100644 --- a/src/npc/carpenter.c +++ b/src/npc/carpenter.c @@ -91,9 +91,9 @@ void sub_08067304(Entity* this) { ShowNPCDialogue(this, &dialog); } -void sub_08067314(Entity* this) { +void Carpenter_MakeInteractable(Entity* this) { this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); } void Carpenter_Fusion(Entity* this) { diff --git a/src/npc/cat.c b/src/npc/cat.c index 7eebb148..33586cb9 100644 --- a/src/npc/cat.c +++ b/src/npc/cat.c @@ -281,7 +281,7 @@ void sub_08067AAC(Entity* this) { this->spriteSettings.flipX = this->direction >> 4 ^ 1; sub_08067DCC(this, 3); - sub_08078850(this, 0, gUnk_0811110C[2], gUnk_0811110F); + SetInteractableObjectCollision(this, 0, gUnk_0811110C[2], gUnk_0811110F); } void sub_08067B08(Entity* this) { @@ -293,7 +293,7 @@ void sub_08067B08(Entity* this) { void sub_08067B34(Entity* this) { sub_08067DCC(this, 0); this->frameDuration = (Random() & 0x30) + 0xb4; - sub_08078850(this, 0, gUnk_0811110C[this->spriteSettings.flipX], gUnk_0811110F); + SetInteractableObjectCollision(this, 0, gUnk_0811110C[this->spriteSettings.flipX], gUnk_0811110F); } void sub_08067B70(Entity* this) { @@ -350,9 +350,9 @@ void sub_08067C44(Entity* this) { if (uVar5 != this->field_0x68.HALF.HI) { if (uVar5 == 0) { - sub_08078778(this); + AddInteractableWhenBigObject(this); } else { - sub_080787A8(this, this->field_0x68.HALF.LO); + AddInteractableAsMinishFuser(this, this->field_0x68.HALF.LO); } } diff --git a/src/npc/cow.c b/src/npc/cow.c index 7c99efb9..e74ed30a 100644 --- a/src/npc/cow.c +++ b/src/npc/cow.c @@ -209,9 +209,9 @@ void sub_0806920C(Entity* ent) { if (var1 != ent->field_0x6c.HALF.HI) { if (var1 == 0) { - sub_08078778(ent); + AddInteractableWhenBigObject(ent); } else { - sub_080787A8(ent, ent->field_0x6c.HALF.LO); + AddInteractableAsMinishFuser(ent, ent->field_0x6c.HALF.LO); } } diff --git a/src/npc/cucco.c b/src/npc/cucco.c index 5710d40a..28709607 100644 --- a/src/npc/cucco.c +++ b/src/npc/cucco.c @@ -1,5 +1,6 @@ #include "npc.h" #include "functions.h" +#include "kinstone.h" void (*const Cucco_Actions[])(Entity*); const u16 Cucco_Sounds[]; @@ -16,7 +17,7 @@ void Cucco(Entity* this) { void Cucco_Init(Entity* this) { this->action++; this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_080787A8(this, this->field_0x68.HALF.LO); + AddInteractableAsMinishFuser(this, this->field_0x68.HALF.LO); SetDefaultPriority(this, PRIO_MESSAGE); this->subAction = 0; sub_0806E4EC(this); @@ -113,7 +114,7 @@ void sub_0806E65C(Entity* this) { void Cucco_ShowMessage(Entity* this) { u32 val = 0; u32 index = GetFuserId(this); - if (gSave.fuserOffers[index] == 0xf3) { + if (gSave.fuserOffers[index] == KINSTONE_FUSER_DONE) { val = 1; } @@ -135,4 +136,4 @@ void (*const Cucco_Actions[])(Entity*) = { }; const u16 Cucco_Sounds[] = { SFX_VO_CUCCO1, SFX_VO_CUCCO2, SFX_VO_CUCCO3, SFX_VO_CUCCO4 }; -const u16 Cucco_Messages[] = { TEXT_INDEX(TEXT_MINISH, 0Xb4), TEXT_INDEX(TEXT_MINISH, 0xb5) }; +const u16 Cucco_Messages[] = { TEXT_INDEX(TEXT_MINISH, 0xb4), TEXT_INDEX(TEXT_MINISH, 0xb5) }; diff --git a/src/npc/cuccoChick.c b/src/npc/cuccoChick.c index 22d29486..75ccdce3 100644 --- a/src/npc/cuccoChick.c +++ b/src/npc/cuccoChick.c @@ -24,7 +24,7 @@ void CuccoChick(Entity* this) { void CuccoChick_Init(Entity* this) { this->action++; this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_080787A8(this, this->field_0x68.HALF.LO); + AddInteractableAsMinishFuser(this, this->field_0x68.HALF.LO); SetDefaultPriority(this, PRIO_MESSAGE); this->subAction = 0; sub_0806E764(this); diff --git a/src/npc/dampe.c b/src/npc/dampe.c index 6c587232..fad25893 100644 --- a/src/npc/dampe.c +++ b/src/npc/dampe.c @@ -33,9 +33,9 @@ void Dampe(Entity* this) { } } -void sub_0806BE3C(Entity* this) { +void Dampe_MakeInteractable(Entity* this) { this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); } void Dampe_Fusion(Entity* this) { diff --git a/src/npc/din.c b/src/npc/din.c index b803d9a2..c5608c7e 100644 --- a/src/npc/din.c +++ b/src/npc/din.c @@ -1,6 +1,7 @@ #include "global.h" #include "entity.h" #include "npc.h" +#include "kinstone.h" void Din(Entity* this) { switch (this->action) { @@ -29,12 +30,12 @@ void Din(Entity* this) { } } -void sub_08064828(Entity* this) { - u32 tmp = GetFusionToOffer(this); +void Din_MakeInteractable(Entity* this) { + u32 kinstoneId = GetFusionToOffer(this); if ((gSave.fuserProgress[GetFuserId(this)] != 0) && (gSave.global_progress < 7)) { - tmp = 0; + kinstoneId = KINSTONE_NONE; } - sub_08078784(this, tmp); + AddInteractableWhenBigFuser(this, kinstoneId); } void Din_Fusion(Entity* this) { diff --git a/src/npc/dog.c b/src/npc/dog.c index e3c287d9..10427419 100644 --- a/src/npc/dog.c +++ b/src/npc/dog.c @@ -351,7 +351,7 @@ void sub_08069E50(Entity* this) { if (GetInventoryValue(ITEM_QST_DOGFOOD) == 2) { this->action = 7; InitAnimationForceUpdate(this, 0x29); - sub_080788E0(this); + RemoveInteractableObject(this); EnqueueSFX(SFX_VO_DOG); EnqueueSFX(SFX_TASK_COMPLETE); } @@ -432,9 +432,9 @@ void sub_08069FE8(Entity* this) { if (tmp != this->field_0x6a.HALF.LO) { if (tmp == 0) { - sub_08078778(this); + AddInteractableWhenBigObject(this); } else { - sub_080787A8(this, this->field_0x74.HALF.LO); + AddInteractableAsMinishFuser(this, this->field_0x74.HALF.LO); } } this->field_0x6a.HALF.LO = tmp; diff --git a/src/npc/drLeft.c b/src/npc/drLeft.c index d991340e..aef5ecc4 100644 --- a/src/npc/drLeft.c +++ b/src/npc/drLeft.c @@ -77,11 +77,6 @@ void sub_0806C038(Entity* this) { } void sub_0806C09C(Entity* this) { - static const u8 gUnk_081133B4[] = { - 0, - 6, - 8, - 12, - }; - sub_08078850(this, 1, 0, &gUnk_081133B4); + static const Rect gUnk_081133B4 = { 0, 6, 8, 12 }; + SetInteractableObjectCollision(this, 1, 0, &gUnk_081133B4); } diff --git a/src/npc/epona.c b/src/npc/epona.c index 544a749d..b06a7777 100644 --- a/src/npc/epona.c +++ b/src/npc/epona.c @@ -73,9 +73,9 @@ void sub_08065A64(Entity* this) { if (uVar2 != this->field_0x68.HALF.HI) { if (uVar2 == 0) { - sub_08078778(this); + AddInteractableWhenBigObject(this); } else { - sub_080787A8(this, this->field_0x68.HALF.LO); + AddInteractableAsMinishFuser(this, this->field_0x68.HALF.LO); } } this->field_0x68.HALF.HI = uVar2; diff --git a/src/npc/farmers.c b/src/npc/farmers.c index 1fa4357c..d2c4e2fc 100644 --- a/src/npc/farmers.c +++ b/src/npc/farmers.c @@ -53,14 +53,14 @@ void sub_0806BCB8(Entity* this) { this->animationState = this->timer; } -void sub_0806BCC0(Entity* this) { +void Farmers_MarkEenieFuserDoner(Entity* this) { if (this->type == 0) { - sub_0806F188(this); + MarkFuserDone(this); } } -void sub_0806BCD4(Entity* this) { - sub_08078784(this, GetFusionToOffer(this)); +void Farmers_MakeInteractable(Entity* this) { + AddInteractableWhenBigFuser(this, GetFusionToOffer(this)); } void sub_0806BCE8(Entity* this) { @@ -69,12 +69,12 @@ void sub_0806BCE8(Entity* this) { DIALOG_KINSTONE, DIALOG_CHECK_FLAG, 1, - { TEXT_INDEX(TEXT_FARMERS, 0X7), TEXT_INDEX(TEXT_FARMERS, 0x2) } }, + { TEXT_INDEX(TEXT_FARMERS, 0x7), TEXT_INDEX(TEXT_FARMERS, 0x2) } }, { 0x29, DIALOG_KINSTONE, DIALOG_CHECK_FLAG, 1, - { TEXT_INDEX(TEXT_FARMERS, 0X11), TEXT_INDEX(TEXT_FARMERS, 0xd) } }, + { TEXT_INDEX(TEXT_FARMERS, 0x11), TEXT_INDEX(TEXT_FARMERS, 0xd) } }, }; ShowNPCDialogue(this, &gUnk_08113158[this->type]); } diff --git a/src/npc/farore.c b/src/npc/farore.c index fa5f25c3..c802bf6f 100644 --- a/src/npc/farore.c +++ b/src/npc/farore.c @@ -1,6 +1,7 @@ #include "global.h" #include "entity.h" #include "npc.h" +#include "kinstone.h" void Farore(Entity* this) { switch (this->action) { @@ -29,12 +30,12 @@ void Farore(Entity* this) { } } -void sub_08064A28(Entity* this) { - u32 tmp = GetFusionToOffer(this); +void Farore_MakeInteractable(Entity* this) { + u32 kinstoneId = GetFusionToOffer(this); if ((gSave.fuserProgress[GetFuserId(this)] != 0) && (gSave.global_progress < 7)) { - tmp = 0; + kinstoneId = KINSTONE_NONE; } - sub_08078784(this, tmp); + AddInteractableWhenBigFuser(this, kinstoneId); } void Farore_Fusion(Entity* this) { diff --git a/src/npc/festari.c b/src/npc/festari.c index 781cc9cf..f9e0cb57 100644 --- a/src/npc/festari.c +++ b/src/npc/festari.c @@ -22,7 +22,7 @@ void sub_0805FE10(Entity* this) { this->spriteSettings.draw = TRUE; SetDefaultPriority(this, PRIO_MESSAGE); this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); sub_0807DD50(this); } diff --git a/src/npc/forestMinish.c b/src/npc/forestMinish.c index 9a898c67..b002d976 100644 --- a/src/npc/forestMinish.c +++ b/src/npc/forestMinish.c @@ -534,9 +534,9 @@ void ForestMinish(Entity* this) { } } -void sub_08060090(Entity* this) { +void ForestMinish_MakeInteractable(Entity* this) { this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); } void ForestMinish_Head(Entity* this) { diff --git a/src/npc/gentari.c b/src/npc/gentari.c index 3ba91821..d2d36028 100644 --- a/src/npc/gentari.c +++ b/src/npc/gentari.c @@ -9,7 +9,7 @@ void Gentari(Entity* this) { this->spriteSettings.draw = TRUE; SetDefaultPriority(this, PRIO_MESSAGE); this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); sub_0807DD50(this); break; case 1: diff --git a/src/npc/ghostBrothers.c b/src/npc/ghostBrothers.c index afcb7f2b..2fe80a97 100644 --- a/src/npc/ghostBrothers.c +++ b/src/npc/ghostBrothers.c @@ -110,9 +110,9 @@ void sub_08065CCC(Entity* this) { gScreen.controls.alphaBlend = 0x10; } -void sub_08065D00(Entity* this) { +void GhostBrothers_MakeInteractable(Entity* this) { this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); } void sub_08065D18(Entity* this) { @@ -219,7 +219,7 @@ void sub_08065EDC(Entity* this) { *(u16**)&this->field_0x6c = (++puVar3); } else { this->action++; - sub_08078778(this); + AddInteractableWhenBigObject(this); } } } diff --git a/src/npc/gina.c b/src/npc/gina.c index 0bb49f92..0095f7b3 100644 --- a/src/npc/gina.c +++ b/src/npc/gina.c @@ -10,7 +10,7 @@ void Gina(Entity* this) { this->spriteSettings.draw = 1; this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); sub_0807DD50(this); break; case 1: diff --git a/src/npc/gorman.c b/src/npc/gorman.c index bec184f5..abec9aae 100644 --- a/src/npc/gorman.c +++ b/src/npc/gorman.c @@ -70,7 +70,7 @@ void sub_080697C4(Entity* this) { if (LoadExtraSpriteData(this, gUnk_08111C3C)) { this->action = 1; InitializeAnimation(this, 2); - sub_08078778(this); + AddInteractableWhenBigObject(this); } } diff --git a/src/npc/goron.c b/src/npc/goron.c index 8056bf52..ce2fb731 100644 --- a/src/npc/goron.c +++ b/src/npc/goron.c @@ -30,7 +30,7 @@ void Goron(Entity* this) { } void sub_08069310(Entity* this) { - sub_08078778(this); + AddInteractableWhenBigObject(this); this->action = 1; InitAnimationForceUpdate(this, 2); } @@ -113,12 +113,12 @@ void sub_0806948C(Entity* this, ScriptExecutionContext* context) { gActiveScriptInfo.flags |= 1; } -void sub_080694B0(Entity* this) { +void Goron_MakeInteractable(Entity* this) { u32 kinstone = (u8)sub_08069480(this); if (CheckKinstoneFused(kinstone)) { - sub_08078778(this); + AddInteractableWhenBigObject(this); } else { - sub_08078784(this, kinstone); + AddInteractableWhenBigFuser(this, kinstone); } } diff --git a/src/npc/gregal.c b/src/npc/gregal.c index 7d867bf0..8a279a06 100644 --- a/src/npc/gregal.c +++ b/src/npc/gregal.c @@ -42,8 +42,8 @@ void sub_0806CAF4(Entity* this) { SortEntityAbove(this, npc); } sub_0807DD64(this); - sub_08078778(this); - sub_08078850(this, 1, (u8)gUnk_08113D84[1], gUnk_08113D84); + AddInteractableWhenBigObject(this); + SetInteractableObjectCollision(this, 1, (u8)gUnk_08113D84[1], gUnk_08113D84); } ExecuteScriptForEntity(this, NULL); HandleEntity0x82Actions(this); @@ -154,9 +154,9 @@ void sub_0806CD4C(Entity* this) { ChangeObjPalette(this, 0x110); } -void sub_0806CD58(Entity* this) { +void Gregal_MakeInteractable(Entity* this) { this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); } void Gregal_Fusion(Entity* this) { diff --git a/src/npc/guard.c b/src/npc/guard.c index 661739ee..834c2f1b 100644 --- a/src/npc/guard.c +++ b/src/npc/guard.c @@ -294,7 +294,7 @@ void sub_08063D44(Entity* this) { ent->subtimer = 60; break; case 4 ... 5: - sub_08078778(this); + AddInteractableWhenBigObject(this); break; } this->action++; diff --git a/src/npc/hurdyGurdyMan.c b/src/npc/hurdyGurdyMan.c index 46ee55f0..1c45bbf3 100644 --- a/src/npc/hurdyGurdyMan.c +++ b/src/npc/hurdyGurdyMan.c @@ -100,9 +100,9 @@ void sub_0806E418(Entity* this) { ShowNPCDialogue(this, &dialogs[tmp]); } -void sub_0806E440(Entity* this) { +void HurdyGurdyMan_MakeInteractable(Entity* this) { this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); } void HurdyGurdyMan_Fusion(Entity* this) { diff --git a/src/npc/kid.c b/src/npc/kid.c index 870b7744..685d7da8 100644 --- a/src/npc/kid.c +++ b/src/npc/kid.c @@ -213,7 +213,7 @@ void sub_080620F4(Entity* this) { this->field_0x68.HALF.LO = 0; this->action = 1; InitAnimationForceUpdate(this, 2); - sub_08078778(this); + AddInteractableWhenBigObject(this); } } @@ -418,7 +418,7 @@ void sub_08062500(Entity* this) { this->myHeap = zMalloc(sizeof(KidHeap)); if (this->myHeap != NULL) { this->field_0x68.HALF.LO = 1; - sub_080788E0(this); + RemoveInteractableObject(this); this->hitbox = NULL; sub_0806252C(this); } @@ -701,9 +701,9 @@ void sub_08062948(Entity* this, ScriptExecutionContext* context) { } } -void sub_08062A48(Entity* this, ScriptExecutionContext* context) { +void Kid_MakeInteractable(Entity* this, ScriptExecutionContext* context) { this->field_0x6a.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x6a.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x6a.HALF.LO); } void Kid_Fusion(Entity* this) { diff --git a/src/npc/kingDaltus.c b/src/npc/kingDaltus.c index 2d9c2989..3bdf60a2 100644 --- a/src/npc/kingDaltus.c +++ b/src/npc/kingDaltus.c @@ -40,7 +40,7 @@ void sub_08066654(Entity* this) { this->action = 1; this->spriteSettings.draw = 1; this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); InitAnimationForceUpdate(this, 2); } @@ -86,8 +86,8 @@ void sub_08066718(Entity* this) { } } -void sub_0806672C(Entity* this) { - sub_08078784(this, this->field_0x68.HALF.LO); +void KingDaltus_MakeInteractable(Entity* this) { + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); } void sub_0806673C(Entity* this) { diff --git a/src/npc/librari.c b/src/npc/librari.c index 819b5a61..e725b669 100644 --- a/src/npc/librari.c +++ b/src/npc/librari.c @@ -10,7 +10,7 @@ void Librari(Entity* this) { this->spriteSettings.draw = TRUE; this->animationState = this->timer; this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); SetDefaultPriority(this, PRIO_MESSAGE); sub_0807DD50(this); break; diff --git a/src/npc/malon.c b/src/npc/malon.c index 0270006d..1ab967c0 100644 --- a/src/npc/malon.c +++ b/src/npc/malon.c @@ -44,7 +44,7 @@ void sub_08065888(Entity* this) { this->spriteSettings.draw = 1; this->animationState = 4; this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); sub_0807DD50(this); } diff --git a/src/npc/mama.c b/src/npc/mama.c index 95758b1c..0e2b7620 100644 --- a/src/npc/mama.c +++ b/src/npc/mama.c @@ -92,9 +92,9 @@ void sub_0806C4DC(Entity* this) { ShowNPCDialogue(this, &dialogs[gSave.global_progress]); } -void sub_0806C4F8(Entity* this) { +void Mama_MakeInteractable(Entity* this) { this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); } void Mama_Fusion(Entity* this) { diff --git a/src/npc/mayorHagen.c b/src/npc/mayorHagen.c index 1cef31bc..e5e5cad3 100644 --- a/src/npc/mayorHagen.c +++ b/src/npc/mayorHagen.c @@ -37,15 +37,10 @@ void MayorHagen(Entity* this) { } } -void sub_0806CE5C(Entity* this) { - static const u8 gUnk_08113F44[] = { - 0, - 8, - 8, - 16, - }; - sub_08078784(this, GetFusionToOffer(this)); - sub_08078850(this, 1, 0, gUnk_08113F44); +void MayorHagen_MakeInteractable(Entity* this) { + static const Rect gUnk_08113F44 = { 0, 8, 8, 16 }; + AddInteractableWhenBigFuser(this, GetFusionToOffer(this)); + SetInteractableObjectCollision(this, 1, 0, &gUnk_08113F44); } void sub_0806CE80(Entity* this) { diff --git a/src/npc/melari.c b/src/npc/melari.c index 5c72230b..59760a78 100644 --- a/src/npc/melari.c +++ b/src/npc/melari.c @@ -29,7 +29,7 @@ void sub_08068708(Entity* this) { if (LoadExtraSpriteData(this, gUnk_08111520)) { this->action = 1; InitializeAnimation(this, 0); - sub_08078778(this); + AddInteractableWhenBigObject(this); } } @@ -100,9 +100,9 @@ void sub_08068780(Entity* this) { } } -void sub_08068884(Entity* this) { +void Melari_MakeInteractable(Entity* this) { this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); } void Melari_Head(Entity* this) { diff --git a/src/npc/ministerPotho.c b/src/npc/ministerPotho.c index 9ee87713..fe5806c1 100644 --- a/src/npc/ministerPotho.c +++ b/src/npc/ministerPotho.c @@ -27,7 +27,7 @@ void sub_080667E4(Entity* this) { this->action = 1; this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 2); - sub_08078778(this); + AddInteractableWhenBigObject(this); } void sub_08066808(Entity* this) { @@ -81,8 +81,8 @@ void sub_08066864(Entity* this) { } } -void sub_080668F0(Entity* this) { - sub_08078784(this, GetFusionToOffer(this)); +void MinisterPotho_MakeInteractable(Entity* this) { + AddInteractableWhenBigFuser(this, GetFusionToOffer(this)); } void sub_08066904(Entity* this) { diff --git a/src/npc/mountainMinish.c b/src/npc/mountainMinish.c index ca0d3574..bfa0e17c 100644 --- a/src/npc/mountainMinish.c +++ b/src/npc/mountainMinish.c @@ -57,7 +57,7 @@ void MountainMinish(Entity* this) { void sub_08067E60(Entity* this) { if (LoadExtraSpriteData(this, gUnk_08111358)) { this->action = 1; - sub_08078778(this); + AddInteractableWhenBigObject(this); InitializeAnimation(this, 2); } } @@ -179,9 +179,9 @@ void sub_08067EF0(Entity* this) { } } -void sub_08068104(Entity* this) { +void MountainMinish_MakeInteractable(Entity* this) { this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); } void sub_0806811C(Entity* this) { diff --git a/src/npc/mutoh.c b/src/npc/mutoh.c index 5cb1691e..a93b7258 100644 --- a/src/npc/mutoh.c +++ b/src/npc/mutoh.c @@ -82,9 +82,9 @@ void sub_080670E4(Entity* this) { ShowNPCDialogue(this, &dialogs[gSave.global_progress]); } -void sub_08067100(Entity* this) { +void Mutoh_MakeInteractable(Entity* this) { this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); } void Mutoh_Fusion(Entity* this) { diff --git a/src/npc/nayru.c b/src/npc/nayru.c index 35176f0b..b9ea0df4 100644 --- a/src/npc/nayru.c +++ b/src/npc/nayru.c @@ -1,6 +1,7 @@ #include "global.h" #include "entity.h" #include "npc.h" +#include "kinstone.h" void Nayru(Entity* this) { switch (this->action) { @@ -29,12 +30,12 @@ void Nayru(Entity* this) { } } -void sub_08064928(Entity* this) { - u32 tmp = GetFusionToOffer(this); +void Nayru_MakeInteractable(Entity* this) { + u32 kinstoneId = GetFusionToOffer(this); if ((gSave.fuserProgress[GetFuserId(this)] != 0) && (gSave.global_progress < 7)) { - tmp = 0; + kinstoneId = KINSTONE_NONE; } - sub_08078784(this, tmp); + AddInteractableWhenBigFuser(this, kinstoneId); } void Nayru_Fusion(Entity* this) { diff --git a/src/npc/npc23.c b/src/npc/npc23.c index eccd933c..a07b14b1 100644 --- a/src/npc/npc23.c +++ b/src/npc/npc23.c @@ -38,7 +38,7 @@ void sub_080662F8(Entity* this) { this->parent = &gPlayerEntity; this->cutsceneBeh.HWORD = 0; sub_08066490(this, this->parent); - sub_08078778(this); + AddInteractableWhenBigObject(this); } void sub_08066358(Entity* this) { @@ -56,7 +56,7 @@ void sub_08066358(Entity* this) { this->speed = 0x80; this->cutsceneBeh.HWORD = 1; gPauseMenuOptions.disabled = 1; - sub_080788E0(this); + RemoveInteractableObject(this); } } else { sub_08066490(this, this->parent); diff --git a/src/npc/npc26.c b/src/npc/npc26.c index a9c19cf2..fddbf460 100644 --- a/src/npc/npc26.c +++ b/src/npc/npc26.c @@ -18,7 +18,7 @@ static void sub_080669B8(Entity* this) { this->action = 1; this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 2); - sub_08078778(this); + AddInteractableWhenBigObject(this); } static void sub_080669DC(Entity* this) { diff --git a/src/npc/npc4E.c b/src/npc/npc4E.c index 42c3b02d..cdfd7abe 100644 --- a/src/npc/npc4E.c +++ b/src/npc/npc4E.c @@ -4,6 +4,7 @@ #include "game.h" #include "hitbox.h" #include "item.h" +#include "kinstone.h" #include "npc.h" #include "object.h" #include "save.h" @@ -11,15 +12,16 @@ #include "sound.h" typedef struct { - u32 unk_00; - s8 unk_04; -} gUnk_0810C89C_struct; + Rect customHitbox; + u8 interactDirections; + u8 unused[3]; +} InteractCollisionData; extern void script_MinishVillageObjectLeftStoneOpening; // Cutscene data type? extern void script_MinishVillageObjectRightStoneOpening; // Cutscene data type? const Hitbox gUnk_08114154; -const u8 gUnk_0811415C[]; +const InteractCollisionData gNpc4ECollisionData[]; const ScreenTransitionData* const gNpc4ETransitions[]; const u8 gNpc4ETransitionTypes[]; const u16 gUnk_081141F4[]; @@ -41,42 +43,39 @@ void NPC4E(Entity* this) { } } -void sub_0806DA04(Entity* this, ScriptExecutionContext* context) { - // TODO gUnk_0811415C should be a gUnk_0810C89C_struct[], but then a lot of bytes everywhere are wrong? - gUnk_0810C89C_struct* a = (gUnk_0810C89C_struct*)&( - (gUnk_0810C89C_struct*)gUnk_0811415C)[context->intVariable]; // cast necessary to no longer make it a const* ? - sub_08078850(this, 1, (u8)a->unk_04, a); +void NPC4E_ChangeInteractableHitbox(Entity* this, ScriptExecutionContext* context) { + const InteractCollisionData* data = &gNpc4ECollisionData[context->intVariable]; + SetInteractableObjectCollision(this, 1, data->interactDirections, data); } void NPC4E_DoScreenTransition(Entity* this, ScriptExecutionContext* context) { sub_0808091C(gNpc4ETransitions[context->intVariable], gNpc4ETransitionTypes[context->intVariable]); } -// Returns the kinstone id? -u8 sub_0806DA3C(Entity* this) { +u8 NPC4E_GetKinstoneId(Entity* this) { u32 result; switch (this->type) { default: - result = 0; + result = KINSTONE_NONE; break; case 1: - result = 1; + result = KINSTONE_MYSTERIOUS_CLOUD_TOP_RIGHT; break; case 2: - result = 2; + result = KINSTONE_MYSTERIOUS_CLOUD_BOTTOM_LEFT; break; case 3: - result = 3; + result = KINSTONE_MYSTERIOUS_CLOUD_TOP_LEFT; break; case 4: - result = 4; + result = KINSTONE_MYSTERIOUS_CLOUD_MIDDLE; break; case 5: - result = 5; + result = KINSTONE_MYSTERIOUS_CLOUD_BOTTOM_RIGHT; break; case 11: - result = 9; + result = KINSTONE_SOURCE_FLOW; break; case 6: case 7: @@ -89,18 +88,16 @@ u8 sub_0806DA3C(Entity* this) { return result; } -// Check whether a kinstone fusion is possible and store the result somewhere in param_2? -void sub_0806DAAC(Entity* this, ScriptExecutionContext* context) { - context->condition = CheckKinstoneFused(sub_0806DA3C(this)); +void NPC4E_IsKinstoneFused(Entity* this, ScriptExecutionContext* context) { + context->condition = CheckKinstoneFused(NPC4E_GetKinstoneId(this)); gActiveScriptInfo.flags |= 1; } -// maybe actually execute the kinstone fusion? -void sub_0806DAD0(Entity* this) { - sub_08078790(this, sub_0806DA3C(this)); +void NPC4E_MakeFuserInteractable(Entity* this) { + AddInteractableFuser(this, NPC4E_GetKinstoneId(this)); } -void sub_0806DAE8(Entity* this) { +void NPC4E_SetPinwheelFlag(Entity* this) { switch (this->type - 1) { case 0: SetLocalFlag(KUMOUE_02_AWASE_01); @@ -122,7 +119,7 @@ void sub_0806DAE8(Entity* this) { SoundReq(SFX_TASK_COMPLETE); } -void sub_0806DB44(Entity* this, ScriptExecutionContext* context) { +void NPC4E_IsEveryPinwheelActivated(Entity* this, ScriptExecutionContext* context) { context->condition = 0; if (CheckLocalFlag(KUMOUE_02_AWASE_01) && CheckLocalFlag(KUMOUE_02_AWASE_02) && @@ -148,29 +145,29 @@ void sub_0806DB84(Entity* this, ScriptExecutionContext* context) { } } -u32 sub_0806DBF4(u32 param_1) { - switch (param_1) { - case 1: - case 2: - case 3: - case 4: - case 6: - param_1 = ITEM_SMITH_SWORD; +Item NPC4E_GetItemWithSwordUpgraded(Item itemId) { + switch (itemId) { + case ITEM_SMITH_SWORD: + case ITEM_GREEN_SWORD: + case ITEM_RED_SWORD: + case ITEM_BLUE_SWORD: + case ITEM_FOURSWORD: + itemId = ITEM_SMITH_SWORD; if (GetInventoryValue(ITEM_GREEN_SWORD) != 0) { - param_1 = ITEM_GREEN_SWORD; + itemId = ITEM_GREEN_SWORD; } if (GetInventoryValue(ITEM_RED_SWORD) != 0) { - param_1 = ITEM_RED_SWORD; + itemId = ITEM_RED_SWORD; } if (GetInventoryValue(ITEM_BLUE_SWORD) != 0) { - param_1 = ITEM_BLUE_SWORD; + itemId = ITEM_BLUE_SWORD; } if (GetInventoryValue(ITEM_FOURSWORD) != 0) { - param_1 = ITEM_FOURSWORD; + itemId = ITEM_FOURSWORD; } break; } - return param_1; + return itemId; } void NPC4E_SaveEquippedItems(Entity* this) { @@ -179,8 +176,8 @@ void NPC4E_SaveEquippedItems(Entity* this) { } void NPC4E_RestoreEquippedItems(Entity* this) { - ForceEquipItem(sub_0806DBF4(this->field_0x68.HALF.LO), EQUIP_SLOT_A); - ForceEquipItem(sub_0806DBF4(this->field_0x68.HALF.HI), EQUIP_SLOT_B); + ForceEquipItem(NPC4E_GetItemWithSwordUpgraded(this->field_0x68.HALF.LO), EQUIP_SLOT_A); + ForceEquipItem(NPC4E_GetItemWithSwordUpgraded(this->field_0x68.HALF.HI), EQUIP_SLOT_B); } void sub_0806DC7C(void) { @@ -234,13 +231,12 @@ void NPC4E_Fusion(Entity* this) { const Hitbox gUnk_08114154 = { 0, -8, 0, 0, 0, 0, 24, 8 }; -const u8 gUnk_0811415C[] = { // - 0x00, 0x00, 0x08, 0x08, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x0e, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x04, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x04, 0x0e, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x10, 0x04, 0x0e, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x08, 0x0e, 0x00, 0x00, 0x00, +const InteractCollisionData gNpc4ECollisionData[] = { // + { 0, 0, 8, 8, 0x0E, 0, 0, 0 }, { 0, 0, 26, 8, 0x0E, 0, 0, 0 }, { 0, 0, 16, 4, 0x0E, 0, 0, 0 }, + { 0, 0, 10, 10, 0x00, 0, 0, 0 }, { 0, 0, 10, 10, 0x00, 0, 0, 0 }, { 0, 0, 6, 4, 0x0E, 0, 0, 0 }, + { 0, 8, 16, 4, 0x0E, 0, 0, 0 }, { 0, -8, 24, 8, 0x0E, 0, 0, 0 }, #ifndef EU - 0x00, 0x00, 0x58, 0x08, 0x0e, 0x00, 0x00, 0x00 + { 0, 0, 88, 8, 0x0E, 0, 0, 0 } #endif }; diff --git a/src/npc/npc5.c b/src/npc/npc5.c index 2a78cc26..f8e6707e 100644 --- a/src/npc/npc5.c +++ b/src/npc/npc5.c @@ -875,7 +875,7 @@ void sub_08061ACC(Entity* this) { this->subAction = 0xff; this->timer = 0; this->followerFlag = this->followerFlag & 0xfe; - sub_08078778(this); + AddInteractableWhenBigObject(this); sub_08061AFC(this); } diff --git a/src/npc/npc9.c b/src/npc/npc9.c index 76a69b93..a8361648 100644 --- a/src/npc/npc9.c +++ b/src/npc/npc9.c @@ -22,7 +22,7 @@ void sub_08062AF0(Entity* this) { this->action = 1; this->spriteSettings.draw = TRUE; InitializeAnimation(this, 0); - sub_08078778(this); + AddInteractableWhenBigObject(this); } void sub_08062B14(Entity* this) { diff --git a/src/npc/percy.c b/src/npc/percy.c index 22753a85..21a205f4 100644 --- a/src/npc/percy.c +++ b/src/npc/percy.c @@ -41,7 +41,7 @@ void sub_0806B3CC(Entity* this) { } this->action = 1; InitializeAnimation(this, 0); - sub_08078778(this); + AddInteractableWhenBigObject(this); } GetNextFrame(this); if (this->interactType != 0) { @@ -161,9 +161,9 @@ void sub_0806B540(Entity* this) { gActiveScriptInfo.commandSize = 0; } -void sub_0806B60C(Entity* this) { +void Percy_MakeInteractable(Entity* this) { this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); } void Percy_Fusion(Entity* this) { diff --git a/src/npc/picolyteBottle.c b/src/npc/picolyteBottle.c index be49c2f3..80ebfc0a 100644 --- a/src/npc/picolyteBottle.c +++ b/src/npc/picolyteBottle.c @@ -26,7 +26,7 @@ void PicolyteBottle_Action1(PicolyteBottleEntity* this); void PicolyteBottle_Action2(PicolyteBottleEntity* this); void nullsub_111(PicolyteBottleEntity* this); -extern void sub_08078828(Entity*); +extern void AddInteractableChest(Entity*); void PicolyteBottle(Entity* this) { static void (*const PicolyteBottle_Actions[])(PicolyteBottleEntity*) = { @@ -97,7 +97,7 @@ void PicolyteBottle_Action2(PicolyteBottleEntity* this) { super->child = obj; CopyPosition(super, obj); } - sub_080788E0(super); + RemoveInteractableObject(super); sub_0807B7D8(0x74, this->unk76, 2); } } @@ -149,7 +149,7 @@ void sub_0806E0DC(PicolyteBottleEntity* this) { DeleteEntity(super->child); super->child = NULL; } - sub_08078828(super); + AddInteractableChest(super); sub_0807B7D8(0x73, this->unk76, 2); } else { super->action = 3; diff --git a/src/npc/pina.c b/src/npc/pina.c index 00d73a13..f11cbdd9 100644 --- a/src/npc/pina.c +++ b/src/npc/pina.c @@ -32,7 +32,7 @@ void sub_08063A98(Entity* this) { this->action++; this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 4); - sub_08078778(this); + AddInteractableWhenBigObject(this); } void sub_08063AC0(Entity* this) { @@ -150,9 +150,9 @@ void sub_08063C90(Entity* this) { ShowNPCDialogue(this, &gUnk_0810CE04[gSave.global_progress]); } -void sub_08063CAC(Entity* this) { +void Pina_MakeInteractable(Entity* this) { this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); } void Pina_Fusion(Entity* this) { diff --git a/src/npc/postman.c b/src/npc/postman.c index 06fa095c..9e7ce529 100644 --- a/src/npc/postman.c +++ b/src/npc/postman.c @@ -8,7 +8,7 @@ extern void sub_08060528(Entity*); extern void sub_080604DC(Entity*); extern void sub_080606D8(Entity*); -extern void sub_080606C0(Entity*); +extern void Postman_MakeInteractable(Entity*); const Coords gUnk_0810A66C[] = { { .HALF = { 0x0, 0x0 } }, { .HALF = { 0x48, 0xa8 } }, { .HALF = { 0x0, 0xf0 } }, @@ -274,7 +274,7 @@ void sub_08060528(Entity* this) { this->field_0x6a.HWORD = 0; this->zVelocity = Q_16_16(2.0); this->field_0x6c.HALF.HI = 1; - sub_080788E0(this); + RemoveInteractableObject(this); EnqueueSFX(SFX_PLY_JUMP); } else { this->field_0x6a.HWORD--; @@ -283,7 +283,7 @@ void sub_08060528(Entity* this) { GravityUpdate(this, Q_8_8(24.0)); if (((this->field_0x6c.HALF.HI != 0) && (this->zVelocity == 0)) && this->z.WORD == 0) { this->field_0x6c.HALF.HI = 0; - sub_080606C0(this); + Postman_MakeInteractable(this); } if (this->z.WORD >= 0 && ((gPlayerEntity.collisionLayer == 0 || (this->collisionLayer == gPlayerEntity.collisionLayer)))) { @@ -292,9 +292,9 @@ void sub_08060528(Entity* this) { sub_0800451C(this); } -void sub_080606C0(Entity* this) { +void Postman_MakeInteractable(Entity* this) { this->field_0x6c.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x6c.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x6c.HALF.LO); } void sub_080606D8(Entity* this) { @@ -336,7 +336,7 @@ void sub_0806076C(Entity* this, ScriptExecutionContext* context) { } this->field_0x68.HALF.HI++; this->collisionLayer = 1; - sub_080606C0(this); + Postman_MakeInteractable(this); pbVar10 = gUnk_0810A918[(s8)this->field_0x68.HALF.LO]; pbVar10 += (s8)this->field_0x68.HALF.HI; do { diff --git a/src/npc/rem.c b/src/npc/rem.c index c8834192..01db2ab1 100644 --- a/src/npc/rem.c +++ b/src/npc/rem.c @@ -328,10 +328,10 @@ void sub_0806A914(Entity* this) { } } -void sub_0806A93C(Entity* this) { - static const u8 gUnk_0811229C[] = { 0, 6, 10, 16 }; - sub_08078778(this); - sub_08078850(this, 0, 0, &gUnk_0811229C); +void Rem_MakeInteractable(Entity* this) { + static const Rect gUnk_0811229C = { 0, 6, 10, 16 }; + AddInteractableWhenBigObject(this); + SetInteractableObjectCollision(this, 0, 0, &gUnk_0811229C); } void sub_0806A958(Entity* this) { diff --git a/src/npc/sittingPerson.c b/src/npc/sittingPerson.c index b7f7af0c..c5f63d07 100644 --- a/src/npc/sittingPerson.c +++ b/src/npc/sittingPerson.c @@ -235,9 +235,9 @@ void SittingPerson_Head(Entity* this) { sub_0807000C(this); } -void sub_080639D0(Entity* this) { +void SittingPerson_MakeInteractable(Entity* this) { this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); } void SittingPerson_Fusion(Entity* this) { diff --git a/src/npc/smallTownMinish.c b/src/npc/smallTownMinish.c index 96e4d1b4..5bbe8040 100644 --- a/src/npc/smallTownMinish.c +++ b/src/npc/smallTownMinish.c @@ -9,12 +9,12 @@ void SmallTownMinish(Entity* this) { static const Hitbox gUnk_081142FC = { -2, 1, { 0, 0, 0, 0 }, 6, 6 }; - static const u8 gUnk_08114304[] = { -2, 1, 6, 6 }; + static const Rect gUnk_08114304 = { -2, 1, 6, 6 }; if (this->action == 0) { this->action++; this->hitbox = (Hitbox*)&gUnk_081142FC; sub_0807DD50(this); - sub_08078850(this, 1, 0, gUnk_08114304); + SetInteractableObjectCollision(this, 1, 0, &gUnk_08114304); } else { sub_0807DD94(this, NULL); } diff --git a/src/npc/smith.c b/src/npc/smith.c index 08013aa7..bc5df016 100644 --- a/src/npc/smith.c +++ b/src/npc/smith.c @@ -205,18 +205,13 @@ void sub_08066258(void) { SoundReq(hammerSounds[Random() & 7]); } -void sub_08066274(Entity* this) { - static const u8 gUnk_081103E0[] = { - 0, - 6, - 8, - 12, - }; - sub_08078850(this, 1, 0, &gUnk_081103E0); +void Smith_ChangeInteractableHitbox(Entity* this) { + static const Rect gUnk_081103E0 = { 0, 6, 8, 12 }; + SetInteractableObjectCollision(this, 1, 0, &gUnk_081103E0); } -void sub_08066288(Entity* this) { - sub_08078784(this, this->field_0x68.HALF.LO); +void Smith_MakeInteractable(Entity* this) { + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); } void Smith_Fusion(Entity* this) { diff --git a/src/npc/stamp.c b/src/npc/stamp.c index 3c932d97..0ac805ec 100644 --- a/src/npc/stamp.c +++ b/src/npc/stamp.c @@ -35,7 +35,7 @@ void sub_08062BD4(Entity* ent) { ent->action = 1; ent->spriteSettings.draw = 1; InitializeAnimation(ent, 0); - sub_08078778(ent); + AddInteractableWhenBigObject(ent); } void sub_08062BF8(Entity* ent) { diff --git a/src/npc/stockwell.c b/src/npc/stockwell.c index d7187ee3..7230bd7a 100644 --- a/src/npc/stockwell.c +++ b/src/npc/stockwell.c @@ -9,7 +9,7 @@ #include "game.h" #ifndef EU -static const u8 gUnk_0810FDA0[] = { 0, 8, 10, 16 }; +static const Rect gUnk_0810FDA0 = { 0, 8, 10, 16 }; #endif extern u16 script_StockwellBuy[]; @@ -48,9 +48,9 @@ void sub_08065080(Entity* this) { this->spriteSettings.draw = 1; SetDefaultPriority(this, PRIO_MESSAGE); InitializeAnimation(this, 4); - sub_08078778(this); + AddInteractableWhenBigObject(this); #ifndef EU - sub_08078850(this, 0, 0, &gUnk_0810FDA0); + SetInteractableObjectCollision(this, 0, 0, &gUnk_0810FDA0); #endif context = StartCutscene(this, &script_Stockwell); *(ScriptExecutionContext**)&this->cutsceneBeh = context; diff --git a/src/npc/sturgeon.c b/src/npc/sturgeon.c index d4902142..05416de9 100644 --- a/src/npc/sturgeon.c +++ b/src/npc/sturgeon.c @@ -28,7 +28,7 @@ extern const u16 gUnk_0810FA54[]; // }; extern u32 gUnk_0810FA5A; // TODO second parameter of sub_0806EE04 -void sub_08064CC0(Entity* this); +void Sturgeon_MakeInteractable(Entity* this); void sub_08064C9C(Entity* this); void sub_08064CD8(Entity* this); @@ -68,7 +68,7 @@ void sub_08064B44(Entity* this) { if (LoadExtraSpriteData(this, gUnk_0810FA38)) { InitializeAnimation(this, 2); sub_0806EE04(this, &gUnk_0810FA5A, 0); - sub_08064CC0(this); + Sturgeon_MakeInteractable(this); this->action = 1; this->subAction = 0; this->spriteSettings.draw = 1; @@ -140,9 +140,9 @@ void sub_08064C9C(Entity* this) { } } -void sub_08064CC0(Entity* this) { +void Sturgeon_MakeInteractable(Entity* this) { this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); } void sub_08064CD8(Entity* this) { diff --git a/src/npc/talon.c b/src/npc/talon.c index b2d99ca8..dc86ba85 100644 --- a/src/npc/talon.c +++ b/src/npc/talon.c @@ -37,7 +37,7 @@ void Talon(Entity* this) { void sub_08065570(Entity* this) { if (LoadExtraSpriteData(this, gUnk_0810FEB0)) { InitializeAnimation(this, 0); - sub_08078778(this); + AddInteractableWhenBigObject(this); this->action = 1; this->subtimer = 1; this->animationState = 2; @@ -79,7 +79,7 @@ void sub_08065608(Entity* this) { this->action = 1; this->spriteSettings.draw = 1; this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); sub_0807DD50(this); } } diff --git a/src/npc/teachers.c b/src/npc/teachers.c index 763bf448..05e0d3f6 100644 --- a/src/npc/teachers.c +++ b/src/npc/teachers.c @@ -42,9 +42,9 @@ void Teachers(Entity* this) { } } -void sub_0806C674(Entity* this) { +void Teachers_MakeInteractable(Entity* this) { this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); } void Teachers_Head(Entity* this) { diff --git a/src/npc/tingleSiblings.c b/src/npc/tingleSiblings.c index cb22cf1d..1d5cfabf 100644 --- a/src/npc/tingleSiblings.c +++ b/src/npc/tingleSiblings.c @@ -83,7 +83,7 @@ void sub_08064DE4(Entity* this) { } } -void sub_08064EA4(Entity* this) { +void TingleSiblings_MakeInteractable(Entity* this) { this->field_0x68.HALF.LO = GetFusionToOffer(this); switch (this->type) { case 0: @@ -99,7 +99,7 @@ void sub_08064EA4(Entity* this) { default: break; } - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); } void sub_08064EE8(Entity* this) { diff --git a/src/npc/townMinish.c b/src/npc/townMinish.c index 69f729d7..a8cb574b 100644 --- a/src/npc/townMinish.c +++ b/src/npc/townMinish.c @@ -129,13 +129,13 @@ static const SpriteLoadData gUnk_08112674[][4] = { { 0x0, 0x0, 0x0 }, }, }; -static const u8 gUnk_081126D4[][4] = { - { 0x0, 0x8, 0x8, 0x10 }, - { 0xf8, 0xfe, 0x10, 0x8 }, - { 0x0, 0x8, 0x8, 0x10 }, - { 0x8, 0xfe, 0x10, 0x8 }, +static const Rect gUnk_081126D4[4] = { + { 0, 8, 8, 16 }, + { -8, -2, 16, 8 }, + { 0, 8, 8, 16 }, + { 8, -2, 16, 8 }, }; -static const u8 gUnk_081126E4[4] = { 14, 13, 11, 7 }; +static const u8 gUnk_081126E4[4] = { 0x0e, 0x0d, 0x0b, 0x07 }; void TownMinish(Entity* this) { static void (*const scriptedActionFuncs[])(Entity*) = { @@ -228,7 +228,7 @@ void sub_0806ACC4(Entity* this) { } if (this->type == 1) { u8 idx = gPlayerEntity.animationState >> 1; - sub_08078850(this, 1, gUnk_081126E4[idx], gUnk_081126D4[idx]); + SetInteractableObjectCollision(this, 1, gUnk_081126E4[idx], &gUnk_081126D4[idx]); } } break; @@ -250,8 +250,8 @@ void sub_0806ACC4(Entity* this) { } } -void sub_0806ADFC(Entity* this) { - sub_08078784(this, this->field_0x68.HALF.LO); +void TownMinish_MakeInteractable(Entity* this) { + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); } void TownMinish_Head(Entity* this) { diff --git a/src/npc/townsperson.c b/src/npc/townsperson.c index 862e00f5..adb973cb 100644 --- a/src/npc/townsperson.c +++ b/src/npc/townsperson.c @@ -15,8 +15,8 @@ extern void sub_08062048(Entity*); extern struct_0810B680 gUnk_0810B680[]; extern SpriteLoadData* gUnk_0810B6EC[]; -extern u32 gUnk_0810B740[]; // TODO fourth parameter of sub_08078850 -extern u8 gUnk_0810B748[]; // TODO third parameter of sub_08078850 +extern u32 gUnk_0810B740[]; // TODO fourth parameter of SetInteractableObjectCollision +extern u8 gUnk_0810B748[]; // TODO third parameter of SetInteractableObjectCollision extern u16 gUnk_0810B74A[]; extern void (*const gUnk_0810B774[])(Entity*); extern void (*const gUnk_0810B77C[])(Entity*); @@ -150,11 +150,11 @@ void sub_08061E50(Entity* this) { } } -void sub_08061E70(Entity* this) { +void Townsperson_MakeInteractable(Entity* this) { if (this->id == 6) { - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); } else { - sub_08078778(this); + AddInteractableWhenBigObject(this); } } @@ -236,7 +236,7 @@ void sub_08061FB0(Entity* this) { void sub_08061FB8(Entity* this, ScriptExecutionContext* context) { u8* temp = gUnk_0810B748; - sub_08078850(this, 1, temp[context->intVariable], &gUnk_0810B740[context->intVariable]); + SetInteractableObjectCollision(this, 1, temp[context->intVariable], &gUnk_0810B740[context->intVariable]); } void sub_08061FD8(Entity* this) { diff --git a/src/npc/windTribespeople.c b/src/npc/windTribespeople.c index d60e0b37..aa4f9b31 100644 --- a/src/npc/windTribespeople.c +++ b/src/npc/windTribespeople.c @@ -78,12 +78,12 @@ void sub_0806C85C(Entity* this) { } } -void sub_0806C870(Entity* this) { +void WindTribespeople_MakeInteractable(Entity* this) { u8 bVar1; bVar1 = GetFusionToOffer(this); this->field_0x68.HALF.LO = bVar1; - sub_08078784(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); } void WindTribespeople_Head(Entity* this) { diff --git a/src/npc/zeldaFollower.c b/src/npc/zeldaFollower.c index 24d9c30c..2402823d 100644 --- a/src/npc/zeldaFollower.c +++ b/src/npc/zeldaFollower.c @@ -1,7 +1,6 @@ -#include "global.h" +#include "common.h" #include "entity.h" #include "functions.h" -#include "common.h" extern s32 sub_080041E8(s32 x1, s32 y1, s32 x2, s32 y2); @@ -19,20 +18,19 @@ typedef union { #define ZELDA_FOLLOWER_HEAP_LEN 20 -#define ZELDA_FOLLOWER_HEAP ((ZeldaFollowerItem *)this->myHeap) -#define ZELDA_FOLLOWER_HEAP_END ((ZeldaFollowerItem *)this->myHeap + (ZELDA_FOLLOWER_HEAP_LEN - 1)) - -#define ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(this, heapPtr) \ - do { \ - int i; \ - heapPtr = ((ZeldaFollowerItem*)this->myHeap); \ - heapPtr += (ZELDA_FOLLOWER_HEAP_LEN - 2); \ - for ( i = 0; i < (ZELDA_FOLLOWER_HEAP_LEN - 1); i++) { \ - heapPtr[1] = heapPtr[0]; \ - heapPtr--; \ - } \ - } while (0) +#define ZELDA_FOLLOWER_HEAP ((ZeldaFollowerItem*)this->myHeap) +#define ZELDA_FOLLOWER_HEAP_END ((ZeldaFollowerItem*)this->myHeap + (ZELDA_FOLLOWER_HEAP_LEN - 1)) +#define ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(this, heapPtr) \ + do { \ + int i; \ + heapPtr = ((ZeldaFollowerItem*)this->myHeap); \ + heapPtr += (ZELDA_FOLLOWER_HEAP_LEN - 2); \ + for (i = 0; i < (ZELDA_FOLLOWER_HEAP_LEN - 1); i++) { \ + heapPtr[1] = heapPtr[0]; \ + heapPtr--; \ + } \ + } while (0) void sub_08068318(Entity*); void sub_0806854C(Entity*, u32*); @@ -66,16 +64,16 @@ void sub_08068318(Entity* this) { ZeldaFollowerItem* heapPtr; ZeldaFollowerItem item; - item.FIELDS.x = gPlayerEntity.x.HALF_U.HI; - item.FIELDS.y = gPlayerEntity.y.HALF_U.HI; - item.FIELDS.z = gPlayerEntity.z.HALF_U.HI; - item.FIELDS.framestate = gPlayerState.framestate; + item.FIELDS.x = gPlayerEntity.x.HALF_U.HI; + item.FIELDS.y = gPlayerEntity.y.HALF_U.HI; + item.FIELDS.z = gPlayerEntity.z.HALF_U.HI; + item.FIELDS.framestate = gPlayerState.framestate; item.FIELDS.animationState = gPlayerEntity.animationState; item.FIELDS.collisionLayer = gPlayerEntity.collisionLayer; heapPtr = this->myHeap; - if ( (heapPtr->FIELDS.framestate == 0xa && item.FIELDS.framestate != 0xa) || + if ((heapPtr->FIELDS.framestate == 0xa && item.FIELDS.framestate != 0xa) || (heapPtr->FIELDS.framestate == 0x16 && item.FIELDS.framestate != 0x16)) { this->x.HALF.HI = gPlayerEntity.x.HALF.HI; this->y.HALF.HI = gPlayerEntity.y.HALF.HI; @@ -84,7 +82,7 @@ void sub_08068318(Entity* this) { } animIndex = 0; - if (item.DWORD != heapPtr->DWORD || item.FIELDS.framestate == 0x16 || item.FIELDS.framestate == 0xa ) { + if (item.DWORD != heapPtr->DWORD || item.FIELDS.framestate == 0x16 || item.FIELDS.framestate == 0xa) { ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(this, heapPtr); heapPtr = ZELDA_FOLLOWER_HEAP; heapPtr[0] = item; @@ -101,12 +99,8 @@ void sub_08068318(Entity* this) { ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(this, heapPtr); animIndex = 0x4; } else { - dist = sub_080041E8( - gPlayerEntity.x.HALF.HI, - gPlayerEntity.y.HALF.HI, - (u16) heapPtr->FIELDS.x, - (u16) heapPtr->FIELDS.y - ); + dist = sub_080041E8(gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, (u16)heapPtr->FIELDS.x, + (u16)heapPtr->FIELDS.y); dist = ((u32)dist) >> 0x4; if (dist > 0x18) { ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(this, heapPtr); @@ -117,9 +111,9 @@ void sub_08068318(Entity* this) { heapPtr = ZELDA_FOLLOWER_HEAP; heapPtr += ZELDA_FOLLOWER_HEAP_LEN - 1; - this->x.HALF.HI = heapPtr->FIELDS.x; - this->y.HALF.HI = heapPtr->FIELDS.y; - this->z.HALF.HI = heapPtr->FIELDS.z; + this->x.HALF.HI = heapPtr->FIELDS.x; + this->y.HALF.HI = heapPtr->FIELDS.y; + this->z.HALF.HI = heapPtr->FIELDS.z; this->animationState = heapPtr->FIELDS.animationState; this->collisionLayer = heapPtr->FIELDS.collisionLayer; @@ -151,7 +145,7 @@ void sub_0806854C(Entity* this, u32* none) { this->myHeap = zMalloc(sizeof(ZeldaFollowerItem[ZELDA_FOLLOWER_HEAP_LEN])); if (this->myHeap != NULL) { this->field_0x68.HALF.LO = 1; - sub_080788E0(this); + RemoveInteractableObject(this); this->hitbox = NULL; sub_08068578(this); } diff --git a/src/npcUtils.c b/src/npcUtils.c index cea167ae..8702f3eb 100644 --- a/src/npcUtils.c +++ b/src/npcUtils.c @@ -352,10 +352,10 @@ u32 UpdateFuseInteraction(Entity* ent) { return ret; } -void sub_0806F188(Entity* ent) { +void MarkFuserDone(Entity* ent) { u32 idx = GetFuserId(ent); if (idx != 0) - gSave.fuserOffers[idx] = 0xF3; + gSave.fuserOffers[idx] = KINSTONE_FUSER_DONE; } void ShowNPCDialogue(Entity* ent, const Dialog* dia) { diff --git a/src/object/bossDoor.c b/src/object/bossDoor.c index 4f9a5220..c1b3bcff 100644 --- a/src/object/bossDoor.c +++ b/src/object/bossDoor.c @@ -27,7 +27,7 @@ typedef struct { } BossDoorEntity; extern bool32 gUnk_02036BB8; -extern const u8 gUnk_0811F740[]; +extern const u8 gLockedDoorInteractDirections[]; void sub_0808C500(BossDoorEntity*); void sub_0808C4BC(BossDoorEntity*); @@ -69,8 +69,8 @@ void BossDoor_Init(BossDoorEntity* this) { super->action = 1; super->spriteSettings.draw = 1; sub_0808C500(this); - sub_08078800(super); - sub_08078850(super, 0, gUnk_0811F740[this->unk_76], 0); + AddInteractableBossDoor(super); + SetInteractableObjectCollision(super, 0, gLockedDoorInteractDirections[this->unk_76], NULL); break; case 1: super->action = 4; @@ -87,7 +87,7 @@ void BossDoor_Init(BossDoorEntity* this) { void BossDoor_Action1(BossDoorEntity* this) { if (super->interactType != 0) { super->action = 2; - sub_080788E0(super); + RemoveInteractableObject(super); SetFlag(this->unk_86); } } diff --git a/src/object/cameraTarget.c b/src/object/cameraTarget.c index 86321cbb..57a5623a 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 (gPossibleInteraction.currentObject->kinstoneId == KINSTONE_32) { + if (CheckKinstoneFused(KINSTONE_32) == 0) { + uVar2 = 0; + break; + } + } + uVar2 = 1; break; } @@ -102,9 +103,10 @@ 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); - this->interactType = gUnk_03003DF0.unk_3; + if ((gPossibleInteraction.currentObject->entity != NULL) && + ((u8)(gPossibleInteraction.currentObject->kinstoneId - 1) < 100)) { + this->child = gPossibleInteraction.currentObject->entity; + this->interactType = gPossibleInteraction.currentIndex; sub_08083A40(this); } } @@ -118,8 +120,8 @@ void CameraTarget_Action2(Entity* this) { u32 temp2; const KinstoneWorldEvent* ptr; - if ((this->type != 1) && - (((u8)(gUnk_03003DF0.unk_4[3] - 1) >= 100 || (this->child != *(Entity**)(gUnk_03003DF0.unk_4 + 8))))) { + if ((this->type != 1) && (((u8)(gPossibleInteraction.currentObject->kinstoneId - 1) >= 100 || + (this->child != gPossibleInteraction.currentObject->entity)))) { sub_080838DC(this); } else { this->x = this->child->x; @@ -128,7 +130,7 @@ void CameraTarget_Action2(Entity* this) { if (this->frame == 1) { this->frame = 0; if (this->type == 0) { - bVar2 = gUnk_03003DF0.unk_4[3]; + bVar2 = gPossibleInteraction.currentObject->kinstoneId; } else { bVar2 = this->type2; } diff --git a/src/object/chestSpawner.c b/src/object/chestSpawner.c index dfe03a92..8a721a58 100644 --- a/src/object/chestSpawner.c +++ b/src/object/chestSpawner.c @@ -26,7 +26,7 @@ extern const Hitbox gUnk_0811F8A8; extern const Hitbox gUnk_0811F8B0; void sub_080842D8(ChestSpawnerEntity*); -void sub_08078828(ChestSpawnerEntity*); +void AddInteractableChest(ChestSpawnerEntity*); void sub_08083E20(ChestSpawnerEntity*); void sub_08084074(u32); void sub_080840A8(s32, s32); @@ -76,7 +76,7 @@ void sub_08083E20(ChestSpawnerEntity* this) { super->spriteSettings.draw = 1; super->spriteRendering.alphaBlend = 0; sub_080842D8(this); - sub_08078828(this); + AddInteractableChest(this); } void ChestSpawner_Type2Init(ChestSpawnerEntity* this) { super->hitbox = (Hitbox*)&gUnk_0811F8B0; @@ -153,7 +153,7 @@ void ChestSpawner_Type2Action3(ChestSpawnerEntity* this) { if (super->interactType != 0) { super->action = 4; super->subtimer = 30; - sub_080788E0(super); + RemoveInteractableObject(super); RequestPriorityDuration(super, 60); SoundReq(SFX_CHEST_OPEN); } diff --git a/src/object/crenelBeanSprout.c b/src/object/crenelBeanSprout.c index a0fb206d..ecd20008 100644 --- a/src/object/crenelBeanSprout.c +++ b/src/object/crenelBeanSprout.c @@ -172,9 +172,9 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) { this->unk_70 = ((super->x.HALF.HI + (s8)gUnk_08123184[tmp]) & -0x10) | 8; this->unk_72 = ((super->y.HALF.HI + (s8)gUnk_08123184[(tmp) + 1]) & -0x10) | 8; if (sub_080B1AB4(this->unk_70, this->unk_72, super->collisionLayer) == 0x19) { - gUnk_0200AF00.unk_2f = 3; + gUnk_0200AF00.rActionPlayerState = R_ACTION_THROW; } else { - gUnk_0200AF00.unk_2f = 0; + gUnk_0200AF00.rActionPlayerState = R_ACTION_NONE; } PositionRelative(&gPlayerEntity, super, 0, 0x10000); if (GetTileUnderEntity(super) == 0x19) { @@ -184,7 +184,7 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) { if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_40)) == 0) { return; } - if (gUnk_0200AF00.unk_2f != 3) { + if (gUnk_0200AF00.rActionPlayerState != R_ACTION_THROW) { return; } gPlayerState.heldObject = 0; diff --git a/src/object/cutsceneMiscObject.c b/src/object/cutsceneMiscObject.c index 75911fe8..54423cc0 100644 --- a/src/object/cutsceneMiscObject.c +++ b/src/object/cutsceneMiscObject.c @@ -22,7 +22,7 @@ extern u16 gUnk_08122B1E[]; extern Coords8 gUnk_08122B2E[]; // TODO struct xy typedef struct { Hitbox hit; - u8 _8[4]; // TODO fourth param of sub_08078850 + u8 _8[4]; // TODO fourth param of SetInteractableObjectCollision u8 _c; } HitboxCfg; extern HitboxCfg gUnk_08122B3C[]; @@ -395,13 +395,13 @@ void sub_08094FA8(CutsceneMiscObjectEntity* this) { super->action = 1; super->frameIndex = 0; super->spritePriority.b0 = 7; - sub_080787B4(super); + AddInteractableCheckableObject(super); break; case 1: if (super->interactType != 0) { super->interactType = 0; super->action = 2; - sub_080788E0(super); + RemoveInteractableObject(super); gPlayerState.queued_action = PLAYER_EMPTYBOTTLE; gPlayerState.field_0x38 = 54; #ifndef EU @@ -449,13 +449,13 @@ void sub_08095088(CutsceneMiscObjectEntity* this) { DeleteThisEntity(); super->action = 1; super->spritePriority.b0 = 7; - sub_080787B4(super); + AddInteractableCheckableObject(super); break; case 1: if (super->interactType != 0) { super->interactType = 0; super->action = 2; - sub_080788E0(super); + RemoveInteractableObject(super); CreateEzloHint(TEXT_INDEX(TEXT_BELARI, 0x1F), 0); } break; @@ -1322,6 +1322,6 @@ void sub_080962E8(CutsceneMiscObjectEntity* this) { void sub_080962F8(CutsceneMiscObjectEntity* this, ScriptExecutionContext* ctx) { HitboxCfg* cfg = &gUnk_08122B3C[ctx->intVariable]; - sub_08078850(super, 1, cfg->_c, cfg->_8); + SetInteractableObjectCollision(super, 1, cfg->_c, cfg->_8); super->hitbox = &cfg->hit; } diff --git a/src/object/figurineDevice.c b/src/object/figurineDevice.c index d52ac049..bf406be3 100644 --- a/src/object/figurineDevice.c +++ b/src/object/figurineDevice.c @@ -79,7 +79,7 @@ void FigurineDevice_Init(FigurineDeviceEntity* this) { case 0: if (CheckLocalFlag(SHOP07_TANA)) { this->unk_7a = 1; - sub_080787B4(super); + AddInteractableCheckableObject(super); } else { this->unk_7a = 0; } @@ -123,7 +123,7 @@ void FigurineDevice_Action1(FigurineDeviceEntity* this) { switch (this->unk_7a) { case 0: this->unk_7a = 1; - sub_080787B4(super); + AddInteractableCheckableObject(super); break; case 1: if (super->interactType != 0) { @@ -142,7 +142,7 @@ void FigurineDevice_Action1(FigurineDeviceEntity* this) { default: if (CheckRoomFlag(2) == 0) { this->unk_7a = 1; - sub_080787B4(super); + AddInteractableCheckableObject(super); } break; } diff --git a/src/object/itemForSale.c b/src/object/itemForSale.c index e4629fa1..916f71d0 100644 --- a/src/object/itemForSale.c +++ b/src/object/itemForSale.c @@ -27,14 +27,14 @@ typedef struct { // not match. } ModifiedParentEntity; -extern u32 sub_080787D8(Entity*); +extern u32 AddInteractableShopItem(Entity*); extern void* sub_080784E4(void); void ItemForSale_Init(ItemForSaleEntity*); void ItemForSale_Action1(ItemForSaleEntity*); void ItemForSale_Action2(ItemForSaleEntity*); void ItemForSale_Action3(ItemForSaleEntity*); -void sub_08081A5C(ItemForSaleEntity*); +void ItemForSale_MakeInteractable(ItemForSaleEntity*); void sub_080819B4(ItemForSaleEntity*); void sub_08081AB0(void); @@ -71,7 +71,7 @@ void ItemForSale_Init(ItemForSaleEntity* this) { SetDefaultPriority(super, 6); #endif super->child = super; - sub_08081A5C(this); + ItemForSale_MakeInteractable(this); switch (super->timer) { case 0: super->hitbox = (Hitbox*)&gUnk_080FD328; @@ -85,7 +85,7 @@ void ItemForSale_Init(ItemForSaleEntity* this) { void ItemForSale_Action1(ItemForSaleEntity* this) { if (super->subAction != 0) { super->action = 2; - gUnk_0200AF00.unk_2f = 2; + gUnk_0200AF00.rActionPlayerState = 2; } else { if (super->type == 0x36) { if (super->interactType != 0) { @@ -102,7 +102,7 @@ void ItemForSale_Action1(ItemForSaleEntity* this) { ResetActiveItems(); gPlayerState.heldObject = 4; gNewPlayerEntity.unk_74 = super; - gUnk_0200AF00.unk_2f = 2; + gUnk_0200AF00.rActionPlayerState = R_ACTION_DROP; MessageClose(); } } @@ -112,15 +112,15 @@ void ItemForSale_Action1(ItemForSaleEntity* this) { void ItemForSale_Action2(ItemForSaleEntity* this) { void* ptr; - gUnk_0200AF00.unk_2f = 2; + gUnk_0200AF00.rActionPlayerState = R_ACTION_DROP; super->spriteSettings.draw = gPlayerEntity.spriteSettings.draw; if ((gPlayerState.heldObject == 0) || (super != gNewPlayerEntity.unk_74)) { sub_080819B4(this); } else { ptr = sub_080784E4(); - if (((*(int*)(ptr + 8) == 0) || - ((*(u8*)(ptr + 1) != 1 || (gUnk_0200AF00.unk_2f = 7, (gPlayerState.playerInput.newInput & - (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0)))) && + if (((*(int*)(ptr + 8) == 0) || ((*(u8*)(ptr + 1) != 1 || (gUnk_0200AF00.rActionPlayerState = R_ACTION_SPEAK, + (gPlayerState.playerInput.newInput & + (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0)))) && ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_10 | PLAYER_INPUT_8)) != 0)) { sub_080819B4(this); } @@ -142,8 +142,8 @@ void sub_080819B4(ItemForSaleEntity* this) { gNewPlayerEntity.unk_74 = 0; ptr = &gUnk_0200AF00; gRoomVars.shopItemType = 0; - ptr->unk_2c = 0; - ptr->unk_2f = 0; + ptr->rActionInteractObject = R_ACTION_NONE; + ptr->rActionPlayerState = R_ACTION_NONE; gRoomVars.shopItemType2 = 0; super->x.HALF.HI = this->unk_80 + gRoomControls.origin_x; super->y.HALF.HI = this->unk_82 + gRoomControls.origin_y; @@ -154,13 +154,13 @@ void sub_080819B4(ItemForSaleEntity* this) { super->collisionLayer = 1; super->spritePriority.b0 = 4; UpdateSpriteForCollisionLayer(super); - sub_08081A5C(this); + ItemForSale_MakeInteractable(this); } -void sub_08081A5C(ItemForSaleEntity* this) { - u32 tmp = sub_080787D8(super); +void ItemForSale_MakeInteractable(ItemForSaleEntity* this) { + u32 tmp = AddInteractableShopItem(super); if (super->timer == 1) { - gUnk_03003DF0.array[tmp].unk_2 = 0; + gPossibleInteraction.candidates[tmp].interactDirections = 0; } } diff --git a/src/object/lilypadLarge.c b/src/object/lilypadLarge.c index 88cf601a..84b11274 100644 --- a/src/object/lilypadLarge.c +++ b/src/object/lilypadLarge.c @@ -117,7 +117,7 @@ void sub_080855E8(LilypadLargeEntity* this) { super->flags |= 0x20; if (sub_0806FC80(super, &gPlayerEntity, 0x18) != 0) { - gPlayerState.flags |= 2; + gPlayerState.flags |= PL_FLAGS2; if (gPlayerEntity.z.WORD == 0) { if (gPlayerState.swim_state != 0) { gPlayerEntity.collisionFlags &= 0xfb; @@ -258,7 +258,7 @@ void sub_080855E8(LilypadLargeEntity* this) { this->unk_85 = 0; } - if ((gPlayerState.flags & 2) != 0) { + if ((gPlayerState.flags & PL_FLAGS2) != 0) { sub_08085F1C(this); } diff --git a/src/object/lockedDoor.c b/src/object/lockedDoor.c index 1b704f50..6cc6c1a6 100644 --- a/src/object/lockedDoor.c +++ b/src/object/lockedDoor.c @@ -81,7 +81,7 @@ const struct_0811F730 gUnk_0811F730[] = { { { 8, 8 }, { 8, -8 } }, }; -const u8 gUnk_0811F740[] = { +const u8 gLockedDoorInteractDirections[] = { 0xBE, 0x7D, 0xEB, @@ -133,8 +133,9 @@ void LockedDoor_Init(Entity* this) { this->action = 5; } else { this->action = 8; - sub_080787CC(this); - sub_08078850(this, 0, gUnk_0811F740[this->field_0x7c.BYTES.byte2], 0); + AddInteractableSmallKeyLock(this); + SetInteractableObjectCollision(this, 0, gLockedDoorInteractDirections[this->field_0x7c.BYTES.byte2], + NULL); } } else { DeleteThisEntity(); diff --git a/src/object/objectA.c b/src/object/objectA.c index f9db55e0..77622f1f 100644 --- a/src/object/objectA.c +++ b/src/object/objectA.c @@ -34,7 +34,7 @@ void ObjectA(Entity* this) { } DeleteThisEntity(); } else { - sub_080787CC(this); + AddInteractableSmallKeyLock(this); } } else if (this->interactType != 0) { SetTileType(*(u16*)&this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); diff --git a/src/object/pushableStatue.c b/src/object/pushableStatue.c index efca1ea6..b29ca269 100644 --- a/src/object/pushableStatue.c +++ b/src/object/pushableStatue.c @@ -132,7 +132,7 @@ void PushableStatue_SubAction0(PushableStatueEntity* this) { if (sub_080896B0()) { gPlayerState.queued_action = PLAYER_PULL; gPlayerState.field_0x38 = 0x20; - gPlayerState.flags |= 1; + gPlayerState.flags |= PL_BUSY; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; super->direction = (gPlayerEntity.animationState ^ 4) << 2; diff --git a/src/object/specialChest.c b/src/object/specialChest.c index 2d0264be..8d8fd2f1 100644 --- a/src/object/specialChest.c +++ b/src/object/specialChest.c @@ -9,7 +9,7 @@ #include "flags.h" #include "room.h" -extern void sub_08078828(Entity*); +extern void AddInteractableChest(Entity*); extern void OpenSmallChest(u32 pos, u32 layer); void SpecialChest(Entity* this) { @@ -19,7 +19,7 @@ void SpecialChest(Entity* this) { } this->action = 1; this->collisionLayer = 1; - sub_08078828(this); + AddInteractableChest(this); } if (this->interactType != 0) { OpenSmallChest(COORD_TO_TILE(this), 2); diff --git a/src/object/swordsmanNewsletter.c b/src/object/swordsmanNewsletter.c index f296de5a..15f8eef5 100644 --- a/src/object/swordsmanNewsletter.c +++ b/src/object/swordsmanNewsletter.c @@ -8,7 +8,7 @@ #include "global.h" #include "message.h" -extern void sub_080787B4(Entity*); +extern void AddInteractableCheckableObject(Entity*); void SwordsmanNewsletter_Init(Entity*); void SwordsmanNewsletter_Action1(Entity*); @@ -27,7 +27,7 @@ void SwordsmanNewsletter_Init(Entity* this) { this->frameIndex = this->type; UpdateSpriteForCollisionLayer(this); this->hitbox = (Hitbox*)&gUnk_081228A8; - sub_080787B4(this); + AddInteractableCheckableObject(this); } void SwordsmanNewsletter_Action1(Entity* this) { diff --git a/src/object/windcrest.c b/src/object/windcrest.c index 56bc6459..815a0f4a 100644 --- a/src/object/windcrest.c +++ b/src/object/windcrest.c @@ -22,9 +22,9 @@ void Windcrest(Entity* this) { HandleEntity0x82Actions(this); } -void sub_080A2124(Entity* this) { - static const u8 gUnk_08125010[] = { 0, 0, 12, 12 }; - sub_08078850(this, 1, 0xe, gUnk_08125010); +void Windcrest_ChangeInteractableHitbox(Entity* this) { + static const Rect gUnk_08125010 = { 0, 0, 12, 12 }; + SetInteractableObjectCollision(this, 1, 0xe, &gUnk_08125010); } void Windcrest_Unlock(Entity* this) { diff --git a/src/player.c b/src/player.c index d5f7a4e7..2d50b1f8 100644 --- a/src/player.c +++ b/src/player.c @@ -1830,7 +1830,7 @@ static void PlayerPull(Entity* this) { gPlayerState.framestate = PL_STATE_PULL; sPlayerPullStates[this->subAction](this); - gUnk_0200AF00.unk_2e = 8; + gUnk_0200AF00.rActionGrabbing = R_ACTION_GRAB; } static void sub_08072214(Entity* this) { @@ -2756,7 +2756,7 @@ static void sub_08073584(Entity* this) { return; } - gUnk_0200AF00.unk_2f = 1; + gUnk_0200AF00.rActionPlayerState = R_ACTION_CANCEL; if (sub_0807A2F8(0)) { this->subAction++; this->direction = 4 * (this->animationState & 6); diff --git a/src/playerItem/playerItemSword.c b/src/playerItem/playerItemSword.c index e1fbacb9..43471e77 100644 --- a/src/playerItem/playerItemSword.c +++ b/src/playerItem/playerItemSword.c @@ -182,7 +182,7 @@ void sub_080A76CC(PlayerItemSwordEntity* this) { } } else { - if ((gPlayerState.flags & 0x8000000) != 0) { + if ((gPlayerState.flags & PL_SWORD_THRUST) != 0) { if (this->unk_68 == 6) { super->hurtType = 0xc; } else { diff --git a/src/playerUtils.c b/src/playerUtils.c index 30d37295..3515748c 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -73,7 +73,7 @@ bool32 sub_0807BF88(u32, u32, RoomResInfo*); void sub_0807BFD0(void); void ForceSetPlayerState(u32 framestate); -struct_03003DF8* sub_080784E4(void); +InteractableObject* sub_080784E4(void); u32 sub_08079778(void); u32 GetPlayerTilePos(void); @@ -211,7 +211,7 @@ bool32 IsPreventedFromUsingItem(void) { } return FALSE; default: - if ((((gUnk_0200AF00.unk_2c == 0xc) && (gPlayerState.field_0x1c == 0)) && + if ((((gUnk_0200AF00.rActionInteractObject == R_ACTION_ROLL) && (gPlayerState.field_0x1c == 0)) && (gPlayerState.floor_type != SURFACE_SWAMP)) && ((((gPlayerState.playerInput.heldInput & PLAYER_INPUT_ANY_DIRECTION) != 0 && ((gPlayerState.flags & (PL_BURNING | PL_ROLLING)) == 0)) && @@ -658,14 +658,17 @@ 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 InteractableObject gNoInteraction = { + 0, INTERACTION_NULL, 0, 0, NULL, NULL, }; -const u8 gUnk_0811C00C[] = { - 0, 238, 14, 255, 0, 10, 241, 255, + +// for shifting the hitbox in which entities can be interacted with in Link's facing direction +// from left to right: north, east, south and west in x, y pairs +const s8 gPlayerInteractHitboxOffsetNormal[] = { + 0, -18, 14, -1, 0, 10, -15, -1, }; -const u8 gUnk_0811C014[] = { - 0, 242, 10, 255, 0, 6, 245, 255, +const s8 gPlayerInteractHitboxOffsetMinish[] = { + 0, -14, 10, -1, 0, 6, -11, -1, }; const u8 gUnk_0811C01C[] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 3, 3, 4, 3, 0, 1, 2, 0, 3, 3, 4, 3, 10, 15, 0, 0, 0, @@ -968,50 +971,49 @@ void ForceSetPlayerState(u32 framestate) { sub_08078B48(); } -void sub_08078180(void) { - u8 uVar1; - u8 uVar3; - struct_03003DF8* ptr; +void DetermineRButtonInteraction(void) { + u8 rAction; + InteractableObject* interaction; - if (gUnk_0200AF00.unk_2f != 0) + if (gUnk_0200AF00.rActionPlayerState != R_ACTION_NONE) return; - uVar1 = 0; + rAction = R_ACTION_NONE; if ((gPlayerState.jump_status == 0) && ((gPlayerState.flags & (PL_IN_HOLE | PL_FROZEN | PL_BURNING | PL_DISABLE_ITEMS | PL_DRUGGED)) == 0)) { if ((u8)(gPlayerState.heldObject - 1) < 4) { - if (gUnk_0200AF00.unk_2e != 0) { - uVar1 = gUnk_0200AF00.unk_2e; + if (gUnk_0200AF00.rActionGrabbing != R_ACTION_NONE) { + rAction = gUnk_0200AF00.rActionGrabbing; } else { - uVar1 = 3; + rAction = R_ACTION_THROW; } } else { - if (gUnk_0200AF00.unk_2d != 0) { - uVar1 = gUnk_0200AF00.unk_2d; + if (gUnk_0200AF00.rActionInteractTile != R_ACTION_NONE) { + rAction = gUnk_0200AF00.rActionInteractTile; } else { - ptr = sub_080784E4(); - if (ptr->entity->interactType == 0) { + interaction = sub_080784E4(); + if (interaction->entity->interactType == 0) { - switch (ptr->unk_1) { - case 1: - case 7: - uVar1 = 7; + switch (interaction->type) { + case INTERACTION_TALK: + case INTERACTION_TALK_MINISH: + rAction = R_ACTION_SPEAK; break; - case 8: + case INTERACTION_LIFT_SHOP_ITEM: if (gRoomVars.shopItemType == ITEM_NONE) { - uVar1 = 9; + rAction = R_ACTION_LIFT; } break; - case 3: - case 5: - case 6: - uVar1 = 6; + case INTERACTION_OPEN_CHEST: + case INTERACTION_USE_SMALL_KEY: + case INTERACTION_USE_BIG_KEY: + rAction = R_ACTION_OPEN; break; - case 9: - uVar1 = 5; + case INTERACTION_CHECK: + rAction = R_ACTION_CHECK; break; - case 10: - uVar1 = 2; + case INTERACTION_DROP_PEDESTAL: + rAction = R_ACTION_DROP; break; } } else { @@ -1019,25 +1021,25 @@ void sub_08078180(void) { if (((gPlayerState.framestate != PL_STATE_USEPORTAL))) { if ((gCarriedEntity.unk_1 == 2) && ((gCarriedEntity.unk_8)->carryFlags == 1)) { - uVar1 = 8; + rAction = R_ACTION_GRAB; } else { - uVar1 = 9; + rAction = R_ACTION_LIFT; } } else { return; } } else { if ((gPlayerState.framestate == PL_STATE_WALK) && (gPlayerState.mobility == 0)) { - uVar1 = 0xc; + rAction = R_ACTION_ROLL; } else { - uVar1 = 0; + rAction = R_ACTION_NONE; } } } } } } - gUnk_0200AF00.unk_2c = uVar1; + gUnk_0200AF00.rActionInteractObject = rAction; } bool32 sub_080782C0(void) { @@ -1088,11 +1090,12 @@ bool32 sub_080782C0(void) { return FALSE; } } - if (((gPlayerState.playerInput.newInput & PLAYER_INPUT_1000) != 0) && ((u8)(gUnk_03003DF0.unk_4[3] - 1) < 100)) { - AddKinstoneToBag(0); + if (((gPlayerState.playerInput.newInput & PLAYER_INPUT_1000) != 0) && + ((u8)(gPossibleInteraction.currentObject->kinstoneId - 1) < 100)) { + AddKinstoneToBag(KINSTONE_NONE); if (gSave.kinstoneAmounts[0] != 0) { - gUnk_03003DF0.unk_2 = gUnk_03003DF0.unk_4[3]; - *(u8*)(*(int*)(gUnk_03003DF0.unk_4 + 8) + 0x39) = 2; + gPossibleInteraction.kinstoneId = gPossibleInteraction.currentObject->kinstoneId; + gPossibleInteraction.currentObject->entity->interactType = 2; gPlayerState.queued_action = PLAYER_08070E9C; } else { CreateEzloHint(TEXT_INDEX(TEXT_EZLO, 0x65), 0); @@ -1103,23 +1106,23 @@ bool32 sub_080782C0(void) { if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0) { return FALSE; } - switch (gUnk_03003DF0.unk_4[1]) { + switch (gPossibleInteraction.currentObject->type) { default: - case 0: + case INTERACTION_NONE: return TRUE; - case 1: - case 6: - case 9: - case 0xa: + case INTERACTION_TALK: + case INTERACTION_USE_BIG_KEY: + case INTERACTION_CHECK: + case INTERACTION_DROP_PEDESTAL: gPlayerState.queued_action = PLAYER_08070E9C; ForceSetPlayerState(PL_STATE_TALKEZLO); - case 3: - case 5: - case 7: + case INTERACTION_OPEN_CHEST: + case INTERACTION_USE_SMALL_KEY: + case INTERACTION_TALK_MINISH: entity->interactType = 1; - gUnk_03003DF0.unk_2 = 0; + gPossibleInteraction.kinstoneId = KINSTONE_NONE; return TRUE; - case 8: + case INTERACTION_LIFT_SHOP_ITEM: if (gRoomVars.shopItemType == 0) { entity->interactType = 1; gRoomVars.shopItemType = entity->type; @@ -1131,99 +1134,102 @@ bool32 sub_080782C0(void) { return TRUE; } -void sub_080784C8(void) { - MemClear(&gUnk_03003DF0, sizeof(gUnk_03003DF0)); - gUnk_03003DF0.unk_4 = (u8*)gUnk_0811C000; +void ResetPossibleInteraction(void) { + MemClear(&gPossibleInteraction, sizeof(gPossibleInteraction)); + gPossibleInteraction.currentObject = (InteractableObject*)&gNoInteraction; } -ASM_FUNC("asm/non_matching/playerUtils/sub_080784E4.inc", struct_03003DF8* sub_080784E4(void)) +// determines which (if any) object the player is currently able to interact with +ASM_FUNC("asm/non_matching/playerUtils/sub_080784E4.inc", InteractableObject* sub_080784E4(void)) -void sub_08078778(Entity* ent) { - sub_0807887C(ent, 1, 0); +void AddInteractableWhenBigObject(Entity* ent) { + AddInteractableObject(ent, 1, 0); } -void sub_08078784(Entity* ent, u32 arg1) { - sub_0807887C(ent, 1, arg1); +void AddInteractableWhenBigFuser(Entity* ent, KinstoneId kinstoneId) { + AddInteractableObject(ent, 1, kinstoneId); } -void sub_08078790(Entity* ent, u32 arg1) { - sub_0807887C(ent, 2, arg1); +void AddInteractableFuser(Entity* ent, KinstoneId kinstoneId) { + AddInteractableObject(ent, 2, kinstoneId); } -void sub_0807879C(Entity* ent) { - sub_0807887C(ent, 7, 0); +void AddInteractableAsMinishObject(Entity* ent) { + AddInteractableObject(ent, 7, 0); } -void sub_080787A8(Entity* ent, u32 arg1) { - sub_0807887C(ent, 7, arg1); +void AddInteractableAsMinishFuser(Entity* ent, KinstoneId kinstoneId) { + AddInteractableObject(ent, 7, kinstoneId); } -void sub_080787B4(Entity* ent) { - sub_0807887C(ent, 9, 0); +void AddInteractableCheckableObject(Entity* ent) { + AddInteractableObject(ent, 9, 0); } -void sub_080787C0(Entity* ent) { - sub_0807887C(ent, 10, 0); +void AddInteractablePedestal(Entity* ent) { + AddInteractableObject(ent, 10, 0); } -void sub_080787CC(Entity* ent) { - sub_0807887C(ent, 5, 0); +void AddInteractableSmallKeyLock(Entity* ent) { + AddInteractableObject(ent, 5, 0); } -s32 sub_080787D8(Entity* ent) { +s32 AddInteractableShopItem(Entity* ent) { s32 iVar1; - iVar1 = sub_0807887C(ent, 8, 0); + iVar1 = AddInteractableObject(ent, 8, 0); if (iVar1 >= 0) { - gUnk_03003DF0.array[iVar1].unk_2 = 0xbe; + gPossibleInteraction.candidates[iVar1].interactDirections = 0xbe; } return iVar1; } -s32 sub_08078800(Entity* ent) { +s32 AddInteractableBossDoor(Entity* ent) { s32 iVar1; - iVar1 = sub_0807887C(ent, 6, 0); + iVar1 = AddInteractableObject(ent, 6, 0); if (iVar1 >= 0) { - gUnk_03003DF0.array[iVar1].unk_2 = 0xbe; + // weird, this line assumes it's a north door, and is unnecessary + // anyway because this is overwritten right after returning + gPossibleInteraction.candidates[iVar1].interactDirections = 0xbe; } return iVar1; } -s32 sub_08078828(Entity* ent) { +s32 AddInteractableChest(Entity* ent) { s32 iVar1; - iVar1 = sub_0807887C(ent, 3, 0); + iVar1 = AddInteractableObject(ent, 3, 0); if (iVar1 >= 0) { - gUnk_03003DF0.array[iVar1].unk_2 = 0xbe; + gPossibleInteraction.candidates[iVar1].interactDirections = 0xbe; } return iVar1; } -void sub_08078850(Entity* arg0, u32 arg1, u32 arg2, const void* arg3) { +void SetInteractableObjectCollision(Entity* arg0, u32 ignoreLayer, u32 interactDirections, const void* customHitbox) { s32 iVar1; - iVar1 = sub_08078904(arg0); + iVar1 = GetInteractableObjectIndex(arg0); if (iVar1 >= 0) { - gUnk_03003DF0.array[iVar1].unk_0 = arg1; - gUnk_03003DF0.array[iVar1].unk_2 = arg2; - gUnk_03003DF0.array[iVar1].unk_4 = arg3; + gPossibleInteraction.candidates[iVar1].ignoreLayer = ignoreLayer; + gPossibleInteraction.candidates[iVar1].interactDirections = interactDirections; + gPossibleInteraction.candidates[iVar1].customHitbox = customHitbox; } } -s32 sub_0807887C(Entity* entity, u32 param_2, u32 param_3) { +s32 AddInteractableObject(Entity* entity, InteractionType type, KinstoneId kinstoneId) { s32 index; entity->interactType = 0; - index = sub_08078904(entity); + index = GetInteractableObjectIndex(entity); if (index < 0) { - index = sub_08078904(0); + index = GetInteractableObjectIndex(0); } if (index >= 0) { - gUnk_03003DF0.array[index].entity = entity; - gUnk_03003DF0.array[index].unk_1 = param_2; - gUnk_03003DF0.array[index].unk_3 = param_3; + gPossibleInteraction.candidates[index].entity = entity; + gPossibleInteraction.candidates[index].type = type; + gPossibleInteraction.candidates[index].kinstoneId = kinstoneId; } - if (param_3 != 0) { + if (kinstoneId != KINSTONE_NONE) { Entity* entity = FindEntityByID(OBJECT, CAMERA_TARGET, 6); if (entity == NULL) { CreateObject(CAMERA_TARGET, 0, 0); @@ -1233,18 +1239,18 @@ s32 sub_0807887C(Entity* entity, u32 param_2, u32 param_3) { } /** Clear entry for Entity. */ -void sub_080788E0(Entity* entity) { - s32 index = sub_08078904(entity); +void RemoveInteractableObject(Entity* entity) { + s32 index = GetInteractableObjectIndex(entity); if (index > -1) { - MemClear(&gUnk_03003DF0.array[index], 0xc); + MemClear(&gPossibleInteraction.candidates[index], sizeof(InteractableObject)); } } /** Find entry for Entity. */ -s32 sub_08078904(Entity* entity) { +s32 GetInteractableObjectIndex(Entity* entity) { u32 index; for (index = 0; index < 0x20; index++) { - if (entity == gUnk_03003DF0.array[index].entity) { + if (entity == gPossibleInteraction.candidates[index].entity) { return index; } } @@ -1376,7 +1382,7 @@ void ClearPlayerState(void) { gPlayerState.spriteOffsetY = 0; gPlayerState.field_0x3c = 0; MemFill32(0xffffffff, gPlayerState.path_memory, 0x40); - MemClear(&gUnk_03003DF0, sizeof(gUnk_03003DF0)); + MemClear(&gPossibleInteraction, sizeof(gPossibleInteraction)); } void UpdateCarriedObject(void) { @@ -1521,10 +1527,10 @@ void sub_08078FB0(Entity* this) { gPlayerState.field_0x35 = 0xff; } sub_08079064(this); - if ((gPlayerState.flags & 8) != 0) { + if ((gPlayerState.flags & PL_NO_CAP) != 0) { animIndex = 0x58; } else { - if ((gPlayerState.flags & 0x80) != 0) { + if ((gPlayerState.flags & PL_MINISH) != 0) { animIndex = 0x18; } else { if (gPlayerState.animation >> 8 == 7) { @@ -1717,8 +1723,8 @@ void RespawnPlayer(void) { player->zVelocity = 0; player->knockbackDuration = 0; ResetPlayerPosition(); - if ((gPlayerState.flags & 0x20000) == 0) { - if ((gPlayerState.flags & 0x10000) != 0) { + if ((gPlayerState.flags & PL_GYORG_FIGHT) == 0) { + if ((gPlayerState.flags & PL_FLAGS10000) != 0) { player->x.HALF.HI = gPlayerState.lilypad->x.HALF.HI; player->y.HALF.HI = gPlayerState.lilypad->y.HALF.HI; } else { diff --git a/src/script.c b/src/script.c index 1f14de5f..23387340 100644 --- a/src/script.c +++ b/src/script.c @@ -94,12 +94,12 @@ void ScriptCommand_SetVariableToFrame(Entity* entity, ScriptExecutionContext* co void ScriptCommand_SetAnimation(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_TriggerInteract(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_0807E974(Entity* entity, ScriptExecutionContext* context); -void ScriptCommand_0807E9D4(Entity* entity, ScriptExecutionContext* context); -void ScriptCommand_0807E9DC(Entity* entity, ScriptExecutionContext* context); -void ScriptCommand_0807E9E4(Entity* entity, ScriptExecutionContext* context); +void ScriptCommand_AddInteractableWhenBigObject(Entity* entity, ScriptExecutionContext* context); +void ScriptCommand_RemoveInteractableObject(Entity* entity, ScriptExecutionContext* context); +void ScriptCommand_AddInteractableWhenBigFuser(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_0807E9F0(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_0807EA4C(Entity* entity, ScriptExecutionContext* context); -void ScriptCommand_0807EA88(Entity* entity, ScriptExecutionContext* context); +void ScriptCommand_AddInteractableFuser(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_WaitUntilTextboxCloses(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_MessageFromTarget(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_MessageNoOverlap(Entity* entity, ScriptExecutionContext* context); @@ -543,12 +543,12 @@ void ExecuteScript(Entity* entity, ScriptExecutionContext* context) { ScriptCommand_SetAnimation, ScriptCommand_TriggerInteract, ScriptCommand_0807E974, - ScriptCommand_0807E9D4, - ScriptCommand_0807E9DC, - ScriptCommand_0807E9E4, + ScriptCommand_AddInteractableWhenBigObject, + ScriptCommand_RemoveInteractableObject, + ScriptCommand_AddInteractableWhenBigFuser, ScriptCommand_0807E9F0, ScriptCommand_0807EA4C, - ScriptCommand_0807EA88, + ScriptCommand_AddInteractableFuser, ScriptCommand_WaitUntilTextboxCloses, ScriptCommand_MessageFromTarget, ScriptCommand_MessageNoOverlap, @@ -721,17 +721,17 @@ void ScriptCommand_CheckInventory1(Entity* entity, ScriptExecutionContext* conte u32 tmp; u32 tmp2 = GetNextScriptCommandHalfwordAfterCommandMetadata(context->scriptInstructionPointer); switch (tmp2) { - case 0x53: - tmp = HasDungeonMap(); + case ITEM_SMALL_KEY: + tmp = HasDungeonSmallKey(); break; - case 0x52: - tmp = HasDungeonCompass(); - break; - case 0x51: + case ITEM_BIG_KEY: tmp = HasDungeonBigKey(); break; - case 0x50: - tmp = HasDungeonSmallKey(); + case ITEM_COMPASS: + tmp = HasDungeonCompass(); + break; + case ITEM_DUNGEON_MAP: + tmp = HasDungeonMap(); break; default: tmp = GetInventoryValue(tmp2); @@ -1136,16 +1136,16 @@ void ScriptCommand_0807E974(Entity* entity, ScriptExecutionContext* context) { gActiveScriptInfo.commandSize = 0; } -void ScriptCommand_0807E9D4(Entity* entity, ScriptExecutionContext* context) { - sub_08078778(entity); +void ScriptCommand_AddInteractableWhenBigObject(Entity* entity, ScriptExecutionContext* context) { + AddInteractableWhenBigObject(entity); } -void ScriptCommand_0807E9DC(Entity* entity, ScriptExecutionContext* context) { - sub_080788E0(entity); +void ScriptCommand_RemoveInteractableObject(Entity* entity, ScriptExecutionContext* context) { + RemoveInteractableObject(entity); } -void ScriptCommand_0807E9E4(Entity* entity, ScriptExecutionContext* context) { - sub_08078784(entity, context->scriptInstructionPointer[1]); +void ScriptCommand_AddInteractableWhenBigFuser(Entity* entity, ScriptExecutionContext* context) { + AddInteractableWhenBigFuser(entity, context->scriptInstructionPointer[1]); } void ScriptCommand_0807E9F0(Entity* entity, ScriptExecutionContext* context) { @@ -1184,8 +1184,8 @@ void ScriptCommand_0807EA4C(Entity* entity, ScriptExecutionContext* context) { } } -void ScriptCommand_0807EA88(Entity* entity, ScriptExecutionContext* context) { - sub_08078790(entity, context->scriptInstructionPointer[1]); +void ScriptCommand_AddInteractableFuser(Entity* entity, ScriptExecutionContext* context) { + AddInteractableFuser(entity, context->scriptInstructionPointer[1]); } void ScriptCommand_WaitUntilTextboxCloses(Entity* entity, ScriptExecutionContext* context) { @@ -1966,16 +1966,16 @@ void PutItemAnySlot(Entity* entity, ScriptExecutionContext* context) { PutItemOnSlot(context->intVariable); } -void sub_0807F924(Entity* entity, ScriptExecutionContext* context) { - sub_0807879C(entity); +void MakeInteractableAsMinish(Entity* entity, ScriptExecutionContext* context) { + AddInteractableAsMinishObject(entity); } -void sub_0807F92C(Entity* entity, ScriptExecutionContext* context) { - sub_080787C0(entity); +void MakePedestalInteractable(Entity* entity, ScriptExecutionContext* context) { + AddInteractablePedestal(entity); } -void sub_0807F934(Entity* entity, ScriptExecutionContext* context) { - sub_080787B4(entity); +void MakeCheckableObjectInteractable(Entity* entity, ScriptExecutionContext* context) { + AddInteractableCheckableObject(entity); } void sub_0807F93C(Entity* entity, ScriptExecutionContext* context) { diff --git a/src/subtask.c b/src/subtask.c index 3661f8a6..6af46d94 100644 --- a/src/subtask.c +++ b/src/subtask.c @@ -114,13 +114,13 @@ void sub_080A70AC(const KeyButtonLayout* layout) { gUnk_0200AF00.unk_14 = 0x7f; gUnk_0200AF00.buttonX[0] = layout->aButtonX; gUnk_0200AF00.buttonY[0] = (s8)layout->aButtonY; - gUnk_0200AF00.unk_30[0] = layout->aButtonText; + gUnk_0200AF00.buttonText[0] = layout->aButtonText; gUnk_0200AF00.buttonX[1] = layout->bButtonX; gUnk_0200AF00.buttonY[1] = (s8)layout->bButtonY; - gUnk_0200AF00.unk_30[1] = layout->bButtonText; + gUnk_0200AF00.buttonText[1] = layout->bButtonText; gUnk_0200AF00.buttonX[2] = layout->rButtonX; gUnk_0200AF00.buttonY[2] = (s8)layout->rButtonY; - gUnk_0200AF00.unk_32 = layout->rButtonText; + gUnk_0200AF00.buttonText[2] = layout->rButtonText; layout++; do { CreateUIElement(layout->aButtonX, layout->aButtonY); diff --git a/src/ui.c b/src/ui.c index 9d104798..7e660167 100644 --- a/src/ui.c +++ b/src/ui.c @@ -739,30 +739,30 @@ void ItemUIElement(UIElement* element) { void TextUIElement(UIElement* element) { UIElement* buttonUIElement; - u32 tmp; + u32 frameIndex; if (element->type2 == 9) { - tmp = gUnk_0200AF00.unk_2f; - if (tmp == 0) { + frameIndex = gUnk_0200AF00.rActionPlayerState; + if (frameIndex == R_ACTION_NONE) { switch (gArea.portal_mode) { case 2: - tmp = 0xb; + frameIndex = R_ACTION_SHRINK; break; case 3: - tmp = 0xa; + frameIndex = R_ACTION_GROW; break; default: - tmp = gUnk_0200AF00.unk_2c; + frameIndex = gUnk_0200AF00.rActionInteractObject; break; } } - gUnk_0200AF00.unk_32 = tmp; + gUnk_0200AF00.buttonText[2] = frameIndex; } - tmp = gUnk_0200AF00.unk_30[element->buttonElementId]; + frameIndex = gUnk_0200AF00.buttonText[element->buttonElementId]; element->unk_0_1 = 0; - if (tmp != 0) { - tmp += gUnk_080C9044[((SaveHeader*)0x2000000)->language]; - sub_0801CAFC(element, tmp); + if (frameIndex != 0) { + frameIndex += gUnk_080C9044[((SaveHeader*)0x2000000)->language]; + sub_0801CAFC(element, frameIndex); buttonUIElement = FindUIElement(element->buttonElementId); if (buttonUIElement != NULL) { element->x = buttonUIElement->x;