]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_screen.c
new cvar: mastervolume (controlling both volume and bgmvolume)
[xonotic/darkplaces.git] / cl_screen.c
index 8fd9b4b9540c92a2216bab0ff670c39dfd18c6eb..9050ab0d7607b4d540438409690835e70e7a1916 100644 (file)
@@ -27,6 +27,8 @@ cvar_t scr_showbrand = {0, "showbrand","0", "shows gfx/brand.tga in a corner of
 cvar_t scr_printspeed = {0, "scr_printspeed","0", "speed of intermission printing (episode end texts), a value of 0 disables the slow printing"};
 cvar_t scr_loadingscreen_background = {0, "scr_loadingscreen_background","0", "show the last visible background during loading screen (costs one screenful of video memory)"};
 cvar_t scr_loadingscreen_count = {0, "scr_loadingscreen_count","1", "number of loading screen files to use randomly (named loading.tga, loading2.tga, loading3.tga, ...)"};
+cvar_t scr_loadingscreen_barcolor = {0, "scr_loadingscreen_barcolor", "0 0 1", "rgb color of loadingscreen progress bar"};
+cvar_t scr_loadingscreen_barheight = {0, "scr_loadingscreen_barheight", "8", "a height loadingscreen progress bar"};
 cvar_t vid_conwidth = {CVAR_SAVE, "vid_conwidth", "640", "virtual width of 2D graphics system"};
 cvar_t vid_conheight = {CVAR_SAVE, "vid_conheight", "480", "virtual height of 2D graphics system"};
 cvar_t vid_pixelheight = {CVAR_SAVE, "vid_pixelheight", "1", "adjusts vertical field of vision to account for non-square pixels (1280x1024 on a CRT monitor for example)"};
@@ -763,6 +765,7 @@ void R_TimeReport_EndFrame(void)
 "%7i lightmap updates (%7i pixels)\n"
 "%4i lights%4i clears%4i scissored%7i light%7i shadow%7i dynamic\n"
 "rendered%6i meshes%8i triangles bloompixels%8i copied%8i drawn\n"
+"updated%5i indexbuffers%8i bytes%5i vertexbuffers%8i bytes\n"
 "%s"
 , loc ? "Location: " : "", loc ? loc->name : ""
 , r_refdef.stats.renders, r_refdef.view.origin[0], r_refdef.view.origin[1], r_refdef.view.origin[2], r_refdef.view.forward[0], r_refdef.view.forward[1], r_refdef.view.forward[2]
@@ -772,6 +775,7 @@ void R_TimeReport_EndFrame(void)
 , r_refdef.stats.lightmapupdates, r_refdef.stats.lightmapupdatepixels
 , r_refdef.stats.lights, r_refdef.stats.lights_clears, r_refdef.stats.lights_scissored, r_refdef.stats.lights_lighttriangles, r_refdef.stats.lights_shadowtriangles, r_refdef.stats.lights_dynamicshadowtriangles
 , r_refdef.stats.meshes, r_refdef.stats.meshes_elements / 3, r_refdef.stats.bloom_copypixels, r_refdef.stats.bloom_drawpixels
+, r_refdef.stats.indexbufferuploadcount, r_refdef.stats.indexbufferuploadsize, r_refdef.stats.vertexbufferuploadcount, r_refdef.stats.vertexbufferuploadsize
 , r_speeds_timestring);
 
                memset(&r_refdef.stats, 0, sizeof(r_refdef.stats));
@@ -853,6 +857,8 @@ void CL_Screen_Init(void)
        Cvar_RegisterVariable (&scr_menuforcewhiledisconnected);
        Cvar_RegisterVariable (&scr_loadingscreen_background);
        Cvar_RegisterVariable (&scr_loadingscreen_count);
+       Cvar_RegisterVariable (&scr_loadingscreen_barcolor);
+       Cvar_RegisterVariable (&scr_loadingscreen_barheight);
        Cvar_RegisterVariable (&scr_showram);
        Cvar_RegisterVariable (&scr_showturtle);
        Cvar_RegisterVariable (&scr_showpause);
@@ -1832,9 +1838,8 @@ void SCR_ClearLoadingScreen (qboolean redraw)
                SCR_PopLoadingScreen(redraw && !loadingscreenstack->prev);
 }
 
