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
This commit is contained in:
aMannus 2022-10-13 04:30:15 +02:00 committed by GitHub
parent dd62d0882e
commit 7906d70485
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 21 deletions

View File

@ -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) {

View File

@ -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;