about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-07-16 01:19:02 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2024-07-16 01:19:02 -0400
commit2bf1b2abf0e90da14080573d7270cca62b2815f0 (patch)
tree417dec725b4ca086145397edaa125df19a7119c0 /src
parent52bc9fdf99d452c592e174acd9cb174ec00e19d7 (diff)
downloadlingo-ap-tracker-2bf1b2abf0e90da14080573d7270cca62b2815f0.tar.gz
lingo-ap-tracker-2bf1b2abf0e90da14080573d7270cca62b2815f0.tar.bz2
lingo-ap-tracker-2bf1b2abf0e90da14080573d7270cca62b2815f0.zip
Display correct sunwarp doors when shuffled
Diffstat (limited to 'src')
-rw-r--r--src/subway_map.cpp33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/subway_map.cpp b/src/subway_map.cpp index e3b844d..044e6fa 100644 --- a/src/subway_map.cpp +++ b/src/subway_map.cpp
@@ -16,6 +16,29 @@ constexpr int OWL_ACTUAL_SIZE = 32;
16 16
17enum class ItemDrawType { kNone, kBox, kOwl }; 17enum class ItemDrawType { kNone, kBox, kOwl };
18 18
19namespace {
20
21std::optional<int> GetRealSubwayDoor(const SubwayItem subway_item) {
22 std::optional<int> subway_door = subway_item.door;
23 if (AP_IsSunwarpShuffle() && subway_item.sunwarp &&
24 subway_item.sunwarp->type != SubwaySunwarpType::kFinal) {
25 int sunwarp_index = subway_item.sunwarp->dots - 1;
26 if (subway_item.sunwarp->type == SubwaySunwarpType::kExit) {
27 sunwarp_index += 6;
28 }
29
30 for (const auto &[start_index, mapping] : AP_GetSunwarpMapping()) {
31 if (start_index == sunwarp_index || mapping.exit_index == sunwarp_index) {
32 subway_door = GD_GetSunwarpDoors().at(mapping.dots - 1);
33 }
34 }
35
36 return subway_door;
37 }
38}
39
40} // namespace
41
19SubwayMap::SubwayMap(wxWindow *parent) : wxPanel(parent, wxID_ANY) { 42SubwayMap::SubwayMap(wxWindow *parent) : wxPanel(parent, wxID_ANY) {
20 SetBackgroundStyle(wxBG_STYLE_PAINT); 43 SetBackgroundStyle(wxBG_STYLE_PAINT);
21 44
@@ -267,9 +290,11 @@ void SubwayMap::OnPaint(wxPaintEvent &event) {
267 // Note that these requirements are duplicated on OnMouseClick so that it 290 // Note that these requirements are duplicated on OnMouseClick so that it
268 // knows when an item has a hover effect. 291 // knows when an item has a hover effect.
269 const SubwayItem &subway_item = GD_GetSubwayItem(*hovered_item_); 292 const SubwayItem &subway_item = GD_GetSubwayItem(*hovered_item_);
270 if (subway_item.door && !GetDoorRequirements(*subway_item.door).empty()) { 293 std::optional<int> subway_door = GetRealSubwayDoor(subway_item);
294
295 if (subway_door && !GetDoorRequirements(*subway_door).empty()) {
271 const std::map<std::string, bool> &report = 296 const std::map<std::string, bool> &report =
272 GetDoorRequirements(*subway_item.door); 297 GetDoorRequirements(*subway_door);
273 298
274 int acc_height = 10; 299 int acc_height = 10;
275 int col_width = 0; 300 int col_width = 0;
@@ -450,7 +475,9 @@ void SubwayMap::OnMouseClick(wxMouseEvent &event) {
450 475
451 if (actual_hover_) { 476 if (actual_hover_) {
452 const SubwayItem &subway_item = GD_GetSubwayItem(*actual_hover_); 477 const SubwayItem &subway_item = GD_GetSubwayItem(*actual_hover_);
453 if ((subway_item.door && !GetDoorRequirements(*subway_item.door).empty()) || 478 std::optional<int> subway_door = GetRealSubwayDoor(subway_item);
479
480 if ((subway_door && !GetDoorRequirements(*subway_door).empty()) ||
454 networks_.IsItemInNetwork(*hovered_item_)) { 481 networks_.IsItemInNetwork(*hovered_item_)) {
455 if (actual_hover_ != hovered_item_) { 482 if (actual_hover_ != hovered_item_) {
456 hovered_item_ = actual_hover_; 483 hovered_item_ = actual_hover_;