diff --git a/src/hardware/hw_defs.h b/src/hardware/hw_defs.h index 9cb48620e..3752cbf05 100644 --- a/src/hardware/hw_defs.h +++ b/src/hardware/hw_defs.h @@ -219,7 +219,8 @@ enum EPolyFlags PF_Substractive = 0x00000010, // for splat PF_NoAlphaTest = 0x00000020, // hiden param PF_Fog = 0x00000040, // Fog blocks - PF_Blending = (PF_Environment|PF_Additive|PF_Translucent|PF_Masked|PF_Substractive|PF_Fog)&~PF_NoAlphaTest, + PF_Invert = 0x00000080, // Polygon inverts the colours of what it's in front of + PF_Blending = (PF_Environment|PF_Additive|PF_Translucent|PF_Masked|PF_Substractive|PF_Fog|PF_Invert)&~PF_NoAlphaTest, // other flag bits diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index 69f37a29b..d3812983e 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -697,6 +697,27 @@ void HWR_DrawConsoleBack(UINT32 color, INT32 height) HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest); } +void HWR_EncoreInvertScreen(void) +{ + FOutVector v[4]; + FSurfaceInfo Surf; + + v[0].x = v[3].x = -1.0f; + v[2].x = v[1].x = 1.0f; + v[0].y = v[1].y = -1.0f; + v[2].y = v[3].y = 1.0f; + v[0].z = v[1].z = v[2].z = v[3].z = 1.0f; + + v[0].s = v[3].s = 0.0f; + v[2].s = v[1].s = 1.0f; + v[0].t = v[1].t = 1.0f; + v[2].t = v[3].t = 0.0f; + + Surf.PolyColor.rgba = 0xFFFFFFFF; + + HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Invert|PF_NoDepthTest); +} + // Very similar to HWR_DrawConsoleBack, except we draw from the middle(-ish) of the screen to the bottom. void HWR_DrawTutorialBack(UINT32 color, INT32 boxheight) { diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 3efeca45b..dfefc2a2f 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -28,6 +28,7 @@ void HWR_Shutdown(void); void HWR_drawAMline(const fline_t *fl, INT32 color); void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength); void HWR_DrawConsoleBack(UINT32 color, INT32 height); +void HWR_EncoreInvertScreen(void); void HWR_DrawTutorialBack(UINT32 color, INT32 boxheight); void HWR_RenderSkyboxView(player_t *player); void HWR_RenderPlayerView(void); diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 9e9bbee81..ceea6558d 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1599,6 +1599,10 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags) pglBlendFunc(GL_SRC_ALPHA, GL_SRC_COLOR); pglAlphaFunc(GL_ALWAYS, 0.0f); // Don't discard zero alpha fragments break; + case PF_Invert & PF_Invert: + pglBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO); + pglAlphaFunc(GL_GREATER, 0.5f); + break; default : // must be 0, otherwise it's an error // No blending pglBlendFunc(GL_ONE, GL_ZERO); // the same as no blending diff --git a/src/v_video.c b/src/v_video.c index 6ccddd89d..31c7eec95 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -1505,7 +1505,7 @@ void V_EncoreInvertScreen(void) #ifdef HWRENDER if (rendermode != render_soft && rendermode != render_none) { - //HWR_EncoreInvertScreen(); + HWR_EncoreInvertScreen(); return; } #endif