Describe the issue
If your computer is kept on for long enough, the RockWipe (falling rocks) animation that plays when transitioning between front end screens begins to stutter and animate very inconsistently (sometimes it looks like its jumping back frames instead of forwards).
Expected behaviour
The RockWipe animation should play smoothly (as fast as the game is ticking).
Steps to reproduce
A) Keep your computer on for a long enough time (for example, when testing this, my computer had been on for over 21 days).
B) Modify Main_GetTime to return the base value + some additional amount (like + 0x70000000) so that the returned value is high enough.
When in the main menu, press Start Game, or any other menu item that brings you to another menu.
Cause
The (incorrectly named) field frontGlobs.rockWipeSFXStartTime is a float, and holds the value returned by Main_GetTime after each tick. Single-precision floating point numbers cannot precisely store high integer values, so the value can either jump to be higher than the actual returned time, or lower. Some ticks, the value won't change at all because it is rounded down.
Solution
Create a new global variable to hold frontGlobs.rockWipeSFXStartTime as an unsigned integer.
In Front_RockWipe_Play, store Main_GetTime in the new global variable.
Implement Front_Menu_Update and replace all uses of the old frontGlobs.rockWipeSFXStartTime global variable with the new unsigned one, never cast to a float before getting the delta between the current and last time.
Because of how big the Front_Menu_Update function is, it may be possible to hook into the function where the animation time is updated and only replace functionality around there.
Describe the issue If your computer is kept on for long enough, the RockWipe (falling rocks) animation that plays when transitioning between front end screens begins to stutter and animate very inconsistently (sometimes it looks like its jumping back frames instead of forwards).
Expected behaviour The RockWipe animation should play smoothly (as fast as the game is ticking).
Steps to reproduce
Main_GetTime
to return the base value + some additional amount (like+ 0x70000000
) so that the returned value is high enough.Cause The (incorrectly named) field
frontGlobs.rockWipeSFXStartTime
is a float, and holds the value returned byMain_GetTime
after each tick. Single-precision floating point numbers cannot precisely store high integer values, so the value can either jump to be higher than the actual returned time, or lower. Some ticks, the value won't change at all because it is rounded down.Solution
frontGlobs.rockWipeSFXStartTime
as an unsigned integer.Front_RockWipe_Play
, storeMain_GetTime
in the new global variable.Front_Menu_Update
and replace all uses of the oldfrontGlobs.rockWipeSFXStartTime
global variable with the new unsigned one, never cast to a float before getting the delta between the current and last time.Because of how big the
Front_Menu_Update
function is, it may be possible to hook into the function where the animation time is updated and only replace functionality around there.Video
https://github.com/trigger-segfault/OpenLRR/assets/9752430/3653e8de-6e1f-4272-89b0-de1037136b93