Decompile object15

This commit is contained in:
Tal Hayon 2022-03-13 01:17:02 +02:00
parent cc8ef3a260
commit 830f07d554
4 changed files with 50 additions and 109 deletions

View File

@ -1,98 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start Object15
Object15: @ 0x0808601C
push {lr}
ldr r2, _08086030 @ =gUnk_08120648
ldrb r1, [r0, #0xc]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_08086030: .4byte gUnk_08120648
thumb_func_start sub_08086034
sub_08086034: @ 0x08086034
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]
adds r1, r0, #0
adds r1, #0x58
ldrb r1, [r1]
bl InitializeAnimation
pop {pc}
.align 2, 0
thumb_func_start sub_08086054
sub_08086054: @ 0x08086054
push {r4, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xa]
cmp r0, #0
bne _08086064
adds r0, r4, #0
bl GetNextFrame
_08086064:
ldrb r0, [r4, #0xb]
cmp r0, #0
beq _0808607C
ldrb r2, [r4, #0x18]
lsls r1, r2, #0x1e
lsrs r1, r1, #0x1e
movs r0, #1
eors r1, r0
subs r0, #5
ands r0, r2
orrs r0, r1
strb r0, [r4, #0x18]
_0808607C:
ldrb r0, [r4, #0xe]
lsls r1, r0, #0x18
cmp r1, #0
blt _080860AA
cmp r1, #0
beq _08086098
subs r0, #1
strb r0, [r4, #0xe]
lsls r0, r0, #0x18
cmp r0, #0
bne _080860AA
bl DeleteThisEntity
b _080860AA
_08086098:
adds r0, r4, #0
adds r0, #0x5a
ldrb r1, [r0]
movs r0, #0x80
ands r0, r1
cmp r0, #0
beq _080860AA
bl DeleteThisEntity
_080860AA:
ldr r1, [r4, #0x54]
cmp r1, #0
beq _080860BC
ldr r0, [r1, #0x2c]
str r0, [r4, #0x2c]
ldr r0, [r1, #0x30]
str r0, [r4, #0x30]
ldr r0, [r1, #0x34]
str r0, [r4, #0x34]
_080860BC:
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_08120648:: @ 08120648
.4byte sub_08086034
.4byte sub_08086054

View File

@ -641,7 +641,7 @@ SECTIONS {
src/object/object12.o(.text);
src/object/railtrack.o(.text);
src/object/lilypadLarge.o(.text);
asm/object/object15.o(.text);
src/object/object15.o(.text);
src/object/floatingPlatform.o(.text);
asm/object/object17.o(.text);
asm/object/evilSpirit.o(.text);
@ -1360,7 +1360,7 @@ SECTIONS {
data/const/object/railtrack.o(.rodata);
data/animations/object/railtrack.o(.rodata);
data/const/object/lilypadLarge.o(.rodata);
data/const/object/object15.o(.rodata);
src/object/object15.o(.rodata);
src/object/floatingPlatform.o(.rodata);
data/const/object/object17.o(.rodata);
data/const/object/evilSpirit.o(.rodata);

48
src/object/object15.c Normal file
View File

@ -0,0 +1,48 @@
#define NENT_DEPRECATED
#include "entity.h"
void Object15_Init(Entity*);
void Object15_Action1(Entity*);
void Object15(Entity* this) {
static void (*const actionFuncs[])(Entity*) = {
Object15_Init,
Object15_Action1,
};
actionFuncs[this->action](this);
}
void Object15_Init(Entity* this) {
this->action = 1;
this->spriteSettings.draw = 1;
InitializeAnimation(this, this->animIndex);
}
void Object15_Action1(Entity* this) {
if (this->type == 0) {
GetNextFrame(this);
}
if (this->type2 != 0) {
this->spriteSettings.draw ^= 1;
}
if ((int)(this->actionDelay * 0x1000000) >= 0) {
if (this->actionDelay) {
if (--this->actionDelay == 0) {
DeleteThisEntity();
}
} else {
if ((this->frame & 0x80) != 0) {
DeleteThisEntity();
}
}
}
if (this->child != NULL) {
this->x = this->child->x;
this->y = this->child->y;
this->z = this->child->z;
}
}