Decompile ObjectD

This commit is contained in:
octorock 2022-03-11 18:43:08 +01:00
parent 11609c6ee9
commit a7c364d9e8
4 changed files with 72 additions and 169 deletions

View File

@ -1,156 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start ObjectD
ObjectD: @ 0x08084334
push {lr}
ldr r2, _08084348 @ =gUnk_0811F908
ldrb r1, [r0, #0xc]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_08084348: .4byte gUnk_0811F908
thumb_func_start sub_0808434C
sub_0808434C: @ 0x0808434C
push {r4, r5, r6, lr}
adds r5, r0, #0
movs r2, #1
movs r3, #1
strb r3, [r5, #0xc]
ldrb r1, [r5, #0x10]
movs r0, #0x80
orrs r0, r1
strb r0, [r5, #0x10]
ldrb r1, [r5, #0x18]
movs r0, #4
rsbs r0, r0, #0
ands r0, r1
orrs r0, r2
strb r0, [r5, #0x18]
adds r1, r5, #0
adds r1, #0x3c
movs r0, #7
strb r0, [r1]
adds r0, r5, #0
adds r0, #0x3f
strb r3, [r0]
adds r1, #4
movs r0, #0x47
strb r0, [r1]
subs r1, #5
movs r0, #2
strb r0, [r1]
ldr r0, _080843E0 @ =gHitbox_4
str r0, [r5, #0x48]
ldr r0, _080843E4 @ =0x00004050
movs r2, #0x2e
ldrsh r1, [r5, r2]
ldr r3, _080843E8 @ =gRoomControls
ldrh r2, [r3, #6]
subs r1, r1, r2
asrs r1, r1, #4
movs r4, #0x3f
ands r1, r4
movs r6, #0x32
ldrsh r2, [r5, r6]
ldrh r3, [r3, #8]
subs r2, r2, r3
asrs r2, r2, #4
ands r2, r4
lsls r2, r2, #6
orrs r1, r2
adds r2, r5, #0
adds r2, #0x38
ldrb r2, [r2]
bl SetTile
ldrb r0, [r5, #0xa]
cmp r0, #1
beq _080843C8
adds r0, r5, #0
adds r0, #0x86
ldrh r0, [r0]
bl CheckFlags
cmp r0, #0
beq _080843EC
_080843C8:
movs r0, #3
strb r0, [r5, #0xc]
adds r0, r5, #0
adds r0, #0x86
ldrh r0, [r0]
bl SetFlag
adds r0, r5, #0
movs r1, #1
bl InitializeAnimation
b _080843F4
.align 2, 0
_080843E0: .4byte gHitbox_4
_080843E4: .4byte 0x00004050
_080843E8: .4byte gRoomControls
_080843EC:
ldrb r1, [r5, #0xa]
adds r0, r5, #0
bl InitializeAnimation
_080843F4:
pop {r4, r5, r6, pc}
.align 2, 0
thumb_func_start sub_080843F8
sub_080843F8: @ 0x080843F8
push {lr}
adds r2, r0, #0
adds r0, #0x41
ldrb r0, [r0]
cmp r0, #0x9c
bne _08084420
movs r0, #2
strb r0, [r2, #0xc]
ldrb r1, [r2, #0x10]
movs r0, #0x7f
ands r0, r1
strb r0, [r2, #0x10]
adds r0, r2, #0
movs r1, #0xd
movs r2, #0
bl CreateFx
ldr r0, _08084424 @ =0x0000010D
bl EnqueueSFX
_08084420:
pop {pc}
.align 2, 0
_08084424: .4byte 0x0000010D
thumb_func_start sub_08084428
sub_08084428: @ 0x08084428
push {r4, lr}
adds r4, r0, #0
bl GetNextFrame
adds r0, r4, #0
adds r0, #0x5a
ldrb r1, [r0]
movs r0, #1
ands r0, r1
cmp r0, #0
beq _08084454
movs r0, #3
strb r0, [r4, #0xc]
adds r0, r4, #0
adds r0, #0x86
ldrh r0, [r0]
bl SetFlag
movs r0, #0x86
lsls r0, r0, #1
bl EnqueueSFX
_08084454:
pop {r4, pc}
.align 2, 0

View File

@ -1,11 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_0811F908:: @ 0811F908
.4byte sub_0808434C
.4byte sub_080843F8
.4byte sub_08084428
.4byte GetNextFrame

View File

@ -633,7 +633,7 @@ SECTIONS {
src/object/objectA.o(.text);
src/object/objectB.o(.text);
src/object/chestSpawner.o(.text);
asm/object/objectD.o(.text);
src/object/objectD.o(.text);
asm/object/objectE.o(.text);
src/object/specialFx.o(.text);
asm/object/object10.o(.text);
@ -1350,7 +1350,7 @@ SECTIONS {
src/object/objectB.o(.rodata);
src/object/chestSpawner.o(.rodata);
data/animations/object/chestSpawner.o(.rodata);
data/const/object/objectD.o(.rodata);
src/object/objectD.o(.rodata);
data/animations/object/objectD.o(.rodata);
src/object/specialFx.o(.rodata);
data/animations/object/specialFx.o(.rodata);

70
src/object/objectD.c Normal file
View File

@ -0,0 +1,70 @@
/**
* @file objectD.c
* @ingroup Objects
*
* @brief ObjectD object
*/
#define NENT_DEPRECATED
#include "global.h"
#include "object.h"
#include "functions.h"
#include "hitbox.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unk_68[0x1e];
/*0x86*/ u16 unk_86;
} ObjectDEntity;
void sub_0808434C(ObjectDEntity*);
void sub_080843F8(ObjectDEntity*);
void sub_08084428(ObjectDEntity*);
void (*const gUnk_0811F908[])(ObjectDEntity*) = {
sub_0808434C,
sub_080843F8,
sub_08084428,
(void (*)(ObjectDEntity*))GetNextFrame,
};
void ObjectD(ObjectDEntity* this) {
gUnk_0811F908[super->action](this);
}
void sub_0808434C(ObjectDEntity* this) {
super->action = 1;
super->flags |= 0x80;
super->spriteSettings.draw = 1;
super->field_0x3c = 7;
super->hitType = 1;
super->hurtType = 0x47;
super->flags2 = 2;
super->hitbox = (Hitbox*)&gHitbox_4;
SetTile(0x4050, COORD_TO_TILE(super), super->collisionLayer);
if (super->type == 1 || CheckFlags(this->unk_86)) {
super->action = 3;
SetFlag(this->unk_86);
InitializeAnimation(super, 1);
} else {
InitializeAnimation(super, super->type);
}
}
void sub_080843F8(ObjectDEntity* this) {
if (super->bitfield == 0x9c) {
super->action = 2;
super->flags &= 0x7f;
CreateFx(super, FX_ICE, 0);
EnqueueSFX(SFX_10D);
}
}
void sub_08084428(ObjectDEntity* this) {
GetNextFrame(super);
if ((super->frame & 1) != 0) {
super->action = 3;
SetFlag(this->unk_86);
EnqueueSFX(SFX_BUTTON_PRESS);
}
}