Skip to content

Export color animation functions & implemented RemoveColorAnimation#241

Merged
themrdemonized merged 3 commits intothemrdemonized:all-in-one-vs2022-wpofrom
nltp-ashes:all-in-one-vs2022-wpo
Jun 3, 2025
Merged

Export color animation functions & implemented RemoveColorAnimation#241
themrdemonized merged 3 commits intothemrdemonized:all-in-one-vs2022-wpofrom
nltp-ashes:all-in-one-vs2022-wpo

Conversation

@nltp-ashes
Copy link
Contributor

Hello,

In this PR, I added new script exports for :

  • CUIStatic::SetColorAnimation
  • CUIStatic::ResetColorAnimation
  • CUIStatic::RemoveColorAnimation

CUIStatic::RemoveColorAnimation is a new method that unsets color animation variables, and sets the texture color to white.

@Bence7661
Copy link
Contributor

Damn I never even knew we had color animations.

@themrdemonized themrdemonized merged commit afdc963 into themrdemonized:all-in-one-vs2022-wpo Jun 3, 2025
9 of 10 checks passed
@nltp-ashes
Copy link
Contributor Author

nltp-ashes commented Jun 3, 2025

@Bence7661 Color animations did exist on CUIStatic before, and were automatically setup by CScriptXmlInit.

When calling CScriptXmlInit::InitStatic, it would look for specific flags for color animations, and initialize one accordingly.

Here is the code in engine that does that.

Source : src/xrGame/ui/UIXmlInit.cpp#L174

LPCSTR str_flag = xml_doc.ReadAttrib(path, index, "light_anim", "");
int flag_cyclic = xml_doc.ReadAttribInt(path, index, "la_cyclic", 1);
int flag_text = xml_doc.ReadAttribInt(path, index, "la_text", 1);
int flag_texture = xml_doc.ReadAttribInt(path, index, "la_texture", 1);
int flag_alpha = xml_doc.ReadAttribInt(path, index, "la_alpha", 0);

u8 flags = 0;
if (flag_cyclic) flags |= LA_CYCLIC;
if (flag_alpha) flags |= LA_ONLYALPHA;
if (flag_text) flags |= LA_TEXTCOLOR;
if (flag_texture) flags |= LA_TEXTURECOLOR;

pWnd->SetColorAnimation(str_flag, flags);

For your information, color animations are also implemented on CUITextWnd. Although it seems it supports less options.

Here's again a fragment from the engine.

Source : src/xrGame/ui/UIXmlInit.cpp#L212

LPCSTR str_flag = xml_doc.ReadAttrib(path, index, "light_anim", "");
int flag_cyclic = xml_doc.ReadAttribInt(path, index, "la_cyclic", 1);
int flag_alpha = xml_doc.ReadAttribInt(path, index, "la_alpha", 0);

u8 flags = LA_TEXTCOLOR;
if (flag_cyclic) flags |= LA_CYCLIC;
if (flag_alpha) flags |= LA_ONLYALPHA;
pWnd->SetColorAnimation(str_flag, flags);

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants