Skip to content

Commit

Permalink
Implement skipping cutscenes for common items
Browse files Browse the repository at this point in the history
  • Loading branch information
aMannus committed Aug 28, 2024
1 parent 9bdfb56 commit fe44916
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 8 additions & 0 deletions soh/soh/SohMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2142,6 +2142,14 @@ void DrawRandomizerMenu() {
disableKeyColors = false;
}

UIWidgets::PaddedEnhancementCheckbox(
"Skip Common Item Cutscenes", CVAR_RANDOMIZER_ENHANCEMENT("SkipCommonItemCutscenes"), true, false,
false, "", UIWidgets::CheckboxGraphics::Cross, true);
UIWidgets::Tooltip(
"Skips the animation of Link obtaining common items. \n\n"
"Items include: Green Rupee, Blue Rupee, Hearts refills, Ammo refills, Magic refills."
);

static const char* disableKeyColorsText =
"This setting is disabled because a savefile is loaded without any key\n"
"shuffle settings set to \"Any Dungeon\", \"Overworld\" or \"Anywhere\"";
Expand Down
9 changes: 8 additions & 1 deletion soh/src/overlays/actors/ovl_player_actor/z_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -6812,6 +6812,13 @@ s32 Player_ActionChange_2(Player* this, PlayState* play) {
interactedActor->id == ACTOR_EN_KAREBABA ||
interactedActor->id == ACTOR_EN_DEKUBABA;

// Automatically skip the pickup messages for very frequent items.
uint8_t isCommonItemToSkip = CVarGetInteger(CVAR_RANDOMIZER_ENHANCEMENT("SkipCommonItemCutscenes"), true) && giEntry.modIndex == MOD_NONE &&
((giEntry.itemId >= ITEM_RUPEE_GREEN && giEntry.itemId <= ITEM_RUPEE_BLUE) ||
giEntry.itemId == ITEM_HEART ||
(giEntry.itemId >= ITEM_NUTS_5 && giEntry.itemId <= ITEM_SEEDS_30) ||
giEntry.itemId == ITEM_MAGIC_SMALL || giEntry.itemId == ITEM_MAGIC_LARGE);

// 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 = CVarGetInteger(CVAR_ENHANCEMENT("FastDrops"), 0) && isDropToSkip;
Expand All @@ -6822,7 +6829,7 @@ s32 Player_ActionChange_2(Player* this, PlayState* play) {
uint8_t skipItemCutsceneRando = IS_RANDO && Item_CheckObtainability(giEntry.itemId) != ITEM_NONE && isDropToSkip;

// Show cutscene when picking up a item.
if (showItemCutscene && !skipItemCutscene && !skipItemCutsceneRando) {
if (showItemCutscene && !skipItemCutscene && !skipItemCutsceneRando && !isCommonItemToSkip) {

Player_DetachHeldActor(play, this);
func_8083AE40(this, giEntry.objectId);
Expand Down

0 comments on commit fe44916

Please sign in to comment.