mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-12 20:45:07 -05:00
Save Editor Adult Trade Shuffle bugfixes:
- Having multiple items with the collapsing header open rapidly cycles trade items - Unchecking any item's checkbox cycles the trade item (it should only do so if it's the one you've selected) - Setting the adult trade slot sets the wrong items' flags - Emptying the adult trade slot doesn't reset all trade items' flags
This commit is contained in:
parent
5156ccbfd5
commit
947a97608c
@ -533,15 +533,18 @@ void DrawBGSItemFlag(uint8_t itemID) {
|
||||
ImGui::SameLine();
|
||||
int tradeIndex = itemID - ITEM_POCKET_EGG;
|
||||
bool hasItem = (gSaveContext.adultTradeItems & (1 << tradeIndex)) != 0;
|
||||
ImGui::Checkbox(("##adultTradeFlag" + std::to_string(itemID)).c_str(), &hasItem);
|
||||
if (hasItem) {
|
||||
gSaveContext.adultTradeItems |= (1 << tradeIndex);
|
||||
if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_NONE) {
|
||||
INV_CONTENT(ITEM_TRADE_ADULT) = ITEM_POCKET_EGG + tradeIndex;
|
||||
bool shouldHaveItem = hasItem;
|
||||
ImGui::Checkbox(("##adultTradeFlag" + std::to_string(itemID)).c_str(), &shouldHaveItem);
|
||||
if (hasItem != shouldHaveItem) {
|
||||
if (shouldHaveItem) {
|
||||
gSaveContext.adultTradeItems |= (1 << tradeIndex);
|
||||
if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_NONE) {
|
||||
INV_CONTENT(ITEM_TRADE_ADULT) = ITEM_POCKET_EGG + tradeIndex;
|
||||
}
|
||||
} else {
|
||||
gSaveContext.adultTradeItems &= ~(1 << tradeIndex);
|
||||
Inventory_ReplaceItem(gGlobalCtx, itemID, Randomizer_GetNextAdultTradeItem());
|
||||
}
|
||||
} else {
|
||||
gSaveContext.adultTradeItems &= ~(1 << tradeIndex);
|
||||
Inventory_ReplaceItem(gGlobalCtx, INV_CONTENT(ITEM_TRADE_ADULT), Randomizer_GetNextAdultTradeItem());
|
||||
}
|
||||
}
|
||||
|
||||
@ -586,6 +589,9 @@ void DrawInventoryTab() {
|
||||
if (ImGui::BeginPopup(itemPopupPicker)) {
|
||||
if (ImGui::Button("##itemNonePicker", ImVec2(32.0f, 32.0f))) {
|
||||
gSaveContext.inventory.items[selectedIndex] = ITEM_NONE;
|
||||
if (selectedIndex == SLOT_TRADE_ADULT) {
|
||||
gSaveContext.adultTradeItems = 0;
|
||||
}
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
SetLastItemHoverText("None");
|
||||
@ -616,17 +622,13 @@ void DrawInventoryTab() {
|
||||
if (ImGui::ImageButton(SohImGui::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f),
|
||||
ImVec2(0, 0), ImVec2(1, 1), 0)) {
|
||||
gSaveContext.inventory.items[selectedIndex] = slotEntry.id;
|
||||
// Set adult trade item flag if you're playing adult trade shuffle in rando
|
||||
// Set adult trade item flag if you're playing adult trade shuffle in rando
|
||||
if (gSaveContext.n64ddFlag &&
|
||||
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_ADULT_TRADE) &&
|
||||
selectedIndex == SLOT_TRADE_ADULT) {
|
||||
if (slotEntry.id == ITEM_NONE) {
|
||||
gSaveContext.adultTradeItems = 0;
|
||||
} else if (slotEntry.id >= ITEM_POCKET_EGG && slotEntry.id <= ITEM_CLAIM_CHECK) {
|
||||
uint32_t tradeID = slotEntry.id - ITEM_POCKET_EGG;
|
||||
gSaveContext.adultTradeItems |= tradeID;
|
||||
}
|
||||
}
|
||||
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_ADULT_TRADE);
|
||||
selectedIndex == SLOT_TRADE_ADULT &&
|
||||
slotEntry.id >= ITEM_POCKET_EGG && slotEntry.id <= ITEM_CLAIM_CHECK) {
|
||||
gSaveContext.adultTradeItems |= ADULT_TRADE_FLAG(slotEntry.id);
|
||||
}
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
SetLastItemHoverText(SohUtils::GetItemName(slotEntry.id));
|
||||
|
Loading…
Reference in New Issue
Block a user