Skip to content

Commit

Permalink
Merge pull request #641 from Reinmmar/MatchedFunctionReadable
Browse files Browse the repository at this point in the history
Cleaned this up a bit
  • Loading branch information
hytopoulos committed Dec 10, 2023
2 parents b43850a + 261e837 commit 9954f15
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
1 change: 1 addition & 0 deletions include/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ typedef enum {
ANIM_THROW_NOCAP = 0x930,
ANIM_CARRY_NOCAP = 0x934,
ANIM_PUSH_NOCAP = 0x93c,
ANIM_PULL_START_NOCAP = 0x940,
ANIM_PULL_NOCAP = 0x944,
ANIM_GRAB_NOCAP = 0x948,
ANIM_FALL_IN_HOLE_NOCAP = 0x950,
Expand Down
40 changes: 20 additions & 20 deletions src/item/itemTryPickupObject.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ void sub_080762D8(ItemBehavior* this, u32 index) {
u32 animIndex;

gPlayerState.heldObject &= 0xcf;
if (PlayerTryDropObject(this, index) == 0) {
if (!PlayerTryDropObject(this, index)) {
return;
}

if (((gPlayerEntity.iframes < 9) && (gPlayerEntity.knockbackDuration == 0))) {
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; //
if (!(gPlayerState.playerInput.heldInput & PLAYER_INPUT_80)) { // Pressing R
this->field_0x18->subAction = 6;
PlayerCancelHoldItem(this, index);
return;
}
Expand All @@ -156,7 +156,7 @@ void sub_080762D8(ItemBehavior* this, u32 index) {
}
}

gPlayerState.framestate = 5;
gPlayerState.framestate = PL_STATE_THROW;
gUnk_0200AF00.rActionGrabbing = 8;
} else {
if (this->field_0x18 != NULL) {
Expand All @@ -166,34 +166,34 @@ void sub_080762D8(ItemBehavior* this, u32 index) {
return;
}

if (gPlayerState.jump_status == 0) {
if (!gPlayerState.jump_status) {

if ((gPlayerState.heldObject == 1) && (sub_0800875A(&gPlayerEntity, 6, this) != 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) {
} else if (gUnk_0811BE38[gPlayerEntity.animationState >> 1] & gPlayerState.playerInput.heldInput) {
UpdateItemAnim(this);

if ((gPlayerState.flags & 8) == 0) {
animIndex = 0x340;
if (!(gPlayerState.flags & PL_NO_CAP)) {
animIndex = ANIM_PULL;
} else {
animIndex = 0x940;
animIndex = ANIM_PULL_START_NOCAP;
}

if (animIndex != this->animIndex) {
SetItemAnim(this, animIndex);
}

gPlayerState.heldObject |= 0x10;
gPlayerState.framestate = 0x1a;
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)]) != 0) {
if (gPlayerState.playerInput.heldInput & gUnk_0811BE40[gPlayerEntity.animationState >> 1]) {
if (gPlayerEntity.subtimer < 6) {
gPlayerEntity.subtimer++;
return;
Expand All @@ -202,12 +202,12 @@ void sub_080762D8(ItemBehavior* this, u32 index) {
gPlayerState.field_0x35 = this->playerAnimationState;
gPlayerState.pushedObject |= 0x80;
gPlayerState.heldObject |= 0x20;
gPlayerState.framestate = 0x19;
gPlayerState.framestate = PL_STATE_PUSH;

if ((gPlayerState.flags & 8) == 0) {
animIndex = 0x33c;
if (!(gPlayerState.flags & PL_NO_CAP)) {
animIndex = ANIM_PUSH;
} else {
animIndex = 0x93c;
animIndex = ANIM_PUSH_NOCAP;
}

if (animIndex == this->animIndex) {
Expand All @@ -218,10 +218,10 @@ void sub_080762D8(ItemBehavior* this, u32 index) {
} else {
gPlayerEntity.subtimer = 0;

if ((gPlayerState.flags & 8) == 0) {
SetItemAnim(this, 0x340);
if (!(gPlayerState.flags & PL_NO_CAP)) {
SetItemAnim(this, ANIM_PULL);
} else {
SetItemAnim(this, 0x940);
SetItemAnim(this, ANIM_PULL_START_NOCAP);
}
}
}
Expand Down

0 comments on commit 9954f15

Please sign in to comment.