-
Notifications
You must be signed in to change notification settings - Fork 647
[Shared] fix UI transition/fade effects being framerate dependent #1223
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: master
Are you sure you want to change the base?
Conversation
@@ -7812,17 +7813,17 @@ static qboolean Item_Paint(itemDef_t *item, qboolean bDraw) | |||
if (DC->realTime > item->window.nextTime) | |||
{ | |||
float rx, ry, a, c, s, w, h; | |||
item->window.nextTime = DC->realTime + item->window.offsetTime; | |||
item->window.nextTime = DC->realTime + (item->window.offsetTime * tAdjust); |
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.
I'm not sure if also adjusting the debouncer is correct since we're adjusting the translation based on the current frametime / 60fps frametime.
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.
I think you can be sure that most users have exactly 60 fps (vsync with most common displays) or more in the menus, thus this should only decrease the amount of tiggered updates. One could argue that this is bad for higher freqency displays, as the interpolation won't work in this case for the frames in between. Probably better to get rid of it, but I wouldn't mind if menu anmiations are capped at the defined fps.
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.
I'm not the one to give a solid opinion on the good coding practice and whether solution is proper for the environment etc. buuut
I've tested the entire UI, checked the references and whether the adjustment is provided in every required variable & function and I can say it is. Checked the references to the timer, ran through call stack and reference tree, everything looks fine, every place that would need the adjustment, has it.
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.
I don't know for sure either but does MP have the correct frametime?
f22d223
to
5c92179
Compare
Currently the
transition
/fade
keywords in menus will behave differently according to your FPS.This PR makes it consistent with the original behaviour as if you had 60 FPS - which is likely what they were designed for.
You can see these in effect in SP from the main menu:
New
(transition)Controls
(fade in)Demonstration of before/after this fix from JA++ with a custom menu:
https://github.com/JACoders/OpenJK/assets/844370/e84b79f1-5da6-4f6a-99fc-f67782263605
Demonstration of fixed behaviour in existing SP menu:
https://github.com/JACoders/OpenJK/assets/844370/16814f7c-94f3-4df3-9631-275bccd461ba