Skip to content

Commit 8e7404e

Browse files
Customize the step limit of the credits indicator and disable the credits indicator smooth transition (#2279)
1 parent 762f2b5 commit 8e7404e

6 files changed

Lines changed: 66 additions & 0 deletions

File tree

CREDITS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,8 @@ This page lists all the individual contributions to the project by their author.
692692
- Allow infantry to perform type conversion when deploying and undeploying
693693
- Custom cruise missiles
694694
- Add a toggle for disabling `SecondaryFire` / `SecondaryProne` on water
695+
- Customize the step limit of the credits indicator
696+
- Disable the credits indicator smooth transition
695697
- **Ollerus**:
696698
- Build limit group enhancement
697699
- Customizable rocker amplitude

docs/User-Interface.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,21 @@ HealthBar.Permanent=false ; boolean
7272
HealthBar.Permanent.PipScale=false ; boolean
7373
```
7474

75+
### Customize the step limit of the credits indicator
76+
77+
- In vanilla, the Credits Indicator in the sidebar increases by at most 143 points per frame, and now you can customize this limit.
78+
- If set to a value less than or equal to 0, the upper limit will be removed.
79+
80+
In `uimd.ini`:
81+
```ini
82+
[Sidebar]
83+
CreditsIndicator.MaxStep=143 ; integer
84+
```
85+
86+
```{note}
87+
The game first takes the absolute value of the difference between the actual credits and the current value, then divides it by 8, and then clamps this value to the limit set here. If you wish to disable this smoothing effect, set [`CreditsIndicator.Smooth=false`](User-Interface.md#disable-the-credits-indicator-smooth-transition).
88+
```
89+
7590
### Digital display
7691

7792
![image](_static/images/digital_display_shapes.png)
@@ -195,6 +210,20 @@ The arrangement of static images on the plane is entirely up to you to draw free
195210
Of course, this is just the implementation method. To balance freedom with efficiency - that is, how to efficiently draw the patterns you need - you still need to independently explore a workflow that suits you.
196211
````
197212

213+
### Disable the credits indicator smooth transition
214+
215+
- In vanilla, the Credits Indicator has a smooth transition effect when the displayed credit value approaches the actual credit value. Now you can disable this effect, allowing the change step to always follow the value of [`CreditsIndicator.MaxStep`](User-Interface.md#customize-the-step-limit-of-the-credits-indicator).
216+
217+
In `uimd.ini`:
218+
```ini
219+
[Sidebar]
220+
CreditsIndicator.Smooth=true ; boolean
221+
```
222+
223+
```{hint}
224+
For example, if you want to make the credits update immediately without a transition process by setting `CreditsIndicator.MaxStep=0`, then you should also set `CreditsIndicator.Smooth=false`; otherwise, the displayed credit value will still change in the form of an exponential approximation function.
225+
```
226+
198227
### Flashing Technos on selecting
199228

200229
- Selecting technos, controlled by player, now may show a flash effect by setting `SelectionFlashDuration` parameter higher than 0.

docs/Whats-New.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,8 @@ HideShakeEffects=false ; boolean
603603
- [Add a toggle for disabling `SecondaryFire` / `SecondaryProne` on water](Fixed-or-Improved-Logics.md#ensure-infantry-use-correct-firing-sequences-on-water) (by Noble_Fish)
604604
- [Allow beacon placement hotkey in single player](Fixed-or-Improved-Logics.md#allow-beacon-placement-hotkey-in-single-player) (by TaranDahl)
605605
- [Auto-remove earliest beacon](Fixed-or-Improved-Logics.md#auto-remove-earliest-beacon) (by TaranDahl)
606+
- [Customize the step limit of the credits indicator](User-Interface.md#customize-the-step-limit-of-the-credits-indicator) (by Noble_Fish)
607+
- [Disable the credits indicator smooth transition](User-Interface.md#disable-the-credits-indicator-smooth-transition) (by Noble_Fish)
606608
607609
#### Vanilla fixes:
608610
- Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya)

src/Misc/Hooks.UI.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,29 @@ DEFINE_HOOK(0x641EE0, PreviewClass_ReadPreview, 0x6)
7575
return 0x64203D;
7676
}
7777

78+
DEFINE_HOOK(0x4A26E8, CreditClass_AI_SmoothDisable, 0x6)
79+
{
80+
if (!Phobos::UI::CreditsIndicator_Smooth)
81+
return 0x4A26F0;
82+
else
83+
return 0;
84+
}
85+
86+
DEFINE_HOOK(0x4A2729, CreditClass_AI_CreditsStepClamp, 0x5)
87+
{
88+
enum { Continue = 0x4A2735 };
89+
90+
int maxStep = Phobos::UI::CreditsIndicator_MaxStep;
91+
if (maxStep <= 0)
92+
return Continue;
93+
94+
GET(int, current, EAX);
95+
96+
R->EAX(Math::min(current, maxStep));
97+
98+
return Continue;
99+
}
100+
78101
DEFINE_HOOK(0x4A25E0, CreditsClass_GraphicLogic_HarvesterCounter, 0x7)
79102
{
80103
auto const pPlayer = HouseClass::CurrentPlayer;

src/Phobos.INI.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ int Phobos::UI::SuperWeaponSidebar_LeftOffset = 0;
4040
int Phobos::UI::SuperWeaponSidebar_CameoHeight = 48;
4141
int Phobos::UI::SuperWeaponSidebar_Max = 0;
4242
int Phobos::UI::SuperWeaponSidebar_MaxColumns = INT32_MAX;
43+
int Phobos::UI::CreditsIndicator_MaxStep = 143;
44+
bool Phobos::UI::CreditsIndicator_Smooth = true;
4345
bool Phobos::UI::WeedsCounter_Show = false;
4446
bool Phobos::UI::AnchoredToolTips = false;
4547

@@ -231,6 +233,12 @@ DEFINE_HOOK(0x5FACDF, OptionsClass_LoadSettings_LoadPhobosSettings, 0x5)
231233

232234
Phobos::UI::SuperWeaponSidebar_MaxColumns =
233235
ini_uimd.ReadInteger(SIDEBAR_SECTION, "SuperWeaponSidebar.MaxColumns", Phobos::UI::SuperWeaponSidebar_MaxColumns);
236+
237+
Phobos::UI::CreditsIndicator_MaxStep =
238+
ini_uimd.ReadInteger(SIDEBAR_SECTION, "CreditsIndicator.MaxStep", Phobos::UI::CreditsIndicator_MaxStep);
239+
240+
Phobos::UI::CreditsIndicator_Smooth =
241+
ini_uimd.ReadBool(SIDEBAR_SECTION, "CreditsIndicator.Smooth", Phobos::UI::CreditsIndicator_Smooth);
234242
}
235243

236244
// UISettings

src/Phobos.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ class Phobos
6262
static int SuperWeaponSidebar_CameoHeight;
6363
static int SuperWeaponSidebar_Max;
6464
static int SuperWeaponSidebar_MaxColumns;
65+
static int CreditsIndicator_MaxStep;
66+
static bool CreditsIndicator_Smooth;
6567
static bool WeedsCounter_Show;
6668
static bool AnchoredToolTips;
6769

0 commit comments

Comments
 (0)