Skip to content

Commit 9208d01

Browse files
Disable the credits indicator smooth transition
1 parent 0e31a0b commit 9208d01

6 files changed

Lines changed: 37 additions & 5 deletions

File tree

CREDITS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,7 @@ 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
- Customize the step limit of the credits indicator
695+
- Disable the credits indicator smooth transition
695696
- **Ollerus**:
696697
- Build limit group enhancement
697698
- Customizable rocker amplitude

docs/User-Interface.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ In `uimd.ini`:
8383
CreditsIndicator.MaxStep=143 ; integer
8484
```
8585

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+
8690
### Digital display
8791

8892
![image](_static/images/digital_display_shapes.png)
@@ -206,6 +210,20 @@ The arrangement of static images on the plane is entirely up to you to draw free
206210
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.
207211
````
208212

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+
209227
### Flashing Technos on selecting
210228

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

docs/Whats-New.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,7 @@ HideShakeEffects=false ; boolean
600600
- [Custom cruise missiles](New-or-Enhanced-Logics.md#custom-cruise-missiles) (by Noble_Fish)
601601
- [Allow chat box in singleplayer](User-Interface.md#allow-chat-box-in-singleplayer) (by TaranDahl)
602602
- [Customize the step limit of the credits indicator](User-Interface.md#customize-the-step-limit-of-the-credits-indicator) (by Noble_Fish)
603+
- [Disable the credits indicator smooth transition](User-Interface.md#disable-the-credits-indicator-smooth-transition) (by Noble_Fish)
603604
604605
#### Vanilla fixes:
605606
- 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: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,25 @@ 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+
7886
DEFINE_HOOK(0x4A2729, CreditClass_AI_CreditsStepClamp, 0x5)
7987
{
8088
enum { Continue = 0x4A2735 };
8189

8290
int maxStep = Phobos::UI::CreditsIndicator_MaxStep;
83-
if (maxStep < 1)
91+
if (maxStep <= 0)
8492
return Continue;
8593

86-
int current = R->EAX();
87-
if (current > maxStep)
88-
current = maxStep;
89-
R->EAX(current);
94+
GET(int, current, EAX);
95+
96+
R->EAX(Math::min(current, maxStep));
9097

9198
return Continue;
9299
}

src/Phobos.INI.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ int Phobos::UI::SuperWeaponSidebar_CameoHeight = 48;
4141
int Phobos::UI::SuperWeaponSidebar_Max = 0;
4242
int Phobos::UI::SuperWeaponSidebar_MaxColumns = INT32_MAX;
4343
int Phobos::UI::CreditsIndicator_MaxStep = 143;
44+
bool Phobos::UI::CreditsIndicator_Smooth = true;
4445
bool Phobos::UI::WeedsCounter_Show = false;
4546
bool Phobos::UI::AnchoredToolTips = false;
4647

@@ -235,6 +236,9 @@ DEFINE_HOOK(0x5FACDF, OptionsClass_LoadSettings_LoadPhobosSettings, 0x5)
235236

236237
Phobos::UI::CreditsIndicator_MaxStep =
237238
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);
238242
}
239243

240244
// UISettings

src/Phobos.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class Phobos
6363
static int SuperWeaponSidebar_Max;
6464
static int SuperWeaponSidebar_MaxColumns;
6565
static int CreditsIndicator_MaxStep;
66+
static bool CreditsIndicator_Smooth;
6667
static bool WeedsCounter_Show;
6768
static bool AnchoredToolTips;
6869

0 commit comments

Comments
 (0)