From 075bce439b21b56b38c7403ace2b81f0c250825d Mon Sep 17 00:00:00 2001 From: aMannus Date: Tue, 29 Jul 2025 10:46:22 +0200 Subject: [PATCH] Misc bug fixes --- soh/include/functions.h | 2 +- soh/soh/Enhancements/randomizer/context.cpp | 16 +++++++++++----- soh/soh/Network/Archipelago/Archipelago.cpp | 8 ++++++-- soh/src/code/z_parameter.c | 4 ++-- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/soh/include/functions.h b/soh/include/functions.h index 826c336e6..a53a463fb 100644 --- a/soh/include/functions.h +++ b/soh/include/functions.h @@ -1069,7 +1069,7 @@ void Interface_LoadItemIcon1(PlayState* play, u16 button); void Interface_LoadItemIcon2(PlayState* play, u16 button); void func_80084BF4(PlayState* play, u16 flag); uint16_t Interface_DrawTextLine(GraphicsContext* gfx, char text[], int16_t x, int16_t y, uint16_t colorR, uint16_t colorG, uint16_t colorB, uint16_t colorA, float textScale, uint8_t textShadow); -uint16_t Interface_DrawTextLine_overlay(GraphicsContext* gfx, char text[], int16_t x, int16_t y, uint16_t colorR, uint16_t colorG, uint16_t colorB, uint16_t colorA, float textScale, uint8_t textShadow); +uint16_t Interface_DrawTextLineOverlay(GraphicsContext* gfx, char text[], int16_t x, int16_t y, uint16_t colorR, uint16_t colorG, uint16_t colorB, uint16_t colorA, float textScale, uint8_t textShadow); u8 Item_Give(PlayState* play, u8 item); u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry); u8 Item_CheckObtainability(u8 item); diff --git a/soh/soh/Enhancements/randomizer/context.cpp b/soh/soh/Enhancements/randomizer/context.cpp index d4770e827..92a18661b 100644 --- a/soh/soh/Enhancements/randomizer/context.cpp +++ b/soh/soh/Enhancements/randomizer/context.cpp @@ -546,7 +546,13 @@ void Context::ParseArchipelagoOptions(const std::map& slot_dat mOptions[RSK_SCRUBS_PRICES_AFFORDABLE].Set(0); mOptions[RSK_SHUFFLE_BEEHIVES].Set(slotData["shuffle_beehives"]); mOptions[RSK_SHUFFLE_COWS].Set(slotData["shuffle_cows"]); - mOptions[RSK_SHUFFLE_WEIRD_EGG].Set(slotData["shuffle_weird_egg"]); + // Ship shows Malon Egg location if weird egg is shuffled even with "Skip Child Zelda" on + // So manually set this to off. + if (slotData["skip_child_zelda"] == 0) { + mOptions[RSK_SHUFFLE_WEIRD_EGG].Set(slotData["shuffle_weird_egg"]); + } else { + mOptions[RSK_SHUFFLE_WEIRD_EGG].Set(RO_GENERIC_NO); + } mOptions[RSK_SHUFFLE_GERUDO_MEMBERSHIP_CARD].Set(RO_GENERIC_YES); mOptions[RSK_SHUFFLE_POTS].Set(slotData["shuffle_pots"]); mOptions[RSK_SHUFFLE_CRATES].Set(slotData["shuffle_crates"]); @@ -692,13 +698,13 @@ void Context::ParseArchipelagoOptions(const std::map& slot_dat mOptions[RSK_SHUFFLE_100_GS_REWARD].Set(RO_GENERIC_NO); mOptions[RSK_TRIFORCE_HUNT].Set(slotData["triforce_hunt"]); uint16_t triforcePiecesRequired = slotData["triforce_hunt_required_pieces"]; - uint16_t triforcePiecesExtraPercentage = slotData["triforce_hunt_extra_pieces_percentage"]; - uint16_t triforcePiecesTotal = floor(triforcePiecesRequired * (1 + (triforcePiecesExtraPercentage / 100))); + float triforcePiecesExtraMultiplier = 1 + (float(slotData["triforce_hunt_extra_pieces_percentage"]) / 100); + uint16_t triforcePiecesTotal = floor(triforcePiecesRequired * triforcePiecesExtraMultiplier); if (triforcePiecesTotal > 100) { triforcePiecesTotal = 100; } - mOptions[RSK_TRIFORCE_HUNT_PIECES_TOTAL].Set(triforcePiecesTotal); - mOptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED].Set(triforcePiecesRequired); + mOptions[RSK_TRIFORCE_HUNT_PIECES_TOTAL].Set((triforcePiecesTotal - 1)); + mOptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED].Set((triforcePiecesRequired - 1)); mOptions[RSK_SHUFFLE_BOSS_SOULS].Set(slotData["shuffle_boss_souls"]); if (slotData["shuffle_fish"] == 0) { mOptions[RSK_FISHSANITY].Set(RO_FISHSANITY_OFF); diff --git a/soh/soh/Network/Archipelago/Archipelago.cpp b/soh/soh/Network/Archipelago/Archipelago.cpp index 50f7cc6c6..5f9aa89f5 100644 --- a/soh/soh/Network/Archipelago/Archipelago.cpp +++ b/soh/soh/Network/Archipelago/Archipelago.cpp @@ -17,8 +17,8 @@ #include "soh/Notification/Notification.h" #include "soh/ShipInit.hpp" #include "soh/SaveManager.h" -#include "soh/util.h" #include "soh/SohGui/SohGui.hpp" +#include "soh/OTRGlobals.h" extern "C" { #include "variables.h" @@ -393,11 +393,15 @@ void ArchipelagoClient::OnItemReceived(const ApItem apItem) { } void ArchipelagoClient::QueueItem(const ApItem item) { - const RandomizerGet RG = Rando::StaticData::itemNameToEnum[item.itemName]; + RandomizerGet RG = Rando::StaticData::itemNameToEnum[item.itemName]; if (RG == RG_NONE) { return; } + if (OTRGlobals::Instance->gRandomizer->GetItemObtainabilityFromRandomizerGet(RG) != CAN_OBTAIN) { + RG = RG_BLUE_RUPEE; + } + itemQueued = true; GameInteractor_ExecuteOnArchipelagoItemReceived(static_cast(RG)); } diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 3459d7d80..a86ebeebf 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -3461,7 +3461,7 @@ void Interface_DrawArchipelagoStatusString(PlayState* play) { } - Interface_DrawTextLine_overlay(play->state.gfxCtx, statusText, posX, posY, 255, 255, 255, 255, 0.8f, true); + Interface_DrawTextLineOverlay(play->state.gfxCtx, statusText, posX, posY, 255, 255, 255, 255, 0.8f, true); } void Interface_DrawMagicBar(PlayState* play) { @@ -7046,7 +7046,7 @@ uint16_t Interface_DrawTextLine(GraphicsContext* gfx, char text[], int16_t x, in return kerningOffset; } -uint16_t Interface_DrawTextLine_overlay(GraphicsContext* gfx, char text[], int16_t x, int16_t y, uint16_t colorR, +uint16_t Interface_DrawTextLineOverlay(GraphicsContext* gfx, char text[], int16_t x, int16_t y, uint16_t colorR, uint16_t colorG, uint16_t colorB, uint16_t colorA, float textScale, uint8_t textShadow) {