diff --git a/assets/assets.json b/assets/assets.json index 90c97cc9..3d0e6646 100644 --- a/assets/assets.json +++ b/assets/assets.json @@ -3567,27 +3567,27 @@ "size": 176 }, { - "path": "playerItem11/gUnk_080B3DE0.bin", + "path": "playerItemGustBig/gUnk_080B3DE0.bin", "start": 736736, "size": 8 }, { - "path": "playerItem11/gUnk_080B3DF4.bin", + "path": "playerItemGustBig/gUnk_080B3DF4.bin", "start": 736756, "size": 36 }, { - "path": "playerItem11/gUnk_080B3E18.bin", + "path": "playerItemGustBig/gUnk_080B3E18.bin", "start": 736792, "size": 8 }, { - "path": "playerItem11/gUnk_080B3E20.bin", + "path": "playerItemGustBig/gUnk_080B3E20.bin", "start": 736800, "size": 8 }, { - "path": "playerItem11/gUnk_080B3E28.bin", + "path": "playerItemGustBig/gUnk_080B3E28.bin", "start": 736808, "size": 8 }, @@ -34056,7 +34056,7 @@ "size": 16 }, { - "path": "playerItem14/gUnk_08109AD0.bin", + "path": "playerItemSpiralBeam/gUnk_08109AD0.bin", "start": 1088208, "size": 8 }, @@ -45260,7 +45260,7 @@ "size": 8 }, { - "path": "playerItem15/gUnk_08127278.bin", + "path": "playerItemFireRodProjectile/gUnk_08127278.bin", "start": 1208952, "size": 8 }, @@ -46407,27 +46407,27 @@ } }, { - "path": "playerItem13/gUnk_081320B8.bin", + "path": "playerItemHeldObject/gUnk_081320B8.bin", "start": 1253560, "size": 12 }, { - "path": "playerItem13/gUnk_081320C4.bin", + "path": "playerItemHeldObject/gUnk_081320C4.bin", "start": 1253572, "size": 8 }, { - "path": "playerItem13/gUnk_081320CC.bin", + "path": "playerItemHeldObject/gUnk_081320CC.bin", "start": 1253580, "size": 8 }, { - "path": "playerItem13/gUnk_081320D4.bin", + "path": "playerItemHeldObject/gUnk_081320D4.bin", "start": 1253588, "size": 16 }, { - "path": "playerItem13/gUnk_081320E4.bin", + "path": "playerItemHeldObject/gUnk_081320E4.bin", "start": 1253604, "size": 12 }, diff --git a/constants/audio_constants.inc b/constants/audio_constants.inc index 16a5c4b7..f2f1f2c5 100644 --- a/constants/audio_constants.inc +++ b/constants/audio_constants.inc @@ -258,7 +258,7 @@ .equiv SFX_101, 0x101 .equiv SFX_102, 0x102 .equiv SFX_103, 0x103 - .equiv SFX_104, 0x104 + .equiv SFX_PLACE_OBJ, 0x104 .equiv SFX_105, 0x105 .equiv SFX_106, 0x106 .equiv SFX_107, 0x107 diff --git a/data/const/playerItem/playerItem10.s b/data/const/playerItem/playerItem10.s deleted file mode 100644 index 49a982a3..00000000 --- a/data/const/playerItem/playerItem10.s +++ /dev/null @@ -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 diff --git a/data/const/playerItem/playerItem15.s b/data/const/playerItem/playerItemFireRodProjectile.s similarity index 77% rename from data/const/playerItem/playerItem15.s rename to data/const/playerItem/playerItemFireRodProjectile.s index 092c03b4..d38fda70 100644 --- a/data/const/playerItem/playerItem15.s +++ b/data/const/playerItem/playerItemFireRodProjectile.s @@ -9,5 +9,5 @@ gUnk_08127270:: @ 08127270 .4byte sub_080A310C gUnk_08127278:: @ 08127278 - .incbin "playerItem15/gUnk_08127278.bin" + .incbin "playerItemFireRodProjectile/gUnk_08127278.bin" diff --git a/data/const/playerItem/playerItem11.s b/data/const/playerItem/playerItemGustBig.s similarity index 65% rename from data/const/playerItem/playerItem11.s rename to data/const/playerItem/playerItemGustBig.s index b4c6e710..2e439ed3 100644 --- a/data/const/playerItem/playerItem11.s +++ b/data/const/playerItem/playerItemGustBig.s @@ -12,7 +12,7 @@ gUnk_080B3DD0:: @ 080B3DD0 .4byte sub_08018F6C gUnk_080B3DE0:: @ 080B3DE0 - .incbin "playerItem11/gUnk_080B3DE0.bin" + .incbin "playerItemGustBig/gUnk_080B3DE0.bin" gUnk_080B3DE8:: @ 080B3DE8 .4byte gUnk_080B3E18 @@ -20,13 +20,13 @@ gUnk_080B3DE8:: @ 080B3DE8 .4byte gUnk_080B3E28 gUnk_080B3DF4:: @ 080B3DF4 - .incbin "playerItem11/gUnk_080B3DF4.bin" + .incbin "playerItemGustBig/gUnk_080B3DF4.bin" gUnk_080B3E18:: @ 080B3E18 - .incbin "playerItem11/gUnk_080B3E18.bin" + .incbin "playerItemGustBig/gUnk_080B3E18.bin" gUnk_080B3E20:: @ 080B3E20 - .incbin "playerItem11/gUnk_080B3E20.bin" + .incbin "playerItemGustBig/gUnk_080B3E20.bin" gUnk_080B3E28:: @ 080B3E28 - .incbin "playerItem11/gUnk_080B3E28.bin" + .incbin "playerItemGustBig/gUnk_080B3E28.bin" diff --git a/data/const/playerItem/playerItem13.s b/data/const/playerItem/playerItemHeldObject.s similarity index 58% rename from data/const/playerItem/playerItem13.s rename to data/const/playerItem/playerItemHeldObject.s index 60174e9b..3df0b29b 100644 --- a/data/const/playerItem/playerItem13.s +++ b/data/const/playerItem/playerItemHeldObject.s @@ -11,16 +11,16 @@ gUnk_081320A8:: @ 081320A8 .4byte sub_080AD274 gUnk_081320B8:: @ 081320B8 - .incbin "playerItem13/gUnk_081320B8.bin" + .incbin "playerItemHeldObject/gUnk_081320B8.bin" gUnk_081320C4:: @ 081320C4 - .incbin "playerItem13/gUnk_081320C4.bin" + .incbin "playerItemHeldObject/gUnk_081320C4.bin" gUnk_081320CC:: @ 081320CC - .incbin "playerItem13/gUnk_081320CC.bin" + .incbin "playerItemHeldObject/gUnk_081320CC.bin" gUnk_081320D4:: @ 081320D4 - .incbin "playerItem13/gUnk_081320D4.bin" + .incbin "playerItemHeldObject/gUnk_081320D4.bin" gUnk_081320E4:: @ 081320E4 - .incbin "playerItem13/gUnk_081320E4.bin" + .incbin "playerItemHeldObject/gUnk_081320E4.bin" diff --git a/data/const/playerItem/playerItem14.s b/data/const/playerItem/playerItemSpiralBeam.s similarity index 79% rename from data/const/playerItem/playerItem14.s rename to data/const/playerItem/playerItemSpiralBeam.s index dfc35a84..0ce9c6d0 100644 --- a/data/const/playerItem/playerItem14.s +++ b/data/const/playerItem/playerItemSpiralBeam.s @@ -9,4 +9,4 @@ gUnk_08109AC8:: @ 08109AC8 .4byte sub_0805FC74 gUnk_08109AD0:: @ 08109AD0 - .incbin "playerItem14/gUnk_08109AD0.bin" + .incbin "playerItemSpiralBeam/gUnk_08109AD0.bin" diff --git a/include/sound.h b/include/sound.h index 5d5f7139..2e1e57b8 100644 --- a/include/sound.h +++ b/include/sound.h @@ -292,7 +292,7 @@ typedef enum { SFX_101, SFX_102, SFX_103, - SFX_104, + SFX_PLACE_OBJ, SFX_105, SFX_106, SFX_107, diff --git a/linker.ld b/linker.ld index 2792d15d..ad4af9da 100644 --- a/linker.ld +++ b/linker.ld @@ -308,13 +308,13 @@ SECTIONS { /* C source compiled without interworking */ asm/kinstone.o(.text); src/kinstone.o(.text); - src/playerItem/playerItem11.o(.text); + src/playerItem/playerItemGustBig.o(.text); src/playerItem/playerItemBow.o(.text); src/playerItem/playerItemSwordBeam.o(.text); asm/beanstalkSubtask.o(.text); src/playerItem/playerItemBomb.o(.text); - src/playerItem/playerItem3.o(.text); - src/playerItem/playerItemC.o(.text); + src/playerItem/playerItemBoomerang.o(.text); + src/playerItem/playerItemDashSword.o(.text); src/playerItem/playerItemBottle.o(.text); src/playerItem/playerItemCellOverwriteSet.o(.text); src/ui.o(.text); @@ -503,7 +503,7 @@ SECTIONS { src/code_0805EC04.o(.text); /* objaffine? */ src/text.o(.text); src/debug.o(.text); - src/playerItem/playerItem14.o(.text); + src/playerItem/playerItemSpiralBeam.o(.text); /* npcs */ src/npc/gentari.o(.text); src/npc/festari.o(.text); @@ -595,7 +595,7 @@ SECTIONS { /* END npcs */ src/npcUtils.o(.text); src/coord.o(.text); /* physics? */ - src/playerItem/playerItem12.o(.text); + src/playerItem/playerItemPacciCaneProjectile.o(.text); src/playerItem/playerItemPacciCane.o(.text); src/player.o(.text); src/item.o(.text); @@ -819,7 +819,7 @@ SECTIONS { /* END objects */ src/objectUtils.o(.text); src/playerItem/playerItemShield.o(.text); - src/playerItem/playerItem15.o(.text); + src/playerItem/playerItemFireRodProjectile.o(.text); #ifdef DEMO_USA src/demo.o(.text); #endif @@ -869,8 +869,8 @@ SECTIONS { src/projectile/gyorgTail.o(.text); src/projectile/gyorgMaleEnergyProjectile.o(.text); src/projectile/v3TennisBallProjectile.o(.text); - src/playerItem/playerItem10.o(.text); - src/playerItem/playerItem13.o(.text); + src/playerItem/playerItemGust.o(.text); + src/playerItem/playerItemHeldObject.o(.text); src/title.o(.text); src/affine.o(.text); src/playerItem/playerItemGustJar.o(.text); @@ -894,14 +894,14 @@ SECTIONS { src/npc.o(.rodata); src/collision.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/data_080B3E70.o(.rodata); data/const/playerItem/playerItemSwordBeam.o(.rodata); data/data_080B4410.o(.rodata); data/const/playerItem/playerItemBomb.o(.rodata); - src/playerItem/playerItem3.o(.rodata); - src/playerItem/playerItemC.o(.rodata); + src/playerItem/playerItemBoomerang.o(.rodata); + src/playerItem/playerItemDashSword.o(.rodata); src/playerItem/playerItemBottle.o(.rodata); data/data_080B7910.o(.rodata); data/const/playerItem/playerItemCellOverwriteSet.o(.rodata); @@ -1114,7 +1114,7 @@ SECTIONS { data/const/manager/manager4.o(.rodata); src/manager/manager5.o(.rodata); src/manager/manager7.o(.rodata); - . = ALIGN(4); + . = ALIGN(4); src/manager/manager9.o(.rodata); src/manager/managerA.o(.rodata); src/manager/managerB.o(.rodata); @@ -1151,7 +1151,7 @@ SECTIONS { data/const/manager/manager38.o(.rodata); data/const/manager/manager39.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/const/npc/festari.o(.rodata); data/animations/npc/festari.o(.rodata); @@ -1307,7 +1307,7 @@ SECTIONS { src/coord.o(.rodata); src/playerHitbox.o(.rodata); data/gfx/sprite_frames.o(.rodata); - src/playerItem/playerItem12.o(.rodata); + src/playerItem/playerItemPacciCaneProjectile.o(.rodata); src/playerItem/playerItemPacciCane.o(.rodata); src/player.o(.rodata); src/item.o(.rodata); @@ -1574,7 +1574,7 @@ SECTIONS { src/playerItemDefinitions.o(.rodata); data/data_08125104.o(.rodata); data/const/playerItem/playerItemShield.o(.rodata); - data/const/playerItem/playerItem15.o(.rodata); + data/const/playerItem/playerItemFireRodProjectile.o(.rodata); #ifdef DEMO_USA data/const/demo.o(.rodata); #endif @@ -1644,10 +1644,9 @@ SECTIONS { src/projectile/gyorgMaleEnergyProjectile.o(.rodata); data/animations/projectile/gyorgMaleEnergyProjectile.o(.rodata); src/projectile/v3TennisBallProjectile.o(.rodata); - data/const/playerItem/playerItem10.o(.rodata); - src/playerItem/playerItem10.o(.rodata); + src/playerItem/playerItemGust.o(.rodata); src/flagDebug.o(.rodata); - data/const/playerItem/playerItem13.o(.rodata); + data/const/playerItem/playerItemHeldObject.o(.rodata); src/title.o(.rodata); src/projectile.o(.rodata); src/playerItem/playerItemGustJar.o(.rodata); diff --git a/src/enemy/bobomb.c b/src/enemy/bobomb.c index d8130a25..8e2a03a9 100644 --- a/src/enemy/bobomb.c +++ b/src/enemy/bobomb.c @@ -243,7 +243,7 @@ void sub_0802CAF8(Entity* this) { sub_0802CBC4(this); } else { if (this->field_0x80.HALF.HI && sub_080044EC(this, 0x2800) == 1) { - EnqueueSFX(SFX_104); + EnqueueSFX(SFX_PLACE_OBJ); } sub_0802CC18(this); RegisterCarryEntity(this); diff --git a/src/enemy/doorMimic.c b/src/enemy/doorMimic.c index 540ae972..1f4d6b4a 100644 --- a/src/enemy/doorMimic.c +++ b/src/enemy/doorMimic.c @@ -90,7 +90,7 @@ void sub_080220F0(Entity* this) { fx->y.HALF.HI += off->v; } } - EnqueueSFX(SFX_104); + EnqueueSFX(SFX_PLACE_OBJ); } else if (this->frame & 1) { this->damage = 4; } diff --git a/src/enemy/likeLike.c b/src/enemy/likeLike.c index a0c15d4b..da2f06c5 100644 --- a/src/enemy/likeLike.c +++ b/src/enemy/likeLike.c @@ -205,7 +205,7 @@ void sub_0802805C(Entity* this) { } if ((this->actionDelay & 3) == 0) { - EnqueueSFX(SFX_104); + EnqueueSFX(SFX_PLACE_OBJ); } } } diff --git a/src/enemy/madderpillar.c b/src/enemy/madderpillar.c index 26ed3023..52098e08 100644 --- a/src/enemy/madderpillar.c +++ b/src/enemy/madderpillar.c @@ -452,7 +452,7 @@ void sub_0802A098(Entity* this) { if (sub_08029F48(this)) { sub_08029E0C(this); sub_08029EEC(this); - EnqueueSFX(SFX_104); + EnqueueSFX(SFX_PLACE_OBJ); } sub_08029FB4(this, this->x.HALF.HI - uVar1, this->y.HALF.HI - uVar2); diff --git a/src/enemy/rollobite.c b/src/enemy/rollobite.c index c9beaa52..f86dd5b9 100644 --- a/src/enemy/rollobite.c +++ b/src/enemy/rollobite.c @@ -188,7 +188,7 @@ void Rollobite_RolledUp(Entity* this) { RegisterCarryEntity(this); } else { if (unk == 1) - EnqueueSFX(SFX_104); + EnqueueSFX(SFX_PLACE_OBJ); if ((this->direction & 0x80) == 0) ProcessMovement2(this); diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c index 8cda5e02..0e6afccb 100644 --- a/src/enemy/rupeeLike.c +++ b/src/enemy/rupeeLike.c @@ -71,7 +71,7 @@ void RupeeLike_OnCollision(Entity* this) { this->field_0x82.HALF.HI = 0x41; this->flags2 &= 0xfc; this->field_0x80.HALF.LO = gPlayerEntity.spritePriority.b1; - EnqueueSFX(SFX_104); + EnqueueSFX(SFX_PLACE_OBJ); } else { if (this->confusedTime != 0) { Create0x68FX(this, FX_STARS); diff --git a/src/item.c b/src/item.c index a88ae226..3e6cbb2d 100644 --- a/src/item.c +++ b/src/item.c @@ -11,6 +11,6 @@ void (*const gItemFunctions[])(ItemBehavior*, u32) = { ItemJarEmpty, ItemJarEmpty, ItemJarEmpty, ItemJarEmpty, }; -void sub_080752E8(ItemBehavior* behavior, u32 arg1) { - gItemFunctions[behavior->behaviorID](behavior, arg1); +void sub_080752E8(ItemBehavior* behavior, u32 idx) { + gItemFunctions[behavior->behaviorID](behavior, idx); } diff --git a/src/item/itemBomb.c b/src/item/itemBomb.c index 5f20f8d7..9adeaa54 100644 --- a/src/item/itemBomb.c +++ b/src/item/itemBomb.c @@ -9,15 +9,15 @@ extern void (*const gUnk_0811BD98[])(ItemBehavior*, u32); extern s8 gUnk_0811BDAC[]; -void ItemBomb(ItemBehavior* this, u32 arg1) { - gUnk_0811BD98[this->stateID](this, arg1); +void ItemBomb(ItemBehavior* this, u32 idx) { + gUnk_0811BD98[this->stateID](this, idx); } -void sub_08075FF8(ItemBehavior* this, u32 arg1) { +void sub_08075FF8(ItemBehavior* this, u32 idx) { Entity* entity; u32 maxBombs; u32 bombCount; - s8* tmp; + s8* pos; s32 x; s32 y; @@ -25,24 +25,20 @@ void sub_08075FF8(ItemBehavior* this, u32 arg1) { bombCount = 0; for (entity = FindEntityByID(PLAYER_ITEM, PLAYER_ITEM_BOMB, 2); entity != NULL; entity = FindNextDuplicateID(entity, 2)) { - bombCount += 1; + bombCount++; } maxBombs = this->behaviorID == 7 ? 3 : 1; if (maxBombs > bombCount) { entity = CreatePlayerItemWithParent(this, 2); if (entity != NULL) { - tmp = &gUnk_0811BDAC[gPlayerEntity.animationState & 6]; - // TODO fix array access - x = tmp[0] << 0x10; - y = tmp[1] << 0x10; - PositionRelative(&gPlayerEntity, entity, x, y); + pos = &gUnk_0811BDAC[gPlayerEntity.animationState & 6]; + PositionRelative(&gPlayerEntity, entity, Q_16_16(pos[0]), Q_16_16(pos[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)) diff --git a/src/item/itemBoomerang.c b/src/item/itemBoomerang.c index 9e402d00..22ac3849 100644 --- a/src/item/itemBoomerang.c +++ b/src/item/itemBoomerang.c @@ -3,23 +3,23 @@ extern void (*const gUnk_0811BD78[])(ItemBehavior*, u32); -void ItemBoomerang(ItemBehavior* this, u32 arg1) { - gUnk_0811BD78[this->stateID](this, arg1); +void ItemBoomerang(ItemBehavior* this, u32 idx) { + 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)) { this->field_0x5[4] |= 0xf; sub_0806F948(&gPlayerEntity); sub_08077C0C(this, 0xb); - sub_08077D38(this, arg1); + sub_08077D38(this, idx); gPlayerState.field_0x3[1] |= 8; } 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 (((this->behaviorID == 0xc) && ((gPlayerState.field_0xa & 0x80) != 0)) && ((this->field_0x5[9] & 2) != 0)) { ResetPlayerVelocity(); @@ -30,5 +30,5 @@ void sub_08075D88(ItemBehavior* this, u32 arg1) { return; } } - DeletePlayerItem(this, arg1); + DeletePlayerItem(this, idx); } diff --git a/src/item/itemBow.c b/src/item/itemBow.c index bc8244f9..586a0505 100644 --- a/src/item/itemBow.c +++ b/src/item/itemBow.c @@ -4,23 +4,23 @@ extern void (*const gUnk_0811BD80[])(ItemBehavior*, u32); -void ItemBow(ItemBehavior* this, u32 arg1) { - gUnk_0811BD80[this->stateID](this, arg1); +void ItemBow(ItemBehavior* this, u32 idx) { + 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) { this->field_0x5[4] |= 0x80; sub_0806F948(&gPlayerEntity); sub_08077BB8(this); - sub_08077D38(this, arg1); + sub_08077D38(this, idx); gPlayerState.field_0x1f[2] = 1; } else { - DeletePlayerItem(this, arg1); + DeletePlayerItem(this, idx); } } -void sub_08075E40(ItemBehavior* this, u32 arg1) { +void sub_08075E40(ItemBehavior* this, u32 idx) { u8 bVar1; if (gPlayerState.field_0x1f[2] != 0) { @@ -32,17 +32,17 @@ void sub_08075E40(ItemBehavior* this, u32 arg1) { this->field_0x5[4] &= 0x7f; if (gSave.stats.arrowCount != 0) { this->field_0xf = bVar1; - gPlayerState.field_0xa &= ~(8 >> arg1); + gPlayerState.field_0xa &= ~(8 >> idx); } } return; } } 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; s32 iVar2; @@ -51,10 +51,10 @@ void sub_08075EC0(ItemBehavior* this, u32 arg1) { if (iVar2 != 0 && arrowCount != 0) { if (((gPlayerState.field_0x3[1] & 0x80) != 0) || (gPlayerState.field_0x1f[2] == 0)) { gPlayerState.field_0x1f[2] = 0; - DeletePlayerItem(this, arg1); + DeletePlayerItem(this, idx); } } else { - gPlayerState.field_0xa = (8 >> arg1) | gPlayerState.field_0xa; + gPlayerState.field_0xa = (8 >> idx) | gPlayerState.field_0xa; sub_08077DF4(this, 0x27c); this->field_0xf = 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)) { UpdateItemAnim(this); if ((this->field_0x5[9] & 1) != 0) { @@ -70,11 +70,11 @@ void sub_08075F38(ItemBehavior* this, u32 arg1) { } } else { 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 (GetInventoryValue(ITEM_ARROW_BUTTERFLY) == 1) { sub_08077E3C(this, 5); @@ -86,5 +86,5 @@ void sub_08075F84(ItemBehavior* this, u32 arg1) { } } gPlayerState.field_0x1f[2] = 0; - DeletePlayerItem(this, arg1); + DeletePlayerItem(this, idx); } diff --git a/src/item/itemDebug.c b/src/item/itemDebug.c index deec580d..e0d9f2f9 100644 --- a/src/item/itemDebug.c +++ b/src/item/itemDebug.c @@ -3,7 +3,7 @@ extern Entity* sub_08077BD4(ItemBehavior*); extern void DeletePlayerItem(ItemBehavior*, u32); -void ItemDebug(ItemBehavior* beh, u32 arg1) { +void ItemDebug(ItemBehavior* beh, u32 idx) { sub_08077BD4(beh); - DeletePlayerItem(beh, arg1); + DeletePlayerItem(beh, idx); } diff --git a/src/item/itemGustJar.c b/src/item/itemGustJar.c index ea3cd42d..a749ea37 100644 --- a/src/item/itemGustJar.c +++ b/src/item/itemGustJar.c @@ -5,15 +5,15 @@ void (*const ItemGustJar_StateFunctions[])(ItemBehavior* beh, u32); -void ItemGustJar(ItemBehavior* this, u32 arg1) { +void ItemGustJar(ItemBehavior* this, u32 idx) { 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 && 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[5] = gPlayerEntity.animationState; this->field_0x5[4] |= 0x80; @@ -23,20 +23,20 @@ void sub_08076DF4(ItemBehavior* this, u32 arg1) { gPlayerState.field_0x1c = 1; sub_08077BB8(this); } else { - DeletePlayerItem(this, arg1); + DeletePlayerItem(this, idx); } } -void sub_08076E60(ItemBehavior* this, u32 arg1) { +void sub_08076E60(ItemBehavior* this, u32 idx) { Entity* playerItem; if ((gPlayerState.field_0x1c & 0xf) == 0) { - DeletePlayerItem(this, arg1); + DeletePlayerItem(this, idx); } if ((this->field_0x5[9] & 0x80) != 0) { this->stateID = 2; 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); if (playerItem != NULL) { 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) { - DeletePlayerItem(this, arg1); + DeletePlayerItem(this, idx); return; } @@ -81,10 +81,10 @@ void sub_08076EC8(ItemBehavior* this, u32 arg1) { } 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* player; switch (gPlayerState.field_0x1c & 0xf) { @@ -97,7 +97,7 @@ void sub_08076F64(ItemBehavior* this, u32 arg1) { player = &gPlayerEntity; *(u32*)&player->field_0x74 = 0; gPlayerState.field_0x1c = 1; - gPlayerState.field_0xa &= ~(8 >> arg1); + gPlayerState.field_0xa &= ~(8 >> idx); this->stateID = 2; sub_08077DF4(this, 0x504); item = CreatePlayerItem(0x10, 0, 0, 0); @@ -169,7 +169,7 @@ void sub_08076F64(ItemBehavior* this, u32 arg1) { case0: gPlayerState.field_0x1c = 0; gPlayerEntity.field_0x70.WORD = 0; - DeletePlayerItem(this, arg1); + DeletePlayerItem(this, idx); break; } } diff --git a/src/item/itemJarEmpty.c b/src/item/itemJarEmpty.c index c50dee06..b8519e25 100644 --- a/src/item/itemJarEmpty.c +++ b/src/item/itemJarEmpty.c @@ -6,13 +6,13 @@ extern void (*const gUnk_0811BE28[])(ItemBehavior*, u32); extern u8 gUnk_02002AC8[]; -void ItemJarEmpty(ItemBehavior* this, u32 arg1) { - gUnk_0811BE28[this->stateID](this, arg1); +void ItemJarEmpty(ItemBehavior* this, u32 idx) { + gUnk_0811BE28[this->stateID](this, idx); } -void sub_08077534(ItemBehavior* this, u32 arg1) { +void sub_08077534(ItemBehavior* this, u32 idx) { u32 tmp; - sub_08077D38(this, arg1); + sub_08077D38(this, idx); sub_0806F948(&gPlayerEntity); sub_08077BB8(this); this->field_0x5[4] |= 0xf; @@ -49,7 +49,7 @@ void sub_08077534(ItemBehavior* this, u32 arg1) { 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) { sub_08077DF4(this, 0x618); 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); if ((this->field_0x5[9] & 0x80) != 0) { 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); if ((this->field_0x5[9] & 0x80) != 0) { gPlayerEntity.flags |= ENT_COLLIDE; - DeletePlayerItem(this, arg1); + DeletePlayerItem(this, idx); } } diff --git a/src/item/itemLantern.c b/src/item/itemLantern.c index c05b8d01..102232e7 100644 --- a/src/item/itemLantern.c +++ b/src/item/itemLantern.c @@ -13,11 +13,11 @@ extern bool32 sub_08077F10(ItemBehavior*); extern void sub_0807AB44(Entity*, s32, s32); -void ItemLantern(ItemBehavior* this, u32 arg1) { - gUnk_0811BD68[this->stateID](this, arg1); +void ItemLantern(ItemBehavior* this, u32 idx) { + gUnk_0811BD68[this->stateID](this, idx); } -void sub_08075A0C(ItemBehavior* this, u32 arg1) { +void sub_08075A0C(ItemBehavior* this, u32 idx) { Entity* object; u32 itemSlot; s8* tmp; @@ -27,10 +27,10 @@ void sub_08075A0C(ItemBehavior* this, u32 arg1) { ForceEquipItem(ITEM_LANTERN_OFF, itemSlot); gPlayerState.flags &= ~PL_USE_LANTERN; ForceEquipItem(ITEM_LANTERN_OFF, itemSlot); - DeletePlayerItem(this, arg1); + DeletePlayerItem(this, idx); } else { this->field_0x5[4] |= 0x80; - sub_08077D38(this, arg1); + sub_08077D38(this, idx); sub_08077BD4(this); sub_0806F948(&gPlayerEntity); 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; if ( @@ -57,7 +57,7 @@ void sub_08075ADC(ItemBehavior* this, u32 arg1) { this->field_0xf = 0; this->stateID += 1; gPlayerState.flags |= PL_USE_LANTERN; - bVar1 = 8 >> arg1; + bVar1 = 8 >> idx; gPlayerState.field_0x3[1] = gPlayerState.field_0x3[1] & ~((bVar1 << 4) | bVar1); bVar1 = ~bVar1; 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 itemSlot; Entity* object; @@ -79,7 +79,7 @@ void sub_08075B54(ItemBehavior* this, u32 arg1) { if (!(((sub_08077F10(this) == 0) && (itemSlot < 2)) || (gPlayerState.jump_status != 0))) { ForceEquipItem(ITEM_LANTERN_OFF, itemSlot); gPlayerState.flags &= ~PL_USE_LANTERN; - DeletePlayerItem(this, arg1); + DeletePlayerItem(this, idx); SoundReq(SFX_ITEM_LANTERN_OFF); } else { 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; } sub_08077DF4(this, 0x60c); - bVar1 = (8 >> (arg1)); + bVar1 = (8 >> (idx)); gPlayerState.field_0xa |= 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; UpdateItemAnim(this); @@ -119,8 +119,8 @@ void sub_08075C9C(ItemBehavior* this, u32 arg1) { if ((this->field_0x5[9] & 0x80) != 0) { this->field_0xf = 0; this->stateID -= 1; - gPlayerState.field_0xa = (~(8 >> arg1)) & gPlayerState.field_0xa; - gPlayerState.keepFacing = (~(8 >> arg1)) & gPlayerState.keepFacing; + gPlayerState.field_0xa = (~(8 >> idx)) & gPlayerState.field_0xa; + gPlayerState.keepFacing = (~(8 >> idx)) & gPlayerState.keepFacing; } else { gPlayerEntity.field_0x7a.HWORD += 1; } diff --git a/src/item/itemMoleMitts.c b/src/item/itemMoleMitts.c index 3dd4bc59..bd80a910 100644 --- a/src/item/itemMoleMitts.c +++ b/src/item/itemMoleMitts.c @@ -18,15 +18,15 @@ extern bool32 sub_0807B5B0(Entity*); extern const s16 gUnk_0811BE16[]; -void ItemMoleMitts(ItemBehavior* this, u32 arg1) { - gUnk_0811BE04[this->stateID](this, arg1); +void ItemMoleMitts(ItemBehavior* this, u32 idx) { + gUnk_0811BE04[this->stateID](this, idx); } -void sub_08077130(ItemBehavior* this, u32 arg1) { +void sub_08077130(ItemBehavior* this, u32 idx) { s32 iVar1; if (gPlayerState.jump_status == 0) { - sub_08077D38(this, arg1); + sub_08077D38(this, idx); gPlayerState.field_0x3c[1] = 1; this->field_0x5[4] |= 0x80; iVar1 = sub_080774A0(); @@ -47,17 +47,17 @@ void sub_08077130(ItemBehavior* this, u32 arg1) { this->stateID = 1; } } else { - DeletePlayerItem(this, arg1); + DeletePlayerItem(this, idx); gPlayerState.field_0x3c[1] = 0; } } -void sub_080771C8(ItemBehavior* this, u32 arg1) { +void sub_080771C8(ItemBehavior* this, u32 idx) { Entity* object; UpdateItemAnim(this); if ((this->field_0x5[9] & 0x80) != 0) { - DeletePlayerItem(this, arg1); + DeletePlayerItem(this, idx); gPlayerState.field_0x3c[1] = 0; } else { 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; if (((this->field_0x5[9] & 8) != 0) && sub_08077F10(this)) { @@ -119,7 +119,7 @@ void sub_080772A8(ItemBehavior* this, u32 param_2) { return; } } - DeletePlayerItem(this, param_2); + DeletePlayerItem(this, idx); gPlayerState.field_0x3c[1] = 0; } else { 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.speed = 0x100; 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); if ((this->field_0x5[9] & 0x80) != 0) { gPlayerState.field_0x3c[1] = 0; - DeletePlayerItem(this, arg1); + DeletePlayerItem(this, idx); } } diff --git a/src/item/itemOcarina.c b/src/item/itemOcarina.c index f73e3d48..ce7d0c4f 100644 --- a/src/item/itemOcarina.c +++ b/src/item/itemOcarina.c @@ -8,14 +8,14 @@ extern void ResetPlayerVelocity(void); extern void CreateBird(void); -void ItemOcarina(ItemBehavior* this, u32 arg1) { - gOcarinaStates[this->stateID](this, arg1); +void ItemOcarina(ItemBehavior* this, u32 idx) { + gOcarinaStates[this->stateID](this, idx); gPlayerEntity.field_0x7a.HWORD += 1; } -void OcarinaUse(ItemBehavior* this, u32 arg1) { +void OcarinaUse(ItemBehavior* this, u32 idx) { if (gPlayerState.queued_action == PLAYER_ROLL) { - DeletePlayerItem(this, arg1); + DeletePlayerItem(this, idx); } else { this->field_0x5[4] |= 0xf; gPlayerEntity.animationState = 0x04; @@ -25,16 +25,16 @@ void OcarinaUse(ItemBehavior* this, u32 arg1) { gPlayerState.flags |= PL_USE_OCARINA; gPlayerState.field_0x27[0] = -1; gPauseMenuOptions.disabled = 1; - gPlayerState.field_0xa = (8 >> arg1) | gPlayerState.field_0xa; - gPlayerState.keepFacing = (8 >> arg1) | gPlayerState.keepFacing; + gPlayerState.field_0xa = (8 >> idx) | gPlayerState.field_0xa; + gPlayerState.keepFacing = (8 >> idx) | gPlayerState.keepFacing; ResetPlayerVelocity(); - sub_08077D38(this, arg1); + sub_08077D38(this, idx); SoundReq(SFX_216); 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 UpdateItemAnim(this); if ((this->field_0x5[9] & 0x80) != 0) { @@ -44,7 +44,7 @@ NONMATCH("asm/non_matching/ocarina/OcarinaUpdate.inc", void OcarinaUpdate(ItemBe gPauseMenuOptions.disabled = 0; CreateBird(); ResetPlayerEventPriority(); - DeletePlayerItem(this, arg1); + DeletePlayerItem(this, idx); } } END_NONMATCH diff --git a/src/item/itemPacciCane.c b/src/item/itemPacciCane.c index ada5d308..dbf9681d 100644 --- a/src/item/itemPacciCane.c +++ b/src/item/itemPacciCane.c @@ -5,20 +5,20 @@ extern void (*const gUnk_0811BDE0[])(ItemBehavior* beh, u32); -void ItemPacciCane(ItemBehavior* beh, u32 arg1) { - gUnk_0811BDE0[beh->stateID](beh, arg1); +void ItemPacciCane(ItemBehavior* beh, u32 idx) { + 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; - sub_08077D38(beh, arg1); + sub_08077D38(beh, idx); sub_0806F948(&gPlayerEntity); sub_08077BB8(beh); } -void sub_08076CBC(ItemBehavior* beh, u32 arg1) { +void sub_08076CBC(ItemBehavior* beh, u32 idx) { if ((beh->field_0x5[9] & 0x80) != 0) { - DeletePlayerItem(beh, arg1); + DeletePlayerItem(beh, idx); } else { if ((beh->field_0x5[9] & 0x40) != 0) { CreatePlayerItemWithParent(beh, 0x12); diff --git a/src/item/itemPegasusBoots.c b/src/item/itemPegasusBoots.c index 2a32cfd9..28479b75 100644 --- a/src/item/itemPegasusBoots.c +++ b/src/item/itemPegasusBoots.c @@ -13,7 +13,7 @@ void sub_08076A88(ItemBehavior*, u32); extern u16 gUnk_0800275C[]; extern u8 gUnk_0811BE38[]; -void ItemPegasusBoots(ItemBehavior* this, u32 arg1) { +void ItemPegasusBoots(ItemBehavior* this, u32 idx) { static void (*const ItemPegasusBoots_StateFunctions[])(ItemBehavior * beh, u32) = { sub_080768F8, sub_08076964, @@ -26,7 +26,7 @@ void ItemPegasusBoots(ItemBehavior* this, u32 arg1) { if (gPlayerEntity.field_0x7a.HWORD != 0) { gPlayerState.dash_state = 0; gPlayerState.field_0xe = 0; - DeletePlayerItem(this, arg1); + DeletePlayerItem(this, idx); } else { bVar1 = this->field_0x5[2] - 1; 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 bVar2; @@ -73,16 +73,16 @@ void sub_080768F8(ItemBehavior* this, u32 arg1) { } else { gPlayerState.animation = 0xc14; } - sub_08077D38(this, arg1); - sub_08076964(this, arg1); + sub_08077D38(this, idx); + sub_08076964(this, idx); } else { gPlayerState.dash_state = 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; u32 uVar3; 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.flags & PL_FLAGS2) != 0) { gPlayerState.dash_state = 0; - DeletePlayerItem(this, arg1); + DeletePlayerItem(this, idx); return; } gPlayerState.dash_state = 0x40; - gPlayerState.field_0xa &= ~(8 >> arg1); + gPlayerState.field_0xa &= ~(8 >> idx); this->stateID++; if (HasSwordEquipped() && (gPlayerState.flags & PL_MINISH) == 0 && (gPlayerState.skills & SKILL_DASH_ATTACK) != 0) { @@ -127,10 +127,10 @@ void sub_08076964(ItemBehavior* this, u32 arg1) { } } 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 uVar2; u8* ptr; @@ -170,5 +170,5 @@ void sub_08076A88(ItemBehavior* this, u32 arg1) { } } gPlayerState.dash_state = 0; - DeletePlayerItem(this, arg1); + DeletePlayerItem(this, idx); } diff --git a/src/item/itemShield.c b/src/item/itemShield.c index d8cd9ace..fe5eacea 100644 --- a/src/item/itemShield.c +++ b/src/item/itemShield.c @@ -6,40 +6,40 @@ extern void (*const gUnk_0811BDE8[])(ItemBehavior* beh, u32); -void ItemShield(ItemBehavior* beh, u32 arg1) { - gUnk_0811BDE8[beh->stateID](beh, arg1); +void ItemShield(ItemBehavior* beh, u32 idx) { + 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; beh->field_0x5[4] = 2; sub_0806F948(&gPlayerEntity); - sub_08077D38(beh, arg1); + sub_08077D38(beh, idx); sub_08077BB8(beh); } -void sub_08076D34(ItemBehavior* beh, u32 arg1) { +void sub_08076D34(ItemBehavior* beh, u32 idx) { if (sub_08077EFC(beh) != 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); + gPlayerState.field_0xa &= ~(u8)(8 >> idx); SoundReq(SFX_15D); } } else { 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)) { gPlayerState.field_0x3[0] |= 1; UpdateItemAnim(beh); } else { gPlayerState.field_0x3[0] = 0; - DeletePlayerItem(beh, arg1); + DeletePlayerItem(beh, idx); } } diff --git a/src/item/itemSword.c b/src/item/itemSword.c index f55a1275..c0a24c68 100644 --- a/src/item/itemSword.c +++ b/src/item/itemSword.c @@ -11,18 +11,18 @@ void sub_080754B8(ItemBehavior*, u32); void sub_08075898(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; - 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; if (gPlayerState.flags & PL_MINISH) { this->field_0x5[4] |= 0x80; - sub_08077D38(this, arg1); + sub_08077D38(this, idx); gPlayerState.animation = 0xc00; SoundReq(SFX_PLY_VO1); return; @@ -34,19 +34,19 @@ void sub_08075338(ItemBehavior* this, u32 arg1) { (gPlayerState.skills & SKILL_DOWN_THRUST) && gPlayerEntity.z.WORD) { gPlayerState.jump_status |= 0x20; 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); this->stateID = 6; - sub_08075898(this, arg1); + sub_08075898(this, idx); return; } } #ifndef EU - sub_080759B8(this, arg1); + sub_080759B8(this, idx); return; } else if (gPlayerEntity.z.WORD) { #endif - sub_080759B8(this, arg1); + sub_080759B8(this, idx); return; } @@ -60,9 +60,9 @@ void sub_08075338(ItemBehavior* this, u32 arg1) { } // Do the roll attack. - sub_08077D38(this, arg1); + sub_08077D38(this, idx); sub_08077B98(this); - temp = (8 >> arg1); + temp = (8 >> idx); gPlayerState.field_0x3[1] |= temp | (temp << 4); gPlayerState.field_0xa |= 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); } -void sub_080754B8(ItemBehavior* this, u32 arg1) { +void sub_080754B8(ItemBehavior* this, u32 idx) { u32 iVar1; if ((gPlayerState.sword_state & 0x80) != 0) { - sub_08075694(this, arg1); + sub_08075694(this, idx); } else if (gPlayerState.field_0x3[1] != 0) { UpdateItemAnim(this); 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 (((gPlayerState.flags & 0x80) != 0) || ((gPlayerState.skills & SKILL_SPIN_ATTACK) == 0)) { - sub_080759B8(this, arg1); + sub_080759B8(this, idx); } else { - sub_08075580(this, arg1); + sub_08075580(this, idx); } } } 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)) { - gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> arg1); + gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> idx); gPlayerState.sword_state = 1; gPlayerState.item->hurtType = 0xd; this->field_0xf = 0; @@ -144,10 +144,10 @@ void sub_08075580(ItemBehavior* this, u32 arg1) { CreateObject(OBJECT_43, 0, 0); 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_08077EC8(this) == 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; } } else { - sub_080759B8(this, arg1); + sub_080759B8(this, idx); } } } 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) { - sub_080759B8(this, arg1); + sub_080759B8(this, idx); } else { 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; if (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; sub_08077DF4(this, 0x124); } - gPlayerState.field_0xa = (8 >> arg1) | gPlayerState.field_0xa; + gPlayerState.field_0xa = (8 >> idx) | gPlayerState.field_0xa; this->stateID = 4; this->field_0xf = 6; gPlayerEntity.hurtType = 0x1e; @@ -198,11 +198,11 @@ void sub_08075694(ItemBehavior* this, u32 arg1) { SoundReq(SFX_PLY_VO2); } -void sub_08075738(ItemBehavior* this, u32 arg1) { +void sub_08075738(ItemBehavior* this, u32 idx) { u32 bVar6; if (gPlayerState.field_0x3[1] == 0) { - sub_080759B8(this, arg1); + sub_080759B8(this, idx); } else { UpdateItemAnim(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)) { - sub_080759B8(this, arg1); + sub_080759B8(this, idx); } } } else { @@ -241,26 +241,26 @@ void sub_08075738(ItemBehavior* this, u32 arg1) { this->field_0x5[6] = gPlayerEntity.animationState << 2; this->field_0x5[2] = 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); } 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) { - 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) { - sub_080759B8(this, arg1); + sub_080759B8(this, idx); } else { UpdateItemAnim(this); 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) { gPlayerState.flags &= ~PL_ROLLING; - sub_080759B8(this, arg1); + sub_080759B8(this, idx); } else { UpdateItemAnim(this); if ((gPlayerState.sword_state & 0x80) != 0) { gPlayerState.sword_state = 0xa0; - sub_0807564C(this, arg1); + sub_0807564C(this, idx); } else { if (this->field_0x5[2] != 0) { @@ -299,19 +299,19 @@ void sub_08075900(ItemBehavior* this, u32 arg1) { } else { if ((this->field_0x5[9] & 0x80) != 0) { 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) { gPlayerEntity.hurtType = 0; } gPlayerState.flags &= ~PL_SWORD_THRUST; gPlayerState.sword_state = 0; gPlayerState.item = NULL; - DeletePlayerItem(this, arg1); + DeletePlayerItem(this, idx); } diff --git a/src/item/itemTryPickupObject.c b/src/item/itemTryPickupObject.c index e03b9c5a..e2c71d66 100644 --- a/src/item/itemTryPickupObject.c +++ b/src/item/itemTryPickupObject.c @@ -4,18 +4,18 @@ 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); void sub_080762C4(ItemBehavior*, void*, u8, u32); void sub_08076088(ItemBehavior*, void*, u32); -void ItemTryPickupObject(ItemBehavior* this, u32 arg1) { - gUnk_0811BDB4[this->stateID](this, arg1); +void ItemTryPickupObject(ItemBehavior* this, u32 idx) { + gUnk_0811BDB4[this->stateID](this, idx); } -void ItemPickupCheck(ItemBehavior* this, u32 param_2) { - Entity* entity; +void ItemPickupCheck(ItemBehavior* this, u32 idx) { + Entity* carried; if (!(((gPlayerState.field_0x3[1] != 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()) { case 2: if (((gCarriedEntity.unk_8)->field_0x16 & 0xf) == 0) { - sub_08076088(this, gCarriedEntity.unk_8, param_2); + sub_08076088(this, gCarriedEntity.unk_8, idx); return; } - entity = gCarriedEntity.unk_8; - this->field_0x18 = entity; - entity->action = 2; - entity->subAction = 5; + carried = gCarriedEntity.unk_8; + this->field_0x18 = carried; + carried->action = 2; + carried->subAction = 5; gPlayerState.framestate = 5; - sub_080762C4(this, entity, 2, param_2); + sub_080762C4(this, carried, 2, idx); gUnk_0200AF00.unk_2e = 8; SoundReq(SFX_102); break; case 1: - sub_080762C4(this, 0, 1, param_2); + sub_080762C4(this, 0, 1, idx); SoundReq(SFX_102); break; case 0: this->stateID = 5; this->field_0x5[2] = 0x0f; this->field_0xf = 6; - gPlayerState.field_0xa = (8 >> param_2) | gPlayerState.field_0xa; - gPlayerState.keepFacing = (8 >> param_2) | gPlayerState.keepFacing; + gPlayerState.field_0xa = (8 >> idx) | gPlayerState.field_0xa; + gPlayerState.keepFacing = (8 >> idx) | gPlayerState.keepFacing; if ((gPlayerState.flags & PL_NO_CAP) == 0) { sub_08077DF4(this, 0x378); } else { @@ -56,9 +56,8 @@ void ItemPickupCheck(ItemBehavior* this, u32 param_2) { default: break; } - } 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); } -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; s32 iVar2; 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)) { return; } @@ -83,7 +82,7 @@ void sub_08076488(ItemBehavior* this, u32 arg1) { if ((this->field_0x5[9] & 0x80) != 0) { gPlayerEntity.flags |= ENT_COLLIDE; gPlayerState.heldObject = 4; - bVar1 = ~(8 >> arg1); + bVar1 = ~(8 >> idx); gPlayerState.keepFacing = bVar1 & gPlayerState.keepFacing; gPlayerState.field_0xa = bVar1 & gPlayerState.field_0xa; this->stateID += 1; @@ -96,22 +95,22 @@ void sub_08076488(ItemBehavior* this, u32 arg1) { 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) { - if (PlayerTryDropObject(this, arg1) != 0) { +void sub_080765E0(ItemBehavior* this, u32 idx) { + if (PlayerTryDropObject(this, idx) != 0) { if ((this->field_0x5[9] & 0x80) != 0) { - PlayerCancelHoldItem(this, arg1); + PlayerCancelHoldItem(this, idx); } else { UpdateItemAnim(this); } } } -void sub_0807660C(ItemBehavior* this, u32 arg1) { +void sub_0807660C(ItemBehavior* this, u32 idx) { UpdateItemAnim(this); if ((this->field_0x5[2]-- == 0) || (gPlayerState.field_0x0[1] == 0)) { gPlayerState.field_0x0[1] = 0; - DeletePlayerItem(this, arg1); + DeletePlayerItem(this, idx); } } diff --git a/src/movement.c b/src/movement.c index 1e54b3c5..66cfb465 100644 --- a/src/movement.c +++ b/src/movement.c @@ -16,7 +16,7 @@ bool32 sub_080AF0C8(Entity*); typedef enum { CollisionType0, // Normal/common? Used by most enemies and NPCs. CollisionType1, // chaser, enemy50, fallingBoulder, ghini, keese, pesto, sensorBladeTrap, vaatiRebornEnemy, - // playerItem10, playerItem13 + // PlayerItemGust, PlayerItemHeldObject CollisionType2, // acroBandits, beetle, chuchu, fireballGuy, flyingSkull, helmasaur, keaton, lakitu, // miniFireballGuy, peahat, rollobite, spikedBeetle, spinyChuchu, stalfos, itemOnGround, // smallIceBlock, flyingPot, object1F @@ -30,7 +30,7 @@ typedef enum { CollisionType7, // not used? CollisionType8, // not used? CollisionType9, // not used? - CollisionType10, // playerItem13, rollobite + CollisionType10, // PlayerItemHeldObject, rollobite CollisionType11, // not used? CollisionType12, // chaser, sensorBladeTrap } CollisionType; diff --git a/src/npc/carlov.c b/src/npc/carlov.c index 8f830b11..6267b19b 100644 --- a/src/npc/carlov.c +++ b/src/npc/carlov.c @@ -12,7 +12,7 @@ void Carlov(Entity* this) { } if ((this->frame & 0x10) != 0) { this->frame = this->frame & 0xef; - EnqueueSFX(SFX_104); + EnqueueSFX(SFX_PLACE_OBJ); InitScreenShake(0x10, 0); } if ((this->frame & 0x20) != 0) { diff --git a/src/object/pushableLever.c b/src/object/pushableLever.c index c546d23e..8142a0f9 100644 --- a/src/object/pushableLever.c +++ b/src/object/pushableLever.c @@ -127,7 +127,7 @@ void PushableLever_CalculateSpriteOffsets(PushableLeverEntity* this) { super->spriteOffsetX = offsets[0]; super->spriteOffsetY = offsets[1]; if ((this->timer & 3) == 0) { - EnqueueSFX(SFX_104); + EnqueueSFX(SFX_PLACE_OBJ); } } diff --git a/src/playerItem.c b/src/playerItem.c index a588f264..7ea36d9e 100644 --- a/src/playerItem.c +++ b/src/playerItem.c @@ -6,23 +6,23 @@ typedef void(PlayerItemFunc)(Entity*); PlayerItemFunc PlayerItemSword; PlayerItemFunc PlayerItemBomb; -PlayerItemFunc PlayerItem3; +PlayerItemFunc PlayerItemBoomerang; PlayerItemFunc PlayerItemBow; PlayerItemFunc PlayerItemShield; PlayerItemFunc PlayerItemLantern; PlayerItemFunc PlayerItemNulled; PlayerItemFunc PlayerItemGustJar; PlayerItemFunc PlayerItemPacciCane; -PlayerItemFunc PlayerItemC; +PlayerItemFunc PlayerItemDashSword; PlayerItemFunc PlayerItemCellOverwriteSet; PlayerItemFunc PlayerItemBottle; PlayerItemFunc PlayerItemSwordBeam; -PlayerItemFunc PlayerItem10; -PlayerItemFunc PlayerItem11; -PlayerItemFunc PlayerItem12; -PlayerItemFunc PlayerItem13; -PlayerItemFunc PlayerItem14; -PlayerItemFunc PlayerItem15; +PlayerItemFunc PlayerItemGust; +PlayerItemFunc PlayerItemGustBig; +PlayerItemFunc PlayerItemPacciCaneProjectile; +PlayerItemFunc PlayerItemHeldObject; +PlayerItemFunc PlayerItemSpiralBeam; +PlayerItemFunc PlayerItemFireRodProjectile; PlayerItemFunc PlayerItemNulled2; typedef struct { @@ -41,7 +41,7 @@ PlayerItemFunc* const gPlayerItemFunctions[] = { DeleteEntity, PlayerItemSword, PlayerItemBomb, - PlayerItem3, + PlayerItemBoomerang, PlayerItemBow, PlayerItemShield, PlayerItemLantern, @@ -50,16 +50,16 @@ PlayerItemFunc* const gPlayerItemFunctions[] = { PlayerItemPacciCane, DeleteEntity, DeleteEntity, - PlayerItemC, + PlayerItemDashSword, PlayerItemCellOverwriteSet, PlayerItemBottle, PlayerItemSwordBeam, - PlayerItem10, - PlayerItem11, - PlayerItem12, - PlayerItem13, - PlayerItem14, - PlayerItem15, + PlayerItemGust, + PlayerItemGustBig, + PlayerItemPacciCaneProjectile, + PlayerItemHeldObject, + PlayerItemSpiralBeam, + PlayerItemFireRodProjectile, PlayerItemSwordBeam, PlayerItemNulled2, PlayerItemCellOverwriteSet, diff --git a/src/playerItem/playerItem10.c b/src/playerItem/playerItem10.c deleted file mode 100644 index c4debda4..00000000 --- a/src/playerItem/playerItem10.c +++ /dev/null @@ -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; - } - } -} diff --git a/src/playerItem/playerItem3.c b/src/playerItem/playerItemBoomerang.c similarity index 95% rename from src/playerItem/playerItem3.c rename to src/playerItem/playerItemBoomerang.c index a461e043..dabceb37 100644 --- a/src/playerItem/playerItem3.c +++ b/src/playerItem/playerItemBoomerang.c @@ -7,7 +7,7 @@ void sub_0801B804(Entity*); Entity* sub_0801B864(Entity*); void sub_0801B584(Entity*); -void PlayerItem3_Init(Entity*); +void PlayerItemBoomerang_Init(Entity*); void sub_0801B680(Entity*); void sub_0801B7A8(Entity*); @@ -16,9 +16,9 @@ extern bool32 sub_080040E2(Entity*, u8*); extern Hitbox gUnk_081271CC; extern u8 gUnk_08003E44; -void PlayerItem3(Entity* this) { - static void (*const PlayerItem3_Actions[])(Entity*) = { - PlayerItem3_Init, +void PlayerItemBoomerang(Entity* this) { + static void (*const PlayerItemBoomerang_Actions[])(Entity*) = { + PlayerItemBoomerang_Init, sub_0801B584, sub_0801B680, sub_0801B7A8, @@ -27,7 +27,7 @@ void PlayerItem3(Entity* this) { // Unused 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->animationState == 6) { 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; gPlayerState.item = this; diff --git a/src/playerItem/playerItemC.c b/src/playerItem/playerItemDashSword.c similarity index 98% rename from src/playerItem/playerItemC.c rename to src/playerItem/playerItemDashSword.c index 2ca10e84..fccbf329 100644 --- a/src/playerItem/playerItemC.c +++ b/src/playerItem/playerItemDashSword.c @@ -11,7 +11,7 @@ void sub_0801B938(Entity*); extern void sub_08017744(Entity*); -void PlayerItemC(Entity* this) { +void PlayerItemDashSword(Entity* this) { static void (*const PlayerItemC_Actions[])(Entity*) = { sub_0801B8B0, sub_0801B8FC, diff --git a/src/playerItem/playerItem15.c b/src/playerItem/playerItemFireRodProjectile.c similarity index 95% rename from src/playerItem/playerItem15.c rename to src/playerItem/playerItemFireRodProjectile.c index 16d0e35c..5bb88269 100644 --- a/src/playerItem/playerItem15.c +++ b/src/playerItem/playerItemFireRodProjectile.c @@ -8,7 +8,7 @@ extern void (*const gUnk_08127270[])(Entity*); extern Hitbox gUnk_08127278; void sub_080A310C(Entity*); -void PlayerItem15(Entity* this) { +void PlayerItemFireRodProjectile(Entity* this) { gUnk_08127270[this->action](this); } diff --git a/src/playerItem/playerItemGust.c b/src/playerItem/playerItemGust.c new file mode 100644 index 00000000..ad0a1a12 --- /dev/null +++ b/src/playerItem/playerItemGust.c @@ -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, +}; diff --git a/src/playerItem/playerItem11.c b/src/playerItem/playerItemGustBig.c similarity index 99% rename from src/playerItem/playerItem11.c rename to src/playerItem/playerItemGustBig.c index 1ae35f07..f357fb97 100644 --- a/src/playerItem/playerItem11.c +++ b/src/playerItem/playerItemGustBig.c @@ -19,7 +19,7 @@ extern u32 sub_08007DD6(u32, const u16*); extern const u16 gUnk_080B3DF4[]; extern const u8 gUnk_08003E44[]; -void PlayerItem11(Entity* this) { +void PlayerItemGustBig(Entity* this) { if (this->health) { this->iframes = 0; gUnk_080B3DD0[this->action](this); diff --git a/src/playerItem/playerItem13.c b/src/playerItem/playerItemHeldObject.c similarity index 90% rename from src/playerItem/playerItem13.c rename to src/playerItem/playerItemHeldObject.c index e76faf89..2eec6a4a 100644 --- a/src/playerItem/playerItem13.c +++ b/src/playerItem/playerItemHeldObject.c @@ -20,25 +20,25 @@ typedef struct { u8 unk_68[4]; u16 unk_6c; u16 unk_6e; -} PlayerItem13Entity; +} PlayerItemHeldObjectEntity; extern bool32 ProcessMovement10(Entity*); extern const s8 gUnk_081320C4[]; -bool32 sub_080AD32C(PlayerItem13Entity*); -void sub_080AD27C(PlayerItem13Entity*); +bool32 sub_080AD32C(PlayerItemHeldObjectEntity*); +void sub_080AD27C(PlayerItemHeldObjectEntity*); u32 sub_0806F8DC(Entity*); extern const u16 gUnk_081320CC[]; extern const u32 gUnk_081320D4[]; -void PlayerItem13(Entity* this) { +void PlayerItemHeldObject(Entity* this) { gUnk_081320A8[this->subAction](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; if ((this->unk_6c == child->kind) || (this->unk_6e == child->id)) { if (child->action != 2) { @@ -59,12 +59,12 @@ void sub_080ACFCC(PlayerItem13Entity* this) { } } -void sub_080AD040(PlayerItem13Entity* this) { - PlayerItem13Entity* child; +void sub_080AD040(PlayerItemHeldObjectEntity* this) { + PlayerItemHeldObjectEntity* child; u32 tile; u32 tmp; - child = (PlayerItem13Entity*)super->child; + child = (PlayerItemHeldObjectEntity*)super->child; if ((child->base).action != 2) { DeleteThisEntity(); } @@ -134,7 +134,7 @@ void sub_080AD040(PlayerItem13Entity* this) { } else { if (super->actionDelay != 0 || sub_080AD32C(child)) { if (super->actionDelay == 1) { - SoundReq(SFX_104); + SoundReq(SFX_PLACE_OBJ); } UpdateSpriteForCollisionLayer(super); child->base.subAction = 3; @@ -143,7 +143,7 @@ void sub_080AD040(PlayerItem13Entity* this) { child->base.spritePriority.b0 = super->spritePriority.b0; DeleteThisEntity(); } else { - SoundReq(SFX_104); + SoundReq(SFX_PLACE_OBJ); super->actionDelay++; super->zVelocity = 0x10000; super->speed /= 2; @@ -181,9 +181,9 @@ void sub_080AD274(Entity* this) { DeleteThisEntity(); } -void sub_080AD27C(PlayerItem13Entity* this) { +void sub_080AD27C(PlayerItemHeldObjectEntity* this) { u32 tmp; - PlayerItem13Entity* child = (PlayerItem13Entity*)super->child; + PlayerItemHeldObjectEntity* child = (PlayerItemHeldObjectEntity*)super->child; gNewPlayerEntity.unk_74 = NULL; if ((this->unk_6c == (u16)(child->base).kind) && (this->unk_6e == (u16)(child->base).id)) { 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; if (((super->field_0x16 & 0xf0) == 0x10) || ((super->kind == OBJECT && ((super->id == 5 || (super->id == 0x7d)))))) { diff --git a/src/playerItem/playerItem12.c b/src/playerItem/playerItemPacciCaneProjectile.c similarity index 92% rename from src/playerItem/playerItem12.c rename to src/playerItem/playerItemPacciCaneProjectile.c index cadb27f0..eee2bec5 100644 --- a/src/playerItem/playerItem12.c +++ b/src/playerItem/playerItemPacciCaneProjectile.c @@ -6,7 +6,7 @@ static const Hitbox gUnk_0811B9D0; -void PlayerItem12_Init(Entity* this); +void PlayerItemPacciCaneProjectile_Init(Entity* this); void sub_080701F8(Entity* this); void sub_0807037C(Entity* this); void sub_08070398(Entity* this); @@ -16,11 +16,11 @@ void sub_08070458(Entity* this); extern void sub_08017744(Entity*); extern u8* sub_08008782(Entity*, u32, u32, u32); -void PlayerItem12(Entity* this) { - static void (*const PlayerItem12_Actions[])(Entity*) = { - PlayerItem12_Init, sub_080701F8, sub_0807037C, sub_08070398, sub_080703BC, +void PlayerItemPacciCaneProjectile(Entity* this) { + static void (*const PlayerItemPacciCaneProjectile_Actions[])(Entity*) = { + PlayerItemPacciCaneProjectile_Init, sub_080701F8, sub_0807037C, sub_08070398, sub_080703BC, }; - PlayerItem12_Actions[this->action](this); + PlayerItemPacciCaneProjectile_Actions[this->action](this); } extern u8 gUnk_08003E44; @@ -34,7 +34,7 @@ typedef struct { u8 filler[3]; } gUnk_0811B9A8_struct; -void PlayerItem12_Init(Entity* this) { +void PlayerItemPacciCaneProjectile_Init(Entity* this) { static const s8 gUnk_0811B9A0[] = { 0, -18, 14, 0, 0, 14, -14, 0, }; diff --git a/src/playerItem/playerItem14.c b/src/playerItem/playerItemSpiralBeam.c similarity index 97% rename from src/playerItem/playerItem14.c rename to src/playerItem/playerItemSpiralBeam.c index b4e400a8..bbd501b3 100644 --- a/src/playerItem/playerItem14.c +++ b/src/playerItem/playerItemSpiralBeam.c @@ -10,7 +10,7 @@ extern u8 gUnk_08003E44; void sub_0805FC74(Entity*); -void PlayerItem14(Entity* this) { +void PlayerItemSpiralBeam(Entity* this) { gUnk_08109AC8[this->action](this); } diff --git a/src/playerItemDefinitions.c b/src/playerItemDefinitions.c index fbe11832..1eaaff4c 100644 --- a/src/playerItemDefinitions.c +++ b/src/playerItemDefinitions.c @@ -8,7 +8,7 @@ const SpriteDataC gPlayerItemDefinitions[] = { { 0, 0, 16384, 1, SPRITE_0, 0 }, // DeleteEntity MULTI_FORM(0, 1), // PlayerItemSword { 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 MULTI_FORM(2, 13), // PlayerItemShield { 0, 0, 1792, 1, SPRITE_18, 0 }, // PlayerItemLantern @@ -17,16 +17,16 @@ const SpriteDataC gPlayerItemDefinitions[] = { { 4, 0, 16384, 1, SPRITE_20, 0 }, // PlayerItemPacciCane { 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 { 0, 0, 7936, 1, SPRITE_19, 0 }, // PlayerItemSwordSpin { 0, 4, 8204, 152, SPRITE_166, 0x8000 }, // PlayerItemSwordBeam - { 0, 0, 4864, 109, SPRITE_0, 0 }, // PlayerItem10 - { 3, 0, 7183, 150, SPRITE_166, 0 }, // PlayerItem11 - { 4, 0, 7424, 1, SPRITE_166, 57 }, // PlayerItem12 - { 0, 3, 5900, 1, SPRITE_POT, 0 }, // PlayerItem13 - { 1, 4, 8460, 152, SPRITE_OBJECT43, 0x8000 }, // PlayerItem14 - { 1, 4, 8204, 152, SPRITE_166, 0x8000 }, // PlayerItem15 + { 0, 0, 4864, 109, SPRITE_0, 0 }, // PlayerItemGust + { 3, 0, 7183, 150, SPRITE_166, 0 }, // PlayerItemGustBig + { 4, 0, 7424, 1, SPRITE_166, 57 }, // PlayerItemPacciCaneProjectile + { 0, 3, 5900, 1, SPRITE_POT, 0 }, // PlayerItemHeldObject + { 1, 4, 8460, 152, SPRITE_OBJECT43, 0x8000 }, // PlayerItemSpiralBeam + { 1, 4, 8204, 152, SPRITE_166, 0x8000 }, // PlayerItemFireRodProjectile { 1, 4, 1036, 151, SPRITE_14, 0 }, // PlayerItemSwordBeam { 1, 4, 1036, 151, SPRITE_14, 0 } // PlayerItemNulled2 }; diff --git a/src/playerUtils.c b/src/playerUtils.c index 10b17c9d..5c80261b 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -78,7 +78,7 @@ void sub_0807BFD0(void); void sub_08077698(PlayerEntity* this) { ItemBehavior* puVar2; - u32 uVar3; + u32 idx; gPlayerState.field_0x3[0] &= 0xfe; gPlayerState.field_0x3[1] &= 0xf; @@ -90,15 +90,15 @@ void sub_08077698(PlayerEntity* this) { sub_08077880(gSave.stats.itemButtons[1], 2, 0); sub_080778CC(); } - uVar3 = 0; + idx = 0; puVar2 = gUnk_03000B80; do { if (puVar2->field_0x5[4] != 0) { - sub_080752E8(puVar2, uVar3); + sub_080752E8(puVar2, idx); } puVar2++; - uVar3++; - } while (uVar3 < 4); + idx++; + } while (idx < 4); } void sub_08077728(u32 param_1) { @@ -432,12 +432,12 @@ Entity* sub_08077CF8(u32 subtype, u32 form, u32 parameter, u32 unk) { return &ent->base; } -void sub_08077D38(ItemBehavior* beh, u32 arg2) { +void sub_08077D38(ItemBehavior* beh, u32 idx) { u32 r6; struct_0811BE48* ptr; - gPlayerState.field_0xa |= 8 >> arg2; - gPlayerState.keepFacing |= 8 >> arg2; + gPlayerState.field_0xa |= 8 >> idx; + gPlayerState.keepFacing |= 8 >> idx; beh->field_0x5[5] = gPlayerEntity.animationState; if (beh->stateID == 0) { beh->stateID++; @@ -465,7 +465,7 @@ void sub_08077D38(ItemBehavior* beh, u32 arg2) { beh->field_0xf = ptr->unk6[0]; 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]; } Unk_struct_in_08077EC8; -void sub_08077DF4(ItemBehavior* beh, u32 arg1) { - beh->field_0x10 = arg1; - if ((arg1 & 0xff) > 0xb8) { - arg1 += beh->field_0x5[5] >> 1; +void sub_08077DF4(ItemBehavior* beh, u32 animation) { + beh->field_0x10 = animation; + if ((animation & 0xff) > 0xb8) { + animation += beh->field_0x5[5] >> 1; } - gPlayerEntity.spriteIndex = (short)(arg1 >> 8); - InitAnimationForceUpdate(&gPlayerEntity, (u8)arg1); + gPlayerEntity.spriteIndex = (short)(animation >> 8); + InitAnimationForceUpdate(&gPlayerEntity, (u8)animation); sub_08077E54(beh); } @@ -505,10 +505,10 @@ void sub_08077E54(ItemBehavior* beh) { beh->field_0x5[9] = gPlayerEntity.frame; } -void DeletePlayerItem(ItemBehavior* arg0, u32 bits) { +void DeletePlayerItem(ItemBehavior* arg0, u32 idx) { u32 not ; - if (bits == 0) { + if (idx == 0) { if (gPlayerState.item != NULL) { ((Unk_bitfield*)gPlayerState.item)[0x11].b0 = 6; gPlayerState.item = NULL; @@ -517,8 +517,8 @@ void DeletePlayerItem(ItemBehavior* arg0, u32 bits) { } } - not = (8 >> bits); - gPlayerState.field_0x3[1] &= ~((u8)((8 >> bits) << 4) | not ); + not = (8 >> idx); + gPlayerState.field_0x3[1] &= ~((u8)((8 >> idx) << 4) | not ); not = ~not ; gPlayerState.field_0xa &= not ; gPlayerState.keepFacing &= not ; diff --git a/src/sound.c b/src/sound.c index e0c772b9..bc152269 100644 --- a/src/sound.c +++ b/src/sound.c @@ -1086,7 +1086,7 @@ const Song gSongTable[] = { [SFX_101] = { &sfx101, MUSIC_PLAYER_10, MUSIC_PLAYER_10 }, [SFX_102] = { &sfx102, MUSIC_PLAYER_0F, MUSIC_PLAYER_0F }, [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_106] = { &sfx106, MUSIC_PLAYER_0B, MUSIC_PLAYER_0B }, [SFX_107] = { &sfx107, MUSIC_PLAYER_0A, MUSIC_PLAYER_0A },