From: terencehill Date: Wed, 22 May 2024 21:55:25 +0000 (+0200) Subject: Make autoscreenshot more reliable by making sure scoreboard is not obstructed by... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1029da27e543081a81e04ad397cff6caa988a593;p=xonotic%2Fxonotic-data.pk3dir.git Make autoscreenshot more reliable by making sure scoreboard is not obstructed by anything else (menu, console, etc...). Screenshot is taken 0.2 seconds after game ends instead of 0.8 (server-side 0.1s delay + client-side 0.1s delay) --- diff --git a/qcsrc/client/hud/panel/quickmenu.qc b/qcsrc/client/hud/panel/quickmenu.qc index 0f3425203..fde929d53 100644 --- a/qcsrc/client/hud/panel/quickmenu.qc +++ b/qcsrc/client/hud/panel/quickmenu.qc @@ -5,6 +5,7 @@ #include #include #include +#include // 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() diff --git a/qcsrc/server/intermission.qc b/qcsrc/server/intermission.qc index 917eb8ce4..7fe38c650 100644 --- a/qcsrc/server/intermission.qc +++ b/qcsrc/server/intermission.qc @@ -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) { diff --git a/xonotic-client.cfg b/xonotic-client.cfg index 666a06538..3c658a865 100644 --- a/xonotic-client.cfg +++ b/xonotic-client.cfg @@ -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"