Cleans up and updates item fanfares.

This commit is contained in:
Christopher Leggett
2022-08-14 11:43:25 -04:00
parent 1ab4b23011
commit 0604dbfef8
2 changed files with 51 additions and 75 deletions
+23 -18
View File
@@ -3892,28 +3892,33 @@ void Audio_ResetSfxChannelState(void) {
// Function to play "get-item" fanfares according to the type of item obtained (used in rando) // 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 // Longer fanfares for medallions/stones/songs are behind the Cvar
void Audio_PlayFanfare_Rando(ItemID getItemId) { void Audio_PlayFanfare_Rando(GetItemEntry getItem) {
s32 temp1; s32 temp1;
s16 getItemId = getItem.getItemId;
if (((getItemId >= GI_RUPEE_GREEN) && (getItemId <= GI_RUPEE_RED)) || if (getItem.modIndex == MOD_NONE) {
((getItemId >= GI_RUPEE_PURPLE) && (getItemId <= GI_RUPEE_GOLD)) || if (((getItemId >= GI_RUPEE_GREEN) && (getItemId <= GI_RUPEE_RED)) ||
((getItemId >= GI_RUPEE_GREEN_LOSE) && (getItemId <= GI_RUPEE_PURPLE_LOSE)) || (getItemId == GI_HEART)) { ((getItemId >= GI_RUPEE_PURPLE) && (getItemId <= GI_RUPEE_GOLD)) ||
Audio_PlaySoundGeneral(NA_SE_SY_GET_BOXITEM, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); ((getItemId >= GI_RUPEE_GREEN_LOSE) && (getItemId <= GI_RUPEE_PURPLE_LOSE)) || (getItemId == GI_HEART)) {
} else { Audio_PlaySoundGeneral(NA_SE_SY_GET_BOXITEM, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
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 { } else {
temp1 = (getItemId == GI_HEART_PIECE) ? NA_BGM_SMALL_ITEM_GET : NA_BGM_ITEM_GET | 0x900; if ((getItemId == GI_HEART_CONTAINER_2) || (getItemId == GI_HEART_CONTAINER) ||
} ((getItemId == GI_HEART_PIECE) && ((gSaveContext.inventory.questItems & 0xF0000000) == 0x40000000))) {
// If we get a skulltula token or the "WINNER" heart, play "get small item" temp1 = NA_BGM_HEART_GET | 0x900;
if (getItemId == GI_SKULL_TOKEN || getItemId == GI_HEART_PIECE_WIN) { } else {
temp1 = NA_BGM_SMALL_ITEM_GET | 0x900; temp1 = (getItemId == GI_HEART_PIECE) ? NA_BGM_SMALL_ITEM_GET : NA_BGM_ITEM_GET | 0x900;
} }
// But if the "WINNER" heart is the 4th heart piece collected, play "get heart container" // If we get a skulltula token or the "WINNER" heart, play "get small item"
if (getItemId == GI_HEART_PIECE_WIN && ((gSaveContext.inventory.questItems & 0xF0000000) == 0x40000000)) { if (getItemId == GI_SKULL_TOKEN || getItemId == GI_HEART_PIECE_WIN) {
temp1 = NA_BGM_HEART_GET | 0x900; 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;
}
Audio_PlayFanfare(temp1);
} }
} else if (getItem.modIndex == MOD_RANDOMIZER) {
// If the setting is toggled on and we get special quest items (longer fanfares): // If the setting is toggled on and we get special quest items (longer fanfares):
if (CVar_GetS32("gRandoQuestItemFanfares", 0) != 0) { if (CVar_GetS32("gRandoQuestItemFanfares", 0) != 0) {
// If we get a medallion, play the "get a medallion" fanfare // If we get a medallion, play the "get a medallion" fanfare
@@ -12578,67 +12578,38 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) {
} }
Player_SetPendingFlag(this, globalCtx); Player_SetPendingFlag(this, globalCtx);
if (this->getItemEntry.objectId == OBJECT_INVALID) { // Use this if we do have a getItemEntry
// Use this if player does not have a getItemEntry if (giEntry.modIndex == MOD_NONE) {
if (giEntry.modIndex == MOD_NONE) { if (gSaveContext.n64ddFlag) {
if (((this->getItemId >= GI_RUPEE_GREEN) && (this->getItemId <= GI_RUPEE_RED)) || Audio_PlayFanfare_Rando(this->getItemId);
((this->getItemId >= GI_RUPEE_PURPLE) && (this->getItemId <= GI_RUPEE_GOLD)) || } else if (((giEntry.itemId >= ITEM_RUPEE_GREEN) && (giEntry.itemId <= ITEM_RUPEE_RED)) ||
((this->getItemId >= GI_RUPEE_GREEN_LOSE) && (this->getItemId <= GI_RUPEE_PURPLE_LOSE)) || ((giEntry.itemId >= ITEM_RUPEE_PURPLE) && (giEntry.itemId <= ITEM_RUPEE_GOLD)) ||
(this->getItemId == GI_HEART)) { (giEntry.itemId == ITEM_HEART)) {
Audio_PlaySoundGeneral(NA_SE_SY_GET_BOXITEM, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); Audio_PlaySoundGeneral(NA_SE_SY_GET_BOXITEM, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
} else { } else {
if ((this->getItemId == GI_HEART_CONTAINER_2) || (this->getItemId == GI_HEART_CONTAINER) || if ((giEntry.itemId == ITEM_HEART_CONTAINER) ||
((this->getItemId == GI_HEART_PIECE) && ((giEntry.itemId == ITEM_HEART_PIECE) &&
((gSaveContext.inventory.questItems & 0xF0000000) == 0x40000000))) { ((gSaveContext.inventory.questItems & 0xF0000000) == 0x40000000))) {
temp1 = NA_BGM_HEART_GET | 0x900; temp1 = NA_BGM_HEART_GET | 0x900;
} else { } else {
temp1 = temp2 = temp1 = temp2 =
(this->getItemId == GI_HEART_PIECE) ? NA_BGM_SMALL_ITEM_GET : NA_BGM_ITEM_GET | 0x900; (giEntry.itemId == ITEM_HEART_PIECE) ? NA_BGM_SMALL_ITEM_GET : NA_BGM_ITEM_GET | 0x900;
} }
Audio_PlayFanfare(temp1); Audio_PlayFanfare(temp1);
} }
} else if (giEntry.modIndex == MOD_RANDOMIZER) { } else if (giEntry.modIndex == MOD_RANDOMIZER) {
if (this->getItemId == RG_DOUBLE_DEFENSE || this->getItemId == RG_MAGIC_SINGLE || if (gSaveContext.n64ddFlag) {
this->getItemId == RG_MAGIC_DOUBLE) { Audio_PlayFanfare_Rando(this->getItemId);
Audio_PlayFanfare(NA_BGM_HEART_GET | 0x900); } else if (giEntry.itemId == RG_DOUBLE_DEFENSE || giEntry.itemId == RG_MAGIC_SINGLE ||
} else { giEntry.itemId == RG_MAGIC_DOUBLE) {
Audio_PlayFanfare(NA_BGM_ITEM_GET | 0x900); Audio_PlayFanfare(NA_BGM_HEART_GET | 0x900);
}
} else { } else {
// Just in case something weird happens with MOD_INDEX
Audio_PlayFanfare(NA_BGM_ITEM_GET | 0x900); Audio_PlayFanfare(NA_BGM_ITEM_GET | 0x900);
} }
} else { } else {
// Use this if we do have a getItemEntry // Just in case something weird happens with modIndex.
if (giEntry.modIndex == MOD_NONE) { Audio_PlayFanfare(NA_BGM_ITEM_GET | 0x900);
if (((giEntry.itemId >= ITEM_RUPEE_GREEN) && (giEntry.itemId <= ITEM_RUPEE_RED)) ||
((giEntry.itemId >= ITEM_RUPEE_PURPLE) && (giEntry.itemId <= ITEM_RUPEE_GOLD)) ||
(giEntry.itemId == ITEM_HEART)) {
Audio_PlaySoundGeneral(NA_SE_SY_GET_BOXITEM, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
} else {
if ((giEntry.itemId == ITEM_HEART_CONTAINER) ||
((giEntry.itemId == ITEM_HEART_PIECE) &&
((gSaveContext.inventory.questItems & 0xF0000000) == 0x40000000))) {
temp1 = NA_BGM_HEART_GET | 0x900;
} else {
temp1 = temp2 =
(giEntry.itemId == ITEM_HEART_PIECE) ? NA_BGM_SMALL_ITEM_GET : NA_BGM_ITEM_GET | 0x900;
}
Audio_PlayFanfare(temp1);
}
} else if (giEntry.modIndex == MOD_RANDOMIZER) {
if (giEntry.itemId == RG_DOUBLE_DEFENSE || giEntry.itemId == RG_MAGIC_SINGLE ||
giEntry.itemId == RG_MAGIC_DOUBLE) {
Audio_PlayFanfare(NA_BGM_HEART_GET | 0x900);
} else {
Audio_PlayFanfare(NA_BGM_ITEM_GET | 0x900);
}
} else {
// Just in case something weird happens with modIndex.
Audio_PlayFanfare(NA_BGM_ITEM_GET | 0x900);
}
} }
//this->getItemEntry = (GetItemEntry)GET_ITEM_NONE;
} else { } else {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) {
if (this->getItemId == GI_GAUNTLETS_SILVER && !gSaveContext.n64ddFlag) { if (this->getItemId == GI_GAUNTLETS_SILVER && !gSaveContext.n64ddFlag) {