From ec0a080956fd0277f776273b9bfe284f58014498 Mon Sep 17 00:00:00 2001 From: Sarge-117 Date: Tue, 12 Jul 2022 22:08:25 -0700 Subject: [PATCH 01/24] Rando: Minor feature - quest item fanfares In rando, when we find a special quest item somewhere (e.g. a medallion, stone, or song), play that item's unique fanfare instead of the default "get item" fanfare Closes HarbourMasters/Shipwright#716 --- .../actors/ovl_player_actor/z_player.c | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) 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 1973a09a4..4e1b054df 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -12675,6 +12675,33 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { else { temp1 = temp2 = (this->getItemId == GI_HEART_PIECE) ? NA_BGM_SMALL_ITEM_GET : NA_BGM_ITEM_GET | 0x900; } + + // In Rando, if we get special quest items (medallions/stones/songs), play their respective unique fanfares + // instead of the default "get item" fanfare + if (gSaveContext.n64ddFlag) { + // If the item we're getting is a medallion, play the "get a medallion" fanfare + if ((this->getItemId == GI_MEDALLION_FOREST) || (this->getItemId == GI_MEDALLION_FIRE) || + (this->getItemId == GI_MEDALLION_WATER) || (this->getItemId == GI_MEDALLION_SHADOW) || + (this->getItemId == GI_MEDALLION_SPIRIT) || (this->getItemId == GI_MEDALLION_LIGHT)) { + temp1 = NA_BGM_MEDALLION_GET | 0x900; + } + // If it's a Spiritual Stone, play the "get a spiritual stone" fanfare + if ((this->getItemId == GI_STONE_KOKIRI) || (this->getItemId == GI_STONE_GORON) || + (this->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 ((this->getItemId == GI_SONG_OF_STORMS) || (this->getItemId == GI_SERENADE_OF_WATER) || + (this->getItemId == GI_EPONAS_SONG) || (this->getItemId == GI_SARIAS_SONG) || + (this->getItemId == GI_SUNS_SONG) || (this->getItemId == GI_SONG_OF_TIME) || + (this->getItemId == GI_PRELUDE_OF_LIGHT) || (this->getItemId == GI_MINUET_OF_FOREST) || + (this->getItemId == GI_BOLERO_OF_FIRE) || (this->getItemId == GI_NOCTURNE_OF_SHADOW) || + (this->getItemId == GI_REQUIEM_OF_SPIRIT) || (this->getItemId == GI_PRELUDE_OF_LIGHT)) { + temp1 = NA_BGM_OCA_FAIRY_GET | 0x900; + } + } + // *************************************************************************************** + Audio_PlayFanfare(temp1); } } From d424ee6fa88658852d76f08a1915a2f7ae9fec27 Mon Sep 17 00:00:00 2001 From: Sarge-117 Date: Tue, 12 Jul 2022 22:21:30 -0700 Subject: [PATCH 02/24] Fix Zelda's Lullaby Accidentally had prelude in there twice --- soh/src/overlays/actors/ovl_player_actor/z_player.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 4e1b054df..b78a8cce3 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -12696,7 +12696,7 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { (this->getItemId == GI_SUNS_SONG) || (this->getItemId == GI_SONG_OF_TIME) || (this->getItemId == GI_PRELUDE_OF_LIGHT) || (this->getItemId == GI_MINUET_OF_FOREST) || (this->getItemId == GI_BOLERO_OF_FIRE) || (this->getItemId == GI_NOCTURNE_OF_SHADOW) || - (this->getItemId == GI_REQUIEM_OF_SPIRIT) || (this->getItemId == GI_PRELUDE_OF_LIGHT)) { + (this->getItemId == GI_REQUIEM_OF_SPIRIT) || (this->getItemId == GI_ZELDAS_LULLABY)) { temp1 = NA_BGM_OCA_FAIRY_GET | 0x900; } } From dd761295fc7a6ba022684e417c96e5bcc352a8ba Mon Sep 17 00:00:00 2001 From: Sarge-117 Date: Wed, 13 Jul 2022 13:34:01 -0700 Subject: [PATCH 03/24] Add logic to also check for a toggle setting Added && for the gRandoFanfareByItemType to allow this to be a toggle setting --- soh/src/overlays/actors/ovl_player_actor/z_player.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 b78a8cce3..073a25f0b 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -12677,8 +12677,8 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { } // In Rando, if we get special quest items (medallions/stones/songs), play their respective unique fanfares - // instead of the default "get item" fanfare - if (gSaveContext.n64ddFlag) { + // instead of the default "get item" fanfare (if we have the setting toggled on) + if (gSaveContext.n64ddFlag && CVar_GetS32("gRandoFanfareByItemType", 0)) { // If the item we're getting is a medallion, play the "get a medallion" fanfare if ((this->getItemId == GI_MEDALLION_FOREST) || (this->getItemId == GI_MEDALLION_FIRE) || (this->getItemId == GI_MEDALLION_WATER) || (this->getItemId == GI_MEDALLION_SHADOW) || From fa1327553d4a37b6253def5874b71d0b802c1a6b Mon Sep 17 00:00:00 2001 From: Sarge-117 Date: Wed, 13 Jul 2022 15:12:44 -0700 Subject: [PATCH 04/24] Fix syntax I think the !=0 is needed --- soh/src/overlays/actors/ovl_player_actor/z_player.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 073a25f0b..f1d0fa6b4 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -12678,7 +12678,7 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { // In Rando, if we get special quest items (medallions/stones/songs), play their respective unique fanfares // instead of the default "get item" fanfare (if we have the setting toggled on) - if (gSaveContext.n64ddFlag && CVar_GetS32("gRandoFanfareByItemType", 0)) { + if (gSaveContext.n64ddFlag && CVar_GetS32("gRandoFanfareByItemType", 0) != 0) { // If the item we're getting is a medallion, play the "get a medallion" fanfare if ((this->getItemId == GI_MEDALLION_FOREST) || (this->getItemId == GI_MEDALLION_FIRE) || (this->getItemId == GI_MEDALLION_WATER) || (this->getItemId == GI_MEDALLION_SHADOW) || From cf0b68c572154a6df703bbb4e19a84e96990af8f Mon Sep 17 00:00:00 2001 From: Sarge-117 Date: Sat, 16 Jul 2022 00:24:38 -0700 Subject: [PATCH 05/24] Allow Equipment Toggle Allow player to toggle equipment on/off on the equipment subscreen. For tunics and boots, this will revert them to Kokiri Tunic/Kokiri Boots. For shields, it will un-equip the shield entirely. For swords, only BGS/Giant's Knife is affected, and it will revert to Master Sword. --- .../ovl_kaleido_scope/z_kaleido_equipment.c | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c index a7d22e584..730919351 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -503,12 +503,48 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { (gEquipAgeReqs[pauseCtx->cursorY[PAUSE_EQUIP]][pauseCtx->cursorX[PAUSE_EQUIP]] == ((void)0, gSaveContext.linkAge))) { if (CHECK_BTN_ALL(input->press.button, BTN_A)) { + + // Allow Link to remove his equipment from the equipment subscreen by toggling on/off + // Shields will be un-equipped entirely, and tunics/boots will revert to Kokiri Tunic/Kokiri Boots + // Only BGS/Giant's Knife is affected, and it will revert to Master Sword. + + // If we have the feature toggled on + if (CVar_GetS32("gEquipmentCanBeRemoved", 0)) { + + // If we're on the "swords" section of the equipment screen AND we're on a currently-equipped BGS/Giant's Knife + if (pauseCtx->cursorY[PAUSE_EQUIP] == 0 && pauseCtx->cursorX[PAUSE_EQUIP] == 3 && CUR_EQUIP_VALUE(EQUIP_SWORD) == 3) { + Inventory_ChangeEquipment(EQUIP_SWORD, 2); // "Unequip" it by equipping Master Sword + gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER; + gSaveContext.infTable[29] = 0; + goto RESUME_EQUIPMENT_SWORD; // Skip to here so we don't re-equip it + } + + // If we're on the "shields" section of the equipment screen AND we're on a currently-equipped shield + if (pauseCtx->cursorY[PAUSE_EQUIP] == 1 && pauseCtx->cursorX[PAUSE_EQUIP] == CUR_EQUIP_VALUE(EQUIP_SHIELD)) { + Inventory_ChangeEquipment(EQUIP_SHIELD, 0); // Unequip it + goto RESUME_EQUIPMENT; // Skip to here so we don't re-equip it + } + + // If we're on the "tunics" section of the equipment screen AND we're on a currently-equipped tunic + if (pauseCtx->cursorY[PAUSE_EQUIP] == 2 && pauseCtx->cursorX[PAUSE_EQUIP] == CUR_EQUIP_VALUE(EQUIP_TUNIC)) { + Inventory_ChangeEquipment(EQUIP_TUNIC, 1); // "Unequip" it (by equipping Kokiri Tunic) + goto RESUME_EQUIPMENT; // Skip to here so we don't re-equip it + } + + // If we're on the "boots" section of the equipment screen AND we're on currently-equipped boots + if (pauseCtx->cursorY[PAUSE_EQUIP] == 3 && pauseCtx->cursorX[PAUSE_EQUIP] == CUR_EQUIP_VALUE(EQUIP_BOOTS)) { + Inventory_ChangeEquipment(EQUIP_BOOTS, 1); // "Unequip" it (by equipping Kokiri Boots) + goto RESUME_EQUIPMENT; // Skip to here so we don't re-equip it + } + } + if (CHECK_OWNED_EQUIP(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP] - 1)) { Inventory_ChangeEquipment(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP]); } else { goto EQUIP_FAIL; } + RESUME_EQUIPMENT: if (pauseCtx->cursorY[PAUSE_EQUIP] == 0) { gSaveContext.infTable[29] = 0; gSaveContext.equips.buttonItems[0] = cursorItem; @@ -525,7 +561,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KNIFE; } } - + RESUME_EQUIPMENT_SWORD: Interface_LoadItemIcon1(globalCtx, 0); } From efe3294f1c08956441d0100a106fcaea39fbfe34 Mon Sep 17 00:00:00 2001 From: Sarge-117 Date: Sat, 16 Jul 2022 10:10:34 -0700 Subject: [PATCH 06/24] Set up Cvar and check for MS Set up the cvar/imgui and add a check that we own the Master Sword (in case we're in the Ganon fight) --- libultraship/libultraship/ImGuiImpl.cpp | 2 ++ soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libultraship/libultraship/ImGuiImpl.cpp b/libultraship/libultraship/ImGuiImpl.cpp index 153a193e8..d14f99128 100644 --- a/libultraship/libultraship/ImGuiImpl.cpp +++ b/libultraship/libultraship/ImGuiImpl.cpp @@ -1001,6 +1001,8 @@ namespace SohImGui { Tooltip("Displays an icon and plays a sound when Stone of Agony\nshould be activated, for those without rumble"); EnhancementCheckbox("Assignable Tunics and Boots", "gAssignableTunicsAndBoots"); Tooltip("Allows equipping the tunic and boots to c-buttons"); + EnhancementCheckbox("Equipment Toggle", "gEquipmentCanBeRemoved"); + Tooltip("Allows equipment to be removed by toggling it off on\nthe equipment subscreen."); EnhancementCheckbox("Link's Cow in Both Time Periods", "gCowOfTime"); Tooltip("Allows the Lon Lon Ranch obstacle course reward to be\nshared across time periods"); EnhancementCheckbox("Enable visible guard vision", "gGuardVision"); diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c index 730919351..f08fc9aba 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -512,7 +512,8 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { if (CVar_GetS32("gEquipmentCanBeRemoved", 0)) { // If we're on the "swords" section of the equipment screen AND we're on a currently-equipped BGS/Giant's Knife - if (pauseCtx->cursorY[PAUSE_EQUIP] == 0 && pauseCtx->cursorX[PAUSE_EQUIP] == 3 && CUR_EQUIP_VALUE(EQUIP_SWORD) == 3) { + if (pauseCtx->cursorY[PAUSE_EQUIP] == 0 && pauseCtx->cursorX[PAUSE_EQUIP] == 3 + && CUR_EQUIP_VALUE(EQUIP_SWORD) == 3 && CHECK_OWNED_EQUIP(0,1)){ // And we have the Master Sword Inventory_ChangeEquipment(EQUIP_SWORD, 2); // "Unequip" it by equipping Master Sword gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER; gSaveContext.infTable[29] = 0; From 3de4e955db89b176e72654022dff34ba96be96fd Mon Sep 17 00:00:00 2001 From: Sarge-117 Date: Mon, 18 Jul 2022 14:44:55 -0700 Subject: [PATCH 07/24] Giant's Knife Behaviour Fixes Fixes a case where Giant's Knife (specifically, breaking and re-buying it) can behave unexpectedly if you don't have a Kokiri Sword in your inventory. Also fixes the broken icon not showing up in inventory after you break it. --- soh/src/code/z_parameter.c | 7 +++++-- .../overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 0ac1e1048..926634339 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -1676,13 +1676,16 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { if (item == ITEM_SWORD_BGS) { gSaveContext.swordHealth = 8; - if (ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xF) { - gSaveContext.inventory.equipment ^= 8 << gEquipShifts[EQUIP_SWORD]; + if (ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xF + ||(gSaveContext.n64ddFlag && ALL_EQUIP_VALUE(EQUIP_SWORD))) { // In rando, when buying Giant's Knife, also check + gSaveContext.inventory.equipment ^= 8 << gEquipShifts[EQUIP_SWORD]; // for 0xE in case we don't have Kokiri Sword if (gSaveContext.equips.buttonItems[0] == ITEM_SWORD_KNIFE) { gSaveContext.equips.buttonItems[0] = ITEM_SWORD_BGS; Interface_LoadItemIcon1(globalCtx, 0); } } + + } else if (item == ITEM_SWORD_MASTER) { gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER; gSaveContext.equips.equipment &= 0xFFF0; diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c index a7d22e584..79b43eb3c 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -652,7 +652,10 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { gsDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255); gsSPGrayscale(POLY_KAL_DISP++, true); } - KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[itemId], 32, 32, point); + + if (!((i == 0) && (k == 2) && (gBitFlags[bit + 1] & gSaveContext.inventory.equipment))) { // Don't draw the full BGS icon when we have a broken Giant's Knife + KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[itemId], 32, 32, point); + } gsSPGrayscale(POLY_KAL_DISP++, false); } } From b188ed8fb4770945cb99b5e4811c7cff44dc5540 Mon Sep 17 00:00:00 2001 From: Sarge-117 Date: Mon, 18 Jul 2022 14:47:15 -0700 Subject: [PATCH 08/24] less whitespace --- soh/src/code/z_parameter.c | 1 - 1 file changed, 1 deletion(-) diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 926634339..3baf7dd77 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -1685,7 +1685,6 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { } } - } else if (item == ITEM_SWORD_MASTER) { gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER; gSaveContext.equips.equipment &= 0xFFF0; From cb1b725cdab2c7b1309f8076454c0ae914600253 Mon Sep 17 00:00:00 2001 From: Sarge-117 Date: Mon, 18 Jul 2022 18:39:24 -0700 Subject: [PATCH 09/24] Shorten code Shortened the code --- .../actors/ovl_player_actor/z_player.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) 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 916116156..c518e7c2e 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -12679,28 +12679,18 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { // In Rando, if we get special quest items (medallions/stones/songs), play their respective unique fanfares // instead of the default "get item" fanfare (if we have the setting toggled on) if (gSaveContext.n64ddFlag && CVar_GetS32("gRandoFanfareByItemType", 0) != 0) { - // If the item we're getting is a medallion, play the "get a medallion" fanfare - if ((this->getItemId == GI_MEDALLION_FOREST) || (this->getItemId == GI_MEDALLION_FIRE) || - (this->getItemId == GI_MEDALLION_WATER) || (this->getItemId == GI_MEDALLION_SHADOW) || - (this->getItemId == GI_MEDALLION_SPIRIT) || (this->getItemId == GI_MEDALLION_LIGHT)) { + if ((this->getItemId >= GI_MEDALLION_LIGHT) && (this->getItemId <= GI_MEDALLION_SPIRIT)) { temp1 = NA_BGM_MEDALLION_GET | 0x900; } // If it's a Spiritual Stone, play the "get a spiritual stone" fanfare - if ((this->getItemId == GI_STONE_KOKIRI) || (this->getItemId == GI_STONE_GORON) || - (this->getItemId == GI_STONE_ZORA)) { + if ((this->getItemId >= GI_STONE_KOKIRI) && (this->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 ((this->getItemId == GI_SONG_OF_STORMS) || (this->getItemId == GI_SERENADE_OF_WATER) || - (this->getItemId == GI_EPONAS_SONG) || (this->getItemId == GI_SARIAS_SONG) || - (this->getItemId == GI_SUNS_SONG) || (this->getItemId == GI_SONG_OF_TIME) || - (this->getItemId == GI_PRELUDE_OF_LIGHT) || (this->getItemId == GI_MINUET_OF_FOREST) || - (this->getItemId == GI_BOLERO_OF_FIRE) || (this->getItemId == GI_NOCTURNE_OF_SHADOW) || - (this->getItemId == GI_REQUIEM_OF_SPIRIT) || (this->getItemId == GI_ZELDAS_LULLABY)) { + if ((this->getItemId >= GI_ZELDAS_LULLABY) && (this->getItemId <= GI_PRELUDE_OF_LIGHT)) { temp1 = NA_BGM_OCA_FAIRY_GET | 0x900; } - } - // *************************************************************************************** + } // *************************************************************************************** Audio_PlayFanfare(temp1); } From d9f4314f5c65154e5824e8f6a6060863bd9986d9 Mon Sep 17 00:00:00 2001 From: Sarge-117 Date: Mon, 18 Jul 2022 19:01:47 -0700 Subject: [PATCH 10/24] Undo accidental commit I'm a dummy and accidentally committed changes from other branches I was working on. --- libultraship/libultraship/ImGuiImpl.cpp | 2 - soh/src/code/z_parameter.c | 6 +-- .../ovl_kaleido_scope/z_kaleido_equipment.c | 44 +------------------ 3 files changed, 4 insertions(+), 48 deletions(-) diff --git a/libultraship/libultraship/ImGuiImpl.cpp b/libultraship/libultraship/ImGuiImpl.cpp index 55316f2e3..b9ce62aee 100644 --- a/libultraship/libultraship/ImGuiImpl.cpp +++ b/libultraship/libultraship/ImGuiImpl.cpp @@ -1105,8 +1105,6 @@ namespace SohImGui { Tooltip("Displays an icon and plays a sound when Stone of Agony\nshould be activated, for those without rumble"); EnhancementCheckbox("Assignable Tunics and Boots", "gAssignableTunicsAndBoots"); Tooltip("Allows equipping the tunic and boots to c-buttons"); - EnhancementCheckbox("Equipment Toggle", "gEquipmentCanBeRemoved"); - Tooltip("Allows equipment to be removed by toggling it off on\nthe equipment subscreen."); EnhancementCheckbox("Link's Cow in Both Time Periods", "gCowOfTime"); Tooltip("Allows the Lon Lon Ranch obstacle course reward to be\nshared across time periods"); EnhancementCheckbox("Enable visible guard vision", "gGuardVision"); diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 713ac3f9c..4a79bd3bc 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -1676,15 +1676,13 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { if (item == ITEM_SWORD_BGS) { gSaveContext.swordHealth = 8; - if (ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xF - ||(gSaveContext.n64ddFlag && ALL_EQUIP_VALUE(EQUIP_SWORD))) { // In rando, when buying Giant's Knife, also check - gSaveContext.inventory.equipment ^= 8 << gEquipShifts[EQUIP_SWORD]; // for 0xE in case we don't have Kokiri Sword + if (ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xF) { + gSaveContext.inventory.equipment ^= 8 << gEquipShifts[EQUIP_SWORD]; if (gSaveContext.equips.buttonItems[0] == ITEM_SWORD_KNIFE) { gSaveContext.equips.buttonItems[0] = ITEM_SWORD_BGS; Interface_LoadItemIcon1(globalCtx, 0); } } - } else if (item == ITEM_SWORD_MASTER) { gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER; gSaveContext.equips.equipment &= 0xFFF0; diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c index f0af1a5aa..a7d22e584 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -503,49 +503,12 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { (gEquipAgeReqs[pauseCtx->cursorY[PAUSE_EQUIP]][pauseCtx->cursorX[PAUSE_EQUIP]] == ((void)0, gSaveContext.linkAge))) { if (CHECK_BTN_ALL(input->press.button, BTN_A)) { - - // Allow Link to remove his equipment from the equipment subscreen by toggling on/off - // Shields will be un-equipped entirely, and tunics/boots will revert to Kokiri Tunic/Kokiri Boots - // Only BGS/Giant's Knife is affected, and it will revert to Master Sword. - - // If we have the feature toggled on - if (CVar_GetS32("gEquipmentCanBeRemoved", 0)) { - - // If we're on the "swords" section of the equipment screen AND we're on a currently-equipped BGS/Giant's Knife - if (pauseCtx->cursorY[PAUSE_EQUIP] == 0 && pauseCtx->cursorX[PAUSE_EQUIP] == 3 - && CUR_EQUIP_VALUE(EQUIP_SWORD) == 3 && CHECK_OWNED_EQUIP(0,1)){ // And we have the Master Sword - Inventory_ChangeEquipment(EQUIP_SWORD, 2); // "Unequip" it by equipping Master Sword - gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER; - gSaveContext.infTable[29] = 0; - goto RESUME_EQUIPMENT_SWORD; // Skip to here so we don't re-equip it - } - - // If we're on the "shields" section of the equipment screen AND we're on a currently-equipped shield - if (pauseCtx->cursorY[PAUSE_EQUIP] == 1 && pauseCtx->cursorX[PAUSE_EQUIP] == CUR_EQUIP_VALUE(EQUIP_SHIELD)) { - Inventory_ChangeEquipment(EQUIP_SHIELD, 0); // Unequip it - goto RESUME_EQUIPMENT; // Skip to here so we don't re-equip it - } - - // If we're on the "tunics" section of the equipment screen AND we're on a currently-equipped tunic - if (pauseCtx->cursorY[PAUSE_EQUIP] == 2 && pauseCtx->cursorX[PAUSE_EQUIP] == CUR_EQUIP_VALUE(EQUIP_TUNIC)) { - Inventory_ChangeEquipment(EQUIP_TUNIC, 1); // "Unequip" it (by equipping Kokiri Tunic) - goto RESUME_EQUIPMENT; // Skip to here so we don't re-equip it - } - - // If we're on the "boots" section of the equipment screen AND we're on currently-equipped boots - if (pauseCtx->cursorY[PAUSE_EQUIP] == 3 && pauseCtx->cursorX[PAUSE_EQUIP] == CUR_EQUIP_VALUE(EQUIP_BOOTS)) { - Inventory_ChangeEquipment(EQUIP_BOOTS, 1); // "Unequip" it (by equipping Kokiri Boots) - goto RESUME_EQUIPMENT; // Skip to here so we don't re-equip it - } - } - if (CHECK_OWNED_EQUIP(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP] - 1)) { Inventory_ChangeEquipment(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP]); } else { goto EQUIP_FAIL; } - RESUME_EQUIPMENT: if (pauseCtx->cursorY[PAUSE_EQUIP] == 0) { gSaveContext.infTable[29] = 0; gSaveContext.equips.buttonItems[0] = cursorItem; @@ -562,7 +525,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KNIFE; } } - RESUME_EQUIPMENT_SWORD: + Interface_LoadItemIcon1(globalCtx, 0); } @@ -689,10 +652,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { gsDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255); gsSPGrayscale(POLY_KAL_DISP++, true); } - - if (!((i == 0) && (k == 2) && (gBitFlags[bit + 1] & gSaveContext.inventory.equipment))) { // Don't draw the full BGS icon when we have a broken Giant's Knife - KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[itemId], 32, 32, point); - } + KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[itemId], 32, 32, point); gsSPGrayscale(POLY_KAL_DISP++, false); } } From 068f3426d754b569050d5509ff17cc12a85342ad Mon Sep 17 00:00:00 2001 From: Sarge-117 Date: Sat, 23 Jul 2022 23:25:35 -0700 Subject: [PATCH 11/24] Account for tokensanity Added changes to restore small item fanfares to rupees, heart containers, and items when picked up from skulltulas in tokensanity. --- soh/src/overlays/actors/ovl_En_Si/z_en_si.c | 45 ++++++++++++++++++- .../actors/ovl_player_actor/z_player.c | 35 +++++++++------ 2 files changed, 65 insertions(+), 15 deletions(-) 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 aa67f1a20..a7d4271d8 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,50 @@ void func_80AFB768(EnSi* this, GlobalContext* globalCtx) { player->actor.freezeTimer = 20; } Message_StartTextbox(globalCtx, textId, NULL); - Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); + + // Restore appropriate item fanfares in rando when we're obtaining items outside of their + // normal contexts (this code more or less copied from z_player.c) + if (gSaveContext.n64ddFlag) { + 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, play "get small item" + if (getItemId == GI_SKULL_TOKEN) { + temp1 = NA_BGM_SMALL_ITEM_GET | 0x900; + } + // If the setting is toggled on and we get special quest items (longer fanfares): + if (CVar_GetS32("gRandoFanfareByItemType", 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); + }// ********************************************* + } else { + Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); + } this->actionFunc = func_80AFB950; } else { Collider_UpdateCylinder(&this->actor, &this->collider); 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 c53be404f..8f2091bca 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -12700,21 +12700,28 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { temp1 = temp2 = (this->getItemId == GI_HEART_PIECE) ? NA_BGM_SMALL_ITEM_GET : NA_BGM_ITEM_GET | 0x900; } - // In Rando, if we get special quest items (medallions/stones/songs), play their respective unique fanfares - // instead of the default "get item" fanfare (if we have the setting toggled on) - if (gSaveContext.n64ddFlag && CVar_GetS32("gRandoFanfareByItemType", 0) != 0) { - if ((this->getItemId >= GI_MEDALLION_LIGHT) && (this->getItemId <= GI_MEDALLION_SPIRIT)) { - temp1 = NA_BGM_MEDALLION_GET | 0x900; + // Restore appropriate item fanfares in rando when we're obtaining items outside of their normal contexts + if (gSaveContext.n64ddFlag) { + // If we get a skulltula token, play "get small item" (for tokensanity) + if (this->getItemId == GI_SKULL_TOKEN) { + temp1 = NA_BGM_SMALL_ITEM_GET | 0x900; + } + // If the setting is toggled on and we get special quest items (longer fanfares): + if (CVar_GetS32("gRandoFanfareByItemType", 0) != 0) { + // If we get a medallion, play the "get a medallion" fanfare + if ((this->getItemId >= GI_MEDALLION_LIGHT) && (this->getItemId <= GI_MEDALLION_SPIRIT)) { + temp1 = NA_BGM_MEDALLION_GET | 0x900; + } + // If it's a Spiritual Stone, play the "get a spiritual stone" fanfare + if ((this->getItemId >= GI_STONE_KOKIRI) && (this->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 ((this->getItemId >= GI_ZELDAS_LULLABY) && (this->getItemId <= GI_PRELUDE_OF_LIGHT)) { + temp1 = NA_BGM_OCA_FAIRY_GET | 0x900; + } } - // If it's a Spiritual Stone, play the "get a spiritual stone" fanfare - if ((this->getItemId >= GI_STONE_KOKIRI) && (this->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 ((this->getItemId >= GI_ZELDAS_LULLABY) && (this->getItemId <= GI_PRELUDE_OF_LIGHT)) { - temp1 = NA_BGM_OCA_FAIRY_GET | 0x900; - } - } // *************************************************************************************** + }// *************************************************************************************** Audio_PlayFanfare(temp1); } From 70e4f216edb49b0dfe63212ece07377fefdeeb28 Mon Sep 17 00:00:00 2001 From: Sarge-117 Date: Sun, 24 Jul 2022 00:53:37 -0700 Subject: [PATCH 12/24] Account for boomerang/hookshot tokens Fixed the case where you get the token via the boomerang or hookshot. Done by separating out the code into its own function and then calling it in the two appropriate spots. --- soh/src/overlays/actors/ovl_En_Si/z_en_si.c | 86 +++++++++++---------- 1 file changed, 46 insertions(+), 40 deletions(-) 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 a7d4271d8..922f4ae69 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 @@ -17,6 +17,7 @@ s32 func_80AFB748(EnSi* this, GlobalContext* globalCtx); void func_80AFB768(EnSi* this, GlobalContext* globalCtx); void func_80AFB89C(EnSi* this, GlobalContext* globalCtx); void func_80AFB950(EnSi* this, GlobalContext* globalCtx); +void Audio_PlayFanfare_Rando(); s32 textId = 0xB4; s32 giveItemId = ITEM_SKULL_TOKEN; @@ -116,46 +117,8 @@ void func_80AFB768(EnSi* this, GlobalContext* globalCtx) { } Message_StartTextbox(globalCtx, textId, NULL); - // Restore appropriate item fanfares in rando when we're obtaining items outside of their - // normal contexts (this code more or less copied from z_player.c) if (gSaveContext.n64ddFlag) { - 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, play "get small item" - if (getItemId == GI_SKULL_TOKEN) { - temp1 = NA_BGM_SMALL_ITEM_GET | 0x900; - } - // If the setting is toggled on and we get special quest items (longer fanfares): - if (CVar_GetS32("gRandoFanfareByItemType", 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); - }// ********************************************* + Audio_PlayFanfare_Rando(); } else { Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); } @@ -192,11 +155,54 @@ 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(); + } else { + Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); + } this->actionFunc = func_80AFB950; } } +// 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() { + 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, play "get small item" + if (getItemId == GI_SKULL_TOKEN) { + temp1 = NA_BGM_SMALL_ITEM_GET | 0x900; + } + // If the setting is toggled on and we get special quest items (longer fanfares): + if (CVar_GetS32("gRandoFanfareByItemType", 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_80AFB950(EnSi* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); From ffa3780d7b0f03f80786c05d41c883359eba12e6 Mon Sep 17 00:00:00 2001 From: aMannus Date: Sun, 24 Jul 2022 12:22:27 +0200 Subject: [PATCH 13/24] Added extra flyout for item fanfares --- libultraship/libultraship/ImGuiImpl.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libultraship/libultraship/ImGuiImpl.cpp b/libultraship/libultraship/ImGuiImpl.cpp index 8fe960904..2bef216ea 100644 --- a/libultraship/libultraship/ImGuiImpl.cpp +++ b/libultraship/libultraship/ImGuiImpl.cpp @@ -1382,6 +1382,19 @@ namespace SohImGui { for (const auto& category : windowCategories) { ImGui::SetCursorPosY(0.0f); if (ImGui::BeginMenu(category.first.c_str())) { + if (category.first == "Randomizer") { + if (ImGui::BeginMenu("Rando Enhancements")) + { + EnhancementCheckbox("Dynamic Item Fanfares", "gRandoFanfareByItemType"); + Tooltip( + "Change what fanfare is played to match the type of item that is\n" + "obtained. This can make fanfares longer than usual in some cases." + ); + + ImGui::EndMenu(); + } + ImGui::Separator(); + } for (const std::string& name : category.second) { std::string varName(name); varName.erase(std::remove_if(varName.begin(), varName.end(), [](unsigned char x) { return std::isspace(x); }), varName.end()); From b42a282a844cdcd916bc1abcc91f9769fedbeac6 Mon Sep 17 00:00:00 2001 From: aMannus Date: Sun, 24 Jul 2022 14:06:55 +0200 Subject: [PATCH 14/24] Manually declared rando menu --- libultraship/libultraship/ImGuiImpl.cpp | 50 ++++++++++++++++--------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/libultraship/libultraship/ImGuiImpl.cpp b/libultraship/libultraship/ImGuiImpl.cpp index 2bef216ea..1eb9bedfc 100644 --- a/libultraship/libultraship/ImGuiImpl.cpp +++ b/libultraship/libultraship/ImGuiImpl.cpp @@ -1381,30 +1381,44 @@ namespace SohImGui { for (const auto& category : windowCategories) { ImGui::SetCursorPosY(0.0f); - if (ImGui::BeginMenu(category.first.c_str())) { - if (category.first == "Randomizer") { - if (ImGui::BeginMenu("Rando Enhancements")) - { - EnhancementCheckbox("Dynamic Item Fanfares", "gRandoFanfareByItemType"); - Tooltip( - "Change what fanfare is played to match the type of item that is\n" - "obtained. This can make fanfares longer than usual in some cases." - ); + if (category.first != "Randomizer") { + if (ImGui::BeginMenu(category.first.c_str())) { + for (const std::string& name : category.second) { + std::string varName(name); + varName.erase(std::remove_if(varName.begin(), varName.end(), [](unsigned char x) { return std::isspace(x); }), varName.end()); + std::string toggleName = "g" + varName + "Enabled"; - ImGui::EndMenu(); + EnhancementCheckbox(name.c_str(), toggleName.c_str()); + customWindows[name].enabled = CVar_GetS32(toggleName.c_str(), 0); } - ImGui::Separator(); + ImGui::EndMenu(); } - for (const std::string& name : category.second) { - std::string varName(name); - varName.erase(std::remove_if(varName.begin(), varName.end(), [](unsigned char x) { return std::isspace(x); }), varName.end()); - std::string toggleName = "g" + varName + "Enabled"; + } + } + + ImGui::SetCursorPosY(0.0f); + + if (ImGui::BeginMenu("Randomizer")) + { + EnhancementCheckbox("Randomizer Settings", "gRandomizerSettingsEnabled"); + customWindows["Randomizer Settings"].enabled = CVar_GetS32("gRandomizerSettingsEnabled", 0); + EnhancementCheckbox("Item Tracker", "gItemTrackerEnabled"); + customWindows["Item Tracker"].enabled = CVar_GetS32("gItemTrackerEnabled", 0); + + ImGui::Separator(); + if (ImGui::BeginMenu("Rando Enhancements")) + { + EnhancementCheckbox("Dynamic Item Fanfares", "gRandoFanfareByItemType"); + Tooltip( + "Change what fanfare is played to match the type\n" + "of item that is obtained. This can make fanfares\n" + "longer than usual in some cases." + ); - EnhancementCheckbox(name.c_str(), toggleName.c_str()); - customWindows[name].enabled = CVar_GetS32(toggleName.c_str(), 0); - } ImGui::EndMenu(); } + + ImGui::EndMenu(); } ImGui::EndMenuBar(); From 5e2b7acabbdd1301dbcb93c0a2fab618953ec47a Mon Sep 17 00:00:00 2001 From: aMannus Date: Sun, 24 Jul 2022 14:19:37 +0200 Subject: [PATCH 15/24] Tiny code cleanup --- libultraship/libultraship/ImGuiImpl.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libultraship/libultraship/ImGuiImpl.cpp b/libultraship/libultraship/ImGuiImpl.cpp index 1eb9bedfc..47b992b88 100644 --- a/libultraship/libultraship/ImGuiImpl.cpp +++ b/libultraship/libultraship/ImGuiImpl.cpp @@ -1396,8 +1396,8 @@ namespace SohImGui { } } + // Randomizer Menu ImGui::SetCursorPosY(0.0f); - if (ImGui::BeginMenu("Randomizer")) { EnhancementCheckbox("Randomizer Settings", "gRandomizerSettingsEnabled"); @@ -1414,13 +1414,10 @@ namespace SohImGui { "of item that is obtained. This can make fanfares\n" "longer than usual in some cases." ); - ImGui::EndMenu(); } - ImGui::EndMenu(); } - ImGui::EndMenuBar(); } From 6c72d39f79ecef7551648a6e25ea8f2340b9386f Mon Sep 17 00:00:00 2001 From: Sarge-117 <108380086+Sarge-117@users.noreply.github.com> Date: Sun, 24 Jul 2022 11:01:57 -0700 Subject: [PATCH 16/24] Remove comment border Co-authored-by: PurpleHato --- soh/src/overlays/actors/ovl_player_actor/z_player.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 8f2091bca..9d05830d4 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -12721,7 +12721,7 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { temp1 = NA_BGM_OCA_FAIRY_GET | 0x900; } } - }// *************************************************************************************** + } Audio_PlayFanfare(temp1); } From 5ad90bf71b9b1a3c1614199219beb0ede9ed3afd Mon Sep 17 00:00:00 2001 From: Sarge-117 Date: Sun, 24 Jul 2022 12:51:55 -0700 Subject: [PATCH 17/24] Change cvar name for accuracy Changed Cvar from "gRandoFanfareByItemType" to "gRandoQuestItemFanfares" for better accuracy --- soh/src/overlays/actors/ovl_En_Si/z_en_si.c | 2 +- soh/src/overlays/actors/ovl_player_actor/z_player.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 922f4ae69..9c3ede3d3 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 @@ -185,7 +185,7 @@ void Audio_PlayFanfare_Rando() { temp1 = NA_BGM_SMALL_ITEM_GET | 0x900; } // If the setting is toggled on and we get special quest items (longer fanfares): - if (CVar_GetS32("gRandoFanfareByItemType", 0) != 0) { + 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; 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 9d05830d4..c906eb162 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -12707,7 +12707,7 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { temp1 = NA_BGM_SMALL_ITEM_GET | 0x900; } // If the setting is toggled on and we get special quest items (longer fanfares): - if (CVar_GetS32("gRandoFanfareByItemType", 0) != 0) { + if (CVar_GetS32("gRandoQuestItemFanfares", 0) != 0) { // If we get a medallion, play the "get a medallion" fanfare if ((this->getItemId >= GI_MEDALLION_LIGHT) && (this->getItemId <= GI_MEDALLION_SPIRIT)) { temp1 = NA_BGM_MEDALLION_GET | 0x900; From 94bff90cb9b2e1d0ff2608b8c49da49dbb5b8d9f Mon Sep 17 00:00:00 2001 From: aMannus Date: Sun, 24 Jul 2022 21:53:38 +0200 Subject: [PATCH 18/24] Changed name/tooltip for fanfares option --- libultraship/libultraship/ImGuiImpl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libultraship/libultraship/ImGuiImpl.cpp b/libultraship/libultraship/ImGuiImpl.cpp index 47b992b88..0e5ddd805 100644 --- a/libultraship/libultraship/ImGuiImpl.cpp +++ b/libultraship/libultraship/ImGuiImpl.cpp @@ -1408,11 +1408,11 @@ namespace SohImGui { ImGui::Separator(); if (ImGui::BeginMenu("Rando Enhancements")) { - EnhancementCheckbox("Dynamic Item Fanfares", "gRandoFanfareByItemType"); + EnhancementCheckbox("Quest Item Fanfares", "gRandoQuestItemFanfares"); Tooltip( - "Change what fanfare is played to match the type\n" - "of item that is obtained. This can make fanfares\n" - "longer than usual in some cases." + "Play unique fanfares when obtaining quest items\n" + "(medallions/stones/songs). Note that these fanfares\n" + "are longer than usual." ); ImGui::EndMenu(); } From c6cd0f5e03610c0d8cf6d63aebf2db28a949e5b3 Mon Sep 17 00:00:00 2001 From: Sarge-117 Date: Mon, 25 Jul 2022 12:43:36 -0700 Subject: [PATCH 19/24] Fix special case with the "WINNER" heart The "WINNER" heart is its own unique item rather than just another piece of heart, so it needed its own check to make it consistent with other pieces of heart --- soh/src/overlays/actors/ovl_En_Si/z_en_si.c | 8 ++++++-- soh/src/overlays/actors/ovl_player_actor/z_player.c | 11 ++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) 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 9c3ede3d3..1aba4fae3 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 @@ -180,10 +180,14 @@ void Audio_PlayFanfare_Rando() { } else { temp1 = (getItemId == GI_HEART_PIECE) ? NA_BGM_SMALL_ITEM_GET : NA_BGM_ITEM_GET | 0x900; } - // If we get a skulltula token, play "get small item" - if (getItemId == GI_SKULL_TOKEN) { + // 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 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 c906eb162..cdc63422f 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -12702,10 +12702,15 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { // Restore appropriate item fanfares in rando when we're obtaining items outside of their normal contexts if (gSaveContext.n64ddFlag) { - // If we get a skulltula token, play "get small item" (for tokensanity) - if (this->getItemId == GI_SKULL_TOKEN) { + // If we get a skulltula token (in tokensanity) or the "WINNER" heart, play "get small item" + if (this->getItemId == GI_SKULL_TOKEN || this->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 (this->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 From 0c6ed553a2b048ae802c982a4e89ff6337495e56 Mon Sep 17 00:00:00 2001 From: Sarge-117 Date: Tue, 26 Jul 2022 18:14:28 -0700 Subject: [PATCH 20/24] Shorten code by calling new function Reduced duplicate code by calling the new Audio_PlayFanfare_Rando function from z_player.c --- soh/src/overlays/actors/ovl_En_Si/z_en_si.c | 6 +-- .../actors/ovl_player_actor/z_player.c | 38 +++++-------------- 2 files changed, 13 insertions(+), 31 deletions(-) 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 1aba4fae3..5597c53eb 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 @@ -118,7 +118,7 @@ void func_80AFB768(EnSi* this, GlobalContext* globalCtx) { Message_StartTextbox(globalCtx, textId, NULL); if (gSaveContext.n64ddFlag) { - Audio_PlayFanfare_Rando(); + Audio_PlayFanfare_Rando(getItemId); } else { Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); } @@ -156,7 +156,7 @@ void func_80AFB89C(EnSi* this, GlobalContext* globalCtx) { } Message_StartTextbox(globalCtx, textId, NULL); if (gSaveContext.n64ddFlag) { - Audio_PlayFanfare_Rando(); + Audio_PlayFanfare_Rando(getItemId); } else { Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); } @@ -166,7 +166,7 @@ void func_80AFB89C(EnSi* this, GlobalContext* globalCtx) { // 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() { +void Audio_PlayFanfare_Rando(ItemID getItemId) { s32 temp1; if (((getItemId >= GI_RUPEE_GREEN) && (getItemId <= GI_RUPEE_RED)) || 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 cdc63422f..11cbf02e2 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -12684,6 +12684,11 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { Message_StartTextbox(globalCtx, giEntry->textId, &this->actor); Item_Give(globalCtx, giEntry->itemId); + // In rando the fanfares are handled in z_en_si.c, so we can skip down a bit + if (gSaveContext.n64ddFlag) { + goto RandoFanfareSkip; + } + 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)) || @@ -12699,36 +12704,13 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { else { temp1 = temp2 = (this->getItemId == GI_HEART_PIECE) ? NA_BGM_SMALL_ITEM_GET : NA_BGM_ITEM_GET | 0x900; } - - // Restore appropriate item fanfares in rando when we're obtaining items outside of their normal contexts + + RandoFanfareSkip: if (gSaveContext.n64ddFlag) { - // If we get a skulltula token (in tokensanity) or the "WINNER" heart, play "get small item" - if (this->getItemId == GI_SKULL_TOKEN || this->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 (this->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 ((this->getItemId >= GI_MEDALLION_LIGHT) && (this->getItemId <= GI_MEDALLION_SPIRIT)) { - temp1 = NA_BGM_MEDALLION_GET | 0x900; - } - // If it's a Spiritual Stone, play the "get a spiritual stone" fanfare - if ((this->getItemId >= GI_STONE_KOKIRI) && (this->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 ((this->getItemId >= GI_ZELDAS_LULLABY) && (this->getItemId <= GI_PRELUDE_OF_LIGHT)) { - temp1 = NA_BGM_OCA_FAIRY_GET | 0x900; - } - } + Audio_PlayFanfare_Rando(this->getItemId); + } else { + Audio_PlayFanfare(temp1); } - - Audio_PlayFanfare(temp1); } } else { From 430d3275bc8f54b9c0d33c5f1d3176c3ee830f3b Mon Sep 17 00:00:00 2001 From: Sarge-117 Date: Tue, 26 Jul 2022 18:25:25 -0700 Subject: [PATCH 21/24] Fix declaration Forgot to include the argument in the declaration at the top. It worked fine even without it, but figured this is safer --- soh/src/overlays/actors/ovl_En_Si/z_en_si.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 5597c53eb..98289a87e 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 @@ -17,7 +17,7 @@ s32 func_80AFB748(EnSi* this, GlobalContext* globalCtx); void func_80AFB768(EnSi* this, GlobalContext* globalCtx); void func_80AFB89C(EnSi* this, GlobalContext* globalCtx); void func_80AFB950(EnSi* this, GlobalContext* globalCtx); -void Audio_PlayFanfare_Rando(); +void Audio_PlayFanfare_Rando(ItemID getItemId); s32 textId = 0xB4; s32 giveItemId = ITEM_SKULL_TOKEN; From 4e2da51c54ef6ee29f35852fbf059217d22b5bb5 Mon Sep 17 00:00:00 2001 From: Sarge-117 Date: Wed, 27 Jul 2022 17:21:09 -0700 Subject: [PATCH 22/24] Code cleanup Some optimizations per suggestions --- .../overlays/actors/ovl_player_actor/z_player.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) 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 11cbf02e2..24c1fc90d 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -12684,12 +12684,11 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { Message_StartTextbox(globalCtx, giEntry->textId, &this->actor); Item_Give(globalCtx, giEntry->itemId); - // In rando the fanfares are handled in z_en_si.c, so we can skip down a bit + // In rando the fanfares are handled by a function in z_en_si.c if (gSaveContext.n64ddFlag) { - goto RandoFanfareSkip; - } - - if (((this->getItemId >= GI_RUPEE_GREEN) && (this->getItemId <= GI_RUPEE_RED)) || + 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)) { @@ -12704,13 +12703,7 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { else { temp1 = temp2 = (this->getItemId == GI_HEART_PIECE) ? NA_BGM_SMALL_ITEM_GET : NA_BGM_ITEM_GET | 0x900; } - - RandoFanfareSkip: - if (gSaveContext.n64ddFlag) { - Audio_PlayFanfare_Rando(this->getItemId); - } else { - Audio_PlayFanfare(temp1); - } + Audio_PlayFanfare(temp1); } } else { From 9f41ea0ab427f663648b68bb78d2190e90c29ef8 Mon Sep 17 00:00:00 2001 From: Sarge-117 Date: Wed, 27 Jul 2022 18:14:26 -0700 Subject: [PATCH 23/24] Move function to code_800EC960.c Moved Audio_PlayFanfare_Rando to a better home --- soh/src/code/code_800EC960.c | 44 +++++++++++++++++++ soh/src/overlays/actors/ovl_En_Si/z_en_si.c | 44 ------------------- .../actors/ovl_player_actor/z_player.c | 2 +- 3 files changed, 45 insertions(+), 45 deletions(-) diff --git a/soh/src/code/code_800EC960.c b/soh/src/code/code_800EC960.c index c5d150984..0a1d61f4e 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) { @@ -3887,6 +3888,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 98289a87e..944a62850 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 @@ -17,7 +17,6 @@ s32 func_80AFB748(EnSi* this, GlobalContext* globalCtx); void func_80AFB768(EnSi* this, GlobalContext* globalCtx); void func_80AFB89C(EnSi* this, GlobalContext* globalCtx); void func_80AFB950(EnSi* this, GlobalContext* globalCtx); -void Audio_PlayFanfare_Rando(ItemID getItemId); s32 textId = 0xB4; s32 giveItemId = ITEM_SKULL_TOKEN; @@ -164,49 +163,6 @@ void func_80AFB89C(EnSi* this, GlobalContext* globalCtx) { } } -// 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_80AFB950(EnSi* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); 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 24c1fc90d..5c680e8fa 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,7 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { Message_StartTextbox(globalCtx, giEntry->textId, &this->actor); Item_Give(globalCtx, giEntry->itemId); - // In rando the fanfares are handled by a function in z_en_si.c + // In rando the fanfares are handled by a function in code_800EC960.c if (gSaveContext.n64ddFlag) { Audio_PlayFanfare_Rando(this->getItemId); } From ee1bdd689979326e54d1b0305e9a0aa4575973e2 Mon Sep 17 00:00:00 2001 From: aMannus Date: Sun, 31 Jul 2022 09:30:04 +0200 Subject: [PATCH 24/24] Added no logic --- .../randomizer/3drando/settings.cpp | 11 +++++++++++ soh/soh/Enhancements/randomizer/randomizer.cpp | 18 ++++++++++++++++++ .../Enhancements/randomizer/randomizerTypes.h | 1 + 3 files changed, 30 insertions(+) diff --git a/soh/soh/Enhancements/randomizer/3drando/settings.cpp b/soh/soh/Enhancements/randomizer/3drando/settings.cpp index d0997a640..6bf207069 100644 --- a/soh/soh/Enhancements/randomizer/3drando/settings.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/settings.cpp @@ -2463,6 +2463,17 @@ namespace Settings { //Function to set flags depending on settings void UpdateSettings(std::unordered_map cvarSettings) { + // RANDTODO: Switch this back once all logic options are implemented + // Logic.SetSelectedIndex(cvarSettings[RSK_LOGIC_RULES]); + switch (cvarSettings[RSK_LOGIC_RULES]) { + case 0: + Logic.SetSelectedIndex(0); + break; + case 1: + Logic.SetSelectedIndex(2); + break; + } + OpenForest.SetSelectedIndex(cvarSettings[RSK_FOREST]); OpenKakariko.SetSelectedIndex(cvarSettings[RSK_KAK_GATE]); ZorasFountain.SetSelectedIndex(cvarSettings[RSK_ZORAS_FOUNTAIN]); diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 38ac4a306..76da06fab 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3414,6 +3414,7 @@ void GenerateRandomizerImgui() { Game::SaveSettings(); std::unordered_map cvarSettings; + cvarSettings[RSK_LOGIC_RULES] = CVar_GetS32("gRandomizeLogicRules", 0); cvarSettings[RSK_FOREST] = CVar_GetS32("gRandomizeForest", 0); cvarSettings[RSK_KAK_GATE] = CVar_GetS32("gRandomizeKakarikoGate", 0); cvarSettings[RSK_DOOR_OF_TIME] = CVar_GetS32("gRandomizeDoorOfTime", 0); @@ -3497,6 +3498,9 @@ void DrawRandoEditor(bool& open) { } // Randomizer settings + // Logic Settings + const char* randoLogicRules[2] = { "Glitchless", "No logic"}; + // Open Settings const char* randoForest[3] = { "Closed", "Closed Deku", "Open" }; const char* randoKakarikoGate[2] = { "Closed", "Open" }; @@ -3739,6 +3743,20 @@ void DrawRandoEditor(bool& open) { if (CVar_GetS32("gRandomizer", 0) == 1 && ImGui::BeginTabBar("Randomizer Settings", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { if (ImGui::BeginTabItem("Main Rules")) { + if (ImGui::BeginTable("tableRandoLogic", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { + ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthStretch, 200.0f); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::PushItemWidth(170.0); + ImGui::Text("Logic Rules"); + InsertHelpHoverText("Glitchless - No glitches are required, but may require some minor tricks.\n" + "\n" + "No logic - Item placement is completely random. MAY BE IMPOSSIBLE TO BEAT." + ); + SohImGui::EnhancementCombobox("gRandomizeLogicRules", randoLogicRules, 2, 0); + ImGui::PopItemWidth(); + ImGui::EndTable(); + } if (ImGui::BeginTable("tableRandoMainRules", 3, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { ImGui::TableSetupColumn("Open Settings", ImGuiTableColumnFlags_WidthStretch, 200.0f); ImGui::TableSetupColumn("Shuffle Settings", ImGuiTableColumnFlags_WidthStretch, 200.0f); diff --git a/soh/soh/Enhancements/randomizer/randomizerTypes.h b/soh/soh/Enhancements/randomizer/randomizerTypes.h index 95b82127e..04e647783 100644 --- a/soh/soh/Enhancements/randomizer/randomizerTypes.h +++ b/soh/soh/Enhancements/randomizer/randomizerTypes.h @@ -952,6 +952,7 @@ typedef enum { typedef enum { RSK_NONE, + RSK_LOGIC_RULES, RSK_FOREST, RSK_KAK_GATE, RSK_DOOR_OF_TIME,