Skip to content

Commit

Permalink
Add signal drawing for Underworld
Browse files Browse the repository at this point in the history
  • Loading branch information
TheIndra55 committed Aug 11, 2024
1 parent d5b8a9f commit 8f411b6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
15 changes: 13 additions & 2 deletions src/level/Level.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,25 @@ struct IndexedFace

struct SignalFace
{
#ifndef TR8
unsigned __int16 i0;
unsigned __int16 i1;
unsigned __int16 i2;

char adjacencyFlags;
char collisionFlags;
unsigned __int8 adjacencyFlags;
unsigned __int8 collisionFlags;

unsigned __int16 id;
#else
unsigned int i0;
unsigned int i1;
unsigned int i2;

unsigned __int8 adjacencyFlags;
unsigned __int8 collisionFlags;

unsigned __int16 id;
#endif
};

struct MeshVertex16
Expand Down
16 changes: 10 additions & 6 deletions src/modules/Draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,19 @@ void Draw::OnMenu()
{
if (ImGui::BeginMenu("Draw"))
{
#ifndef TR8
ImGui::MenuItem("Draw instances", nullptr, &m_drawInstances);
ImGui::MenuItem("Draw markup", nullptr, &m_drawMarkUp);
ImGui::MenuItem("Draw enemy route", nullptr, &m_drawEnemyRouting);
#endif

ImGui::MenuItem("Draw markup", nullptr, &m_drawMarkUp);
ImGui::MenuItem("Draw collision", nullptr, &m_drawCollision);
ImGui::MenuItem("Draw portals", nullptr, &m_drawPortals);
ImGui::MenuItem("Draw signals", nullptr, &m_drawSignals);

#ifdef TR8
ImGui::MenuItem("Draw triggers", nullptr, &m_drawTriggers);
#endif

ImGui::EndMenu();
}
Expand Down Expand Up @@ -417,7 +423,6 @@ void Draw::DrawPortals(Level* level)

void Draw::DrawSignals(Level* level)
{
#ifndef TR8
auto terrain = level->terrain;
auto terrainGroup = terrain->signalTerrainGroup;

Expand All @@ -435,14 +440,13 @@ void Draw::DrawSignals(Level* level)
auto face = (SignalFace*)&mesh->m_faces[i];

// Get the position of every vertice in world coordinates
auto x = GetVertice<MeshVertex32>(face->i0, mesh, &mesh->m_position);
auto y = GetVertice<MeshVertex32>(face->i1, mesh, &mesh->m_position);
auto z = GetVertice<MeshVertex32>(face->i2, mesh, &mesh->m_position);
auto x = GetVertice(face->i0, mesh, &mesh->m_position);
auto y = GetVertice(face->i1, mesh, &mesh->m_position);
auto z = GetVertice(face->i2, mesh, &mesh->m_position);

// Draw the face
DrawTriangle(&x, &y, &z, RGBA(255, 0, 0, 10));
}
#endif
}

void Draw::DrawTriggers()
Expand Down

0 comments on commit 8f411b6

Please sign in to comment.