Decompile object53

This commit is contained in:
Tal Hayon 2022-03-13 11:39:30 +02:00
parent 875049f3ce
commit c70e86a8d8
5 changed files with 66 additions and 147 deletions

View File

@ -1,128 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start Object53
Object53: @ 0x08091108
push {lr}
ldr r2, _0809111C @ =gUnk_08122280
ldrb r1, [r0, #0xc]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_0809111C: .4byte gUnk_08122280
thumb_func_start sub_08091120
sub_08091120: @ 0x08091120
push {r4, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xc]
adds r0, #1
strb r0, [r4, #0xc]
ldr r3, _08091194 @ =gUnk_08122288
ldrb r0, [r4, #0xa]
lsls r0, r0, #2
adds r0, r0, r3
ldrb r1, [r0, #2]
adds r0, r4, #0
adds r0, #0x60
strh r1, [r0]
ldrb r0, [r4, #0xa]
lsls r0, r0, #2
adds r0, r0, r3
ldrb r1, [r0, #1]
movs r0, #0xf
ands r1, r0
ldrb r2, [r4, #0x1a]
movs r0, #0x10
rsbs r0, r0, #0
ands r0, r2
orrs r0, r1
strb r0, [r4, #0x1a]
ldrb r0, [r4, #0xa]
lsls r0, r0, #2
adds r0, r0, r3
ldrb r0, [r0, #3]
strh r0, [r4, #0x12]
ldrb r1, [r4, #0x18]
movs r0, #4
rsbs r0, r0, #0
ands r0, r1
movs r1, #1
orrs r0, r1
strb r0, [r4, #0x18]
ldrb r1, [r4, #0x19]
movs r0, #0x3f
ands r0, r1
movs r1, #0x80
orrs r0, r1
strb r0, [r4, #0x19]
movs r0, #0xa8
lsls r0, r0, #0xa
str r0, [r4, #0x20]
ldrb r0, [r4, #0xa]
lsls r0, r0, #2
adds r0, r0, r3
ldrb r1, [r0]
adds r0, r4, #0
bl InitializeAnimation
adds r0, r4, #0
bl sub_08004168
pop {r4, pc}
.align 2, 0
_08091194: .4byte gUnk_08122288
thumb_func_start sub_08091198
sub_08091198: @ 0x08091198
push {r4, lr}
adds r4, r0, #0
ldr r0, [r4, #0x20]
cmp r0, #0
bge _080911AA
ldrb r0, [r4, #0x18]
movs r1, #0x80
orrs r0, r1
strb r0, [r4, #0x18]
_080911AA:
movs r1, #0x80
lsls r1, r1, #6
adds r0, r4, #0
bl GravityUpdate
cmp r0, #0
bne _080911E8
ldrb r1, [r4, #0xb]
cmp r1, #0xf
beq _080911CE
cmp r1, #0xf
bgt _080911C8
cmp r1, #0
beq _080911E4
b _080911DA
_080911C8:
cmp r1, #0xff
bne _080911DA
b _080911E4
_080911CE:
ldrb r1, [r4, #0xe]
adds r0, r4, #0
movs r2, #0x80
bl CreateFx
b _080911E4
_080911DA:
ldrb r2, [r4, #0xe]
adds r0, r4, #0
movs r3, #0
bl CreateObjectWithParent
_080911E4:
bl DeleteThisEntity
_080911E8:
pop {r4, pc}
.align 2, 0

View File

@ -43547,11 +43547,6 @@
"start": 1188444,
"size": 8
},
{
"path": "object53/gUnk_08122288.bin",
"start": 1188488,
"size": 12
},
{
"path": "animations/gSpriteAnimations_PullableLever_0.bin",
"start": 1188548,

View File

@ -1,12 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_08122280:: @ 08122280
.4byte sub_08091120
.4byte sub_08091198
gUnk_08122288:: @ 08122288
.incbin "object53/gUnk_08122288.bin"

View File

@ -706,7 +706,7 @@ SECTIONS {
src/object/giantRock.o(.text);
src/object/giantRock2.o(.text);
src/object/object52.o(.text);
asm/object/object53.o(.text);
src/object/object53.o(.text);
src/object/pullableLever.o(.text);
src/object/minecart.o(.text);
asm/object/minecart.o(.text);
@ -1442,7 +1442,7 @@ SECTIONS {
data/const/object/minishSizedEntrance.o(.rodata);
data/animations/object/minishSizedEntrance.o(.rodata);
src/object/giantRock2.o(.rodata);
data/const/object/object53.o(.rodata);
src/object/object53.o(.rodata);
src/object/pullableLever.o(.rodata);
data/animations/object/pullableLever.o(.rodata);
data/const/object/minecart.o(.rodata);

64
src/object/object53.c Normal file
View File

@ -0,0 +1,64 @@
#define NENT_DEPRECATED
#include "entity.h"
#include "functions.h"
#include "asm.h"
void sub_08091120(Entity*);
void sub_08091198(Entity*);
void Object53(Entity* this) {
static void (*const actionFuncs[])(Entity*) = {
sub_08091120,
sub_08091198,
};
actionFuncs[this->action]((Entity*)this);
}
typedef struct {
u8 animationState;
u8 palette;
u8 spriteVramOffset;
u8 spriteIndex;
} gUnk_08122288_struct;
void sub_08091120(Entity* this) {
static const gUnk_08122288_struct gUnk_08122288[] = { { 0x0, 0x2, 0xe8, 0xa7 },
{ 0x0, 0x5, 0xe0, 0xa7 },
{ 0x0, 0x5, 0xf2, 0xa7 } };
u32 temp;
this->action++;
this->spriteVramOffset = gUnk_08122288[this->type].spriteVramOffset;
temp = gUnk_08122288[this->type].palette;
this->palette.b.b0 = temp;
this->spriteIndex = gUnk_08122288[this->type].spriteIndex;
this->spriteSettings.draw = 1;
this->spriteRendering.b3 = 2;
this->zVelocity = 0x2a000;
InitializeAnimation(this, gUnk_08122288[this->type].animationState);
sub_08004168(this);
}
void sub_08091198(Entity* this) {
if (this->zVelocity < 0) {
this->spriteSettings.flipY = 1;
}
if (GravityUpdate(this, 0x2000)) {
return;
}
switch ((u8)this->type2) {
case 0:
case 0xff:
break;
case 0xf:
CreateFx(this, this->actionDelay, 0x80);
break;
default:
CreateObjectWithParent(this, this->type2, this->actionDelay, 0);
break;
}
DeleteThisEntity();
}