Skip to content

Commit

Permalink
pass z plane to custom line from QuestModule
Browse files Browse the repository at this point in the history
  • Loading branch information
DubbleClick committed Jul 27, 2024
1 parent d15ba2c commit c3b5a1c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion GWToolboxdll/Widgets/Minimap/CustomRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,9 @@ bool CustomRenderer::RemoveCustomLine(CustomRenderer::CustomLine* line)

CustomRenderer::CustomLine* CustomRenderer::AddCustomLine(const GW::GamePos& from, const GW::GamePos& to, const char* _name, bool draw_everywhere)
{
const auto line = new CustomLine(GW::Vec3f(from), GW::Vec3f(to), GW::Map::GetMapID(), _name, draw_everywhere);
const auto p1 = GW::Vec3f{from.x, from.y, static_cast<float>(from.zplane)};
const auto p2 = GW::Vec3f{to.x, to.y, static_cast<float>(to.zplane)};
const auto line = new CustomLine(p1, p2, GW::Map::GetMapID(), _name, draw_everywhere);
lines.push_back(line);
markers_changed = true;
return line;
Expand Down
5 changes: 3 additions & 2 deletions GWToolboxdll/Widgets/Minimap/GameWorldRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace {

GameWorldRenderer::GenericPolyRenderable* find_matching_poly(const GameWorldRenderer::GenericPolyRenderable& poly_to_find) {
// Check to see if we've already got this poly plotted; this will save us having to calculate altitude later.
auto found = std::ranges::find_if(renderables, [&poly_to_find](const GameWorldRenderer::GenericPolyRenderable& check) {
const auto found = std::ranges::find_if(renderables, [&poly_to_find](const GameWorldRenderer::GenericPolyRenderable& check) {
if (!(check.map_id == poly_to_find.map_id
&& check.col == poly_to_find.col
&& check.filled == poly_to_find.filled
Expand Down Expand Up @@ -101,7 +101,8 @@ namespace {
// to appear.

// @Cleanup: zplane needs setting properly here!
GW::Map::QueryAltitude({ vertices[i].x, vertices[i].y, 0 }, 5.f, altitude);
const auto z_plane = vertices[i].z == static_cast<int>(vertices[i].z) ? static_cast<unsigned>(vertices[i].z) : 0u; // 0 = unknown
GW::Map::QueryAltitude({ vertices[i].x, vertices[i].y, z_plane}, 5.f, altitude);

if (altitude < vertices[i].z) {
// recall that the Up camera component is inverted
Expand Down

0 comments on commit c3b5a1c

Please sign in to comment.