Skip to content

Conversation

@Flactine
Copy link
Contributor

@Flactine Flactine commented Dec 10, 2025

Description

This PR improves the Display Damage Numbers feature in the following aspects:


1. Independent Configuration Toggle

The feature depends on:

rulesmd.ini -> [GlobalControls] -> DamageNumbersEnabled = true

If DamageNumbersEnabled is not specified, its value defaults to the value of DebugKeysEnabled.

The initial state of the feature (enabled or disabled when entering a game) is controlled by a dedicated setting in ra2md.ini:

[Phobos]
DisplayDamageNumbers=no   ; Boolean value, determines whether the damage numbers feature is enabled by default.

2. Sign Display Adjustment

Damage number formatting has been updated:

  • Damage taken now displays as a negative value with “-” prefix

    • Example: -35
  • Healing now displays as a positive value with “+” prefix

    • Example: +50

This change avoids visual ambiguity when multiple numbers appear close together — for example:

50 50 could previously be misread as 5050.


3. Suppress damage number display for individual warheads

Introduces a new optional flag for WarheadType, allowing modders to suppress the display of damage numbers on a per-warhead basis.
By setting HiddenDamageNumbers=true on a warhead, any damage dealt by that warhead will not generate floating damage numbers, regardless of the global or player-enabled settings.

[SOMEWARHEAD]            ; WarheadType
HiddenDamageNumbers=false  ; boolean

本次改动对“显示伤害数字(Display Damage Numbers)”功能进行了优化与完善,主要包含以下三点:

1. 独立配置开关

“显示伤害数字”功能依赖
rulesmd.ini -> [GlobalControls] -> DamageNumbersEnabled = true 才可使用。

若未指定DamageNumbersEnabled的值,则其默认值与DebugKeysEnabled相同。

该功能在游戏开始时的默认状态由 ra2md.ini 的 Phobos 配置决定:

[Phobos]
DisplayDamageNumbers=no			; 布尔值,控制是否默认启用伤害数字显示功能

2. 数字正负号规则调整

调整伤害数值的显示逻辑:

  • 受伤:显示负数(前缀“-”)

    • 示例:-35
  • 治疗:显示正数(前缀“+”)

    • 示例:+50

此改动可有效避免多个数字紧密排列时被误认成单一数值的情况,例如:
50 50 容易被视觉上误读为 5050


3. 在弹头上禁用伤害数字显示

WarheadType引入了一个新的可选标志,允许为每个弹头单独设置是否显示损伤数字。
通过在弹头上设置“HiddenDamageNumbers=true”,该弹头所造成的任何伤害将不会产生浮动伤害数字,无论全局或玩家启用设置如何。

[SOMEWARHEAD]            ; WarheadType
HiddenDamageNumbers=false  ; boolean

65874019-63f2-4d2f-a618-6fddc85f5afd

@github-actions
Copy link

github-actions bot commented Dec 10, 2025

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

@Speederovsky
Copy link

Speederovsky commented Dec 10, 2025

Keep the DebugKeysEnabled tag under GlobalControls too, with a priority.

Copy link
Contributor

@Coronia Coronia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need to draw 2 texts I think, DrawText function allow you to choose a TextPrintType other than NoShadow, so you could try with other options for a text with shadow (search TextPrintType in Phobos to see how it's been defined and used). Drawing 2 texts would be a bit perf costy considering this will be displayed frequently

Also this shouldn't overwrite the existing DebugKeyEnable function. It should be done in a way that DebugKeyEnable can still enable or disable it, but would be overwritten by DisplayDamageNumbers

DeathFishAtEase and others added 3 commits December 12, 2025 17:34
Jump positioning issue with duplicate headings (anchor)
If `DamageNumbersEnabled` is not specified, its value defaults to the value of `DebugKeysEnabled`.
@Flactine Flactine requested a review from Coronia December 12, 2025 10:11
@Flactine
Copy link
Contributor Author

Flactine commented Dec 12, 2025

There's no need to draw 2 texts I think, DrawText function allow you to choose a TextPrintType other than NoShadow, so you could try with other options for a text with shadow (search TextPrintType in Phobos to see how it's been defined and used). Drawing 2 texts would be a bit perf costy considering this will be displayed frequently

Also this shouldn't overwrite the existing DebugKeyEnable function. It should be done in a way that DebugKeyEnable can still enable or disable it, but would be overwritten by DisplayDamageNumbers

Thanks for the suggestion!
I tested the built-in shadow types like FullShadow, but unfortunately most of them don’t look very good in this context. Since this PR’s focus is mainly on moving damage numbers from a debug-only feature to a proper UI visual option, I think it’s better not to expand the scope into UI/visual optimization at this stage. So for now I’ve reverted to using NoShadow, keeping the text rendering consistent with the previous behavior.

