Skip to content

Money switch building active animation - #2380

Open
dh381-1 wants to merge 16 commits into
Phobos-developers:developfrom
dh381-1:MoneyChangeAnimation
Open

Money switch building active animation#2380
dh381-1 wants to merge 16 commits into
Phobos-developers:developfrom
dh381-1:MoneyChangeAnimation

Conversation

@dh381-1

@dh381-1 dh381-1 commented Aug 31, 2026

Copy link
Copy Markdown

What kind of change is this?

  • New feature, vanilla bugfix or enhancement of a released feature - changelog, docs and credits entries are needed.
  • Improvement to a new (unreleased) feature - docs and credits entries are needed; no changelog entry (Skip Changelog).
  • Bugfix to a new (unreleased) feature - credits entry is needed; no changelog or docs entries (Skip Changelog, Skip Docs).
  • Bugfix to an old (released) feature - changelog and credits entries are needed; no docs entry (Skip Docs).
  • Completely minor change (e.g. a typo fix) - no entries are needed (Skip Changelog, Skip Docs, Skip Credits).

Description

  • Now you can use ActiveAnim.MoneyAmount, ActiveAnimTwo.MoneyAmount, ActiveAnimThree.MoneyAmount, ActiveAnimFour.MoneyAmount to switch active animation of building.
  • When funds are greater than ActiveAnimFour.MoneyAmount, ActiveAnimFour is played; when funds are greater than ActiveAnimThree.MoneyAmount but less than ActiveAnimFour.MoneyAmount, ActiveAnimThree is played, and so on. If the corresponding animation does not exist, no switch will occur.

In rulesmd.ini:

[SOMEBUILDING]                   ; BuildingType
ActiveAnim.MoneyAmount=1000      ; integar
ActiveAnimTwo.MoneyAmount=2000   ; integar
ActiveAnimThree.MoneyAmount=3000 ; integar
ActiveAnimFour.MoneyAmount=4000  ; integar
All four configuration entries default to `-1`. The feature will only be enabled when all entries have been configured.

Comment thread docs/New-or-Enhanced-Logics.md Outdated
Comment thread CREDITS.md Outdated
@github-actions

Copy link
Copy Markdown

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.

