diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ap_state.cpp | 7 | ||||
-rw-r--r-- | src/ap_state.h | 2 | ||||
-rw-r--r-- | src/subway_map.cpp | 54 |
3 files changed, 40 insertions, 23 deletions
diff --git a/src/ap_state.cpp b/src/ap_state.cpp index 0c75eae..0ce4582 100644 --- a/src/ap_state.cpp +++ b/src/ap_state.cpp | |||
@@ -70,6 +70,7 @@ struct APState { | |||
70 | bool sunwarp_shuffle = false; | 70 | bool sunwarp_shuffle = false; |
71 | 71 | ||
72 | std::map<std::string, std::string> painting_mapping; | 72 | std::map<std::string, std::string> painting_mapping; |
73 | std::set<std::string> painting_codomain; | ||
73 | std::map<int, SunwarpMapping> sunwarp_mapping; | 74 | std::map<int, SunwarpMapping> sunwarp_mapping; |
74 | 75 | ||
75 | void Connect(std::string server, std::string player, std::string password) { | 76 | void Connect(std::string server, std::string player, std::string password) { |
@@ -137,6 +138,7 @@ struct APState { | |||
137 | color_shuffle = false; | 138 | color_shuffle = false; |
138 | painting_shuffle = false; | 139 | painting_shuffle = false; |
139 | painting_mapping.clear(); | 140 | painting_mapping.clear(); |
141 | painting_codomain.clear(); | ||
140 | mastery_requirement = 21; | 142 | mastery_requirement = 21; |
141 | level_2_requirement = 223; | 143 | level_2_requirement = 223; |
142 | location_checks = kNORMAL_LOCATIONS; | 144 | location_checks = kNORMAL_LOCATIONS; |
@@ -253,6 +255,7 @@ struct APState { | |||
253 | for (const auto& mapping_it : | 255 | for (const auto& mapping_it : |
254 | slot_data["painting_entrance_to_exit"].items()) { | 256 | slot_data["painting_entrance_to_exit"].items()) { |
255 | painting_mapping[mapping_it.key()] = mapping_it.value(); | 257 | painting_mapping[mapping_it.key()] = mapping_it.value(); |
258 | painting_codomain.insert(mapping_it.value()); | ||
256 | } | 259 | } |
257 | } | 260 | } |
258 | 261 | ||
@@ -510,6 +513,10 @@ const std::map<std::string, std::string>& AP_GetPaintingMapping() { | |||
510 | return GetState().painting_mapping; | 513 | return GetState().painting_mapping; |
511 | } | 514 | } |
512 | 515 | ||
516 | bool AP_IsPaintingMappedTo(const std::string& painting_id) { | ||
517 | return GetState().painting_codomain.count(painting_id); | ||
518 | } | ||
519 | |||
513 | const std::set<std::string>& AP_GetCheckedPaintings() { | 520 | const std::set<std::string>& AP_GetCheckedPaintings() { |
514 | return GetState().GetCheckedPaintings(); | 521 | return GetState().GetCheckedPaintings(); |
515 | } | 522 | } |
diff --git a/src/ap_state.h b/src/ap_state.h index 2769bb8..7af7395 100644 --- a/src/ap_state.h +++ b/src/ap_state.h | |||
@@ -59,6 +59,8 @@ bool AP_IsPaintingShuffle(); | |||
59 | 59 | ||
60 | const std::map<std::string, std::string>& AP_GetPaintingMapping(); | 60 | const std::map<std::string, std::string>& AP_GetPaintingMapping(); |
61 | 61 | ||
62 | bool AP_IsPaintingMappedTo(const std::string& painting_id); | ||
63 | |||
62 | const std::set<std::string>& AP_GetCheckedPaintings(); | 64 | const std::set<std::string>& AP_GetCheckedPaintings(); |
63 | 65 | ||
64 | bool AP_IsPaintingChecked(const std::string& painting_id); | 66 | bool AP_IsPaintingChecked(const std::string& painting_id); |
diff --git a/src/subway_map.cpp b/src/subway_map.cpp index 0beef76..dde817b 100644 --- a/src/subway_map.cpp +++ b/src/subway_map.cpp | |||
@@ -457,7 +457,9 @@ void SubwayMap::OnClickHelp(wxCommandEvent &event) { | |||
457 | "your mouse. Click again to stop.\nHover over a door to see the " | 457 | "your mouse. Click again to stop.\nHover over a door to see the " |
458 | "requirements to open it.\nHover over a warp or active painting to see " | 458 | "requirements to open it.\nHover over a warp or active painting to see " |
459 | "what it is connected to.\nIn painting shuffle, paintings that have not " | 459 | "what it is connected to.\nIn painting shuffle, paintings that have not " |
460 | "yet been checked will not show their connections.\nClick on a door or " | 460 | "yet been checked will not show their connections.\nA green shaded owl " |
461 | "means that there is a painting entrance there.\nA red shaded owl means " | ||
462 | "that there are only painting exits there.\nClick on a door or " | ||
461 | "warp to make the popup stick until you click again.", | 463 | "warp to make the popup stick until you click again.", |
462 | "Subway Map Help"); | 464 | "Subway Map Help"); |
463 | } | 465 | } |
@@ -468,28 +470,19 @@ void SubwayMap::Redraw() { | |||
468 | wxMemoryDC dc; | 470 | wxMemoryDC dc; |
469 | dc.SelectObject(rendered_); | 471 | dc.SelectObject(rendered_); |
470 | 472 | ||
473 | wxGCDC gcdc(dc); | ||
474 | |||
471 | for (const SubwayItem &subway_item : GD_GetSubwayItems()) { | 475 | for (const SubwayItem &subway_item : GD_GetSubwayItems()) { |
472 | ItemDrawType draw_type = ItemDrawType::kNone; | 476 | ItemDrawType draw_type = ItemDrawType::kNone; |
473 | const wxBrush *brush_color = wxGREY_BRUSH; | 477 | const wxBrush *brush_color = wxGREY_BRUSH; |
474 | std::optional<wxColour> shade_color; | 478 | std::optional<wxColour> shade_color; |
475 | 479 | ||
476 | if (subway_item.door) { | 480 | if (!subway_item.paintings.empty()) { |
477 | draw_type = ItemDrawType::kBox; | ||
478 | |||
479 | if (IsDoorOpen(*subway_item.door)) { | ||
480 | if (!subway_item.paintings.empty()) { | ||
481 | draw_type = ItemDrawType::kOwl; | ||
482 | } else { | ||
483 | brush_color = wxGREEN_BRUSH; | ||
484 | } | ||
485 | } else { | ||
486 | brush_color = wxRED_BRUSH; | ||
487 | } | ||
488 | } else if (!subway_item.paintings.empty()) { | ||
489 | if (AP_IsPaintingShuffle()) { | 481 | if (AP_IsPaintingShuffle()) { |
490 | bool has_checked_painting = false; | 482 | bool has_checked_painting = false; |
491 | bool has_unchecked_painting = false; | 483 | bool has_unchecked_painting = false; |
492 | bool has_mapped_painting = false; | 484 | bool has_mapped_painting = false; |
485 | bool has_codomain_painting = false; | ||
493 | 486 | ||
494 | for (const std::string &painting_id : subway_item.paintings) { | 487 | for (const std::string &painting_id : subway_item.paintings) { |
495 | if (checked_paintings_.count(painting_id)) { | 488 | if (checked_paintings_.count(painting_id)) { |
@@ -497,26 +490,36 @@ void SubwayMap::Redraw() { | |||
497 | 490 | ||
498 | if (AP_GetPaintingMapping().count(painting_id)) { | 491 | if (AP_GetPaintingMapping().count(painting_id)) { |
499 | has_mapped_painting = true; | 492 | has_mapped_painting = true; |
493 | } else if (AP_IsPaintingMappedTo(painting_id)) { | ||
494 | has_codomain_painting = true; | ||
500 | } | 495 | } |
501 | } else { | 496 | } else { |
502 | has_unchecked_painting = true; | 497 | has_unchecked_painting = true; |
503 | } | 498 | } |
504 | } | 499 | } |
505 | 500 | ||
506 | if (has_unchecked_painting || has_mapped_painting) { | 501 | if (has_unchecked_painting || has_mapped_painting || has_codomain_painting) { |
507 | draw_type = ItemDrawType::kOwl; | 502 | draw_type = ItemDrawType::kOwl; |
508 | 503 | ||
509 | if (has_unchecked_painting) { | 504 | if (has_checked_painting) { |
510 | if (has_checked_painting) { | 505 | if (has_mapped_painting) { |
511 | shade_color = wxColour(255, 255, 0, 100); | 506 | shade_color = wxColour(0, 255, 0, 128); |
512 | } else { | 507 | } else { |
513 | shade_color = wxColour(100, 100, 100, 100); | 508 | shade_color = wxColour(255, 0, 0, 128); |
514 | } | 509 | } |
515 | } | 510 | } |
516 | } | 511 | } |
517 | } else if (!subway_item.tags.empty()) { | 512 | } else if (!subway_item.tags.empty()) { |
518 | draw_type = ItemDrawType::kOwl; | 513 | draw_type = ItemDrawType::kOwl; |
519 | } | 514 | } |
515 | } else if (subway_item.door) { | ||
516 | draw_type = ItemDrawType::kBox; | ||
517 | |||
518 | if (IsDoorOpen(*subway_item.door)) { | ||
519 | brush_color = wxGREEN_BRUSH; | ||
520 | } else { | ||
521 | brush_color = wxRED_BRUSH; | ||
522 | } | ||
520 | } | 523 | } |
521 | 524 | ||
522 | wxPoint real_area_pos = {subway_item.x, subway_item.y}; | 525 | wxPoint real_area_pos = {subway_item.x, subway_item.y}; |
@@ -525,13 +528,18 @@ void SubwayMap::Redraw() { | |||
525 | (draw_type == ItemDrawType::kOwl ? OWL_ACTUAL_SIZE : AREA_ACTUAL_SIZE); | 528 | (draw_type == ItemDrawType::kOwl ? OWL_ACTUAL_SIZE : AREA_ACTUAL_SIZE); |
526 | 529 | ||
527 | if (draw_type == ItemDrawType::kBox) { | 530 | if (draw_type == ItemDrawType::kBox) { |
528 | dc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, 1)); | 531 | gcdc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, 1)); |
529 | dc.SetBrush(*brush_color); | 532 | gcdc.SetBrush(*brush_color); |
530 | dc.DrawRectangle(real_area_pos, {real_area_size, real_area_size}); | 533 | gcdc.DrawRectangle(real_area_pos, {real_area_size, real_area_size}); |
531 | } else if (draw_type == ItemDrawType::kOwl) { | 534 | } else if (draw_type == ItemDrawType::kOwl) { |
532 | wxBitmap owl_bitmap = wxBitmap(owl_image_.Scale( | 535 | wxBitmap owl_bitmap = wxBitmap(owl_image_.Scale( |
533 | real_area_size, real_area_size, wxIMAGE_QUALITY_BILINEAR)); | 536 | real_area_size, real_area_size, wxIMAGE_QUALITY_BILINEAR)); |
534 | dc.DrawBitmap(owl_bitmap, real_area_pos); | 537 | gcdc.DrawBitmap(owl_bitmap, real_area_pos); |
538 | |||
539 | if (shade_color) { | ||
540 | gcdc.SetBrush(wxBrush(*shade_color)); | ||
541 | gcdc.DrawRectangle(real_area_pos, {real_area_size, real_area_size}); | ||
542 | } | ||
535 | } | 543 | } |
536 | } | 544 | } |
537 | } | 545 | } |