From fc978c79bbcaf36fb17ed73c69d720ebec9c677c Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Fri, 28 Mar 2014 23:28:00 +0000 Subject: [PATCH 1/5] OpenGL wall Y offset Fixed wall textures breaking when Y offset of the wall was too high. --- src/hardware/hw_main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 91ce389e..8cfa1150 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -1420,6 +1420,9 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) texturevpegtop += gr_sidedef->rowoffset; + // This is so that it doesn't overflow and screw up the wall, it doesn't need to go higher than the texture's height anyway + texturevpegtop %= SHORT(textures[texturetranslation[gr_sidedef->toptexture]]->height)<scaleY; wallVerts[0].t = wallVerts[1].t = (texturevpegtop + worldtop - worldhigh) * grTex->scaleY; wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX; @@ -1459,6 +1462,9 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) texturevpegbottom += gr_sidedef->rowoffset; + // This is so that it doesn't overflow and screw up the wall, it doesn't need to go higher than the texture's height anyway + texturevpegbottom %= SHORT(textures[texturetranslation[gr_sidedef->bottomtexture]]->height)<scaleY; wallVerts[0].t = wallVerts[1].t = (texturevpegbottom + worldlow - worldbottom) * grTex->scaleY; wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX; From 9f0aacb059b4fe2eb631b3604c16e37fe0d3eb47 Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Sun, 30 Mar 2014 17:45:58 +0100 Subject: [PATCH 2/5] MD2 Texture load fix Fixes MD2's using sprites on the first frame when they're loaded. --- src/hardware/hw_md2.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 6d3c52b0..0ab58c84 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1179,6 +1179,8 @@ void HWR_DrawMD2(gr_vissprite_t *spr) if (!gpatch || !gpatch->mipmap.grInfo.format || !gpatch->mipmap.downloaded) md2_loadTexture(md2); + gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture... + if (gpatch && gpatch->mipmap.grInfo.format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture { // This is safe, since we know the texture has been downloaded From d75d7cd09a477ebfbf47ee6e11e1f9fd0f25d29c Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Mon, 31 Mar 2014 00:07:55 +0100 Subject: [PATCH 3/5] OpenGL Splitscreen Fix First screen in split-screen is now not completely black. --- src/hardware/hw_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 8cfa1150..05964351 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -4635,7 +4635,8 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) ClearColor.blue = 0.0f; ClearColor.alpha = 1.0f; - HWD.pfnClearBuffer(true, false, &ClearColor); // Clear the Color Buffer, stops HOMs. Also seems to fix the skybox issue on Intel GPUs. + if (viewnumber == 0) // Only do it if it's the first screen being rendered + HWD.pfnClearBuffer(true, false, &ClearColor); // Clear the Color Buffer, stops HOMs. Also seems to fix the skybox issue on Intel GPUs. if (skybox && drawsky) // If there's a skybox and we should be drawing the sky, draw the skybox HWR_RenderSkyboxView(viewnumber, player); // This is drawn before everything else so it is placed behind From fc12fc7cd4e53d3b1f182e7b3839884a71ecd4fd Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Mon, 31 Mar 2014 23:47:12 +0100 Subject: [PATCH 4/5] OpenGL Screen Fading Fix Screen Wipes now work as they did in 2.0.x. --- src/d_main.c | 4 ---- src/f_wipe.c | 3 +-- src/hardware/hw_main.c | 27 +++++---------------------- src/hardware/hw_main.h | 1 - src/hardware/r_opengl/r_opengl.c | 16 +++++++++++++++- src/p_setup.c | 5 +---- 6 files changed, 22 insertions(+), 34 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 9475a77a..9e00049e 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -268,10 +268,6 @@ static void D_Display(void) && wipedefs[wipedefindex] != UINT8_MAX) { V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); -#ifdef HWRENDER - if(rendermode != render_soft) - HWR_PrepFadeToBlack(); -#endif F_WipeEndScreen(); F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK); } diff --git a/src/f_wipe.c b/src/f_wipe.c index fe740408..64d5cfee 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -288,8 +288,7 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu) if (drawMenu) M_Drawer(); // menu is drawn even on top of wipes - if (rendermode == render_soft) - I_FinishUpdate(); // page flip or blit buffer + I_FinishUpdate(); // page flip or blit buffer if (moviemode) M_SaveFrame(); diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 05964351..c59cc28d 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5347,24 +5347,6 @@ void HWR_EndScreenWipe(void) HWD.pfnEndScreenWipe(); } -// Prepare the screen for fading to black. -void HWR_PrepFadeToBlack(void) -{ - FOutVector v[4]; - INT32 flags; - FSurfaceInfo Surf; - - v[0].x = v[2].y = v[3].x = v[3].y = -1.0f; - v[0].y = v[1].x = v[1].y = v[2].x = 1.0f; - v[0].z = v[1].z = v[2].z = v[3].z = 1.0f; - - flags = PF_Modulated | PF_Clip | PF_NoZClip | PF_NoDepthTest | PF_NoTexture; - Surf.FlatColor.s.red = Surf.FlatColor.s.green = Surf.FlatColor.s.blue = 0x00; - Surf.FlatColor.s.alpha = 0xff; - - HWD.pfnDrawPolygon(&Surf, v, 4, flags); -} - void HWR_DrawIntermissionBG(void) { HWD.pfnDrawIntermissionBG(); @@ -5372,14 +5354,15 @@ void HWR_DrawIntermissionBG(void) void HWR_DoScreenWipe(void) { - HWRWipeCounter -= 0.035f; - //CONS_Debug(DBG_RENDER, "In HWR_DoScreenWipe(). Alpha =%f\n", HWRWipeCounter); HWD.pfnDoScreenWipe(HWRWipeCounter); - I_OsPolling(); - I_FinishUpdate(); + // This works for all the cases in vanilla until fade masks get done + HWRWipeCounter -= 0.05f; // Go less opaque after + + if (HWRWipeCounter < 0) + HWRWipeCounter = 0; } #endif // HWRENDER diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index c93d4ea6..8d8b69e6 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -64,7 +64,6 @@ void HWR_DoPostProcessor(player_t *player); void HWR_StartScreenWipe(void); void HWR_EndScreenWipe(void); void HWR_DoScreenWipe(void); -void HWR_PrepFadeToBlack(void); void HWR_DrawIntermissionBG(void); // This stuff is put here so MD2's can use them diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index c9a2f392..ded8d076 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -2016,6 +2016,8 @@ EXPORT void HWRAPI(StartScreenWipe) (void) #ifndef KOS_GL_COMPATIBILITY pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, texsize, texsize, 0); #endif + + tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now } // Create Screen to fade to @@ -2043,6 +2045,8 @@ EXPORT void HWRAPI(EndScreenWipe)(void) #ifndef KOS_GL_COMPATIBILITY pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, texsize, texsize, 0); #endif + + tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now } @@ -2060,7 +2064,7 @@ EXPORT void HWRAPI(DrawIntermissionBG)(void) xfix = 1/((float)(texsize)/((float)((screen_width)))); yfix = 1/((float)(texsize)/((float)((screen_height)))); - //pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); + pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); pglBindTexture(GL_TEXTURE_2D, screentexture); pglBegin(GL_QUADS); @@ -2083,6 +2087,8 @@ EXPORT void HWRAPI(DrawIntermissionBG)(void) pglVertex3f(1.0f, -1.0f, 1.0f); pglEnd(); + + tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now } // Do screen fades! @@ -2102,6 +2108,8 @@ EXPORT void HWRAPI(DoScreenWipe)(float alpha) pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); + SetBlend(PF_Modulated|PF_NoDepthTest|PF_Clip|PF_NoZClip); + // Draw the screen on bottom to fade to pglBindTexture(GL_TEXTURE_2D, endScreenWipe); pglBegin(GL_QUADS); @@ -2124,6 +2132,8 @@ EXPORT void HWRAPI(DoScreenWipe)(float alpha) pglVertex3f(1.0f, -1.0f, 1.0f); pglEnd(); + SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest|PF_Clip|PF_NoZClip); + // Draw the screen on top that fades. pglBindTexture(GL_TEXTURE_2D, startScreenWipe); pglBegin(GL_QUADS); @@ -2146,6 +2156,8 @@ EXPORT void HWRAPI(DoScreenWipe)(float alpha) pglVertex3f(1.0f, -1.0f, 1.0f); pglEnd(); + + tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now } @@ -2174,6 +2186,8 @@ EXPORT void HWRAPI(MakeScreenTexture) (void) #ifndef KOS_GL_COMPATIBILITY pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, texsize, texsize, 0); #endif + + tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now } #endif //HWRENDER diff --git a/src/p_setup.c b/src/p_setup.c index 9b32d4a0..64f67094 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2435,10 +2435,7 @@ noscript: { F_WipeStartScreen(); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); -#ifdef HWRENDER - if(rendermode != render_soft) - HWR_PrepFadeToBlack(); -#endif + F_WipeEndScreen(); F_RunWipe(wipedefs[wipe_level_toblack], false); From 56fbdfdad3ab828ca02f8c602669e75fc1f42b68 Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Sat, 5 Apr 2014 22:13:09 +0100 Subject: [PATCH 5/5] OpenGL Translucent Midtexture Fix Translucent Midtextures using holes with textures in them now work when there is no FOF's above their sector. --- src/hardware/hw_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index c59cc28d..341845a1 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -1654,12 +1654,12 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) break; } if (grTex->mipmap.flags & TF_TRANSPARENT) - blendmode = PF_Environment; + blendmode = PF_Translucent; if (gr_frontsector->numlights) { if (!(blendmode & PF_Masked)) - HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, &Surf, FF_CUTSOLIDS|FF_TRANSLUCENT); + HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, &Surf, FF_TRANSLUCENT); else HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, &Surf, FF_CUTSOLIDS); }