Skip to content

Commit

Permalink
Add Boss Soul Icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Caladius committed Nov 10, 2024
1 parent 53f9633 commit a282c67
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions soh/soh/Enhancements/randomizer/Plandomizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <vector>
#include "include/z64item.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#include <soh_assets.h>

#include <fstream>
#include <filesystem>
Expand Down Expand Up @@ -66,6 +67,19 @@ std::unordered_map<RandomizerGet, std::string> bossKeyShortNames = {
{ RG_GANONS_CASTLE_BOSS_KEY, "Ganon" },
};

std::map<RandomizerGet, ImVec4> bossSoulMapping = {
{ RG_GOHMA_SOUL, { 0.00f, 1.00f, 0.00f, 1.0f } },
{ RG_KING_DODONGO_SOUL, { 1.00f, 0.00f, 0.39f, 1.0f } },
{ RG_BARINADE_SOUL, { 0.20f, 1.00f, 1.00f, 1.0f } },
{ RG_PHANTOM_GANON_SOUL, { 0.02f, 0.76f, 0.18f, 1.0f } },
{ RG_VOLVAGIA_SOUL, { 0.93f, 0.37f, 0.37f, 1.0f } },
{ RG_MORPHA_SOUL, { 0.33f, 0.71f, 0.87f, 1.0f } },
{ RG_BONGO_BONGO_SOUL, { 0.49f, 0.06f, 0.69f, 1.0f } },
{ RG_TWINROVA_SOUL, { 0.87f, 0.62f, 0.18f, 1.0f } },
{ RG_GANON_SOUL, { 0.31f, 0.31f, 0.31f, 1.0f } }
};


std::vector<RandomizerGet> infiniteItemList = {
RG_GREEN_RUPEE, RG_BLUE_RUPEE, RG_RED_RUPEE, RG_PURPLE_RUPEE, RG_HUGE_RUPEE,
RG_ARROWS_5, RG_ARROWS_10, RG_ARROWS_30,
Expand Down Expand Up @@ -318,6 +332,10 @@ ImVec4 plandomizerGetItemColor(Rando::Item randoItem) {
}
return itemColor;
}

if (randoItem.GetRandomizerGet() >= RG_GOHMA_SOUL && randoItem.GetRandomizerGet() <= RG_GANON_SOUL) {
itemColor = bossSoulMapping.at(randoItem.GetRandomizerGet());
}

return itemColor;
}
Expand All @@ -334,6 +352,16 @@ std::string plandomizerHintsTooltip() {
return hintTootip;
}

std::string extractNumberInParentheses(const std::string& text) {
size_t start = text.find('(');
size_t end = text.find(')');

if (start != std::string::npos && end != std::string::npos && start < end) {
return text.substr(start + 1, end - start - 1);
}
return "";
}

void PlandomizerPopulateSeedList() {
existingSeedList.clear();

Expand Down Expand Up @@ -375,6 +403,10 @@ void PlandomizerItemImageCorrection(Rando::Item randoItem) {
}
}

if (randoItem.GetRandomizerGet() >= RG_GOHMA_SOUL && randoItem.GetRandomizerGet() <= RG_GANON_SOUL) {
textureID = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Boss Soul");
}

if (textureID == 0) {
textureID = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(itemMapping[randoItem.GetGIEntry()->itemId].name);
}
Expand Down Expand Up @@ -616,6 +648,15 @@ void PlandomizerOverlayText(std::pair<Rando::Item, uint32_t> drawObject ) {
ImGui::SetCursorScreenPos(textPos);
ImGui::Text("+");
}
if (extractNumberInParentheses(drawObject.first.GetName().english.c_str()) != "" &&
extractNumberInParentheses(drawObject.first.GetName().english.c_str()) != "WINNER") {
textPos = ImVec2(imageMin.x + 2, imageMin.y + 2);

ImGui::SetCursorScreenPos(textPos);
std::string overlayText = "+";
overlayText += extractNumberInParentheses(drawObject.first.GetName().english.c_str());
ImGui::Text(overlayText.c_str());
}
if (drawObject.first.GetRandomizerGet() >= RG_FOREST_TEMPLE_BOSS_KEY &&
drawObject.first.GetRandomizerGet() <= RG_GANONS_CASTLE_BOSS_KEY) {
textPos = ImVec2(imageMin.x + 1, imageMin.y + 1);
Expand Down Expand Up @@ -654,6 +695,7 @@ void PlandomizerDrawItemPopup(uint32_t index) {
ImGui::CloseCurrentPopup();
}
UIWidgets::Tooltip(plandomizerRandoRetrieveItem(item).GetName().english.c_str());
PlandomizerOverlayText(std::make_pair(plandomizerRandoRetrieveItem(item), 1));
ImGui::PopID();
}

Expand Down Expand Up @@ -1049,4 +1091,5 @@ void PlandomizerWindow::InitElement() {
Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture("ITEM_TRIFORCE", gEmptyCDownArrowTex, ImVec4( 1, 1, 0, 1 ));
Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture("HASH_ARROW_UP", gEmptyCDownArrowTex, ImVec4( 1, 1, 1, 1 ));
Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture("HASH_ARROW_DWN", gEmptyCDownArrowTex, ImVec4( 1, 1, 1, 1 ));
Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture("Boss Soul", gBossSoulTex, ImVec4(1, 1, 1, 1));
}

0 comments on commit a282c67

Please sign in to comment.