And now, DamageNumbersEnabled will use DebugKeysEnabled as the default value.

感谢您的建议!
刚才测试了几个文字效果,比如FullShadow,但它们的效果都不是很好看。这个PR的主要目的是将“伤害显示从 Debug 功能转为 UI 视觉效果”,所以我觉得在该PR中,可能暂时无需改变其视觉效果。现在恢复了使用NoShadow单层文字的默认值。

另外,修改了DamageNumbersEnabled 的默认值,若未填写DamageNumbersEnabled,则该功能将与DebugKeysEnabled保持一致。

注:DamageNumbersEnabled是该功能的总开关,它的作用是决定该功能的启用/禁用,若禁用则无法在游戏里用快捷键打开,若启用,才会在下一步检查DisplayDamageNumbers的值;
DisplayDamageNumbers的作用是决定游戏开始时,该功能是处于关闭(可用快捷键手动打开)状态,还是处于打开(可手动关闭)状态。

@NetsuNegi
Copy link
Contributor

NetsuNegi commented Dec 12, 2025

There's no need to draw 2 texts I think, DrawText function allow you to choose a TextPrintType other than NoShadow, so you could try with other options for a text with shadow (search TextPrintType in Phobos to see how it's been defined and used). Drawing 2 texts would be a bit perf costy considering this will be displayed frequently
Also this shouldn't overwrite the existing DebugKeyEnable function. It should be done in a way that DebugKeyEnable can still enable or disable it, but would be overwritten by DisplayDamageNumbers

Thanks for the suggestion! I tested the built-in shadow types like FullShadow, but unfortunately most of them don’t look very good in this context. Since this PR’s focus is mainly on moving damage numbers from a debug-only feature to a proper UI visual option, I think it’s better not to expand the scope into UI/visual optimization at this stage. So for now I’ve reverted to using NoShadow, keeping the text rendering consistent with the previous behavior.

And now, DamageNumbersEnabled will use DebugKeysEnabled as the default value.

感谢您的建议! 刚才测试了几个文字效果,比如FullShadow,但它们的效果都不是很好看。这个PR的主要目的是将“伤害显示从 Debug 功能转为 UI 视觉效果”,所以我觉得在该PR中,可能暂时无需改变其视觉效果。现在恢复了使用NoShadow单层文字的默认值。

另外,修改了DamageNumbersEnabled 的默认值,若未填写DamageNumbersEnabled,则该功能将与DebugKeysEnabled保持一致。

注:DamageNumbersEnabled是该功能的总开关,它的作用是决定该功能的启用/禁用,若禁用则无法在游戏里用快捷键打开,若启用,才会在下一步检查DisplayDamageNumbers的值; 而DisplayDamageNumbers的作用是决定游戏开始时,该功能是处于关闭(可用快捷键手动打开)状态,还是处于打开(可手动关闭)状态。

actually, idk there has any thing different either use FullShadow or not. It looks like totally same
实际上,我不知道用不用FullShadow有什么区别。看起来是完全一样的

@NetsuNegi
Copy link
Contributor

There's no need to draw 2 texts I think, DrawText function allow you to choose a TextPrintType other than NoShadow, so you could try with other options for a text with shadow (search TextPrintType in Phobos to see how it's been defined and used). Drawing 2 texts would be a bit perf costy considering this will be displayed frequently
Also this shouldn't overwrite the existing DebugKeyEnable function. It should be done in a way that DebugKeyEnable can still enable or disable it, but would be overwritten by DisplayDamageNumbers

Thanks for the suggestion! I tested the built-in shadow types like FullShadow, but unfortunately most of them don’t look very good in this context. Since this PR’s focus is mainly on moving damage numbers from a debug-only feature to a proper UI visual option, I think it’s better not to expand the scope into UI/visual optimization at this stage. So for now I’ve reverted to using NoShadow, keeping the text rendering consistent with the previous behavior.
And now, DamageNumbersEnabled will use DebugKeysEnabled as the default value.
感谢您的建议! 刚才测试了几个文字效果,比如FullShadow,但它们的效果都不是很好看。这个PR的主要目的是将“伤害显示从 Debug 功能转为 UI 视觉效果”,所以我觉得在该PR中,可能暂时无需改变其视觉效果。现在恢复了使用NoShadow单层文字的默认值。
另外,修改了DamageNumbersEnabled 的默认值,若未填写DamageNumbersEnabled,则该功能将与DebugKeysEnabled保持一致。
注:DamageNumbersEnabled是该功能的总开关,它的作用是决定该功能的启用/禁用,若禁用则无法在游戏里用快捷键打开,若启用,才会在下一步检查DisplayDamageNumbers的值; 而DisplayDamageNumbers的作用是决定游戏开始时,该功能是处于关闭(可用快捷键手动打开)状态,还是处于打开(可手动关闭)状态。

