From 5436dc4f12671d2605944bed03e1f8ab7853056c Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 8 Mar 2025 16:13:23 -0500 Subject: Added options pane --- src/ap_state.cpp | 15 +++++++++++ src/ap_state.h | 6 +++++ src/options_pane.cpp | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/options_pane.h | 19 ++++++++++++++ src/tracker_frame.cpp | 5 ++++ src/tracker_frame.h | 2 ++ 6 files changed, 118 insertions(+) create mode 100644 src/options_pane.cpp create mode 100644 src/options_pane.h (limited to 'src') diff --git a/src/ap_state.cpp b/src/ap_state.cpp index 01ee065..c3e7f5b 100644 --- a/src/ap_state.cpp +++ b/src/ap_state.cpp @@ -71,6 +71,7 @@ struct APState { DoorShuffleMode door_shuffle_mode = kNO_DOORS; bool group_doors = false; bool color_shuffle = false; + PanelShuffleMode panel_shuffle_mode = kNO_PANELS; bool painting_shuffle = false; int mastery_requirement = 21; int level_2_requirement = 223; @@ -133,6 +134,7 @@ struct APState { door_shuffle_mode = kNO_DOORS; group_doors = false; color_shuffle = false; + panel_shuffle_mode = kNO_PANELS; painting_shuffle = false; painting_mapping.clear(); painting_codomain.clear(); @@ -469,6 +471,7 @@ struct APState { } } color_shuffle = slot_data["shuffle_colors"].get() == 1; + panel_shuffle_mode = slot_data["shuffle_panels"].get(); painting_shuffle = slot_data["shuffle_paintings"].get() == 1; mastery_requirement = slot_data["mastery_achievements"].get(); level_2_requirement = slot_data["level_2_requirement"].get(); @@ -762,6 +765,12 @@ int AP_GetLevel2Requirement() { return GetState().level_2_requirement; } +LocationChecks AP_GetLocationsChecks() { + std::lock_guard state_guard(GetState().state_mutex); + + return GetState().location_checks; +} + bool AP_IsLocationVisible(int classification) { std::lock_guard state_guard(GetState().state_mutex); @@ -789,6 +798,12 @@ bool AP_IsLocationVisible(int classification) { return (world_state & classification); } +PanelShuffleMode AP_GetPanelShuffleMode() { + std::lock_guard state_guard(GetState().state_mutex); + + return GetState().panel_shuffle_mode; +} + VictoryCondition AP_GetVictoryCondition() { std::lock_guard state_guard(GetState().state_mutex); diff --git a/src/ap_state.h b/src/ap_state.h index 8b8db03..298df8c 100644 --- a/src/ap_state.h +++ b/src/ap_state.h @@ -26,6 +26,8 @@ enum LocationChecks { kPANELSANITY = 2 }; +enum PanelShuffleMode { kNO_PANELS = 0, kREARRANGE_PANELS = 1 }; + enum SunwarpAccess { kSUNWARP_ACCESS_NORMAL = 0, kSUNWARP_ACCESS_DISABLED = 1, @@ -88,8 +90,12 @@ int AP_GetMasteryRequirement(); int AP_GetLevel2Requirement(); +LocationChecks AP_GetLocationsChecks(); + bool AP_IsLocationVisible(int classification); +PanelShuffleMode AP_GetPanelShuffleMode(); + VictoryCondition AP_GetVictoryCondition(); bool AP_HasAchievement(const std::string& achievement_name); diff --git a/src/options_pane.cpp b/src/options_pane.cpp new file mode 100644 index 0000000..844e145 --- /dev/null +++ b/src/options_pane.cpp @@ -0,0 +1,71 @@ +#include "options_pane.h" + +#include "ap_state.h" + +namespace { + +const char* kDoorShuffleLabels[] = {"None", "Panels", "Doors"}; +const char* kLocationChecksLabels[] = {"Normal", "Reduced", "Insanity"}; +const char* kPanelShuffleLabels[] = {"None", "Rearrange"}; +const char* kVictoryConditionLabels[] = {"The End", "The Master", "Level 2", + "Pilgrimage"}; +const char* kSunwarpAccessLabels[] = {"Normal", "Disabled", "Unlock", + "Individual", "Progressive"}; + +void AddRow(wxDataViewListCtrl* list, const std::string& text) { + wxVector data; + data.push_back(wxVariant{text + ": "}); + data.push_back(wxVariant{""}); + list->AppendItem(data); +} + +} // namespace + +OptionsPane::OptionsPane(wxWindow* parent) + : wxDataViewListCtrl(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, + wxDV_ROW_LINES) { + AppendTextColumn("Name", wxDATAVIEW_CELL_INERT, wxCOL_WIDTH_AUTOSIZE); + AppendTextColumn("Value"); + AddRow(this, "Shuffle Doors"); + AddRow(this, "Group Doors"); + AddRow(this, "Location Checks"); + AddRow(this, "Shuffle Colors"); + AddRow(this, "Shuffle Panels"); + AddRow(this, "Shuffle Paintings"); + AddRow(this, "Victory Condition"); + AddRow(this, "Early Color Hallways"); + AddRow(this, "Shuffle Postgame"); + AddRow(this, "Enable Pilgrimage"); + AddRow(this, "Pilgrimage Roof Access"); + AddRow(this, "Pilgrimage Paintings"); + AddRow(this, "Sunwarp Access"); + AddRow(this, "Shuffle Sunwarps"); + AddRow(this, "Mastery Achievements"); + AddRow(this, "Level 2 Requirement"); +} + +void OptionsPane::OnConnect() { + SetTextValue(kDoorShuffleLabels[static_cast(AP_GetDoorShuffleMode())], + 0, 1); + SetTextValue(AP_AreDoorsGrouped() ? "Yes" : "No", 1, 1); + SetTextValue( + kLocationChecksLabels[static_cast(AP_GetLocationsChecks())], 2, + 1); + SetTextValue(AP_IsColorShuffle() ? "Yes" : "No", 3, 1); + SetTextValue( + kPanelShuffleLabels[static_cast(AP_GetPanelShuffleMode())], 4, 1); + SetTextValue(AP_IsPaintingShuffle() ? "Yes" : "No", 5, 1); + SetTextValue( + kVictoryConditionLabels[static_cast(AP_GetVictoryCondition())], 6, + 1); + SetTextValue(AP_HasEarlyColorHallways() ? "Yes" : "No", 7, 1); + SetTextValue(AP_IsPostgameShuffle() ? "Yes" : "No", 8, 1); + SetTextValue(AP_IsPilgrimageEnabled() ? "Yes" : "No", 9, 1); + SetTextValue(AP_DoesPilgrimageAllowRoofAccess() ? "Yes" : "No", 10, 1); + SetTextValue(AP_DoesPilgrimageAllowPaintings() ? "Yes" : "No", 11, 1); + SetTextValue(kSunwarpAccessLabels[static_cast(AP_GetSunwarpAccess())], + 12, 1); + SetTextValue(AP_IsSunwarpShuffle() ? "Yes" : "No", 13, 1); + SetTextValue(std::to_string(AP_GetMasteryRequirement()), 14, 1); + SetTextValue(std::to_string(AP_GetLevel2Requirement()), 15, 1); +} diff --git a/src/options_pane.h b/src/options_pane.h new file mode 100644 index 0000000..e9df9f0 --- /dev/null +++ b/src/options_pane.h @@ -0,0 +1,19 @@ +#ifndef OPTIONS_PANE_H_026A0EC0 +#define OPTIONS_PANE_H_026A0EC0 + +#include + +#ifndef WX_PRECOMP +#include +#endif + +#include + +class OptionsPane : public wxDataViewListCtrl { + public: + explicit OptionsPane(wxWindow* parent); + + void OnConnect(); +}; + +#endif /* end of include guard: OPTIONS_PANE_H_026A0EC0 */ diff --git a/src/tracker_frame.cpp b/src/tracker_frame.cpp index 0ab043d..2e7a7d7 100644 --- a/src/tracker_frame.cpp +++ b/src/tracker_frame.cpp @@ -18,6 +18,7 @@ #include "ipc_dialog.h" #include "ipc_state.h" #include "items_pane.h" +#include "options_pane.h" #include "paintings_pane.h" #include "settings_dialog.h" #include "subway_map.h" @@ -127,6 +128,9 @@ TrackerFrame::TrackerFrame() items_pane_ = new ItemsPane(choicebook); choicebook->AddPage(items_pane_, "Items"); + options_pane_ = new OptionsPane(choicebook); + choicebook->AddPage(options_pane_, "Options"); + paintings_pane_ = new PaintingsPane(choicebook); choicebook->AddPage(paintings_pane_, "Paintings"); @@ -301,6 +305,7 @@ void TrackerFrame::OnStateReset(wxCommandEvent &event) { tracker_panel_->UpdateIndicators(); achievements_pane_->UpdateIndicators(); items_pane_->ResetIndicators(); + options_pane_->OnConnect(); paintings_pane_->ResetIndicators(); subway_map_->OnConnect(); if (panels_panel_ != nullptr) { diff --git a/src/tracker_frame.h b/src/tracker_frame.h index e7a3958..3bf0753 100644 --- a/src/tracker_frame.h +++ b/src/tracker_frame.h @@ -15,6 +15,7 @@ class AchievementsPane; class ItemsPane; +class OptionsPane; class PaintingsPane; class SubwayMap; class TrackerPanel; @@ -108,6 +109,7 @@ class TrackerFrame : public wxFrame { TrackerPanel *tracker_panel_; AchievementsPane *achievements_pane_; ItemsPane *items_pane_; + OptionsPane *options_pane_; PaintingsPane *paintings_pane_; SubwayMap *subway_map_; TrackerPanel *panels_panel_ = nullptr; -- cgit 1.4.1