Decompile some functions

This commit is contained in:
octorock
2022-03-28 17:30:56 +02:00
parent c86ada3e3d
commit eb1158855b
38 changed files with 935 additions and 2299 deletions
+64 -1
View File
@@ -2,6 +2,8 @@
#include "item.h"
#include "functions.h"
#include "sound.h"
#include "effects.h"
#include "object.h"
extern void (*const gUnk_0811BE04[])(ItemBehavior*, u32);
@@ -12,6 +14,10 @@ extern s32 sub_0800875A(Entity*, u32, ItemBehavior*);
extern void UpdatePlayerMovement(void);
extern bool32 sub_0807B5B0(Entity*);
extern const s16 gUnk_0811BE16[];
void ItemMoleMitts(ItemBehavior* this, u32 arg1) {
gUnk_0811BE04[this->stateID](this, arg1);
}
@@ -83,7 +89,64 @@ void sub_080771C8(ItemBehavior* this, u32 arg1) {
}
}
ASM_FUNC("asm/non_matching/itemMoleMitts/sub_080772A8.inc", void sub_080772A8(ItemBehavior* this, u32 arg1))
void sub_080772A8(ItemBehavior* this, u32 param_2) {
Entity* effect;
if (((this->field_0x5[9] & 8) != 0) && sub_08077F10(this)) {
this->field_0x5[2] = 1;
}
if (GetInventoryValue(ITEM_DIG_BUTTERFLY) == 1) {
if ((this->field_0x5[9] & 7) != 3) {
sub_08077E3C(this, 2);
gPlayerEntity.speed = gUnk_0811BE16[this->field_0x5[9] & 7] << 1;
} else {
UpdateItemAnim(this);
gPlayerEntity.speed = gUnk_0811BE16[this->field_0x5[9] & 7];
}
} else {
UpdateItemAnim(this);
gPlayerEntity.speed = gUnk_0811BE16[this->field_0x5[9] & 7];
}
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
if (gPlayerEntity.speed != 0) {
UpdatePlayerMovement();
}
if ((this->field_0x5[9] & 0x10) != 0) {
if (this->field_0x5[2] != 0) {
gPlayerEntity.frameDuration = 1;
if (sub_080774A0()) {
this->field_0x5[2] = 0;
return;
}
}
DeletePlayerItem(this, param_2);
gPlayerState.field_0x3c[1] = 0;
} else {
if ((this->field_0x5[9] & 0x60) != 0) {
gPlayerEntity.frameDuration = 1;
if (sub_0807B5B0(&gPlayerEntity)) {
SoundReq(SFX_108);
CreateObjectWithParent(&gPlayerEntity, OBJECT_1E, this->field_0x5[9], 0);
} else {
sub_08077DF4(this, 0x51c);
effect = CreateFx(&gPlayerEntity, FX_STARS_STRIKE, 0);
if (effect != NULL) {
effect->animationState = this->field_0x5[5];
effect->spritePriority.b0 = gPlayerEntity.spritePriority.b0 - 1;
}
effect = CreateFx(&gPlayerEntity, FX_STARS_STRIKE, 0);
if (effect != NULL) {
effect->animationState = this->field_0x5[5];
effect->spritePriority.b0 = gPlayerEntity.spritePriority.b0 - 1;
effect->field_0xf = 1;
}
this->stateID = 3;
this->field_0x5[0] = 1;
SoundReq(SFX_ITEM_GLOVES_KNOCKBACK);
}
}
}
}
void sub_08077448(ItemBehavior* this, u32 arg1) {
gPlayerEntity.direction = gPlayerEntity.animationState << 2 ^ 0x10;
+54 -3
View File
@@ -1,17 +1,68 @@
#include "item.h"
#include "functions.h"
#include "sound.h"
extern void (*const gUnk_0811BDB4[])(ItemBehavior*, u32);
u32 sub_08077F64(ItemBehavior* arg0, u32 unk);
u32 sub_080789A8(void);
void sub_080762C4(ItemBehavior*, void*, u8, u32);
void sub_08076088(ItemBehavior*, void*, u32);
void ItemTryPickupObject(ItemBehavior* this, u32 arg1) {
gUnk_0811BDB4[this->stateID](this, arg1);
}
ASM_FUNC("asm/non_matching/itemTryPickupObject/ItemPickupCheck.inc", void ItemPickupCheck(ItemBehavior* this, u32 arg1))
void ItemPickupCheck(ItemBehavior* this, u32 param_2) {
Entity* entity;
void sub_080762C4(ItemBehavior* this, u32 arg1, u8 arg2, u32 arg3) {
if (!(((gPlayerState.field_0x3[1] != 0) ||
(((gPlayerState.jump_status != 0 && ((gPlayerState.flags & (PL_BUSY | PL_FALLING | PL_IN_MINECART)) == 0)) ||
(gPlayerState.field_0x0[1] = gPlayerEntity.animationState | 0x80, 8 < gPlayerEntity.iframes)))))) {
switch (sub_080789A8()) {
case 2:
if (((gCarriedEntity.unk_8)->field_0x16 & 0xf) == 0) {
sub_08076088(this, gCarriedEntity.unk_8, param_2);
return;
}
entity = gCarriedEntity.unk_8;
this->field_0x18 = entity;
entity->action = 2;
entity->subAction = 5;
gPlayerState.framestate = 5;
sub_080762C4(this, entity, 2, param_2);
gUnk_0200AF00.unk_2e = 8;
SoundReq(SFX_102);
break;
case 1:
sub_080762C4(this, 0, 1, param_2);
SoundReq(SFX_102);
break;
case 0:
this->stateID = 5;
this->field_0x5[2] = 0x0f;
this->field_0xf = 6;
gPlayerState.field_0xa = (8 >> param_2) | gPlayerState.field_0xa;
gPlayerState.keepFacing = (8 >> param_2) | gPlayerState.keepFacing;
if ((gPlayerState.flags & PL_NO_CAP) == 0) {
sub_08077DF4(this, 0x378);
} else {
sub_08077DF4(this, 0x948);
}
SoundReq(SFX_88);
break;
default:
break;
}
} else {
sub_08077F50(this, param_2);
}
}
void sub_080762C4(ItemBehavior* this, void* arg1, u8 arg2, u32 arg3) {
this->field_0x18 = arg1;
gPlayerState.heldObject = arg2;
sub_08077D38(this, arg3);
@@ -25,7 +76,7 @@ void sub_08076488(ItemBehavior* this, u32 arg1) {
if (this->field_0x5[2] == 0) {
if (sub_08077F64(this, arg1) != 0) {
if (((*(u8*)((this->field_0x18) + 0x16) & 0xf0) == 0x10) && ((gRoomTransition.frameCount & 1U) != 0)) {
if ((((this->field_0x18->field_0x16) & 0xf0) == 0x10) && ((gRoomTransition.frameCount & 1U) != 0)) {
return;
}
UpdateItemAnim(this);