Improve Damage Number Display Configuration and Readability
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
- Example:
-
Healing now displays as a positive value with “+” prefix
- Example:
+50
- Example:
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
Nightly build for this pull request:
- compiled-dll-d401d71fd5e3a9304fbf5dffc00829c30a2a651a.zip These artifacts will expire in 90 days and will not be available for download after that time.
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.
Keep the DebugKeysEnabled tag under GlobalControls too, with a priority.
There's no need to draw 2 texts I think,
DrawTextfunction allow you to choose aTextPrintTypeother 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 frequentlyAlso this shouldn't overwrite the existing
DebugKeyEnablefunction. It should be done in a way that DebugKeyEnable can still enable or disable it, but would be overwritten byDisplayDamageNumbers
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的作用是决定游戏开始时,该功能是处于关闭(可用快捷键手动打开)状态,还是处于打开(可手动关闭)状态。
There's no need to draw 2 texts I think,
DrawTextfunction allow you to choose aTextPrintTypeother 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 existingDebugKeyEnablefunction. It should be done in a way that DebugKeyEnable can still enable or disable it, but would be overwritten byDisplayDamageNumbersThanks 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,
DamageNumbersEnabledwill useDebugKeysEnabledas 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有什么区别。看起来是完全一样的
There's no need to draw 2 texts I think,
DrawTextfunction allow you to choose aTextPrintTypeother 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 existingDebugKeyEnablefunction. It should be done in a way that DebugKeyEnable can still enable or disable it, but would be overwritten byDisplayDamageNumbersThanks 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,DamageNumbersEnabledwill useDebugKeysEnabledas the default value. 感谢您的建议! 刚才测试了几个文字效果,比如FullShadow,但它们的效果都不是很好看。这个PR的主要目的是将“伤害显示从 Debug 功能转为 UI 视觉效果”,所以我觉得在该PR中,可能暂时无需改变其视觉效果。现在恢复了使用NoShadow单层文字的默认值。 另外,修改了DamageNumbersEnabled的默认值,若未填写DamageNumbersEnabled,则该功能将与DebugKeysEnabled保持一致。 注:DamageNumbersEnabled是该功能的总开关,它的作用是决定该功能的启用/禁用,若禁用则无法在游戏里用快捷键打开,若启用,才会在下一步检查DisplayDamageNumbers的值; 而DisplayDamageNumbers的作用是决定游戏开始时,该功能是处于关闭(可用快捷键手动打开)状态,还是处于打开(可手动关闭)状态。actually, idk there has any thing different either use
FullShadowor not. It looks like totally same
There's no need to draw 2 texts I think,
DrawTextfunction allow you to choose aTextPrintTypeother 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 existingDebugKeyEnablefunction. It should be done in a way that DebugKeyEnable can still enable or disable it, but would be overwritten byDisplayDamageNumbersThanks 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,DamageNumbersEnabledwill useDebugKeysEnabledas the default value. 感谢您的建议! 刚才测试了几个文字效果,比如FullShadow,但它们的效果都不是很好看。这个PR的主要目的是将“伤害显示从 Debug 功能转为 UI 视觉效果”,所以我觉得在该PR中,可能暂时无需改变其视觉效果。现在恢复了使用NoShadow单层文字的默认值。 另外,修改了DamageNumbersEnabled的默认值,若未填写DamageNumbersEnabled,则该功能将与DebugKeysEnabled保持一致。 注:DamageNumbersEnabled是该功能的总开关,它的作用是决定该功能的启用/禁用,若禁用则无法在游戏里用快捷键打开,若启用,才会在下一步检查DisplayDamageNumbers的值; 而DisplayDamageNumbers的作用是决定游戏开始时,该功能是处于关闭(可用快捷键手动打开)状态,还是处于打开(可手动关闭)状态。actually, idk there has any thing different either use
FullShadowor not. It looks like totally same 实际上,我不知道用不用FullShadow有什么区别。看起来是完全一样的
other options about shadow is same 其他有关阴影的选项也是一样
There's no need to draw 2 texts I think,
DrawTextfunction allow you to choose aTextPrintTypeother 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 existingDebugKeyEnablefunction. It should be done in a way that DebugKeyEnable can still enable or disable it, but would be overwritten byDisplayDamageNumbersThanks 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,DamageNumbersEnabledwill useDebugKeysEnabledas the default value. 感谢您的建议! 刚才测试了几个文字效果,比如FullShadow,但它们的效果都不是很好看。这个PR的主要目的是将“伤害显示从 Debug 功能转为 UI 视觉效果”,所以我觉得在该PR中,可能暂时无需改变其视觉效果。现在恢复了使用NoShadow单层文字的默认值。 另外,修改了DamageNumbersEnabled的默认值,若未填写DamageNumbersEnabled,则该功能将与DebugKeysEnabled保持一致。 注:DamageNumbersEnabled是该功能的总开关,它的作用是决定该功能的启用/禁用,若禁用则无法在游戏里用快捷键打开,若启用,才会在下一步检查DisplayDamageNumbers的值; 而DisplayDamageNumbers的作用是决定游戏开始时,该功能是处于关闭(可用快捷键手动打开)状态,还是处于打开(可手动关闭)状态。actually, idk there has any thing different either use
FullShadowor 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;