decompile enemyE

This commit is contained in:
Behemoth 2020-08-30 00:35:06 +02:00
parent 6e61e77e9e
commit b5bf34f521
5 changed files with 79 additions and 110 deletions

View File

@ -1,100 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start EnemyE
EnemyE: @ 0x08022FA4
push {lr}
ldr r1, _08022FB0 @ =gUnk_080CBBC8
bl EnemyFunctionHandler
pop {pc}
.align 2, 0
_08022FB0: .4byte gUnk_080CBBC8
thumb_func_start sub_08022FB4
sub_08022FB4: @ 0x08022FB4
push {lr}
ldr r2, _08022FC8 @ =gUnk_080CBBDC
ldrb r1, [r0, #0xc]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_08022FC8: .4byte gUnk_080CBBDC
thumb_func_start nullsub_133
nullsub_133: @ 0x08022FCC
bx lr
.align 2, 0
thumb_func_start sub_08022FD0
sub_08022FD0: @ 0x08022FD0
push {lr}
movs r3, #1
movs r1, #1
strb r1, [r0, #0xc]
ldrb r2, [r0, #0x18]
subs r1, #5
ands r1, r2
orrs r1, r3
strb r1, [r0, #0x18]
movs r1, #0
bl sub_08023000
pop {pc}
.align 2, 0
thumb_func_start sub_08022FEC
sub_08022FEC: @ 0x08022FEC
push {lr}
movs r1, #0x80
bl sub_08023000
pop {pc}
.align 2, 0
thumb_func_start sub_08022FF8
sub_08022FF8: @ 0x08022FF8
bx lr
.align 2, 0
thumb_func_start sub_08022FFC
sub_08022FFC: @ 0x08022FFC
bx lr
.align 2, 0
thumb_func_start sub_08023000
sub_08023000: @ 0x08023000
push {r4, lr}
adds r4, r0, #0
cmp r1, #0x80
bne _0802300E
bl UpdateAnimationSingleFrame
b _08023014
_0802300E:
adds r0, r4, #0
bl InitAnimationForceUpdate
_08023014:
movs r2, #0x80
adds r0, r4, #0
adds r0, #0x5b
ldrb r0, [r0]
cmp r0, #0x40
bne _08023022
rsbs r2, r2, #0
_08023022:
ldrb r0, [r4, #0x19]
movs r1, #3
orrs r0, r1
strb r0, [r4, #0x19]
adds r0, r4, #0
adds r1, r2, #0
movs r2, #0x80
movs r3, #0
bl sub_0805EC9C
pop {r4, pc}

7
data/animations/enemyE.s Normal file
View File

@ -0,0 +1,7 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
gUnk_080CBBEC:: @ 080CBBEC
.incbin "baserom.gba", 0x0CBBEC, 0x000004C

View File

@ -3,15 +3,6 @@
.section .rodata .section .rodata
gUnk_080CBBC8:: @ 080CBBC8
.incbin "baserom.gba", 0x0CBBC8, 0x0000014
gUnk_080CBBDC:: @ 080CBBDC
.incbin "baserom.gba", 0x0CBBDC, 0x0000010
gUnk_080CBBEC:: @ 080CBBEC
.incbin "baserom.gba", 0x0CBBEC, 0x000004C
gUnk_080CBC38:: @ 080CBC38 gUnk_080CBC38:: @ 080CBC38
.incbin "baserom.gba", 0x0CBC38, 0x0000018 .incbin "baserom.gba", 0x0CBC38, 0x0000018

View File

@ -339,7 +339,7 @@ SECTIONS {
src/enemy/spinyChuchu.o(.text); src/enemy/spinyChuchu.o(.text);
src/enemy/cuccoChickAggr.o(.text); src/enemy/cuccoChickAggr.o(.text);
src/enemy/moldorm.o(.text); src/enemy/moldorm.o(.text);
asm/enemyE.o(.text); src/enemy/enemyE.o(.text);
asm/moldworm.o(.text); asm/moldworm.o(.text);
asm/sluggula.o(.text); asm/sluggula.o(.text);
asm/pesto.o(.text); asm/pesto.o(.text);
@ -930,6 +930,8 @@ SECTIONS {
data/animations/spinyChuchu.o(.rodata); data/animations/spinyChuchu.o(.rodata);
src/enemy/cuccoChickAggr.o(.rodata); src/enemy/cuccoChickAggr.o(.rodata);
src/enemy/moldorm.o(.rodata); src/enemy/moldorm.o(.rodata);
src/enemy/enemyE.o(.rodata);
data/animations/enemyE.o(.rodata);
data/data_080CBB90.o(.rodata); data/data_080CBB90.o(.rodata);
src/enemy.o(.rodata); src/enemy.o(.rodata);
data/data_080D3D94.o(.rodata); data/data_080D3D94.o(.rodata);

69
src/enemy/enemyE.c Normal file
View File

@ -0,0 +1,69 @@
#include "enemy.h"
#include "entity.h"
#include "functions.h"
void sub_08023000(Entity*, int);
extern void (*const gUnk_080CBBC8[])(Entity*);
extern void (*const gUnk_080CBBDC[])(Entity*);
void EnemyE(Entity* this) {
EnemyFunctionHandler(this, gUnk_080CBBC8);
}
void sub_08022FB4(Entity* this) {
gUnk_080CBBDC[this->action](this);
}
void nullsub_133(Entity* this) {
}
void sub_08022FD0(Entity* this) {
this->action = 1;
this->spriteSettings.b.draw = 1;
sub_08023000(this, 0);
}
void sub_08022FEC(Entity* this) {
sub_08023000(this, 0x80);
}
void sub_08022FF8(Entity* this) {
}
void sub_08022FFC(Entity* this) {
}
void sub_08023000(Entity* this, int frames) {
int tmp;
if (frames == 0x80) {
UpdateAnimationSingleFrame(this);
} else {
InitAnimationForceUpdate(this, frames);
}
tmp = 0x80;
if (this->frameSpriteSettings == 0x40)
tmp *= -1;
this->spriteRendering.b0 = 3;
sub_0805EC9C(this, tmp, 0x80, 0);
}
// clang-format off
void (*const gUnk_080CBBC8[])(Entity*) = {
sub_08022FB4,
nullsub_133,
sub_08001324,
sub_0804A7D4,
sub_08001242,
};
void (*const gUnk_080CBBDC[])(Entity*) = {
sub_08022FD0,
sub_08022FEC,
sub_08022FF8,
sub_08022FFC,
};
// clang-format on