diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-03-11 17:49:13 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-03-11 17:49:13 -0400 |
commit | 009cfbee0c28bb9c80e305de4a9c430350d6dde6 (patch) | |
tree | 18f06b090d2fd749aa5c653ce28977a945a815e0 /src | |
parent | 8ad881fed6e388f7a254350532ce58552ef47a1d (diff) | |
download | lingo-ap-tracker-009cfbee0c28bb9c80e305de4a9c430350d6dde6.tar.gz lingo-ap-tracker-009cfbee0c28bb9c80e305de4a9c430350d6dde6.tar.bz2 lingo-ap-tracker-009cfbee0c28bb9c80e305de4a9c430350d6dde6.zip |
Handled tilted subway items
Diffstat (limited to 'src')
-rw-r--r-- | src/game_data.cpp | 4 | ||||
-rw-r--r-- | src/game_data.h | 1 | ||||
-rw-r--r-- | src/subway_map.cpp | 13 |
3 files changed, 17 insertions, 1 deletions
diff --git a/src/game_data.cpp b/src/game_data.cpp index 8ccc0da..a4a441d 100644 --- a/src/game_data.cpp +++ b/src/game_data.cpp | |||
@@ -828,6 +828,10 @@ struct GameData { | |||
828 | subway_item.special = subway_it["special"].as<std::string>(); | 828 | subway_item.special = subway_it["special"].as<std::string>(); |
829 | } | 829 | } |
830 | 830 | ||
831 | if (subway_it["tilted"]) { | ||
832 | subway_item.tilted = subway_it["tilted"].as<bool>(); | ||
833 | } | ||
834 | |||
831 | subway_items_.push_back(subway_item); | 835 | subway_items_.push_back(subway_item); |
832 | } | 836 | } |
833 | 837 | ||
diff --git a/src/game_data.h b/src/game_data.h index be10900..24760de 100644 --- a/src/game_data.h +++ b/src/game_data.h | |||
@@ -156,6 +156,7 @@ struct SubwayItem { | |||
156 | int id; | 156 | int id; |
157 | int x; | 157 | int x; |
158 | int y; | 158 | int y; |
159 | bool tilted = false; | ||
159 | std::optional<int> door; | 160 | std::optional<int> door; |
160 | std::optional<std::string> painting; | 161 | std::optional<std::string> painting; |
161 | std::vector<std::string> tags; // 2-way teleports | 162 | std::vector<std::string> tags; // 2-way teleports |
diff --git a/src/subway_map.cpp b/src/subway_map.cpp index f00f03f..94292fd 100644 --- a/src/subway_map.cpp +++ b/src/subway_map.cpp | |||
@@ -611,7 +611,18 @@ void SubwayMap::Redraw() { | |||
611 | if (draw_type == ItemDrawType::kBox) { | 611 | if (draw_type == ItemDrawType::kBox) { |
612 | gcdc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, 1)); | 612 | gcdc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, 1)); |
613 | gcdc.SetBrush(*brush_color); | 613 | gcdc.SetBrush(*brush_color); |
614 | gcdc.DrawRectangle(real_area_pos, {real_area_size, real_area_size}); | 614 | |
615 | if (subway_item.tilted) { | ||
616 | constexpr int AREA_TILTED_SIDE = | ||
617 | static_cast<int>(AREA_ACTUAL_SIZE / 1.41421356237); | ||
618 | const wxPoint poly_points[] = {{AREA_TILTED_SIDE, 0}, | ||
619 | {2 * AREA_TILTED_SIDE, AREA_TILTED_SIDE}, | ||
620 | {AREA_TILTED_SIDE, 2 * AREA_TILTED_SIDE}, | ||
621 | {0, AREA_TILTED_SIDE}}; | ||
622 | gcdc.DrawPolygon(4, poly_points, subway_item.x, subway_item.y); | ||
623 | } else { | ||
624 | gcdc.DrawRectangle(real_area_pos, {real_area_size, real_area_size}); | ||
625 | } | ||
615 | } else if (draw_type == ItemDrawType::kOwl || draw_type == ItemDrawType::kOwlExit) { | 626 | } else if (draw_type == ItemDrawType::kOwl || draw_type == ItemDrawType::kOwlExit) { |
616 | gcdc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, 1)); | 627 | gcdc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, 1)); |
617 | gcdc.SetBrush(*brush_color); | 628 | gcdc.SetBrush(*brush_color); |