summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/item.c117
-rw-r--r--src/item/itemGustJar.c10
-rw-r--r--src/item/itemOcarina.c40
-rw-r--r--src/item/itemPacciCane.c35
-rw-r--r--src/item/itemShield.c52
5 files changed, 138 insertions, 116 deletions
diff --git a/src/item.c b/src/item.c
index fbf31cd8..60006575 100644
--- a/src/item.c
+++ b/src/item.c
@@ -11,119 +11,4 @@ void (*const gItemFunctions[])(ItemBehavior*, u32) = {
ItemShield, ItemLantern, ItemLantern, ItemGustJar, ItemPacciCane, ItemMoleMitts, ItemRocsCape,
ItemPegasusBoots, ItemDebug, ItemOcarina, ItemDebug, ItemDebug, ItemDebug, ItemTryPickupObject,
ItemJarEmpty, ItemJarEmpty, ItemJarEmpty, ItemJarEmpty,
-};
-
-extern void sub_08077E78(ItemBehavior*, u32);
-extern void sub_08078F60(void);
-extern void sub_08077D38(ItemBehavior*, u32);
-extern void sub_0805E544(void);
-extern void UpdateItemAnim(ItemBehavior*);
-extern void CreateBird(void);
-extern void UnfreezeTime(void);
-extern void sub_0806F948(Entity*);
-extern void sub_08077BB8(ItemBehavior*);
-extern void CreatePlayerBomb(ItemBehavior*, u32);
-extern u32 sub_08077EFC();
-
-extern void (*const gOcarinaStates[4])(ItemBehavior*, u32);
-extern void (*const gUnk_0811BDE0[])(ItemBehavior* beh, u32);
-extern void (*const gUnk_0811BDE8[])(ItemBehavior* beh, u32);
-extern void (*const gUnk_0811BDF4[])(ItemBehavior* beh, u32);
-
-#if 0
-void Ocarina(ItemBehavior* beh, u32 inputFlags) {
- gOcarinaStates[beh->stateID](beh, inputFlags);
- gPlayerEntity.field_0x7a++;
-}
-
-void OcarinaUse(ItemBehavior *beh, u32 arg1)
-{
- u32 bVar1;
-
- if (gPlayerState.playerAction == 0x18) {
- PlayerChangeState(beh, arg1);
- }
- else {
- beh->field_0x5[4] = beh->field_0x5[4] | 0xf;
- gPlayerEntity.animationState = 4;
- gPlayerEntity.spriteSettings.b.flipX = 0;
- gPlayerEntity.flags &= 0x7f;
- gPlayerEntity.field_0x7a = 2;
- gPlayerState.flags.all |= 0x10000000;
- gPlayerState.field_0x27[0] = 0xff;
- gUnk_02034490[0] = 1;
- bVar1 = (8 >> arg1);
- gPlayerState.field_0xa |= bVar1;
- gPlayerState.keepFacing |= bVar1;
- sub_08078F60();
- sub_08077D38(beh, arg1);
- SoundReq(0x216);
- sub_0805E544();
- }
-}
-#endif
-
-void ItemPacciCane(ItemBehavior* beh, u32 arg1) {
- gUnk_0811BDE0[beh->stateID](beh, arg1);
-}
-
-void sub_08076C98(ItemBehavior* beh, u32 arg1) {
- beh->field_0x5[4] |= 0xf;
- sub_08077D38(beh, arg1);
- sub_0806F948(&gPlayerEntity);
- sub_08077BB8(beh);
-}
-
-void sub_08076CBC(ItemBehavior* beh, u32 arg1) {
- if ((beh->field_0x5[9] & 0x80) != 0) {
- sub_08077E78(beh, arg1);
- } else {
- if ((beh->field_0x5[9] & 0x40) != 0) {
- CreatePlayerBomb(beh, 0x12);
- }
- UpdateItemAnim(beh);
- }
-}
-
-void ItemShield(ItemBehavior* beh, u32 arg1) {
- gUnk_0811BDE8[beh->stateID](beh, arg1);
-}
-
-void sub_08076D04(ItemBehavior* beh, u32 arg1) {
- gPlayerState.field_0x3[0] = 0x81;
- beh->field_0x5[4] = 2;
- sub_0806F948(&gPlayerEntity);
- sub_08077D38(beh, arg1);
- sub_08077BB8(beh);
-}
-
-void sub_08076D34(ItemBehavior* beh, u32 arg1) {
- if (sub_08077EFC() != 0) {
- gPlayerState.field_0x3[0] |= 1;
- UpdateItemAnim(beh);
- if (beh->field_0x5[9] != 0) {
- beh->stateID++;
- beh->field_0xf = 0;
- gPlayerState.field_0xa &= ~(u8)(8 >> arg1);
- SoundReq(0x15d);
- }
- } else {
- gPlayerState.field_0x3[0] = 0;
- sub_08077E78(beh, arg1);
- }
-}
-
-void sub_08076D94(ItemBehavior* beh, u32 arg1) {
- if (sub_08077EFC(beh)) {
- gPlayerState.field_0x3[0] |= 1;
- UpdateItemAnim(beh);
- } else {
- gPlayerState.field_0x3[0] = 0;
- sub_08077E78(beh, arg1);
- }
-}
-
-void ItemGustJar(ItemBehavior* beh, u32 arg1) {
- gPlayerState.field_0xa8 = 3;
- gUnk_0811BDF4[beh->stateID](beh, arg1);
-}
+}; \ No newline at end of file
diff --git a/src/item/itemGustJar.c b/src/item/itemGustJar.c
new file mode 100644
index 00000000..ef25e097
--- /dev/null
+++ b/src/item/itemGustJar.c
@@ -0,0 +1,10 @@
+#include "global.h"
+#include "entity.h"
+#include "item.h"
+
+extern void (*const gUnk_0811BDF4[])(ItemBehavior* beh, u32);
+
+void ItemGustJar(ItemBehavior* beh, u32 arg1) {
+ gPlayerState.field_0xa8 = 3;
+ gUnk_0811BDF4[beh->stateID](beh, arg1);
+}
diff --git a/src/item/itemOcarina.c b/src/item/itemOcarina.c
new file mode 100644
index 00000000..efb256eb
--- /dev/null
+++ b/src/item/itemOcarina.c
@@ -0,0 +1,40 @@
+#include "item.h"
+
+extern void (*const gOcarinaStates[4])(ItemBehavior*, u32);
+
+extern void sub_08078F60(void);
+extern void sub_0805E544(void);
+
+
+#if 0
+void Ocarina(ItemBehavior* beh, u32 inputFlags) {
+ gOcarinaStates[beh->stateID](beh, inputFlags);
+ gPlayerEntity.field_0x7a++;
+}
+
+void OcarinaUse(ItemBehavior *beh, u32 arg1)
+{
+ u32 bVar1;
+
+ if (gPlayerState.playerAction == 0x18) {
+ PlayerChangeState(beh, arg1);
+ }
+ else {
+ beh->field_0x5[4] = beh->field_0x5[4] | 0xf;
+ gPlayerEntity.animationState = 4;
+ gPlayerEntity.spriteSettings.b.flipX = 0;
+ gPlayerEntity.flags &= 0x7f;
+ gPlayerEntity.field_0x7a = 2;
+ gPlayerState.flags.all |= 0x10000000;
+ gPlayerState.field_0x27[0] = 0xff;
+ gUnk_02034490[0] = 1;
+ bVar1 = (8 >> arg1);
+ gPlayerState.field_0xa |= bVar1;
+ gPlayerState.keepFacing |= bVar1;
+ sub_08078F60();
+ sub_08077D38(beh, arg1);
+ SoundReq(0x216);
+ sub_0805E544();
+ }
+}
+#endif
diff --git a/src/item/itemPacciCane.c b/src/item/itemPacciCane.c
new file mode 100644
index 00000000..524ae645
--- /dev/null
+++ b/src/item/itemPacciCane.c
@@ -0,0 +1,35 @@
+#include "global.h"
+#include "entity.h"
+#include "item.h"
+
+// TODO include correct headers?
+extern void UpdateItemAnim(ItemBehavior*);
+extern void CreatePlayerBomb(ItemBehavior*, u32);
+extern void sub_08077E78(ItemBehavior*, u32);
+extern void sub_08077BB8(ItemBehavior*);
+extern void sub_0806F948(Entity*);
+extern void sub_08077D38(ItemBehavior*, u32);
+
+extern void (*const gUnk_0811BDE0[])(ItemBehavior* beh, u32);
+
+void ItemPacciCane(ItemBehavior* beh, u32 arg1) {
+ gUnk_0811BDE0[beh->stateID](beh, arg1);
+}
+
+void sub_08076C98(ItemBehavior* beh, u32 arg1) {
+ beh->field_0x5[4] |= 0xf;
+ sub_08077D38(beh, arg1);
+ sub_0806F948(&gPlayerEntity);
+ sub_08077BB8(beh);
+}
+
+void sub_08076CBC(ItemBehavior* beh, u32 arg1) {
+ if ((beh->field_0x5[9] & 0x80) != 0) {
+ sub_08077E78(beh, arg1);
+ } else {
+ if ((beh->field_0x5[9] & 0x40) != 0) {
+ CreatePlayerBomb(beh, 0x12);
+ }
+ UpdateItemAnim(beh);
+ }
+}
diff --git a/src/item/itemShield.c b/src/item/itemShield.c
new file mode 100644
index 00000000..621341e2
--- /dev/null
+++ b/src/item/itemShield.c
@@ -0,0 +1,52 @@
+#include "global.h"
+#include "entity.h"
+#include "item.h"
+
+// TODO include correct headers?
+extern void sub_08077E78(ItemBehavior*, u32);
+extern void SoundReq(u32);
+extern void UpdateItemAnim(ItemBehavior*);
+extern u32 sub_08077EFC();
+extern void sub_08077BB8(ItemBehavior*);
+extern void sub_08077D38(ItemBehavior*, u32);
+extern void sub_0806F948(Entity*);
+
+extern void (*const gUnk_0811BDE8[])(ItemBehavior* beh, u32);
+
+void ItemShield(ItemBehavior* beh, u32 arg1) {
+ gUnk_0811BDE8[beh->stateID](beh, arg1);
+}
+
+void sub_08076D04(ItemBehavior* beh, u32 arg1) {
+ gPlayerState.field_0x3[0] = 0x81;
+ beh->field_0x5[4] = 2;
+ sub_0806F948(&gPlayerEntity);
+ sub_08077D38(beh, arg1);
+ sub_08077BB8(beh);
+}
+
+void sub_08076D34(ItemBehavior* beh, u32 arg1) {
+ if (sub_08077EFC() != 0) {
+ gPlayerState.field_0x3[0] |= 1;
+ UpdateItemAnim(beh);
+ if (beh->field_0x5[9] != 0) {
+ beh->stateID++;
+ beh->field_0xf = 0;
+ gPlayerState.field_0xa &= ~(u8)(8 >> arg1);
+ SoundReq(0x15d);
+ }
+ } else {
+ gPlayerState.field_0x3[0] = 0;
+ sub_08077E78(beh, arg1);
+ }
+}
+
+void sub_08076D94(ItemBehavior* beh, u32 arg1) {
+ if (sub_08077EFC(beh)) {
+ gPlayerState.field_0x3[0] |= 1;
+ UpdateItemAnim(beh);
+ } else {
+ gPlayerState.field_0x3[0] = 0;
+ sub_08077E78(beh, arg1);
+ }
+}