Decompile Object35

This commit is contained in:
octorock 2022-02-27 21:27:41 +01:00
parent 54767a1595
commit 754b3eb760
5 changed files with 183 additions and 403 deletions

View File

@ -1,373 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start Object35
Object35: @ 0x0808B86C
push {lr}
ldr r2, _0808B880 @ =gUnk_081213C4
ldrb r1, [r0, #0xa]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_0808B880: .4byte gUnk_081213C4
thumb_func_start sub_0808B884
sub_0808B884: @ 0x0808B884
push {lr}
ldr r2, _0808B898 @ =gUnk_081213D0
ldrb r1, [r0, #0xc]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_0808B898: .4byte gUnk_081213D0
thumb_func_start sub_0808B89C
sub_0808B89C: @ 0x0808B89C
push {r4, lr}
adds r4, r0, #0
movs r0, #2
strb r0, [r4, #0xc]
strb r0, [r4, #0xb]
adds r1, r4, #0
adds r1, #0x38
strb r0, [r1]
adds r0, r4, #0
bl UpdateSpriteForCollisionLayer
adds r2, r4, #0
adds r2, #0x29
ldrb r1, [r2]
movs r0, #8
rsbs r0, r0, #0
ands r0, r1
movs r1, #1
orrs r0, r1
strb r0, [r2]
movs r0, #0xb4
strb r0, [r4, #0xe]
ldrb r1, [r4, #0xb]
adds r0, r4, #0
bl InitializeAnimation
pop {r4, pc}
.align 2, 0
thumb_func_start sub_0808B8D4
sub_0808B8D4: @ 0x0808B8D4
push {r4, lr}
adds r4, r0, #0
bl GetNextFrame
ldrb r0, [r4, #0xe]
subs r0, #1
strb r0, [r4, #0xe]
lsls r0, r0, #0x18
cmp r0, #0
bne _0808B904
movs r0, #0xb4
strb r0, [r4, #0xe]
ldrb r0, [r4, #0xb]
adds r0, #1
strb r0, [r4, #0xb]
ldrb r0, [r4, #0xb]
movs r1, #3
bl __modsi3
strb r0, [r4, #0xb]
ldrb r1, [r4, #0xb]
adds r0, r4, #0
bl InitializeAnimation
_0808B904:
pop {r4, pc}
.align 2, 0
thumb_func_start sub_0808B908
sub_0808B908: @ 0x0808B908
push {lr}
bl GetNextFrame
pop {pc}
thumb_func_start sub_0808B910
sub_0808B910: @ 0x0808B910
push {lr}
ldr r2, _0808B92C @ =gUnk_081213DC
ldrb r1, [r0, #0xc]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
ldr r2, _0808B930 @ =gPlayerState
ldrb r1, [r2, #0x1a]
movs r0, #0x80
orrs r0, r1
strb r0, [r2, #0x1a]
pop {pc}
.align 2, 0
_0808B92C: .4byte gUnk_081213DC
_0808B930: .4byte gPlayerState
thumb_func_start sub_0808B934
sub_0808B934: @ 0x0808B934
push {r4, r5, r6, r7, lr}
adds r4, r0, #0
movs r7, #0
movs r0, #0xc0
lsls r0, r0, #2
strh r0, [r4, #0x24]
strb r7, [r4, #0x1e]
ldrh r1, [r4, #0x2e]
adds r0, r4, #0
adds r0, #0x70
strh r1, [r0]
ldrh r0, [r4, #0x32]
adds r1, r4, #0
adds r1, #0x72
strh r0, [r1]
adds r2, r4, #0
adds r2, #0x29
ldrb r1, [r2]
movs r0, #8
rsbs r0, r0, #0
ands r0, r1
movs r1, #5
orrs r0, r1
strb r0, [r2]
movs r0, #0x2e
ldrsh r1, [r4, r0]
ldr r2, _0808B9B8 @ =gRoomControls
ldrh r0, [r2, #6]
subs r1, r1, r0
asrs r1, r1, #4
movs r3, #0x3f
ands r1, r3
movs r5, #0x32
ldrsh r0, [r4, r5]
ldrh r2, [r2, #8]
subs r0, r0, r2
asrs r0, r0, #4
ands r0, r3
lsls r0, r0, #6
orrs r1, r0
adds r5, r4, #0
adds r5, #0x76
strh r1, [r5]
ldrh r0, [r5]
adds r6, r4, #0
adds r6, #0x38
ldrb r1, [r6]
bl GetTileIndex
adds r1, r4, #0
adds r1, #0x74
strh r0, [r1]
ldrb r0, [r4, #0xe]
cmp r0, #0
bne _0808B9C0
movs r0, #1
strb r0, [r4, #0xc]
movs r0, #0x78
strb r0, [r4, #0xf]
ldr r0, _0808B9BC @ =0x00004022
ldrh r1, [r5]
ldrb r2, [r6]
bl SetTile
b _0808B9D2
.align 2, 0
_0808B9B8: .4byte gRoomControls
_0808B9BC: .4byte 0x00004022
_0808B9C0:
movs r0, #3
strb r0, [r4, #0xc]
ldrb r1, [r4, #0x18]
subs r0, #7
ands r0, r1
movs r1, #0x80
orrs r0, r1
strb r0, [r4, #0x18]
strb r7, [r4, #0xe]
_0808B9D2:
pop {r4, r5, r6, r7, pc}
thumb_func_start sub_0808B9D4
sub_0808B9D4: @ 0x0808B9D4
push {r4, lr}
adds r4, r0, #0
movs r0, #0
bl CheckRoomFlag
cmp r0, #0
beq _0808BA0A
movs r1, #0
movs r0, #2
strb r0, [r4, #0xc]
movs r0, #7
strb r0, [r4, #0xe]
strb r1, [r4, #0x15]
adds r0, r4, #0
adds r0, #0x74
ldrh r0, [r0]
adds r1, r4, #0
adds r1, #0x76
ldrh r1, [r1]
adds r2, r4, #0
adds r2, #0x38
ldrb r2, [r2]
bl SetTile
ldr r0, _0808BA0C @ =0x0000010B
bl EnqueueSFX
_0808BA0A:
pop {r4, pc}
.align 2, 0
_0808BA0C: .4byte 0x0000010B
thumb_func_start sub_0808BA10
sub_0808BA10: @ 0x0808BA10
push {r4, lr}
adds r4, r0, #0
bl LinearMoveUpdate
ldrb r0, [r4, #0xe]
subs r0, #1
strb r0, [r4, #0xe]
lsls r0, r0, #0x18
cmp r0, #0
bne _0808BA44
movs r0, #5
strb r0, [r4, #0xc]
movs r0, #8
strb r0, [r4, #0xe]
ldrb r1, [r4, #0x18]
subs r0, #0xc
ands r0, r1
strb r0, [r4, #0x18]
adds r0, r4, #0
adds r0, #0x70
ldrh r0, [r0]
strh r0, [r4, #0x2e]
adds r0, r4, #0
adds r0, #0x72
ldrh r0, [r0]
strh r0, [r4, #0x32]
_0808BA44:
pop {r4, pc}
.align 2, 0
thumb_func_start sub_0808BA48
sub_0808BA48: @ 0x0808BA48
push {r4, lr}
adds r4, r0, #0
movs r1, #2
bl sub_08083734
cmp r0, #0
beq _0808BA68
movs r0, #4
strb r0, [r4, #0xc]
adds r0, r4, #0
adds r0, #0x76
ldrh r2, [r0]
adds r0, r4, #0
movs r1, #2
bl sub_080836DC
_0808BA68:
pop {r4, pc}
.align 2, 0
thumb_func_start sub_0808BA6C
sub_0808BA6C: @ 0x0808BA6C
push {r4, lr}
adds r4, r0, #0
bl LinearMoveUpdate
ldrb r0, [r4, #0xe]
subs r0, #1
strb r0, [r4, #0xe]
lsls r0, r0, #0x18
cmp r0, #0
bne _0808BAA4
movs r0, #5
strb r0, [r4, #0xc]
adds r0, r4, #0
movs r1, #2
bl sub_08083814
ldr r0, _0808BAA8 @ =0x0000010B
bl EnqueueSFX
ldr r0, _0808BAAC @ =0x00004022
adds r1, r4, #0
adds r1, #0x76
ldrh r1, [r1]
adds r2, r4, #0
adds r2, #0x38
ldrb r2, [r2]
bl SetTile
_0808BAA4:
pop {r4, pc}
.align 2, 0
_0808BAA8: .4byte 0x0000010B
_0808BAAC: .4byte 0x00004022
thumb_func_start nullsub_520
nullsub_520: @ 0x0808BAB0
bx lr
.align 2, 0
thumb_func_start sub_0808BAB4
sub_0808BAB4: @ 0x0808BAB4
push {lr}
ldr r2, _0808BAC8 @ =gUnk_081213F4
ldrb r1, [r0, #0xc]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_0808BAC8: .4byte gUnk_081213F4
thumb_func_start sub_0808BACC
sub_0808BACC: @ 0x0808BACC
push {r4, lr}
adds r2, r0, #0
movs r4, #1
strb r4, [r2, #0xc]
movs r3, #0x10
strb r3, [r2, #0xe]
ldrh r0, [r2, #0x36]
subs r0, #0x10
strh r0, [r2, #0x36]
ldrb r0, [r2, #0xb]
cmp r0, #0
bne _0808BAEA
movs r0, #2
strb r0, [r2, #0x1e]
b _0808BAFC
_0808BAEA:
movs r0, #0
strb r0, [r2, #0x1e]
ldr r0, [r2, #0x50]
ldrh r1, [r0, #0x2e]
adds r0, r3, #0
ands r0, r1
cmp r0, #0
beq _0808BAFC
strb r4, [r2, #0x1e]
_0808BAFC:
adds r0, r2, #0
bl CreateDust
pop {r4, pc}
thumb_func_start sub_0808BB04
sub_0808BB04: @ 0x0808BB04
push {lr}
ldrb r1, [r0, #0xe]
subs r1, #1
strb r1, [r0, #0xe]
lsls r1, r1, #0x18
cmp r1, #0
bne _0808BB16
bl DeleteThisEntity
_0808BB16:
pop {pc}

View File

@ -1,27 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_081213C4:: @ 081213C4
.4byte sub_0808B884
.4byte sub_0808B910
.4byte sub_0808BAB4
gUnk_081213D0:: @ 081213D0
.4byte sub_0808B89C
.4byte sub_0808B8D4
.4byte sub_0808B908
gUnk_081213DC:: @ 081213DC
.4byte sub_0808B934
.4byte sub_0808B9D4
.4byte sub_0808BA10
.4byte sub_0808BA48
.4byte sub_0808BA6C
.4byte nullsub_520
gUnk_081213F4:: @ 081213F4
.4byte sub_0808BACC
.4byte sub_0808BB04

View File

@ -279,7 +279,7 @@ void FrozenFlower(Entity*);
void PullableMushroom();
void Bollard(Entity*);
void WarpPoint(Entity*);
void Object35(Entity*);
void Object35();
void Object36(Entity*);
void Object37(Entity*);
void JarPortal(Entity*);

View File

@ -695,7 +695,7 @@ SECTIONS {
src/object/pullableMushroom.o(.text);
asm/object/bollard.o(.text);
src/object/warpPoint.o(.text);
asm/object/object35.o(.text);
src/object/object35.o(.text);
asm/object/object36.o(.text);
asm/object/object37.o(.text);
src/object/jarPortal.o(.text);
@ -1428,7 +1428,7 @@ SECTIONS {
data/animations/object/bollard.o(.rodata);
src/object/warpPoint.o(.rodata);
data/animations/object/warpPoint.o(.rodata);
data/const/object/object35.o(.rodata);
src/object/object35.o(.rodata);
data/animations/object/object35.o(.rodata);
data/const/object/object36.o(.rodata);
data/const/object/object37.o(.rodata);

180
src/object/object35.c Normal file
View File

@ -0,0 +1,180 @@
/**
* @file object35.c
* @ingroup Objects
*
* @brief Object35 object
*/
#define NENT_DEPRECATED
#include "global.h"
#include "object.h"
#include "functions.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unk_68[8];
/*0x70*/ u16 unk_70;
/*0x72*/ u16 unk_72;
/*0x74*/ u16 unk_74;
/*0x76*/ u16 unk_76;
} Object35Entity;
extern void sub_080836DC(Entity*, u32, u32); // lockedDoor
extern void sub_08083814(Entity*, u32); // lockedDoor
void Object35_Type0(Object35Entity*);
void Object35_Type1(Object35Entity*);
void Object35_Type2(Object35Entity*);
void Object35_Type0Init(Object35Entity*);
void Object35_Type0Action1(Object35Entity*);
void Object35_Type0Action2(Object35Entity*);
void Object35_Type1Init(Object35Entity*);
void Object35_Type1Action1(Object35Entity*);
void Object35_Type1Action2(Object35Entity*);
void Object35_Type1Action3(Object35Entity*);
void Object35_Type1Action4(Object35Entity*);
void Object35_Type1Action5(Object35Entity*);
void Object35_Type2Init(Object35Entity*);
void Object35_Type2Action1(Object35Entity*);
void Object35(Object35Entity* this) {
static void (*const Object35_Types[])(Object35Entity*) = {
Object35_Type0,
Object35_Type1,
Object35_Type2,
};
Object35_Types[super->type](this);
}
void Object35_Type0(Object35Entity* this) {
static void (*const Object35_Type0Actions[])(Object35Entity*) = {
Object35_Type0Init,
Object35_Type0Action1,
Object35_Type0Action2,
};
Object35_Type0Actions[super->action](this);
}
void Object35_Type0Init(Object35Entity* this) {
super->action = 2;
super->type2 = 2;
super->collisionLayer = 2;
UpdateSpriteForCollisionLayer(super);
super->spritePriority.b0 = 1;
super->actionDelay = -0x4c;
InitializeAnimation(super, super->type2);
}
void Object35_Type0Action1(Object35Entity* this) {
s8 tmp;
GetNextFrame(super);
if (--super->actionDelay == 0) {
super->actionDelay = -0x4c;
super->type2++;
tmp = 3;
super->type2 = super->type2 % tmp;
InitializeAnimation(super, super->type2);
}
}
void Object35_Type0Action2(Object35Entity* this) {
GetNextFrame(super);
}
void Object35_Type1(Object35Entity* this) {
static void (*const Object35_Type1Actions[])(Object35Entity*) = {
Object35_Type1Init, Object35_Type1Action1, Object35_Type1Action2,
Object35_Type1Action3, Object35_Type1Action4, Object35_Type1Action5,
};
Object35_Type1Actions[super->action](this);
gPlayerState.mobility |= 0x80;
}
void Object35_Type1Init(Object35Entity* this) {
super->speed = 0x300;
super->frameIndex = 0;
this->unk_70 = super->x.HALF.HI;
this->unk_72 = super->y.HALF.HI;
super->spritePriority.b0 = 5;
this->unk_76 = COORD_TO_TILE(super);
this->unk_74 = GetTileIndex(this->unk_76, super->collisionLayer);
if (super->actionDelay == 0) {
super->action = 1;
super->field_0xf = 0x78;
SetTile(0x4022, this->unk_76, super->collisionLayer);
} else {
super->action = 3;
super->spriteSettings.draw = 0;
super->spriteSettings.flipY = 1;
super->actionDelay = 0;
}
}
void Object35_Type1Action1(Object35Entity* this) {
if (CheckRoomFlag(0)) {
super->action = 2;
super->actionDelay = 7;
super->direction = 0;
SetTile(this->unk_74, this->unk_76, super->collisionLayer);
EnqueueSFX(SFX_10B);
}
}
void Object35_Type1Action2(Object35Entity* this) {
LinearMoveUpdate(super);
if (--super->actionDelay == 0) {
super->action = 5;
super->actionDelay = 8;
super->spriteSettings.draw = 0;
super->x.HALF.HI = this->unk_70;
super->y.HALF.HI = this->unk_72;
}
}
void Object35_Type1Action3(Object35Entity* this) {
if (sub_08083734(super, 2)) {
super->action = 4;
sub_080836DC(super, 2, this->unk_76);
}
}
void Object35_Type1Action4(Object35Entity* this) {
LinearMoveUpdate(super);
if (--super->actionDelay == 0) {
super->action = 5;
sub_08083814(super, 2);
EnqueueSFX(SFX_10B);
SetTile(0x4022, this->unk_76, super->collisionLayer);
}
}
void Object35_Type1Action5(Object35Entity* this) {
}
void Object35_Type2(Object35Entity* this) {
static void (*const Object35_Type2Actions[])(Object35Entity*) = {
Object35_Type2Init,
Object35_Type2Action1,
};
Object35_Type2Actions[super->action](this);
}
void Object35_Type2Init(Object35Entity* this) {
super->action = 1;
super->actionDelay = 0x10;
super->z.HALF.HI -= 0x10;
if (super->type2 == 0) {
super->frameIndex = 2;
} else {
super->frameIndex = 0;
if (((super->parent)->x.HALF.HI & 0x10) != 0) {
super->frameIndex = 1;
}
}
CreateDust(super);
}
void Object35_Type2Action1(Object35Entity* this) {
if (--super->actionDelay == 0) {
DeleteThisEntity();
}
}