diff options
| author | KEKW555 <152369890+KEKW555@users.noreply.github.com> | 2023-12-04 03:40:57 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-03 14:10:57 -0800 |
| commit | b43850a9aa1a78ab4571fc3a6b226f89d3c3183d (patch) | |
| tree | 692a9c1c9368e1a52010d219b18d31fb5a5a5ff8 /src | |
| parent | e9d4be449129a87e6ab9d8ee9e2bf13c9c013945 (diff) | |
Match sub_080762D8 (#640)
* Nuke sub_080762D8.inc
* Match sub_080762D8
* Fix field name
* Fix field name v2
Diffstat (limited to 'src')
| -rw-r--r-- | src/item/itemTryPickupObject.c | 101 |
1 files changed, 100 insertions, 1 deletions
diff --git a/src/item/itemTryPickupObject.c b/src/item/itemTryPickupObject.c index 994e9e2d..67340391 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) { @@ -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) == 0) { + 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 & 0x80) == 0) { + this->field_0x18->subAction = 6; // + PlayerCancelHoldItem(this, index); + return; + } + } else { + PlayerCancelHoldItem(this, index); + return; + } + } + + gPlayerState.framestate = 5; + gUnk_0200AF00.rActionGrabbing = 8; + } else { + if (this->field_0x18 != NULL) { + this->field_0x18->subAction = 6; + } + PlayerCancelHoldItem(this, index); + return; + } + + if (gPlayerState.jump_status == 0) { + + 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) != 0) { + UpdateItemAnim(this); + + if ((gPlayerState.flags & 8) == 0) { + animIndex = 0x340; + } else { + animIndex = 0x940; + } + + if (animIndex != this->animIndex) { + SetItemAnim(this, animIndex); + } + + gPlayerState.heldObject |= 0x10; + gPlayerState.framestate = 0x1a; + + if (gPlayerState.heldObject == 1) { + return; + } + + sub_08076088(this, this->field_0x18, index); + } else { + if ((gPlayerState.playerInput.heldInput & gUnk_0811BE40[(gPlayerEntity.animationState >> 1)]) != 0) { + if (gPlayerEntity.subtimer < 6) { + gPlayerEntity.subtimer++; + return; + } + + gPlayerState.field_0x35 = this->playerAnimationState; + gPlayerState.pushedObject |= 0x80; + gPlayerState.heldObject |= 0x20; + gPlayerState.framestate = 0x19; + + if ((gPlayerState.flags & 8) == 0) { + animIndex = 0x33c; + } else { + animIndex = 0x93c; + } + + if (animIndex == this->animIndex) { + UpdateItemAnim(this); + } else { + SetItemAnim(this, animIndex); + } + } else { + gPlayerEntity.subtimer = 0; + + if ((gPlayerState.flags & 8) == 0) { + SetItemAnim(this, 0x340); + } else { + SetItemAnim(this, 0x940); + } + } + } + } else { + PlayerCancelHoldItem(this, index); + } +} void sub_08076488(ItemBehavior* this, u32 index) { u32 bVar1; |
