Decompile objectA9

This commit is contained in:
Tal Hayon 2022-03-16 15:32:11 +02:00
parent dd131b7aa0
commit 64e3013c77
5 changed files with 39 additions and 107 deletions

View File

@ -1,79 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start ObjectA9
ObjectA9: @ 0x0809FEE0
push {lr}
ldr r2, _0809FEF4 @ =gUnk_08124850
ldrb r1, [r0, #0xc]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_0809FEF4: .4byte gUnk_08124850
thumb_func_start sub_0809FEF8
sub_0809FEF8: @ 0x0809FEF8
push {r4, lr}
adds r4, r0, #0
movs r0, #1
strb r0, [r4, #0xc]
ldr r1, _0809FF20 @ =gUnk_0812485C
ldrb r0, [r4, #0xa]
adds r0, r0, r1
ldrb r1, [r0]
adds r0, r4, #0
bl InitializeAnimation
ldr r1, _0809FF24 @ =gUnk_08124860
ldrb r0, [r4, #0xa]
lsls r0, r0, #1
adds r0, r0, r1
ldrh r0, [r0]
bl SoundReq
pop {r4, pc}
.align 2, 0
_0809FF20: .4byte gUnk_0812485C
_0809FF24: .4byte gUnk_08124860
thumb_func_start sub_0809FF28
sub_0809FF28: @ 0x0809FF28
push {r4, lr}
adds r4, r0, #0
bl GetNextFrame
adds r0, r4, #0
adds r0, #0x5a
ldrb r1, [r0]
movs r0, #0x80
ands r0, r1
cmp r0, #0
beq _0809FF64
movs r0, #2
strb r0, [r4, #0xc]
ldr r1, [r4, #0x50]
ldrb r0, [r4, #0xe]
strb r0, [r1, #0x10]
ldrb r2, [r4, #0xf]
movs r0, #3
ands r2, r0
ldrb r3, [r1, #0x18]
movs r0, #4
rsbs r0, r0, #0
ands r0, r3
orrs r0, r2
strb r0, [r1, #0x18]
adds r1, #0x6d
ldrb r2, [r1]
movs r0, #0xef
ands r0, r2
strb r0, [r1]
_0809FF64:
pop {r4, pc}
.align 2, 0

View File

@ -44902,16 +44902,6 @@
"size": 20,
"type": "animation"
},
{
"path": "objectA9/gUnk_0812485C.bin",
"start": 1198172,
"size": 4
},
{
"path": "objectA9/gUnk_08124860.bin",
"start": 1198176,
"size": 8
},
{
"path": "animations/gSpriteAnimations_ObjectAB_0.bin",
"start": 1198200,

View File

@ -1,16 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_08124850:: @ 08124850
.4byte sub_0809FEF8
.4byte sub_0809FF28
.4byte DeleteEntity
gUnk_0812485C:: @ 0812485C
.incbin "objectA9/gUnk_0812485C.bin"
gUnk_08124860:: @ 08124860
.incbin "objectA9/gUnk_08124860.bin"

View File

@ -794,7 +794,7 @@ SECTIONS {
src/object/objectA6.o(.text);
src/object/objectA7.o(.text);
src/object/objectA8.o(.text);
asm/object/objectA9.o(.text);
src/object/objectA9.o(.text);
src/object/waterfallOpening.o(.text);
asm/object/objectAB.o(.text);
src/object/fourElements.o(.text);
@ -1547,7 +1547,7 @@ SECTIONS {
src/object/objectA6.o(.rodata);
data/animations/object/objectA6.o(.rodata);
src/object/objectA8.o(.rodata);
data/const/object/objectA9.o(.rodata);
src/object/objectA9.o(.rodata);
src/object/waterfallOpening.o(.rodata);
data/const/object/objectAB.o(.rodata);
data/animations/object/objectAB.o(.rodata);

37
src/object/objectA9.c Normal file
View File

@ -0,0 +1,37 @@
#define NENT_DEPRECATED
#include "entity.h"
#include "sound.h"
void sub_0809FEF8(Entity*);
void sub_0809FF28(Entity*);
void ObjectA9(Entity* this) {
static void (*const actionFuncs[])(Entity*) = {
sub_0809FEF8,
sub_0809FF28,
DeleteEntity,
};
actionFuncs[this->action]((Entity*)this);
}
void sub_0809FEF8(Entity* this) {
static const u8 typeAnimationStates[] = { 0x2, 0x0, 0x43, 0x0 };
static const u16 typeSounds[] = { SFX_124, SFX_197, SFX_11D, SFX_NONE };
this->action = 1;
InitializeAnimation(this, typeAnimationStates[this->type]);
SoundReq(typeSounds[this->type]);
}
void sub_0809FF28(Entity* this) {
Entity* pEVar1;
GetNextFrame(this);
if (this->frame & 0x80) {
this->action = 2;
pEVar1 = this->parent;
pEVar1->flags = this->actionDelay;
pEVar1->spriteSettings.draw = this->field_0xf;
((GenericEntity*)pEVar1)->field_0x6c.HALF.HI &= 0xef;
}
}