Skip to content

Commit

Permalink
Enable debug draw functions with text
Browse files Browse the repository at this point in the history
  • Loading branch information
TheIndra55 committed Aug 19, 2024
1 parent 6efd22e commit d57e15e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
17 changes: 8 additions & 9 deletions src/modules/Draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,14 @@ void Draw::OnMenu()
{
if (ImGui::BeginMenu("Draw"))
{
#ifndef TR8
ImGui::MenuItem("Draw instances", nullptr, &m_drawInstances);
#ifndef TR8
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
Expand All @@ -82,6 +80,11 @@ void Draw::OnFrame()
auto gameTracker = Game::GetGameTracker();
auto level = gameTracker->level;

// Default font in Underworld is a bit too large
#ifdef TR8
Font::SetScale(0.6f, 0.6f);
#endif

if (m_drawInstances || m_drawEnemyRouting)
{
DrawInstances();
Expand Down Expand Up @@ -167,7 +170,6 @@ void Draw::DrawInstances()

void Draw::DrawInstance(Instance* instance)
{
#ifndef TR8
auto name = instance->object->name;
auto data = (ObjectData*)instance->data;

Expand Down Expand Up @@ -208,6 +210,7 @@ void Draw::DrawInstance(Instance* instance)
font->Print("Family: %d", data->family);
}

#ifndef TR8
// Draw enemy health
if (m_drawHealth && data && data->family == 0xDAF0)
{
Expand All @@ -218,6 +221,7 @@ void Draw::DrawInstance(Instance* instance)
font->SetCursor(position.x, position.y);
font->Print("Health: %g", extraData->m_health.m_hitPoints);
}
#endif

// Draw animations
if (m_drawAnimation)
Expand Down Expand Up @@ -245,7 +249,6 @@ void Draw::DrawInstance(Instance* instance)
}
}
}
#endif
}

void Draw::DrawEnemyRoute(Instance* instance)
Expand Down Expand Up @@ -300,7 +303,6 @@ void Draw::DrawMarkUp()
position += &box->instance->position;
}

#ifndef TR8
TRANS_RotTransPersVectorf(&position, &position);

// Check if the text is on screen
Expand All @@ -309,7 +311,6 @@ void Draw::DrawMarkUp()
font->SetCursor(position.x, position.y);
font->PrintFormatted(FlagsToString(box->flags).c_str());
}
#endif

// Draw the poly line
if (markup->polyLine)
Expand Down Expand Up @@ -410,7 +411,6 @@ void Draw::DrawPortals(Level* level)
position += &portal->max;
position /= 2;

#ifndef TR8
TRANS_RotTransPersVectorf(&position, &position);

// Check if the portal is on screen
Expand All @@ -420,7 +420,6 @@ void Draw::DrawPortals(Level* level)
font->SetCursor(position.x, position.y);
font->PrintCentered("Portal to %s", portal->tolevelname);
}
#endif

// Draw the portal bounds
DrawPlane(&portal->min, &portal->max, RGBA(0, 0, 255, 10));
Expand Down
5 changes: 3 additions & 2 deletions src/modules/MainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,19 @@ void MainMenu::SwitchPlayerCharacter(char* name) noexcept

void MainMenu::OnFrame()
{
#ifndef TR8
// Shows the watermark in th main menu
auto mainState = *(int*)GET_ADDRESS(0x10E5868, 0x838838, 0xE7ED60);

if (mainState == MS_DISPLAY_MAIN_MENU && !m_noWatermark.GetValue())
{
auto font = Font::GetMainFont();

#ifdef TR8
font->SetScale(0.7f, 0.7f);
#endif
font->SetCursor(5.f, 430.f);
font->Print("TRLAU-Menu-Hook");
}
#endif
}

void MainMenu::OnLoop()
Expand Down

0 comments on commit d57e15e

Please sign in to comment.