Decompile object9B

This commit is contained in:
Tal Hayon 2022-03-15 02:25:17 +02:00
parent bc89db61b5
commit b3ccaa7864
5 changed files with 44 additions and 96 deletions

View File

@ -1,76 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start Object9B
Object9B: @ 0x0809E7A8
push {lr}
ldr r2, _0809E7BC @ =gUnk_081242D0
ldrb r1, [r0, #0xc]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_0809E7BC: .4byte gUnk_081242D0
thumb_func_start sub_0809E7C0
sub_0809E7C0: @ 0x0809E7C0
push {r4, lr}
adds r4, r0, #0
movs r0, #1
strb r0, [r4, #0xc]
ldrb r0, [r4, #0xb]
cmp r0, #0xff
beq _0809E7D4
adds r0, r4, #0
bl sub_0809E7FC
_0809E7D4:
ldrb r1, [r4, #0xa]
adds r0, r4, #0
bl InitializeAnimation
pop {r4, pc}
.align 2, 0
thumb_func_start sub_0809E7E0
sub_0809E7E0: @ 0x0809E7E0
push {r4, lr}
adds r4, r0, #0
bl GetNextFrame
adds r4, #0x5a
ldrb r1, [r4]
movs r0, #0x80
ands r0, r1
cmp r0, #0
beq _0809E7F8
bl DeleteThisEntity
_0809E7F8:
pop {r4, pc}
.align 2, 0
thumb_func_start sub_0809E7FC
sub_0809E7FC: @ 0x0809E7FC
push {lr}
adds r1, r0, #0
ldrb r3, [r1, #0xb]
lsls r3, r3, #1
ldr r0, _0809E820 @ =gUnk_081242D8
adds r3, r3, r0
ldr r0, [r1, #0x50]
movs r2, #0
ldrsb r2, [r3, r2]
lsls r2, r2, #0x10
ldrb r3, [r3, #1]
lsls r3, r3, #0x18
asrs r3, r3, #0x18
lsls r3, r3, #0x10
bl PositionRelative
pop {pc}
.align 2, 0
_0809E820: .4byte gUnk_081242D8

View File

@ -44794,11 +44794,6 @@
"size": 40,
"type": "animation"
},
{
"path": "object9B/gUnk_081242D8.bin",
"start": 1196760,
"size": 16
},
{
"path": "animations/gSpriteAnimations_Fan_0.bin",
"start": 1197044,

View File

@ -1,13 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_081242D0:: @ 081242D0
.4byte sub_0809E7C0
.4byte sub_0809E7E0
gUnk_081242D8:: @ 081242D8
.incbin "object9B/gUnk_081242D8.bin"

View File

@ -778,7 +778,7 @@ SECTIONS {
asm/object/object98.o(.text);
asm/object/object99.o(.text);
src/object/macroAcorn.o(.text);
asm/object/object9B.o(.text);
src/object/object9B.o(.text);
src/object/treeHidingPortal.o(.text);
src/object/lightableSwitch.o(.text);
src/object/treeThorns.o(.text);
@ -1529,7 +1529,7 @@ SECTIONS {
data/const/object/object98.o(.rodata);
data/animations/object/object98.o(.rodata);
src/object/macroAcorn.o(.rodata);
data/const/object/object9B.o(.rodata);
src/object/object9B.o(.rodata);
data/animations/object/object9B.o(.rodata);
src/object/treeHidingPortal.o(.rodata);
data/const/object/lightableSwitch.o(.rodata);

42
src/object/object9B.c Normal file
View File

@ -0,0 +1,42 @@
#define NENT_DEPRECATED
#include "entity.h"
#include "coord.h"
void sub_0809E7C0(Entity*);
void sub_0809E7E0(Entity*);
void sub_0809E7FC(Entity*);
void Object9B(Entity* this) {
static void (*const actionFuncs[])(Entity*) = {
sub_0809E7C0,
sub_0809E7E0,
};
actionFuncs[this->action]((Entity*)this);
}
void sub_0809E7C0(Entity* this) {
this->action = 1;
if (this->type2 != 0xff) {
sub_0809E7FC(this);
}
InitializeAnimation(this, this->type);
}
void sub_0809E7E0(Entity* this) {
GetNextFrame(this);
if (this->frame & 0x80) {
DeleteThisEntity();
}
}
void sub_0809E7FC(Entity* this) {
static const s8 gUnk_081242D8[] = {
0, -24, 16, -16, 24, 0, 16, 16, 0, 24, -16, 16, -24, 0, -16, -16,
};
int iVar1;
const s8* ptr;
ptr = &gUnk_081242D8[this->type2 * 2];
PositionRelative(this->parent, this, ptr[0] << 0x10, ptr[1] << 0x10);
}