mirror of
https://github.com/zeldaret/tmc
synced 2026-06-01 17:58:06 -04:00
Split items and extract pointers
This commit is contained in:
+1
-116
@@ -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);
|
||||
}
|
||||
};
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user