actually, idk there has any thing different either use FullShadow or not. It looks like totally same

There's no need to draw 2 texts I think, DrawText function allow you to choose a TextPrintType other than NoShadow, so you could try with other options for a text with shadow (search TextPrintType in Phobos to see how it's been defined and used). Drawing 2 texts would be a bit perf costy considering this will be displayed frequently
Also this shouldn't overwrite the existing DebugKeyEnable function. It should be done in a way that DebugKeyEnable can still enable or disable it, but would be overwritten by DisplayDamageNumbers

Thanks for the suggestion! I tested the built-in shadow types like FullShadow, but unfortunately most of them don’t look very good in this context. Since this PR’s focus is mainly on moving damage numbers from a debug-only feature to a proper UI visual option, I think it’s better not to expand the scope into UI/visual optimization at this stage. So for now I’ve reverted to using NoShadow, keeping the text rendering consistent with the previous behavior.
And now, DamageNumbersEnabled will use DebugKeysEnabled as the default value.
感谢您的建议! 刚才测试了几个文字效果,比如FullShadow,但它们的效果都不是很好看。这个PR的主要目的是将“伤害显示从 Debug 功能转为 UI 视觉效果”,所以我觉得在该PR中,可能暂时无需改变其视觉效果。现在恢复了使用NoShadow单层文字的默认值。
另外,修改了DamageNumbersEnabled 的默认值,若未填写DamageNumbersEnabled,则该功能将与DebugKeysEnabled保持一致。
注:DamageNumbersEnabled是该功能的总开关,它的作用是决定该功能的启用/禁用,若禁用则无法在游戏里用快捷键打开,若启用,才会在下一步检查DisplayDamageNumbers的值; 而DisplayDamageNumbers的作用是决定游戏开始时,该功能是处于关闭(可用快捷键手动打开)状态,还是处于打开(可手动关闭)状态。

actually, idk there has any thing different either use FullShadow or not. It looks like totally same 实际上,我不知道用不用FullShadow有什么区别。看起来是完全一样的

other options about shadow is same
其他有关阴影的选项也是一样

@Flactine
Copy link
Contributor Author

There's no need to draw 2 texts I think, DrawText function allow you to choose a TextPrintType other than NoShadow, so you could try with other options for a text with shadow (search TextPrintType in Phobos to see how it's been defined and used). Drawing 2 texts would be a bit perf costy considering this will be displayed frequently
Also this shouldn't overwrite the existing DebugKeyEnable function. It should be done in a way that DebugKeyEnable can still enable or disable it, but would be overwritten by DisplayDamageNumbers

Thanks for the suggestion! I tested the built-in shadow types like FullShadow, but unfortunately most of them don’t look very good in this context. Since this PR’s focus is mainly on moving damage numbers from a debug-only feature to a proper UI visual option, I think it’s better not to expand the scope into UI/visual optimization at this stage. So for now I’ve reverted to using NoShadow, keeping the text rendering consistent with the previous behavior.
And now, DamageNumbersEnabled will use DebugKeysEnabled as the default value.
感谢您的建议! 刚才测试了几个文字效果,比如FullShadow,但它们的效果都不是很好看。这个PR的主要目的是将“伤害显示从 Debug 功能转为 UI 视觉效果”,所以我觉得在该PR中,可能暂时无需改变其视觉效果。现在恢复了使用NoShadow单层文字的默认值。
另外,修改了DamageNumbersEnabled 的默认值,若未填写DamageNumbersEnabled,则该功能将与DebugKeysEnabled保持一致。
注:DamageNumbersEnabled是该功能的总开关,它的作用是决定该功能的启用/禁用,若禁用则无法在游戏里用快捷键打开,若启用,才会在下一步检查DisplayDamageNumbers的值; 而DisplayDamageNumbers的作用是决定游戏开始时,该功能是处于关闭(可用快捷键手动打开)状态,还是处于打开(可手动关闭)状态。

actually, idk there has any thing different either use FullShadow or not. It looks like totally same 实际上,我不知道用不用FullShadow有什么区别。看起来是完全一样的

FullShadow似乎还要带其他参数,比如:
It seems that FullShadow also needs to take other parameters, such as:
const TextPrintType printType = TextPrintType::Background | TextPrintType::FullShadow | TextPrintType::Point8;

af1161cc-1679-4132-ae76-86205b2f623e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants