From b84a5401359a442b2dff14599f80d47626290fa1 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 6 Jun 2024 14:35:57 -0400 Subject: Shade owls to indicate entrance/exit --- src/subway_map.cpp | 54 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 23 deletions(-) (limited to 'src/subway_map.cpp') 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) { "your mouse. Click again to stop.\nHover over a door to see the " "requirements to open it.\nHover over a warp or active painting to see " "what it is connected to.\nIn painting shuffle, paintings that have not " - "yet been checked will not show their connections.\nClick on a door or " + "yet been checked will not show their connections.\nA green shaded owl " + "means that there is a painting entrance there.\nA red shaded owl means " + "that there are only painting exits there.\nClick on a door or " "warp to make the popup stick until you click again.", "Subway Map Help"); } @@ -468,28 +470,19 @@ void SubwayMap::Redraw() { wxMemoryDC dc; dc.SelectObject(rendered_); + wxGCDC gcdc(dc); + for (const SubwayItem &subway_item : GD_GetSubwayItems()) { ItemDrawType draw_type = ItemDrawType::kNone; const wxBrush *brush_color = wxGREY_BRUSH; std::optional shade_color; - if (subway_item.door) { - draw_type = ItemDrawType::kBox; - - if (IsDoorOpen(*subway_item.door)) { - if (!subway_item.paintings.empty()) { - draw_type = ItemDrawType::kOwl; - } else { - brush_color = wxGREEN_BRUSH; - } - } else { - brush_color = wxRED_BRUSH; - } - } else if (!subway_item.paintings.empty()) { + if (!subway_item.paintings.empty()) { if (AP_IsPaintingShuffle()) { bool has_checked_painting = false; bool has_unchecked_painting = false; bool has_mapped_painting = false; + bool has_codomain_painting = false; for (const std::string &painting_id : subway_item.paintings) { if (checked_paintings_.count(painting_id)) { @@ -497,26 +490,36 @@ void SubwayMap::Redraw() { if (AP_GetPaintingMapping().count(painting_id)) { has_mapped_painting = true; + } else if (AP_IsPaintingMappedTo(painting_id)) { + has_codomain_painting = true; } } else { has_unchecked_painting = true; } } - if (has_unchecked_painting || has_mapped_painting) { + if (has_unchecked_painting || has_mapped_painting || has_codomain_painting) { draw_type = ItemDrawType::kOwl; - if (has_unchecked_painting) { - if (has_checked_painting) { - shade_color = wxColour(255, 255, 0, 100); + if (has_checked_painting) { + if (has_mapped_painting) { + shade_color = wxColour(0, 255, 0, 128); } else { - shade_color = wxColour(100, 100, 100, 100); + shade_color = wxColour(255, 0, 0, 128); } } } } else if (!subway_item.tags.empty()) { draw_type = ItemDrawType::kOwl; } + } else if (subway_item.door) { + draw_type = ItemDrawType::kBox; + + if (IsDoorOpen(*subway_item.door)) { + brush_color = wxGREEN_BRUSH; + } else { + brush_color = wxRED_BRUSH; + } } wxPoint real_area_pos = {subway_item.x, subway_item.y}; @@ -525,13 +528,18 @@ void SubwayMap::Redraw() { (draw_type == ItemDrawType::kOwl ? OWL_ACTUAL_SIZE : AREA_ACTUAL_SIZE); if (draw_type == ItemDrawType::kBox) { - dc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, 1)); - dc.SetBrush(*brush_color); - dc.DrawRectangle(real_area_pos, {real_area_size, real_area_size}); + gcdc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, 1)); + gcdc.SetBrush(*brush_color); + gcdc.DrawRectangle(real_area_pos, {real_area_size, real_area_size}); } else if (draw_type == ItemDrawType::kOwl) { wxBitmap owl_bitmap = wxBitmap(owl_image_.Scale( real_area_size, real_area_size, wxIMAGE_QUALITY_BILINEAR)); - dc.DrawBitmap(owl_bitmap, real_area_pos); + gcdc.DrawBitmap(owl_bitmap, real_area_pos); + + if (shade_color) { + gcdc.SetBrush(wxBrush(*shade_color)); + gcdc.DrawRectangle(real_area_pos, {real_area_size, real_area_size}); + } } } } -- cgit 1.4.1