identify all player items

This commit is contained in:
theo3 2022-03-28 15:08:37 -07:00
parent 270476488f
commit 7c16e8d50a
46 changed files with 531 additions and 515 deletions

View File

@ -3567,27 +3567,27 @@
"size": 176 "size": 176
}, },
{ {
"path": "playerItem11/gUnk_080B3DE0.bin", "path": "playerItemGustBig/gUnk_080B3DE0.bin",
"start": 736736, "start": 736736,
"size": 8 "size": 8
}, },
{ {
"path": "playerItem11/gUnk_080B3DF4.bin", "path": "playerItemGustBig/gUnk_080B3DF4.bin",
"start": 736756, "start": 736756,
"size": 36 "size": 36
}, },
{ {
"path": "playerItem11/gUnk_080B3E18.bin", "path": "playerItemGustBig/gUnk_080B3E18.bin",
"start": 736792, "start": 736792,
"size": 8 "size": 8
}, },
{ {
"path": "playerItem11/gUnk_080B3E20.bin", "path": "playerItemGustBig/gUnk_080B3E20.bin",
"start": 736800, "start": 736800,
"size": 8 "size": 8
}, },
{ {
"path": "playerItem11/gUnk_080B3E28.bin", "path": "playerItemGustBig/gUnk_080B3E28.bin",
"start": 736808, "start": 736808,
"size": 8 "size": 8
}, },
@ -34056,7 +34056,7 @@
"size": 16 "size": 16
}, },
{ {
"path": "playerItem14/gUnk_08109AD0.bin", "path": "playerItemSpiralBeam/gUnk_08109AD0.bin",
"start": 1088208, "start": 1088208,
"size": 8 "size": 8
}, },
@ -45260,7 +45260,7 @@
"size": 8 "size": 8
}, },
{ {
"path": "playerItem15/gUnk_08127278.bin", "path": "playerItemFireRodProjectile/gUnk_08127278.bin",
"start": 1208952, "start": 1208952,
"size": 8 "size": 8
}, },
@ -46407,27 +46407,27 @@
} }
}, },
{ {
"path": "playerItem13/gUnk_081320B8.bin", "path": "playerItemHeldObject/gUnk_081320B8.bin",
"start": 1253560, "start": 1253560,
"size": 12 "size": 12
}, },
{ {
"path": "playerItem13/gUnk_081320C4.bin", "path": "playerItemHeldObject/gUnk_081320C4.bin",
"start": 1253572, "start": 1253572,
"size": 8 "size": 8
}, },
{ {
"path": "playerItem13/gUnk_081320CC.bin", "path": "playerItemHeldObject/gUnk_081320CC.bin",
"start": 1253580, "start": 1253580,
"size": 8 "size": 8
}, },
{ {
"path": "playerItem13/gUnk_081320D4.bin", "path": "playerItemHeldObject/gUnk_081320D4.bin",
"start": 1253588, "start": 1253588,
"size": 16 "size": 16
}, },
{ {
"path": "playerItem13/gUnk_081320E4.bin", "path": "playerItemHeldObject/gUnk_081320E4.bin",
"start": 1253604, "start": 1253604,
"size": 12 "size": 12
}, },

View File

@ -258,7 +258,7 @@
.equiv SFX_101, 0x101 .equiv SFX_101, 0x101
.equiv SFX_102, 0x102 .equiv SFX_102, 0x102
.equiv SFX_103, 0x103 .equiv SFX_103, 0x103
.equiv SFX_104, 0x104 .equiv SFX_PLACE_OBJ, 0x104
.equiv SFX_105, 0x105 .equiv SFX_105, 0x105
.equiv SFX_106, 0x106 .equiv SFX_106, 0x106
.equiv SFX_107, 0x107 .equiv SFX_107, 0x107

View File

@ -1,9 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_0812AA80:: @ 0812AA80
.4byte sub_080ACC04
.4byte sub_080ACC5C

View File

@ -9,5 +9,5 @@ gUnk_08127270:: @ 08127270
.4byte sub_080A310C .4byte sub_080A310C
gUnk_08127278:: @ 08127278 gUnk_08127278:: @ 08127278
.incbin "playerItem15/gUnk_08127278.bin" .incbin "playerItemFireRodProjectile/gUnk_08127278.bin"

View File

@ -12,7 +12,7 @@ gUnk_080B3DD0:: @ 080B3DD0
.4byte sub_08018F6C .4byte sub_08018F6C
gUnk_080B3DE0:: @ 080B3DE0 gUnk_080B3DE0:: @ 080B3DE0
.incbin "playerItem11/gUnk_080B3DE0.bin" .incbin "playerItemGustBig/gUnk_080B3DE0.bin"
gUnk_080B3DE8:: @ 080B3DE8 gUnk_080B3DE8:: @ 080B3DE8
.4byte gUnk_080B3E18 .4byte gUnk_080B3E18
@ -20,13 +20,13 @@ gUnk_080B3DE8:: @ 080B3DE8
.4byte gUnk_080B3E28 .4byte gUnk_080B3E28
gUnk_080B3DF4:: @ 080B3DF4 gUnk_080B3DF4:: @ 080B3DF4
.incbin "playerItem11/gUnk_080B3DF4.bin" .incbin "playerItemGustBig/gUnk_080B3DF4.bin"
gUnk_080B3E18:: @ 080B3E18 gUnk_080B3E18:: @ 080B3E18
.incbin "playerItem11/gUnk_080B3E18.bin" .incbin "playerItemGustBig/gUnk_080B3E18.bin"
gUnk_080B3E20:: @ 080B3E20 gUnk_080B3E20:: @ 080B3E20
.incbin "playerItem11/gUnk_080B3E20.bin" .incbin "playerItemGustBig/gUnk_080B3E20.bin"
gUnk_080B3E28:: @ 080B3E28 gUnk_080B3E28:: @ 080B3E28
.incbin "playerItem11/gUnk_080B3E28.bin" .incbin "playerItemGustBig/gUnk_080B3E28.bin"

View File

@ -11,16 +11,16 @@ gUnk_081320A8:: @ 081320A8
.4byte sub_080AD274 .4byte sub_080AD274
gUnk_081320B8:: @ 081320B8 gUnk_081320B8:: @ 081320B8
.incbin "playerItem13/gUnk_081320B8.bin" .incbin "playerItemHeldObject/gUnk_081320B8.bin"
gUnk_081320C4:: @ 081320C4 gUnk_081320C4:: @ 081320C4
.incbin "playerItem13/gUnk_081320C4.bin" .incbin "playerItemHeldObject/gUnk_081320C4.bin"
gUnk_081320CC:: @ 081320CC gUnk_081320CC:: @ 081320CC
.incbin "playerItem13/gUnk_081320CC.bin" .incbin "playerItemHeldObject/gUnk_081320CC.bin"
gUnk_081320D4:: @ 081320D4 gUnk_081320D4:: @ 081320D4
.incbin "playerItem13/gUnk_081320D4.bin" .incbin "playerItemHeldObject/gUnk_081320D4.bin"
gUnk_081320E4:: @ 081320E4 gUnk_081320E4:: @ 081320E4
.incbin "playerItem13/gUnk_081320E4.bin" .incbin "playerItemHeldObject/gUnk_081320E4.bin"

View File

@ -9,4 +9,4 @@ gUnk_08109AC8:: @ 08109AC8
.4byte sub_0805FC74 .4byte sub_0805FC74
gUnk_08109AD0:: @ 08109AD0 gUnk_08109AD0:: @ 08109AD0
.incbin "playerItem14/gUnk_08109AD0.bin" .incbin "playerItemSpiralBeam/gUnk_08109AD0.bin"

View File

