From f08c30f7ba95618605b977afd056d34022d90095 Mon Sep 17 00:00:00 2001 From: clement Date: Sun, 4 Jan 2026 16:51:47 +0000 Subject: [PATCH 1/2] add option to enable/disable ui transitions --- share/config.c | 2 ++ share/config.h | 3 ++- share/gui.c | 6 ++++++ share/st_common.c | 17 +++++++++++++++-- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/share/config.c b/share/config.c index ea6507277..82aa53b64 100644 --- a/share/config.c +++ b/share/config.c @@ -46,6 +46,7 @@ int CONFIG_MOUSE_SENSE; int CONFIG_MOUSE_RESPONSE; int CONFIG_MOUSE_INVERT; int CONFIG_VSYNC; +int CONFIG_TRANSITIONS; int CONFIG_HMD; int CONFIG_HIGHDPI; int CONFIG_MOUSE_CAMERA_1; @@ -158,6 +159,7 @@ static struct { &CONFIG_MOUSE_RESPONSE, "mouse_response", 50 }, { &CONFIG_MOUSE_INVERT, "mouse_invert", 0 }, { &CONFIG_VSYNC, "vsync", 1 }, + { &CONFIG_TRANSITIONS, "uitransitions", 1}, { &CONFIG_HMD, "hmd", 0 }, { &CONFIG_HIGHDPI, "highdpi", 1 }, diff --git a/share/config.h b/share/config.h index 8f2e241a9..f5d9ca23c 100644 --- a/share/config.h +++ b/share/config.h @@ -38,6 +38,7 @@ extern int CONFIG_MOUSE_RESPONSE; extern int CONFIG_MOUSE_INVERT; extern int CONFIG_VSYNC; extern int CONFIG_HMD; +extern int CONFIG_TRANSITIONS; extern int CONFIG_HIGHDPI; extern int CONFIG_MOUSE_CAMERA_1; extern int CONFIG_MOUSE_CAMERA_2; @@ -153,4 +154,4 @@ int config_screenshot(void); /*---------------------------------------------------------------------------*/ -#endif \ No newline at end of file +#endif diff --git a/share/gui.c b/share/gui.c index 8f686e860..cfc261fcd 100644 --- a/share/gui.c +++ b/share/gui.c @@ -1733,6 +1733,12 @@ static void gui_widget_offset(int id, int pd) void gui_set_slide(int id, int flags, float delay, float t, float stagger) { + if(config_get_d(CONFIG_TRANSITIONS) == 0){ + if(t != 0 || delay != 0){ //fix for hack at hud.c:117 + t = 0.0000000001f; + delay = 0.00000001f; + } + } if (id) { int jd, c = 0; diff --git a/share/st_common.c b/share/st_common.c index 246577ece..d8328ed4c 100644 --- a/share/st_common.c +++ b/share/st_common.c @@ -252,7 +252,8 @@ enum VIDEO_SHADOW, VIDEO_VSYNC, VIDEO_HMD, - VIDEO_MULTISAMPLE + VIDEO_MULTISAMPLE, + VIDEO_TRANSITIONS }; static struct state *video_back; @@ -326,6 +327,12 @@ static int video_action(int tok, int val) r = video_mode(f, w, h); goto_state(&st_video); break; + case VIDEO_TRANSITIONS: + goto_state(&st_null); + config_set_d(CONFIG_TRANSITIONS, val); + r = video_mode(f, w, h); + goto_state(&st_video); + break; } return r; @@ -400,7 +407,13 @@ static int video_gui(void) conf_toggle(id, _("Shadow"), VIDEO_SHADOW, config_get_d(CONFIG_SHADOW), _("On"), 1, _("Off"), 0); - gui_layout(id, 0, 0); + gui_space(id); + + conf_toggle(id, _("UI Transitions"), VIDEO_TRANSITIONS, + config_get_d(CONFIG_TRANSITIONS), _("On"), 1, _("Off"), 0); + + gui_layout(id, 0, 0); + } return id; From 7af3ba1b59d0a969a3324e54473b08a93763d125 Mon Sep 17 00:00:00 2001 From: Byron Johnson Date: Sat, 7 Mar 2026 19:17:06 -0700 Subject: [PATCH 2/2] Clean up clement's contribution. --- share/config.c | 2 +- share/gui.c | 20 +++++++++++--------- share/st_common.c | 12 ++++++------ 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/share/config.c b/share/config.c index 82aa53b64..25fc4b52e 100644 --- a/share/config.c +++ b/share/config.c @@ -159,7 +159,7 @@ static struct { &CONFIG_MOUSE_RESPONSE, "mouse_response", 50 }, { &CONFIG_MOUSE_INVERT, "mouse_invert", 0 }, { &CONFIG_VSYNC, "vsync", 1 }, - { &CONFIG_TRANSITIONS, "uitransitions", 1}, + { &CONFIG_TRANSITIONS, "ui_transitions", 1 }, { &CONFIG_HMD, "hmd", 0 }, { &CONFIG_HIGHDPI, "highdpi", 1 }, diff --git a/share/gui.c b/share/gui.c index cfc261fcd..e19c21d74 100644 --- a/share/gui.c +++ b/share/gui.c @@ -1733,12 +1733,6 @@ static void gui_widget_offset(int id, int pd) void gui_set_slide(int id, int flags, float delay, float t, float stagger) { - if(config_get_d(CONFIG_TRANSITIONS) == 0){ - if(t != 0 || delay != 0){ //fix for hack at hud.c:117 - t = 0.0000000001f; - delay = 0.00000001f; - } - } if (id) { int jd, c = 0; @@ -2324,10 +2318,18 @@ void gui_timer(int id, float dt) widget[id].slide_time += dt; - alpha = (widget[id].slide_time - widget[id].slide_delay) / widget[id].slide_dur; - alpha = CLAMP(0.0f, alpha, 1.0f); + if (config_get_d(CONFIG_TRANSITIONS) == 0) + { + alpha = 1.0f; + at_end = 1; + } + else + { + alpha = (widget[id].slide_time - widget[id].slide_delay) / widget[id].slide_dur; + alpha = CLAMP(0.0f, alpha, 1.0f); - at_end = (alpha >= 1.0f); + at_end = (alpha >= 1.0f); + } if (widget[id].slide_flags & GUI_BACKWARD) { diff --git a/share/st_common.c b/share/st_common.c index d8328ed4c..bfcc73bfc 100644 --- a/share/st_common.c +++ b/share/st_common.c @@ -328,7 +328,7 @@ static int video_action(int tok, int val) goto_state(&st_video); break; case VIDEO_TRANSITIONS: - goto_state(&st_null); + goto_state(&st_null); config_set_d(CONFIG_TRANSITIONS, val); r = video_mode(f, w, h); goto_state(&st_video); @@ -407,12 +407,12 @@ static int video_gui(void) conf_toggle(id, _("Shadow"), VIDEO_SHADOW, config_get_d(CONFIG_SHADOW), _("On"), 1, _("Off"), 0); - gui_space(id); - - conf_toggle(id, _("UI Transitions"), VIDEO_TRANSITIONS, + gui_space(id); + + conf_toggle(id, _("UI Transitions"), VIDEO_TRANSITIONS, config_get_d(CONFIG_TRANSITIONS), _("On"), 1, _("Off"), 0); - - gui_layout(id, 0, 0); + + gui_layout(id, 0, 0); }