mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-12-23 11:10:56 +00:00
Add tinted fade support to HWR_FadeScreenMenuBack
This commit is contained in:
parent
978006bc97
commit
d310729b54
1 changed files with 43 additions and 13 deletions
|
@ -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)
|
||||||
{
|
{
|
||||||
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,31 +797,59 @@ 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
|
||||||
{
|
{
|
||||||
if (HWR_ShouldUsePaletteRendering())
|
UINT16 option = color & 0x0F00;
|
||||||
|
if (option == 0x0A00 || option == 0x0B00) // Tinted fades
|
||||||
{
|
{
|
||||||
const hwdscreentexture_t scr_tex = HWD_SCREENTEXTURE_GENERIC2;
|
INT32 r, g, b;
|
||||||
|
int fade = strength * 8;
|
||||||
|
|
||||||
Surf.LightTableId = HWR_GetLightTableID(NULL);
|
r = FADEREDFACTOR*fade/10;
|
||||||
Surf.LightInfo.light_level = strength;
|
g = FADEGREENFACTOR*fade/10;
|
||||||
HWD.pfnMakeScreenTexture(scr_tex);
|
b = FADEBLUEFACTOR*fade/10;
|
||||||
HWD.pfnSetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
|
|
||||||
HWD.pfnDrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
|
|
||||||
HWD.pfnUnSetShader();
|
|
||||||
|
|
||||||
return;
|
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())
|
||||||
|
{
|
||||||
|
const hwdscreentexture_t scr_tex = HWD_SCREENTEXTURE_GENERIC2;
|
||||||
|
|
||||||
|
Surf.LightTableId = HWR_GetLightTableID(NULL);
|
||||||
|
Surf.LightInfo.light_level = strength;
|
||||||
|
HWD.pfnMakeScreenTexture(scr_tex);
|
||||||
|
HWD.pfnSetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
|
||||||
|
HWD.pfnDrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
|
||||||
|
HWD.pfnUnSetShader();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Surf.PolyColor.rgba = UINT2RGBA(0x01010160);
|
||||||
|
Surf.PolyColor.s.alpha = (strength*8);
|
||||||
|
poly_flags |= PF_Translucent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Surf.PolyColor.rgba = UINT2RGBA(0x01010160);
|
|
||||||
Surf.PolyColor.s.alpha = (strength*8);
|
|
||||||
}
|
}
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------+
|
// -----------------+
|
||||||
|
|
Loading…
Reference in a new issue