summaryrefslogtreecommitdiff
path: root/mm/2s2h/DeveloperTools/SaveEditor.cpp
diff options
context:
space:
mode:
authorlouist103 <35883445+louist103@users.noreply.github.com>2024-04-07 18:54:01 -0400
committerGarrett Cox <garrettjcox@gmail.com>2024-05-22 09:05:01 -0500
commitdbdbfc738d66685ccf349c5febbd58b941bd880d (patch)
tree697bdb46edfac1ded6401aba9c2f96b716c70aa0 /mm/2s2h/DeveloperTools/SaveEditor.cpp
parent9bf84e306ca2d1f00c4e866cd1b150287310d3bb (diff)
Add rupees to the save editor (#173)
* Add rupee editor to save editor * Remove static
Diffstat (limited to 'mm/2s2h/DeveloperTools/SaveEditor.cpp')
-rw-r--r--mm/2s2h/DeveloperTools/SaveEditor.cpp36
1 files changed, 23 insertions, 13 deletions
diff --git a/mm/2s2h/DeveloperTools/SaveEditor.cpp b/mm/2s2h/DeveloperTools/SaveEditor.cpp
index a3c7663e9..41ac5112a 100644
--- a/mm/2s2h/DeveloperTools/SaveEditor.cpp
+++ b/mm/2s2h/DeveloperTools/SaveEditor.cpp
@@ -13,19 +13,19 @@ extern RegEditor* gRegEditor;
}
bool safeMode = true;
-const float INV_GRID_WIDTH = 46.0f;
-const float INV_GRID_HEIGHT = 58.0f;
-const float INV_GRID_ICON_SIZE = 40.0f;
-const float INV_GRID_PADDING = 10.0f;
-const float INV_GRID_TOP_MARGIN = 20.0f;
-const uint16_t HEART_COUNT_MIN = 3;
-const uint16_t HEART_COUNT_MAX = 20;
-const int16_t S16_ZERO = 0;
-const int8_t S8_ZERO = 0;
-const u8 REG_PAGES_MAX = REG_PAGES;
-const u8 REG_GROUPS_MAX = REG_GROUPS - 1;
+constexpr float INV_GRID_WIDTH = 46.0f;
+constexpr float INV_GRID_HEIGHT = 58.0f;
+constexpr float INV_GRID_ICON_SIZE = 40.0f;
+constexpr float INV_GRID_PADDING = 10.0f;
+constexpr float INV_GRID_TOP_MARGIN = 20.0f;
+constexpr uint16_t HEART_COUNT_MIN = 3;
+constexpr uint16_t HEART_COUNT_MAX = 20;
+constexpr int16_t S16_ZERO = 0;
+constexpr int8_t S8_ZERO = 0;
+constexpr u8 REG_PAGES_MAX = REG_PAGES;
+constexpr u8 REG_GROUPS_MAX = REG_GROUPS - 1;
const char* MAGIC_LEVEL_NAMES[3] = { "No Magic", "Single Magic", "Double Magic" };
-const int8_t MAGIC_LEVEL_MAX = 2;
+constexpr int8_t MAGIC_LEVEL_MAX = 2;
InventorySlot selectedInventorySlot = SLOT_NONE;
std::vector<ItemId> safeItemsForInventorySlot[SLOT_MASK_FIERCE_DEITY + 1] = {};
@@ -281,7 +281,7 @@ void DrawEquipItemMenu(InventorySlot slot) {
void NextItemInSlot(InventorySlot slot) {
ItemId currentItemId = static_cast<ItemId>(gSaveContext.save.saveInfo.inventory.items[slot]);
- int currentItemIndex = find(safeItemsForInventorySlot[slot].begin(), safeItemsForInventorySlot[slot].end(), currentItemId) - safeItemsForInventorySlot[slot].begin();
+ size_t currentItemIndex = find(safeItemsForInventorySlot[slot].begin(), safeItemsForInventorySlot[slot].end(), currentItemId) - safeItemsForInventorySlot[slot].begin();
if (currentItemId == ITEM_NONE) {
gSaveContext.save.saveInfo.inventory.items[slot] = safeItemsForInventorySlot[slot][0];
@@ -418,6 +418,16 @@ void DrawItemsAndMasksTab() {
}
}
UIWidgets::Checkbox("Safe Mode", &safeMode);
+ char text[4];
+ snprintf(text, sizeof(text), "%d", gSaveContext.save.saveInfo.playerData.rupees);
+
+ // Make the input box slightly larger than 3 digits
+ ImGui::SetNextItemWidth(ImGui::CalcTextSize(" ").x);
+ ImGui::InputText("Rupees", text, sizeof(text),
+ ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_CharsNoBlank |
+ ImGuiInputTextFlags_AutoSelectAll);
+ gSaveContext.save.saveInfo.playerData.rupees = atoi(text);
+
// Expose inputs to edit raw number values of equips
// ImGui::Text("Equips");
// ImGui::Text("C-Buttons");