| 45 | } |
| 46 | |
| 47 | void RadioMessagePopup::update(float dt) { |
| 48 | if (messageActive()) { |
| 49 | if (m_stageTimer.tick(dt)) |
| 50 | nextPopupStage(); |
| 51 | |
| 52 | if (m_popupStage == PopupStage::AnimateIn) { |
| 53 | int frame = floor((1.0f - m_stageTimer.percent()) * m_animateInFrames); |
| 54 | setBG("", strf("{}:{}", m_animateInImage, frame), ""); |
| 55 | } else if (m_popupStage == PopupStage::ScrollText) { |
| 56 | int frame = |
| 57 | int((m_stageTimer.timer / m_message.portraitSpeed) * m_message.portraitFrames) % m_message.portraitFrames; |
| 58 | m_portraitImage->setImage(m_message.portraitImage.replace("<frame>", toString(frame))); |
| 59 | int textLength = floor(Text::stripEscapeCodes(m_message.text).length() * (1.0f - m_stageTimer.percent())); |
| 60 | m_messageLabel->setTextCharLimit(textLength); |
| 61 | } else if (m_popupStage == PopupStage::Persist) { |
| 62 | // you're cool, just stay cool, cool person |
| 63 | } else if (m_popupStage == PopupStage::AnimateOut) { |
| 64 | int frame = floor((1.0f - m_stageTimer.percent()) * m_animateOutFrames); |
| 65 | setBG("", strf("{}:{}", m_animateOutImage, frame), ""); |
| 66 | } |
| 67 | |
| 68 | m_slideTimer = min(m_slideTimer + dt, m_slideTime); |
| 69 | updateAnchorOffset(); |
| 70 | } |
| 71 | |
| 72 | Pane::update(dt); |
| 73 | } |
| 74 | |
| 75 | void RadioMessagePopup::dismissed() { |
| 76 | if (m_chatterSound) |
nothing calls this directly
no test coverage detected