-
Notifications
You must be signed in to change notification settings - Fork 256
bugfix(drawable): Decouple fade timing from render rate #3303
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
base: main
Are you sure you want to change the base?
Changes from all commits
bb8610d
0ef50c6
d726a1e
4c14eae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1149,10 +1149,14 @@ void Drawable::updateDrawable() | |
| Real numer = (m_fadeMode == FADING_IN) ? (m_timeElapsedFade) : (m_timeToFade-m_timeElapsedFade); | ||
|
|
||
| setDrawableOpacity(numer/(Real)m_timeToFade); | ||
| ++m_timeElapsedFade; | ||
| // TheSuperHackers @bugfix bobtista 15/09/2026 Decouple Drawable fade timing from render updates. | ||
| m_timeElapsedFade += TheFramePacer->getActualLogicTimeScaleOverFpsRatio(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is better for long term performance to pass timeScale as argument to |
||
|
|
||
| if (m_timeElapsedFade > m_timeToFade) | ||
| { | ||
| setDrawableOpacity(m_fadeMode == FADING_IN ? 1.0f : 0.0f); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This now calls |
||
| m_fadeMode = FADING_NONE; | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -1167,7 +1171,8 @@ void Drawable::updateDrawable() | |
| { | ||
| //LERP | ||
| (*dm)->setTerrainDecalOpacity(m_decalOpacity); | ||
| m_decalOpacity += m_decalOpacityFadeRate; | ||
| // TheSuperHackers @bugfix bobtista 15/09/2026 Decouple decal opacity fade timing from render updates. | ||
| m_decalOpacity += m_decalOpacityFadeRate * TheFramePacer->getActualLogicTimeScaleOverFpsRatio(); | ||
| } | ||
| //--------------- | ||
|
|
||
|
|
@@ -4850,6 +4855,7 @@ void Drawable::xferDrawableModules( Xfer *xfer ) | |
| * 6: Added m_ambientSoundEnabledFromScript flag (Added in Zero Hour) | ||
| * 7: Save the customize ambient sound info (Added in Zero Hour) | ||
| * 8: TheSuperHackers @bugfix Removed m_prevTintStatus because loading its value is unnecessary and undesirable | ||
| * 9: TheSuperHackers @info Preserve fractional fade progress in non-retail saves | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better describe this as m_timeElapsedFade is now serialized as Real instead of UnsignedInt. |
||
| */ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| void Drawable::xfer( Xfer *xfer ) | ||
|
|
@@ -4861,7 +4867,7 @@ void Drawable::xfer( Xfer *xfer ) | |
| #elif RETAIL_COMPATIBLE_XFER_SAVE | ||
| const XferVersion currentVersion = 7; | ||
| #else | ||
| const XferVersion currentVersion = 8; | ||
| const XferVersion currentVersion = 9; | ||
| #endif | ||
| XferVersion version = currentVersion; | ||
| xfer->xferVersion( &version, currentVersion ); | ||
|
|
@@ -5035,7 +5041,19 @@ void Drawable::xfer( Xfer *xfer ) | |
| xfer->xferUser( &m_fadeMode, sizeof( FadingMode ) ); | ||
|
|
||
| // time elapsed fade | ||
| xfer->xferUnsignedInt( &m_timeElapsedFade ); | ||
| if (version >= 9) | ||
| { | ||
| xfer->xferReal( &m_timeElapsedFade ); | ||
| } | ||
| else | ||
| { | ||
| UnsignedInt timeElapsedFadeFrames = static_cast<UnsignedInt>(m_timeElapsedFade); | ||
| xfer->xferUnsignedInt( &timeElapsedFadeFrames ); | ||
| if (xfer->getXferMode() == XFER_LOAD) | ||
| { | ||
| m_timeElapsedFade = static_cast<Real>(timeElapsedFadeFrames); | ||
| } | ||
| } | ||
|
|
||
| // time to fade | ||
| xfer->xferUnsignedInt( &m_timeToFade ); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 30fps-equivalent frames comment turns wrong when LOGICFRAMES_PER_SECOND is changed.
Corrected comment: