Decompile houseDoorInterior

This commit is contained in:
Tal Hayon 2022-03-05 21:23:26 +02:00
parent 6206ff831a
commit 51aeb674cc
26 changed files with 135 additions and 228 deletions

View File

@ -1,163 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start HouseDoorInterior
HouseDoorInterior: @ 0x08092B74
push {lr}
ldr r2, _08092B88 @ =gUnk_081227C0
ldrb r1, [r0, #0xc]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_08092B88: .4byte gUnk_081227C0
thumb_func_start sub_08092B8C
sub_08092B8C: @ 0x08092B8C
push {r4, lr}
adds r4, r0, #0
adds r1, r4, #0
adds r1, #0x86
ldrh r0, [r1]
cmp r0, #0
beq _08092BA6
bl CheckFlags
cmp r0, #0
beq _08092BA6
bl DeleteThisEntity
_08092BA6:
movs r2, #1
movs r0, #1
strb r0, [r4, #0xc]
ldrb r1, [r4, #0x18]
subs r0, #5
ands r0, r1
orrs r0, r2
strb r0, [r4, #0x18]
ldrb r0, [r4, #0xe]
adds r1, r4, #0
adds r1, #0x7d
strb r0, [r1]
adds r2, r4, #0
adds r2, #0x29
ldrb r0, [r2]
movs r1, #7
orrs r0, r1
strb r0, [r2]
ldr r0, _08092BE8 @ =gUnk_081227EC
str r0, [r4, #0x48]
movs r0, #8
strb r0, [r4, #0xe]
ldrb r0, [r4, #0xa]
lsls r0, r0, #1
ldr r1, _08092BEC @ =gUnk_081227B4
adds r2, r0, r1
ldrb r1, [r2]
adds r0, r1, #0
cmp r0, #0xff
bne _08092BF0
ldrb r0, [r4, #0xb]
strb r0, [r4, #0x1e]
b _08092BF6
.align 2, 0
_08092BE8: .4byte gUnk_081227EC
_08092BEC: .4byte gUnk_081227B4
_08092BF0:
strb r1, [r4, #0x1e]
ldrb r0, [r2, #1]
strb r0, [r4, #0xb]
_08092BF6:
pop {r4, pc}
thumb_func_start sub_08092BF8
sub_08092BF8: @ 0x08092BF8
push {r4, r5, lr}
adds r4, r0, #0
adds r1, r4, #0
adds r1, #0x86
ldrh r0, [r1]
cmp r0, #0
beq _08092C20
bl CheckFlags
cmp r0, #0
beq _08092C20
movs r0, #2
strb r0, [r4, #0xc]
ldr r0, _08092C1C @ =0x00000111
bl SoundReq
b _08092C92
.align 2, 0
_08092C1C: .4byte 0x00000111
_08092C20:
adds r0, r4, #0
bl sub_0800445C
cmp r0, #0
beq _08092C74
adds r0, r4, #0
adds r0, #0x7d
ldrb r0, [r0]
cmp r0, #0
bne _08092C74
ldrb r0, [r4, #0xb]
lsls r0, r0, #3
ldr r1, _08092C68 @ =gUnk_081227CC
adds r5, r0, r1
ldrh r1, [r5, #4]
ldrh r2, [r5, #6]
adds r0, r4, #0
bl sub_0806ED9C
cmp r0, #0
blt _08092C78
ldr r1, _08092C6C @ =gPlayerEntity
ldrh r0, [r5]
ldrb r1, [r1, #0x14]
cmp r0, r1
bne _08092C78
ldr r0, _08092C70 @ =gPlayerState
adds r0, #0x90
ldrh r1, [r0]
ldrh r0, [r5, #2]
ands r0, r1
cmp r0, #0
beq _08092C78
ldrb r0, [r4, #0xe]
subs r0, #1
b _08092C76
.align 2, 0
_08092C68: .4byte gUnk_081227CC
_08092C6C: .4byte gPlayerEntity
_08092C70: .4byte gPlayerState
_08092C74:
movs r0, #8
_08092C76:
strb r0, [r4, #0xe]
_08092C78:
ldrb r0, [r4, #0xe]
cmp r0, #0
bne _08092C92
movs r0, #2
strb r0, [r4, #0xc]
movs r0, #8
movs r1, #0
movs r2, #0
bl sub_08078AC0
ldr r0, _08092C94 @ =0x00000111
bl SoundReq
_08092C92:
pop {r4, r5, pc}
.align 2, 0
_08092C94: .4byte 0x00000111
thumb_func_start sub_08092C98
sub_08092C98: @ 0x08092C98
push {lr}
bl DeleteThisEntity
pop {pc}

View File

@ -44081,21 +44081,6 @@
"size": 4,
"type": "animation"
},
{
"path": "houseDoorInterior/gUnk_081227B4.bin",
"start": 1189812,
"size": 12
},
{
"path": "houseDoorInterior/gUnk_081227CC.bin",
"start": 1189836,
"size": 32
},
{
"path": "houseDoorInterior/gUnk_081227EC.bin",
"start": 1189868,
"size": 8
},
{
"path": "animations/gSpriteAnimations_Whirlwind_0.bin",
"start": 1189888,

View File

@ -1,20 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_081227B4:: @ 081227B4
.incbin "houseDoorInterior/gUnk_081227B4.bin"
gUnk_081227C0:: @ 081227C0
.4byte sub_08092B8C
.4byte sub_08092BF8
.4byte sub_08092C98
gUnk_081227CC:: @ 081227CC
.incbin "houseDoorInterior/gUnk_081227CC.bin"
gUnk_081227EC:: @ 081227EC
.incbin "houseDoorInterior/gUnk_081227EC.bin"

View File

@ -22,9 +22,9 @@
void sub_0806EC20(Entity* ent);
void sub_0806EC38(void);
u32 sub_0806ED78(Entity* ent);
s32 sub_0806ED9C(Entity*, u32, u32);
s32 GetAnimationStateInRectRadius(Entity*, u32, u32);
u32 GetAnimationState(Entity* ent);
s32 sub_0806EDD8(Entity* ent, u32 x, u32 y);
s32 GetFacingDirectionInRectRadius(Entity* ent, u32 x, u32 y);
void sub_0806EE04(Entity* ent, void* a2, u32 a3);
u32 sub_0806EE20(Entity* ent);
s32 sub_0806F078(Entity* ent, s32 a2);

View File

@ -718,7 +718,7 @@ SECTIONS {
asm/object/paper.o(.text);
asm/object/object5B.o(.text);
src/object/mask.o(.text);
asm/object/houseDoorInterior.o(.text);
src/object/houseDoorInterior.o(.text);
src/object/whirlwind.o(.text);
asm/object/objectBlockingStairs.o(.text);
src/object/swordsmanNewsletter.o(.text);
@ -1461,7 +1461,7 @@ SECTIONS {
data/const/object/paper.o(.rodata);
data/const/object/object5B.o(.rodata);
data/const/object/mask.o(.rodata);
data/const/object/houseDoorInterior.o(.rodata);
src/object/houseDoorInterior.o(.rodata);
src/object/whirlwind.o(.rodata);
data/animations/object/whirlwind.o(.rodata);
data/const/object/objectBlockingStairs.o(.rodata);

View File

@ -78,7 +78,7 @@ void sub_08063390(Entity* this) {
s32 sub_080633C8(Entity* this) {
s32 uVar1;
uVar1 = sub_0806ED9C(this, 0x20, 0x20);
uVar1 = GetAnimationStateInRectRadius(this, 0x20, 0x20);
if (uVar1 < 0) {
uVar1 = this->animIndex;
}

View File

@ -70,7 +70,7 @@ void sub_08068A4C(Entity* this) {
s32 uVar1;
s32 iVar2;
uVar1 = sub_0806ED9C(this, 0x28, 0x28);
uVar1 = GetAnimationStateInRectRadius(this, 0x28, 0x28);
if (uVar1 < 0) {
uVar1 = 2;
} else {

View File

@ -36,7 +36,7 @@ void sub_0806355C(Entity* this) {
}
void sub_08063584(Entity* this) {
if (sub_0806ED9C(this, 0x20, 0x20) >= 0) {
if (GetAnimationStateInRectRadius(this, 0x20, 0x20) >= 0) {
if (this->field_0xf == 0) {
if ((Random() & 0x3f) == 0) {
this->field_0xf = 1;

View File

@ -104,7 +104,7 @@ void sub_08060158(Entity* this) {
this->actionDelay--;
} else {
this->actionDelay = 2;
index = sub_0806EDD8(this, 0x20, 0x20);
index = GetFacingDirectionInRectRadius(this, 0x20, 0x20);
if (index < 0) {
int state = this->field_0x68.HALF.HI;
this->animationState = state;

View File

@ -44,7 +44,7 @@ void sub_080697C4(Entity* this) {
void sub_080697EC(Entity* this) {
s32 tmp;
tmp = sub_0806ED9C(this, 0x20, 0x20);
tmp = GetAnimationStateInRectRadius(this, 0x20, 0x20);
if (tmp >= 0) {
if (this->field_0xf == 0) {
this->field_0xf = 0x10;

View File

@ -29,7 +29,7 @@ void sub_08069328(Entity* this) {
int action;
this->field_0xf = 0;
action = sub_0806ED9C(this, 40, 40);
action = GetAnimationStateInRectRadius(this, 40, 40);
if (action >= 0) {
this->animationState = action;
}

View File

@ -38,7 +38,7 @@ void sub_080695AC(Entity* this) {
if (++this->field_0xf > 0x10) {
this->field_0xf = 0;
iVar2 = sub_0806ED9C(this, 0x28, 0x28);
iVar2 = GetAnimationStateInRectRadius(this, 0x28, 0x28);
if (iVar2 > -1) {
this->animationState = iVar2;
}

View File

@ -33,7 +33,7 @@ void sub_08066654(Entity* this) {
}
void sub_08066688(Entity* this) {
s32 tmp = sub_0806ED9C(this, 0x28, 0x28);
s32 tmp = GetAnimationStateInRectRadius(this, 0x28, 0x28);
if (tmp < 0) {
tmp = 2;
} else {

View File

@ -30,7 +30,7 @@ void sub_08068708(Entity* this) {
void sub_08068730(Entity* this) {
s32 animIndex;
animIndex = sub_0806ED9C(this, 0x20, 0x20);
animIndex = GetAnimationStateInRectRadius(this, 0x20, 0x20);
if (-1 < animIndex) {
if (this->field_0xf == 0) {
this->field_0xf = 0x10;
@ -123,7 +123,7 @@ void sub_08068910(Entity* this) {
} else {
this->actionDelay = 0x10;
if ((this->frame & 0x20) != 0) {
iVar1 = sub_0806EDD8(this, 0x30, 0x30);
iVar1 = GetFacingDirectionInRectRadius(this, 0x30, 0x30);
if (iVar1 < 0) {
iVar1 = 0x10;
} else {

View File

@ -26,7 +26,7 @@ void sub_080667E4(Entity* this) {
}
void sub_08066808(Entity* this) {
s32 tmp = sub_0806ED9C(this, 0x28, 0x28);
s32 tmp = GetAnimationStateInRectRadius(this, 0x28, 0x28);
if (tmp < 0) {
tmp = 2;
} else {

View File

@ -65,7 +65,7 @@ void sub_08067E60(Entity* this) {
void sub_08067E88(Entity* this) {
s32 tmp;
tmp = sub_0806ED9C(this, 0x28, 0x28);
tmp = GetAnimationStateInRectRadius(this, 0x28, 0x28);
if (tmp < 0) {
tmp = 2;
} else {
@ -195,7 +195,7 @@ void sub_0806811C(Entity* this) {
this->actionDelay--;
} else {
this->actionDelay = 2;
iVar4 = sub_0806EDD8(this, 0x20, 0x20);
iVar4 = GetFacingDirectionInRectRadius(this, 0x20, 0x20);
if (iVar4 < 0) {
type = this->type;
this->animationState = type;

View File

@ -25,7 +25,7 @@ static void sub_080669DC(Entity* this) {
s32 sVar1;
s32 sVar2;
sVar1 = sub_0806ED9C(this, 0x28, 0x28);
sVar1 = GetAnimationStateInRectRadius(this, 0x28, 0x28);
if (sVar1 < 0) {
sVar1 = 2;
} else {

View File

@ -38,7 +38,7 @@ void sub_08063A98(Entity* this) {
}
void sub_08063AC0(Entity* this) {
if (sub_0806ED9C(this, 0x20, 0x20) >= 0) {
if (GetAnimationStateInRectRadius(this, 0x20, 0x20) >= 0) {
if (this->field_0xf == 0) {
if ((Random() & 0x3f) == 0) {
InitAnimationForceUpdate(this, 0);

View File

@ -62,7 +62,7 @@ void sub_0806045C(Entity* this) {
this->animationState = bVar1;
InitAnimationForceUpdate(this, 4 + bVar1);
}
temp = sub_0806ED9C(this, 0x18, 0x18);
temp = GetAnimationStateInRectRadius(this, 0x18, 0x18);
if ((temp > -1) && (temp == this->animationState)) {
bVar3 = 1;
} else {

View File

@ -64,7 +64,7 @@ void sub_080660EC(Entity* this) {
void sub_08066118(Entity* this) {
s32 uVar1;
uVar1 = sub_0806ED9C(this, 0x28, 0x28);
uVar1 = GetAnimationStateInRectRadius(this, 0x28, 0x28);
if (uVar1 < 0) {
uVar1 = 2;
} else {

View File

@ -35,7 +35,7 @@ void sub_0806559C(Entity* this) {
this->actionDelay++;
if (this->actionDelay >= 9) {
this->actionDelay = 0;
result = sub_0806ED9C(this, 0x20, 0x20);
result = GetAnimationStateInRectRadius(this, 0x20, 0x20);
if (result < 0) {
offset = this->animationState + 4;
} else {

View File

@ -188,7 +188,7 @@ void sub_0806AEE4(Entity* this) {
this->actionDelay--;
} else {
this->actionDelay = 2;
index = sub_0806EDD8(this, 0x20, 0x20);
index = GetFacingDirectionInRectRadius(this, 0x20, 0x20);
if (index < 0) {
int state = this->field_0x6a.HALF.LO;
this->animationState = state * 2;

View File

@ -45,7 +45,7 @@ void sub_08061BC8(Entity* this) {
void sub_08061C00(Entity* this) {
s32 uVar1;
uVar1 = sub_0806ED9C(this, 0x20, 0x20);
uVar1 = GetAnimationStateInRectRadius(this, 0x20, 0x20);
if (uVar1 < 0) {
uVar1 = this->animationState + 4;
} else {

View File

@ -107,7 +107,7 @@ u32 sub_0806ED78(Entity* ent) {
return result;
}
s32 sub_0806ED9C(Entity* ent, u32 x, u32 y) {
s32 GetAnimationStateInRectRadius(Entity* ent, u32 x, u32 y) {
s32 anim = -1;
if (EntityInRectRadius(ent, &gPlayerEntity, x, y))
anim = GetAnimationState(ent);
@ -119,11 +119,11 @@ u32 GetAnimationState(Entity* ent) {
return sub_0806F5A4(direction);
}
s32 sub_0806EDD8(Entity* ent, u32 x, u32 y) {
s32 anim = -1;
s32 GetFacingDirectionInRectRadius(Entity* ent, u32 x, u32 y) {
s32 dir = -1;
if (EntityInRectRadius(ent, &gPlayerEntity, x, y))
anim = GetFacingDirection(ent, &gPlayerEntity);
return anim;
dir = GetFacingDirection(ent, &gPlayerEntity);
return dir;
}
void sub_0806EE04(Entity* ent, void* a2, u32 a3) {

View File

@ -164,7 +164,7 @@ void sub_0808692C(Entity* this) {
static u8 sub_08086954(Entity* this) {
if (sub_0800445C(this)) {
if (sub_0806ED9C(this, 6, 20) >= 0 && gPlayerEntity.animationState == 0 &&
if (GetAnimationStateInRectRadius(this, 6, 20) >= 0 && gPlayerEntity.animationState == 0 &&
(u16)gPlayerState.field_0x90 == 0x400 && gPlayerState.jump_status == 0) {
this->actionDelay--;
}

View File

@ -0,0 +1,105 @@
#define NENT_DEPRECATED
#include "entity.h"
#include "flags.h"
#include "sound.h"
#include "functions.h"
#include "npc.h"
typedef struct {
Entity base;
u8 filler[0x15];
u8 unk7d;
u8 filler2[0x8];
u16 doorFlags;
} HouseDoorInteriorEntity;
void HouseDoorInterior_Init(HouseDoorInteriorEntity*);
void HouseDoorInterior_Action1(HouseDoorInteriorEntity*);
void HouseDoorInterior_Delete(HouseDoorInteriorEntity*);
typedef struct {
u8 frameIndex;
u8 type2;
} PACKED HouseDoorInteriorFrameIndices_struct;
static const HouseDoorInteriorFrameIndices_struct HouseDoorInteriorFrameIndices[] = {
{ -1, 0 }, { -1, 0 }, { 0, 0 }, { 0, 3 }, { 2, 2 }, { 2, 2 },
};
void HouseDoorInterior(Entity* this) {
static void (*const actionFuncs[])(HouseDoorInteriorEntity*) = {
HouseDoorInterior_Init,
HouseDoorInterior_Action1,
HouseDoorInterior_Delete,
};
actionFuncs[this->action]((HouseDoorInteriorEntity*)this);
}
typedef struct {
u16 animationState;
u16 unk2;
u16 x;
u16 y;
} gUnk_081227CC_struct;
static const gUnk_081227CC_struct gUnk_081227CC[] = {
{ 0x0, 0x400, 0x6, 0x10 },
{ 0x2, 0x100, 0x10, 0x6 },
{ 0x4, 0x800, 0x6, 0x10 },
{ 0x6, 0x200, 0x10, 0x6 },
};
void HouseDoorInterior_Init(HouseDoorInteriorEntity* this) {
static const Hitbox HouseDoorInteriorHitbox = {
0, 0, { 5, 3, 3, 5 }, 6, 6,
};
const HouseDoorInteriorFrameIndices_struct* ptr;
if (this->doorFlags && CheckFlags(this->doorFlags)) {
DeleteThisEntity();
}
super->action = 1;
super->spriteSettings.draw = 1;
this->unk7d = super->actionDelay;
super->spritePriority.b0 = 7;
super->hitbox = (Hitbox*)&HouseDoorInteriorHitbox;
super->actionDelay = 8;
ptr = HouseDoorInteriorFrameIndices + super->type;
if (ptr->frameIndex == 0xff) {
super->frameIndex = super->type2;
} else {
super->frameIndex = ptr->frameIndex;
super->type2 = ptr->type2;
}
}
void HouseDoorInterior_Action1(HouseDoorInteriorEntity* this) {
const gUnk_081227CC_struct* ptr;
if (this->doorFlags && CheckFlags(this->doorFlags)) {
super->action = 2;
SoundReq(SFX_111);
return;
}
if (sub_0800445C(super) && this->unk7d == 0) {
ptr = gUnk_081227CC + super->type2;
if (GetAnimationStateInRectRadius(super, ptr->x, ptr->y) >= 0 &&
ptr->animationState == gPlayerEntity.animationState && gPlayerState.field_0x90 & ptr->unk2) {
--super->actionDelay;
}
} else {
super->actionDelay = 8;
}
if (super->actionDelay == 0) {
super->action = 2;
sub_08078AC0(8, 0, 0);
SoundReq(SFX_111);
}
}
void HouseDoorInterior_Delete(HouseDoorInteriorEntity* this) {
DeleteThisEntity();
}