Decompile object98

This commit is contained in:
Tal Hayon 2022-03-16 14:50:28 +02:00
parent c8547ffe35
commit d93dfd2c59
4 changed files with 70 additions and 139 deletions

View File

@ -1,128 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start Object98
Object98: @ 0x0809E348
push {lr}
ldr r2, _0809E35C @ =gUnk_0812418C
ldrb r1, [r0, #0xc]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_0809E35C: .4byte gUnk_0812418C
thumb_func_start sub_0809E360
sub_0809E360: @ 0x0809E360
push {r4, r5, r6, r7, lr}
mov r7, r8
push {r7}
adds r4, r0, #0
ldrb r0, [r4, #0xe]
cmp r0, #8
bls _0809E372
movs r0, #8
strb r0, [r4, #0xe]
_0809E372:
ldrb r2, [r4, #0xe]
movs r0, #0x48
subs r0, r0, r2
ldr r1, _0809E3E0 @ =gEntCount
ldrb r1, [r1]
cmp r0, r1
ble _0809E3D8
movs r5, #0
adds r7, r4, #0
adds r7, #0x7e
movs r0, #0x76
adds r0, r0, r4
mov r8, r0
cmp r5, r2
bhs _0809E3A6
movs r6, #0xe
_0809E392:
movs r0, #0x17
bl CreateProjectile
strb r6, [r0, #0xe]
str r4, [r0, #0x50]
adds r6, #0xc
adds r5, #1
ldrb r2, [r4, #0xe]
cmp r5, r2
blo _0809E392
_0809E3A6:
movs r0, #1
strb r0, [r4, #0xc]
ldrb r0, [r7]
lsls r1, r0, #8
mov r2, r8
strh r1, [r2]
lsls r0, r0, #6
strb r0, [r4, #0x14]
adds r0, r4, #0
movs r1, #0
bl SetDefaultPriority
ldrb r0, [r4, #0xa]
cmp r0, #0
beq _0809E3D8
bl GetCurrentRoomProperty
str r0, [r4, #0x54]
adds r1, r4, #0
adds r1, #0x54
adds r2, r4, #0
adds r2, #0x74
adds r0, r4, #0
bl sub_080A2CC0
_0809E3D8:
pop {r3}
mov r8, r3
pop {r4, r5, r6, r7, pc}
.align 2, 0
_0809E3E0: .4byte gEntCount
thumb_func_start sub_0809E3E4
sub_0809E3E4: @ 0x0809E3E4
push {r4, lr}
adds r4, r0, #0
adds r2, r4, #0
adds r2, #0x76
ldrb r0, [r4, #0xb]
ldrh r1, [r2]
adds r1, r1, r0
strh r1, [r2]
lsrs r1, r1, #2
strb r1, [r4, #0x14]
ldrb r0, [r4, #0xa]
cmp r0, #0
beq _0809E428
ldrb r1, [r4, #0x15]
movs r0, #0x80
ands r0, r1
cmp r0, #0
bne _0809E40E
adds r0, r4, #0
bl LinearMoveUpdate
_0809E40E:
adds r2, r4, #0
adds r2, #0x74
ldrh r0, [r2]
subs r0, #1
strh r0, [r2]
lsls r0, r0, #0x10
cmp r0, #0
bne _0809E428
adds r1, r4, #0
adds r1, #0x54
adds r0, r4, #0
bl sub_080A2CC0
_0809E428:
pop {r4, pc}
.align 2, 0

View File

@ -1,9 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_0812418C:: @ 0812418C
.4byte sub_0809E360
.4byte sub_0809E3E4

View File

@ -777,7 +777,7 @@ SECTIONS {
asm/object/bird.o(.text);
src/object/object96.o(.text);
src/object/keyStealingTakkuri.o(.text);
asm/object/object98.o(.text);
src/object/object98.o(.text);
asm/object/object99.o(.text);
src/object/macroAcorn.o(.text);
src/object/object9B.o(.text);
@ -1528,7 +1528,7 @@ SECTIONS {
data/animations/object/bird.o(.rodata);
src/object/object96.o(.rodata);
src/object/keyStealingTakkuri.o(.rodata);
data/const/object/object98.o(.rodata);
src/object/object98.o(.rodata);
data/animations/object/object98.o(.rodata);
src/object/macroAcorn.o(.rodata);
src/object/object9B.o(.rodata);

68
src/object/object98.c Normal file
View File

@ -0,0 +1,68 @@
#define NENT_DEPRECATED
#include "entity.h"
#include "projectile.h"
#include "room.h"
#include "functions.h"
typedef struct {
Entity base;
u8 filler[0xC];
u16 unk74;
u16 unk76;
u8 filler2[0x6];
u8 unk7e;
} Object98Entity;
void sub_0809E360(Object98Entity*);
void sub_0809E3E4(Object98Entity*);
void Object98(Entity* this) {
static void (*const actionFuncs[])(Object98Entity*) = {
sub_0809E360,
sub_0809E3E4,
};
actionFuncs[this->action]((Object98Entity*)this);
}
void sub_0809E360(Object98Entity* this) {
u32 bVar1;
Entity* projEnt;
u32 index;
if (8 < super->actionDelay) {
super->actionDelay = 8;
}
if (0x48 - super->actionDelay > gEntCount) {
for (index = 0; index < super->actionDelay; index++) {
projEnt = CreateProjectile(GURUGURU_BAR_PROJECTILE);
projEnt->actionDelay = 14 + 12 * index;
projEnt->parent = super;
}
super->action = 1;
bVar1 = this->unk7e;
this->unk76 = bVar1 << 8;
super->animationState = bVar1 << 6;
SetDefaultPriority(super, 0);
if (super->type != 0) {
super->child = (Entity*)GetCurrentRoomProperty(super->type);
sub_080A2CC0(super, (u16**)&super->child, &this->unk74);
}
}
}
void sub_0809E3E4(Object98Entity* this) {
this->unk76 += super->type2;
super->animationState = this->unk76 >> 2;
if (super->type != 0) {
if ((super->direction & 0x80) == 0) {
LinearMoveUpdate(super);
}
if (--this->unk74 == 0) {
sub_080A2CC0(super, (u16**)&super->child, &this->unk74);
}
}
}