From 3019a26d29278eda3df743e8c6e7a5b7f453fd13 Mon Sep 17 00:00:00 2001 From: Tony Jih Date: Tue, 2 Jan 2024 22:30:26 +0800 Subject: [PATCH 1/2] True match GoronMerchantShopManager_Main --- src/manager/goronMerchantShopManager.c | 60 +++++++++++++------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/src/manager/goronMerchantShopManager.c b/src/manager/goronMerchantShopManager.c index c2493c998..9bb9dca7e 100644 --- a/src/manager/goronMerchantShopManager.c +++ b/src/manager/goronMerchantShopManager.c @@ -19,41 +19,43 @@ typedef struct { u16 y; } GoronShopSpawnData; +inline static void CheckGoronKakera() { + if (CheckGlobalFlag(GORON_KAKERA_L) == 0 || CheckGlobalFlag(GORON_KAKERA_M) == 0 || + CheckGlobalFlag(GORON_KAKERA_R) == 0) + return; + + if (CheckGlobalFlag(GORON_KAKERA_LV2) == 0) { + if (CheckGlobalFlag(LV1_CLEAR) == 0) + return; + SetGlobalFlag(GORON_KAKERA_LV2); + } else if (CheckGlobalFlag(GORON_KAKERA_LV3) == 0) { + if (CheckGlobalFlag(LV2_CLEAR) == 0) + return; + SetGlobalFlag(GORON_KAKERA_LV3); + } else if (CheckGlobalFlag(GORON_KAKERA_LV4) == 0) { + if (CheckGlobalFlag(LV3_CLEAR) == 0) + return; + SetGlobalFlag(GORON_KAKERA_LV4); + } else if (CheckGlobalFlag(GORON_KAKERA_LV5) == 0) { + if (CheckGlobalFlag(LV4_CLEAR) == 0) + return; + SetGlobalFlag(GORON_KAKERA_LV5); + } else + return; + ClearGlobalFlag(GORON_KAKERA_L); + ClearGlobalFlag(GORON_KAKERA_M); + ClearGlobalFlag(GORON_KAKERA_R); + return; +} + void GoronMerchantShopManager_Main(GoronMerchantShopManager* this) { - static const GoronShopSpawnData shopSpawnData[3] = { { 0x6e, 0x3, 0x210, 0x210 }, - { 0x71, 0x2, 0x220, 0x210 }, - { 0x73, 0x3, 0x230, 0x210 } }; - s32 uVar2; + const GoronShopSpawnData* spawnData; s32 count; if (super->action == 0) { super->action++; - if (CheckGlobalFlag(GORON_KAKERA_L) != 0 && CheckGlobalFlag(GORON_KAKERA_M) != 0 && - CheckGlobalFlag(GORON_KAKERA_R) != 0) { - if (CheckGlobalFlag(GORON_KAKERA_LV2) == 0) { - if (CheckGlobalFlag(LV1_CLEAR) != 0) { - SetGlobalFlag(GORON_KAKERA_LV2); - goto clearGlobalFlags; - } - } else if (CheckGlobalFlag(GORON_KAKERA_LV3) == 0) { - if (CheckGlobalFlag(LV2_CLEAR) != 0) { - SetGlobalFlag(GORON_KAKERA_LV3); - goto clearGlobalFlags; - } - } else if (CheckGlobalFlag(GORON_KAKERA_LV4) == 0) { - if (CheckGlobalFlag(LV3_CLEAR) != 0) { - SetGlobalFlag(GORON_KAKERA_LV4); - goto clearGlobalFlags; - } - } else if (CheckGlobalFlag(GORON_KAKERA_LV5) == 0 && CheckGlobalFlag(LV4_CLEAR) != 0) { - SetGlobalFlag(GORON_KAKERA_LV5); - clearGlobalFlags: - ClearGlobalFlag(GORON_KAKERA_L); - ClearGlobalFlag(GORON_KAKERA_M); - ClearGlobalFlag(GORON_KAKERA_R); - } - } + CheckGoronKakera(); this->itemActive[2] = 0; this->itemActive[1] = 0; this->itemActive[0] = 0; From 88338832f9403cc6a7e510b56caada70bbac3bc9 Mon Sep 17 00:00:00 2001 From: Tony Jih Date: Wed, 3 Jan 2024 16:11:40 +0800 Subject: [PATCH 2/2] Bring back shopSpawnData --- src/manager/goronMerchantShopManager.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/manager/goronMerchantShopManager.c b/src/manager/goronMerchantShopManager.c index 9bb9dca7e..ff1d1b561 100644 --- a/src/manager/goronMerchantShopManager.c +++ b/src/manager/goronMerchantShopManager.c @@ -49,7 +49,9 @@ inline static void CheckGoronKakera() { } void GoronMerchantShopManager_Main(GoronMerchantShopManager* this) { - + static const GoronShopSpawnData shopSpawnData[3] = { { 0x6e, 0x3, 0x210, 0x210 }, + { 0x71, 0x2, 0x220, 0x210 }, + { 0x73, 0x3, 0x230, 0x210 } }; const GoronShopSpawnData* spawnData; s32 count;