Make Infinite Ammo Cheat respect Progressive Bombchu Bag Capacities (#6421)

Cap infinite ammo for chus according to rando settings
Add bombchuUpgradeLevel to save editor
This commit is contained in:
Christopher Leggett 2026-03-28 02:58:41 +00:00 committed by GitHub
parent d1643aa196
commit 42ba25449e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 40 additions and 1 deletions

View file

@ -1,5 +1,6 @@
#include <libultraship/bridge.h>
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#include "soh/OTRGlobals.h"
#include "soh/ShipInit.hpp"
#include "z64save.h"
@ -24,7 +25,11 @@ void OnGameFrameUpdateInfiniteAmmo() {
AMMO(ITEM_BOW) = CUR_CAPACITY(UPG_QUIVER);
AMMO(ITEM_SLINGSHOT) = CUR_CAPACITY(UPG_BULLET_BAG);
if (INV_CONTENT(ITEM_BOMBCHU) != ITEM_NONE) {
AMMO(ITEM_BOMBCHU) = 50;
int chuCapacity = 50;
if (IS_RANDO && RAND_GET_OPTION(RSK_BOMBCHU_BAG).Is(RO_BOMBCHU_BAG_PROGRESSIVE)) {
chuCapacity = OTRGlobals::Instance->gRandoContext->GetBombchuCapacity();
}
AMMO(ITEM_BOMBCHU) = chuCapacity;
}
}

View file

@ -1,4 +1,5 @@
#include "debugSaveEditor.h"
#include "soh/Enhancements/randomizer/randomizerTypes.h"
#include "soh/util.h"
#include "soh/SohGui/ImGuiUtils.h"
#include "soh/OTRGlobals.h"
@ -1392,6 +1393,39 @@ void DrawEquipmentTab() {
"40",
};
DrawUpgrade("Deku Nut Capacity", UPG_NUTS, nutNames);
if (IS_RANDO &&
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_BOMBCHU_BAG) == RO_BOMBCHU_BAG_PROGRESSIVE) {
const std::vector<std::string> bombchuNames = {
"None",
"20",
"30",
"50",
};
ImGui::Text("%s", "Bombchu Bag Capacity");
ImGui::SameLine();
ImGui::PushID("Bombchu Bag Capacity");
PushStyleCombobox(THEME_COLOR);
ImGui::AlignTextToFramePadding();
auto value = gSaveContext.ship.quest.data.randomizer.bombchuUpgradeLevel;
auto name = value < bombchuNames.size() ? bombchuNames[value].c_str() : "Glitched";
if (ImGui::BeginCombo("##upgrade", name)) {
for (size_t i = 0; i < bombchuNames.size(); i++) {
if (ImGui::Selectable(bombchuNames[i].c_str())) {
gSaveContext.ship.quest.data.randomizer.bombchuUpgradeLevel = i;
if (i > 0) {
INV_CONTENT(ITEM_BOMBCHU) = ITEM_BOMBCHU;
} else {
INV_CONTENT(ITEM_BOMBCHU) = ITEM_NONE;
}
}
}
ImGui::EndCombo();
}
PopStyleCombobox();
ImGui::PopID();
UIWidgets::Tooltip("Bombchu Bag Capapcity");
}
}
// Draws a toggleable icon for a quest item that is faded when disabled