Decompile Object5B

This commit is contained in:
octorock 2022-03-11 17:08:36 +01:00
parent 09ddc08f51
commit 3006233238
4 changed files with 88 additions and 172 deletions

View File

@ -1,157 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start Object5B
Object5B: @ 0x0809288C
push {lr}
adds r2, r0, #0
ldrb r1, [r2, #0x10]
movs r0, #2
ands r0, r1
cmp r0, #0
beq _080928B0
ldr r0, _080928AC @ =gUnk_0812279C
ldrb r1, [r2, #0xc]
lsls r1, r1, #2
adds r1, r1, r0
ldr r1, [r1]
adds r0, r2, #0
bl _call_via_r1
b _080928C0
.align 2, 0
_080928AC: .4byte gUnk_0812279C
_080928B0:
ldr r0, _080928C4 @ =gUnk_08122794
ldrb r1, [r2, #0xc]
lsls r1, r1, #2
adds r1, r1, r0
ldr r1, [r1]
adds r0, r2, #0
bl _call_via_r1
_080928C0:
pop {pc}
.align 2, 0
_080928C4: .4byte gUnk_08122794
thumb_func_start sub_080928C8
sub_080928C8: @ 0x080928C8
push {lr}
adds r3, r0, #0
movs r2, #1
movs r0, #1
strb r0, [r3, #0xc]
ldrb r1, [r3, #0x18]
subs r0, #5
ands r0, r1
orrs r0, r2
strb r0, [r3, #0x18]
ldrb r0, [r3, #0xa]
strb r0, [r3, #0x1e]
ldrb r0, [r3, #0x19]
movs r1, #0xc0
orrs r0, r1
strb r0, [r3, #0x19]
adds r2, r3, #0
adds r2, #0x29
ldrb r1, [r2]
movs r0, #8
rsbs r0, r0, #0
ands r0, r1
movs r1, #6
orrs r0, r1
strb r0, [r2]
ldrb r1, [r3, #0x1b]
movs r0, #0x3f
ands r0, r1
movs r1, #0x80
orrs r0, r1
strb r0, [r3, #0x1b]
ldrb r0, [r3, #0xa]
cmp r0, #2
beq _08092912
cmp r0, #4
beq _08092920
b _08092928
_08092912:
adds r0, r3, #0
movs r1, #0x5b
movs r2, #4
movs r3, #0
bl CreateObjectWithParent
b _08092928
_08092920:
ldrb r0, [r2]
movs r1, #7
orrs r0, r1
strb r0, [r2]
_08092928:
pop {pc}
.align 2, 0
thumb_func_start nullsub_119
nullsub_119: @ 0x0809292C
bx lr
.align 2, 0
thumb_func_start sub_08092930
sub_08092930: @ 0x08092930
push {r4, lr}
adds r4, r0, #0
bl sub_080928C8
adds r4, #0x82
movs r0, #0
strh r0, [r4]
pop {r4, pc}
thumb_func_start sub_08092940
sub_08092940: @ 0x08092940
push {r4, r5, lr}
adds r4, r0, #0
adds r5, r4, #0
adds r5, #0x84
ldr r1, [r5]
bl ExecuteScript
ldr r1, [r5]
adds r0, r4, #0
bl sub_08092958
pop {r4, r5, pc}
thumb_func_start sub_08092958
sub_08092958: @ 0x08092958
push {r4, lr}
adds r3, r0, #0
adds r2, r1, #0
ldr r0, [r2, #8]
cmp r0, #0
beq _0809298A
movs r4, #0
_08092966:
ldr r1, [r2, #8]
mvns r0, r1
adds r0, #1
ands r0, r1
eors r1, r0
str r1, [r2, #8]
cmp r0, #1
beq _0809297C
cmp r0, #2
beq _08092980
b _08092984
_0809297C:
strb r4, [r3, #0x1e]
b _08092984
_08092980:
ldr r0, [r2, #4]
strb r0, [r3, #0x1e]
_08092984:
ldr r0, [r2, #8]
cmp r0, #0
bne _08092966
_0809298A:
pop {r4, pc}

View File

@ -1,13 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_08122794:: @ 08122794
.4byte sub_080928C8
.4byte nullsub_119
gUnk_0812279C:: @ 0812279C
.4byte sub_08092930
.4byte sub_08092940

View File

@ -715,7 +715,7 @@ SECTIONS {
src/object/gentariCurtains.o(.text);
src/object/lavaPlatform.o(.text);
src/object/paper.o(.text);
asm/object/object5B.o(.text);
src/object/object5B.o(.text);
src/object/mask.o(.text);
src/object/houseDoorInterior.o(.text);
src/object/whirlwind.o(.text);
@ -1455,7 +1455,7 @@ SECTIONS {
src/object/lavaPlatform.o(.rodata);
data/animations/object/lavaPlatform.o(.rodata);
src/object/paper.o(.rodata);
data/const/object/object5B.o(.rodata);
src/object/object5B.o(.rodata);
data/const/object/mask.o(.rodata);
src/object/houseDoorInterior.o(.rodata);
src/object/whirlwind.o(.rodata);

86
src/object/object5B.c Normal file
View File

@ -0,0 +1,86 @@
/**
* @file object5B.c
* @ingroup Objects
*
* @brief Object5B object
*/
#define NENT_DEPRECATED
#include "global.h"
#include "object.h"
#include "functions.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unk_68[0x1a];
/*0x82*/ u16 unk_82;
/*0x84*/ ScriptExecutionContext* unk_84;
} Object5BEntity;
void sub_080928C8(Object5BEntity*);
void nullsub_119(Object5BEntity*);
void sub_08092930(Object5BEntity*);
void sub_08092940(Object5BEntity*);
void sub_08092958(Object5BEntity*, ScriptExecutionContext*);
void Object5B(Object5BEntity* this) {
static void (*const gUnk_08122794[])(Object5BEntity*) = {
sub_080928C8,
nullsub_119,
};
static void (*const gUnk_0812279C[])(Object5BEntity*) = {
sub_08092930,
sub_08092940,
};
if ((super->flags & 2) != 0) {
gUnk_0812279C[super->action](this);
} else {
gUnk_08122794[super->action](this);
}
}
void sub_080928C8(Object5BEntity* this) {
super->action = 1;
super->spriteSettings.draw = 1;
super->frameIndex = super->type;
super->spriteRendering.b3 = 3;
super->spritePriority.b0 = 6;
super->spriteOrientation.flipY = 2;
switch (super->type) {
case 2:
CreateObjectWithParent(super, OBJECT_5B, 4, 0);
break;
case 4:
super->spritePriority.b0 = 7;
break;
}
}
void nullsub_119(Object5BEntity* this) {
}
void sub_08092930(Object5BEntity* this) {
sub_080928C8(this);
this->unk_82 = 0;
}
void sub_08092940(Object5BEntity* this) {
ExecuteScript(super, this->unk_84);
sub_08092958(this, this->unk_84);
}
void sub_08092958(Object5BEntity* this, ScriptExecutionContext* context) {
u32 tmp;
while (context->postScriptActions != 0) {
tmp = (~context->postScriptActions + 1) & context->postScriptActions;
context->postScriptActions = context->postScriptActions ^ tmp;
switch (tmp) {
case 1:
super->frameIndex = 0;
break;
case 2:
super->frameIndex = context->intVariable;
break;
}
}
}