Decompile floatingPlatform

This commit is contained in:
Tal Hayon 2022-03-08 06:21:15 +02:00
parent 12e8722606
commit ea85b8e04b
6 changed files with 78 additions and 153 deletions

View File

@ -1,132 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start FloatingPlatform
FloatingPlatform: @ 0x080860C0
push {lr}
ldr r2, _080860D4 @ =gUnk_08120650
ldrb r1, [r0, #0xc]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_080860D4: .4byte gUnk_08120650
thumb_func_start sub_080860D8
sub_080860D8: @ 0x080860D8
push {r4, lr}
adds r4, r0, #0
movs r2, #1
movs r0, #1
strb r0, [r4, #0xc]
adds r0, #0xff
strh r0, [r4, #0x24]
ldrb r1, [r4, #0x18]
movs r0, #4
rsbs r0, r0, #0
ands r0, r1
orrs r0, r2
strb r0, [r4, #0x18]
ldrb r0, [r4, #0xa]
strb r0, [r4, #0x1e]
adds r2, r4, #0
adds r2, #0x29
ldrb r0, [r2]
movs r1, #7
orrs r0, r1
strb r0, [r2]
ldrb r0, [r4, #0xb]
bl GetCurrentRoomProperty
str r0, [r4, #0x54]
adds r1, r4, #0
adds r1, #0x54
adds r2, r4, #0
adds r2, #0x70
adds r0, r4, #0
bl sub_080A2CC0
pop {r4, pc}
.align 2, 0
thumb_func_start sub_0808611C
sub_0808611C: @ 0x0808611C
push {r4, lr}
adds r4, r0, #0
bl sub_08086168
adds r1, r0, #0
ldrb r0, [r4, #0xe]
cmp r0, #0
beq _0808613C
ldr r2, [r4, #0x50]
ldrb r0, [r2, #0xe]
cmp r0, #0
bne _08086144
cmp r1, #0
beq _0808613C
adds r0, #1
strb r0, [r2, #0xe]
_0808613C:
adds r0, r4, #0
bl sub_080A2BE4
b _0808614C
_08086144:
adds r0, r4, #0
movs r1, #0
bl sub_080A2BE4
_0808614C:
adds r2, r4, #0
adds r2, #0x70
ldrh r0, [r2]
subs r0, #1
strh r0, [r2]
lsls r0, r0, #0x10
cmp r0, #0
bne _08086166
adds r1, r4, #0
adds r1, #0x54
adds r0, r4, #0
bl sub_080A2CC0
_08086166:
pop {r4, pc}
thumb_func_start sub_08086168
sub_08086168: @ 0x08086168
push {r4, lr}
ldrb r1, [r0, #0xa]
lsls r1, r1, #1
ldr r2, _0808619C @ =gUnk_08120658
adds r1, r1, r2
ldr r4, _080861A0 @ =gPlayerEntity
ldrb r2, [r1]
ldrb r3, [r1, #1]
adds r1, r4, #0
bl EntityInRectRadius
cmp r0, #0
beq _080861A8
bl sub_08079F8C
cmp r0, #0
beq _080861A8
ldr r0, _080861A4 @ =gPlayerState
movs r1, #1
strb r1, [r0, #0x14]
movs r1, #0x36
ldrsh r0, [r4, r1]
cmp r0, #0
bne _080861A8
movs r0, #1
b _080861AA
.align 2, 0
_0808619C: .4byte gUnk_08120658
_080861A0: .4byte gPlayerEntity
_080861A4: .4byte gPlayerState
_080861A8:
movs r0, #0
_080861AA:
pop {r4, pc}

View File

@ -42729,11 +42729,6 @@
"start": 1181248,
"size": 8
},
{
"path": "floatingPlatform/gUnk_08120658.bin",
"start": 1181272,
"size": 8
},
{
"path": "evilSpirit/gUnk_08120678.bin",
"start": 1181304,

View File

@ -1,12 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_08120650:: @ 08120650
.4byte sub_080860D8
.4byte sub_0808611C
gUnk_08120658:: @ 08120658
.incbin "floatingPlatform/gUnk_08120658.bin"

View File

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

View File

@ -0,0 +1,72 @@
#define NENT_DEPRECATED
#include "entity.h"
#include "functions.h"
#include "object.h"
typedef struct {
Entity base;
u8 filler[0x8];
u16 unk70;
} FloatingPlatformEntity;
void sub_080860D8(FloatingPlatformEntity*);
void sub_0808611C(FloatingPlatformEntity*);
bool32 sub_08086168(FloatingPlatformEntity*);
void FloatingPlatform(Entity* this) {
static void (*const actionFuncs[])(FloatingPlatformEntity*) = {
sub_080860D8,
sub_0808611C,
};
actionFuncs[this->action]((FloatingPlatformEntity*)this);
}
void sub_080860D8(FloatingPlatformEntity* this) {
super->action = 1;
super->speed = 0x100;
super->spriteSettings.draw = 1;
super->frameIndex = super->type;
super->spritePriority.b0 = 7;
super->child = (Entity*)GetCurrentRoomProperty(super->type2);
sub_080A2CC0(super, (u16**)&super->child, &this->unk70);
}
void sub_0808611C(FloatingPlatformEntity* this) {
int iVar2;
iVar2 = sub_08086168(this);
if (super->actionDelay != 0 && super->parent->actionDelay == 0) {
if (iVar2 != 0) {
super->parent->actionDelay++;
}
sub_080A2BE4(super, iVar2);
} else if (super->actionDelay == 0) {
sub_080A2BE4(super, iVar2);
} else {
sub_080A2BE4(super, 0);
}
if (--this->unk70 == 0) {
sub_080A2CC0(super, (u16**)&super->child, &this->unk70);
}
}
bool32 sub_08086168(FloatingPlatformEntity* this) {
static const u8 gUnk_08120658[] = { 0x12, 0xa, 0xa, 0x12, 0x12, 0x12, 0x1a, 0x1a };
const u8* ptr;
ptr = gUnk_08120658 + super->type * 2;
if (((EntityInRectRadius(super, &gPlayerEntity, ptr[0], ptr[1])) && sub_08079F8C())) {
gPlayerState.field_0x14 = 1;
if (gPlayerEntity.z.HALF.HI == 0) {
return TRUE;
} else {
return FALSE;
}
} else {
return FALSE;
}
}

View File

@ -1254,8 +1254,10 @@ bool32 sub_08079F48(u32 param_1, u32 param_2) {
}
bool32 sub_08079F8C(void) {
if ((gPlayerState.flags & 0x22189b75) != 0 || gPlayerState.field_0x3c[0] != 0 || gPlayerEntity.action == 3 ||
gPlayerEntity.action == 0xb) {
if ((gPlayerState.flags &
(PL_BUSY | PL_DROWNING | PL_CAPTURED | PL_USE_PORTAL | PL_HIDDEN | PL_FROZEN | PL_FALLING | PL_DISABLE_ITEMS |
PL_FLAGS8000 | PL_IN_MINECART | PL_MOLDWORM_CAPTURED | PL_IN_HOLE | PL_FLAGS2000000 | PL_CLIMBING)) != 0 ||
gPlayerState.field_0x3c[0] != 0 || gPlayerEntity.action == 3 || gPlayerEntity.action == 0xb) {
return FALSE;
} else {
return TRUE;