From 7906d7048524d66fc02d5372ca0b4f21e53663f5 Mon Sep 17 00:00:00 2001 From: aMannus Date: Thu, 13 Oct 2022 04:30:15 +0200 Subject: [PATCH] Fix: Pickup item cutscene logic fix (#1733) * Fix: Fix for the pickup CS logic fix (fixed) * Tiny cleanup * More fixes + clarified comments * Extract more logic into bool, clarified comments --- soh/src/code/z_parameter.c | 7 ---- .../actors/ovl_player_actor/z_player.c | 34 +++++++++++-------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index f87ba7a25..dd150913b 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -2484,13 +2484,6 @@ u8 Item_CheckObtainability(u8 item) { } else { return ITEM_NONE; } - } else if ( gSaveContext.n64ddFlag && - ((item >= RG_GERUDO_FORTRESS_SMALL_KEY) && (item <= RG_GANONS_CASTLE_SMALL_KEY) || - (item >= RG_FOREST_TEMPLE_BOSS_KEY) && (item <= RG_GANONS_CASTLE_BOSS_KEY) || - (item >= RG_DEKU_TREE_MAP) && (item <= RG_ICE_CAVERN_MAP) || - (item >= RG_DEKU_TREE_COMPASS) && (item <= RG_ICE_CAVERN_COMPASS)) - ) { - return ITEM_NONE; } else if ((item == ITEM_KEY_BOSS) || (item == ITEM_COMPASS) || (item == ITEM_DUNGEON_MAP)) { return ITEM_NONE; } else if (item == ITEM_KEY_SMALL) { diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index 515afb71c..dabafa2c9 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -6246,21 +6246,27 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { } } - // Skip cutscenes from picking up items when they come from bushes/rocks/etc, but nowhere else. - uint8_t skipItemCutscene = CVar_GetS32("gFastDrops", 0) && interactedActor->id == ACTOR_EN_ITEM00 && - interactedActor->params != 6 && interactedActor->params != 17; + // Show the cutscene for picking up an item. In vanilla, this happens in bombchu bowling alley (because getting bombchus need to show the cutscene) + // and whenever the player doesn't have the item yet. In rando, we're overruling this because we need to keep showing the cutscene + // because those items can be randomized and thus it's important to keep showing the cutscene. + uint8_t showItemCutscene = globalCtx->sceneNum == SCENE_BOWLING || Item_CheckObtainability(giEntry.itemId) == ITEM_NONE || gSaveContext.n64ddFlag; - // Same as above but for rando. We need this specifically for rando because we need to be enable the cutscenes everywhere else in the game - // because the items are randomized and thus it's important to show the get item animation. - uint8_t skipItemCutsceneRando = gSaveContext.n64ddFlag && - Item_CheckObtainability(giEntry.itemId) != ITEM_NONE && - interactedActor->id == ACTOR_EN_ITEM00 && - interactedActor->params != 6 && interactedActor->params != 17; + // Only skip cutscenes for drops when they're items/consumables from bushes/rocks/enemies. + uint8_t isDropToSkip = (interactedActor->id == ACTOR_EN_ITEM00 && interactedActor->params != 6 && interactedActor->params != 17) || + interactedActor->id == ACTOR_EN_KAREBABA || + interactedActor->id == ACTOR_EN_DEKUBABA; - // Show cutscene when picking up a item that the player doesn't own yet. - // We want to ALWAYS show "get item animations" for items when they're randomized to account for - // randomized freestanding items etc, but we still don't want to show it every time you pick up a consumable from a pot/bush etc. - if ((globalCtx->sceneNum == SCENE_BOWLING || Item_CheckObtainability(giEntry.itemId) == ITEM_NONE || gSaveContext.n64ddFlag) && !skipItemCutscene && !skipItemCutsceneRando) { + // Skip cutscenes from picking up consumables with "Fast Pickup Text" enabled, even when the player never picked it up before. + // But only for bushes/rocks/enemies because otherwise it can lead to softlocks in deku mask theatre and potentially other places. + uint8_t skipItemCutscene = CVar_GetS32("gFastDrops", 0) && isDropToSkip; + + // Same as above but for rando. Rando is different because we want to enable cutscenes for items that the player already has because + // those items could be a randomized item coming from scrubs, freestanding PoH's and keys. So we need to once again overrule + // this specifically for items coming from bushes/rocks/enemies when the player has already picked that item up. + uint8_t skipItemCutsceneRando = gSaveContext.n64ddFlag && Item_CheckObtainability(giEntry.itemId) != ITEM_NONE && isDropToSkip; + + // Show cutscene when picking up a item. + if (showItemCutscene && !skipItemCutscene && !skipItemCutsceneRando) { func_808323B4(globalCtx, this); func_8083AE40(this, giEntry.objectId); @@ -6276,7 +6282,7 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { return 1; } - // Don't show cutscene when picking up an item + // Don't show cutscene when picking up an item. func_8083E4C4(globalCtx, this, &giEntry); this->getItemId = GI_NONE; this->getItemEntry = (GetItemEntry)GET_ITEM_NONE;