Match sub_080774A0 and put const data in itemMoleMitts

This commit is contained in:
Tal Hayon
2022-04-16 21:33:51 +03:00
parent 0b81971858
commit 9d043a4ad7
5 changed files with 42 additions and 109 deletions
@@ -1,63 +0,0 @@
.syntax unified
push {r4, r5, r6, r7, lr}
ldr r3, _080774FC @ =gPlayerEntity
movs r0, #0x2e
ldrsh r2, [r3, r0]
ldr r5, _08077500 @ =gUnk_0811BE1E
ldrb r0, [r3, #0x14]
movs r1, #6
ands r1, r0
adds r0, r1, r5
ldrb r0, [r0]
lsls r0, r0, #0x18
asrs r0, r0, #0x18
adds r2, r2, r0
ldr r4, _08077504 @ =gRoomControls
ldrh r0, [r4, #6]
subs r2, r2, r0
asrs r6, r2, #4
movs r2, #0x3f
ands r6, r2
movs r7, #0x32
ldrsh r0, [r3, r7]
adds r1, #1
adds r1, r1, r5
ldrb r1, [r1]
lsls r1, r1, #0x18
asrs r1, r1, #0x18
adds r0, r0, r1
ldrh r1, [r4, #8]
subs r0, r0, r1
asrs r0, r0, #4
ands r0, r2
lsls r0, r0, #6
orrs r6, r0
adds r4, r3, #0
adds r4, #0x38
ldrb r1, [r4]
adds r0, r6, #0
bl sub_080B1B44
cmp r0, #0x16
bhi _080774F6
cmp r0, #0xe
bhi _08077508
_080774F6:
movs r0, #0
b _0807751A
.align 2, 0
_080774FC: .4byte gPlayerEntity
_08077500: .4byte gUnk_0811BE1E
_08077504: .4byte gRoomControls
_08077508:
adds r0, r6, #0
ldrb r1, [r4]
bl sub_080B1AE0
cmp r0, #0x56
bne _08077518
movs r0, #0x56
b _0807751A
_08077518:
movs r0, #1
_0807751A:
pop {r4, r5, r6, r7, pc}
.syntax divided
-15
View File
@@ -40793,21 +40793,6 @@
"size": 76,
"type": "sprite_frame"
},
{
"path": "itemMoleMitts/gUnk_0811BE14.bin",
"start": 1162772,
"size": 2
},
{
"path": "itemMoleMitts/gUnk_0811BE16.bin",
"start": 1162774,
"size": 8
},
{
"path": "itemMoleMitts/gUnk_0811BE1E.bin",
"start": 1162782,
"size": 10
},
{
"path": "data_0811BE38/gUnk_0811BE38.bin",
"start": 1162808,
-20
View File
@@ -1,20 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_0811BE04:: @ 0811BE04
.4byte sub_08077130
.4byte sub_080771C8
.4byte sub_080772A8
.4byte sub_08077448
gUnk_0811BE14:: @ 0811BE14
.incbin "itemMoleMitts/gUnk_0811BE14.bin"
gUnk_0811BE16:: @ 0811BE16
.incbin "itemMoleMitts/gUnk_0811BE16.bin"
gUnk_0811BE1E:: @ 0811BE1E
.incbin "itemMoleMitts/gUnk_0811BE1E.bin"
+1 -1
View File
@@ -1318,7 +1318,7 @@ SECTIONS {
src/item/itemPacciCane.o(.rodata);
src/item/itemShield.o(.rodata);
src/item/itemGustJar.o(.rodata);
data/const/item/itemMoleMitts.o(.rodata);
src/item/itemMoleMitts.o(.rodata);
data/const/item/itemJarEmpty.o(.rodata);
data/data_0811BE38.o(.rodata);
data/map/room_headers.o(.rodata);
+41 -10
View File
@@ -5,21 +5,23 @@
#include "effects.h"
#include "object.h"
extern void (*const gUnk_0811BE04[])(ItemBehavior*, u32);
s32 sub_080774A0(void);
extern u8 gUnk_0811BE14[];
extern s32 sub_0800875A(Entity*, u32, ItemBehavior*);
extern void UpdatePlayerMovement(void);
extern bool32 sub_0807B5B0(Entity*);
extern const s16 gUnk_0811BE16[];
void sub_08077130(ItemBehavior*, u32);
void sub_080771C8(ItemBehavior*, u32);
void sub_080772A8(ItemBehavior*, u32);
void sub_08077448(ItemBehavior*, u32);
void ItemMoleMitts(ItemBehavior* this, u32 idx) {
gUnk_0811BE04[this->stateID](this, idx);
static void (*const stateFuncs[])(ItemBehavior*, u32) = {
sub_08077130,
sub_080771C8,
sub_080772A8,
sub_08077448,
};
stateFuncs[this->stateID](this, idx);
}
void sub_08077130(ItemBehavior* this, u32 idx) {
@@ -53,6 +55,10 @@ void sub_08077130(ItemBehavior* this, u32 idx) {
}
void sub_080771C8(ItemBehavior* this, u32 idx) {
static const u8 gUnk_0811BE14[] = {
0x1,
0x12,
};
Entity* object;
UpdateItemAnim(this);
@@ -90,6 +96,12 @@ void sub_080771C8(ItemBehavior* this, u32 idx) {
}
void sub_080772A8(ItemBehavior* this, u32 idx) {
static const s16 gUnk_0811BE16[] = {
0,
0xc0,
0x100,
0x180,
};
Entity* effect;
if (((this->field_0x5[9] & 8) != 0) && sub_08077F10(this)) {
@@ -161,4 +173,23 @@ void sub_08077448(ItemBehavior* this, u32 idx) {
}
}
ASM_FUNC("asm/non_matching/itemMoleMitts/sub_080774A0.inc", s32 sub_080774A0(void))
s32 sub_080774A0(void) {
static const s8 gUnk_0811BE1E[] = { 0, -13, 13, 0, 0, 16, -13, 0, 0, 0 };
u32 iVar2;
u32 uVar3;
uVar3 = COORD_TO_TILE_OFFSET((&gPlayerEntity), -gUnk_0811BE1E[gPlayerEntity.animationState & 6],
-gUnk_0811BE1E[(gPlayerEntity.animationState & 6) + 1]);
iVar2 = sub_080B1B44(uVar3, gPlayerEntity.collisionLayer);
if (iVar2 > 0x16)
return 0;
if (iVar2 < 0xf)
return 0;
if (sub_080B1AE0(uVar3, gPlayerEntity.collisionLayer) != 0x56) {
return 1;
} else {
return 0x56;
}
}