Skip to content

Commit

Permalink
overlay: fix demo text overlapping with bottom center enemy bar
Browse files Browse the repository at this point in the history
Resolves #1446.
  • Loading branch information
walkawayy authored and rr- committed Nov 13, 2024
1 parent 23610ed commit d13d2d4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/tr1/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
- fixed being able to shoot the scion multiple times if save/load is used while it blows up (#1819)
- fixed certain erroneous `/play` invocations resulting in duplicated error messages
- fixed the `/play` console command resulting in Lara starting the target level without pistols (#1861, regression from 4.5)
- fixed the demo mode text overlapping with the enemy health bar if the health bar is located in the bottom centered (#1446)
- improved enemy item drops by supporting the TR2+ approach of having drops defined in level data (#1713)
- improved Italian localization for the Config Tool
- improved the injection approach for Lara's responsive jumping (#1823)
Expand Down
15 changes: 11 additions & 4 deletions src/tr1/game/overlay.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ static void M_ResetBarLocations(void);
static void M_RemoveAmmoText(void);
static void M_DrawAmmoInfo(void);
static void M_DrawPickups(void);
static double M_GetBarToTextScale(void);

static void M_BarSetupHealth(void)
{
Expand Down Expand Up @@ -237,19 +238,25 @@ static void M_BarGetLocation(
- m_BarOffsetY[bar_info->location];
}

if (Phase_Get() == PHASE_INVENTORY
if (Phase_Get() == PHASE_DEMO && bar_info->location == BL_BOTTOM_CENTER) {
*y -= M_GetBarToTextScale() * (TEXT_HEIGHT + bar_spacing);
} else if (
Phase_Get() == PHASE_INVENTORY
&& g_CurrentLevel == g_GameFlow.title_level_num
&& (bar_info->location == BL_TOP_CENTER
|| bar_info->location == BL_BOTTOM_CENTER)) {
double scale_bar_to_text =
g_Config.ui.text_scale / g_Config.ui.bar_scale;
*y = screen_margin_v + m_BarOffsetY[bar_info->location]
+ scale_bar_to_text * (TEXT_HEIGHT + bar_spacing);
+ M_GetBarToTextScale() * (TEXT_HEIGHT + bar_spacing);
}

m_BarOffsetY[bar_info->location] += *height + bar_spacing;
}

static double M_GetBarToTextScale(void)
{
return g_Config.ui.text_scale / g_Config.ui.bar_scale;
}

void Overlay_BarDraw(BAR_INFO *bar_info, RENDER_SCALE_REF scale_ref)
{
if (!g_Config.ui.enable_game_ui) {
Expand Down

0 comments on commit d13d2d4

Please sign in to comment.