fix upgrades one more time

This commit is contained in:
Asuro
2025-05-10 18:12:15 +02:00
parent 5d1db591b7
commit 1616704c50
19 changed files with 210 additions and 104 deletions

View File

@@ -50,12 +50,12 @@ namespace Tools
return changed;
}
bool ModelDropdown(Gen::ModelHandle& modelHandle)
bool ModelDropdown(Gen::ModelHandle& modelHandle, const char* name)
{
bool changed = false;
auto& R = Game::GameRendering::Get();
const char* name = GetAssetPath(modelHandle.Asset);
if (ImGui::BeginCombo("Model", name))
const char* assetName = GetAssetPath(modelHandle.Asset);
if (ImGui::BeginCombo(name, assetName))
{
for (int32_t i = 0; i < R.ModelCount; ++i)
{
@@ -360,34 +360,15 @@ namespace Tools
ImGui::End();
if (ImGui::Begin("Puzzles"))
{
if (ImGui::Button("Add"))
{
bool found = false;
for (int32_t i = 0; i < BX_COUNTOF(level.Puzzles); ++i)
{
auto& puz = level.Puzzles[i].Data;
if (puz.ID == UINT16_MAX)
{
bx::strCopy(puz.PuzzleName, sizeof(puz.PuzzleName), "Unnamed Puzzle");
puz.ID = i;
found = true;
break;
}
}
if (!found)
{
LOG_ERROR("Too many puzzles!");
}
}
ImGui::Separator();
char nameBuf[64]{0};
for (int32_t i = 0; i < BX_COUNTOF(level.Puzzles); ++i)
{
auto& puzzleData = level.Puzzles[i].Data;
if (puzzleData.ID == UINT16_MAX) continue;
bool isSelected = debug.SelectedDebugLevel == i;
ImGui::PushID("selectable");
if (ImGui::Selectable(puzzleData.PuzzleName, isSelected))
bx::snprintf(nameBuf, sizeof(nameBuf), "%u: %s", i, puzzleData.PuzzleName);
if (ImGui::Selectable(nameBuf, isSelected))
{
debug.SelectedDebugLevel = isSelected ? UINT16_MAX : i;
}
@@ -438,8 +419,19 @@ namespace Tools
ImGui::EndDragDropSource();
}
Tools::ModelDropdown(card.ModelHandle);
Tools::ModelDropdown(card.BaseModelHandle);
Tools::TextureDropdown(card.BoardTextureHandle);
if (ImGui::TreeNodeEx("Covers"))
{
Tools::ModelDropdown(card.NorthCoverHandle, "North Cover");
Tools::ModelDropdown(card.EastCoverHandle, "East Cover");
Tools::ModelDropdown(card.SouthCoverHandle, "South Cover");
Tools::ModelDropdown(card.WestCoverHandle, "West Cover");
ImGui::TreePop();
}
ImGui::Text("Card");
for (int8_t y = 0; y < Puzzle::Config::CardSize; ++y)
{
ImGui::PushID(y);