summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/item/itemPegasusBoots.c108
1 files changed, 103 insertions, 5 deletions
diff --git a/src/item/itemPegasusBoots.c b/src/item/itemPegasusBoots.c
index 755362bf..6a2c3782 100644
--- a/src/item/itemPegasusBoots.c
+++ b/src/item/itemPegasusBoots.c
@@ -3,12 +3,24 @@
#include "sound.h"
#include "functions.h"
#include "effects.h"
-
-extern void (*const gUnk_0811BDCC[])(ItemBehavior* beh, u32);
+#include "game.h"
+#include "save.h"
void sub_08076964(ItemBehavior*, u32);
+void sub_080768F8(ItemBehavior*, u32);
+void sub_08076A88(ItemBehavior*, u32);
+extern bool32 sub_0807A158();
+extern Entity* CreatePlayerBomb(ItemBehavior*, u32);
+
+extern u16 gUnk_0800275C[];
+extern u8 gUnk_0811BE38[];
void ItemPegasusBoots(ItemBehavior* this, u32 arg1) {
+ static void (*const ItemPegasusBoots_StateFunctions[])(ItemBehavior * beh, u32) = {
+ sub_080768F8,
+ sub_08076964,
+ sub_08076A88,
+ };
u32 bVar1;
Entity* fx;
u32 uVar4;
@@ -44,7 +56,7 @@ void ItemPegasusBoots(ItemBehavior* this, u32 arg1) {
}
}
}
- gUnk_0811BDCC[this->stateID](this, arg1);
+ ItemPegasusBoots_StateFunctions[this->stateID](this, arg1);
}
}
@@ -72,6 +84,92 @@ void sub_080768F8(ItemBehavior* this, u32 arg1) {
}
}
-ASM_FUNC("asm/non_matching/itemPegasusBoots/sub_08076964.inc", void sub_08076964(ItemBehavior* this, u32 arg1))
+void sub_08076964(ItemBehavior* this, u32 arg1) {
+ Entity* bombEntity;
+ u32 uVar3;
+ if (sub_08077EFC(this) && gPlayerEntity.z.WORD == 0 && gPlayerState.dash_state) {
+ UpdateItemAnim(this);
+
+ if ((gPlayerState.flags & PL_MINISH) == 0) {
+ UpdateItemAnim(this);
+ }
+
+ if ((++gPlayerState.dash_state) == 0x1e) {
+ if ((gPlayerState.flags & PL_FLAGS2) != 0) {
+ gPlayerState.dash_state = 0;
+ sub_08077E78(this, arg1);
+ return;
+ }
+ gPlayerState.dash_state = 0x40;
+ gPlayerState.field_0xa &= ~(8 >> arg1);
+ this->stateID++;
+ if (sub_0807A158() && (gPlayerState.flags & PL_MINISH) == 0 && (gPlayerState.field_0xac & 4) != 0) {
+ gPlayerState.field_0xab = 3;
+ sub_08077DF4(this, 0x298);
+ bombEntity = CreatePlayerBomb(this, 0xc);
+ if (bombEntity != NULL) {
+ if (ItemIsSword(gSave.stats.itemButtons[SLOT_A]) != 0) {
+ uVar3 = gSave.stats.itemButtons[SLOT_A];
+ } else {
+ uVar3 = gSave.stats.itemButtons[SLOT_B];
+ }
+ bombEntity->field_0x68.HALF.LO = uVar3;
+ return;
+ }
+ } else if ((gPlayerState.flags & PL_MINISH) == 0) {
+ sub_08077DF4(this, 0x104);
+ return;
+ } else {
+ gPlayerState.animation = 0xc10;
+ return;
+ }
+ } else {
+ return;
+ }
+ }
+ gPlayerState.dash_state = 0;
+ sub_08077E78(this, arg1);
+}
+
+void sub_08076A88(ItemBehavior* this, u32 arg1) {
+ u32 uVar1;
+ u32 uVar2;
+ u8* ptr;
-ASM_FUNC("asm/non_matching/itemPegasusBoots/sub_08076A88.inc", void sub_08076A88(ItemBehavior* this, u32 arg1))
+ if ((sub_08077EFC(this) != 0) && (gPlayerState.dash_state != 0)) {
+ if ((gPlayerState.flags & PL_MINISH) == 0) {
+ gPlayerEntity.speed = 0x300;
+ } else {
+ gPlayerEntity.speed = 0x280;
+ }
+ uVar2 = gUnk_0800275C[(gPlayerEntity.animationState & 0xe) * 4];
+ if (uVar2 == (gPlayerEntity.collisions & uVar2)) {
+ if (this->field_0x5[3] != 0) {
+ gPlayerEntity.action = 6;
+ gPlayerEntity.subAction = 0;
+ COLLISION_OFF(&gPlayerEntity);
+ gPlayerState.field_0x38 = 0;
+ gPlayerState.field_0xd = 0xff;
+ return;
+ }
+ this->field_0x5[3] = 1;
+ return;
+ }
+ ptr = gUnk_0811BE38;
+ if ((*(u16*)&ptr[(gPlayerEntity.animationState & 0xfe)] & gPlayerState.field_0x90) == 0) {
+ this->field_0x5[6] = (this->field_0x5[5] & 0xe) * 4;
+ if ((gPlayerState.field_0xd != 0xff) && (gPlayerState.field_0xd != this->field_0x5[6])) {
+ if (((gPlayerState.field_0xd - this->field_0x5[6]) & 0x1f) < 0x10) {
+ this->field_0x5[6] = this->field_0x5[6] + 2;
+ }
+ this->field_0x5[6]--;
+ this->field_0x5[6] &= 0x1f;
+ }
+ gPlayerState.field_0xd = this->field_0x5[6];
+ UpdateItemAnim(this);
+ return;
+ }
+ }
+ gPlayerState.dash_state = 0;
+ sub_08077E78(this, arg1);
+}