@ -292,7 +292,7 @@ typedef enum {
SFX_101, SFX_101,
SFX_102, SFX_102,
SFX_103, SFX_103,
SFX_104, SFX_PLACE_OBJ,
SFX_105, SFX_105,
SFX_106, SFX_106,
SFX_107, SFX_107,

View File

@ -308,13 +308,13 @@ SECTIONS {
/* C source compiled without interworking */ /* C source compiled without interworking */
asm/kinstone.o(.text); asm/kinstone.o(.text);
src/kinstone.o(.text); src/kinstone.o(.text);
src/playerItem/playerItem11.o(.text); src/playerItem/playerItemGustBig.o(.text);
src/playerItem/playerItemBow.o(.text); src/playerItem/playerItemBow.o(.text);
src/playerItem/playerItemSwordBeam.o(.text); src/playerItem/playerItemSwordBeam.o(.text);
asm/beanstalkSubtask.o(.text); asm/beanstalkSubtask.o(.text);
src/playerItem/playerItemBomb.o(.text); src/playerItem/playerItemBomb.o(.text);
src/playerItem/playerItem3.o(.text); src/playerItem/playerItemBoomerang.o(.text);
src/playerItem/playerItemC.o(.text); src/playerItem/playerItemDashSword.o(.text);
src/playerItem/playerItemBottle.o(.text); src/playerItem/playerItemBottle.o(.text);
src/playerItem/playerItemCellOverwriteSet.o(.text); src/playerItem/playerItemCellOverwriteSet.o(.text);
src/ui.o(.text); src/ui.o(.text);
@ -503,7 +503,7 @@ SECTIONS {
src/code_0805EC04.o(.text); /* objaffine? */ src/code_0805EC04.o(.text); /* objaffine? */
src/text.o(.text); src/text.o(.text);
src/debug.o(.text); src/debug.o(.text);
src/playerItem/playerItem14.o(.text); src/playerItem/playerItemSpiralBeam.o(.text);
/* npcs */ /* npcs */
src/npc/gentari.o(.text); src/npc/gentari.o(.text);
src/npc/festari.o(.text); src/npc/festari.o(.text);
@ -595,7 +595,7 @@ SECTIONS {
/* END npcs */ /* END npcs */
src/npcUtils.o(.text); src/npcUtils.o(.text);
src/coord.o(.text); /* physics? */ src/coord.o(.text); /* physics? */
src/playerItem/playerItem12.o(.text); src/playerItem/playerItemPacciCaneProjectile.o(.text);
src/playerItem/playerItemPacciCane.o(.text); src/playerItem/playerItemPacciCane.o(.text);
src/player.o(.text); src/player.o(.text);
src/item.o(.text); src/item.o(.text);
@ -819,7 +819,7 @@ SECTIONS {
/* END objects */ /* END objects */
src/objectUtils.o(.text); src/objectUtils.o(.text);
src/playerItem/playerItemShield.o(.text); src/playerItem/playerItemShield.o(.text);
src/playerItem/playerItem15.o(.text); src/playerItem/playerItemFireRodProjectile.o(.text);
#ifdef DEMO_USA #ifdef DEMO_USA
src/demo.o(.text); src/demo.o(.text);
#endif #endif
@ -869,8 +869,8 @@ SECTIONS {
src/projectile/gyorgTail.o(.text); src/projectile/gyorgTail.o(.text);
src/projectile/gyorgMaleEnergyProjectile.o(.text); src/projectile/gyorgMaleEnergyProjectile.o(.text);
src/projectile/v3TennisBallProjectile.o(.text); src/projectile/v3TennisBallProjectile.o(.text);
src/playerItem/playerItem10.o(.text); src/playerItem/playerItemGust.o(.text);
src/playerItem/playerItem13.o(.text); src/playerItem/playerItemHeldObject.o(.text);
src/title.o(.text); src/title.o(.text);
src/affine.o(.text); src/affine.o(.text);
src/playerItem/playerItemGustJar.o(.text); src/playerItem/playerItemGustJar.o(.text);
@ -894,14 +894,14 @@ SECTIONS {
src/npc.o(.rodata); src/npc.o(.rodata);
src/collision.o(.rodata); src/collision.o(.rodata);
data/data_080B3740.o(.rodata); data/data_080B3740.o(.rodata);
data/const/playerItem/playerItem11.o(.rodata); data/const/playerItem/playerItemGustBig.o(.rodata);
data/const/playerItem/playerItemBow.o(.rodata); data/const/playerItem/playerItemBow.o(.rodata);
data/data_080B3E70.o(.rodata); data/data_080B3E70.o(.rodata);
data/const/playerItem/playerItemSwordBeam.o(.rodata); data/const/playerItem/playerItemSwordBeam.o(.rodata);
data/data_080B4410.o(.rodata); data/data_080B4410.o(.rodata);
data/const/playerItem/playerItemBomb.o(.rodata); data/const/playerItem/playerItemBomb.o(.rodata);
src/playerItem/playerItem3.o(.rodata); src/playerItem/playerItemBoomerang.o(.rodata);
src/playerItem/playerItemC.o(.rodata); src/playerItem/playerItemDashSword.o(.rodata);
src/playerItem/playerItemBottle.o(.rodata); src/playerItem/playerItemBottle.o(.rodata);
data/data_080B7910.o(.rodata); data/data_080B7910.o(.rodata);
data/const/playerItem/playerItemCellOverwriteSet.o(.rodata); data/const/playerItem/playerItemCellOverwriteSet.o(.rodata);
@ -1151,7 +1151,7 @@ SECTIONS {
data/const/manager/manager38.o(.rodata); data/const/manager/manager38.o(.rodata);
data/const/manager/manager39.o(.rodata); data/const/manager/manager39.o(.rodata);
data/data_08108E6C.o(.rodata); data/data_08108E6C.o(.rodata);
data/const/playerItem/playerItem14.o(.rodata); data/const/playerItem/playerItemSpiralBeam.o(.rodata);
data/animations/npc/gentari.o(.rodata); data/animations/npc/gentari.o(.rodata);
data/const/npc/festari.o(.rodata); data/const/npc/festari.o(.rodata);
data/animations/npc/festari.o(.rodata); data/animations/npc/festari.o(.rodata);
@ -1307,7 +1307,7 @@ SECTIONS {
src/coord.o(.rodata); src/coord.o(.rodata);
src/playerHitbox.o(.rodata); src/playerHitbox.o(.rodata);
data/gfx/sprite_frames.o(.rodata); data/gfx/sprite_frames.o(.rodata);
src/playerItem/playerItem12.o(.rodata); src/playerItem/playerItemPacciCaneProjectile.o(.rodata);
src/playerItem/playerItemPacciCane.o(.rodata); src/playerItem/playerItemPacciCane.o(.rodata);
src/player.o(.rodata); src/player.o(.rodata);
src/item.o(.rodata); src/item.o(.rodata);
@ -1574,7 +1574,7 @@ SECTIONS {
src/playerItemDefinitions.o(.rodata); src/playerItemDefinitions.o(.rodata);
data/data_08125104.o(.rodata); data/data_08125104.o(.rodata);
data/const/playerItem/playerItemShield.o(.rodata); data/const/playerItem/playerItemShield.o(.rodata);
data/const/playerItem/playerItem15.o(.rodata); data/const/playerItem/playerItemFireRodProjectile.o(.rodata);
#ifdef DEMO_USA #ifdef DEMO_USA
data/const/demo.o(.rodata); data/const/demo.o(.rodata);
#endif #endif
@ -1644,10 +1644,9 @@ SECTIONS {
src/projectile/gyorgMaleEnergyProjectile.o(.rodata); src/projectile/gyorgMaleEnergyProjectile.o(.rodata);
data/animations/projectile/gyorgMaleEnergyProjectile.o(.rodata); data/animations/projectile/gyorgMaleEnergyProjectile.o(.rodata);
src/projectile/v3TennisBallProjectile.o(.rodata); src/projectile/v3TennisBallProjectile.o(.rodata);
data/const/playerItem/playerItem10.o(.rodata); src/playerItem/playerItemGust.o(.rodata);
src/playerItem/playerItem10.o(.rodata);
src/flagDebug.o(.rodata); src/flagDebug.o(.rodata);
data/const/playerItem/playerItem13.o(.rodata); data/const/playerItem/playerItemHeldObject.o(.rodata);
src/title.o(.rodata); src/title.o(.rodata);
src/projectile.o(.rodata); src/projectile.o(.rodata);
src/playerItem/playerItemGustJar.o(.rodata); src/playerItem/playerItemGustJar.o(.rodata);

View File

@ -243,7 +243,7 @@ void sub_0802CAF8(Entity* this) {
sub_0802CBC4(this); sub_0802CBC4(this);
} else { } else {
if (this->field_0x80.HALF.HI && sub_080044EC(this, 0x2800) == 1) { if (this->field_0x80.HALF.HI && sub_080044EC(this, 0x2800) == 1) {
EnqueueSFX(SFX_104); EnqueueSFX(SFX_PLACE_OBJ);
} }
sub_0802CC18(this); sub_0802CC18(this);
RegisterCarryEntity(this); RegisterCarryEntity(this);

View File

@ -90,7 +90,7 @@ void sub_080220F0(Entity* this) {
fx->y.HALF.HI += off->v; fx->y.HALF.HI += off->v;
} }
} }
EnqueueSFX(SFX_104); EnqueueSFX(SFX_PLACE_OBJ);
} else if (this->frame & 1) { } else if (this->frame & 1) {
this->damage = 4; this->damage = 4;
} }

View File

@ -205,7 +205,7 @@ void sub_0802805C(Entity* this) {
} }
if ((this->actionDelay & 3) == 0) { if ((this->actionDelay & 3) == 0) {
EnqueueSFX(SFX_104); EnqueueSFX(SFX_PLACE_OBJ);
} }
} }
} }

View File

@ -452,7 +452,7 @@ void sub_0802A098(Entity* this) {
if (sub_08029F48(this)) { if (sub_08029F48(this)) {
sub_08029E0C(this); sub_08029E0C(this);
sub_08029EEC(this); sub_08029EEC(this);
EnqueueSFX(SFX_104); EnqueueSFX(SFX_PLACE_OBJ);
} }
sub_08029FB4(this, this->x.HALF.HI - uVar1, this->y.HALF.HI - uVar2); sub_08029FB4(this, this->x.HALF.HI - uVar1, this->y.HALF.HI - uVar2);

View File

@ -188,7 +188,7 @@ void Rollobite_RolledUp(Entity* this) {
RegisterCarryEntity(this); RegisterCarryEntity(this);
} else { } else {
if (unk == 1) if (unk == 1)
EnqueueSFX(SFX_104); EnqueueSFX(SFX_PLACE_OBJ);
if ((this->direction & 0x80) == 0) if ((this->direction & 0x80) == 0)
ProcessMovement2(this); ProcessMovement2(this);

View File

@ -71,7 +71,7 @@ void RupeeLike_OnCollision(Entity* this) {
this->field_0x82.HALF.HI = 0x41; this->field_0x82.HALF.HI = 0x41;
this->flags2 &= 0xfc; this->flags2 &= 0xfc;
this->field_0x80.HALF.LO = gPlayerEntity.spritePriority.b1; this->field_0x80.HALF.LO = gPlayerEntity.spritePriority.b1;
EnqueueSFX(SFX_104); EnqueueSFX(SFX_PLACE_OBJ);
} else { } else {
if (this->confusedTime != 0) { if (this->confusedTime != 0) {
Create0x68FX(this, FX_STARS); Create0x68FX(this, FX_STARS);

View File

@ -11,6 +11,6 @@ void (*const gItemFunctions[])(ItemBehavior*, u32) = {
ItemJarEmpty, ItemJarEmpty, ItemJarEmpty, ItemJarEmpty, ItemJarEmpty, ItemJarEmpty, ItemJarEmpty, ItemJarEmpty,
}; };
void sub_080752E8(ItemBehavior* behavior, u32 arg1) { void sub_080752E8(ItemBehavior* behavior, u32 idx) {
gItemFunctions[behavior->behaviorID](behavior, arg1); gItemFunctions[behavior->behaviorID](behavior, idx);
} }

View File

@ -9,15 +9,15 @@ extern void (*const gUnk_0811BD98[])(ItemBehavior*, u32);
extern s8 gUnk_0811BDAC[]; extern s8 gUnk_0811BDAC[];
void ItemBomb(ItemBehavior* this, u32 arg1) { void ItemBomb(ItemBehavior* this, u32 idx) {
gUnk_0811BD98[this->stateID](this, arg1); gUnk_0811BD98[this->stateID](this, idx);
} }
void sub_08075FF8(ItemBehavior* this, u32 arg1) { void sub_08075FF8(ItemBehavior* this, u32 idx) {
Entity* entity; Entity* entity;
u32 maxBombs; u32 maxBombs;
u32 bombCount; u32 bombCount;
s8* tmp; s8* pos;
s32 x; s32 x;
s32 y; s32 y;
@ -25,24 +25,20 @@ void sub_08075FF8(ItemBehavior* this, u32 arg1) {
bombCount = 0; bombCount = 0;
for (entity = FindEntityByID(PLAYER_ITEM, PLAYER_ITEM_BOMB, 2); entity != NULL; for (entity = FindEntityByID(PLAYER_ITEM, PLAYER_ITEM_BOMB, 2); entity != NULL;
entity = FindNextDuplicateID(entity, 2)) { entity = FindNextDuplicateID(entity, 2)) {
bombCount += 1; bombCount++;
} }
maxBombs = this->behaviorID == 7 ? 3 : 1; maxBombs = this->behaviorID == 7 ? 3 : 1;
if (maxBombs > bombCount) { if (maxBombs > bombCount) {
entity = CreatePlayerItemWithParent(this, 2); entity = CreatePlayerItemWithParent(this, 2);
if (entity != NULL) { if (entity != NULL) {
tmp = &gUnk_0811BDAC[gPlayerEntity.animationState & 6]; pos = &gUnk_0811BDAC[gPlayerEntity.animationState & 6];
// TODO fix array access PositionRelative(&gPlayerEntity, entity, Q_16_16(pos[0]), Q_16_16(pos[1]));
x = tmp[0] << 0x10;
y = tmp[1] << 0x10;
PositionRelative(&gPlayerEntity, entity, x, y);
ModBombs(-1); ModBombs(-1);
SoundReq(SFX_104); SoundReq(SFX_PLACE_OBJ);
} }
} }
} }
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
} }
// TODO arg1 type not yet known, called by ItemPickupCheck and sub_080762D8
ASM_FUNC("asm/non_matching/itemBomb/sub_08076088.inc", void sub_08076088(ItemBehavior* this, void* arg1)) ASM_FUNC("asm/non_matching/itemBomb/sub_08076088.inc", void sub_08076088(ItemBehavior* this, void* arg1))

View File

@ -3,23 +3,23 @@
extern void (*const gUnk_0811BD78[])(ItemBehavior*, u32); extern void (*const gUnk_0811BD78[])(ItemBehavior*, u32);
void ItemBoomerang(ItemBehavior* this, u32 arg1) { void ItemBoomerang(ItemBehavior* this, u32 idx) {
gUnk_0811BD78[this->stateID](this, arg1); gUnk_0811BD78[this->stateID](this, idx);
} }
void sub_08075D2C(ItemBehavior* this, u32 arg1) { void sub_08075D2C(ItemBehavior* this, u32 idx) {
if (((gPlayerState.field_0x3[1] & 8) == 0) && (sub_08077C94(this, this->behaviorID) == NULL)) { if (((gPlayerState.field_0x3[1] & 8) == 0) && (sub_08077C94(this, this->behaviorID) == NULL)) {
this->field_0x5[4] |= 0xf; this->field_0x5[4] |= 0xf;
sub_0806F948(&gPlayerEntity); sub_0806F948(&gPlayerEntity);
sub_08077C0C(this, 0xb); sub_08077C0C(this, 0xb);
sub_08077D38(this, arg1); sub_08077D38(this, idx);
gPlayerState.field_0x3[1] |= 8; gPlayerState.field_0x3[1] |= 8;
} else { } else {
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
} }
} }
void sub_08075D88(ItemBehavior* this, u32 arg1) { void sub_08075D88(ItemBehavior* this, u32 idx) {
if ((gPlayerState.field_0x3[1] & 0x80) == 0) { if ((gPlayerState.field_0x3[1] & 0x80) == 0) {
if (((this->behaviorID == 0xc) && ((gPlayerState.field_0xa & 0x80) != 0)) && ((this->field_0x5[9] & 2) != 0)) { if (((this->behaviorID == 0xc) && ((gPlayerState.field_0xa & 0x80) != 0)) && ((this->field_0x5[9] & 2) != 0)) {
ResetPlayerVelocity(); ResetPlayerVelocity();
@ -30,5 +30,5 @@ void sub_08075D88(ItemBehavior* this, u32 arg1) {
return; return;
} }
} }
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
} }

View File

@ -4,23 +4,23 @@
extern void (*const gUnk_0811BD80[])(ItemBehavior*, u32); extern void (*const gUnk_0811BD80[])(ItemBehavior*, u32);
void ItemBow(ItemBehavior* this, u32 arg1) { void ItemBow(ItemBehavior* this, u32 idx) {
gUnk_0811BD80[this->stateID](this, arg1); gUnk_0811BD80[this->stateID](this, idx);
} }
void sub_08075DF4(ItemBehavior* this, u32 arg1) { void sub_08075DF4(ItemBehavior* this, u32 idx) {
if ((gPlayerState.field_0x3[1] & 8) == 0) { if ((gPlayerState.field_0x3[1] & 8) == 0) {
this->field_0x5[4] |= 0x80; this->field_0x5[4] |= 0x80;
sub_0806F948(&gPlayerEntity); sub_0806F948(&gPlayerEntity);
sub_08077BB8(this); sub_08077BB8(this);
sub_08077D38(this, arg1); sub_08077D38(this, idx);
gPlayerState.field_0x1f[2] = 1; gPlayerState.field_0x1f[2] = 1;
} else { } else {
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
} }
} }
void sub_08075E40(ItemBehavior* this, u32 arg1) { void sub_08075E40(ItemBehavior* this, u32 idx) {
u8 bVar1; u8 bVar1;
if (gPlayerState.field_0x1f[2] != 0) { if (gPlayerState.field_0x1f[2] != 0) {
@ -32,17 +32,17 @@ void sub_08075E40(ItemBehavior* this, u32 arg1) {
this->field_0x5[4] &= 0x7f; this->field_0x5[4] &= 0x7f;
if (gSave.stats.arrowCount != 0) { if (gSave.stats.arrowCount != 0) {
this->field_0xf = bVar1; this->field_0xf = bVar1;
gPlayerState.field_0xa &= ~(8 >> arg1); gPlayerState.field_0xa &= ~(8 >> idx);
} }
} }
return; return;
} }
} }
gPlayerState.field_0x1f[2] = 0; gPlayerState.field_0x1f[2] = 0;
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
} }
void sub_08075EC0(ItemBehavior* this, u32 arg1) { void sub_08075EC0(ItemBehavior* this, u32 idx) {
u8 arrowCount; u8 arrowCount;
s32 iVar2; s32 iVar2;
@ -51,10 +51,10 @@ void sub_08075EC0(ItemBehavior* this, u32 arg1) {
if (iVar2 != 0 && arrowCount != 0) { if (iVar2 != 0 && arrowCount != 0) {
if (((gPlayerState.field_0x3[1] & 0x80) != 0) || (gPlayerState.field_0x1f[2] == 0)) { if (((gPlayerState.field_0x3[1] & 0x80) != 0) || (gPlayerState.field_0x1f[2] == 0)) {
gPlayerState.field_0x1f[2] = 0; gPlayerState.field_0x1f[2] = 0;
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
} }
} else { } else {
gPlayerState.field_0xa = (8 >> arg1) | gPlayerState.field_0xa; gPlayerState.field_0xa = (8 >> idx) | gPlayerState.field_0xa;
sub_08077DF4(this, 0x27c); sub_08077DF4(this, 0x27c);
this->field_0xf = 0xf; this->field_0xf = 0xf;
this->field_0x5[4] |= 0xf; this->field_0x5[4] |= 0xf;
@ -62,7 +62,7 @@ void sub_08075EC0(ItemBehavior* this, u32 arg1) {
} }
} }
void sub_08075F38(ItemBehavior* this, u32 arg1) { void sub_08075F38(ItemBehavior* this, u32 idx) {
if (((gPlayerState.field_0x3[1] & 0x80) == 0) && (gPlayerState.field_0x1f[2] != 0)) { if (((gPlayerState.field_0x3[1] & 0x80) == 0) && (gPlayerState.field_0x1f[2] != 0)) {
UpdateItemAnim(this); UpdateItemAnim(this);
if ((this->field_0x5[9] & 1) != 0) { if ((this->field_0x5[9] & 1) != 0) {
@ -70,11 +70,11 @@ void sub_08075F38(ItemBehavior* this, u32 arg1) {
} }
} else { } else {
gPlayerState.field_0x1f[2] = 0; gPlayerState.field_0x1f[2] = 0;
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
} }
} }
void sub_08075F84(ItemBehavior* this, u32 arg1) { void sub_08075F84(ItemBehavior* this, u32 idx) {
if (((gPlayerState.field_0x3[1] & 0x80) == 0) && (gPlayerState.field_0x1f[2] != 0)) { if (((gPlayerState.field_0x3[1] & 0x80) == 0) && (gPlayerState.field_0x1f[2] != 0)) {
if (GetInventoryValue(ITEM_ARROW_BUTTERFLY) == 1) { if (GetInventoryValue(ITEM_ARROW_BUTTERFLY) == 1) {
sub_08077E3C(this, 5); sub_08077E3C(this, 5);
@ -86,5 +86,5 @@ void sub_08075F84(ItemBehavior* this, u32 arg1) {
} }
} }
gPlayerState.field_0x1f[2] = 0; gPlayerState.field_0x1f[2] = 0;
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
} }

View File

@ -3,7 +3,7 @@
extern Entity* sub_08077BD4(ItemBehavior*); extern Entity* sub_08077BD4(ItemBehavior*);
extern void DeletePlayerItem(ItemBehavior*, u32); extern void DeletePlayerItem(ItemBehavior*, u32);
void ItemDebug(ItemBehavior* beh, u32 arg1) { void ItemDebug(ItemBehavior* beh, u32 idx) {
sub_08077BD4(beh); sub_08077BD4(beh);
DeletePlayerItem(beh, arg1); DeletePlayerItem(beh, idx);
} }

View File

@ -5,15 +5,15 @@
void (*const ItemGustJar_StateFunctions[])(ItemBehavior* beh, u32); void (*const ItemGustJar_StateFunctions[])(ItemBehavior* beh, u32);
void ItemGustJar(ItemBehavior* this, u32 arg1) { void ItemGustJar(ItemBehavior* this, u32 idx) {
gPlayerState.framestate = PL_STATE_GUSTJAR; gPlayerState.framestate = PL_STATE_GUSTJAR;
ItemGustJar_StateFunctions[this->stateID](this, arg1); ItemGustJar_StateFunctions[this->stateID](this, idx);
} }
void sub_08076DF4(ItemBehavior* this, u32 arg1) { void sub_08076DF4(ItemBehavior* this, u32 idx) {
if (sub_0807A894(&gPlayerEntity) != 0x29 && gPlayerState.floor_type != SURFACE_DOOR && if (sub_0807A894(&gPlayerEntity) != 0x29 && gPlayerState.floor_type != SURFACE_DOOR &&
gPlayerState.floor_type != SURFACE_DOOR_13 && gPlayerState.jump_status == 0) { gPlayerState.floor_type != SURFACE_DOOR_13 && gPlayerState.jump_status == 0) {
sub_08077D38(this, arg1); sub_08077D38(this, idx);
this->field_0x5[2] = 0; this->field_0x5[2] = 0;
this->field_0x5[5] = gPlayerEntity.animationState; this->field_0x5[5] = gPlayerEntity.animationState;
this->field_0x5[4] |= 0x80; this->field_0x5[4] |= 0x80;
@ -23,20 +23,20 @@ void sub_08076DF4(ItemBehavior* this, u32 arg1) {
gPlayerState.field_0x1c = 1; gPlayerState.field_0x1c = 1;
sub_08077BB8(this); sub_08077BB8(this);
} else { } else {
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
} }
} }
void sub_08076E60(ItemBehavior* this, u32 arg1) { void sub_08076E60(ItemBehavior* this, u32 idx) {
Entity* playerItem; Entity* playerItem;
if ((gPlayerState.field_0x1c & 0xf) == 0) { if ((gPlayerState.field_0x1c & 0xf) == 0) {
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
} }
if ((this->field_0x5[9] & 0x80) != 0) { if ((this->field_0x5[9] & 0x80) != 0) {
this->stateID = 2; this->stateID = 2;
sub_08077DF4(this, 0x504); sub_08077DF4(this, 0x504);
gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> arg1); gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> idx);
playerItem = CreatePlayerItem(0x10, 0, 0, 0); playerItem = CreatePlayerItem(0x10, 0, 0, 0);
if (playerItem != NULL) { if (playerItem != NULL) {
playerItem->parent = &gPlayerEntity; playerItem->parent = &gPlayerEntity;
@ -46,9 +46,9 @@ void sub_08076E60(ItemBehavior* this, u32 arg1) {
} }
} }
void sub_08076EC8(ItemBehavior* this, u32 arg1) { void sub_08076EC8(ItemBehavior* this, u32 idx) {
if ((gPlayerState.field_0x1c & 0xf) == 0) { if ((gPlayerState.field_0x1c & 0xf) == 0) {
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
return; return;
} }
@ -81,10 +81,10 @@ void sub_08076EC8(ItemBehavior* this, u32 arg1) {
} }
this->stateID++; this->stateID++;
gPlayerState.field_0xa |= 8 >> arg1; gPlayerState.field_0xa |= 8 >> idx;
} }
void sub_08076F64(ItemBehavior* this, u32 arg1) { void sub_08076F64(ItemBehavior* this, u32 idx) {
Entity* item; Entity* item;
Entity* player; Entity* player;
switch (gPlayerState.field_0x1c & 0xf) { switch (gPlayerState.field_0x1c & 0xf) {
@ -97,7 +97,7 @@ void sub_08076F64(ItemBehavior* this, u32 arg1) {
player = &gPlayerEntity; player = &gPlayerEntity;
*(u32*)&player->field_0x74 = 0; *(u32*)&player->field_0x74 = 0;
gPlayerState.field_0x1c = 1; gPlayerState.field_0x1c = 1;
gPlayerState.field_0xa &= ~(8 >> arg1); gPlayerState.field_0xa &= ~(8 >> idx);
this->stateID = 2; this->stateID = 2;
sub_08077DF4(this, 0x504); sub_08077DF4(this, 0x504);
item = CreatePlayerItem(0x10, 0, 0, 0); item = CreatePlayerItem(0x10, 0, 0, 0);
@ -169,7 +169,7 @@ void sub_08076F64(ItemBehavior* this, u32 arg1) {
case0: case0:
gPlayerState.field_0x1c = 0; gPlayerState.field_0x1c = 0;
gPlayerEntity.field_0x70.WORD = 0; gPlayerEntity.field_0x70.WORD = 0;
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
break; break;
} }
} }

View File

@ -6,13 +6,13 @@ extern void (*const gUnk_0811BE28[])(ItemBehavior*, u32);
extern u8 gUnk_02002AC8[]; extern u8 gUnk_02002AC8[];
void ItemJarEmpty(ItemBehavior* this, u32 arg1) { void ItemJarEmpty(ItemBehavior* this, u32 idx) {
gUnk_0811BE28[this->stateID](this, arg1); gUnk_0811BE28[this->stateID](this, idx);
} }
void sub_08077534(ItemBehavior* this, u32 arg1) { void sub_08077534(ItemBehavior* this, u32 idx) {
u32 tmp; u32 tmp;
sub_08077D38(this, arg1); sub_08077D38(this, idx);
sub_0806F948(&gPlayerEntity); sub_0806F948(&gPlayerEntity);
sub_08077BB8(this); sub_08077BB8(this);
this->field_0x5[4] |= 0xf; this->field_0x5[4] |= 0xf;
@ -49,7 +49,7 @@ void sub_08077534(ItemBehavior* this, u32 arg1) {
gPlayerEntity.flags &= ~ENT_COLLIDE; gPlayerEntity.flags &= ~ENT_COLLIDE;
} }
void sub_08077618(ItemBehavior* this, u32 arg1) { void sub_08077618(ItemBehavior* this, u32 idx) {
if ((this->field_0x5[9] & 0x80) != 0) { if ((this->field_0x5[9] & 0x80) != 0) {
sub_08077DF4(this, 0x618); sub_08077DF4(this, 0x618);
this->stateID += 1; this->stateID += 1;
@ -58,18 +58,18 @@ void sub_08077618(ItemBehavior* this, u32 arg1) {
} }
} }
void sub_08077640(ItemBehavior* this, u32 arg1) { void sub_08077640(ItemBehavior* this, u32 idx) {
UpdateItemAnim(this); UpdateItemAnim(this);
if ((this->field_0x5[9] & 0x80) != 0) { if ((this->field_0x5[9] & 0x80) != 0) {
gPlayerEntity.flags |= ENT_COLLIDE; gPlayerEntity.flags |= ENT_COLLIDE;
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
} }
} }
void sub_0807766C(ItemBehavior* this, u32 arg1) { void sub_0807766C(ItemBehavior* this, u32 idx) {
UpdateItemAnim(this); UpdateItemAnim(this);
if ((this->field_0x5[9] & 0x80) != 0) { if ((this->field_0x5[9] & 0x80) != 0) {
gPlayerEntity.flags |= ENT_COLLIDE; gPlayerEntity.flags |= ENT_COLLIDE;
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
} }
} }

View File

@ -13,11 +13,11 @@ extern bool32 sub_08077F10(ItemBehavior*);
extern void sub_0807AB44(Entity*, s32, s32); extern void sub_0807AB44(Entity*, s32, s32);
void ItemLantern(ItemBehavior* this, u32 arg1) { void ItemLantern(ItemBehavior* this, u32 idx) {
gUnk_0811BD68[this->stateID](this, arg1); gUnk_0811BD68[this->stateID](this, idx);
} }
void sub_08075A0C(ItemBehavior* this, u32 arg1) { void sub_08075A0C(ItemBehavior* this, u32 idx) {
Entity* object; Entity* object;
u32 itemSlot; u32 itemSlot;
s8* tmp; s8* tmp;
@ -27,10 +27,10 @@ void sub_08075A0C(ItemBehavior* this, u32 arg1) {
ForceEquipItem(ITEM_LANTERN_OFF, itemSlot); ForceEquipItem(ITEM_LANTERN_OFF, itemSlot);
gPlayerState.flags &= ~PL_USE_LANTERN; gPlayerState.flags &= ~PL_USE_LANTERN;
ForceEquipItem(ITEM_LANTERN_OFF, itemSlot); ForceEquipItem(ITEM_LANTERN_OFF, itemSlot);
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
} else { } else {
this->field_0x5[4] |= 0x80; this->field_0x5[4] |= 0x80;
sub_08077D38(this, arg1); sub_08077D38(this, idx);
sub_08077BD4(this); sub_08077BD4(this);
sub_0806F948(&gPlayerEntity); sub_0806F948(&gPlayerEntity);
this->behaviorID = 0x10; this->behaviorID = 0x10;
@ -45,7 +45,7 @@ void sub_08075A0C(ItemBehavior* this, u32 arg1) {
} }
} }
void sub_08075ADC(ItemBehavior* this, u32 arg1) { void sub_08075ADC(ItemBehavior* this, u32 idx) {
u32 bVar1; u32 bVar1;
if ( if (
@ -57,7 +57,7 @@ void sub_08075ADC(ItemBehavior* this, u32 arg1) {
this->field_0xf = 0; this->field_0xf = 0;
this->stateID += 1; this->stateID += 1;
gPlayerState.flags |= PL_USE_LANTERN; gPlayerState.flags |= PL_USE_LANTERN;
bVar1 = 8 >> arg1; bVar1 = 8 >> idx;
gPlayerState.field_0x3[1] = gPlayerState.field_0x3[1] & ~((bVar1 << 4) | bVar1); gPlayerState.field_0x3[1] = gPlayerState.field_0x3[1] & ~((bVar1 << 4) | bVar1);
bVar1 = ~bVar1; bVar1 = ~bVar1;
gPlayerState.field_0xa = bVar1 & gPlayerState.field_0xa; gPlayerState.field_0xa = bVar1 & gPlayerState.field_0xa;
@ -68,7 +68,7 @@ void sub_08075ADC(ItemBehavior* this, u32 arg1) {
} }
} }
void sub_08075B54(ItemBehavior* this, u32 arg1) { void sub_08075B54(ItemBehavior* this, u32 idx) {
u32 bVar1; u32 bVar1;
u32 itemSlot; u32 itemSlot;
Entity* object; Entity* object;
@ -79,7 +79,7 @@ void sub_08075B54(ItemBehavior* this, u32 arg1) {
if (!(((sub_08077F10(this) == 0) && (itemSlot < 2)) || (gPlayerState.jump_status != 0))) { if (!(((sub_08077F10(this) == 0) && (itemSlot < 2)) || (gPlayerState.jump_status != 0))) {
ForceEquipItem(ITEM_LANTERN_OFF, itemSlot); ForceEquipItem(ITEM_LANTERN_OFF, itemSlot);
gPlayerState.flags &= ~PL_USE_LANTERN; gPlayerState.flags &= ~PL_USE_LANTERN;
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
SoundReq(SFX_ITEM_LANTERN_OFF); SoundReq(SFX_ITEM_LANTERN_OFF);
} else { } else {
if (((gPlayerState.queued_action != PLAYER_ROLL) && (gPlayerEntity.frameIndex < 0x37)) && if (((gPlayerState.queued_action != PLAYER_ROLL) && (gPlayerEntity.frameIndex < 0x37)) &&
@ -99,7 +99,7 @@ void sub_08075B54(ItemBehavior* this, u32 arg1) {
object->y.HALF.HI = tmp[1] + object->y.HALF.HI; object->y.HALF.HI = tmp[1] + object->y.HALF.HI;
} }
sub_08077DF4(this, 0x60c); sub_08077DF4(this, 0x60c);
bVar1 = (8 >> (arg1)); bVar1 = (8 >> (idx));
gPlayerState.field_0xa |= bVar1; gPlayerState.field_0xa |= bVar1;
gPlayerState.keepFacing |= bVar1; gPlayerState.keepFacing |= bVar1;
} }
@ -108,7 +108,7 @@ void sub_08075B54(ItemBehavior* this, u32 arg1) {
} }
} }
void sub_08075C9C(ItemBehavior* this, u32 arg1) { void sub_08075C9C(ItemBehavior* this, u32 idx) {
s8* tmp; s8* tmp;
UpdateItemAnim(this); UpdateItemAnim(this);
@ -119,8 +119,8 @@ void sub_08075C9C(ItemBehavior* this, u32 arg1) {
if ((this->field_0x5[9] & 0x80) != 0) { if ((this->field_0x5[9] & 0x80) != 0) {
this->field_0xf = 0; this->field_0xf = 0;
this->stateID -= 1; this->stateID -= 1;
gPlayerState.field_0xa = (~(8 >> arg1)) & gPlayerState.field_0xa; gPlayerState.field_0xa = (~(8 >> idx)) & gPlayerState.field_0xa;
gPlayerState.keepFacing = (~(8 >> arg1)) & gPlayerState.keepFacing; gPlayerState.keepFacing = (~(8 >> idx)) & gPlayerState.keepFacing;
} else { } else {
gPlayerEntity.field_0x7a.HWORD += 1; gPlayerEntity.field_0x7a.HWORD += 1;
} }

View File

@ -18,15 +18,15 @@ extern bool32 sub_0807B5B0(Entity*);
extern const s16 gUnk_0811BE16[]; extern const s16 gUnk_0811BE16[];
void ItemMoleMitts(ItemBehavior* this, u32 arg1) { void ItemMoleMitts(ItemBehavior* this, u32 idx) {
gUnk_0811BE04[this->stateID](this, arg1); gUnk_0811BE04[this->stateID](this, idx);
} }
void sub_08077130(ItemBehavior* this, u32 arg1) { void sub_08077130(ItemBehavior* this, u32 idx) {
s32 iVar1; s32 iVar1;
if (gPlayerState.jump_status == 0) { if (gPlayerState.jump_status == 0) {
sub_08077D38(this, arg1); sub_08077D38(this, idx);
gPlayerState.field_0x3c[1] = 1; gPlayerState.field_0x3c[1] = 1;
this->field_0x5[4] |= 0x80; this->field_0x5[4] |= 0x80;
iVar1 = sub_080774A0(); iVar1 = sub_080774A0();
@ -47,17 +47,17 @@ void sub_08077130(ItemBehavior* this, u32 arg1) {
this->stateID = 1; this->stateID = 1;
} }
} else { } else {
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
gPlayerState.field_0x3c[1] = 0; gPlayerState.field_0x3c[1] = 0;
} }
} }
void sub_080771C8(ItemBehavior* this, u32 arg1) { void sub_080771C8(ItemBehavior* this, u32 idx) {
Entity* object; Entity* object;
UpdateItemAnim(this); UpdateItemAnim(this);
if ((this->field_0x5[9] & 0x80) != 0) { if ((this->field_0x5[9] & 0x80) != 0) {
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
gPlayerState.field_0x3c[1] = 0; gPlayerState.field_0x3c[1] = 0;
} else { } else {
if (((this->field_0x5[9] & 0x20) != 0) && (this->field_0x5[3] == 0xff)) { if (((this->field_0x5[9] & 0x20) != 0) && (this->field_0x5[3] == 0xff)) {
@ -89,7 +89,7 @@ void sub_080771C8(ItemBehavior* this, u32 arg1) {
} }
} }
void sub_080772A8(ItemBehavior* this, u32 param_2) { void sub_080772A8(ItemBehavior* this, u32 idx) {
Entity* effect; Entity* effect;
if (((this->field_0x5[9] & 8) != 0) && sub_08077F10(this)) { if (((this->field_0x5[9] & 8) != 0) && sub_08077F10(this)) {
@ -119,7 +119,7 @@ void sub_080772A8(ItemBehavior* this, u32 param_2) {
return; return;
} }
} }
DeletePlayerItem(this, param_2); DeletePlayerItem(this, idx);
gPlayerState.field_0x3c[1] = 0; gPlayerState.field_0x3c[1] = 0;
} else { } else {
if ((this->field_0x5[9] & 0x60) != 0) { if ((this->field_0x5[9] & 0x60) != 0) {
@ -148,7 +148,7 @@ void sub_080772A8(ItemBehavior* this, u32 param_2) {
} }
} }
void sub_08077448(ItemBehavior* this, u32 arg1) { void sub_08077448(ItemBehavior* this, u32 idx) {
gPlayerEntity.direction = gPlayerEntity.animationState << 2 ^ 0x10; gPlayerEntity.direction = gPlayerEntity.animationState << 2 ^ 0x10;
gPlayerEntity.speed = 0x100; gPlayerEntity.speed = 0x100;
if (((this->field_0x5[9] & 1) != 0) && (this->field_0x5[0] != 0)) { if (((this->field_0x5[9] & 1) != 0) && (this->field_0x5[0] != 0)) {
@ -157,7 +157,7 @@ void sub_08077448(ItemBehavior* this, u32 arg1) {
UpdateItemAnim(this); UpdateItemAnim(this);
if ((this->field_0x5[9] & 0x80) != 0) { if ((this->field_0x5[9] & 0x80) != 0) {
gPlayerState.field_0x3c[1] = 0; gPlayerState.field_0x3c[1] = 0;
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
} }
} }

View File

@ -8,14 +8,14 @@ extern void ResetPlayerVelocity(void);
extern void CreateBird(void); extern void CreateBird(void);
void ItemOcarina(ItemBehavior* this, u32 arg1) { void ItemOcarina(ItemBehavior* this, u32 idx) {
gOcarinaStates[this->stateID](this, arg1); gOcarinaStates[this->stateID](this, idx);
gPlayerEntity.field_0x7a.HWORD += 1; gPlayerEntity.field_0x7a.HWORD += 1;
} }
void OcarinaUse(ItemBehavior* this, u32 arg1) { void OcarinaUse(ItemBehavior* this, u32 idx) {
if (gPlayerState.queued_action == PLAYER_ROLL) { if (gPlayerState.queued_action == PLAYER_ROLL) {
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
} else { } else {
this->field_0x5[4] |= 0xf; this->field_0x5[4] |= 0xf;
gPlayerEntity.animationState = 0x04; gPlayerEntity.animationState = 0x04;
@ -25,16 +25,16 @@ void OcarinaUse(ItemBehavior* this, u32 arg1) {
gPlayerState.flags |= PL_USE_OCARINA; gPlayerState.flags |= PL_USE_OCARINA;
gPlayerState.field_0x27[0] = -1; gPlayerState.field_0x27[0] = -1;
gPauseMenuOptions.disabled = 1; gPauseMenuOptions.disabled = 1;
gPlayerState.field_0xa = (8 >> arg1) | gPlayerState.field_0xa; gPlayerState.field_0xa = (8 >> idx) | gPlayerState.field_0xa;
gPlayerState.keepFacing = (8 >> arg1) | gPlayerState.keepFacing; gPlayerState.keepFacing = (8 >> idx) | gPlayerState.keepFacing;
ResetPlayerVelocity(); ResetPlayerVelocity();
sub_08077D38(this, arg1); sub_08077D38(this, idx);
SoundReq(SFX_216); SoundReq(SFX_216);
SetPlayerEventPriority(); SetPlayerEventPriority();
} }
} }
NONMATCH("asm/non_matching/ocarina/OcarinaUpdate.inc", void OcarinaUpdate(ItemBehavior* this, u32 arg1)) { NONMATCH("asm/non_matching/ocarina/OcarinaUpdate.inc", void OcarinaUpdate(ItemBehavior* this, u32 idx)) {
// TODO regalloc // TODO regalloc
UpdateItemAnim(this); UpdateItemAnim(this);
if ((this->field_0x5[9] & 0x80) != 0) { if ((this->field_0x5[9] & 0x80) != 0) {
@ -44,7 +44,7 @@ NONMATCH("asm/non_matching/ocarina/OcarinaUpdate.inc", void OcarinaUpdate(ItemBe
gPauseMenuOptions.disabled = 0; gPauseMenuOptions.disabled = 0;
CreateBird(); CreateBird();
ResetPlayerEventPriority(); ResetPlayerEventPriority();
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
} }
} }
END_NONMATCH END_NONMATCH

View File

@ -5,20 +5,20 @@
extern void (*const gUnk_0811BDE0[])(ItemBehavior* beh, u32); extern void (*const gUnk_0811BDE0[])(ItemBehavior* beh, u32);
void ItemPacciCane(ItemBehavior* beh, u32 arg1) { void ItemPacciCane(ItemBehavior* beh, u32 idx) {
gUnk_0811BDE0[beh->stateID](beh, arg1); gUnk_0811BDE0[beh->stateID](beh, idx);
} }
void sub_08076C98(ItemBehavior* beh, u32 arg1) { void sub_08076C98(ItemBehavior* beh, u32 idx) {
beh->field_0x5[4] |= 0xf; beh->field_0x5[4] |= 0xf;
sub_08077D38(beh, arg1); sub_08077D38(beh, idx);
sub_0806F948(&gPlayerEntity); sub_0806F948(&gPlayerEntity);
sub_08077BB8(beh); sub_08077BB8(beh);
} }
void sub_08076CBC(ItemBehavior* beh, u32 arg1) { void sub_08076CBC(ItemBehavior* beh, u32 idx) {
if ((beh->field_0x5[9] & 0x80) != 0) { if ((beh->field_0x5[9] & 0x80) != 0) {
DeletePlayerItem(beh, arg1); DeletePlayerItem(beh, idx);
} else { } else {
if ((beh->field_0x5[9] & 0x40) != 0) { if ((beh->field_0x5[9] & 0x40) != 0) {
CreatePlayerItemWithParent(beh, 0x12); CreatePlayerItemWithParent(beh, 0x12);

View File

@ -13,7 +13,7 @@ void sub_08076A88(ItemBehavior*, u32);
extern u16 gUnk_0800275C[]; extern u16 gUnk_0800275C[];
extern u8 gUnk_0811BE38[]; extern u8 gUnk_0811BE38[];
void ItemPegasusBoots(ItemBehavior* this, u32 arg1) { void ItemPegasusBoots(ItemBehavior* this, u32 idx) {
static void (*const ItemPegasusBoots_StateFunctions[])(ItemBehavior * beh, u32) = { static void (*const ItemPegasusBoots_StateFunctions[])(ItemBehavior * beh, u32) = {
sub_080768F8, sub_080768F8,
sub_08076964, sub_08076964,
@ -26,7 +26,7 @@ void ItemPegasusBoots(ItemBehavior* this, u32 arg1) {
if (gPlayerEntity.field_0x7a.HWORD != 0) { if (gPlayerEntity.field_0x7a.HWORD != 0) {
gPlayerState.dash_state = 0; gPlayerState.dash_state = 0;
gPlayerState.field_0xe = 0; gPlayerState.field_0xe = 0;
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
} else { } else {
bVar1 = this->field_0x5[2] - 1; bVar1 = this->field_0x5[2] - 1;
this->field_0x5[2] = bVar1; this->field_0x5[2] = bVar1;
@ -54,11 +54,11 @@ void ItemPegasusBoots(ItemBehavior* this, u32 arg1) {
} }
} }
} }
ItemPegasusBoots_StateFunctions[this->stateID](this, arg1); ItemPegasusBoots_StateFunctions[this->stateID](this, idx);
} }
} }
void sub_080768F8(ItemBehavior* this, u32 arg1) { void sub_080768F8(ItemBehavior* this, u32 idx) {
u32 bVar1; u32 bVar1;
u32 bVar2; u32 bVar2;
@ -73,16 +73,16 @@ void sub_080768F8(ItemBehavior* this, u32 arg1) {
} else { } else {
gPlayerState.animation = 0xc14; gPlayerState.animation = 0xc14;
} }
sub_08077D38(this, arg1); sub_08077D38(this, idx);
sub_08076964(this, arg1); sub_08076964(this, idx);
} else { } else {
gPlayerState.dash_state = 0; gPlayerState.dash_state = 0;
gPlayerState.field_0xe = 0; gPlayerState.field_0xe = 0;
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
} }
} }
void sub_08076964(ItemBehavior* this, u32 arg1) { void sub_08076964(ItemBehavior* this, u32 idx) {
Entity* bombEntity; Entity* bombEntity;
u32 uVar3; u32 uVar3;
if (sub_08077EFC(this) && gPlayerEntity.z.WORD == 0 && gPlayerState.dash_state) { if (sub_08077EFC(this) && gPlayerEntity.z.WORD == 0 && gPlayerState.dash_state) {
@ -95,11 +95,11 @@ void sub_08076964(ItemBehavior* this, u32 arg1) {
if ((++gPlayerState.dash_state) == 0x1e) { if ((++gPlayerState.dash_state) == 0x1e) {
if ((gPlayerState.flags & PL_FLAGS2) != 0) { if ((gPlayerState.flags & PL_FLAGS2) != 0) {
gPlayerState.dash_state = 0; gPlayerState.dash_state = 0;
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
return; return;
} }
gPlayerState.dash_state = 0x40; gPlayerState.dash_state = 0x40;
gPlayerState.field_0xa &= ~(8 >> arg1); gPlayerState.field_0xa &= ~(8 >> idx);
this->stateID++; this->stateID++;
if (HasSwordEquipped() && (gPlayerState.flags & PL_MINISH) == 0 && if (HasSwordEquipped() && (gPlayerState.flags & PL_MINISH) == 0 &&
(gPlayerState.skills & SKILL_DASH_ATTACK) != 0) { (gPlayerState.skills & SKILL_DASH_ATTACK) != 0) {
@ -127,10 +127,10 @@ void sub_08076964(ItemBehavior* this, u32 arg1) {
} }
} }
gPlayerState.dash_state = 0; gPlayerState.dash_state = 0;
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
} }
void sub_08076A88(ItemBehavior* this, u32 arg1) { void sub_08076A88(ItemBehavior* this, u32 idx) {
u32 uVar1; u32 uVar1;
u32 uVar2; u32 uVar2;
u8* ptr; u8* ptr;
@ -170,5 +170,5 @@ void sub_08076A88(ItemBehavior* this, u32 arg1) {
} }
} }
gPlayerState.dash_state = 0; gPlayerState.dash_state = 0;
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
} }

View File

@ -6,40 +6,40 @@
extern void (*const gUnk_0811BDE8[])(ItemBehavior* beh, u32); extern void (*const gUnk_0811BDE8[])(ItemBehavior* beh, u32);
void ItemShield(ItemBehavior* beh, u32 arg1) { void ItemShield(ItemBehavior* beh, u32 idx) {
gUnk_0811BDE8[beh->stateID](beh, arg1); gUnk_0811BDE8[beh->stateID](beh, idx);
} }
void sub_08076D04(ItemBehavior* beh, u32 arg1) { void sub_08076D04(ItemBehavior* beh, u32 idx) {
gPlayerState.field_0x3[0] = 0x81; gPlayerState.field_0x3[0] = 0x81;
beh->field_0x5[4] = 2; beh->field_0x5[4] = 2;
sub_0806F948(&gPlayerEntity); sub_0806F948(&gPlayerEntity);
sub_08077D38(beh, arg1); sub_08077D38(beh, idx);
sub_08077BB8(beh); sub_08077BB8(beh);
} }
void sub_08076D34(ItemBehavior* beh, u32 arg1) { void sub_08076D34(ItemBehavior* beh, u32 idx) {
if (sub_08077EFC(beh) != 0) { if (sub_08077EFC(beh) != 0) {
gPlayerState.field_0x3[0] |= 1; gPlayerState.field_0x3[0] |= 1;
UpdateItemAnim(beh); UpdateItemAnim(beh);
if (beh->field_0x5[9] != 0) { if (beh->field_0x5[9] != 0) {
beh->stateID++; beh->stateID++;
beh->field_0xf = 0; beh->field_0xf = 0;
gPlayerState.field_0xa &= ~(u8)(8 >> arg1); gPlayerState.field_0xa &= ~(u8)(8 >> idx);
SoundReq(SFX_15D); SoundReq(SFX_15D);
} }
} else { } else {
gPlayerState.field_0x3[0] = 0; gPlayerState.field_0x3[0] = 0;
DeletePlayerItem(beh, arg1); DeletePlayerItem(beh, idx);
} }
} }
void sub_08076D94(ItemBehavior* beh, u32 arg1) { void sub_08076D94(ItemBehavior* beh, u32 idx) {
if (sub_08077EFC(beh)) { if (sub_08077EFC(beh)) {
gPlayerState.field_0x3[0] |= 1; gPlayerState.field_0x3[0] |= 1;
UpdateItemAnim(beh); UpdateItemAnim(beh);
} else { } else {
gPlayerState.field_0x3[0] = 0; gPlayerState.field_0x3[0] = 0;
DeletePlayerItem(beh, arg1); DeletePlayerItem(beh, idx);
} }
} }

View File

@ -11,18 +11,18 @@ void sub_080754B8(ItemBehavior*, u32);
void sub_08075898(ItemBehavior*, u32); void sub_08075898(ItemBehavior*, u32);
void sub_08075580(ItemBehavior*, u32); void sub_08075580(ItemBehavior*, u32);
void sub_08075694(ItemBehavior* this, u32 arg1); void sub_08075694(ItemBehavior* this, u32 idx);
void ItemSword(ItemBehavior* this, u32 arg1) { void ItemSword(ItemBehavior* this, u32 idx) {
gPlayerState.framestate = PL_STATE_SWORD; gPlayerState.framestate = PL_STATE_SWORD;
gUnk_0811BD44[this->stateID](this, arg1); gUnk_0811BD44[this->stateID](this, idx);
} }
void sub_08075338(ItemBehavior* this, u32 arg1) { void sub_08075338(ItemBehavior* this, u32 idx) {
u32 temp, temp2; u32 temp, temp2;
if (gPlayerState.flags & PL_MINISH) { if (gPlayerState.flags & PL_MINISH) {
this->field_0x5[4] |= 0x80; this->field_0x5[4] |= 0x80;
sub_08077D38(this, arg1); sub_08077D38(this, idx);
gPlayerState.animation = 0xc00; gPlayerState.animation = 0xc00;
SoundReq(SFX_PLY_VO1); SoundReq(SFX_PLY_VO1);
return; return;
@ -34,19 +34,19 @@ void sub_08075338(ItemBehavior* this, u32 arg1) {
(gPlayerState.skills & SKILL_DOWN_THRUST) && gPlayerEntity.z.WORD) { (gPlayerState.skills & SKILL_DOWN_THRUST) && gPlayerEntity.z.WORD) {
gPlayerState.jump_status |= 0x20; gPlayerState.jump_status |= 0x20;
gPlayerState.field_0xab = 7; gPlayerState.field_0xab = 7;
gPlayerState.field_0x3[1] |= (8 >> arg1) | ((8 >> arg1) << 4); gPlayerState.field_0x3[1] |= (8 >> idx) | ((8 >> idx) << 4);
sub_08077B98(this); sub_08077B98(this);
this->stateID = 6; this->stateID = 6;
sub_08075898(this, arg1); sub_08075898(this, idx);
return; return;
} }
} }
#ifndef EU #ifndef EU
sub_080759B8(this, arg1); sub_080759B8(this, idx);
return; return;
} else if (gPlayerEntity.z.WORD) { } else if (gPlayerEntity.z.WORD) {
#endif #endif
sub_080759B8(this, arg1); sub_080759B8(this, idx);
return; return;
} }
@ -60,9 +60,9 @@ void sub_08075338(ItemBehavior* this, u32 arg1) {
} }
// Do the roll attack. // Do the roll attack.
sub_08077D38(this, arg1); sub_08077D38(this, idx);
sub_08077B98(this); sub_08077B98(this);
temp = (8 >> arg1); temp = (8 >> idx);
gPlayerState.field_0x3[1] |= temp | (temp << 4); gPlayerState.field_0x3[1] |= temp | (temp << 4);
gPlayerState.field_0xa |= temp; gPlayerState.field_0xa |= temp;
gPlayerState.keepFacing |= temp; gPlayerState.keepFacing |= temp;
@ -89,15 +89,15 @@ void sub_08075338(ItemBehavior* this, u32 arg1) {
} }
} }
sub_08077D38(this, arg1); sub_08077D38(this, idx);
sub_08077B98(this); sub_08077B98(this);
} }
void sub_080754B8(ItemBehavior* this, u32 arg1) { void sub_080754B8(ItemBehavior* this, u32 idx) {
u32 iVar1; u32 iVar1;
if ((gPlayerState.sword_state & 0x80) != 0) { if ((gPlayerState.sword_state & 0x80) != 0) {
sub_08075694(this, arg1); sub_08075694(this, idx);
} else if (gPlayerState.field_0x3[1] != 0) { } else if (gPlayerState.field_0x3[1] != 0) {
UpdateItemAnim(this); UpdateItemAnim(this);
if (this->field_0x5[9] != 0) { if (this->field_0x5[9] != 0) {
@ -118,19 +118,19 @@ void sub_080754B8(ItemBehavior* this, u32 arg1) {
if ((this->field_0x5[9] & 0x80) != 0) { if ((this->field_0x5[9] & 0x80) != 0) {
if (((gPlayerState.flags & 0x80) != 0) || ((gPlayerState.skills & SKILL_SPIN_ATTACK) == 0)) { if (((gPlayerState.flags & 0x80) != 0) || ((gPlayerState.skills & SKILL_SPIN_ATTACK) == 0)) {
sub_080759B8(this, arg1); sub_080759B8(this, idx);
} else { } else {
sub_08075580(this, arg1); sub_08075580(this, idx);
} }
} }
} else { } else {
sub_080759B8(this, arg1); sub_080759B8(this, idx);
} }
} }
void sub_08075580(ItemBehavior* this, u32 arg1) { void sub_08075580(ItemBehavior* this, u32 idx) {
if ((sub_08077EFC(this) != 0) && (gPlayerState.jump_status == 0)) { if ((sub_08077EFC(this) != 0) && (gPlayerState.jump_status == 0)) {
gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> arg1); gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> idx);
gPlayerState.sword_state = 1; gPlayerState.sword_state = 1;
gPlayerState.item->hurtType = 0xd; gPlayerState.item->hurtType = 0xd;
this->field_0xf = 0; this->field_0xf = 0;
@ -144,10 +144,10 @@ void sub_08075580(ItemBehavior* this, u32 arg1) {
CreateObject(OBJECT_43, 0, 0); CreateObject(OBJECT_43, 0, 0);
return; return;
} }
sub_080759B8(this, arg1); sub_080759B8(this, idx);
} }
void sub_080755F0(ItemBehavior* this, u32 arg1) { void sub_080755F0(ItemBehavior* this, u32 idx) {
if (sub_08077EFC(this) != 0) { if (sub_08077EFC(this) != 0) {
if (sub_08077EC8(this) == 0) { if (sub_08077EC8(this) == 0) {
if ((gPlayerState.sword_state | gPlayerState.field_0x3[1]) != 0) { if ((gPlayerState.sword_state | gPlayerState.field_0x3[1]) != 0) {
@ -157,25 +157,25 @@ void sub_080755F0(ItemBehavior* this, u32 arg1) {
gPlayerState.sword_state = gPlayerState.sword_state | 0x20; gPlayerState.sword_state = gPlayerState.sword_state | 0x20;
} }
} else { } else {
sub_080759B8(this, arg1); sub_080759B8(this, idx);
} }
} }
} else { } else {
sub_080759B8(this, arg1); sub_080759B8(this, idx);
} }
} }
void sub_0807564C(ItemBehavior* this, u32 arg1) { void sub_0807564C(ItemBehavior* this, u32 idx) {
if ((gPlayerState.sword_state | gPlayerState.field_0x3[1]) == 0) { if ((gPlayerState.sword_state | gPlayerState.field_0x3[1]) == 0) {
sub_080759B8(this, arg1); sub_080759B8(this, idx);
} else { } else {
if ((sub_08077EC8(this) == 0) && ((sub_08077EFC(this) == 0 || ((gPlayerState.sword_state & 0x80) != 0)))) { if ((sub_08077EC8(this) == 0) && ((sub_08077EFC(this) == 0 || ((gPlayerState.sword_state & 0x80) != 0)))) {
sub_08075694(this, arg1); sub_08075694(this, idx);
} }
} }
} }
void sub_08075694(ItemBehavior* this, u32 arg1) { void sub_08075694(ItemBehavior* this, u32 idx) {
this->field_0x5[2] = 1; this->field_0x5[2] = 1;
if (gPlayerState.flags & PL_SWORD_THRUST) { if (gPlayerState.flags & PL_SWORD_THRUST) {
gPlayerState.flags &= ~PL_SWORD_THRUST; gPlayerState.flags &= ~PL_SWORD_THRUST;
@ -185,7 +185,7 @@ void sub_08075694(ItemBehavior* this, u32 arg1) {
gPlayerState.field_0xab = 1; gPlayerState.field_0xab = 1;
sub_08077DF4(this, 0x124); sub_08077DF4(this, 0x124);
} }
gPlayerState.field_0xa = (8 >> arg1) | gPlayerState.field_0xa; gPlayerState.field_0xa = (8 >> idx) | gPlayerState.field_0xa;
this->stateID = 4; this->stateID = 4;
this->field_0xf = 6; this->field_0xf = 6;
gPlayerEntity.hurtType = 0x1e; gPlayerEntity.hurtType = 0x1e;
@ -198,11 +198,11 @@ void sub_08075694(ItemBehavior* this, u32 arg1) {
SoundReq(SFX_PLY_VO2); SoundReq(SFX_PLY_VO2);
} }
void sub_08075738(ItemBehavior* this, u32 arg1) { void sub_08075738(ItemBehavior* this, u32 idx) {
u32 bVar6; u32 bVar6;
if (gPlayerState.field_0x3[1] == 0) { if (gPlayerState.field_0x3[1] == 0) {
sub_080759B8(this, arg1); sub_080759B8(this, idx);
} else { } else {
UpdateItemAnim(this); UpdateItemAnim(this);
if (sub_08077F10(this)) { if (sub_08077F10(this)) {
@ -222,7 +222,7 @@ void sub_08075738(ItemBehavior* this, u32 arg1) {
} }
if ((bVar6 <= ++this->field_0x5[3]) || (--this->field_0x5[2] == 0)) { if ((bVar6 <= ++this->field_0x5[3]) || (--this->field_0x5[2] == 0)) {
sub_080759B8(this, arg1); sub_080759B8(this, idx);
} }
} }
} else { } else {
@ -241,26 +241,26 @@ void sub_08075738(ItemBehavior* this, u32 arg1) {
this->field_0x5[6] = gPlayerEntity.animationState << 2; this->field_0x5[6] = gPlayerEntity.animationState << 2;
this->field_0x5[2] = 1; this->field_0x5[2] = 1;
this->field_0x5[3] = 1; this->field_0x5[3] = 1;
gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> arg1); gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> idx);
sub_08077DF4(this, 0x128); sub_08077DF4(this, 0x128);
} }
if ((this->field_0x5[9] & 0x80) != 0) { if ((this->field_0x5[9] & 0x80) != 0) {
sub_080759B8(this, arg1); sub_080759B8(this, idx);
} }
} }
} }
} }
void sub_08075898(ItemBehavior* this, u32 arg1) { void sub_08075898(ItemBehavior* this, u32 idx) {
if (gPlayerState.field_0x3[1] == 0) { if (gPlayerState.field_0x3[1] == 0) {
sub_080759B8(this, arg1); sub_080759B8(this, idx);
} }
} }
void sub_080758B0(ItemBehavior* this, u32 arg1) { void sub_080758B0(ItemBehavior* this, u32 idx) {
if (gPlayerState.field_0x3[1] == 0) { if (gPlayerState.field_0x3[1] == 0) {
sub_080759B8(this, arg1); sub_080759B8(this, idx);
} else { } else {
UpdateItemAnim(this); UpdateItemAnim(this);
if ((this->field_0x5[9] & 0x80) != 0) { if ((this->field_0x5[9] & 0x80) != 0) {
@ -275,15 +275,15 @@ void sub_080758B0(ItemBehavior* this, u32 arg1) {
} }
} }
void sub_08075900(ItemBehavior* this, u32 arg1) { void sub_08075900(ItemBehavior* this, u32 idx) {
if (gPlayerState.floor_type == SURFACE_SWAMP) { if (gPlayerState.floor_type == SURFACE_SWAMP) {
gPlayerState.flags &= ~PL_ROLLING; gPlayerState.flags &= ~PL_ROLLING;
sub_080759B8(this, arg1); sub_080759B8(this, idx);
} else { } else {
UpdateItemAnim(this); UpdateItemAnim(this);
if ((gPlayerState.sword_state & 0x80) != 0) { if ((gPlayerState.sword_state & 0x80) != 0) {
gPlayerState.sword_state = 0xa0; gPlayerState.sword_state = 0xa0;
sub_0807564C(this, arg1); sub_0807564C(this, idx);
} else { } else {
if (this->field_0x5[2] != 0) { if (this->field_0x5[2] != 0) {
@ -299,19 +299,19 @@ void sub_08075900(ItemBehavior* this, u32 arg1) {
} else { } else {
if ((this->field_0x5[9] & 0x80) != 0) { if ((this->field_0x5[9] & 0x80) != 0) {
gPlayerState.flags &= ~PL_ROLLING; gPlayerState.flags &= ~PL_ROLLING;
sub_080759B8(this, arg1); sub_080759B8(this, idx);
} }
} }
} }
} }
} }
void sub_080759B8(ItemBehavior* this, u32 arg1) { void sub_080759B8(ItemBehavior* this, u32 idx) {
if ((gPlayerState.flags & PL_MINISH) == 0) { if ((gPlayerState.flags & PL_MINISH) == 0) {
gPlayerEntity.hurtType = 0; gPlayerEntity.hurtType = 0;
} }
gPlayerState.flags &= ~PL_SWORD_THRUST; gPlayerState.flags &= ~PL_SWORD_THRUST;
gPlayerState.sword_state = 0; gPlayerState.sword_state = 0;
gPlayerState.item = NULL; gPlayerState.item = NULL;
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
} }

View File

@ -4,18 +4,18 @@
extern void (*const gUnk_0811BDB4[])(ItemBehavior*, u32); extern void (*const gUnk_0811BDB4[])(ItemBehavior*, u32);
u32 sub_08077F64(ItemBehavior* arg0, u32 unk); u32 sub_08077F64(ItemBehavior* arg0, u32 idx);
u32 sub_080789A8(void); u32 sub_080789A8(void);
void sub_080762C4(ItemBehavior*, void*, u8, u32); void sub_080762C4(ItemBehavior*, void*, u8, u32);
void sub_08076088(ItemBehavior*, void*, u32); void sub_08076088(ItemBehavior*, void*, u32);
void ItemTryPickupObject(ItemBehavior* this, u32 arg1) { void ItemTryPickupObject(ItemBehavior* this, u32 idx) {
gUnk_0811BDB4[this->stateID](this, arg1); gUnk_0811BDB4[this->stateID](this, idx);
} }
void ItemPickupCheck(ItemBehavior* this, u32 param_2) { void ItemPickupCheck(ItemBehavior* this, u32 idx) {
Entity* entity; Entity* carried;
if (!(((gPlayerState.field_0x3[1] != 0) || if (!(((gPlayerState.field_0x3[1] != 0) ||
(((gPlayerState.jump_status != 0 && ((gPlayerState.flags & (PL_BUSY | PL_FALLING | PL_IN_MINECART)) == 0)) || (((gPlayerState.jump_status != 0 && ((gPlayerState.flags & (PL_BUSY | PL_FALLING | PL_IN_MINECART)) == 0)) ||
@ -24,28 +24,28 @@ void ItemPickupCheck(ItemBehavior* this, u32 param_2) {
switch (sub_080789A8()) { switch (sub_080789A8()) {
case 2: case 2:
if (((gCarriedEntity.unk_8)->field_0x16 & 0xf) == 0) { if (((gCarriedEntity.unk_8)->field_0x16 & 0xf) == 0) {
sub_08076088(this, gCarriedEntity.unk_8, param_2); sub_08076088(this, gCarriedEntity.unk_8, idx);
return; return;
} }
entity = gCarriedEntity.unk_8; carried = gCarriedEntity.unk_8;
this->field_0x18 = entity; this->field_0x18 = carried;
entity->action = 2; carried->action = 2;
entity->subAction = 5; carried->subAction = 5;
gPlayerState.framestate = 5; gPlayerState.framestate = 5;
sub_080762C4(this, entity, 2, param_2); sub_080762C4(this, carried, 2, idx);
gUnk_0200AF00.unk_2e = 8; gUnk_0200AF00.unk_2e = 8;
SoundReq(SFX_102); SoundReq(SFX_102);
break; break;
case 1: case 1:
sub_080762C4(this, 0, 1, param_2); sub_080762C4(this, 0, 1, idx);
SoundReq(SFX_102); SoundReq(SFX_102);
break; break;
case 0: case 0:
this->stateID = 5; this->stateID = 5;
this->field_0x5[2] = 0x0f; this->field_0x5[2] = 0x0f;
this->field_0xf = 6; this->field_0xf = 6;
gPlayerState.field_0xa = (8 >> param_2) | gPlayerState.field_0xa; gPlayerState.field_0xa = (8 >> idx) | gPlayerState.field_0xa;
gPlayerState.keepFacing = (8 >> param_2) | gPlayerState.keepFacing; gPlayerState.keepFacing = (8 >> idx) | gPlayerState.keepFacing;
if ((gPlayerState.flags & PL_NO_CAP) == 0) { if ((gPlayerState.flags & PL_NO_CAP) == 0) {
sub_08077DF4(this, 0x378); sub_08077DF4(this, 0x378);
} else { } else {
@ -56,9 +56,8 @@ void ItemPickupCheck(ItemBehavior* this, u32 param_2) {
default: default:
break; break;
} }
} else { } else {
PlayerCancelHoldItem(this, param_2); PlayerCancelHoldItem(this, idx);
} }
} }
@ -68,14 +67,14 @@ void sub_080762C4(ItemBehavior* this, void* arg1, u8 arg2, u32 arg3) {
sub_08077D38(this, arg3); sub_08077D38(this, arg3);
} }
ASM_FUNC("asm/non_matching/itemTryPickupObject/sub_080762D8.inc", void sub_080762D8(ItemBehavior* this, u32 arg1)) ASM_FUNC("asm/non_matching/itemTryPickupObject/sub_080762D8.inc", void sub_080762D8(ItemBehavior* this, u32 idx))
void sub_08076488(ItemBehavior* this, u32 arg1) { void sub_08076488(ItemBehavior* this, u32 idx) {
u32 bVar1; u32 bVar1;
s32 iVar2; s32 iVar2;
if (this->field_0x5[2] == 0) { if (this->field_0x5[2] == 0) {
if (PlayerTryDropObject(this, arg1) != 0) { if (PlayerTryDropObject(this, idx) != 0) {
if ((((this->field_0x18->field_0x16) & 0xf0) == 0x10) && ((gRoomTransition.frameCount & 1U) != 0)) { if ((((this->field_0x18->field_0x16) & 0xf0) == 0x10) && ((gRoomTransition.frameCount & 1U) != 0)) {
return; return;
} }
@ -83,7 +82,7 @@ void sub_08076488(ItemBehavior* this, u32 arg1) {
if ((this->field_0x5[9] & 0x80) != 0) { if ((this->field_0x5[9] & 0x80) != 0) {
gPlayerEntity.flags |= ENT_COLLIDE; gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerState.heldObject = 4; gPlayerState.heldObject = 4;
bVar1 = ~(8 >> arg1); bVar1 = ~(8 >> idx);
gPlayerState.keepFacing = bVar1 & gPlayerState.keepFacing; gPlayerState.keepFacing = bVar1 & gPlayerState.keepFacing;
gPlayerState.field_0xa = bVar1 & gPlayerState.field_0xa; gPlayerState.field_0xa = bVar1 & gPlayerState.field_0xa;
this->stateID += 1; this->stateID += 1;
@ -96,22 +95,22 @@ void sub_08076488(ItemBehavior* this, u32 arg1) {
gPlayerState.framestate = PL_STATE_HOLD; gPlayerState.framestate = PL_STATE_HOLD;
} }
ASM_FUNC("asm/non_matching/itemTryPickupObject/sub_08076518.inc", void sub_08076518(ItemBehavior* this, u32 arg1)) ASM_FUNC("asm/non_matching/itemTryPickupObject/sub_08076518.inc", void sub_08076518(ItemBehavior* this, u32 idx))
void sub_080765E0(ItemBehavior* this, u32 arg1) { void sub_080765E0(ItemBehavior* this, u32 idx) {
if (PlayerTryDropObject(this, arg1) != 0) { if (PlayerTryDropObject(this, idx) != 0) {
if ((this->field_0x5[9] & 0x80) != 0) { if ((this->field_0x5[9] & 0x80) != 0) {
PlayerCancelHoldItem(this, arg1); PlayerCancelHoldItem(this, idx);
} else { } else {
UpdateItemAnim(this); UpdateItemAnim(this);
} }
} }
} }
void sub_0807660C(ItemBehavior* this, u32 arg1) { void sub_0807660C(ItemBehavior* this, u32 idx) {
UpdateItemAnim(this); UpdateItemAnim(this);
if ((this->field_0x5[2]-- == 0) || (gPlayerState.field_0x0[1] == 0)) { if ((this->field_0x5[2]-- == 0) || (gPlayerState.field_0x0[1] == 0)) {
gPlayerState.field_0x0[1] = 0; gPlayerState.field_0x0[1] = 0;
DeletePlayerItem(this, arg1); DeletePlayerItem(this, idx);
} }
} }

View File

@ -16,7 +16,7 @@ bool32 sub_080AF0C8(Entity*);
typedef enum { typedef enum {
CollisionType0, // Normal/common? Used by most enemies and NPCs. CollisionType0, // Normal/common? Used by most enemies and NPCs.
CollisionType1, // chaser, enemy50, fallingBoulder, ghini, keese, pesto, sensorBladeTrap, vaatiRebornEnemy, CollisionType1, // chaser, enemy50, fallingBoulder, ghini, keese, pesto, sensorBladeTrap, vaatiRebornEnemy,
// playerItem10, playerItem13 // PlayerItemGust, PlayerItemHeldObject
CollisionType2, // acroBandits, beetle, chuchu, fireballGuy, flyingSkull, helmasaur, keaton, lakitu, CollisionType2, // acroBandits, beetle, chuchu, fireballGuy, flyingSkull, helmasaur, keaton, lakitu,
// miniFireballGuy, peahat, rollobite, spikedBeetle, spinyChuchu, stalfos, itemOnGround, // miniFireballGuy, peahat, rollobite, spikedBeetle, spinyChuchu, stalfos, itemOnGround,
// smallIceBlock, flyingPot, object1F // smallIceBlock, flyingPot, object1F
@ -30,7 +30,7 @@ typedef enum {
CollisionType7, // not used? CollisionType7, // not used?
CollisionType8, // not used? CollisionType8, // not used?
CollisionType9, // not used? CollisionType9, // not used?
CollisionType10, // playerItem13, rollobite CollisionType10, // PlayerItemHeldObject, rollobite
CollisionType11, // not used? CollisionType11, // not used?
CollisionType12, // chaser, sensorBladeTrap CollisionType12, // chaser, sensorBladeTrap
} CollisionType; } CollisionType;

View File

@ -12,7 +12,7 @@ void Carlov(Entity* this) {
} }
if ((this->frame & 0x10) != 0) { if ((this->frame & 0x10) != 0) {
this->frame = this->frame & 0xef; this->frame = this->frame & 0xef;
EnqueueSFX(SFX_104); EnqueueSFX(SFX_PLACE_OBJ);
InitScreenShake(0x10, 0); InitScreenShake(0x10, 0);
} }
if ((this->frame & 0x20) != 0) { if ((this->frame & 0x20) != 0) {

View File

@ -127,7 +127,7 @@ void PushableLever_CalculateSpriteOffsets(PushableLeverEntity* this) {
super->spriteOffsetX = offsets[0]; super->spriteOffsetX = offsets[0];
super->spriteOffsetY = offsets[1]; super->spriteOffsetY = offsets[1];
if ((this->timer & 3) == 0) { if ((this->timer & 3) == 0) {
EnqueueSFX(SFX_104); EnqueueSFX(SFX_PLACE_OBJ);
} }
} }

View File

@ -6,23 +6,23 @@ typedef void(PlayerItemFunc)(Entity*);
PlayerItemFunc PlayerItemSword; PlayerItemFunc PlayerItemSword;
PlayerItemFunc PlayerItemBomb; PlayerItemFunc PlayerItemBomb;
PlayerItemFunc PlayerItem3; PlayerItemFunc PlayerItemBoomerang;
PlayerItemFunc PlayerItemBow; PlayerItemFunc PlayerItemBow;
PlayerItemFunc PlayerItemShield; PlayerItemFunc PlayerItemShield;
PlayerItemFunc PlayerItemLantern; PlayerItemFunc PlayerItemLantern;
PlayerItemFunc PlayerItemNulled; PlayerItemFunc PlayerItemNulled;
PlayerItemFunc PlayerItemGustJar; PlayerItemFunc PlayerItemGustJar;
PlayerItemFunc PlayerItemPacciCane; PlayerItemFunc PlayerItemPacciCane;
PlayerItemFunc PlayerItemC; PlayerItemFunc PlayerItemDashSword;
PlayerItemFunc PlayerItemCellOverwriteSet; PlayerItemFunc PlayerItemCellOverwriteSet;
PlayerItemFunc PlayerItemBottle; PlayerItemFunc PlayerItemBottle;
PlayerItemFunc PlayerItemSwordBeam; PlayerItemFunc PlayerItemSwordBeam;
PlayerItemFunc PlayerItem10; PlayerItemFunc PlayerItemGust;
PlayerItemFunc PlayerItem11; PlayerItemFunc PlayerItemGustBig;
PlayerItemFunc PlayerItem12; PlayerItemFunc PlayerItemPacciCaneProjectile;
PlayerItemFunc PlayerItem13; PlayerItemFunc PlayerItemHeldObject;
PlayerItemFunc PlayerItem14; PlayerItemFunc PlayerItemSpiralBeam;
PlayerItemFunc PlayerItem15; PlayerItemFunc PlayerItemFireRodProjectile;
PlayerItemFunc PlayerItemNulled2; PlayerItemFunc PlayerItemNulled2;
typedef struct { typedef struct {
@ -41,7 +41,7 @@ PlayerItemFunc* const gPlayerItemFunctions[] = {
DeleteEntity, DeleteEntity,
PlayerItemSword, PlayerItemSword,
PlayerItemBomb, PlayerItemBomb,
PlayerItem3, PlayerItemBoomerang,
PlayerItemBow, PlayerItemBow,
PlayerItemShield, PlayerItemShield,
PlayerItemLantern, PlayerItemLantern,
@ -50,16 +50,16 @@ PlayerItemFunc* const gPlayerItemFunctions[] = {
PlayerItemPacciCane, PlayerItemPacciCane,
DeleteEntity, DeleteEntity,
DeleteEntity, DeleteEntity,
PlayerItemC, PlayerItemDashSword,
PlayerItemCellOverwriteSet, PlayerItemCellOverwriteSet,
PlayerItemBottle, PlayerItemBottle,
PlayerItemSwordBeam, PlayerItemSwordBeam,
PlayerItem10, PlayerItemGust,
PlayerItem11, PlayerItemGustBig,
PlayerItem12, PlayerItemPacciCaneProjectile,
PlayerItem13, PlayerItemHeldObject,
PlayerItem14, PlayerItemSpiralBeam,
PlayerItem15, PlayerItemFireRodProjectile,
PlayerItemSwordBeam, PlayerItemSwordBeam,
PlayerItemNulled2, PlayerItemNulled2,
PlayerItemCellOverwriteSet, PlayerItemCellOverwriteSet,

View File

@ -1,187 +0,0 @@
#include "entity.h"
#include "player.h"
#include "functions.h"
#include "asm.h"
#include "object.h"
extern void (*const gUnk_0812AA80[])(Entity*);
bool32 sub_080ACDB0(Entity*);
void sub_080ACC78(Entity*);
void sub_080ACECC(Entity*);
typedef struct {
u16 bits;
u8 type2;
u8 actionDelay;
u8 _4;
u8 type;
u16 tileID;
} Obj11;
Obj11* sub_08008782(Entity*, u32, u32, u32);
const s8 gUnk_0812AA88[] = {
-4, -4, 4, -4, -4, 4, 4, 4, 0,
};
const s8 gUnk_0812AA91[] = {
-5, -5, 5, -5, -5, 5, 5, 5, 0,
};
const s8 gUnk_0812AA9A[] = {
-9, -9, 1, -9, 9, -9, -9, 1, 9, 1, -9, 9, 1, 9, 9, 9, 0, 0,
};
const s8* const gUnk_0812AAAC[] = {
gUnk_0812AA88,
gUnk_0812AA91,
gUnk_0812AA91,
gUnk_0812AA9A,
};
const s8 gUnk_0812AABC[] = {
0x78,
0x50,
0x28,
0x4,
};
const Hitbox gUnk_0812AAC0 = {
0, 0, 4, 2, 2, 4, 4, 4,
};
const Hitbox gUnk_0812AAC8 = {
0, 0, 4, 3, 3, 4, 9, 9,
};
const Hitbox gUnk_0812AAD0 = {
0, 0, 8, 7, 7, 8, 14, 14,
};
const Hitbox* const gUnk_0812AAD8[] = {
&gUnk_0812AAC0,
&gUnk_0812AAC8,
&gUnk_0812AAC8,
&gUnk_0812AAD0,
};
const u8 gUnk_0812AAE8[] = {
0,
12,
16,
16,
};
void PlayerItem10(Entity* this) {
if ((gPlayerState.field_0x1c & 0x7f) != 1) {
DeleteThisEntity();
}
gUnk_0812AA80[this->action](this);
this->iframes = 0;
}
void sub_080ACC04(Entity* this) {
this->action = 1;
this->flags2 = gPlayerEntity.flags2;
this->direction = this->animationState << 2;
this->speed = 0x200;
this->flags |= ENT_COLLIDE | ENT_PERSIST;
this->field_0x3c = 2;
this->hitbox = (Hitbox*)gUnk_0812AAD8[this->type];
this->field_0x70.WORD = 0x10;
sub_080ACDB0(this);
sub_0801766C(this);
}
void sub_080ACC5C(Entity* this) {
if (sub_080ACDB0(this) == FALSE) {
sub_080ACC78(this);
sub_080ACECC(this);
}
}
void sub_080ACC78(Entity* this) {
s32 width;
Obj11* o;
Entity* child;
s32 offset;
const s8* puVar8;
if ((this->type + gRoomTransition.frameCount) & 1) {
puVar8 = gUnk_0812AAAC[this->type];
if (puVar8[*(u32*)&this->field_0x74] == 0) {
*(u32*)&this->field_0x74 = 0;
}
o = sub_08008782(this, 0xe, puVar8[*(u32*)&this->field_0x74], puVar8[*(u32*)&this->field_0x74 + 1]);
if (o != NULL) {
child = CreateObject(OBJECT_11, o->type, o->type2);
if (child != NULL) {
child->actionDelay = o->actionDelay;
child->x.HALF.HI = puVar8[*(u32*)&this->field_0x74] + this->x.HALF.HI;
child->y.HALF.HI = puVar8[*(u32*)&this->field_0x74 + 1] + this->y.HALF.HI;
}
}
*(u32*)&this->field_0x74 += 2;
}
if (this->child == NULL && (u32)this->field_0x70.WORD > 2) {
this->field_0x70.WORD = 1;
}
if (--this->field_0x70.WORD != -1) {
return;
}
if (this->child == NULL) {
this->field_0x70.WORD = 2;
} else {
this->field_0x70.WORD = gUnk_0812AABC[this->type];
}
child = CreateObject(OBJECT_17, 0, 0);
if (child == NULL) {
return;
}
offset = Random() % 16;
width = this->hitbox->width;
if (width < offset) {
offset = width;
}
if (offset & 1) {
offset = -offset;
}
switch (this->animationState >> 1) {
case 0:
child->y.HALF.HI = this->y.HALF.HI - this->hitbox->height;
child->x.HALF.HI = this->x.HALF.HI + offset;
break;
case 2:
child->y.HALF.HI = this->y.HALF.HI + this->hitbox->height;
child->x.HALF.HI = this->x.HALF.HI + offset;
break;
case 1:
child->x.HALF.HI = this->x.HALF.HI + this->hitbox->width;
child->y.HALF.HI = this->y.HALF.HI + offset;
break;
case 3:
child->x.HALF.HI = this->x.HALF.HI - this->hitbox->width;
child->y.HALF.HI = this->y.HALF.HI + offset;
break;
}
}
ASM_FUNC("asm/non_matching/playerItem10/sub_080ACDB0.inc", bool32 sub_080ACDB0(Entity* this))
void sub_080ACECC(Entity* this) {
Entity* entity;
if (this->type < 3 && this->child == NULL && (s32) * (u32*)&this->field_0x78 >= 0 &&
gUnk_0812AAE8[this->type] <= *(u32*)&this->field_0x78) {
entity = CreatePlayerItem(0x10, this->type + 1, 0, 0);
if (entity != NULL) {
entity->parent = this;
this->child = entity;
entity->x.HALF.HI = this->x.HALF.HI;
entity->y.HALF.HI = this->y.HALF.HI;
}
}
}

View File

@ -7,7 +7,7 @@
void sub_0801B804(Entity*); void sub_0801B804(Entity*);
Entity* sub_0801B864(Entity*); Entity* sub_0801B864(Entity*);
void sub_0801B584(Entity*); void sub_0801B584(Entity*);
void PlayerItem3_Init(Entity*); void PlayerItemBoomerang_Init(Entity*);
void sub_0801B680(Entity*); void sub_0801B680(Entity*);
void sub_0801B7A8(Entity*); void sub_0801B7A8(Entity*);
@ -16,9 +16,9 @@ extern bool32 sub_080040E2(Entity*, u8*);
extern Hitbox gUnk_081271CC; extern Hitbox gUnk_081271CC;
extern u8 gUnk_08003E44; extern u8 gUnk_08003E44;
void PlayerItem3(Entity* this) { void PlayerItemBoomerang(Entity* this) {
static void (*const PlayerItem3_Actions[])(Entity*) = { static void (*const PlayerItemBoomerang_Actions[])(Entity*) = {
PlayerItem3_Init, PlayerItemBoomerang_Init,
sub_0801B584, sub_0801B584,
sub_0801B680, sub_0801B680,
sub_0801B7A8, sub_0801B7A8,
@ -27,7 +27,7 @@ void PlayerItem3(Entity* this) {
// Unused // Unused
static const u16 gUnk_080B780C[] = { 0x75, 0x1, 0x76, 0x1, 0x3ac, 0x1, 0x4050, 0x1, 0x377, 0x1, 0x378, 0x1, 0x0 }; static const u16 gUnk_080B780C[] = { 0x75, 0x1, 0x76, 0x1, 0x3ac, 0x1, 0x4050, 0x1, 0x377, 0x1, 0x378, 0x1, 0x0 };
PlayerItem3_Actions[this->action](this); PlayerItemBoomerang_Actions[this->action](this);
if (this->animIndex != 0xb) { if (this->animIndex != 0xb) {
if (this->animationState == 6) { if (this->animationState == 6) {
this->field_0x86.HWORD += 0x2000; this->field_0x86.HWORD += 0x2000;
@ -43,7 +43,7 @@ void PlayerItem3(Entity* this) {
} }
} }
void PlayerItem3_Init(Entity* this) { void PlayerItemBoomerang_Init(Entity* this) {
u32 uVar1; u32 uVar1;
gPlayerState.item = this; gPlayerState.item = this;

View File

@ -11,7 +11,7 @@ void sub_0801B938(Entity*);
extern void sub_08017744(Entity*); extern void sub_08017744(Entity*);
void PlayerItemC(Entity* this) { void PlayerItemDashSword(Entity* this) {
static void (*const PlayerItemC_Actions[])(Entity*) = { static void (*const PlayerItemC_Actions[])(Entity*) = {
sub_0801B8B0, sub_0801B8B0,
sub_0801B8FC, sub_0801B8FC,

View File

@ -8,7 +8,7 @@ extern void (*const gUnk_08127270[])(Entity*);
extern Hitbox gUnk_08127278; extern Hitbox gUnk_08127278;
void sub_080A310C(Entity*); void sub_080A310C(Entity*);
void PlayerItem15(Entity* this) { void PlayerItemFireRodProjectile(Entity* this) {
gUnk_08127270[this->action](this); gUnk_08127270[this->action](this);
} }

View File

@ -0,0 +1,218 @@
#define NENT_DEPRECATED
#include "entity.h"
#include "player.h"
#include "functions.h"
#include "asm.h"
#include "object.h"
enum {
GUST_INIT,
GUST_UPDATE,
};
typedef struct {
Entity base;
u32 filler68[2];
u32 timer;
u32 offset_iter;
u32 unk78;
} GustEntity;
typedef void(GustActionFunc)(GustEntity*);
static GustActionFunc PlayerItemGust_Init;
static GustActionFunc PlayerItemGust_Update;
static void sub_080ACC78(GustEntity*);
/*static*/ bool32 sub_080ACDB0(GustEntity*);
static void sub_080ACECC(GustEntity*);
typedef struct {
u16 bits;
u8 type2;
u8 actionDelay;
u8 _4;
u8 type;
u16 tileID;
} Obj11;
Obj11* sub_08008782(Entity*, u32, u32, u32);
extern const s8* const sOffsets[];
extern const s8 gUnk_0812AABC[];
extern const Hitbox* const sHitboxes[];
extern const u8 gUnk_0812AAE8[];
// specifically, the little gusts that come out while the item is active
// type 0: stays close to jar?
// type 1: causes the particles to move away from the jar
// type 2: same as 1?
// type 3: horizontal spread
void PlayerItemGust(Entity* this) {
static GustActionFunc* const sActions[] = {
PlayerItemGust_Init,
PlayerItemGust_Update,
};
if ((gPlayerState.field_0x1c & 0x7f) != 1) {
DeleteThisEntity();
}
sActions[this->action]((GustEntity*)this);
this->iframes = 0;
}
static void PlayerItemGust_Init(GustEntity* this) {
super->action = GUST_UPDATE;
super->flags2 = gPlayerEntity.flags2;
super->direction = super->animationState << 2;
super->speed = 0x200;
super->flags |= ENT_COLLIDE | ENT_PERSIST;
super->field_0x3c = 2;
super->hitbox = (Hitbox*)sHitboxes[super->type];
this->timer = 16;
sub_080ACDB0(this);
sub_0801766C(super);
}
static void PlayerItemGust_Update(GustEntity* this) {
if (sub_080ACDB0(this) == FALSE) {
sub_080ACC78(this);
sub_080ACECC(this);
}
}
static void sub_080ACC78(GustEntity* this) {
s32 width;
Obj11* o;
Entity* child;
s32 offset;
const s8* child_offsets;
// this is what makes types 1 and 2 different?
if ((super->type + gRoomTransition.frameCount) & 1) {
child_offsets = sOffsets[super->type];
if (child_offsets[this->offset_iter] == 0) {
this->offset_iter = 0;
}
o = sub_08008782(super, 0xe, child_offsets[this->offset_iter], child_offsets[this->offset_iter + 1]);
if (o != NULL) {
child = CreateObject(OBJECT_11, o->type, o->type2);
if (child != NULL) {
child->actionDelay = o->actionDelay;
child->x.HALF.HI = child_offsets[this->offset_iter] + super->x.HALF.HI;
child->y.HALF.HI = child_offsets[this->offset_iter + 1] + super->y.HALF.HI;
}
}
this->offset_iter += 2;
}
if (super->child == NULL && (u32)this->timer > 2) {
this->timer = 1;
}
if (this->timer-- != 0) {
return;
}
if (super->child == NULL) {
this->timer = 2;
} else {
this->timer = gUnk_0812AABC[super->type];
}
child = CreateObject(OBJECT_17, 0, 0);
if (child == NULL) {
return;
}
offset = Random() % 16;
width = super->hitbox->width;
if (width < offset) {
offset = width;
}
if (offset & 1) {
offset = -offset;
}
switch (super->animationState >> 1) {
case 0:
child->y.HALF.HI = super->y.HALF.HI - super->hitbox->height;
child->x.HALF.HI = super->x.HALF.HI + offset;
break;
case 2:
child->y.HALF.HI = super->y.HALF.HI + super->hitbox->height;
child->x.HALF.HI = super->x.HALF.HI + offset;
break;
case 1:
child->x.HALF.HI = super->x.HALF.HI + super->hitbox->width;
child->y.HALF.HI = super->y.HALF.HI + offset;
break;
case 3:
child->x.HALF.HI = super->x.HALF.HI - super->hitbox->width;
child->y.HALF.HI = super->y.HALF.HI + offset;
break;
}
}
/*static*/ ASM_FUNC("asm/non_matching/playerItem10/sub_080ACDB0.inc", bool32 sub_080ACDB0(GustEntity* this))
static void sub_080ACECC(GustEntity* this) {
Entity* entity;
if (super->type < 3 && super->child == NULL && (s32)this->unk78 >= 0 && gUnk_0812AAE8[super->type] <= this->unk78) {
entity = CreatePlayerItem(0x10, super->type + 1, 0, 0);
if (entity != NULL) {
entity->parent = super;
super->child = entity;
entity->x.HALF.HI = super->x.HALF.HI;
entity->y.HALF.HI = super->y.HALF.HI;
}
}
}
static const s8 sOffsets0[] = {
-4, -4, 4, -4, -4, 4, 4, 4, 0,
};
static const s8 sOffsets1And2[] = {
-5, -5, 5, -5, -5, 5, 5, 5, 0,
};
static const s8 sOffsets3[] = {
-9, -9, 1, -9, 9, -9, -9, 1, 9, 1, -9, 9, 1, 9, 9, 9, 0, 0,
};
static const s8* const sOffsets[] = {
sOffsets0,
sOffsets1And2,
sOffsets1And2,
sOffsets3,
};
static const s8 gUnk_0812AABC[] = {
120,
80,
40,
4,
};
static const Hitbox sHitbox0 = {
0, 0, 4, 2, 2, 4, 4, 4,
};
static const Hitbox sHitbox1And2 = {
0, 0, 4, 3, 3, 4, 9, 9,
};
static const Hitbox sHitbox3 = {
0, 0, 8, 7, 7, 8, 14, 14,
};
static const Hitbox* const sHitboxes[] = {
&sHitbox0,
&sHitbox1And2,
&sHitbox1And2,
&sHitbox3,
};
static const u8 gUnk_0812AAE8[] = {
0,
12,
16,
16,
};

View File

@ -19,7 +19,7 @@ extern u32 sub_08007DD6(u32, const u16*);
extern const u16 gUnk_080B3DF4[]; extern const u16 gUnk_080B3DF4[];
extern const u8 gUnk_08003E44[]; extern const u8 gUnk_08003E44[];
void PlayerItem11(Entity* this) { void PlayerItemGustBig(Entity* this) {
if (this->health) { if (this->health) {
this->iframes = 0; this->iframes = 0;
gUnk_080B3DD0[this->action](this); gUnk_080B3DD0[this->action](this);

View File

@ -20,25 +20,25 @@ typedef struct {
u8 unk_68[4]; u8 unk_68[4];
u16 unk_6c; u16 unk_6c;
u16 unk_6e; u16 unk_6e;
} PlayerItem13Entity; } PlayerItemHeldObjectEntity;
extern bool32 ProcessMovement10(Entity*); extern bool32 ProcessMovement10(Entity*);
extern const s8 gUnk_081320C4[]; extern const s8 gUnk_081320C4[];
bool32 sub_080AD32C(PlayerItem13Entity*); bool32 sub_080AD32C(PlayerItemHeldObjectEntity*);
void sub_080AD27C(PlayerItem13Entity*); void sub_080AD27C(PlayerItemHeldObjectEntity*);
u32 sub_0806F8DC(Entity*); u32 sub_0806F8DC(Entity*);
extern const u16 gUnk_081320CC[]; extern const u16 gUnk_081320CC[];
extern const u32 gUnk_081320D4[]; extern const u32 gUnk_081320D4[];
void PlayerItem13(Entity* this) { void PlayerItemHeldObject(Entity* this) {
gUnk_081320A8[this->subAction](this); gUnk_081320A8[this->subAction](this);
} }
ASM_FUNC("asm/non_matching/playerItem13/sub_080ACF2C.inc", void sub_080ACF2C(Entity* this)) ASM_FUNC("asm/non_matching/playerItem13/sub_080ACF2C.inc", void sub_080ACF2C(Entity* this))
void sub_080ACFCC(PlayerItem13Entity* this) { void sub_080ACFCC(PlayerItemHeldObjectEntity* this) {
Entity* child = super->child; Entity* child = super->child;
if ((this->unk_6c == child->kind) || (this->unk_6e == child->id)) { if ((this->unk_6c == child->kind) || (this->unk_6e == child->id)) {
if (child->action != 2) { if (child->action != 2) {
@ -59,12 +59,12 @@ void sub_080ACFCC(PlayerItem13Entity* this) {
} }
} }
void sub_080AD040(PlayerItem13Entity* this) { void sub_080AD040(PlayerItemHeldObjectEntity* this) {
PlayerItem13Entity* child; PlayerItemHeldObjectEntity* child;
u32 tile; u32 tile;
u32 tmp; u32 tmp;
child = (PlayerItem13Entity*)super->child; child = (PlayerItemHeldObjectEntity*)super->child;
if ((child->base).action != 2) { if ((child->base).action != 2) {
DeleteThisEntity(); DeleteThisEntity();
} }
@ -134,7 +134,7 @@ void sub_080AD040(PlayerItem13Entity* this) {
} else { } else {
if (super->actionDelay != 0 || sub_080AD32C(child)) { if (super->actionDelay != 0 || sub_080AD32C(child)) {
if (super->actionDelay == 1) { if (super->actionDelay == 1) {
SoundReq(SFX_104); SoundReq(SFX_PLACE_OBJ);
} }
UpdateSpriteForCollisionLayer(super); UpdateSpriteForCollisionLayer(super);
child->base.subAction = 3; child->base.subAction = 3;
@ -143,7 +143,7 @@ void sub_080AD040(PlayerItem13Entity* this) {
child->base.spritePriority.b0 = super->spritePriority.b0; child->base.spritePriority.b0 = super->spritePriority.b0;
DeleteThisEntity(); DeleteThisEntity();
} else { } else {
SoundReq(SFX_104); SoundReq(SFX_PLACE_OBJ);
super->actionDelay++; super->actionDelay++;
super->zVelocity = 0x10000; super->zVelocity = 0x10000;
super->speed /= 2; super->speed /= 2;
@ -181,9 +181,9 @@ void sub_080AD274(Entity* this) {
DeleteThisEntity(); DeleteThisEntity();
} }
void sub_080AD27C(PlayerItem13Entity* this) { void sub_080AD27C(PlayerItemHeldObjectEntity* this) {
u32 tmp; u32 tmp;
PlayerItem13Entity* child = (PlayerItem13Entity*)super->child; PlayerItemHeldObjectEntity* child = (PlayerItemHeldObjectEntity*)super->child;
gNewPlayerEntity.unk_74 = NULL; gNewPlayerEntity.unk_74 = NULL;
if ((this->unk_6c == (u16)(child->base).kind) && (this->unk_6e == (u16)(child->base).id)) { if ((this->unk_6c == (u16)(child->base).kind) && (this->unk_6e == (u16)(child->base).id)) {
if (child != this) { if (child != this) {
@ -209,7 +209,7 @@ void sub_080AD27C(PlayerItem13Entity* this) {
} }
} }
bool32 sub_080AD32C(PlayerItem13Entity* this) { bool32 sub_080AD32C(PlayerItemHeldObjectEntity* this) {
bool32 result = FALSE; bool32 result = FALSE;
if (((super->field_0x16 & 0xf0) == 0x10) || if (((super->field_0x16 & 0xf0) == 0x10) ||
((super->kind == OBJECT && ((super->id == 5 || (super->id == 0x7d)))))) { ((super->kind == OBJECT && ((super->id == 5 || (super->id == 0x7d)))))) {

View File

@ -6,7 +6,7 @@
static const Hitbox gUnk_0811B9D0; static const Hitbox gUnk_0811B9D0;
void PlayerItem12_Init(Entity* this); void PlayerItemPacciCaneProjectile_Init(Entity* this);
void sub_080701F8(Entity* this); void sub_080701F8(Entity* this);
void sub_0807037C(Entity* this); void sub_0807037C(Entity* this);
void sub_08070398(Entity* this); void sub_08070398(Entity* this);
@ -16,11 +16,11 @@ void sub_08070458(Entity* this);
extern void sub_08017744(Entity*); extern void sub_08017744(Entity*);
extern u8* sub_08008782(Entity*, u32, u32, u32); extern u8* sub_08008782(Entity*, u32, u32, u32);
void PlayerItem12(Entity* this) { void PlayerItemPacciCaneProjectile(Entity* this) {
static void (*const PlayerItem12_Actions[])(Entity*) = { static void (*const PlayerItemPacciCaneProjectile_Actions[])(Entity*) = {
PlayerItem12_Init, sub_080701F8, sub_0807037C, sub_08070398, sub_080703BC, PlayerItemPacciCaneProjectile_Init, sub_080701F8, sub_0807037C, sub_08070398, sub_080703BC,
}; };
PlayerItem12_Actions[this->action](this); PlayerItemPacciCaneProjectile_Actions[this->action](this);
} }
extern u8 gUnk_08003E44; extern u8 gUnk_08003E44;
@ -34,7 +34,7 @@ typedef struct {
u8 filler[3]; u8 filler[3];
} gUnk_0811B9A8_struct; } gUnk_0811B9A8_struct;
void PlayerItem12_Init(Entity* this) { void PlayerItemPacciCaneProjectile_Init(Entity* this) {
static const s8 gUnk_0811B9A0[] = { static const s8 gUnk_0811B9A0[] = {
0, -18, 14, 0, 0, 14, -14, 0, 0, -18, 14, 0, 0, 14, -14, 0,
}; };

View File

@ -10,7 +10,7 @@ extern u8 gUnk_08003E44;
void sub_0805FC74(Entity*); void sub_0805FC74(Entity*);
void PlayerItem14(Entity* this) { void PlayerItemSpiralBeam(Entity* this) {
gUnk_08109AC8[this->action](this); gUnk_08109AC8[this->action](this);
} }

View File

@ -8,7 +8,7 @@ const SpriteDataC gPlayerItemDefinitions[] = {
{ 0, 0, 16384, 1, SPRITE_0, 0 }, // DeleteEntity { 0, 0, 16384, 1, SPRITE_0, 0 }, // DeleteEntity
MULTI_FORM(0, 1), // PlayerItemSword MULTI_FORM(0, 1), // PlayerItemSword
{ 1, 12, 5644, 169, SPRITE_166, 192 }, // PlayerItemBomb { 1, 12, 5644, 169, SPRITE_166, 192 }, // PlayerItemBomb
{ 0, 3, 5130, 118, SPRITE_22, 0 }, // PlayerItem3 { 0, 3, 5130, 118, SPRITE_22, 0 }, // PlayerItemBoomerang
{ 1, 3, 5391, 171, SPRITE_21, 203 }, // PlayerItemBow { 1, 3, 5391, 171, SPRITE_21, 203 }, // PlayerItemBow
MULTI_FORM(2, 13), // PlayerItemShield MULTI_FORM(2, 13), // PlayerItemShield
{ 0, 0, 1792, 1, SPRITE_18, 0 }, // PlayerItemLantern { 0, 0, 1792, 1, SPRITE_18, 0 }, // PlayerItemLantern
@ -17,16 +17,16 @@ const SpriteDataC gPlayerItemDefinitions[] = {
{ 4, 0, 16384, 1, SPRITE_20, 0 }, // PlayerItemPacciCane { 4, 0, 16384, 1, SPRITE_20, 0 }, // PlayerItemPacciCane
{ 0, 0, 16384, 1, SPRITE_0, 0 }, // DeleteEntity { 0, 0, 16384, 1, SPRITE_0, 0 }, // DeleteEntity
{ 0, 0, 16384, 1, SPRITE_0, 0 }, // DeleteEntity { 0, 0, 16384, 1, SPRITE_0, 0 }, // DeleteEntity
MULTI_FORM(1, 1), // PlayerItemC MULTI_FORM(1, 1), // PlayerItemDashSword
MULTI_FORM(0, 1), // PlayerItemCellOverwriteSet MULTI_FORM(0, 1), // PlayerItemCellOverwriteSet
{ 0, 0, 7936, 1, SPRITE_19, 0 }, // PlayerItemSwordSpin { 0, 0, 7936, 1, SPRITE_19, 0 }, // PlayerItemSwordSpin
{ 0, 4, 8204, 152, SPRITE_166, 0x8000 }, // PlayerItemSwordBeam { 0, 4, 8204, 152, SPRITE_166, 0x8000 }, // PlayerItemSwordBeam
{ 0, 0, 4864, 109, SPRITE_0, 0 }, // PlayerItem10 { 0, 0, 4864, 109, SPRITE_0, 0 }, // PlayerItemGust
{ 3, 0, 7183, 150, SPRITE_166, 0 }, // PlayerItem11 { 3, 0, 7183, 150, SPRITE_166, 0 }, // PlayerItemGustBig
{ 4, 0, 7424, 1, SPRITE_166, 57 }, // PlayerItem12 { 4, 0, 7424, 1, SPRITE_166, 57 }, // PlayerItemPacciCaneProjectile
{ 0, 3, 5900, 1, SPRITE_POT, 0 }, // PlayerItem13 { 0, 3, 5900, 1, SPRITE_POT, 0 }, // PlayerItemHeldObject
{ 1, 4, 8460, 152, SPRITE_OBJECT43, 0x8000 }, // PlayerItem14 { 1, 4, 8460, 152, SPRITE_OBJECT43, 0x8000 }, // PlayerItemSpiralBeam
{ 1, 4, 8204, 152, SPRITE_166, 0x8000 }, // PlayerItem15 { 1, 4, 8204, 152, SPRITE_166, 0x8000 }, // PlayerItemFireRodProjectile
{ 1, 4, 1036, 151, SPRITE_14, 0 }, // PlayerItemSwordBeam { 1, 4, 1036, 151, SPRITE_14, 0 }, // PlayerItemSwordBeam
{ 1, 4, 1036, 151, SPRITE_14, 0 } // PlayerItemNulled2 { 1, 4, 1036, 151, SPRITE_14, 0 } // PlayerItemNulled2
}; };

View File

@ -78,7 +78,7 @@ void sub_0807BFD0(void);
void sub_08077698(PlayerEntity* this) { void sub_08077698(PlayerEntity* this) {
ItemBehavior* puVar2; ItemBehavior* puVar2;
u32 uVar3; u32 idx;
gPlayerState.field_0x3[0] &= 0xfe; gPlayerState.field_0x3[0] &= 0xfe;
gPlayerState.field_0x3[1] &= 0xf; gPlayerState.field_0x3[1] &= 0xf;
@ -90,15 +90,15 @@ void sub_08077698(PlayerEntity* this) {
sub_08077880(gSave.stats.itemButtons[1], 2, 0); sub_08077880(gSave.stats.itemButtons[1], 2, 0);
sub_080778CC(); sub_080778CC();
} }
uVar3 = 0; idx = 0;
puVar2 = gUnk_03000B80; puVar2 = gUnk_03000B80;
do { do {
if (puVar2->field_0x5[4] != 0) { if (puVar2->field_0x5[4] != 0) {
sub_080752E8(puVar2, uVar3); sub_080752E8(puVar2, idx);
} }
puVar2++; puVar2++;
uVar3++; idx++;
} while (uVar3 < 4); } while (idx < 4);
} }
void sub_08077728(u32 param_1) { void sub_08077728(u32 param_1) {
@ -432,12 +432,12 @@ Entity* sub_08077CF8(u32 subtype, u32 form, u32 parameter, u32 unk) {
return &ent->base; return &ent->base;
} }
void sub_08077D38(ItemBehavior* beh, u32 arg2) { void sub_08077D38(ItemBehavior* beh, u32 idx) {
u32 r6; u32 r6;
struct_0811BE48* ptr; struct_0811BE48* ptr;
gPlayerState.field_0xa |= 8 >> arg2; gPlayerState.field_0xa |= 8 >> idx;
gPlayerState.keepFacing |= 8 >> arg2; gPlayerState.keepFacing |= 8 >> idx;
beh->field_0x5[5] = gPlayerEntity.animationState; beh->field_0x5[5] = gPlayerEntity.animationState;
if (beh->stateID == 0) { if (beh->stateID == 0) {
beh->stateID++; beh->stateID++;
@ -465,7 +465,7 @@ void sub_08077D38(ItemBehavior* beh, u32 arg2) {
beh->field_0xf = ptr->unk6[0]; beh->field_0xf = ptr->unk6[0];
if (ptr->unk6[1]) { if (ptr->unk6[1]) {
gPlayerState.field_0x3[1] |= (8 >> arg2) | ((8 >> arg2) << 4); gPlayerState.field_0x3[1] |= (8 >> idx) | ((8 >> idx) << 4);
} }
} }
@ -478,13 +478,13 @@ typedef struct {
u8 unk[16]; u8 unk[16];
} Unk_struct_in_08077EC8; } Unk_struct_in_08077EC8;
void sub_08077DF4(ItemBehavior* beh, u32 arg1) { void sub_08077DF4(ItemBehavior* beh, u32 animation) {
beh->field_0x10 = arg1; beh->field_0x10 = animation;
if ((arg1 & 0xff) > 0xb8) { if ((animation & 0xff) > 0xb8) {
arg1 += beh->field_0x5[5] >> 1; animation += beh->field_0x5[5] >> 1;
} }
gPlayerEntity.spriteIndex = (short)(arg1 >> 8); gPlayerEntity.spriteIndex = (short)(animation >> 8);
InitAnimationForceUpdate(&gPlayerEntity, (u8)arg1); InitAnimationForceUpdate(&gPlayerEntity, (u8)animation);
sub_08077E54(beh); sub_08077E54(beh);
} }
@ -505,10 +505,10 @@ void sub_08077E54(ItemBehavior* beh) {
beh->field_0x5[9] = gPlayerEntity.frame; beh->field_0x5[9] = gPlayerEntity.frame;
} }
void DeletePlayerItem(ItemBehavior* arg0, u32 bits) { void DeletePlayerItem(ItemBehavior* arg0, u32 idx) {
u32 not ; u32 not ;
if (bits == 0) { if (idx == 0) {
if (gPlayerState.item != NULL) { if (gPlayerState.item != NULL) {
((Unk_bitfield*)gPlayerState.item)[0x11].b0 = 6; ((Unk_bitfield*)gPlayerState.item)[0x11].b0 = 6;
gPlayerState.item = NULL; gPlayerState.item = NULL;
@ -517,8 +517,8 @@ void DeletePlayerItem(ItemBehavior* arg0, u32 bits) {
} }
} }
not = (8 >> bits); not = (8 >> idx);
gPlayerState.field_0x3[1] &= ~((u8)((8 >> bits) << 4) | not ); gPlayerState.field_0x3[1] &= ~((u8)((8 >> idx) << 4) | not );
not = ~not ; not = ~not ;
gPlayerState.field_0xa &= not ; gPlayerState.field_0xa &= not ;
gPlayerState.keepFacing &= not ; gPlayerState.keepFacing &= not ;

View File

@ -1086,7 +1086,7 @@ const Song gSongTable[] = {
[SFX_101] = { &sfx101, MUSIC_PLAYER_10, MUSIC_PLAYER_10 }, [SFX_101] = { &sfx101, MUSIC_PLAYER_10, MUSIC_PLAYER_10 },
[SFX_102] = { &sfx102, MUSIC_PLAYER_0F, MUSIC_PLAYER_0F }, [SFX_102] = { &sfx102, MUSIC_PLAYER_0F, MUSIC_PLAYER_0F },
[SFX_103] = { &sfx103, MUSIC_PLAYER_00, MUSIC_PLAYER_00 }, [SFX_103] = { &sfx103, MUSIC_PLAYER_00, MUSIC_PLAYER_00 },
[SFX_104] = { &sfx104, MUSIC_PLAYER_0D, MUSIC_PLAYER_0D }, [SFX_PLACE_OBJ] = { &sfx104, MUSIC_PLAYER_0D, MUSIC_PLAYER_0D },
[SFX_105] = { &sfx105, MUSIC_PLAYER_1E, MUSIC_PLAYER_1E }, [SFX_105] = { &sfx105, MUSIC_PLAYER_1E, MUSIC_PLAYER_1E },
[SFX_106] = { &sfx106, MUSIC_PLAYER_0B, MUSIC_PLAYER_0B }, [SFX_106] = { &sfx106, MUSIC_PLAYER_0B, MUSIC_PLAYER_0B },
[SFX_107] = { &sfx107, MUSIC_PLAYER_0A, MUSIC_PLAYER_0A }, [SFX_107] = { &sfx107, MUSIC_PLAYER_0A, MUSIC_PLAYER_0A },