Updates styling for checked items in Check Tracker

This commit is contained in:
sonoftunk 2022-11-06 08:08:47 -05:00
parent 466aa7d96e
commit 984a2b0bb1

View File

@ -718,9 +718,9 @@ void DrawLocations() {
bool lastItemFound = false; bool lastItemFound = false;
ImGui::BeginChild("ChildToCheckLocations", ImVec2(0, -8)); ImGui::BeginChild("ChildToCheckLocations", ImVec2(0, -8));
for (auto [rcArea, rcObjects] : RandomizerCheckObjects::GetAllRCObjectsByArea()) { for (auto& [rcArea, rcObjects] : RandomizerCheckObjects::GetAllRCObjectsByArea()) {
bool hasItems = false; bool hasItems = false;
for (auto locationIt : rcObjects) { for (auto& locationIt : rcObjects) {
if (locationIt.second.visibleInImgui && !checkedLocations.count(locationIt.second.rc) && if (locationIt.second.visibleInImgui && !checkedLocations.count(locationIt.second.rc) &&
locationSearch.PassFilter(locationIt.second.rcSpoilerName.c_str())) { locationSearch.PassFilter(locationIt.second.rcSpoilerName.c_str())) {
@ -732,7 +732,7 @@ void DrawLocations() {
if (hasItems) { if (hasItems) {
ImGui::SetNextItemOpen(true, ImGuiCond_Once); ImGui::SetNextItemOpen(true, ImGuiCond_Once);
if (ImGui::TreeNode(RandomizerCheckObjects::GetRCAreaName(rcArea).c_str())) { if (ImGui::TreeNode(RandomizerCheckObjects::GetRCAreaName(rcArea).c_str())) {
for (auto locationIt : rcObjects) { for (auto& locationIt : rcObjects) {
// If the location has its scene flag set // If the location has its scene flag set
if (HasItemBeenCollected(locationIt.second)) { // && checkedLocations.find(locationIt.rc) != checkedLocations.end()) { if (HasItemBeenCollected(locationIt.second)) { // && checkedLocations.find(locationIt.rc) != checkedLocations.end()) {
// show it as checked // show it as checked
@ -788,9 +788,9 @@ void DrawLocations() {
// COLUMN 2 - CHECKED LOCATIONS // COLUMN 2 - CHECKED LOCATIONS
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::BeginChild("ChildCheckedLocations", ImVec2(0, -8)); ImGui::BeginChild("ChildCheckedLocations", ImVec2(0, -8));
for (auto areaIt : RandomizerCheckObjects::GetAllRCObjectsByArea()) { for (auto& areaIt : RandomizerCheckObjects::GetAllRCObjectsByArea()) {
bool hasItems = false; bool hasItems = false;
for (auto locationIt : areaIt.second) { for (auto& locationIt : areaIt.second) {
if (locationIt.second.visibleInImgui && checkedLocations.count(locationIt.second.rc)) { if (locationIt.second.visibleInImgui && checkedLocations.count(locationIt.second.rc)) {
hasItems = true; hasItems = true;
break; break;
@ -800,29 +800,28 @@ void DrawLocations() {
if (hasItems) { if (hasItems) {
ImGui::SetNextItemOpen(true, ImGuiCond_Once); ImGui::SetNextItemOpen(true, ImGuiCond_Once);
if (ImGui::TreeNode(RandomizerCheckObjects::GetRCAreaName(areaIt.first).c_str())) { if (ImGui::TreeNode(RandomizerCheckObjects::GetRCAreaName(areaIt.first).c_str())) {
for (auto locationIt : areaIt.second) { for (auto& locationIt : areaIt.second) {
auto elfound = checkedLocations.find(locationIt.second.rc); auto elfound = checkedLocations.find(locationIt.second.rc);
if (locationIt.second.visibleInImgui && elfound != checkedLocations.end()) { if (locationIt.second.visibleInImgui && elfound != checkedLocations.end()) {
// If the location has its scene flag set // If the location has its scene flag set
if (!HasItemBeenCollected(locationIt.second)) { if (!HasItemBeenCollected(locationIt.second)) {
// show it as checked // show it as checked
checkedLocations.erase(locationIt.second.rc); checkedLocations.erase(locationIt.second.rc);
} else if (ImGui::ArrowButton(std::to_string(locationIt.second.rc).c_str(), } else if (ImGui::ArrowButton(std::to_string(locationIt.second.rc).c_str(), ImGuiDir_Left)) {
ImGuiDir_Left)) {
checkedLocations.erase(elfound); checkedLocations.erase(elfound);
} }
ImGui::SameLine(); ImGui::SameLine();
std::string txt = std::string txt =
(lastLocationChecked == locationIt.second.rc (lastLocationChecked == locationIt.second.rc ? "* " : "") + // Indicate the last location checked (before app reset at least)
? "* " locationIt.second.rcShortName;
: "") + // Indicate the last location checked (before app reset at least)
locationIt.second.rcShortName +
" - ";
txt += OTRGlobals::Instance->gRandomizer
->EnumToSpoilerfileGetName[gSaveContext.itemLocations[locationIt.second.rc]
.get.rgID]
[LANGUAGE_ENG]; // TODO Language
ImGui::Text(txt.c_str()); ImGui::Text(txt.c_str());
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(0, 185, 0, 255));
txt = OTRGlobals::Instance->gRandomizer
->EnumToSpoilerfileGetName[gSaveContext.itemLocations[locationIt.second.rc].get.rgID][LANGUAGE_ENG]; // TODO Language
ImGui::SameLine();
ImGui::Text("(%s)", txt.c_str());
ImGui::PopStyleColor();
// TODO GetItemObtainabilityFromRandomizerGet(rgData.rgID).CAN_OBTAIN or something to // TODO GetItemObtainabilityFromRandomizerGet(rgData.rgID).CAN_OBTAIN or something to
// determine if it should say blue rupee // determine if it should say blue rupee
} }