From dfddd07b8b5cbff7c09103a694aed40bda254a2d Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 13 Mar 2025 12:47:54 -0400 Subject: Obsolete savefile reader + IPC solves Now, panel solve state is all read from the sync fields in datastorage. The "show hunt panels" field in settings is now a radio box, and you can choose to show all panels. --- CMakeLists.txt | 1 - src/area_popup.cpp | 26 +++++---------- src/godot_variant.cpp | 84 ------------------------------------------------- src/godot_variant.h | 28 ----------------- src/ipc_state.cpp | 21 ------------- src/ipc_state.h | 2 -- src/settings_dialog.cpp | 48 ++++++++++++++++------------ src/settings_dialog.h | 11 +++++-- src/tracker_config.cpp | 8 +++-- src/tracker_config.h | 8 ++++- src/tracker_frame.cpp | 54 +++---------------------------- src/tracker_frame.h | 3 -- src/tracker_panel.cpp | 75 ++++++------------------------------------- src/tracker_panel.h | 21 ------------- 14 files changed, 72 insertions(+), 318 deletions(-) delete mode 100644 src/godot_variant.cpp delete mode 100644 src/godot_variant.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 9432f2e..82673ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,6 @@ set(SOURCE_FILES "src/subway_map.cpp" "src/network_set.cpp" "src/logger.cpp" - "src/godot_variant.cpp" "src/ipc_state.cpp" "src/ipc_dialog.cpp" "src/report_popup.cpp" diff --git a/src/area_popup.cpp b/src/area_popup.cpp index 2c9d18d..8ec4dd1 100644 --- a/src/area_popup.cpp +++ b/src/area_popup.cpp @@ -54,15 +54,12 @@ void AreaPopup::ResetIndicators() { continue; } - if (tracker_panel->IsPanelsMode()) { - if (!location.single_panel) { - continue; - } - } else { - if (!AP_IsLocationVisible(location.classification) && - !(location.hunt && GetTrackerConfig().show_hunt_panels)) { - continue; - } + if (!AP_IsLocationVisible(location.classification) && + !(location.hunt && + GetTrackerConfig().visible_panels == TrackerConfig::kHUNT_PANELS) && + !(location.single_panel && + GetTrackerConfig().visible_panels == TrackerConfig::kALL_PANELS)) { + continue; } indicators_.emplace_back(section_id, kLOCATION, acc_height); @@ -77,7 +74,7 @@ void AreaPopup::ResetIndicators() { } } - if (AP_IsPaintingShuffle() && !tracker_panel->IsPanelsMode()) { + if (AP_IsPaintingShuffle()) { for (int painting_id : map_area.paintings) { if (IsPaintingPostgame(painting_id)) { continue; @@ -135,16 +132,9 @@ void AreaPopup::UpdateIndicators() { bool checked = false; if (IsLocationWinCondition(location)) { checked = AP_HasReachedGoal(); - } else if (tracker_panel->IsPanelsMode()) { - const Panel& panel = GD_GetPanel(*location.single_panel); - if (panel.non_counting) { - checked = AP_HasCheckedGameLocation(location.ap_location_id); - } else { - checked = tracker_panel->GetSolvedPanels().contains(panel.nodepath); - } } else { checked = AP_HasCheckedGameLocation(location.ap_location_id) || - (location.hunt && + (location.single_panel && AP_IsPanelSolved( GD_GetPanel(*location.single_panel).solve_index)); } diff --git a/src/godot_variant.cpp b/src/godot_variant.cpp deleted file mode 100644 index 152b9ef..0000000 --- a/src/godot_variant.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// Godot save decoder algorithm by Chris Souvey. - -#include "godot_variant.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace { - -uint16_t ReadUint16(std::basic_istream& stream) { - uint16_t result; - stream.read(reinterpret_cast(&result), 2); - return result; -} - -uint32_t ReadUint32(std::basic_istream& stream) { - uint32_t result; - stream.read(reinterpret_cast(&result), 4); - return result; -} - -GodotVariant ParseVariant(std::basic_istream& stream) { - uint16_t type = ReadUint16(stream); - stream.ignore(2); - - switch (type) { - case 1: { - // bool - bool boolval = (ReadUint32(stream) == 1); - return {boolval}; - } - case 15: { - // nodepath - uint32_t name_length = ReadUint32(stream) & 0x7fffffff; - uint32_t subname_length = ReadUint32(stream) & 0x7fffffff; - uint32_t flags = ReadUint32(stream); - - std::vector result; - for (size_t i = 0; i < name_length + subname_length; i++) { - uint32_t char_length = ReadUint32(stream); - uint32_t padded_length = (char_length % 4 == 0) - ? char_length - : (char_length + 4 - (char_length % 4)); - std::vector next_bytes(padded_length); - stream.read(next_bytes.data(), padded_length); - std::string next_piece; - std::copy(next_bytes.begin(), - std::next(next_bytes.begin(), char_length), - std::back_inserter(next_piece)); - result.push_back(next_piece); - } - - return {result}; - } - case 19: { - // array - uint32_t length = ReadUint32(stream) & 0x7fffffff; - std::vector result; - for (size_t i = 0; i < length; i++) { - result.push_back(ParseVariant(stream)); - } - return {result}; - } - default: { - // eh - return {std::monostate{}}; - } - } -} - -} // namespace - -GodotVariant ParseGodotFile(std::string filename) { - std::ifstream file_stream(filename, std::ios_base::binary); - file_stream.ignore(4); - return ParseVariant(file_stream); -} diff --git a/src/godot_variant.h b/src/godot_variant.h deleted file mode 100644 index 620e569..0000000 --- a/src/godot_variant.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef GODOT_VARIANT_H_ED7F2EB6 -#define GODOT_VARIANT_H_ED7F2EB6 - -#include -#include -#include - -struct GodotVariant { - using value_type = std::variant, std::vector>; - - value_type value; - - GodotVariant(value_type v) : value(v) {} - - bool AsBool() const { return std::get(value); } - - const std::vector& AsNodePath() const { - return std::get>(value); - } - - const std::vector& AsArray() const { - return std::get>(value); - } -}; - -GodotVariant ParseGodotFile(std::string filename); - -#endif /* end of include guard: GODOT_VARIANT_H_ED7F2EB6 */ diff --git a/src/ipc_state.cpp b/src/ipc_state.cpp index a99fa89..6e2a440 100644 --- a/src/ipc_state.cpp +++ b/src/ipc_state.cpp @@ -39,7 +39,6 @@ struct IPCState { std::string game_ap_user; std::optional> player_position; - std::set solved_panels; // Thread state std::unique_ptr ws; @@ -103,12 +102,6 @@ struct IPCState { return player_position; } - std::set GetSolvedPanels() { - std::lock_guard state_guard(state_mutex); - - return solved_panels; - } - private: void Thread() { for (;;) { @@ -134,7 +127,6 @@ struct IPCState { game_ap_user.clear(); player_position = std::nullopt; - solved_panels.clear(); if (address.empty()) { initialized = false; @@ -273,7 +265,6 @@ struct IPCState { slot_matches = false; player_position = std::nullopt; - solved_panels.clear(); } } @@ -314,14 +305,6 @@ struct IPCState { std::make_tuple(msg["position"]["x"], msg["position"]["z"]); tracker_frame->UpdateIndicators(StateUpdate{.player_position = true}); - } else if (msg["cmd"] == "SolvePanels") { - std::lock_guard state_guard(state_mutex); - - for (std::string panel : msg["panels"]) { - solved_panels.insert(std::move(panel)); - } - - tracker_frame->UpdateIndicators(StateUpdate{.open_panels_tab = true}); } } @@ -382,7 +365,3 @@ bool IPC_IsConnected() { return GetState().IsConnected(); } std::optional> IPC_GetPlayerPosition() { return GetState().GetPlayerPosition(); } - -std::set IPC_GetSolvedPanels() { - return GetState().GetSolvedPanels(); -} diff --git a/src/ipc_state.h b/src/ipc_state.h index 7c9d68d..0e6fa51 100644 --- a/src/ipc_state.h +++ b/src/ipc_state.h @@ -20,6 +20,4 @@ bool IPC_IsConnected(); std::optional> IPC_GetPlayerPosition(); -std::set IPC_GetSolvedPanels(); - #endif /* end of include guard: IPC_STATE_H_6B3B0958 */ diff --git a/src/settings_dialog.cpp b/src/settings_dialog.cpp index fa7a82f..95df577 100644 --- a/src/settings_dialog.cpp +++ b/src/settings_dialog.cpp @@ -3,35 +3,43 @@ #include "tracker_config.h" SettingsDialog::SettingsDialog() : wxDialog(nullptr, wxID_ANY, "Settings") { - should_check_for_updates_box_ = new wxCheckBox( - this, wxID_ANY, "Check for updates when the tracker opens"); + wxStaticBoxSizer* main_box = + new wxStaticBoxSizer(wxVERTICAL, this, "General settings"); + + should_check_for_updates_box_ = + new wxCheckBox(main_box->GetStaticBox(), wxID_ANY, + "Check for updates when the tracker opens"); hybrid_areas_box_ = new wxCheckBox( - this, wxID_ANY, + main_box->GetStaticBox(), wxID_ANY, "Use two colors to show that an area has partial availability"); - show_hunt_panels_box_ = new wxCheckBox(this, wxID_ANY, "Show hunt panels"); - track_position_box_ = new wxCheckBox(this, wxID_ANY, "Track player position"); + track_position_box_ = new wxCheckBox(main_box->GetStaticBox(), wxID_ANY, + "Track player position"); should_check_for_updates_box_->SetValue( GetTrackerConfig().should_check_for_updates); hybrid_areas_box_->SetValue(GetTrackerConfig().hybrid_areas); - show_hunt_panels_box_->SetValue(GetTrackerConfig().show_hunt_panels); track_position_box_->SetValue(GetTrackerConfig().track_position); - wxBoxSizer* form_sizer = new wxBoxSizer(wxVERTICAL); - - form_sizer->Add(should_check_for_updates_box_, wxSizerFlags().HorzBorder()); - form_sizer->AddSpacer(2); - - form_sizer->Add(hybrid_areas_box_, wxSizerFlags().HorzBorder()); - form_sizer->AddSpacer(2); + main_box->Add(should_check_for_updates_box_, wxSizerFlags().Border()); + main_box->AddSpacer(2); + main_box->Add(hybrid_areas_box_, wxSizerFlags().Border()); + main_box->AddSpacer(2); + main_box->Add(track_position_box_, wxSizerFlags().Border()); + + const wxString visible_panels_choices[] = {"Only show locations", + "Show locations and hunt panels", + "Show all panels"}; + visible_panels_box_ = + new wxRadioBox(this, wxID_ANY, "Visible panels", wxDefaultPosition, + wxDefaultSize, 3, visible_panels_choices, 1); + visible_panels_box_->SetSelection( + static_cast(GetTrackerConfig().visible_panels)); - form_sizer->Add(show_hunt_panels_box_, wxSizerFlags().HorzBorder()); - form_sizer->AddSpacer(2); - - form_sizer->Add(track_position_box_, wxSizerFlags().HorzBorder()); - form_sizer->AddSpacer(2); - - form_sizer->Add(CreateButtonSizer(wxOK | wxCANCEL), wxSizerFlags().Center()); + wxBoxSizer* form_sizer = new wxBoxSizer(wxVERTICAL); + form_sizer->Add(main_box, wxSizerFlags().Border().Expand()); + form_sizer->Add(visible_panels_box_, wxSizerFlags().Border().Expand()); + form_sizer->Add(CreateButtonSizer(wxOK | wxCANCEL), + wxSizerFlags().Center().Border()); SetSizerAndFit(form_sizer); diff --git a/src/settings_dialog.h b/src/settings_dialog.h index 12f2439..c4dacfa 100644 --- a/src/settings_dialog.h +++ b/src/settings_dialog.h @@ -7,6 +7,10 @@ #include #endif +#include + +#include "tracker_config.h" + class SettingsDialog : public wxDialog { public: SettingsDialog(); @@ -15,13 +19,16 @@ class SettingsDialog : public wxDialog { return should_check_for_updates_box_->GetValue(); } bool GetHybridAreas() const { return hybrid_areas_box_->GetValue(); } - bool GetShowHuntPanels() const { return show_hunt_panels_box_->GetValue(); } + TrackerConfig::VisiblePanels GetVisiblePanels() const { + return static_cast( + visible_panels_box_->GetSelection()); + } bool GetTrackPosition() const { return track_position_box_->GetValue(); } private: wxCheckBox* should_check_for_updates_box_; wxCheckBox* hybrid_areas_box_; - wxCheckBox* show_hunt_panels_box_; + wxRadioBox* visible_panels_box_; wxCheckBox* track_position_box_; }; diff --git a/src/tracker_config.cpp b/src/tracker_config.cpp index aeff669..da5d60a 100644 --- a/src/tracker_config.cpp +++ b/src/tracker_config.cpp @@ -16,7 +16,9 @@ void TrackerConfig::Load() { asked_to_check_for_updates = file["asked_to_check_for_updates"].as(); should_check_for_updates = file["should_check_for_updates"].as(); hybrid_areas = file["hybrid_areas"].as(); - show_hunt_panels = file["show_hunt_panels"].as(); + if (file["show_hunt_panels"] && file["show_hunt_panels"].as()) { + visible_panels = kHUNT_PANELS; + } if (file["connection_history"]) { for (const auto& connection : file["connection_history"]) { @@ -30,6 +32,8 @@ void TrackerConfig::Load() { ipc_address = file["ipc_address"].as(); track_position = file["track_position"].as(); + visible_panels = + static_cast(file["visible_panels"].as()); } catch (const std::exception&) { // It's fine if the file can't be loaded. } @@ -43,7 +47,6 @@ void TrackerConfig::Save() { output["asked_to_check_for_updates"] = asked_to_check_for_updates; output["should_check_for_updates"] = should_check_for_updates; output["hybrid_areas"] = hybrid_areas; - output["show_hunt_panels"] = show_hunt_panels; output.remove("connection_history"); for (const ConnectionDetails& details : connection_history) { @@ -57,6 +60,7 @@ void TrackerConfig::Save() { output["ipc_address"] = ipc_address; output["track_position"] = track_position; + output["visible_panels"] = static_cast(visible_panels); std::ofstream filewriter(filename_); filewriter << output; diff --git a/src/tracker_config.h b/src/tracker_config.h index 4e851dc..df4105d 100644 --- a/src/tracker_config.h +++ b/src/tracker_config.h @@ -23,14 +23,20 @@ class TrackerConfig { void Save(); + enum VisiblePanels { + kLOCATIONS_ONLY, + kHUNT_PANELS, + kALL_PANELS, + }; + ConnectionDetails connection_details; bool asked_to_check_for_updates = false; bool should_check_for_updates = false; bool hybrid_areas = false; - bool show_hunt_panels = false; std::deque connection_history; std::string ipc_address; bool track_position = true; + VisiblePanels visible_panels = kLOCATIONS_ONLY; private: std::string filename_; diff --git a/src/tracker_frame.cpp b/src/tracker_frame.cpp index 84017a3..c0b070b 100644 --- a/src/tracker_frame.cpp +++ b/src/tracker_frame.cpp @@ -51,7 +51,6 @@ enum TrackerFrameIds { ID_SETTINGS = 3, ID_ZOOM_IN = 4, ID_ZOOM_OUT = 5, - ID_OPEN_SAVE_FILE = 6, ID_IPC_CONNECT = 7, ID_LOG_DIALOG = 8, }; @@ -77,7 +76,6 @@ TrackerFrame::TrackerFrame() wxMenu *menuFile = new wxMenu(); menuFile->Append(ID_AP_CONNECT, "&Connect to Archipelago"); menuFile->Append(ID_IPC_CONNECT, "&Connect to Lingo"); - menuFile->Append(ID_OPEN_SAVE_FILE, "&Open Save Data\tCtrl-O"); menuFile->Append(ID_SETTINGS, "&Settings"); menuFile->Append(wxID_EXIT); @@ -114,7 +112,6 @@ TrackerFrame::TrackerFrame() Bind(wxEVT_MENU, &TrackerFrame::OnZoomOut, this, ID_ZOOM_OUT); Bind(wxEVT_MENU, &TrackerFrame::OnOpenLogWindow, this, ID_LOG_DIALOG); Bind(wxEVT_NOTEBOOK_PAGE_CHANGED, &TrackerFrame::OnChangePage, this); - Bind(wxEVT_MENU, &TrackerFrame::OnOpenFile, this, ID_OPEN_SAVE_FILE); Bind(wxEVT_SPLITTER_SASH_POS_CHANGED, &TrackerFrame::OnSashPositionChanged, this); Bind(STATE_RESET, &TrackerFrame::OnStateReset, this); @@ -252,7 +249,7 @@ void TrackerFrame::OnSettings(wxCommandEvent &event) { GetTrackerConfig().should_check_for_updates = dlg.GetShouldCheckForUpdates(); GetTrackerConfig().hybrid_areas = dlg.GetHybridAreas(); - GetTrackerConfig().show_hunt_panels = dlg.GetShowHuntPanels(); + GetTrackerConfig().visible_panels = dlg.GetVisiblePanels(); GetTrackerConfig().track_position = dlg.GetTrackPosition(); GetTrackerConfig().Save(); @@ -303,28 +300,6 @@ void TrackerFrame::OnChangePage(wxBookCtrlEvent &event) { zoom_out_menu_item_->Enable(event.GetSelection() == 1); } -void TrackerFrame::OnOpenFile(wxCommandEvent &event) { - wxFileDialog open_file_dialog( - this, "Open Lingo Save File", - fmt::format("{}\\Godot\\app_userdata\\Lingo\\level1_stable", - wxStandardPaths::Get().GetUserConfigDir().ToStdString()), - AP_GetSaveName(), "Lingo save file (*.save)|*.save", - wxFD_OPEN | wxFD_FILE_MUST_EXIST); - if (open_file_dialog.ShowModal() == wxID_CANCEL) { - return; - } - - std::string savedata_path = open_file_dialog.GetPath().ToStdString(); - - if (panels_panel_ == nullptr) { - panels_panel_ = new TrackerPanel(notebook_); - notebook_->AddPage(panels_panel_, "Panels"); - } - - notebook_->SetSelection(notebook_->FindPage(panels_panel_)); - panels_panel_->SetSavedataPath(savedata_path); -} - void TrackerFrame::OnSashPositionChanged(wxSplitterEvent& event) { notebook_->Refresh(); } @@ -336,36 +311,20 @@ void TrackerFrame::OnStateReset(wxCommandEvent &event) { options_pane_->OnConnect(); paintings_pane_->ResetIndicators(); subway_map_->OnConnect(); - if (panels_panel_ != nullptr) { - notebook_->DeletePage(notebook_->FindPage(panels_panel_)); - panels_panel_ = nullptr; - } Refresh(); } void TrackerFrame::OnStateChanged(StateChangedEvent &event) { const StateUpdate &state = event.GetState(); - if (state.open_panels_tab) { - if (panels_panel_ == nullptr) { - panels_panel_ = new TrackerPanel(notebook_); - panels_panel_->SetPanelsMode(); - notebook_->AddPage(panels_panel_, "Panels"); - } - panels_panel_->UpdateIndicators(/*reset=*/false); - if (notebook_->GetSelection() == 2) { - Refresh(); - } - - return; - } - bool hunt_panels = false; - if (GetTrackerConfig().show_hunt_panels) { + if (GetTrackerConfig().visible_panels == TrackerConfig::kHUNT_PANELS) { hunt_panels = std::any_of( state.panels.begin(), state.panels.end(), [](int solve_index) { return GD_GetPanel(GD_GetPanelBySolveIndex(solve_index)).hunt; }); + } else if (GetTrackerConfig().visible_panels == TrackerConfig::kALL_PANELS) { + hunt_panels = true; } if (!state.items.empty() || !state.paintings.empty() || @@ -375,15 +334,10 @@ void TrackerFrame::OnStateChanged(StateChangedEvent &event) { // panels later, we can get rid of this. tracker_panel_->UpdateIndicators(/*reset=*/state.changed_settings); subway_map_->UpdateIndicators(); - if (panels_panel_ != nullptr) { - panels_panel_->UpdateIndicators(/*reset=*/false); - } Refresh(); } else if (state.player_position && GetTrackerConfig().track_position) { if (notebook_->GetSelection() == 0) { tracker_panel_->Refresh(); - } else if (notebook_->GetSelection() == 2) { - panels_panel_->Refresh(); } } diff --git a/src/tracker_frame.h b/src/tracker_frame.h index 8eb4465..2167852 100644 --- a/src/tracker_frame.h +++ b/src/tracker_frame.h @@ -54,7 +54,6 @@ struct StateUpdate { bool progression_items = false; std::vector paintings; bool achievements = false; - bool open_panels_tab = false; bool cleared_locations = false; std::set panels; bool player_position = false; @@ -101,7 +100,6 @@ class TrackerFrame : public wxFrame { void OnOpenLogWindow(wxCommandEvent &event); void OnCloseLogWindow(wxCloseEvent &event); void OnChangePage(wxBookCtrlEvent &event); - void OnOpenFile(wxCommandEvent &event); void OnSashPositionChanged(wxSplitterEvent &event); void OnStateReset(wxCommandEvent &event); @@ -119,7 +117,6 @@ class TrackerFrame : public wxFrame { OptionsPane *options_pane_; PaintingsPane *paintings_pane_; SubwayMap *subway_map_; - TrackerPanel *panels_panel_ = nullptr; LogDialog *log_dialog_ = nullptr; wxMenuItem *zoom_in_menu_item_; diff --git a/src/tracker_panel.cpp b/src/tracker_panel.cpp index d8ba054..0a756e6 100644 --- a/src/tracker_panel.cpp +++ b/src/tracker_panel.cpp @@ -9,7 +9,6 @@ #include "area_popup.h" #include "game_data.h" #include "global.h" -#include "godot_variant.h" #include "ipc_state.h" #include "tracker_config.h" #include "tracker_state.h" @@ -52,20 +51,18 @@ TrackerPanel::TrackerPanel(wxWindow *parent) : wxPanel(parent, wxID_ANY) { } void TrackerPanel::UpdateIndicators(bool reset) { - if (panels_mode_ && !savedata_path_) { - solved_panels_ = IPC_GetSolvedPanels(); - } - if (reset) { for (AreaIndicator &area : areas_) { const MapArea &map_area = GD_GetMapArea(area.area_id); if (IsAreaPostgame(area.area_id)) { area.active = false; - } else if (panels_mode_) { - area.active = map_area.has_single_panel; } else if (!AP_IsLocationVisible(map_area.classification) && - !(map_area.hunt && GetTrackerConfig().show_hunt_panels) && + !(map_area.hunt && GetTrackerConfig().visible_panels == + TrackerConfig::kHUNT_PANELS) && + !(map_area.has_single_panel && + GetTrackerConfig().visible_panels == + TrackerConfig::kALL_PANELS) && !(AP_IsPaintingShuffle() && !map_area.paintings.empty())) { area.active = false; } else { @@ -85,47 +82,10 @@ void TrackerPanel::UpdateIndicators(bool reset) { Redraw(); } -void TrackerPanel::SetPanelsMode() { panels_mode_ = true; } - -void TrackerPanel::SetSavedataPath(std::string savedata_path) { - if (!savedata_path_) { - refresh_button_ = new wxButton(this, wxID_ANY, "Refresh"); - refresh_button_->Bind(wxEVT_BUTTON, &TrackerPanel::OnRefreshSavedata, this); - SetUpRefreshButton(); - } - - savedata_path_ = savedata_path; - panels_mode_ = true; - - UpdateIndicators(/*reset=*/true); - RefreshSavedata(); -} - -void TrackerPanel::RefreshSavedata() { - solved_panels_.clear(); - - GodotVariant godot_variant = ParseGodotFile(*savedata_path_); - for (const GodotVariant &panel_node : godot_variant.AsArray()) { - const std::vector &fields = panel_node.AsArray(); - if (fields[1].AsBool()) { - const std::vector &nodepath = fields[0].AsNodePath(); - std::string key = fmt::format("{}/{}", nodepath[3], nodepath[4]); - solved_panels_.insert(key); - } - } - - UpdateIndicators(/*reset=*/false); - Refresh(); -} - void TrackerPanel::OnPaint(wxPaintEvent &event) { if (GetSize() != rendered_.GetSize()) { Resize(); Redraw(); - - if (refresh_button_ != nullptr) { - SetUpRefreshButton(); - } } wxBufferedPaintDC dc(this); @@ -174,10 +134,6 @@ void TrackerPanel::OnMouseMove(wxMouseEvent &event) { event.Skip(); } -void TrackerPanel::OnRefreshSavedata(wxCommandEvent &event) { - RefreshSavedata(); -} - void TrackerPanel::Resize() { wxSize panel_size = GetClientSize(); wxSize image_size = map_image_.GetSize(); @@ -281,18 +237,12 @@ void TrackerPanel::Redraw() { // Nope. } else if (IsLocationWinCondition(section)) { has_unchecked = !AP_HasReachedGoal(); - } else if (panels_mode_) { - if (section.single_panel) { - const Panel &panel = GD_GetPanel(*section.single_panel); - if (panel.non_counting) { - has_unchecked = !AP_HasCheckedGameLocation(section.ap_location_id); - } else { - has_unchecked = !GetSolvedPanels().contains(panel.nodepath); - } - } } else if (AP_IsLocationVisible(section.classification)) { has_unchecked = !AP_HasCheckedGameLocation(section.ap_location_id); - } else if (section.hunt && GetTrackerConfig().show_hunt_panels) { + } else if ((section.hunt && GetTrackerConfig().visible_panels == + TrackerConfig::kHUNT_PANELS) || + (section.single_panel && GetTrackerConfig().visible_panels == + TrackerConfig::kALL_PANELS)) { has_unchecked = !AP_IsPanelSolved(GD_GetPanel(*section.single_panel).solve_index); } @@ -306,7 +256,7 @@ void TrackerPanel::Redraw() { } } - if (AP_IsPaintingShuffle() && !panels_mode_) { + if (AP_IsPaintingShuffle()) { for (int painting_id : map_area.paintings) { if (IsPaintingPostgame(painting_id)) { continue; @@ -358,8 +308,3 @@ void TrackerPanel::Redraw() { } } } - -void TrackerPanel::SetUpRefreshButton() { - refresh_button_->SetSize(FromDIP(15), FromDIP(15), wxDefaultCoord, - wxDefaultCoord, wxSIZE_AUTO); -} diff --git a/src/tracker_panel.h b/src/tracker_panel.h index abab1bf..6825843 100644 --- a/src/tracker_panel.h +++ b/src/tracker_panel.h @@ -19,16 +19,6 @@ class TrackerPanel : public wxPanel { void UpdateIndicators(bool reset); - void SetPanelsMode(); - - void SetSavedataPath(std::string savedata_path); - - bool IsPanelsMode() const { return panels_mode_; } - - const std::set &GetSolvedPanels() const { - return solved_panels_; - } - private: struct AreaIndicator { int area_id = -1; @@ -42,23 +32,16 @@ class TrackerPanel : public wxPanel { void OnPaint(wxPaintEvent &event); void OnMouseMove(wxMouseEvent &event); - void OnRefreshSavedata(wxCommandEvent &event); void Resize(); void Redraw(); - void RefreshSavedata(); - - void SetUpRefreshButton(); - wxImage map_image_; wxImage player_image_; wxBitmap scaled_map_; wxBitmap rendered_; wxBitmap scaled_player_; - wxButton *refresh_button_ = nullptr; - int offset_x_ = 0; int offset_y_ = 0; double scale_x_ = 0; @@ -66,10 +49,6 @@ class TrackerPanel : public wxPanel { int real_area_size_ = 0; std::vector areas_; - - bool panels_mode_ = false; - std::optional savedata_path_; - std::set solved_panels_; }; #endif /* end of include guard: TRACKER_PANEL_H_D675A54D */ -- cgit 1.4.1