Skip to content

Commit

Permalink
Search bar, more UX, more models
Browse files Browse the repository at this point in the history
  • Loading branch information
aMannus committed Oct 8, 2024
1 parent 6f95f94 commit 49a8daa
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 14 deletions.
47 changes: 41 additions & 6 deletions soh/soh/Enhancements/PropHunt.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,52 @@ typedef struct PropHuntProps {
Vec3f propOffset;
} PropHuntProps;

#define PROP_COUNT 7
#define PROP_COUNT 42
#define LINK_PROP_DEFAULT 0

static PropHuntProps propHuntTable[PROP_COUNT] = {
static PropHuntProps propHuntTable[] = {
{ "Link", "", { 1.0f, 1.0f, 1.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Pot", "__OTR__objects/gameplay_dangeon_keep/gPotDL", { 15.0f, 15.0f, 15.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Grass", "__OTR__objects/gameplay_field_keep/gFieldBushDL", { 45.0f, 45.0f, 45.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Rock", "__OTR__objects/gameplay_field_keep/gFieldKakeraDL", { 1.0f, 1.0f, 1.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Gravestone", "__OTR__objects/object_haka/gGravestoneStoneDL", { 1.0f, 1.0f, 1.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Royal Tomb", "__OTR__objects/object_spot02_objects/object_spot02_objects_DL_0130B0", { 1.0f, 1.0f, 1.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Crate", "__OTR__objects/object_kibako2/gLargeCrateDL", { 1.0f, 1.0f, 1.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Rock", "__OTR__objects/gameplay_field_keep/gFieldKakeraDL", { 10.0f, 10.0f, 10.0f }, { 0.0f, 58.0f, 0.0f } },
{ "Gravestone", "__OTR__objects/object_haka/gGravestoneStoneDL", { 10.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Royal Tomb", "__OTR__objects/object_spot02_objects/object_spot02_objects_DL_0130B0", { 10.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Crate", "__OTR__objects/object_kibako2/gLargeCrateDL", { 10.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Bean Seedling", "__OTR__objects/object_mamenoki/gMagicBeanSeedlingDL", { 10.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Graveyard Kid Left Foot", "__OTR__objects/object_cs/gGraveyardKidLeftFootDL", { 10.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Child Link Bottle", "__OTR__objects/object_link_child/gLinkChildBottle2DL", { 1.0f, 1.0f, 1.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Hookshot Post", "__OTR__objects/object_d_hsblock/gHookshotPostDL", { 10.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Bombwall Broken", "__OTR__objects/gameplay_field_keep/gBgBombwallBrokenDL", { 10.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Ganondorf Open Left Hand", "__OTR__objects/object_gndd/gYoungGanondorfOpenLeftHandDL", { 1.0f, 1.0f, 1.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Deku Stick", "__OTR__objects/object_link_child/gLinkChildLinkDekuStickDL", { 1.0f, 1.0f, 1.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Kak Well Arch", "__OTR__objects/object_spot01_objects/gKakarikoWellArchDL", { 10.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Lake Flower Patch", "__OTR__objects/gameplay_field_keep/gHanaDL", { 1.0f, 1.0f, 1.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Bomb", "__OTR__objects/object_gi_bomb_1/gGiBombDL", { 25.0f, 25.0f, 25.0f }, { 0.0f, 40.0f, 0.0f } },
{ "Magic Jar Large", "__OTR__objects/object_gi_magicpot/gGiMagicJarLargeDL", { 37.0f, 37.0f, 37.0f }, { 0.0f, 40.0f, 0.0f } },
{ "Water Trial Ice Block", "__OTR__objects/object_demo_kekkai/gWaterTrialIceBlockDL", { 10.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Zora Mask", "__OTR__objects/object_gi_zoramask/gGiZoraMaskDL", { 25.0f, 25.0f, 25.0f }, { 0.0f, 30.0f, 0.0f } },
{ "Volvagia Platform", "__OTR__objects/object_fd/gVolvagiaPlatformDL", { 10.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Fishing Post", "__OTR__objects/object_fish/gFishingWoodPostModelDL", { 8.0f, 8.0f, 8.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Dampe Lantern", "__OTR__objects/object_tk/gDampeLanternDL", { 1.0f, 1.0f, 1.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Gate - Other", "__OTR__objects/object_mori_objects/gMoriHashiraGateDL", { 100.0f, 100.0f, 100.0f }, { 0.0f, 0.0f, 100.0f } },
{ "Door - Dungeon", "__OTR__objects/gameplay_keep/gDungeonDoorDL", { 100.0f, 100.0f, 100.0f }, { 0.0f, 0.0f, 30.0f } },
{ "Grotto", "__OTR__objects/gameplay_field_keep/gGrottoDL", { 1.0f, 1.0f, 1.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Great Fairy - Beta", "__OTR__objects/object_dy_obj/gGreatFairyBetaDL", { 10.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Flare Dancer Platform", "__OTR__objects/object_hidan_objects/gFireTempleFlareDancerPlatformDL", { 10.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Block - Tall", "__OTR__objects/object_pu_box/gBlockTallDL", { 1.0f, 1.0f, 1.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Pocket Egg", "__OTR__objects/object_gi_egg/gGiEggDL", { 25.0f, 25.0f, 25.0f }, { 0.0f, 30.0f, 0.0f } },
{ "Carpenters' Tent", "__OTR__objects/object_spot09_obj/gCarpentersTentDL", { 10.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Door - Dodongo", "__OTR__objects/object_ddan_objects/gDodongoDoorDL", { 100.0f, 100.0f, 100.0f }, { 0.0f, 0.0f, 20.0f } },
{ "Door - Goron City", "__OTR__objects/object_spot18_obj/gGoronCityDoorDL", { 10.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 20.0f } },
{ "Ganon Castle Rubble Tall", "__OTR__objects/object_gj/gGanonsCastleRubbleTallDL", { 10.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f } },
{ "Kokiri Sword Sheath", "__OTR__objects/object_link_child/gLinkChildSwordAndSheathNearDL", { 1.0f, 1.0f, 1.0f }, { 0.0f, 200.0f, 0.0f } },
{ "Flagpole", "__OTR__objects/object_hata/gFlagpolePoleDL", { 1.5f, 1.5f, 1.5f }, { 0.0f, 0.0f, 0.0f } },
{ "Volvagia Skull", "__OTR__objects/object_fd/gVolvagiaSkullDL", { 1.0f, 1.0f, 1.0f }, { 0.0f, 3500.0f, 0.0f } },
{ "GTG Fake Wall", "__OTR__objects/object_menkuri_objects/gGTGFakeWallDL", { 10.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, -200.0f } },
{ "Fire Temple Gate", "__OTR__objects/object_hidan_objects/gFireTempleMetalFenceDL", { 10.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 250.0f } },
{ "Hookshot Target", "__OTR__objects/object_d_hsblock/gHookshotTargetDL", { 10.0f, 10.0f, 10.0f }, { 0.0f, 1390.0f, -200.0f } },
{ "Ladder One Story", "__OTR__objects/object_mori_objects/gMoriHashigoLadderDL", { 100.0f, 100.0f, 100.0f }, { 0.0f, 0.0f, -25.0f } },
{ "Kotake Head", "__OTR__objects/object_tr/gKotakeHeadDL", { 1.0f, 1.0f, 1.0f }, { 0.0f, 1000.0f, 0.0f } },
};

#endif
44 changes: 36 additions & 8 deletions soh/soh/Enhancements/game-interactor/GameInteractor_Anchor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1449,6 +1449,8 @@ void AnchorLogWindow::UpdateElement() {
}
}

char propSearchChar[64] = "";

void AnchorPropHuntWindow::DrawElement() {
ImGui::SetNextWindowViewport(ImGui::GetMainViewport()->ID);
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0, 0, 0, 0.7f));
Expand All @@ -1465,24 +1467,45 @@ void AnchorPropHuntWindow::DrawElement() {

UIWidgets::Spacer(5.0f);

if (ImGui::Button("Reset to Link", ImVec2(150.0f, 0.0f))) {
if (ImGui::Button("Reset to Link", ImVec2(120.0f, 0.0f))) {
gSaveContext.playerData.currentProp = LINK_PROP_DEFAULT;
}

UIWidgets::PaddedSeparator(true, true, 5.0f, 5.0f);

ImGui::Text("Search Props");
UIWidgets::Spacer(1.0f);
if (ImGui::InputText("##searchprops", propSearchChar, ARRAY_COUNT(propSearchChar))) {

}

UIWidgets::Spacer(5.0f);

ImGui::BeginChild("ChildPropHuntButtons", ImVec2(400.0f, 300.0f));

uint16_t visibleButtons = 0;
std::string propSearchString = propSearchChar;

for (uint16_t i = 1; i < PROP_COUNT; i++) {
if (i % 3 != 1) {
ImGui::SameLine();
}
std::string currentButtonName = propHuntTable[i].name;
std::transform(currentButtonName.begin(), currentButtonName.end(), currentButtonName.begin(), ::toupper);
std::transform(propSearchString.begin(), propSearchString.end(), propSearchString.begin(), ::toupper);
if (propSearchString.empty() || currentButtonName.find(propSearchString) != std::string::npos) {
visibleButtons++;
if (visibleButtons % 3 != 1) {
ImGui::SameLine();
}

if (propHuntTable[i].name != NULL) {
if (ImGui::Button(propHuntTable[i].name, ImVec2(120.0f, 0.0f))) {
gSaveContext.playerData.currentProp = i;
if (propHuntTable[i].name != NULL) {
if (ImGui::Button(propHuntTable[i].name, ImVec2(120.0f, 0.0f))) {
gSaveContext.playerData.currentProp = i;
}
}
}
}

ImGui::EndChild();

UIWidgets::PaddedSeparator(true, true, 5.0f, 5.0f);

ImGui::PopStyleVar(3);
Expand All @@ -1495,12 +1518,13 @@ void AnchorPropHuntWindow::DrawElement() {
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f));

UIWidgets::PaddedSeparator(true, true, 5.0f, 5.0f);
UIWidgets::Spacer(5.0f);

UIWidgets::EnhancementCheckbox("Render selected DL in DLViewer", "gPropUseDLViewer");
if (CVarGetInteger("gPropUseDLViewer", 0)) {
char* currentDL = GetActiveDisplayList();
if (currentDL != nullptr) {
UIWidgets::Spacer(5.0f);
ImGui::PushItemWidth(ImGui::GetWindowSize().x - 100.0f);
ImGui::InputText("##", currentDL, 256, ImGuiInputTextFlags_ReadOnly);
ImGui::PopItemWidth();
Expand All @@ -1515,13 +1539,17 @@ void AnchorPropHuntWindow::DrawElement() {
UIWidgets::PaddedSeparator(true, true, 5.0f, 5.0f);

UIWidgets::EnhancementInputInt("Size X: ", "gPropSizeX", 10, 100);
UIWidgets::Spacer(3.0f);
UIWidgets::EnhancementInputInt("Size Y: ", "gPropSizeY", 10, 100);
UIWidgets::Spacer(3.0f);
UIWidgets::EnhancementInputInt("Size Z: ", "gPropSizeZ", 10, 100);

UIWidgets::PaddedSeparator(true, true, 5.0f, 5.0f);

UIWidgets::EnhancementInputInt("Offset X: ", "gPropOffsetX", 10, 100);
UIWidgets::Spacer(3.0f);
UIWidgets::EnhancementInputInt("Offset Y: ", "gPropOffsetY", 10, 100);
UIWidgets::Spacer(3.0f);
UIWidgets::EnhancementInputInt("Offset Z: ", "gPropOffsetZ", 10, 100);

UIWidgets::Spacer(5.0f);
Expand Down

0 comments on commit 49a8daa

Please sign in to comment.