-
Notifications
You must be signed in to change notification settings - Fork 40
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
Simplify clock APIs; migrade fade effects to the new API #2232
Conversation
Download the built assets for this pull request: |
TR1X issues:
|
ab74e45
to
49fd51c
Compare
@aredfan addressed all |
@aredfan I have proposed a different fade setup for TR1 in the latest commit, which makes ingame fades to black work the same as the main menu ones. Fades to transparency are working as they were. LMK how this change feels, if it's yay or nay. |
I have to say I do like this change because it's visually neater to allow the ring to close before fading out, albeit a tiny bit slower when loading a savegame or exiting to the title. Regardless, yay is my answer. 😄
|
This is to simplify the fade effect lifecycles. As a consequence, this changes the behavior of unpausing to wait a couple of frames before yielding the control to the player, but I think it's acceptable.
3031ae7
to
d9cbc33
Compare
@aredfan addressed – I changed the fader to ensure it has drawn the target state before I consider it deactivated. |
Does the build here update when you say you've addressed something? #2232 (comment) I might have an hour for some testing later tonight. |
No. Edit: I've rebased it (which means I've updated that other PR with the changes from here) |
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.
@aredfan addressed – I changed the fader to ensure it has drawn the target state before I consider it deactivated.
Thank you. Everything LGTM. 👍
Checklist
Clock API changes
This pull request simplifies the
CLOCK_TIMER
APIs. I've removed logical and draw frames, opting to use seconds (as decimals) throughout. Historically, this method was compromised by the turbo cheat, whose capability to alter the game pace made real-time measurements meaningless, but I managed to circumvent this problem with some tricks.CLOCK_TIMER
is now split into two types:CLOCK_TIMER_REAL
, which uses real-world time for tasks like player input debouncing or calculating rendered FPS, andCLOCK_TIMER_SIM
(simulation), which adjusts for the turbo cheat speed multiplier. The APIs include the following functions:ClockTimer_Sync
: reset the timer state to now,ClockTimer_PeekElapsed
: return elapsed seconds since the last sync,ClockTimer_TakeElapsed
: return elapsed seconds since the last sync, and immediately sync again,ClockTimer_CheckElapsed
: check if the given time has passed since the last sync,ClockTimer_CheckElapsedAndTake
: check if the given time has passed since the last sync, and sync again if so.Coincidentally, this fixes also #2231.
Fader API changes
The fader module has been updated to operate in seconds rather than logical frames as well. Since it was made to utilize the new timers, there was no need for
Fader_Control
anymore and it was removed. This means that the current draw value, and whether a fader is active, is determined solely by the elapsed time, making it entirely immutable. In addition, the multiple factory functions have been combined into a singleFader_Init
function, which abandonsFADER_ARGS
in favor of plain arguments with the debuff being determined automatically to cut down on verbosity for API users. The call sites can opt forFader_InitEx
, which still supports the fullFADER_ARGS
. I've also replaced manualOutput_DrawBlackRectangle
calls with a dedicatedFader_Draw
function, which further reduces complexity in usage.All TR1 phases have transitioned to the new fader system, resulting in the removal of the old
Output_Fade*
APIs. This update went smoothly, except for the pause phase, which was a bit peculiar – it depended on the overlay fade effect maintaining its state across different phases. Specifically, a fade-out effect that began on the pause screen would continue into the game after a phase change. To avoid managing global state across phases, I decided to complete the fade within the pause phase itself. The downside is that it prevents player interaction during this short period. An alternative approach that could prevent this regression would be for the game phase to transfer its internal fader to the pause phase usingPHASE_PAUSE_ARGS
.Testing