Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imgui 1.90.6 -> 1.91.6 #4838

Merged
merged 10 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions soh/soh/Enhancements/audio/AudioEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
#ifdef __cplusplus

#include <libultraship/libultraship.h>
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
#include <imgui.h>
#include "AudioCollection.h"

Expand Down
3 changes: 0 additions & 3 deletions soh/soh/Enhancements/controls/InputViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
#include "Context.h"
#include "soh/OTRGlobals.h"
#include "soh/cvar_prefixes.h"
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
#include <imgui.h>
#include <spdlog/spdlog.h>
#include <cmath>
Expand Down
3 changes: 0 additions & 3 deletions soh/soh/Enhancements/controls/SohInputEditorWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

#include "stdint.h"
#include <libultraship/libultraship.h>
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
#include <imgui.h>
#include <unordered_map>
#include <string>
Expand Down
3 changes: 0 additions & 3 deletions soh/soh/Enhancements/debugconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@

#include <Window.h>
#include <Context.h>
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
#include <imgui.h>
#include <imgui_internal.h>
#undef PATH_HACK
Expand Down
56 changes: 40 additions & 16 deletions soh/soh/Enhancements/debugger/debugSaveEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,11 @@ void DrawInventoryTab() {
uint8_t item = gSaveContext.inventory.items[index];
if (item != ITEM_NONE) {
const ItemMapEntry& slotEntry = itemMapping.find(item)->second;
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0),
ImVec2(1, 1), 0)) {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
auto ret = ImGui::ImageButton(slotEntry.name.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1));
ImGui::PopStyleVar();
if (ret) {
selectedIndex = index;
ImGui::OpenPopup(itemPopupPicker);
}
Expand Down Expand Up @@ -503,8 +506,11 @@ void DrawInventoryTab() {
ImGui::SameLine();
}
const ItemMapEntry& slotEntry = possibleItems[pickerIndex];
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f),
ImVec2(0, 0), ImVec2(1, 1), 0)) {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
auto ret = ImGui::ImageButton(slotEntry.name.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1));
ImGui::PopStyleVar();
if (ret) {
gSaveContext.inventory.items[selectedIndex] = slotEntry.id;
// Set adult trade item flag if you're playing adult trade shuffle in rando
if (IS_RANDO &&
Expand Down Expand Up @@ -986,8 +992,11 @@ void DrawUpgradeIcon(const std::string& categoryName, int32_t categoryId, const
uint8_t item = items[CUR_UPG_VALUE(categoryId)];
if (item != ITEM_NONE) {
const ItemMapEntry& slotEntry = itemMapping[item];
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0),
ImVec2(1, 1), 0)) {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
auto ret = ImGui::ImageButton(slotEntry.name.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1));
ImGui::PopStyleVar();
if (ret) {
ImGui::OpenPopup(upgradePopupPicker);
}
} else {
Expand All @@ -1014,8 +1023,11 @@ void DrawUpgradeIcon(const std::string& categoryName, int32_t categoryId, const
UIWidgets::SetLastItemHoverText("None");
} else {
const ItemMapEntry& slotEntry = itemMapping[items[pickerIndex]];
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0),
ImVec2(1, 1), 0)) {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
auto ret = ImGui::ImageButton(slotEntry.name.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1));
ImGui::PopStyleVar();
if (ret) {
Inventory_ChangeUpgrade(categoryId, pickerIndex);
ImGui::CloseCurrentPopup();
}
Expand Down Expand Up @@ -1051,8 +1063,11 @@ void DrawEquipmentTab() {
bool hasEquip = (bitMask & gSaveContext.inventory.equipment) != 0;
const ItemMapEntry& entry = itemMapping[equipmentValues[i]];
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasEquip ? entry.name : entry.nameFaded),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
auto ret = ImGui::ImageButton(entry.name.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasEquip ? entry.name : entry.nameFaded),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1));
ImGui::PopStyleVar();
if (ret) {
if (hasEquip) {
gSaveContext.inventory.equipment &= ~bitMask;
} else {
Expand Down Expand Up @@ -1150,8 +1165,11 @@ void DrawQuestItemButton(uint32_t item) {
uint32_t bitMask = 1 << entry.id;
bool hasQuestItem = (bitMask & gSaveContext.inventory.questItems) != 0;
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
auto ret = ImGui::ImageButton(entry.name.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1));
ImGui::PopStyleVar();
if (ret) {
if (hasQuestItem) {
gSaveContext.inventory.questItems &= ~bitMask;
} else {
Expand All @@ -1168,8 +1186,11 @@ void DrawDungeonItemButton(uint32_t item, uint32_t scene) {
uint32_t bitMask = 1 << (entry.id - ITEM_KEY_BOSS); // Bitset starts at ITEM_KEY_BOSS == 0. the rest are sequential
bool hasItem = (bitMask & gSaveContext.inventory.dungeonItems[scene]) != 0;
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem ? entry.name : entry.nameFaded),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
auto ret = ImGui::ImageButton(entry.name.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem ? entry.name : entry.nameFaded),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1));
ImGui::PopStyleVar();
if (ret) {
if (hasItem) {
gSaveContext.inventory.dungeonItems[scene] &= ~bitMask;
} else {
Expand Down Expand Up @@ -1215,8 +1236,11 @@ void DrawQuestStatusTab() {
uint32_t bitMask = 1 << entry.id;
bool hasQuestItem = (bitMask & gSaveContext.inventory.questItems) != 0;
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded),
ImVec2(16.0f, 24.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
auto ret = ImGui::ImageButton(entry.name.c_str(), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded),
ImVec2(16.0f, 24.0f), ImVec2(0, 0), ImVec2(1, 1));
ImGui::PopStyleVar();
if (ret) {
if (hasQuestItem) {
gSaveContext.inventory.questItems &= ~bitMask;
} else {
Expand Down
56 changes: 40 additions & 16 deletions soh/soh/Enhancements/randomizer/Plandomizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -715,15 +715,18 @@ void PlandomizerDrawItemPopup(uint32_t index) {
ImGui::PushID(item);
ImGui::TableNextColumn();
PlandomizerItemImageCorrection(plandomizerRandoRetrieveItem(item));
if (ImGui::ImageButton(textureID,
imageSize, textureUV0, textureUV1, imagePadding, ImVec4(0, 0, 0, 0), itemColor)) {
auto name = plandomizerRandoRetrieveItem(item).GetName().english;
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(imagePadding, imagePadding));
auto ret = ImGui::ImageButton(name.c_str(), textureID, imageSize, textureUV0, textureUV1, ImVec4(0, 0, 0, 0), itemColor);
ImGui::PopStyleVar();
if (ret) {
if (std::find(infiniteItemList.begin(), infiniteItemList.end(), plandoLogData[index].checkRewardItem.GetRandomizerGet()) == infiniteItemList.end()) {
PlandomizerAddToItemList(plandoLogData[index].checkRewardItem);
}
plandoLogData[index].checkRewardItem = plandomizerRandoRetrieveItem(item);
ImGui::CloseCurrentPopup();
}
UIWidgets::Tooltip(plandomizerRandoRetrieveItem(item).GetName().english.c_str());
UIWidgets::Tooltip(name.c_str());
PlandomizerOverlayText(std::make_pair(plandomizerRandoRetrieveItem(item), 1));
ImGui::PopID();
}
Expand All @@ -741,8 +744,11 @@ void PlandomizerDrawItemPopup(uint32_t index) {
ImGui::PushID(itemIndex);
auto itemToDraw = drawSlots.first;
PlandomizerItemImageCorrection(drawSlots.first);
if (ImGui::ImageButton(textureID,
imageSize, textureUV0, textureUV1, imagePadding, ImVec4(0, 0, 0, 0), itemColor)) {
auto name = drawSlots.first.GetName().english;
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(imagePadding, imagePadding));
auto ret = ImGui::ImageButton(name.c_str(), textureID, imageSize, textureUV0, textureUV1, ImVec4(0, 0, 0, 0), itemColor);
ImGui::PopStyleVar();
if (ret) {
if (itemToDraw.GetRandomizerGet() >= RG_PROGRESSIVE_HOOKSHOT &&
itemToDraw.GetRandomizerGet() <= RG_PROGRESSIVE_GORONSWORD) {
plandoLogData[index].checkRewardItem = drawSlots.first;
Expand All @@ -757,7 +763,7 @@ void PlandomizerDrawItemPopup(uint32_t index) {
ImGui::CloseCurrentPopup();
}
if (!isClicked) {
UIWidgets::Tooltip(drawSlots.first.GetName().english.c_str());
UIWidgets::Tooltip(name.c_str());
}
ImGui::PopID();

Expand Down Expand Up @@ -786,12 +792,16 @@ void PlandomizerDrawIceTrapPopUp(uint32_t index) {
}
ImGui::TableNextColumn();
ImGui::PushID(items.first);
auto name = Rando::StaticData::RetrieveItem(items.first).GetName().english;
PlandomizerItemImageCorrection(Rando::StaticData::RetrieveItem(items.first));
if (ImGui::ImageButton(textureID, imageSize, textureUV0, textureUV1, imagePadding, ImVec4(0, 0, 0, 0), itemColor)) {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(imagePadding, imagePadding));
auto ret = ImGui::ImageButton(name.c_str(), textureID, imageSize, textureUV0, textureUV1, ImVec4(0, 0, 0, 0), itemColor);
ImGui::PopStyleVar();
if (ret) {
plandoLogData[index].iceTrapModel = Rando::StaticData::RetrieveItem(items.first);
ImGui::CloseCurrentPopup();
};
UIWidgets::Tooltip(Rando::StaticData::RetrieveItem(items.first).GetName().english.c_str());
UIWidgets::Tooltip(name.c_str());

auto itemObject = Rando::StaticData::RetrieveItem(items.first);
PlandomizerOverlayText(std::make_pair(itemObject, 1));
Expand All @@ -808,13 +818,17 @@ void PlandomizerDrawItemSlots(uint32_t index) {
ImGui::PushID(index);
PlandoPushImageButtonStyle();
PlandomizerItemImageCorrection(plandoLogData[index].checkRewardItem);
if (ImGui::ImageButton(textureID, imageSize, textureUV0, textureUV1, imagePadding, ImVec4(0, 0, 0, 0), itemColor)) {
auto name = plandoLogData[index].checkRewardItem.GetName().english;
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(imagePadding, imagePadding));
auto ret = ImGui::ImageButton(name.c_str(), textureID, imageSize, textureUV0, textureUV1, ImVec4(0, 0, 0, 0), itemColor);
ImGui::PopStyleVar();
if (ret) {
shouldPopup = true;
temporaryItem = plandoLogData[index].checkRewardItem;
ImGui::OpenPopup("ItemList");
};
PlandoPopImageButtonStyle();
UIWidgets::Tooltip(plandoLogData[index].checkRewardItem.GetName().english.c_str());
UIWidgets::Tooltip(name.c_str());
PlandomizerOverlayText(std::make_pair(plandoLogData[index].checkRewardItem, 1));
PlandomizerDrawItemPopup(index);
ImGui::PopID();
Expand Down Expand Up @@ -852,12 +866,16 @@ void PlandomizerDrawIceTrapSetup(uint32_t index) {
ImGui::TableNextColumn();
PlandomizerItemImageCorrection(plandoLogData[index].iceTrapModel);
PlandoPushImageButtonStyle();
if (ImGui::ImageButton(textureID, imageSize, textureUV0, textureUV1, imagePadding, ImVec4(0, 0, 0, 0), itemColor)) {
auto name = plandoLogData[index].iceTrapModel.GetName().english;
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(imagePadding, imagePadding));
auto ret = ImGui::ImageButton(name.c_str(), textureID, imageSize, textureUV0, textureUV1, ImVec4(0, 0, 0, 0), itemColor);
ImGui::PopStyleVar();
if (ret) {
shouldTrapPopup = true;
ImGui::OpenPopup("TrapList");
};
PlandoPopImageButtonStyle();
UIWidgets::Tooltip(plandoLogData[index].iceTrapModel.GetName().english.c_str());
UIWidgets::Tooltip(name.c_str());
PlandomizerDrawIceTrapPopUp(index);
ImGui::SameLine();
ImGui::TableNextColumn();
Expand Down Expand Up @@ -934,8 +952,11 @@ void PlandomizerDrawOptions() {
for (auto& hash : plandoHash) {
ImGui::PushID(index);
textureID = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(gSeedTextures[hash].tex);
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("HASH_ARROW_UP"),
ImVec2(35.0f, 18.0f), ImVec2(1, 1), ImVec2(0, 0), 2.0f, ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2.0f, 2.0f));
auto upRet = ImGui::ImageButton("HASH_ARROW_UP", Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("HASH_ARROW_UP"),
ImVec2(35.0f, 18.0f), ImVec2(1, 1), ImVec2(0, 0), ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1));
ImGui::PopStyleVar();
if (upRet) {
if (hash + 1 >= gSeedTextures.size()) {
hash = 0;
}
Expand All @@ -944,8 +965,11 @@ void PlandomizerDrawOptions() {
}
}
ImGui::Image(textureID, ImVec2(35.0f, 35.0f));
if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("HASH_ARROW_DWN"),
ImVec2(35.0f, 18.0f), ImVec2(0, 0), ImVec2(1, 1), 2.0f, ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2.0f, 2.0f));
auto downRet = ImGui::ImageButton("HASH_ARROW_DWN", Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("HASH_ARROW_DWN"),
ImVec2(35.0f, 18.0f), ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1));
ImGui::PopStyleVar();
if (downRet) {
if (hash == 0) {
hash = gSeedTextures.size() - 1;
}
Expand Down
3 changes: 0 additions & 3 deletions soh/soh/Enhancements/randomizer/randomizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
#include "soh/UIWidgets.hpp"
#include "3drando/custom_messages.hpp"
#include "../../UIWidgets.hpp"
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
#include <imgui.h>
#include <imgui_internal.h>
#include "../custom-message/CustomMessageTypes.h"
Expand Down
Loading