Skip to content

Commit d57e15e

Browse files
committed
Enable debug draw functions with text
1 parent 6efd22e commit d57e15e

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/modules/Draw.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,14 @@ void Draw::OnMenu()
5959
{
6060
if (ImGui::BeginMenu("Draw"))
6161
{
62-
#ifndef TR8
6362
ImGui::MenuItem("Draw instances", nullptr, &m_drawInstances);
63+
#ifndef TR8
6464
ImGui::MenuItem("Draw enemy route", nullptr, &m_drawEnemyRouting);
6565
#endif
66-
6766
ImGui::MenuItem("Draw markup", nullptr, &m_drawMarkUp);
6867
ImGui::MenuItem("Draw collision", nullptr, &m_drawCollision);
6968
ImGui::MenuItem("Draw portals", nullptr, &m_drawPortals);
7069
ImGui::MenuItem("Draw signals", nullptr, &m_drawSignals);
71-
7270
#ifdef TR8
7371
ImGui::MenuItem("Draw triggers", nullptr, &m_drawTriggers);
7472
#endif
@@ -82,6 +80,11 @@ void Draw::OnFrame()
8280
auto gameTracker = Game::GetGameTracker();
8381
auto level = gameTracker->level;
8482

83+
// Default font in Underworld is a bit too large
84+
#ifdef TR8
85+
Font::SetScale(0.6f, 0.6f);
86+
#endif
87+
8588
if (m_drawInstances || m_drawEnemyRouting)
8689
{
8790
DrawInstances();
@@ -167,7 +170,6 @@ void Draw::DrawInstances()
167170

168171
void Draw::DrawInstance(Instance* instance)
169172
{
170-
#ifndef TR8
171173
auto name = instance->object->name;
172174
auto data = (ObjectData*)instance->data;
173175

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

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

222226
// Draw animations
223227
if (m_drawAnimation)
@@ -245,7 +249,6 @@ void Draw::DrawInstance(Instance* instance)
245249
}
246250
}
247251
}
248-
#endif
249252
}
250253

251254
void Draw::DrawEnemyRoute(Instance* instance)
@@ -300,7 +303,6 @@ void Draw::DrawMarkUp()
300303
position += &box->instance->position;
301304
}
302305

303-
#ifndef TR8
304306
TRANS_RotTransPersVectorf(&position, &position);
305307

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

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

413-
#ifndef TR8
414414
TRANS_RotTransPersVectorf(&position, &position);
415415

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

425424
// Draw the portal bounds
426425
DrawPlane(&portal->min, &portal->max, RGBA(0, 0, 255, 10));

src/modules/MainMenu.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,18 +183,19 @@ void MainMenu::SwitchPlayerCharacter(char* name) noexcept
183183

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

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

193+
#ifdef TR8
194+
font->SetScale(0.7f, 0.7f);
195+
#endif
194196
font->SetCursor(5.f, 430.f);
195197
font->Print("TRLAU-Menu-Hook");
196198
}
197-
#endif
198199
}
199200

200201
void MainMenu::OnLoop()

0 commit comments

Comments
 (0)