]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_screen.c
implemented sv_gameplayfix_delayprojectiles -1 (force move on first
[xonotic/darkplaces.git] / cl_screen.c
index 546e34de3cf41e78fdfaa920c0dd885a93f7a8d3..c3c10953112926cb4b8763d8774198a64bcef5d4 100644 (file)
@@ -55,6 +55,7 @@ cvar_t scr_zoomwindow_viewsizey = {CVAR_SAVE, "scr_zoomwindow_viewsizey", "20",
 cvar_t scr_zoomwindow_fov = {CVAR_SAVE, "scr_zoomwindow_fov", "20", "fov of zoom window"};
 cvar_t scr_stipple = {0, "scr_stipple", "0", "interlacing-like stippling of the display"};
 cvar_t scr_refresh = {0, "scr_refresh", "1", "allows you to completely shut off rendering for benchmarking purposes"};
+cvar_t scr_screenshot_name_in_mapdir = {CVAR_SAVE, "scr_screenshot_name_in_mapdir", "0", "if set to 1, screenshots are placed in a subdirectory named like the map they are from"};
 cvar_t shownetgraph = {CVAR_SAVE, "shownetgraph", "0", "shows a graph of packet sizes and other information, 0 = off, 1 = show client netgraph, 2 = show client and server netgraphs (when hosting a server)"};
 cvar_t cl_demo_mousegrab = {0, "cl_demo_mousegrab", "0", "Allows reading the mouse input while playing demos. Useful for camera mods developed in csqc. (0: never, 1: always)"};
 
@@ -559,7 +560,7 @@ static int SCR_DrawCurlDownload(int offset)
 SCR_DrawInfobar
 ==============
 */
-static void SCR_DrawInfobar()
+static void SCR_DrawInfobar(void)
 {
        int offset = 0;
        if(scr_infobartime_off > 0)
@@ -570,7 +571,7 @@ static void SCR_DrawInfobar()
                Con_DPrintf("broken console margin calculation: %d != %d\n", offset, scr_con_margin_bottom);
 }
 
-static int SCR_InfobarHeight()
+static int SCR_InfobarHeight(void)
 {
        int offset = 0;
        Curl_downloadinfo_t *downinfo;
@@ -862,6 +863,7 @@ void CL_Screen_Init(void)
        Cvar_RegisterVariable (&scr_screenshot_jpeg_quality);
        Cvar_RegisterVariable (&scr_screenshot_gammaboost);
        Cvar_RegisterVariable (&scr_screenshot_hwgamma);
+       Cvar_RegisterVariable (&scr_screenshot_name_in_mapdir);
        Cvar_RegisterVariable (&cl_capturevideo);
        Cvar_RegisterVariable (&cl_capturevideo_printfps);
        Cvar_RegisterVariable (&cl_capturevideo_width);
@@ -910,12 +912,22 @@ void SCR_ScreenShot_f (void)
        static char old_prefix_name[MAX_QPATH];
        char prefix_name[MAX_QPATH];
        char filename[MAX_QPATH];
+       char mapname[MAX_QPATH];
        unsigned char *buffer1;
        unsigned char *buffer2;
        unsigned char *buffer3;
        qboolean jpeg = (scr_screenshot_jpeg.integer != 0);
 
-       dpsnprintf (prefix_name, sizeof(prefix_name), "%s", Sys_TimeString(scr_screenshot_name.string));
+       // TODO maybe make capturevideo and screenshot use similar name patterns?
+       if (scr_screenshot_name_in_mapdir.integer && cl.worldmodel && *cl.worldmodel->name) {
+               // figure out the map's filename without path or extension
+               strlcpy(mapname, FS_FileWithoutPath(cl.worldmodel->name), sizeof(mapname));
+               if (strrchr(mapname, '.'))
+                       *(strrchr(mapname, '.')) = 0;
+               dpsnprintf (prefix_name, sizeof(prefix_name), "%s/%s", mapname, Sys_TimeString(scr_screenshot_name.string));
+       } else {
+               dpsnprintf (prefix_name, sizeof(prefix_name), "%s", Sys_TimeString(scr_screenshot_name.string));
+       }
 
        if (strcmp(old_prefix_name, prefix_name))
        {
@@ -1637,7 +1649,7 @@ rtexture_t *loadingscreentexture = NULL;
 static float loadingscreentexture_vertex3f[12];
 static float loadingscreentexture_texcoord2f[8];
 
-static void SCR_ClearLoadingScreenTexture()
+static void SCR_ClearLoadingScreenTexture(void)
 {
        if(loadingscreentexture)
                R_FreeTexture(loadingscreentexture);
@@ -1645,7 +1657,7 @@ static void SCR_ClearLoadingScreenTexture()
 }
 
 extern rtexturepool_t *r_main_texturepool;
-static void SCR_SetLoadingScreenTexture()
+static void SCR_SetLoadingScreenTexture(void)
 {
        int w, h;
        float loadingscreentexture_w;
@@ -1682,7 +1694,7 @@ static void SCR_SetLoadingScreenTexture()
        loadingscreentexture_texcoord2f[6] = 0;loadingscreentexture_texcoord2f[7] = 0;
 }
 
-void SCR_UpdateLoadingScreenIfShown()
+void SCR_UpdateLoadingScreenIfShown(void)
 {
        if(realtime == loadingscreentime)
                SCR_UpdateLoadingScreen(loadingscreencleared);
@@ -1776,7 +1788,7 @@ static float SCR_DrawLoadingStack_r(loadingscreenstack_t *s, float y)
        return total;
 }
 
-static void SCR_DrawLoadingStack()
+static void SCR_DrawLoadingStack(void)
 {
        float verts[12];
        float colors[16];
@@ -1935,6 +1947,16 @@ void SCR_UpdateLoadingScreen (qboolean clear)
        key_consoleactive = old_key_consoleactive;
 }
 
+qboolean R_Stereo_ColorMasking(void)
+{
+       return r_stereo_redblue.integer || r_stereo_redgreen.integer || r_stereo_redcyan.integer;
+}
+
+qboolean R_Stereo_Active(void)
+{
+       return (vid.stereobuffer || r_stereo_sidebyside.integer || R_Stereo_ColorMasking());
+}
+
 extern cvar_t cl_minfps;
 extern cvar_t cl_minfps_fade;
 extern cvar_t cl_minfps_qualitymax;
@@ -2051,7 +2073,7 @@ void CL_UpdateScreen(void)
        else
                qglDisable(GL_POLYGON_STIPPLE);
 
-       if (vid.stereobuffer || r_stereo_redblue.integer || r_stereo_redgreen.integer || r_stereo_redcyan.integer || r_stereo_sidebyside.integer)
+       if (R_Stereo_Active())
        {
                matrix4x4_t originalmatrix = r_refdef.view.matrix;
                matrix4x4_t offsetmatrix;