From: havoc Date: Fri, 26 Nov 2004 00:57:30 +0000 (+0000) Subject: redesigned drawing of loading plaque, it's now a separate refresh function which... X-Git-Tag: xonotic-v0.1.0preview~5340 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=96409c902b1b9f037427afc141c0de1bc5fdc4a0;ds=sidebyside redesigned drawing of loading plaque, it's now a separate refresh function which draws over the previous frame, rather than invoking a new render, which should fix crashes with level changes with rtlights on (trying to render an rtlight while the map the rtlight was for has already been unloaded tends to cause a crash) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4796 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_screen.c b/cl_screen.c index 2628fd7b..9177d0e6 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -38,8 +38,6 @@ float scr_conlines; // lines of console to display extern int con_vislines; -qboolean scr_drawloading = false; - void DrawCrosshair(int num); static void SCR_ScreenShot_f (void); static void R_Envmap_f (void); @@ -224,19 +222,6 @@ void SCR_DrawPause (void) -/* -============== -SCR_DrawLoading -============== -*/ -void SCR_DrawLoading (void) -{ - cachepic_t *pic; - - pic = Draw_CachePic ("gfx/loading.lmp"); - DrawQ_Pic ((vid.conwidth - pic->width)/2, (vid.conheight - pic->height)/2, "gfx/loading.lmp", 0, 0, 1, 1, 1, 1, 0); -} - //============================================================================= @@ -309,15 +294,8 @@ SCR_BeginLoadingPlaque */ void SCR_BeginLoadingPlaque (void) { - if (scr_drawloading) - return; - S_StopAllSounds (); - - scr_drawloading = true; - CL_UpdateScreen (); - scr_drawloading = true; - CL_UpdateScreen (); + SCR_UpdateLoadingScreen(); } //============================================================================= @@ -1243,35 +1221,28 @@ void CL_UpdateScreen(void) //FIXME: force menu if nothing else to look at? //if (key_dest == key_game && cls.signon != SIGNONS && cls.state == ca_disconnected) - if (scr_drawloading) + if (cls.signon == SIGNONS) { - scr_drawloading = false; - SCR_DrawLoading(); + SCR_DrawNet (); + SCR_DrawTurtle (); + SCR_DrawPause (); + if (!r_letterbox.value) + Sbar_Draw(); + SHOWLMP_drawall(); + SCR_CheckDrawCenterString(); } - else + MR_Draw(); + UI_Callback_Draw(); + CL_DrawVideo(); + //ui_draw(); + if (cls.signon == SIGNONS) { - if (cls.signon == SIGNONS) - { - SCR_DrawNet (); - SCR_DrawTurtle (); - SCR_DrawPause (); - if (!r_letterbox.value) - Sbar_Draw(); - SHOWLMP_drawall(); - SCR_CheckDrawCenterString(); - } - MR_Draw(); - UI_Callback_Draw(); - CL_DrawVideo(); - //ui_draw(); - if (cls.signon == SIGNONS) - { - R_TimeReport("2d"); - R_TimeReport_End(); - R_TimeReport_Start(); - } - R_Shadow_EditLights_DrawSelectedLightProperties(); + R_TimeReport("2d"); + R_TimeReport_End(); + R_TimeReport_Start(); } + R_Shadow_EditLights_DrawSelectedLightProperties(); + SCR_DrawConsole(); SCR_UpdateScreen(); diff --git a/gl_backend.c b/gl_backend.c index 299e42ab..3d356737 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -1343,6 +1343,59 @@ void SCR_DrawScreen (void) R_TimeReport("meshfinish"); } + r_showtrispass = 0; +} + +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_GetWindowSize(&vid.realx, &vid.realy, &vid.realwidth, &vid.realheight); + VID_UpdateGamma(false); + qglViewport(0, 0, vid.realwidth, vid.realheight); + //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.lmp"); + 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(4, 2, polygonelements); + GL_LockArrays(0, 0); + R_Mesh_Finish(); + // refresh + VID_Finish(); } /* @@ -1355,6 +1408,9 @@ text to the screen. */ void SCR_UpdateScreen (void) { + if (vid_hidden) + return; + if (r_textureunits.integer > gl_textureunits) Cvar_SetValueQuick(&r_textureunits, gl_textureunits); if (r_textureunits.integer < 1) diff --git a/gl_backend.h b/gl_backend.h index 645aeaf6..69287506 100644 --- a/gl_backend.h +++ b/gl_backend.h @@ -85,6 +85,8 @@ qboolean SCR_ScreenShot(char *filename, qbyte *buffer1, qbyte *buffer2, qbyte *b void R_ClearScreen(void); // invoke refresh of frame void SCR_UpdateScreen(void); +// invoke refresh of loading plaque (nothing else seen) +void SCR_UpdateLoadingScreen(void); // public structure typedef struct rcachearrayrequest_s