| 223 | } |
| 224 | |
| 225 | void CUIStatic::Update() |
| 226 | { |
| 227 | inherited::Update(); |
| 228 | // update light animation if defined |
| 229 | if (m_lanim_clr.m_lanim) |
| 230 | { |
| 231 | if (m_lanim_clr.m_lanim_start_time < 0.0f) |
| 232 | { |
| 233 | ResetClrAnimation(); |
| 234 | } |
| 235 | |
| 236 | float t = Device.dwTimeContinual / 1000.0f; |
| 237 | |
| 238 | if (t < m_lanim_clr.m_lanim_start_time) // consider animation delay |
| 239 | return; |
| 240 | |
| 241 | u32 clr = 0; |
| 242 | bool apply = false; |
| 243 | |
| 244 | if (m_lanim_clr.m_lanimFlags.test(LA_CYCLIC) || t - m_lanim_clr.m_lanim_start_time < m_lanim_clr.m_lanim->Length_sec()) |
| 245 | { |
| 246 | int frame; |
| 247 | clr = m_lanim_clr.m_lanim->CalculateRGB(t - m_lanim_clr.m_lanim_start_time, frame); |
| 248 | apply = true; |
| 249 | } |
| 250 | else if (!m_lanim_clr_completed) |
| 251 | { |
| 252 | int frame = m_lanim_clr.m_lanim->LastKeyFrame(); |
| 253 | clr = m_lanim_clr.m_lanim->InterpolateRGB(frame); |
| 254 | apply = true; |
| 255 | |
| 256 | m_lanim_clr_completed = true; |
| 257 | } |
| 258 | |
| 259 | if (apply) |
| 260 | { |
| 261 | if (m_lanim_clr.m_lanimFlags.test(LA_TEXTURECOLOR)) |
| 262 | if (m_lanim_clr.m_lanimFlags.test(LA_ONLYALPHA)) |
| 263 | SetColor(subst_alpha(GetColor(), color_get_A(clr))); |
| 264 | else |
| 265 | SetColor(clr); |
| 266 | |
| 267 | if (m_lanim_clr.m_lanimFlags.test(LA_TEXTCOLOR)) |
| 268 | if (m_lanim_clr.m_lanimFlags.test(LA_ONLYALPHA)) |
| 269 | SetTextColor(subst_alpha(GetTextColor(), color_get_A(clr))); |
| 270 | else |
| 271 | SetTextColor(clr); |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | if (m_lanim_xform.m_lanim) |
| 276 | { |
| 277 | if (m_lanim_xform.m_lanim_start_time < 0.0f) |
| 278 | { |
| 279 | ResetXformAnimation(); |
| 280 | } |
| 281 | |
| 282 | float t = Device.dwTimeContinual / 1000.0f; |
nothing calls this directly
no test coverage detected