diff --git a/soh/src/code/code_800EC960.c b/soh/src/code/code_800EC960.c index cab454b13a..a0b08ff144 100644 --- a/soh/src/code/code_800EC960.c +++ b/soh/src/code/code_800EC960.c @@ -1246,6 +1246,7 @@ void Audio_StepFreqLerp(FreqLerp* lerp); void func_800F56A8(void); void Audio_PlayNatureAmbienceSequence(u8 natureAmbienceId); s32 Audio_SetGanonDistVol(u8 targetVol); +void Audio_PlayFanfare_Rando(ItemID getItemId); // Function originally not called, so repurposing for DPad input void func_800EC960(u8 dpad) { @@ -3889,6 +3890,49 @@ void Audio_ResetSfxChannelState(void) { sAudioCodeReverb = 0; } +// Function to play "get-item" fanfares according to the type of item obtained (used in rando) +// Longer fanfares for medallions/stones/songs are behind the Cvar +void Audio_PlayFanfare_Rando(ItemID getItemId) { + s32 temp1; + + if (((getItemId >= GI_RUPEE_GREEN) && (getItemId <= GI_RUPEE_RED)) || + ((getItemId >= GI_RUPEE_PURPLE) && (getItemId <= GI_RUPEE_GOLD)) || + ((getItemId >= GI_RUPEE_GREEN_LOSE) && (getItemId <= GI_RUPEE_PURPLE_LOSE)) || (getItemId == GI_HEART)) { + Audio_PlaySoundGeneral(NA_SE_SY_GET_BOXITEM, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); + } else { + if ((getItemId == GI_HEART_CONTAINER_2) || (getItemId == GI_HEART_CONTAINER) || + ((getItemId == GI_HEART_PIECE) && ((gSaveContext.inventory.questItems & 0xF0000000) == 0x40000000))) { + temp1 = NA_BGM_HEART_GET | 0x900; + } else { + temp1 = (getItemId == GI_HEART_PIECE) ? NA_BGM_SMALL_ITEM_GET : NA_BGM_ITEM_GET | 0x900; + } + // If we get a skulltula token or the "WINNER" heart, play "get small item" + if (getItemId == GI_SKULL_TOKEN || getItemId == GI_HEART_PIECE_WIN) { + temp1 = NA_BGM_SMALL_ITEM_GET | 0x900; + } + // But if the "WINNER" heart is the 4th heart piece collected, play "get heart container" + if (getItemId == GI_HEART_PIECE_WIN && ((gSaveContext.inventory.questItems & 0xF0000000) == 0x40000000)) { + temp1 = NA_BGM_HEART_GET | 0x900; + } + // If the setting is toggled on and we get special quest items (longer fanfares): + if (CVar_GetS32("gRandoQuestItemFanfares", 0) != 0) { + // If we get a medallion, play the "get a medallion" fanfare + if ((getItemId >= GI_MEDALLION_LIGHT) && (getItemId <= GI_MEDALLION_SPIRIT)) { + temp1 = NA_BGM_MEDALLION_GET | 0x900; + } + // If it's a Spiritual Stone, play the "get a spiritual stone" fanfare + if ((getItemId >= GI_STONE_KOKIRI) && (getItemId <= GI_STONE_ZORA)) { + temp1 = NA_BGM_SPIRITUAL_STONE | 0x900; + } + // If the item we're getting is a song, play the "learned a song" fanfare + if ((getItemId >= GI_ZELDAS_LULLABY) && (getItemId <= GI_PRELUDE_OF_LIGHT)) { + temp1 = NA_BGM_OCA_FAIRY_GET | 0x900; + } + } + Audio_PlayFanfare(temp1); + } +} + void func_800F3F3C(u8 arg0) { if (gSoundBankMuted[0] != 1) { Audio_StartSeq(SEQ_PLAYER_BGM_SUB, 0, NA_BGM_VARIOUS_SFX); diff --git a/soh/src/overlays/actors/ovl_En_Si/z_en_si.c b/soh/src/overlays/actors/ovl_En_Si/z_en_si.c index aa67f1a20f..944a628507 100644 --- a/soh/src/overlays/actors/ovl_En_Si/z_en_si.c +++ b/soh/src/overlays/actors/ovl_En_Si/z_en_si.c @@ -115,7 +115,12 @@ void func_80AFB768(EnSi* this, GlobalContext* globalCtx) { player->actor.freezeTimer = 20; } Message_StartTextbox(globalCtx, textId, NULL); - Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); + + if (gSaveContext.n64ddFlag) { + Audio_PlayFanfare_Rando(getItemId); + } else { + Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); + } this->actionFunc = func_80AFB950; } else { Collider_UpdateCylinder(&this->actor, &this->collider); @@ -149,7 +154,11 @@ void func_80AFB89C(EnSi* this, GlobalContext* globalCtx) { Item_Give(globalCtx, giveItemId); } Message_StartTextbox(globalCtx, textId, NULL); - Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); + if (gSaveContext.n64ddFlag) { + Audio_PlayFanfare_Rando(getItemId); + } else { + Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); + } this->actionFunc = func_80AFB950; } } 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 569ec28022..d7faa19cb3 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -12684,7 +12684,11 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { Message_StartTextbox(globalCtx, giEntry->textId, &this->actor); Item_Give(globalCtx, giEntry->itemId); - if (((this->getItemId >= GI_RUPEE_GREEN) && (this->getItemId <= GI_RUPEE_RED)) || + // In rando the fanfares are handled by a function in code_800EC960.c + if (gSaveContext.n64ddFlag) { + Audio_PlayFanfare_Rando(this->getItemId); + } + else if (((this->getItemId >= GI_RUPEE_GREEN) && (this->getItemId <= GI_RUPEE_RED)) || ((this->getItemId >= GI_RUPEE_PURPLE) && (this->getItemId <= GI_RUPEE_GOLD)) || ((this->getItemId >= GI_RUPEE_GREEN_LOSE) && (this->getItemId <= GI_RUPEE_PURPLE_LOSE)) || (this->getItemId == GI_HEART)) {