Add equipment selection for sword, shield, and armor in save file generation

This commit is contained in:
scawful
2025-01-19 02:24:36 -05:00
parent 5523ffb3c7
commit e6a37970a0

View File

@@ -132,9 +132,6 @@ void GenerateSaveFileComponent(ftxui::ScreenInteractive &screen) {
"Magic Powder", "Magic Powder",
"Fire Rod", "Fire Rod",
"Ice Rod", "Ice Rod",
"Bombos",
"Ether",
"Quake",
"Lantern", "Lantern",
"Hammer", "Hammer",
"Shovel", "Shovel",
@@ -146,27 +143,46 @@ void GenerateSaveFileComponent(ftxui::ScreenInteractive &screen) {
"Magic Cape", "Magic Cape",
"Magic Mirror", "Magic Mirror",
"Pegasus Boots", "Pegasus Boots",
"Power Glove",
"Titan's Mitt",
"Flippers", "Flippers",
"Moon Pearl", "Moon Pearl",
"Sword", "Bottle 1",
"Shield", "Bottle 2",
"Mail", "Bottle 3",
"Bottle", "Bottle 4"};
"Heart Container",
"Piece of Heart",
"Rupee",
"Bomb",
"Arrow"};
std::array<bool, 35> values = {};
constexpr size_t kNumItems = 28;
std::array<bool, kNumItems> values = {};
auto checkboxes = Container::Vertical({}); auto checkboxes = Container::Vertical({});
for (size_t i = 0; i < items.size(); ++i) { for (size_t i = 0; i < items.size(); i += 4) {
checkboxes->Add(Checkbox(items[i].data(), &values[i])); auto row = Container::Horizontal({});
for (size_t j = 0; j < 4 && (i + j) < items.size(); ++j) {
row->Add(Checkbox(absl::StrCat(items[i + j], " ").data(), &values[i + j]));
}
checkboxes->Add(row);
} }
// border container for sword, shield, armor with radioboxes
// to select the current item
// sword, shield, armor
static int sword = 0;
static int shield = 0;
static int armor = 0;
const std::vector<std::string> sword_items = {"Fighter", "Master", "Tempered",
"Golden"};
const std::vector<std::string> shield_items = {"Small", "Fire", "Mirror"};
const std::vector<std::string> armor_items = {"Green", "Blue", "Red"};
auto sword_radiobox = Radiobox(&sword_items, &sword);
auto shield_radiobox = Radiobox(&shield_items, &shield);
auto armor_radiobox = Radiobox(&armor_items, &armor);
auto equipment_container = Container::Vertical({
sword_radiobox,
shield_radiobox,
armor_radiobox,
});
auto save_button = Button("Generate Save File", [&] { auto save_button = Button("Generate Save File", [&] {
// Generate the save file here. // Generate the save file here.
// You can use the values vector to determine which items are checked. // You can use the values vector to determine which items are checked.
@@ -179,6 +195,7 @@ void GenerateSaveFileComponent(ftxui::ScreenInteractive &screen) {
auto container = Container::Vertical({ auto container = Container::Vertical({
checkboxes, checkboxes,
equipment_container,
save_button, save_button,
back_button, back_button,
}); });
@@ -187,6 +204,7 @@ void GenerateSaveFileComponent(ftxui::ScreenInteractive &screen) {
return vbox({text("Generate Save File") | center, separator(), return vbox({text("Generate Save File") | center, separator(),
text("Select items to include in the save file:"), text("Select items to include in the save file:"),
checkboxes->Render(), separator(), checkboxes->Render(), separator(),
equipment_container->Render(), separator(),
hbox({ hbox({
save_button->Render() | center, save_button->Render() | center,
separator(), separator(),
@@ -324,8 +342,10 @@ void PaletteEditorComponent(ftxui::ScreenInteractive &screen) {
}); });
auto palette_editor_renderer = Renderer(palette_editor_container, [&] { auto palette_editor_renderer = Renderer(palette_editor_container, [&] {
return vbox({text("Palette Editor") | center, separator(), return vbox({text(gfx::kPaletteCategoryNames[selected_palette_group]
palette_grid->Render(), separator(), .data()) |
center,
separator(), palette_grid->Render(), separator(),
hbox({ hbox({
save_button->Render() | center, save_button->Render() | center,
separator(), separator(),