Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Minor] Randomized anims for several behaviors #1380

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

Coronia
Copy link
Contributor

@Coronia Coronia commented Sep 16, 2024

Allow several Phobos anim logic to display one of the random anims in the list, instead of one fixed anim. Most of them are related to destroy/take damage behaviors. You can either use their old tags to input the list directly, or use the following new tags in plural forms to override them.

In rulesmd.ini:

[SOMESHIELDTYPE]                            ; ShieldType name
BreakAnim=                                  ; list of Animation
BreakAnims=                                 ; list of Animation, overrides BreakAnim
HitAnim=                                    ; list of Animation
HitAnims=                                   ; list of Animation, overrides HitAnim

[SOMEWARHEAD]                               ; WarheadType
Shield.BreakAnim=                           ; list of Animation
Shield.BreakAnims=                          ; list of Animation, overrides Shield.BreakAnim
Shield.HitAnim=                             ; list of Animation
Shield.HitAnims=                            ; list of Animation, overrides Shield.HitAnim

[SOMETECHNO]                                   ; TechnoType
PassengerDeletion.Anim=                         ; list of Animation
PassengerDeletion.Anims=                        ; list of Animation, overrides PassengerDeletion.Anim
AutoDeath.VanishAnimation=                     ; list of Animation
AutoDeath.VanishAnimations=                    ; list of Animation, overrides AutoDeath.VanishAnimation

[SOMEANIM]                             ; AnimationType
CreateUnit.SpawnAnim=                  ; list of Animation
CreateUnit.SpawnAnims=                 ; list of Animation, overrides CreateUnit.SpawnAnim

[SOMETERRAINTYPE]  ; TerrainType
DestroyAnim=       ; list of Animation
DestroyAnims=      ; list of Animation, overrides DestroyAnim

@github-actions github-actions bot added the Minor Documentation is not required label Sep 16, 2024
Copy link

github-actions bot commented Sep 16, 2024

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.

@Starkku
Copy link
Contributor

Starkku commented Sep 16, 2024

Add a function to create random anim from std::vector<AnimTypeClass*> in AnimExt or something instead of copypasting the same thing across the place.

@MortonPL MortonPL added Needs improvement and removed Minor Documentation is not required labels Sep 23, 2024
Copy link
Member

@MortonPL MortonPL left a comment

Choose a reason for hiding this comment

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

What Starkku said.

Additionally, I think that adding a separate tag is unnecessary, because changing *Anim to work with a list is backwards compatible (from INI perspective) and less confusing than an extra override. Depends on what others think.

@Coronia Coronia force-pushed the random-anims branch 2 times, most recently from 42342b7 to 29f26ce Compare September 24, 2024 09:01
Copy link
Member

@MortonPL MortonPL left a comment

Choose a reason for hiding this comment

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

Please add an entry in the changelog and credits as well.

@@ -239,6 +239,43 @@ void AnimExt::HandleDebrisImpact(AnimTypeClass* pExpireAnim, AnimTypeClass* pWak
}
}

AnimClass* AnimExt::CreateRandomAnim(std::vector<AnimTypeClass*> AnimList, CoordStruct coords, TechnoClass* pTechno, HouseClass* pHouse, bool invoker)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
AnimClass* AnimExt::CreateRandomAnim(std::vector<AnimTypeClass*> AnimList, CoordStruct coords, TechnoClass* pTechno, HouseClass* pHouse, bool invoker)
AnimClass* AnimExt::CreateRandomAnim(const std::vector<AnimTypeClass*>& AnimList, CoordStruct coords, TechnoClass* pTechno, HouseClass* pHouse, bool invoker)

Since we're only accessing elements, this vector should be passed as an immutable reference.

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.

3 participants