From 51f3e3701020c6850a80d78e3ca056d7bef59cca Mon Sep 17 00:00:00 2001 From: Adam Bird Date: Sun, 18 Dec 2022 20:07:35 -0500 Subject: [PATCH] fix medi goron not selling randomized item and continuously selling knifes (#2206) --- soh/src/overlays/actors/ovl_En_Gm/z_en_gm.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/soh/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/soh/src/overlays/actors/ovl_En_Gm/z_en_gm.c index c9f95bbfd..414c35d3a 100644 --- a/soh/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/soh/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -93,13 +93,13 @@ void EnGm_Destroy(Actor* thisx, PlayState* play) { s32 func_80A3D7C8(void) { if (LINK_AGE_IN_YEARS == YEARS_CHILD) { return 0; - } else if (!(gBitFlags[2] & gSaveContext.inventory.equipment)) { - return 1; - } else if (gBitFlags[3] & gSaveContext.inventory.equipment) { - return 2; } else if ((gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_MERCHANTS) != RO_SHUFFLE_MERCHANTS_OFF) && - (gBitFlags[2] & gSaveContext.inventory.equipment)) { + !Flags_GetRandomizerInf(RAND_INF_MERCHANTS_MEDIGORON)) { return 1; + } else if (!(gBitFlags[2] & gSaveContext.inventory.equipment)) { // Don't have giant's knife + return 1; + } else if (gBitFlags[3] & gSaveContext.inventory.equipment) { // Have broken giant's knife + return 2; } else { return 3; } @@ -256,7 +256,6 @@ void EnGm_ProcessChoiceIndex(EnGm* this, PlayState* play) { GetItemEntry itemEntry = Randomizer_GetItemFromKnownCheck(RC_GC_MEDIGORON, GI_SWORD_KNIFE); gSaveContext.pendingSale = itemEntry.itemId; GiveItemEntryFromActor(&this->actor, play, itemEntry, 415.0f, 10.0f); - Flags_SetRandomizerInf(RAND_INF_MERCHANTS_MEDIGORON); gSaveContext.infTable[11] |= 2; this->actionFunc = func_80A3DF00; } else { @@ -276,6 +275,11 @@ void EnGm_ProcessChoiceIndex(EnGm* this, PlayState* play) { void func_80A3DF00(EnGm* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { + if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_MERCHANTS) != RO_SHUFFLE_MERCHANTS_OFF && + !Flags_GetRandomizerInf(RAND_INF_MERCHANTS_MEDIGORON)) { + Flags_SetRandomizerInf(RAND_INF_MERCHANTS_MEDIGORON); + } + this->actor.parent = NULL; this->actionFunc = func_80A3DF60; } else { @@ -284,14 +288,12 @@ void func_80A3DF00(EnGm* this, PlayState* play) { GetItemEntry itemEntry = Randomizer_GetItemFromKnownCheck(RC_GC_MEDIGORON, GI_SWORD_KNIFE); gSaveContext.pendingSale = itemEntry.itemId; GiveItemEntryFromActor(&this->actor, play, itemEntry, 415.0f, 10.0f); - Flags_SetRandomizerInf(RAND_INF_MERCHANTS_MEDIGORON); gSaveContext.infTable[11] |= 2; } else { gSaveContext.pendingSale = ItemTable_Retrieve(GI_SWORD_KNIFE).itemId; func_8002F434(&this->actor, play, GI_SWORD_KNIFE, 415.0f, 10.0f); } - } }