Comment thread src/Ext/Building/Hooks.cpp Outdated
Comment thread src/Ext/Building/Hooks.cpp Outdated
Comment thread src/Ext/Building/Hooks.cpp Outdated
Comment thread src/Ext/Building/Hooks.cpp Outdated
Comment thread src/Ext/Building/Hooks.cpp Outdated
Comment thread src/Ext/Building/Hooks.cpp Outdated
Comment thread src/Ext/Building/Hooks.cpp Outdated
&& pTypeExt->ActiveAnimThree_MoneyAmount != -1
&& pTypeExt->ActiveAnimFour_MoneyAmount != -1)
{
if(auto pBuildingExt = BuildingExt::Fetch(pThis))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same

Comment thread src/Ext/Building/Hooks.cpp Outdated
&& pTypeExt->ActiveAnimThree_MoneyAmount != -1
&& pTypeExt->ActiveAnimFour_MoneyAmount != -1)
{
if(auto pBuildingExt = BuildingExt::Fetch(pThis))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same

Comment thread src/Ext/Building/Hooks.cpp Outdated
{
int Grade = pBuildingExt->MoneyGrade;
R->EAX(Grade);
__asm { cmp eax, 3 }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You should manually compare and jump to the corresponding address instead of directly writing the assembly.
你应当手动检查并跳转到对应地址,而不是直接写汇编。

Comment thread src/Ext/Building/Hooks.cpp Outdated
__asm
{
cmp eax, 3
mov [esi + 0x6F0], eax

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here.
这里也是。

@phoboscn-bot

Copy link
Copy Markdown

To Chinese users:
This pull request has been mentioned on Phobos CN. There might be relevant details there:

致中文用户:
此拉取请求已在 Phobos CN 上被提及。那里可能有相关详细信息:

https://www.phoboscn.top/t/topic/755/1

Comment thread src/Ext/Building/Body.h Outdated
Comment on lines +1556 to +1559
if(pTypeExt->ActiveAnim_MoneyAmount != -1
&& pTypeExt->ActiveAnimTwo_MoneyAmount != -1
&& pTypeExt->ActiveAnimThree_MoneyAmount != -1
&& pTypeExt->ActiveAnimFour_MoneyAmount != -1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caching these in BuildingTypeExt would be better.

Coronia and others added 10 commits September 9, 2026 12:37
- only AE that's been applied through the TechnoType tags should be considered as self owned
- other scenario (e.g. applied through warhead from itself) shouldn't be handled in the same way
- if simply checking whether the source is equal to the target, some process will be wrong
- SourceHouse of damage arg is likely to be null in some cases (e.g. AmbientDamage), resulting in wrong damage calculation
- use the same method as Ares now: try to use Attacker's owner as source house first, and fallback to SourceHouse if not exists
…ectory to ignore settings such as `BounceTimes` (Phobos-developers#2383)

<!--
If the changes are solely made to the documentation, please set the
target branch to the pull request named "Weekly Regular Documentation
Revisions", rather than the repository's existing branches.
-->

## What kind of change is this?

<!-- Tick the row that matches your change. It tells the maintainers
which of the changelog, docs and credits checks should run, and which
`Skip` labels to apply for the ones that don't. -->

- [ ] **New feature, vanilla bugfix or enhancement of a released
feature** - changelog, docs and credits entries are needed.
- [ ] **Improvement to a new (unreleased) feature** - docs and credits
entries are needed; no changelog entry (`Skip Changelog`).
- [ ] **Bugfix to a new (unreleased) feature** - credits entry is
needed; no changelog or docs entries (`Skip Changelog`, `Skip Docs`).
- [X] **Bugfix to an old (released) feature** - changelog and credits
entries are needed; no docs entry (`Skip Docs`).
- [ ] **Completely minor change (e.g. a typo fix)** - no entries are
needed (`Skip Changelog`, `Skip Docs`, `Skip Credits`).

## Description

In vanilla, `Ranged=true` runs a check that, once the fuse timer has
expired, snaps the bullet onto the target coordinates and detonates it
as soon as the projectile comes within 64 leptons of them. This check
runs after the trajectory system has decided the projectile should keep
flying (the trajectory `BulletClass_AI_Trajectories` hook at 0x4666F7)
and bypasses all of the trajectory's detonation logic - including the
shared `DetonationDistance` / `TargetSnapDistance` handling and the
Parabola bouncing mechanism.
<!--
If the changes are solely made to the documentation, please set the
target branch to the pull request named "Weekly Regular Documentation
Revisions", rather than the repository's existing branches.
-->

## What kind of change is this?

<!-- Tick the row that matches your change. It tells the maintainers
which of the changelog, docs and credits checks should run, and which
`Skip` labels to apply for the ones that don't. -->

- [X] **New feature, vanilla bugfix or enhancement of a released
feature** - changelog, docs and credits entries are needed.
- [ ] **Improvement to a new (unreleased) feature** - docs and credits
entries are needed; no changelog entry (`Skip Changelog`).
- [ ] **Bugfix to a new (unreleased) feature** - credits entry is
needed; no changelog or docs entries (`Skip Changelog`, `Skip Docs`).
- [ ] **Bugfix to an old (released) feature** - changelog and credits
entries are needed; no docs entry (`Skip Docs`).
- [ ] **Completely minor change (e.g. a typo fix)** - no entries are
needed (`Skip Changelog`, `Skip Docs`, `Skip Credits`).

## Description


In vanilla, the number of game frames each animation frame of the
infantry sequence stays (i.e., its playback rate) is hardcoded. Now it
can be customized for each sequence in each infantry's sequence section.
- `<Sequence>Rate` defines the number of game logic frames that 1
animation frame stays; 0 means still, for example, the `Ready` and
`Guard` sequences in vanilla are still.
- `<Sequence>Normalized` defines whether the playback rate is affected
by game speed, for example, the `Idle1`, `Idle2`, `WetIdle1`,
`WetIdle2`, `Hover`, and `Cheer` sequences in vanilla are affected by
game speed.

```{note}
The effective rate of a normalized sequence is `rate` adjusted by the game speed:

- `rate < 5`: from the table below (`rate` row, `GameSpeed` column).
- `rate >= 5`: `rate * 8 / (GameSpeed + 1)`.

| Rate \ GameSpeed | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
| ---------------- | - | - | - | - | - | - | - |
| 1                | 2 | 2 | 1 | 1 | 1 | 1 | 1 |
| 2                | 3 | 3 | 3 | 2 | 2 | 2 | 1 |
| 3                | 5 | 4 | 4 | 3 | 3 | 2 | 2 |
| 4                | 7 | 6 | 5 | 4 | 4 | 4 | 3 |

`GameSpeed` goes from `0` (fastest) to `6` (slowest).
```

In `rulesmd.ini`:
```ini
[AudioVisual]
Sequence.<Sequence>.DefaultRate=0         ; integer
Sequence.<Sequence>.DefaultNormalized=no  ; boolean
```

```{dropdown} Default value table
| Name            | DefaultRate | Normalized |
|-----------------|-------------|------------|
| Ready           | 0           | false      |
| Guard           | 0           | false      |
| Prone           | 6           | false      |
| Walk            | 3           | false      |
| FireUp          | 1           | false      |
| Down            | 1           | false      |
| Crawl           | 1           | false      |
| Up              | 1           | false      |
| FireProne       | 1           | false      |
| Idle1           | 3           | true       |
| Idle2           | 3           | true       |
| Die1            | 1           | false      |
| Die2            | 1           | false      |
| Die3            | 1           | false      |
| Die4            | 1           | false      |
| Die5            | 1           | false      |
| Tread           | 3           | false      |
| Swim            | 1           | false      |
| WetIdle1        | 3           | true       |
| WetIdle2        | 3           | true       |
| WetDie1         | 1           | false      |
| WetDie2         | 1           | false      |
| WetAttack       | 1           | false      |
| Hover           | 2           | true       |
| Fly             | 1           | false      |
| Tumble          | 1           | false      |
| FireFly         | 1           | false      |
| Deploy          | 1           | false      |
| Deployed        | 1           | false      |
| DeployedFire    | 1           | false      |
| DeployedIdle    | 1           | false      |
| Undeploy        | 1           | false      |
| Cheer           | 3           | true       |
| Paradrop        | 1           | false      |
| AirDeathStart   | 3           | false      |
| AirDeathFalling | 1           | false      |
| AirDeathFinish  | 3           | false      |
| Panic           | 4           | false      |
| Shovel          | 6           | false      |
| Carry           | 3           | false      |
| SecondaryFire   | 1           | false      |
| SecondaryProne  | 1           | false      |
```

In `artmd.ini`:
```ini
[SEQUENCE]                                ; Sequence
<Sequence>Rate=                           ; integer, defaults to [AudioVisual] -> Sequence.<Sequence>.DefaultRate
<Sequence>Normalized=                     ; boolean, defaults to [AudioVisual] -> Sequence.<Sequence>.DefaultNormalized
```

> [!Tip]
> The naming of each infantry flag is aligned with `[Sequence] ->
<Sequence>Sounds= (List of sound entries)` (Vanilla flag. It is
concatenated by `<Sequence>` and the suffix `Sounds`, so the full string
is not stored in `gamemd.exe`, see `0x523FC4`.).
@dh381-1
dh381-1 requested a review from TaranDahl September 9, 2026 05:11
@TaranDahl

Copy link
Copy Markdown
Contributor

Don't know why I'm being requested to review again.
I already approved it. Also, you haven't made the minor changes I suggested.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants