diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-06-06 14:35:57 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-06-06 14:35:57 -0400 |
commit | b84a5401359a442b2dff14599f80d47626290fa1 (patch) | |
tree | 0af48315e4d221e45846424e2946ef194eab5887 /src/subway_map.cpp | |
parent | 973179a841e98c55a56a977634891ba592d2e2be (diff) | |
download | lingo-ap-tracker-b84a5401359a442b2dff14599f80d47626290fa1.tar.gz lingo-ap-tracker-b84a5401359a442b2dff14599f80d47626290fa1.tar.bz2 lingo-ap-tracker-b84a5401359a442b2dff14599f80d47626290fa1.zip |
Shade owls to indicate entrance/exit
Diffstat (limited to 'src/subway_map.cpp')
-rw-r--r-- | src/subway_map.cpp | 54 |
1 files changed, 31 insertions, 23 deletions
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 | } |