+qboolean CL_VM_UpdateView (void);
+void SCR_DrawConsole (void);
+
+int r_stereo_side;
+
+void SCR_DrawScreen (void)
+{
+ R_Mesh_Start();
+
+ R_TimeReport("setup");
+
+ if (cls.signon == SIGNONS)
+ {
+ float size;
+
+ size = scr_viewsize.value * (1.0 / 100.0);
+ size = min(size, 1);
+
+ if (r_stereo_sidebyside.integer)
+ {
+ r_refdef.width = vid.width * size / 2.5;
+ r_refdef.height = vid.height * size / 2.5 * (1 - bound(0, r_letterbox.value, 100) / 100);
+ r_refdef.x = (vid.width - r_refdef.width * 2.5) * 0.5;
+ r_refdef.y = (vid.height - r_refdef.height)/2;
+ if (r_stereo_side)
+ r_refdef.x += r_refdef.width * 1.5;
+ }
+ else
+ {
+ r_refdef.width = vid.width * size;
+ r_refdef.height = vid.height * size * (1 - bound(0, r_letterbox.value, 100) / 100);
+ r_refdef.x = (vid.width - r_refdef.width)/2;
+ r_refdef.y = (vid.height - r_refdef.height)/2;
+ }
+
+ // LordHavoc: viewzoom (zoom in for sniper rifles, etc)
+ // LordHavoc: this is designed to produce widescreen fov values
+ // when the screen is wider than 4/3 width/height aspect, to do
+ // this it simply assumes the requested fov is the vertical fov
+ // for a 4x3 display, if the ratio is not 4x3 this makes the fov
+ // higher/lower according to the ratio
+ r_refdef.frustum_y = tan(scr_fov.value * cl.viewzoom * M_PI / 360.0) * (3.0/4.0);
+ r_refdef.frustum_x = r_refdef.frustum_y * (float)r_refdef.width / (float)r_refdef.height / vid_pixelheight.value;
+
+ r_refdef.frustum_x *= r_refdef.frustumscale_x;
+ r_refdef.frustum_y *= r_refdef.frustumscale_y;
+
+ if(!CL_VM_UpdateView())
+ R_RenderView();
+ else
+ SCR_DrawConsole();
+
+ if (scr_zoomwindow.integer)
+ {
+ float sizex = bound(10, scr_zoomwindow_viewsizex.value, 100) / 100.0;
+ float sizey = bound(10, scr_zoomwindow_viewsizey.value, 100) / 100.0;
+ r_refdef.width = vid.width * sizex;
+ r_refdef.height = vid.height * sizey;
+ r_refdef.x = (vid.width - r_refdef.width)/2;
+ r_refdef.y = 0;
+
+ r_refdef.frustum_y = tan(scr_zoomwindow_fov.value * cl.viewzoom * M_PI / 360.0) * (3.0/4.0);
+ r_refdef.frustum_x = r_refdef.frustum_y * vid_pixelheight.value * (float)r_refdef.width / (float)r_refdef.height;
+
+ r_refdef.frustum_x *= r_refdef.frustumscale_x;
+ r_refdef.frustum_y *= r_refdef.frustumscale_y;
+
+ if(!CL_VM_UpdateView())
+ R_RenderView();
+ }
+ }
+
+ if (!r_stereo_sidebyside.integer)
+ {
+ r_refdef.width = vid.width;
+ r_refdef.height = vid.height;
+ r_refdef.x = 0;
+ r_refdef.y = 0;
+ }
+
+ // draw 2D stuff
+ R_DrawQueue();
+
+ R_Mesh_Finish();
+
+ R_TimeReport("meshfinish");
+}
+
+void SCR_UpdateLoadingScreen (void)
+{
+ float x, y;
+ cachepic_t *pic;
+ rmeshstate_t m;
+ // don't do anything if not initialized yet
+ if (vid_hidden)
+ return;
+ r_showtrispass = 0;
+ VID_UpdateGamma(false);
+ qglViewport(0, 0, vid.width, vid.height);
+ //qglDisable(GL_SCISSOR_TEST);
+ //qglDepthMask(1);
+ qglColorMask(1,1,1,1);
+ //qglClearColor(0,0,0,0);
+ //qglClear(GL_COLOR_BUFFER_BIT);
+ //qglCullFace(GL_FRONT);
+ //qglDisable(GL_CULL_FACE);
+ //R_ClearScreen();
+ R_Textures_Frame();
+ GL_SetupView_Mode_Ortho(0, 0, vid_conwidth.integer, vid_conheight.integer, -10, 100);
+ R_Mesh_Start();
+ R_Mesh_Matrix(&r_identitymatrix);
+ // draw the loading plaque
+ pic = Draw_CachePic("gfx/loading", false);
+ x = (vid_conwidth.integer - pic->width)/2;
+ y = (vid_conheight.integer - pic->height)/2;
+ GL_Color(1,1,1,1);
+ GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ GL_DepthTest(false);
+ memset(&m, 0, sizeof(m));
+ m.pointer_vertex = varray_vertex3f;
+ m.pointer_texcoord[0] = varray_texcoord2f[0];
+ m.tex[0] = R_GetTexture(pic->tex);
+ R_Mesh_State(&m);
+ varray_vertex3f[0] = varray_vertex3f[9] = x;
+ varray_vertex3f[1] = varray_vertex3f[4] = y;
+ varray_vertex3f[3] = varray_vertex3f[6] = x + pic->width;
+ varray_vertex3f[7] = varray_vertex3f[10] = y + pic->height;
+ varray_texcoord2f[0][0] = 0;varray_texcoord2f[0][1] = 0;
+ varray_texcoord2f[0][2] = 1;varray_texcoord2f[0][3] = 0;
+ varray_texcoord2f[0][4] = 1;varray_texcoord2f[0][5] = 1;
+ varray_texcoord2f[0][6] = 0;varray_texcoord2f[0][7] = 1;
+ GL_LockArrays(0, 4);
+ R_Mesh_Draw(0, 4, 2, polygonelements);
+ GL_LockArrays(0, 0);
+ R_Mesh_Finish();
+ // refresh
+ VID_Finish();
+}
+