diff --git a/asm/object/treeHidingPortal.s b/asm/object/treeHidingPortal.s deleted file mode 100644 index 5616c883..00000000 --- a/asm/object/treeHidingPortal.s +++ /dev/null @@ -1,54 +0,0 @@ - .include "asm/macros.inc" - - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_0809E9A0 -sub_0809E9A0: @ 0x0809E9A0 - push {r4, r5, r6, lr} - ldr r5, _0809E9B0 @ =gPlayerEntity - ldrb r2, [r5, #0xc] - cmp r2, #6 - beq _0809E9B4 - movs r0, #0 - b _0809E9F0 - .align 2, 0 -_0809E9B0: .4byte gPlayerEntity -_0809E9B4: - ldrb r0, [r5, #0x14] - ands r2, r0 - lsls r2, r2, #1 - ldr r0, _0809E9F4 @ =gUnk_080B4468 - adds r2, r2, r0 - movs r1, #0x2e - ldrsh r0, [r5, r1] - movs r3, #0 - ldrsh r1, [r2, r3] - adds r0, r0, r1 - ldr r4, _0809E9F8 @ =gRoomControls - ldrh r1, [r4, #6] - subs r0, r0, r1 - asrs r0, r0, #4 - movs r3, #0x3f - ands r0, r3 - movs r6, #0x32 - ldrsh r1, [r5, r6] - movs r5, #2 - ldrsh r2, [r2, r5] - adds r1, r1, r2 - ldrh r2, [r4, #8] - subs r1, r1, r2 - asrs r1, r1, #4 - ands r1, r3 - lsls r1, r1, #6 - orrs r0, r1 - movs r1, #1 - bl sub_080B1AE0 -_0809E9F0: - pop {r4, r5, r6, pc} - .align 2, 0 -_0809E9F4: .4byte gUnk_080B4468 -_0809E9F8: .4byte gRoomControls diff --git a/assets/assets.json b/assets/assets.json index c579cdea..5ac2026c 100644 --- a/assets/assets.json +++ b/assets/assets.json @@ -44799,11 +44799,6 @@ "start": 1196760, "size": 16 }, - { - "path": "treeHidingPortal/gUnk_08124364.bin", - "start": 1196900, - "size": 80 - }, { "path": "animations/gSpriteAnimations_Fan_0.bin", "start": 1197044, diff --git a/data/const/object/treeHidingPortal.s b/data/const/object/treeHidingPortal.s index 69399391..8ad175aa 100644 --- a/data/const/object/treeHidingPortal.s +++ b/data/const/object/treeHidingPortal.s @@ -4,12 +4,7 @@ .section .rodata .align 2 -gUnk_08124354:: @ 08124354 - .4byte sub_0809E83C - .4byte sub_0809E86C - .4byte sub_0809E8BC - .4byte sub_0809E8EC -gUnk_08124364:: @ 08124364 - .incbin "treeHidingPortal/gUnk_08124364.bin" + + diff --git a/linker.ld b/linker.ld index fcdf02bd..625c621c 100644 --- a/linker.ld +++ b/linker.ld @@ -780,7 +780,6 @@ SECTIONS { src/object/macroAcorn.o(.text); asm/object/object9B.o(.text); src/object/treeHidingPortal.o(.text); - asm/object/treeHidingPortal.o(.text); src/object/lightableSwitch.o(.text); src/object/treeThorns.o(.text); src/object/fan.o(.text); @@ -1532,7 +1531,7 @@ SECTIONS { src/object/macroAcorn.o(.rodata); data/const/object/object9B.o(.rodata); data/animations/object/object9B.o(.rodata); - data/const/object/treeHidingPortal.o(.rodata); + src/object/treeHidingPortal.o(.rodata); data/const/object/lightableSwitch.o(.rodata); src/object/fan.o(.rodata); data/animations/object/fan.o(.rodata); diff --git a/src/object/treeHidingPortal.c b/src/object/treeHidingPortal.c index aa450002..c4a0518a 100644 --- a/src/object/treeHidingPortal.c +++ b/src/object/treeHidingPortal.c @@ -7,12 +7,21 @@ #include "functions.h" #include "effects.h" -extern void (*const gUnk_08124354[])(Entity*); +extern const s16 gUnk_080B4468[]; -extern s16 gUnk_08124364[]; +void sub_0809E83C(Entity* this); +void sub_0809E86C(Entity* this); +void sub_0809E8BC(Entity* this); +void sub_0809E8EC(Entity* this); void TreeHidingPortal(Entity* this) { - gUnk_08124354[this->action](this); + static void (*const actionFuncs[])(Entity*) = { + sub_0809E83C, + sub_0809E86C, + sub_0809E8BC, + sub_0809E8EC, + }; + actionFuncs[this->action](this); } void sub_0809E83C(Entity* this) { @@ -61,8 +70,12 @@ void sub_0809E8EC(Entity* this) { } void sub_0809E918(Entity* this) { + static const s16 gUnk_08124364[] = { + 0, -4, 8, -4, 16, -4, 22, -4, -8, -4, -16, -4, -22, -4, 0, -12, 0, 4, 8, -12, + 8, 4, -8, -12, -8, 4, 8, -16, -8, -16, 12, -16, -12, -16, 16, -14, -16, -14, -1000, 0, + }; Entity* fx; - s16* i = gUnk_08124364; + const s16* i = gUnk_08124364; while (*i != -1000) { fx = CreateFx(this, FX_BUSH, 0); if (fx != NULL) { @@ -78,3 +91,17 @@ void sub_0809E918(Entity* this) { void sub_0809E96C(Entity* this) { CreateMinishEntrance(COORD_TO_TILE_OFFSET(this, 0x20, 0x8)); } + +u32 sub_0809E9A0(void) { + u32 rv; + const s16* ptr; + + if (gPlayerEntity.action != PLAYER_BOUNCE) { + rv = 0; + } else { + ptr = &gUnk_080B4468[gPlayerEntity.animationState & 6]; + rv = sub_080B1AE0(COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr[0], -ptr[1]), 1); + } + + return rv; +}