Decompile the rest of treeHidingPortal

This commit is contained in:
Tal Hayon 2022-03-15 01:55:54 +02:00
parent b84b2268a2
commit bc89db61b5
5 changed files with 34 additions and 72 deletions

View File

@ -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

View File

@ -44799,11 +44799,6 @@
"start": 1196760, "start": 1196760,
"size": 16 "size": 16
}, },
{
"path": "treeHidingPortal/gUnk_08124364.bin",
"start": 1196900,
"size": 80
},
{ {
"path": "animations/gSpriteAnimations_Fan_0.bin", "path": "animations/gSpriteAnimations_Fan_0.bin",
"start": 1197044, "start": 1197044,

View File

@ -4,12 +4,7 @@
.section .rodata .section .rodata
.align 2 .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"

View File

@ -780,7 +780,6 @@ SECTIONS {
src/object/macroAcorn.o(.text); src/object/macroAcorn.o(.text);
asm/object/object9B.o(.text); asm/object/object9B.o(.text);
src/object/treeHidingPortal.o(.text); src/object/treeHidingPortal.o(.text);
asm/object/treeHidingPortal.o(.text);
src/object/lightableSwitch.o(.text); src/object/lightableSwitch.o(.text);
src/object/treeThorns.o(.text); src/object/treeThorns.o(.text);
src/object/fan.o(.text); src/object/fan.o(.text);
@ -1532,7 +1531,7 @@ SECTIONS {
src/object/macroAcorn.o(.rodata); src/object/macroAcorn.o(.rodata);
data/const/object/object9B.o(.rodata); data/const/object/object9B.o(.rodata);
data/animations/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); data/const/object/lightableSwitch.o(.rodata);
src/object/fan.o(.rodata); src/object/fan.o(.rodata);
data/animations/object/fan.o(.rodata); data/animations/object/fan.o(.rodata);

View File

@ -7,12 +7,21 @@
#include "functions.h" #include "functions.h"
#include "effects.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) { 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) { void sub_0809E83C(Entity* this) {
@ -61,8 +70,12 @@ void sub_0809E8EC(Entity* this) {
} }
void sub_0809E918(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; Entity* fx;
s16* i = gUnk_08124364; const s16* i = gUnk_08124364;
while (*i != -1000) { while (*i != -1000) {
fx = CreateFx(this, FX_BUSH, 0); fx = CreateFx(this, FX_BUSH, 0);
if (fx != NULL) { if (fx != NULL) {
@ -78,3 +91,17 @@ void sub_0809E918(Entity* this) {
void sub_0809E96C(Entity* this) { void sub_0809E96C(Entity* this) {
CreateMinishEntrance(COORD_TO_TILE_OFFSET(this, 0x20, 0x8)); 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;
}