diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/game_data.cpp | 3 | ||||
| -rw-r--r-- | src/game_data.h | 1 | ||||
| -rw-r--r-- | src/paintings_pane.cpp | 61 | ||||
| -rw-r--r-- | src/paintings_pane.h | 22 | ||||
| -rw-r--r-- | src/tracker_frame.cpp | 7 | ||||
| -rw-r--r-- | src/tracker_frame.h | 2 |
6 files changed, 95 insertions, 1 deletions
| diff --git a/src/game_data.cpp b/src/game_data.cpp index a3ac27d..e92e6a2 100644 --- a/src/game_data.cpp +++ b/src/game_data.cpp | |||
| @@ -723,7 +723,8 @@ struct GameData { | |||
| 723 | MapArea &map_area = map_areas_[area_id]; | 723 | MapArea &map_area = map_areas_[area_id]; |
| 724 | 724 | ||
| 725 | for (int painting_id : room.paintings) { | 725 | for (int painting_id : room.paintings) { |
| 726 | const PaintingExit &painting_obj = paintings_.at(painting_id); | 726 | PaintingExit &painting_obj = paintings_.at(painting_id); |
| 727 | painting_obj.map_area = area_id; | ||
| 727 | if (painting_obj.entrance) { | 728 | if (painting_obj.entrance) { |
| 728 | map_area.paintings.push_back(painting_id); | 729 | map_area.paintings.push_back(painting_id); |
| 729 | } | 730 | } |
| diff --git a/src/game_data.h b/src/game_data.h index fd7301f..51fbf09 100644 --- a/src/game_data.h +++ b/src/game_data.h | |||
| @@ -105,6 +105,7 @@ struct PaintingExit { | |||
| 105 | std::string display_name; | 105 | std::string display_name; |
| 106 | std::optional<int> door; | 106 | std::optional<int> door; |
| 107 | bool entrance = false; | 107 | bool entrance = false; |
| 108 | int map_area; | ||
| 108 | }; | 109 | }; |
| 109 | 110 | ||
| 110 | struct Room { | 111 | struct Room { |
| diff --git a/src/paintings_pane.cpp b/src/paintings_pane.cpp new file mode 100644 index 0000000..352533f --- /dev/null +++ b/src/paintings_pane.cpp | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | #include "paintings_pane.h" | ||
| 2 | |||
| 3 | #include <map> | ||
| 4 | #include <set> | ||
| 5 | |||
| 6 | #include <fmt/core.h> | ||
| 7 | #include <wx/dataview.h> | ||
| 8 | |||
| 9 | #include "ap_state.h" | ||
| 10 | #include "game_data.h" | ||
| 11 | #include "tracker_state.h" | ||
| 12 | |||
| 13 | namespace { | ||
| 14 | |||
| 15 | std::string GetPaintingDisplayName(const std::string& id) { | ||
| 16 | const PaintingExit& painting = GD_GetPaintingExit(GD_GetPaintingByName(id)); | ||
| 17 | const MapArea& map_area = GD_GetMapArea(painting.map_area); | ||
| 18 | |||
| 19 | return fmt::format("{} - {}", map_area.name, painting.display_name); | ||
| 20 | } | ||
| 21 | |||
| 22 | } // namespace | ||
| 23 | |||
| 24 | PaintingsPane::PaintingsPane(wxWindow* parent) | ||
| 25 | : wxPanel(parent, wxID_ANY) { | ||
| 26 | wxStaticText* label = new wxStaticText(this, wxID_ANY, "Shuffled paintings grouped by destination:"); | ||
| 27 | tree_ctrl_ = new wxDataViewTreeCtrl(this, wxID_ANY); | ||
| 28 | |||
| 29 | wxBoxSizer* top_sizer = new wxBoxSizer(wxVERTICAL); | ||
| 30 | top_sizer->Add(label, wxSizerFlags().Border()); | ||
| 31 | top_sizer->Add(tree_ctrl_, wxSizerFlags().Expand().Proportion(1)); | ||
| 32 | |||
| 33 | SetSizerAndFit(top_sizer); | ||
| 34 | } | ||
| 35 | |||
| 36 | void PaintingsPane::UpdateIndicators() { | ||
| 37 | tree_ctrl_->DeleteAllItems(); | ||
| 38 | |||
| 39 | if (!AP_IsPaintingShuffle()) { | ||
| 40 | return; | ||
| 41 | } | ||
| 42 | |||
| 43 | std::map<std::string, std::set<std::string>> grouped_paintings; | ||
| 44 | |||
| 45 | for (const auto& [from, to] : AP_GetPaintingMapping()) { | ||
| 46 | if (IsPaintingReachable(GD_GetPaintingByName(from)) && | ||
| 47 | AP_IsPaintingChecked(from)) { | ||
| 48 | grouped_paintings[GetPaintingDisplayName(to)].insert( | ||
| 49 | GetPaintingDisplayName(from)); | ||
| 50 | } | ||
| 51 | } | ||
| 52 | |||
| 53 | for (const auto& [to, froms] : grouped_paintings) { | ||
| 54 | wxDataViewItem tree_branch = | ||
| 55 | tree_ctrl_->AppendContainer(wxDataViewItem(0), to); | ||
| 56 | |||
| 57 | for (const std::string& from : froms) { | ||
| 58 | tree_ctrl_->AppendItem(tree_branch, from); | ||
| 59 | } | ||
| 60 | } | ||
| 61 | } | ||
| diff --git a/src/paintings_pane.h b/src/paintings_pane.h new file mode 100644 index 0000000..f8d3e09 --- /dev/null +++ b/src/paintings_pane.h | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | #ifndef PAINTINGS_PANE_H_815370D2 | ||
| 2 | #define PAINTINGS_PANE_H_815370D2 | ||
| 3 | |||
| 4 | #include <wx/wxprec.h> | ||
| 5 | |||
| 6 | #ifndef WX_PRECOMP | ||
| 7 | #include <wx/wx.h> | ||
| 8 | #endif | ||
| 9 | |||
| 10 | class wxDataViewTreeCtrl; | ||
| 11 | |||
| 12 | class PaintingsPane : public wxPanel { | ||
| 13 | public: | ||
| 14 | explicit PaintingsPane(wxWindow* parent); | ||
| 15 | |||
| 16 | void UpdateIndicators(); | ||
| 17 | |||
| 18 | private: | ||
| 19 | wxDataViewTreeCtrl* tree_ctrl_; | ||
| 20 | }; | ||
| 21 | |||
| 22 | #endif /* end of include guard: PAINTINGS_PANE_H_815370D2 */ | ||
| diff --git a/src/tracker_frame.cpp b/src/tracker_frame.cpp index a1bd23e..a697f9a 100644 --- a/src/tracker_frame.cpp +++ b/src/tracker_frame.cpp | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include "connection_dialog.h" | 17 | #include "connection_dialog.h" |
| 18 | #include "ipc_dialog.h" | 18 | #include "ipc_dialog.h" |
| 19 | #include "ipc_state.h" | 19 | #include "ipc_state.h" |
| 20 | #include "paintings_pane.h" | ||
| 20 | #include "settings_dialog.h" | 21 | #include "settings_dialog.h" |
| 21 | #include "subway_map.h" | 22 | #include "subway_map.h" |
| 22 | #include "tracker_config.h" | 23 | #include "tracker_config.h" |
| @@ -120,9 +121,13 @@ TrackerFrame::TrackerFrame() | |||
| 120 | splitter_window_->SetMinimumPaneSize(logicalSize.x / 5); | 121 | splitter_window_->SetMinimumPaneSize(logicalSize.x / 5); |
| 121 | 122 | ||
| 122 | wxChoicebook *choicebook = new wxChoicebook(splitter_window_, wxID_ANY); | 123 | wxChoicebook *choicebook = new wxChoicebook(splitter_window_, wxID_ANY); |
| 124 | |||
| 123 | achievements_pane_ = new AchievementsPane(choicebook); | 125 | achievements_pane_ = new AchievementsPane(choicebook); |
| 124 | choicebook->AddPage(achievements_pane_, "Achievements"); | 126 | choicebook->AddPage(achievements_pane_, "Achievements"); |
| 125 | 127 | ||
| 128 | paintings_pane_ = new PaintingsPane(choicebook); | ||
| 129 | choicebook->AddPage(paintings_pane_, "Paintings"); | ||
| 130 | |||
| 126 | notebook_ = new wxNotebook(splitter_window_, wxID_ANY); | 131 | notebook_ = new wxNotebook(splitter_window_, wxID_ANY); |
| 127 | tracker_panel_ = new TrackerPanel(notebook_); | 132 | tracker_panel_ = new TrackerPanel(notebook_); |
| 128 | subway_map_ = new SubwayMap(notebook_); | 133 | subway_map_ = new SubwayMap(notebook_); |
| @@ -299,6 +304,7 @@ void TrackerFrame::OnSashPositionChanged(wxSplitterEvent& event) { | |||
| 299 | void TrackerFrame::OnStateReset(wxCommandEvent &event) { | 304 | void TrackerFrame::OnStateReset(wxCommandEvent &event) { |
| 300 | tracker_panel_->UpdateIndicators(); | 305 | tracker_panel_->UpdateIndicators(); |
| 301 | achievements_pane_->UpdateIndicators(); | 306 | achievements_pane_->UpdateIndicators(); |
| 307 | paintings_pane_->UpdateIndicators(); | ||
| 302 | subway_map_->OnConnect(); | 308 | subway_map_->OnConnect(); |
| 303 | if (panels_panel_ != nullptr) { | 309 | if (panels_panel_ != nullptr) { |
| 304 | notebook_->DeletePage(notebook_->FindPage(panels_panel_)); | 310 | notebook_->DeletePage(notebook_->FindPage(panels_panel_)); |
| @@ -313,6 +319,7 @@ void TrackerFrame::OnStateChanged(wxCommandEvent &event) { | |||
| 313 | if (mode == kUPDATE_ALL_INDICATORS) { | 319 | if (mode == kUPDATE_ALL_INDICATORS) { |
| 314 | tracker_panel_->UpdateIndicators(); | 320 | tracker_panel_->UpdateIndicators(); |
| 315 | achievements_pane_->UpdateIndicators(); | 321 | achievements_pane_->UpdateIndicators(); |
| 322 | paintings_pane_->UpdateIndicators(); | ||
| 316 | subway_map_->UpdateIndicators(); | 323 | subway_map_->UpdateIndicators(); |
| 317 | if (panels_panel_ != nullptr) { | 324 | if (panels_panel_ != nullptr) { |
| 318 | panels_panel_->UpdateIndicators(); | 325 | panels_panel_->UpdateIndicators(); |
| diff --git a/src/tracker_frame.h b/src/tracker_frame.h index 9aff0a5..4f1f464 100644 --- a/src/tracker_frame.h +++ b/src/tracker_frame.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include "updater.h" | 13 | #include "updater.h" |
| 14 | 14 | ||
| 15 | class AchievementsPane; | 15 | class AchievementsPane; |
| 16 | class PaintingsPane; | ||
| 16 | class SubwayMap; | 17 | class SubwayMap; |
| 17 | class TrackerPanel; | 18 | class TrackerPanel; |
| 18 | class wxBookCtrlEvent; | 19 | class wxBookCtrlEvent; |
| @@ -90,6 +91,7 @@ class TrackerFrame : public wxFrame { | |||
| 90 | wxNotebook *notebook_; | 91 | wxNotebook *notebook_; |
| 91 | TrackerPanel *tracker_panel_; | 92 | TrackerPanel *tracker_panel_; |
| 92 | AchievementsPane *achievements_pane_; | 93 | AchievementsPane *achievements_pane_; |
| 94 | PaintingsPane *paintings_pane_; | ||
| 93 | SubwayMap *subway_map_; | 95 | SubwayMap *subway_map_; |
| 94 | TrackerPanel *panels_panel_ = nullptr; | 96 | TrackerPanel *panels_panel_ = nullptr; |
| 95 | 97 | ||
