Skip to content
Snippets Groups Projects
Commit d310729b authored by Hannu Hanhi's avatar Hannu Hanhi
Browse files

Add tinted fade support to HWR_FadeScreenMenuBack

parent 978006bc
No related branches found
No related tags found
2 merge requests!2355fix newer versions of mixerx,!1516OpenGL palette rendering and related things
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "../st_stuff.h" #include "../st_stuff.h"
#include "../p_local.h" // stplyr #include "../p_local.h" // stplyr
#include "../g_game.h" // players #include "../g_game.h" // players
#include "../f_finale.h" // fade color factors
#include <fcntl.h> #include <fcntl.h>
#include "../i_video.h" // for rendermode != render_glide #include "../i_video.h" // for rendermode != render_glide
...@@ -783,6 +784,7 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength) ...@@ -783,6 +784,7 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
{ {
FOutVector v[4]; FOutVector v[4];
FSurfaceInfo Surf; FSurfaceInfo Surf;
FBITFIELD poly_flags = PF_NoTexture|PF_Modulated|PF_NoDepthTest;
v[0].x = v[3].x = -1.0f; v[0].x = v[3].x = -1.0f;
v[2].x = v[1].x = 1.0f; v[2].x = v[1].x = 1.0f;
...@@ -795,7 +797,29 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength) ...@@ -795,7 +797,29 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
v[0].t = v[1].t = 1.0f; v[0].t = v[1].t = 1.0f;
v[2].t = v[3].t = 0.0f; v[2].t = v[3].t = 0.0f;
if (color & 0xFF00) // Do COLORMAP fade. if (color & 0xFF00) // Special fade options
{
UINT16 option = color & 0x0F00;
if (option == 0x0A00 || option == 0x0B00) // Tinted fades
{
INT32 r, g, b;
int fade = strength * 8;
r = FADEREDFACTOR*fade/10;
g = FADEGREENFACTOR*fade/10;
b = FADEBLUEFACTOR*fade/10;
Surf.PolyColor.s.red = min(r, 255);
Surf.PolyColor.s.green = min(g, 255);
Surf.PolyColor.s.blue = min(b, 255);
Surf.PolyColor.s.alpha = 255;
if (option == 0x0A00) // Tinted subtractive fade
poly_flags |= PF_ReverseSubtract;
else if (option == 0x0B00) // Tinted additive fade
poly_flags |= PF_Additive;
}
else // COLORMAP fade
{ {
if (HWR_ShouldUsePaletteRendering()) if (HWR_ShouldUsePaletteRendering())
{ {
...@@ -810,16 +834,22 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength) ...@@ -810,16 +834,22 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
return; return;
} }
else
{
Surf.PolyColor.rgba = UINT2RGBA(0x01010160); Surf.PolyColor.rgba = UINT2RGBA(0x01010160);
Surf.PolyColor.s.alpha = (strength*8); Surf.PolyColor.s.alpha = (strength*8);
poly_flags |= PF_Translucent;
}
}
} }
else // Do TRANSMAP** fade. else // Do TRANSMAP** fade.
{ {
RGBA_t *palette = HWR_GetTexturePalette(); RGBA_t *palette = HWR_GetTexturePalette();
Surf.PolyColor.rgba = palette[color&0xFF].rgba; Surf.PolyColor.rgba = palette[color&0xFF].rgba;
Surf.PolyColor.s.alpha = softwaretranstogl[strength]; Surf.PolyColor.s.alpha = softwaretranstogl[strength];
poly_flags |= PF_Translucent;
} }
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest); HWD.pfnDrawPolygon(&Surf, v, 4, poly_flags);
} }
// -----------------+ // -----------------+
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment