diff options
| author | octorock <79596758+octorock@users.noreply.github.com> | 2023-12-28 14:59:23 +0100 |
|---|---|---|
| committer | octorock <79596758+octorock@users.noreply.github.com> | 2023-12-28 14:59:23 +0100 |
| commit | 768efa50b308be03737d7eae2a1069627ea48b79 (patch) | |
| tree | 447c266172ef82df68bfd6d4737acb499f2b1a9d /src/item | |
| parent | b6a94d5062076ce53a00609e1e661b9da9e7ee5b (diff) | |
| parent | dae4c669913c3dc4248291f2d843ac39525b2738 (diff) | |
Merge branch 'master' into tilemap-docs
Diffstat (limited to 'src/item')
| -rw-r--r-- | src/item/itemBow.c | 32 | ||||
| -rw-r--r-- | src/item/itemGustJar.c | 18 | ||||
| -rw-r--r-- | src/item/itemJarEmpty.c | 42 | ||||
| -rw-r--r-- | src/item/itemLantern.c | 2 | ||||
| -rw-r--r-- | src/item/itemMoleMitts.c | 10 | ||||
| -rw-r--r-- | src/item/itemPegasusBoots.c | 25 | ||||
| -rw-r--r-- | src/item/itemRocsCape.c | 2 | ||||
| -rw-r--r-- | src/item/itemSword.c | 16 | ||||
| -rw-r--r-- | src/item/itemTryPickupObject.c | 119 |
9 files changed, 183 insertions, 83 deletions
diff --git a/src/item/itemBow.c b/src/item/itemBow.c index 7714734f..ca2cc809 100644 --- a/src/item/itemBow.c +++ b/src/item/itemBow.c @@ -4,14 +4,14 @@ void sub_08075DF4(ItemBehavior*, u32); void sub_08075E40(ItemBehavior*, u32); -void sub_08075EC0(ItemBehavior*, u32); +void ItemBowShoot(ItemBehavior*, u32); void sub_08075F38(ItemBehavior*, u32); void sub_08075F84(ItemBehavior*, u32); void sub_08075D88(ItemBehavior*, u32); void ItemBow(ItemBehavior* this, u32 index) { static void (*const stateFuncs[])(ItemBehavior*, u32) = { - sub_08075DF4, sub_08075E40, sub_08075EC0, sub_08075F38, sub_08075F84, sub_08075D88, + sub_08075DF4, sub_08075E40, ItemBowShoot, sub_08075F38, sub_08075F84, sub_08075D88, }; stateFuncs[this->stateID](this, index); } @@ -22,14 +22,14 @@ void sub_08075DF4(ItemBehavior* this, u32 index) { sub_0806F948(&gPlayerEntity); sub_08077BB8(this); sub_08077D38(this, index); - gPlayerState.field_0x1f[2] = 1; + gPlayerState.bow_state = 1; } else { DeleteItemBehavior(this, index); } } void sub_08075E40(ItemBehavior* this, u32 index) { - if (gPlayerState.field_0x1f[2] != 0) { + if (gPlayerState.bow_state != 0) { if ((gPlayerState.attack_status & 0x80) == 0) { UpdateItemAnim(this); if ((this->playerFrame & 0x80) != 0) { @@ -43,24 +43,24 @@ void sub_08075E40(ItemBehavior* this, u32 index) { return; } } - gPlayerState.field_0x1f[2] = 0; + gPlayerState.bow_state = 0; DeleteItemBehavior(this, index); } -void sub_08075EC0(ItemBehavior* this, u32 index) { +void ItemBowShoot(ItemBehavior* this, u32 index) { u8 arrowCount; - s32 iVar2; + s32 isShooting; arrowCount = gSave.stats.arrowCount; - iVar2 = IsItemActive(this); - if (iVar2 != 0 && arrowCount != 0) { - if (((gPlayerState.attack_status & 0x80) != 0) || (gPlayerState.field_0x1f[2] == 0)) { - gPlayerState.field_0x1f[2] = 0; + isShooting = IsItemActive(this); + if (isShooting && arrowCount != 0) { + if (((gPlayerState.attack_status & 0x80) != 0) || (gPlayerState.bow_state == 0)) { + gPlayerState.bow_state = 0; DeleteItemBehavior(this, index); } } else { gPlayerState.field_0xa = (8 >> index) | gPlayerState.field_0xa; - SetItemAnim(this, 0x27c); + SetItemAnim(this, ANIM_BOW_SHOOT); this->animPriority = 0xf; this->priority |= 0xf; this->stateID = 3; @@ -68,19 +68,19 @@ void sub_08075EC0(ItemBehavior* this, u32 index) { } void sub_08075F38(ItemBehavior* this, u32 index) { - if (((gPlayerState.attack_status & 0x80) == 0) && (gPlayerState.field_0x1f[2] != 0)) { + if (((gPlayerState.attack_status & 0x80) == 0) && (gPlayerState.bow_state != 0)) { UpdateItemAnim(this); if ((this->playerFrame & 1) != 0) { this->stateID = 4; } } else { - gPlayerState.field_0x1f[2] = 0; + gPlayerState.bow_state = 0; DeleteItemBehavior(this, index); } } void sub_08075F84(ItemBehavior* this, u32 index) { - if (((gPlayerState.attack_status & 0x80) == 0) && (gPlayerState.field_0x1f[2] != 0)) { + if (((gPlayerState.attack_status & 0x80) == 0) && (gPlayerState.bow_state != 0)) { if (GetInventoryValue(ITEM_ARROW_BUTTERFLY) == 1) { sub_08077E3C(this, 5); } else { @@ -90,6 +90,6 @@ void sub_08075F84(ItemBehavior* this, u32 index) { return; } } - gPlayerState.field_0x1f[2] = 0; + gPlayerState.bow_state = 0; DeleteItemBehavior(this, index); } diff --git a/src/item/itemGustJar.c b/src/item/itemGustJar.c index 833f1198..3f66a3c1 100644 --- a/src/item/itemGustJar.c +++ b/src/item/itemGustJar.c @@ -36,7 +36,7 @@ void sub_08076E60(ItemBehavior* this, u32 index) { } if ((this->playerFrame & 0x80) != 0) { this->stateID = 2; - SetItemAnim(this, 0x504); + SetItemAnim(this, ANIM_GUSTJAR_SUCK); gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> index); playerItem = CreatePlayerItem(PLAYER_ITEM_GUST, 0, 0, 0); if (playerItem != NULL) { @@ -64,12 +64,12 @@ void sub_08076EC8(ItemBehavior* this, u32 index) { } if (gPlayerEntity.subAction == 0x1b) { - animIndex = 0x524; + animIndex = ANIM_GUSTJAR_524; } else { - if (gPlayerState.direction & 0x80) { - animIndex = 0x504; + if (gPlayerState.direction & DIR_NOT_MOVING_CHECK) { + animIndex = ANIM_GUSTJAR_SUCK; } else { - animIndex = 0x518; + animIndex = ANIM_GUSTJAR_WALK; } } @@ -100,7 +100,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) { gPlayerState.field_0x1c = 1; gPlayerState.field_0xa &= ~(8 >> index); this->stateID = 2; - SetItemAnim(this, 0x504); + SetItemAnim(this, ANIM_GUSTJAR_SUCK); item = CreatePlayerItem(PLAYER_ITEM_GUST, 0, 0, 0); if (item) { item->parent = player; @@ -108,7 +108,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) { return; } else { gPlayerState.field_0x1c = 6; - SetItemAnim(this, 0x510); + SetItemAnim(this, ANIM_GUSTJAR_END); return; } } else { @@ -155,7 +155,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) { return; break; case 7: - SetItemAnim(this, 0x514); + SetItemAnim(this, ANIM_GUSTJAR_BLOW); gPlayerState.field_0x1c = 3; gPlayerState.gustJarSpeed = 0; return; @@ -163,7 +163,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) { case 2: default: gPlayerState.field_0x1c = 3; - SetItemAnim(this, 0x514); + SetItemAnim(this, ANIM_GUSTJAR_BLOW); return; case 0: break; diff --git a/src/item/itemJarEmpty.c b/src/item/itemJarEmpty.c index 60997922..6296dc67 100644 --- a/src/item/itemJarEmpty.c +++ b/src/item/itemJarEmpty.c @@ -24,41 +24,41 @@ void sub_08077534(ItemBehavior* this, u32 index) { sub_08077BB8(this); this->priority |= 0xf; tmp = this->behaviorId; - this->timer = gSave.filler86[tmp + 0x14]; + this->timer = gSave.stats.bottles[tmp - ITEM_BOTTLE1]; switch (this->timer) { - case 0x20: - SetItemAnim(this, 0x614); + case ITEM_BOTTLE_EMPTY: + SetItemAnim(this, ANIM_BOTTLE_SWING); return; - case 0x21: - case 0x22: - case 0x23: - case 0x24: - case 0x25: - case 0x29: - case 0x2a: - case 0x2b: - case 0x2c: - case 0x2d: - case 0x2e: + case ITEM_BOTTLE_BUTTER: + case ITEM_BOTTLE_MILK: + case ITEM_BOTTLE_HALF_MILK: + case ITEM_BOTTLE_RED_POTION: + case ITEM_BOTTLE_BLUE_POTION: + case ITEM_BOTTLE_PICOLYTE_RED: + case ITEM_BOTTLE_PICOLYTE_ORANGE: + case ITEM_BOTTLE_PICOLYTE_YELLOW: + case ITEM_BOTTLE_PICOLYTE_GREEN: + case ITEM_BOTTLE_PICOLYTE_BLUE: + case ITEM_BOTTLE_PICOLYTE_WHITE: this->stateID = 3; gPlayerEntity.animationState = 4; gPlayerEntity.spriteSettings.flipX = 0; - SetItemAnim(this, 0x2df); + SetItemAnim(this, ANIM_BOTTLE_DRINK); break; - case 0x2f: - case 0x30: - case 0x31: + case BOTTLE_CHARM_NAYRU: + case BOTTLE_CHARM_FARORE: + case BOTTLE_CHARM_DIN: default: this->stateID = 3; - SetItemAnim(this, 0x610); + SetItemAnim(this, ANIM_BOTTLE_POUR); break; } gPlayerEntity.flags &= ~ENT_COLLIDE; } void sub_08077618(ItemBehavior* this, u32 index) { - if ((this->playerFrame & 0x80) != 0) { - SetItemAnim(this, 0x618); + if (this->playerFrame & 0x80) { + SetItemAnim(this, ANIM_BOTTLE_SWING_END); this->stateID++; } else { UpdateItemAnim(this); diff --git a/src/item/itemLantern.c b/src/item/itemLantern.c index 4e9902a0..070d9a89 100644 --- a/src/item/itemLantern.c +++ b/src/item/itemLantern.c @@ -104,7 +104,7 @@ void sub_08075B54(ItemBehavior* this, u32 index) { object->x.HALF.HI = tmp[0] + object->x.HALF.HI; object->y.HALF.HI = tmp[1] + object->y.HALF.HI; } - SetItemAnim(this, 0x60c); + SetItemAnim(this, ANIM_LANTERN_BURN); bVar1 = (8 >> (index)); gPlayerState.field_0xa |= bVar1; gPlayerState.keepFacing |= bVar1; diff --git a/src/item/itemMoleMitts.c b/src/item/itemMoleMitts.c index 53800f30..cf307a79 100644 --- a/src/item/itemMoleMitts.c +++ b/src/item/itemMoleMitts.c @@ -35,7 +35,7 @@ void sub_08077130(ItemBehavior* this, u32 index) { iVar1 = sub_080774A0(); if (iVar1 != 0) { if (this->timer == 0) { - SetItemAnim(this, 0x50c); + SetItemAnim(this, ANIM_MOLEMITTS_DIG); this->stateID = 2; if (iVar1 == 0x56) { if ((gPlayerEntity.animationState & 2) != 0) { @@ -46,7 +46,7 @@ void sub_08077130(ItemBehavior* this, u32 index) { } } } else { - SetItemAnim(this, 0x508); + SetItemAnim(this, ANIM_MOLEMITTS_FLOOR); this->stateID = 1; } } else { @@ -72,9 +72,9 @@ void sub_080771C8(ItemBehavior* this, u32 index) { } if ((this->playerFrame & 0x10) != 0) { if (sub_0800875A(&gPlayerEntity, 0xd, this) == 0) { - SetItemAnim(this, 0x520); + SetItemAnim(this, ANIM_MOLEMITTS_MISS); this->stateID = 3; - SoundReq(SFX_107); + SoundReq(SFX_ITEM_GLOVES_AIR); } else { if (this->subtimer != 0xff) { object = CreateObjectWithParent(&gPlayerEntity, OBJECT_1F, 0, this->field_0x2[1]); @@ -141,7 +141,7 @@ void sub_080772A8(ItemBehavior* this, u32 index) { SoundReq(SFX_108); CreateObjectWithParent(&gPlayerEntity, MOLE_MITTS_PARTICLE, this->playerFrame, 0); } else { - SetItemAnim(this, 0x51c); + SetItemAnim(this, ANIM_MOLEMITTS_CLANG); effect = CreateFx(&gPlayerEntity, FX_STARS_STRIKE, 0); if (effect != NULL) { effect->animationState = this->playerAnimationState; diff --git a/src/item/itemPegasusBoots.c b/src/item/itemPegasusBoots.c index 7b487cee..1f4aa52a 100644 --- a/src/item/itemPegasusBoots.c +++ b/src/item/itemPegasusBoots.c @@ -67,11 +67,11 @@ void sub_080768F8(ItemBehavior* this, u32 index) { bVar1 |= bVar2; if (bVar1 == 0) { gPlayerState.dash_state = 1; - gPlayerState.field_0x1f[2] = bVar1; - if ((gPlayerState.flags & PL_MINISH) == 0) { + gPlayerState.bow_state = bVar1; + if (!(gPlayerState.flags & PL_MINISH)) { this->timer = 0x10; } else { - gPlayerState.animation = 0xc14; + gPlayerState.animation = ANIM_DASH_CHARGE_MINISH; } sub_08077D38(this, index); sub_08076964(this, index); @@ -104,7 +104,7 @@ void sub_08076964(ItemBehavior* this, u32 index) { if (HasSwordEquipped() && (gPlayerState.flags & PL_MINISH) == 0 && (gPlayerState.skills & SKILL_DASH_ATTACK) != 0) { gPlayerState.lastSwordMove = SWORD_MOVE_DASH; - SetItemAnim(this, 0x298); + SetItemAnim(this, ANIM_DASH); entity = CreatePlayerItemWithParent(this, PLAYER_ITEM_DASH_SWORD); if (entity != NULL) { if (ItemIsSword(gSave.stats.itemButtons[SLOT_A]) != 0) { @@ -115,11 +115,11 @@ void sub_08076964(ItemBehavior* this, u32 index) { entity->field_0x68.HALF.LO = uVar3; return; } - } else if ((gPlayerState.flags & PL_MINISH) == 0) { - SetItemAnim(this, 0x104); + } else if (!(gPlayerState.flags & PL_MINISH)) { + SetItemAnim(this, ANIM_WALK); return; } else { - gPlayerState.animation = 0xc10; + gPlayerState.animation = ANIM_DASH_MINISH; return; } } else { @@ -136,7 +136,7 @@ void sub_08076A88(ItemBehavior* this, u32 index) { u8* ptr; if ((IsItemActive(this) != 0) && (gPlayerState.dash_state != 0)) { - if ((gPlayerState.flags & PL_MINISH) == 0) { + if (!(gPlayerState.flags & PL_MINISH)) { gPlayerEntity.speed = 0x300; } else { gPlayerEntity.speed = 0x280; @@ -148,7 +148,7 @@ void sub_08076A88(ItemBehavior* this, u32 index) { gPlayerEntity.subAction = 0; COLLISION_OFF(&gPlayerEntity); gPlayerState.field_0x38 = 0; - gPlayerState.direction = 0xff; + gPlayerState.direction = DIR_NONE; return; } this->subtimer = 1; @@ -157,12 +157,13 @@ void sub_08076A88(ItemBehavior* this, u32 index) { ptr = gUnk_0811BE38; if ((*(u16*)&ptr[(gPlayerEntity.animationState & 0xfe)] & gPlayerState.playerInput.heldInput) == 0) { this->direction = (this->playerAnimationState & 0xe) * 4; - if ((gPlayerState.direction != 0xff) && (gPlayerState.direction != this->direction)) { - if (((gPlayerState.direction - this->direction) & 0x1f) < 0x10) { + if ((gPlayerState.direction != DIR_NONE) && (gPlayerState.direction != this->direction)) { + if (((gPlayerState.direction - this->direction) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | + DirectionSouth | DirectionWest)) < DirectionSouth) { this->direction = this->direction + 2; } this->direction--; - this->direction &= 0x1f; + this->direction &= 0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest; } gPlayerState.direction = this->direction; UpdateItemAnim(this); diff --git a/src/item/itemRocsCape.c b/src/item/itemRocsCape.c index dee55950..cfb165a3 100644 --- a/src/item/itemRocsCape.c +++ b/src/item/itemRocsCape.c @@ -69,7 +69,7 @@ void sub_08076758(ItemBehavior* this, u32 index) { gPlayerEntity.field_0x7a.HWORD = 2; gPlayerEntity.zVelocity = Q_16_16(2.0); gPlayerState.jump_status |= 0x10; - gPlayerState.animation = 0x288; + gPlayerState.animation = ANIM_ROCS_CAPE; SoundReq(SFX_172); } } else { diff --git a/src/item/itemSword.c b/src/item/itemSword.c index 5598e0d7..f27e0f2b 100644 --- a/src/item/itemSword.c +++ b/src/item/itemSword.c @@ -31,7 +31,7 @@ void sub_08075338(ItemBehavior* this, u32 index) { if (gPlayerState.flags & PL_MINISH) { this->priority |= 0x80; sub_08077D38(this, index); - gPlayerState.animation = 0xc00; + gPlayerState.animation = ANIM_SWORD_MINISH; SoundReq(SFX_PLY_VO1); return; } @@ -80,7 +80,7 @@ void sub_08075338(ItemBehavior* this, u32 index) { this->priority |= 0x80; gPlayerState.lastSwordMove = SWORD_MOVE_ROLL; gPlayerState.flags |= PL_SWORD_THRUST; - SetItemAnim(this, 0x130); + SetItemAnim(this, ANIM_ROLLATTACK_SLIDE); SoundReq(SFX_PLY_VO3); return; } @@ -150,7 +150,7 @@ void sub_08075580(ItemBehavior* this, u32 index) { } else { this->timer = 0x50; } - SetItemAnim(this, 0x168); + SetItemAnim(this, ANIM_SWORD_CHARGE); CreateObject(SWORD_PARTICLE, 0, 0); return; } @@ -190,10 +190,10 @@ void sub_08075694(ItemBehavior* this, u32 index) { if (gPlayerState.flags & PL_SWORD_THRUST) { gPlayerState.flags &= ~PL_SWORD_THRUST; gPlayerState.flags &= ~PL_ROLLING; - SetItemAnim(this, 300); + SetItemAnim(this, ANIM_ROLLATTACK_SPIN); } else { gPlayerState.lastSwordMove = SWORD_MOVE_SPIN; - SetItemAnim(this, 0x124); + SetItemAnim(this, ANIM_SPINATTACK); } gPlayerState.field_0xa = (8 >> index) | gPlayerState.field_0xa; this->stateID = 4; @@ -220,7 +220,7 @@ void sub_08075738(ItemBehavior* this, u32 index) { } if ((gPlayerState.sword_state & 0x10) != 0) { - if ((gPlayerState.direction & 0x80) == 0) { + if (!(gPlayerState.direction & DIR_NOT_MOVING_CHECK)) { this->direction = gPlayerState.direction; } gPlayerEntity.direction = this->direction; @@ -252,7 +252,7 @@ void sub_08075738(ItemBehavior* this, u32 index) { this->timer = 1; this->subtimer = 1; gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> index); - SetItemAnim(this, 0x128); + SetItemAnim(this, ANIM_GREATSPIN); } if ((this->playerFrame & 0x80) != 0) { @@ -298,7 +298,7 @@ void sub_08075900(ItemBehavior* this, u32 index) { } else { if (this->timer != 0) { if (--this->timer == 0) { - SetItemAnim(this, 0x134); + SetItemAnim(this, ANIM_ROLLATTACK_END); } gPlayerEntity.direction = (gPlayerEntity.animationState >> 1) << 3; gPlayerEntity.speed = 0x300; diff --git a/src/item/itemTryPickupObject.c b/src/item/itemTryPickupObject.c index 19838963..7e4eb7be 100644 --- a/src/item/itemTryPickupObject.c +++ b/src/item/itemTryPickupObject.c @@ -14,6 +14,11 @@ void sub_08076518(ItemBehavior*, u32); void sub_080765E0(ItemBehavior*, u32); void sub_0807660C(ItemBehavior*, u32); +extern s32 sub_0800875A(Entity*, u32, ItemBehavior*); + +extern const u16 gUnk_0811BE38[]; +extern const u16 gUnk_0811BE40[]; + void sub_08076088(ItemBehavior* this, Entity* param_2, u32 param_3) { if (param_2 != NULL) { if ((param_2->carryFlags & 1) != 0) { @@ -25,9 +30,9 @@ void sub_08076088(ItemBehavior* this, Entity* param_2, u32 param_3) { this->field_0x18 = param_2; if ((gPlayerState.flags & PL_NO_CAP)) { - SetItemAnim(this, 0x928); + SetItemAnim(this, ANIM_PICKUP_NOCAP); } else { - SetItemAnim(this, 0x338); + SetItemAnim(this, ANIM_PICKUP); } gPlayerState.heldObject = 3; gPlayerState.framestate = 4; @@ -108,12 +113,12 @@ void ItemPickupCheck(ItemBehavior* this, u32 index) { this->animPriority = 6; gPlayerState.field_0xa = (8 >> index) | gPlayerState.field_0xa; gPlayerState.keepFacing = (8 >> index) | gPlayerState.keepFacing; - if ((gPlayerState.flags & PL_NO_CAP) == 0) { - SetItemAnim(this, 0x378); + if (!(gPlayerState.flags & PL_NO_CAP)) { + SetItemAnim(this, ANIM_GRAB); } else { - SetItemAnim(this, 0x948); + SetItemAnim(this, ANIM_GRAB_NOCAP); } - SoundReq(SFX_88); + SoundReq(SFX_GRAB); break; default: break; @@ -129,7 +134,101 @@ void sub_080762C4(ItemBehavior* this, Entity* arg1, u8 arg2, u32 arg3) { sub_08077D38(this, arg3); } -ASM_FUNC("asm/non_matching/itemTryPickupObject/sub_080762D8.inc", void sub_080762D8(ItemBehavior* this, u32 index)) +void sub_080762D8(ItemBehavior* this, u32 index) { + u32 animIndex; + + gPlayerState.heldObject &= 0xcf; + if (!PlayerTryDropObject(this, index)) { + return; + } + + if (gPlayerEntity.iframes < 9 && gPlayerEntity.knockbackDuration == 0) { + if (this->field_0x18 != NULL) { + if (this->field_0x18->action == 2 && this->field_0x18->subAction == 5) { + if (!(gPlayerState.playerInput.heldInput & PLAYER_INPUT_80)) { // Pressing R + this->field_0x18->subAction = 6; + PlayerCancelHoldItem(this, index); + return; + } + } else { + PlayerCancelHoldItem(this, index); + return; + } + } + + gPlayerState.framestate = PL_STATE_THROW; + gHUD.rActionGrabbing = 8; + } else { + if (this->field_0x18 != NULL) { + this->field_0x18->subAction = 6; + } + PlayerCancelHoldItem(this, index); + return; + } + + if (!gPlayerState.jump_status) { + + if (gPlayerState.heldObject == 1 && sub_0800875A(&gPlayerEntity, 6, this) != 0) { + sub_08076088(this, NULL, index); + return; + } else if (gUnk_0811BE38[gPlayerEntity.animationState >> 1] & gPlayerState.playerInput.heldInput) { + UpdateItemAnim(this); + + if (!(gPlayerState.flags & PL_NO_CAP)) { + animIndex = ANIM_PULL; + } else { + animIndex = ANIM_PULL_START_NOCAP; + } + + if (animIndex != this->animIndex) { + SetItemAnim(this, animIndex); + } + + gPlayerState.heldObject |= 0x10; + gPlayerState.framestate = PL_STATE_PULL; + + if (gPlayerState.heldObject == 1) { + return; + } + + sub_08076088(this, this->field_0x18, index); + } else { + if (gPlayerState.playerInput.heldInput & gUnk_0811BE40[gPlayerEntity.animationState >> 1]) { + if (gPlayerEntity.subtimer < 6) { + gPlayerEntity.subtimer++; + return; + } + + gPlayerState.field_0x35 = this->playerAnimationState; + gPlayerState.pushedObject |= 0x80; + gPlayerState.heldObject |= 0x20; + gPlayerState.framestate = PL_STATE_PUSH; + + if (!(gPlayerState.flags & PL_NO_CAP)) { + animIndex = ANIM_PUSH; + } else { + animIndex = ANIM_PUSH_NOCAP; + } + + if (animIndex == this->animIndex) { + UpdateItemAnim(this); + } else { + SetItemAnim(this, animIndex); + } + } else { + gPlayerEntity.subtimer = 0; + + if (!(gPlayerState.flags & PL_NO_CAP)) { + SetItemAnim(this, ANIM_PULL); + } else { + SetItemAnim(this, ANIM_PULL_START_NOCAP); + } + } + } + } else { + PlayerCancelHoldItem(this, index); + } +} void sub_08076488(ItemBehavior* this, u32 index) { u32 bVar1; @@ -172,10 +271,10 @@ void sub_08076518(ItemBehavior* this, u32 index) { this->field_0x18 = NULL; this->stateID++; this->animPriority = 0x0f; - if ((gPlayerState.flags & PL_NO_CAP) != 0) { - SetItemAnim(this, 0x930); + if (gPlayerState.flags & PL_NO_CAP) { + SetItemAnim(this, ANIM_THROW_NOCAP); } else { - SetItemAnim(this, 0x344); + SetItemAnim(this, ANIM_THROW); } gPlayerState.field_0xa |= 8 >> index; gPlayerState.keepFacing |= 8 >> index; |