-static float SCR_DrawLoadingStack_r(loadingscreenstack_t *s, float y)
+static float SCR_DrawLoadingStack_r(loadingscreenstack_t *s, float y, float size)
 {
-       float size = 8;
        float x;
        size_t len;
        float total;
@@ -1843,7 +1848,7 @@ static float SCR_DrawLoadingStack_r(loadingscreenstack_t *s, float y)
 #if 0
        if(s)
        {
-               total += SCR_DrawLoadingStack_r(s->prev, y);
+               total += SCR_DrawLoadingStack_r(s->prev, y, 8);
                y -= total;
                if(!s->prev || strcmp(s->msg, s->prev->msg))
                {
@@ -1873,9 +1878,8 @@ static void SCR_DrawLoadingStack(void)
 {
        float verts[12];
        float colors[16];
-       int i;
 
-       loadingscreenheight = SCR_DrawLoadingStack_r(loadingscreenstack, vid_conheight.integer);
+       loadingscreenheight = SCR_DrawLoadingStack_r(loadingscreenstack, vid_conheight.integer, scr_loadingscreen_barheight.value);
        if(loadingscreenstack)
        {
                // height = 32; // sorry, using the actual one is ugly
@@ -1883,22 +1887,27 @@ static void SCR_DrawLoadingStack(void)
                GL_DepthRange(0, 1);
                GL_PolygonOffset(0, 0);
                GL_DepthTest(false);
-               R_Mesh_VertexPointer(verts, 0, 0);
-               R_Mesh_ColorPointer(colors, 0, 0);
                R_Mesh_ResetTextureState();
-               R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1);
                verts[2] = verts[5] = verts[8] = verts[11] = 0;
                verts[0] = verts[9] = 0;
-               verts[1] = verts[4] = vid_conheight.integer - 8;
+               verts[1] = verts[4] = vid_conheight.integer - scr_loadingscreen_barheight.value;
                verts[3] = verts[6] = vid_conwidth.integer * loadingscreenstack->absolute_loading_amount_min;
                verts[7] = verts[10] = vid_conheight.integer;
-
-               for(i = 0; i < 16; ++i)
-                       colors[i] = (i % 4 == 3) ? 1 : (i >= 8 && i % 4 == 2) ? 1 : 0;
-                       //                                        ^^^^^^^^^^ blue component
-                       //                              ^^^^^^ bottom row
-                       //          ^^^^^^^^^^^^ alpha is always on
-               R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
+               
+#if _MSC_VER >= 1400
+#define sscanf sscanf_s
+#endif
+               //                                        ^^^^^^^^^^ blue component
+               //                              ^^^^^^ bottom row
+               //          ^^^^^^^^^^^^ alpha is always on
+               colors[0] = 0; colors[1] = 0; colors[2] = 0; colors[3] = 1;
+               colors[4] = 0; colors[5] = 0; colors[6] = 0; colors[7] = 1;
+               sscanf(scr_loadingscreen_barcolor.string, "%f %f %f", &colors[8], &colors[9], &colors[10]); colors[11] = 1;
+               sscanf(scr_loadingscreen_barcolor.string, "%f %f %f", &colors[12], &colors[13], &colors[14]);  colors[15] = 1;
+
+               R_Mesh_PrepareVertices_Generic_Arrays(4, verts, colors, NULL);
+               R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1);
+               R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
 
                // make sure everything is cleared, including the progress indicator
                if(loadingscreenheight < 8)
@@ -1948,25 +1957,20 @@ static void SCR_DrawLoadingScreen_SharedSetup (qboolean clear)
 static void SCR_DrawLoadingScreen (qboolean clear)
 {
        // we only need to draw the image if it isn't already there
-       GL_Color(1,1,1,1);
        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        GL_DepthRange(0, 1);
        GL_PolygonOffset(0, 0);
        GL_DepthTest(false);
-       R_Mesh_ColorPointer(NULL, 0, 0);
+       R_Mesh_ResetTextureState();
+       GL_Color(1,1,1,1);
+       R_Mesh_PrepareVertices_Generic_Arrays(4, loadingscreentexture_vertex3f, NULL, loadingscreentexture_texcoord2f);
        if(loadingscreentexture)
        {
-               R_Mesh_VertexPointer(loadingscreentexture_vertex3f, 0, 0);
-               R_Mesh_ResetTextureState();
                R_SetupShader_Generic(loadingscreentexture, NULL, GL_MODULATE, 1);
-               R_Mesh_TexCoordPointer(0, 2, loadingscreentexture_texcoord2f, 0, 0);
-               R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
+               R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
        }
-       R_Mesh_VertexPointer(loadingscreenpic_vertex3f, 0, 0);
-       R_Mesh_ResetTextureState();
        R_SetupShader_Generic(loadingscreenpic->tex, NULL, GL_MODULATE, 1);
-       R_Mesh_TexCoordPointer(0, 2, loadingscreenpic_texcoord2f, 0, 0);
-       R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, polygonelement3s, 0, 0);
+       R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
        SCR_DrawLoadingStack();
 }