Only show adult trade items in the save editor if they're shuffled

This commit is contained in:
lilDavid 2022-08-06 12:56:29 -05:00
parent 6603a9a474
commit f41b939a71
2 changed files with 10 additions and 8 deletions

View File

@ -1,5 +1,6 @@
#include "debugSaveEditor.h"
#include "../../util.h"
#include "../../OTRGlobals.h"
#include "../libultraship/ImGuiImpl.h"
#include "ImGuiHelpers.h"
@ -648,8 +649,9 @@ void DrawInventoryTab() {
}
// Trade quest flags are only used when shuffling the trade sequence, so
// this is only necessary when that's enabled.
if (gSaveContext.n64ddFlag && ImGui::TreeNode("Adult trade quest items")) {
// don't show this if it isn't needed.
if (gSaveContext.n64ddFlag && OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_ADULT_TRADE)
&& ImGui::TreeNode("Adult trade quest items")) {
for (int i = ITEM_POCKET_EGG; i <= ITEM_CLAIM_CHECK; i++) {
DrawBGSItemFlag(i);
}

View File

@ -13,10 +13,10 @@ void Randomizer_ConsumeAdultTradeItem(GlobalContext* globalCtx, u8 itemId) {
}
u8 Randomizer_GetNextAdultTradeItem() {
const u16 numTradeItems = ITEM_CLAIM_CHECK - ITEM_POCKET_EGG + 1;
u16 currentTradeItemIndex = INV_CONTENT(ITEM_TRADE_ADULT) - ITEM_POCKET_EGG;
const u8 numTradeItems = ITEM_CLAIM_CHECK - ITEM_POCKET_EGG + 1;
u8 currentTradeItemIndex = INV_CONTENT(ITEM_TRADE_ADULT) - ITEM_POCKET_EGG;
for (int i = 0; i < numTradeItems; i++) {
u16 tradeIndex = (currentTradeItemIndex + i + 1) % numTradeItems;
u8 tradeIndex = (currentTradeItemIndex + i + 1) % numTradeItems;
if (gSaveContext.adultTradeItems & (1 << tradeIndex)) {
return ITEM_POCKET_EGG + tradeIndex;
}
@ -24,10 +24,10 @@ u8 Randomizer_GetNextAdultTradeItem() {
}
u8 Randomizer_GetPrevAdultTradeItem() {
const u16 numTradeItems = ITEM_CLAIM_CHECK - ITEM_POCKET_EGG + 1;
u16 currentTradeItemIndex = INV_CONTENT(ITEM_TRADE_ADULT) - ITEM_POCKET_EGG;
const u8 numTradeItems = ITEM_CLAIM_CHECK - ITEM_POCKET_EGG + 1;
u8 currentTradeItemIndex = INV_CONTENT(ITEM_TRADE_ADULT) - ITEM_POCKET_EGG;
for (int i = 0; i < numTradeItems; i++) {
u16 tradeIndex = (currentTradeItemIndex - i - 1 + numTradeItems) % numTradeItems;
u8 tradeIndex = (currentTradeItemIndex - i - 1 + numTradeItems) % numTradeItems;
if (gSaveContext.adultTradeItems & (1 << tradeIndex)) {
return ITEM_POCKET_EGG + tradeIndex;
}