]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make autoscreenshot more reliable by making sure scoreboard is not obstructed by...
authorterencehill <piuntn@gmail.com>
Wed, 22 May 2024 21:55:25 +0000 (23:55 +0200)
committerterencehill <piuntn@gmail.com>
Wed, 22 May 2024 22:16:49 +0000 (00:16 +0200)
Screenshot is taken 0.2 seconds after game ends instead of 0.8 (server-side 0.1s delay + client-side 0.1s delay)

qcsrc/client/hud/panel/quickmenu.qc
qcsrc/server/intermission.qc
xonotic-client.cfg

index 0f3425203600cb5be5fedaedb0b45d9bcb32b9af..fde929d538ac05674d640454454b12877b46812e 100644 (file)
@@ -5,6 +5,7 @@
 #include <client/mapvoting.qh>
 #include <common/ent_cs.qh>
 #include <common/minigames/cl_minigames.qh>
+#include <client/view.qh>
 
 // QuickMenu (#23)
 
@@ -84,6 +85,7 @@ void QuickMenu_Page_ClearEntry(int i)
 bool HUD_QuickMenu_Forbidden()
 {
        return (mv_active
+               || intermission_time == time // close upon game over, can still be opened during intermission
                || scoreboard_ui_enabled
                || (hud_configure_prev && hud_configure_prev != -1)
                || HUD_MinigameMenu_IsOpened()
index 917eb8ce44b18901b3704e7226cf3bfaf99ea1dd..7fe38c6500f239eb7756259cbd82337340f9c09c 100644 (file)
@@ -444,7 +444,7 @@ void IntermissionThink(entity this)
                if(IS_REAL_CLIENT(this))
                {
                        string num = strftime_s(); // strftime(false, "%s") isn't reliable, see strftime_s description
-                       stuffcmd(this, sprintf("\nscreenshot screenshots/autoscreenshot/%s-%s.jpg; "
+                       stuffcmd(this, sprintf("\ncl_autoscreenshot_screenshot %s %s; "
                                "echo \"^5A screenshot has been taken at request of the server.\"\n", GetMapname(), num));
                }
                return;
@@ -464,7 +464,7 @@ void FixIntermissionClient(entity e)
 {
        if(!e.autoscreenshot) // initial call
        {
-               e.autoscreenshot = time + 0.8;  // used for autoscreenshot
+               e.autoscreenshot = time + 0.1;
                SetResourceExplicit(e, RES_HEALTH, -2342); // health in the first intermission phase
                for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
                {
index 666a065385e84a3c3cc7101728c09c8f0923c832..3c658a8658924c4eb66a3b44564e816b9bb4f2de 100644 (file)
@@ -693,7 +693,13 @@ set cl_handicap 1  "multiplies damage received and divides damage dealt"
 
 seta cl_clippedspectating 1 "movement collision for spectators so that you can't pass through walls and such"
 
+// cl_autoscreenshot_screenshot is called by the server when the game ends with map name and match id as parameters
+// it takes care of hiding all the UI parts that may overlap the scoredoard before taking a screenshot
 seta cl_autoscreenshot 1 "Take a screenshot upon the end of a match... 0 = Disable completely, 1 = Allow sv_autoscreenshot to take a screenshot when requested, 2 = Always take an autoscreenshot anyway."
+alias _cl_autoscreenshot_save "set _con_chattime_save $con_chattime; set _hud_panel_scoreboard_fadeinspeed_save $hud_panel_scoreboard_fadeinspeed; set _menu_slowmo_save $menu_slowmo; set _scr_conheight_save $scr_conheight; set _con_textsize_save $con_textsize; set _scr_conalpha_save $scr_conalpha"
+alias _cl_autoscreenshot_set "con_chattime 0.001; hud_panel_scoreboard_fadeinspeed 999; menu_slowmo 999; scr_conheight 0; con_textsize 1; scr_conalpha 0"
+alias _cl_autoscreenshot_restore "set con_chattime $_con_chattime_save; set hud_panel_scoreboard_fadeinspeed $_hud_panel_scoreboard_fadeinspeed_save; set menu_slowmo $_menu_slowmo_save; set scr_conheight $_scr_conheight_save; set con_textsize $_con_textsize_save; set scr_conalpha $_scr_conalpha_save"
+alias cl_autoscreenshot_screenshot "togglemenu 0; -con_chat_maximize; _cl_autoscreenshot_save; _cl_autoscreenshot_set; defer 0.1 \"screenshot screenshots/autoscreenshot/${1}-${2}.jpg\"; defer 0.1 \"_cl_autoscreenshot_restore\""
 
 seta cl_jetpack_jump 1 "Activate jetpack by pressing jump in the air. 0 = Disable, 1 = Stop when touching ground, 2 = Enable"