Fix weirdness with item gets from chests (#4146)

This commit is contained in:
Garrett Cox
2024-05-13 12:29:34 -05:00
committed by GitHub
parent 6f7173a5c4
commit baf7691fbd
4 changed files with 43 additions and 11 deletions
@@ -6853,10 +6853,6 @@ s32 Player_ActionChange_2(Player* this, PlayState* play) {
giEntry = this->getItemEntry;
}
EnBox* chest = (EnBox*)interactedActor;
if (CVarGetInteger(CVAR_ENHANCEMENT("FastChests"), 0) != 0) {
giEntry.gi = -1 * abs(giEntry.gi);
}
if (giEntry.itemId != ITEM_NONE) {
if (((Item_CheckObtainability(giEntry.itemId) == ITEM_NONE) && (giEntry.field & 0x40)) ||
((Item_CheckObtainability(giEntry.itemId) != ITEM_NONE) && (giEntry.field & 0x20))) {
@@ -6865,11 +6861,12 @@ s32 Player_ActionChange_2(Player* this, PlayState* play) {
}
}
func_80836898(play, this, func_8083A434);
if (GameInteractor_Should(VB_GIVE_ITEM_FROM_CHEST, true, chest)) {
func_80836898(play, this, func_8083A434);
}
this->stateFlags1 |= PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_ITEM_OVER_HEAD | PLAYER_STATE1_IN_CUTSCENE;
func_8083AE40(this, giEntry.objectId);
}
this->actor.world.pos.x =
chest->dyna.actor.world.pos.x - (Math_SinS(chest->dyna.actor.shape.rot.y) * 29.4343f);
this->actor.world.pos.z =
@@ -6877,8 +6874,10 @@ s32 Player_ActionChange_2(Player* this, PlayState* play) {
this->yaw = this->actor.shape.rot.y = chest->dyna.actor.shape.rot.y;
func_80832224(this);
if ((giEntry.itemId != ITEM_NONE) && (giEntry.gi >= 0) &&
(Item_CheckObtainability(giEntry.itemId) == ITEM_NONE)) {
bool vanillaPlaySlowChestCS = (giEntry.itemId != ITEM_NONE) && (giEntry.gi >= 0) &&
(Item_CheckObtainability(giEntry.itemId) == ITEM_NONE);
if (GameInteractor_Should(VB_PLAY_SLOW_CHEST_CS, vanillaPlaySlowChestCS, chest)) {
Player_AnimPlayOnceAdjusted(play, this, this->ageProperties->unk_98);
Player_AnimReplaceApplyFlags(play, this, 0x28F);
chest->unk_1F4 = 1;